/* Graph Player app styles. Tailwind (CDN) covers most utilities; this file
   holds the few classes the renderer adds directly. */

.nav-active {
  font-weight: 600;
  color: #1e293b;
  background-color: #f1f5f9;
}

/* App theme tokens (from the Spinn prototype: ink/muted/line/surface). Provided
   as utilities so component templates can use them like Tailwind classes. */
.text-ink {
  color: #172033;
}
.text-muted {
  color: #667085;
}
.border-line {
  border-color: #e4e7ec;
}
.bg-surface {
  background-color: #f8fafc;
}

/* A hero-led page suppresses the generic page <h1> (the hero provides the
   heading), so an empty page title reserves no space. */
.page-title:empty {
  display: none;
}
.hero-eyebrow:empty,
.hero-lead:empty {
  display: none;
}
/* A Chat whose ComponentInstance sets `showTitle: false` renders an empty heading
   (e.g. its Section already shows the title); collapse it so it reserves no space. */
.chat-title:empty {
  display: none;
}

/* List orientation (List.orientation drives the container layout). */
.list-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.list-horizontal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

/* Card component (card-list children): a horizontal card — rounded icon badge on
   the left, title + subtitle in the middle, chevron on the right. Most styling is
   Tailwind utilities in card.htm; this holds the chevron and the danger treatment. */

/* Chevron affordance (thin ">" drawn with borders — no inline SVG, so it survives
   the template parser's attribute lowercasing). */
.card-chevron {
  width: 0.5rem;
  height: 0.5rem;
  border-top: 2px solid #cbd5e1; /* slate-300 */
  border-right: 2px solid #cbd5e1;
  transform: rotate(45deg);
}
.card:hover .card-chevron {
  border-color: #94a3b8; /* slate-400 */
}

/* The semantic `variant` on a ListItem expresses intent (default/danger); the
   implementation maps `danger` to a red badge + accent. The graph never stores the
   colour — only the intent. (Attribute selector out-specifies the Tailwind badge
   utilities, so the red badge wins.) */
.card[data-variant="danger"] {
  border-color: #fecaca; /* red-200 */
}
.card[data-variant="danger"] .card-icon {
  background-color: #fee2e2; /* red-100 */
  color: #dc2626; /* red-600 */
}
.card[data-variant="danger"] .card-title {
  color: #b91c1c; /* red-700 */
}
.card[data-variant="danger"] .card-chevron {
  border-color: #f87171; /* red-400 */
}

/* An empty card slot (e.g. ListItem.hint === null) should not reserve space. */
.card-hint:empty,
.card-description:empty,
.card-icon:empty {
  display: none;
}

/* Brand accent (teal), defined once so the active tab + input focus share it. */
:root {
  --brand: #0e7490; /* cyan-700 */
}

/* Active tab in a graph-rendered tab-panel (.js-tabs): teal text + teal underline
   (matches the form design). */
.tab-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  border-bottom-width: 3px;
  font-weight: 700;
}

/* Form-page styling (scoped). The form design places the tab strip and all
   field-group sections on a SINGLE rounded white card, with flat section groups and
   large light-gray section headings. This is scoped to a tabbed form page via
   `.page-body:has(.tab-panel)` — the form page renders a tab-panel; the start page
   (hero + card grid + its own top-level sections) does NOT, so it is left entirely
   unchanged. All form-specific look lives here so the shared section.htm template
   keeps its default (start-page) appearance. */
.page-body:has(.tab-panel) {
  background: #ffffff;
  border: 1px solid #e4e7ec; /* line token */
  border-radius: 1rem;
  padding: 1.5rem 2rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
/* Inside the form card, field-group sections are flat groups (no per-section card)
   with a large, light-weight gray heading. Overrides the section.htm inline
   utilities only within the form context. */
.page-body:has(.tab-panel) .section {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  margin-bottom: 0.5rem;
}
.page-body:has(.tab-panel) .section-heading {
  font-size: 1.5rem; /* text-2xl */
  line-height: 2rem;
  font-weight: 300; /* font-light */
  color: #64748b; /* slate-500 */
}

/* Modal overlay. Visibility is class-driven (.is-open) rather than the `hidden`
   attribute, so a Tailwind display utility can't defeat it. */
.js-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: rgba(15, 23, 42, 0.45);
}
.js-modal.is-open {
  display: flex;
}

/* Dropdown / action menu. Absolutely positioned; the client module sets its
   top/left from the trigger. Visibility is class-driven, like the modal. */
.js-menu {
  position: absolute;
  z-index: 60;
  display: none;
  min-width: 12rem;
  padding: 0.25rem;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}
.js-menu.is-open {
  display: block;
}

/* A graph element that navigates (non-empty data-nav-href) reads as clickable. */
[data-nav-href]:not([data-nav-href=""]) {
  cursor: pointer;
}

/* Read-only field state. A field wrapper the renderer marked read-only carries
   data-readonly="true" (from DataBinding.readOnly / renderMode). This is a legible,
   NOT-disabled treatment: normal-contrast text on a subtle surface, a default
   cursor, and no focus/hover affordance suggesting editability. It is distinct from
   `:disabled` (we never disable — the value stays in form state and is submitted).
   Attribute selectors out-specify the Tailwind utilities in the field templates. */
[data-readonly="true"] .js-field {
  background-color: #f1f5f9; /* slate-100 — grayer disabled fill, matching the design */
  color: #64748b; /* slate-500 — muted, still legible */
  text-transform: uppercase;
  cursor: default;
}
[data-readonly="true"] .js-field:focus {
  /* Keep a visible focus ring (stays focusable) but no edit affordance. */
  outline: 2px solid #cbd5e1; /* slate-300 */
  outline-offset: 1px;
}
/* A read-only file dropzone: no clickable/dashed affordance. */
[data-readonly="true"] .js-dropzone {
  cursor: default;
  border-style: solid;
  opacity: 0.85;
}

/* Back-variant button (ComponentInstance.variant === "back"): a ghost/link-style
   control with a left-pointing arrow. The variant is a styling decision on the
   instance/renderer; the semantic Button only carries the NAVIGATE_BACK action.
   The attribute selector out-specifies the Tailwind utilities in button.htm. */
.js-graph-button[data-variant="back"] {
  border-color: transparent;
  background-color: transparent;
  color: #475569; /* slate-600 */
  padding-left: 0.25rem;
  padding-right: 0.5rem;
}
.js-graph-button[data-variant="back"]:hover {
  background-color: #f1f5f9; /* slate-100 */
  color: #1e293b; /* slate-800 */
}

/* Decorative left arrow (border-drawn, like .card-chevron, so no inline SVG is
   parsed). aria-hidden in the markup — the visible "Tillbaka" text is the name. */
.back-arrow {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

/* HoverIcon help tooltip (a composed Help feature — see scripts/hover-icon.js).
   The tip is hidden by default (the `hidden` attribute in hover-icon.htm) and
   revealed on hover OR keyboard focus. This CSS is the no-JS baseline; the module
   additionally toggles the `hidden` attribute + aria-expanded and handles Escape.
   Reveal must cover BOTH mouse (hover) and keyboard (focus-within) so help is never
   mouse-only (accessibility). `display:block` beats the `hidden` attribute's
   `display:none` via specificity while the trigger is hovered/focused. */
.hover-help:hover .hover-help-tooltip,
.hover-help:focus-within .hover-help-tooltip {
  display: block;
}
