/* =============================================================================
   Warraq landing — stylesheet.
   Vanilla CSS. No build step. DHH: "The best code is the code you don't write."

   Structure:
     1. Design tokens       — custom properties (palette, type, spacing)
     2. Reset & base        — sensible defaults
     3. Layout primitives   — nav, hero, buttons
     4. Accessibility       — reduced motion fallback for video
============================================================================= */


/* ---------- 1. Design tokens ------------------------------------------------
   These map directly to the existing Warraq app's design system so the
   landing page and the dashboard feel like one product later. */

:root {
  /* Palette — continues the manuscript theme */
  --color-primary:        #2C1810;  /* deep manuscript brown  — headlines on light */
  --color-primary-hover:  #D4A578;  /* accent-hover pair      — used on .btn--primary:hover */
  --color-accent:         #C4956A;  /* warm gold              — CTA, highlights */
  --color-accent-dark:    #9C6E42;  /* darker gold            — for text on light bg */
  --color-accent-bg:      #F0E8DC;  /* warmer parchment       — early-access section */
  --color-surface:        #FAF8F5;  /* parchment white        — section backgrounds */
  --color-ink:            #1A0F08;  /* near-black warm        — body text */
  --color-muted:          rgba(44, 24, 16, 0.72); /* secondary copy — bumped from 0.65 → 0.72 (AUDIT P2: contrast) */

  /* Tonal expansion — additional parchment/neutral tones for sophistication.
     Every new token lives within the existing brown + gold hue family.
     No new hues; just more steps in the tonal ramp. */
  --color-parchment-mid:  #F5F1EA;                /* between surface and accent-bg — section rhythm */
  --color-raised:         #FFFDF9;                /* elevated paper — surfaces that float above */
  --color-sunk:           #EBE4D6;                /* inset paper — surfaces carved into the page */
  --color-border-whisper: rgba(44, 24, 16, 0.06); /* barely-there hairline — card edges */
  --color-border-soft:    rgba(44, 24, 16, 0.12); /* standard panel edge */
  --color-text-secondary: rgba(44, 24, 16, 0.55); /* h3 + supporting copy */
  --color-text-tertiary:  rgba(44, 24, 16, 0.40); /* timestamps, captions, metadata */

  /* Phone mockup colors (used only in sections/how_it_works.html) */
  --color-phone-bezel:    #0e0805;
  --color-phone-notch:    #0a0605;
  --color-chat-bg:        #f7efe4;

  /* Semantic — success / danger */
  --color-success:        #6FAE6A;  /* muted green — online dot, success panel */
  --color-success-ink:    #3F7B3A;  /* darker green — success icon fg */
  --color-danger:         #7A2020;  /* error text color */
  --color-danger-bg:      rgba(170, 50, 50, 0.06);
  --color-danger-border:  rgba(170, 50, 50, 0.22);

  /* Typography — Noto Naskh Arabic is a classical Naskh typeface used in
     published Arabic scholarly books for centuries. Reads with the authority
     of a printed edition. Used for both display and body. Rubik is the
     Latin fallback for brand words (MCP, Claude, ChatGPT, Gemini). */
  --font-display: "Noto Naskh Arabic", "Amiri", "Tajawal", system-ui, serif;
  --font-body:    "Noto Naskh Arabic", "Rubik", system-ui, sans-serif;

  /* Fluid type scale — clamps between mobile and desktop */
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);       /* body */
  --step-1: clamp(1.125rem, 1.05rem + 0.375vw, 1.375rem);  /* subhead */
  --step-3: clamp(2rem, 1.2rem + 3.8vw, 4.75rem);          /* h1 — bumped to 76px max for hero impact */

  /* Spacing (4px base) */
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;

  /* Radii + shadows — minimal, almost no plasticky shadows */
  --radius-sm: 4px;
  --radius-md: 8px;

  /* Motion */
  --ease-quiet: cubic-bezier(0.4, 0, 0.2, 1);
}


/* ---------- 2. Reset & base ------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;          /* in-page anchor clicks ease instead of jump */
  scroll-padding-top: 80px;         /* offset for the fixed nav */
}

body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  color: var(--color-ink);
  background: var(--color-surface);
  min-height: 100dvh;            /* dvh handles mobile browser chrome better than vh */
  overflow-x: hidden;             /* video object-fit sometimes bleeds a pixel */
}

a {
  color: inherit;
  text-decoration: none;
}

img, video {
  display: block;
  max-width: 100%;
}


/* ---------- 3. Navigation --------------------------------------------------- */

.nav {
  position: fixed;                 /* was absolute — now tracks the viewport */
  inset: 0 0 auto 0;
  z-index: 100;
  padding: var(--space-4) var(--space-6);
  transition: background-color 280ms var(--ease-quiet),
              backdrop-filter 280ms var(--ease-quiet);
}

/* Toggled by JS when the user scrolls past the hero.
   Semi-opaque dark pane + subtle blur — keeps text legible over light sections. */
.nav--scrolled {
  background-color: rgba(10, 6, 3, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(250, 248, 245, 0.05);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin-inline: auto;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-1);
  color: var(--color-surface);    /* white on dark video */
  letter-spacing: 0.01em;
  text-decoration: none;
}

.nav__brand-icon {
  display: block;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.nav__links {
  display: flex;
  gap: var(--space-6);
  color: var(--color-surface);
  font-size: 0.95rem;
  opacity: 0.9;
}

.nav__links a {
  transition: opacity 180ms var(--ease-quiet);
}

.nav__links a:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Hide nav links on small screens; brand stays visible */
@media (max-width: 640px) {
  .nav__links { display: none; }
}


/* ---------- 4. Hero --------------------------------------------------------- */

.hero {
  position: relative;
  width: 100%;
  /* Shorter than 100dvh so the works-with strip below peeks into the first
     viewport — users see "يعمل مع مساعدات الذكاء الاصطناعي" without scrolling.
     96px ≈ strip height (padding + content + padding). */
  height: calc(100dvh - 96px);
  min-height: 520px;
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* Video sits underneath everything */
.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;              /* crops to fill, prevents letterboxing */
  z-index: 1;
}

/* Gradient overlay:
   On desktop (landscape) — darken the RIGHT side where Arabic text sits.
   On mobile (portrait)    — darken the TOP third where headline sits.
   Linear gradients hand-tuned for legibility over the manuscript-brown palette. */
.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  /* Desktop: strong right → faded left. `to left` because body dir=rtl flips? No —
     the gradient always works in physical pixels regardless of document direction.
     We want DARKER on the RIGHT visually (text zone). */
  background:
    linear-gradient(to left, rgba(10, 6, 3, 0.75) 0%, rgba(10, 6, 3, 0.35) 40%, rgba(10, 6, 3, 0.05) 70%, rgba(10, 6, 3, 0) 100%);
}

@media (max-aspect-ratio: 1/1) {
  /* Mobile portrait — darken the TOP for headline legibility */
  .hero__overlay {
    background:
      linear-gradient(to bottom, rgba(10, 6, 3, 0.80) 0%, rgba(10, 6, 3, 0.45) 30%, rgba(10, 6, 3, 0.15) 55%, rgba(10, 6, 3, 0) 75%);
  }
}

/* Content sits on top of overlay.
   Layout approach: the container is 1280px max, centered. Each child element
   uses max-width + `margin-inline-start: auto` to hug the inline-end edge of
   the container — which in RTL is the visual RIGHT side. This is unambiguous
   and respects logical properties correctly (unlike `justify-items: end`,
   which flips on direction and caused the earlier centering bug). */
.hero__content {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  /* Padding scales with viewport — more air on wide screens, tight on mobile. */
  padding: clamp(2rem, 4vw, 4rem) clamp(1.5rem, 3vw, 3rem);
  color: var(--color-surface);
}

/* Every direct child hugs the inline-START (RIGHT in RTL) edge of the container,
   while being capped at its own max-width so lines stay readable. Vertical
   rhythm via margin-top on adjacent siblings.

   Direction mental model: `margin-X: auto` FILLS that side with auto space,
   pushing the element AWAY from it. So to pin content at inline-start (right
   in RTL), we fill the inline-END side with auto. Easy to get backwards —
   I got it backwards in the previous revision. */
.hero__content > * {
  margin-inline-start: 0;      /* hug the start side (right in RTL) */
  margin-inline-end: auto;     /* fill the end side (left in RTL) with auto */
}

.hero__content > * + * {
  margin-top: var(--space-6);
}

/* The positioning eyebrow — the one-line identity line above the headline.
   Small, gold, tracked. Reads as a "badge" without being decorative. */
.hero__eyebrow {
  display: block;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  max-width: 40ch;
  padding-block: var(--space-2);
  border-block: 1px solid rgba(196, 149, 106, 0.25);
  margin-bottom: var(--space-4);
}

.hero__headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-3);
  line-height: 1.15;
  letter-spacing: -0.01em;
  max-width: 18ch;                 /* was 22ch — forces 2-line break on desktop */
  color: var(--color-surface);
  text-wrap: balance;
}

.hero__subhead {
  font-family: var(--font-body);
  font-size: var(--step-1);
  line-height: 1.65;
  max-width: 42ch;
  color: rgba(250, 248, 245, 0.92);
  font-weight: 400;
}

.hero__subhead strong {
  color: var(--color-accent);
  font-weight: 700;
}

.hero__cta-row {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  /* Default flex-start works: in RTL row, flex-start is the inline-start
     side (right), which is where we want the buttons. */
  justify-content: flex-start;
  max-width: 42ch;
}

@media (max-aspect-ratio: 1/1) {
  /* Mobile portrait — stack content near the TOP of the hero (below nav),
     full-width children, left-aligned. The mobile video composition has the
     quiet zone at the top, so content sits there. */
  .hero__content {
    padding-top: calc(var(--space-12) + var(--space-8));
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }
  .hero__content > * {
    margin-inline-start: 0;     /* undo right-hug on mobile */
    margin-top: 0;
  }
  .hero__headline,
  .hero__subhead { max-width: none; }
  .hero__cta-row {
    flex-direction: column;
    justify-content: flex-start;
    max-width: none;
  }
}


/* ---------- 5. Buttons ------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 180ms var(--ease-quiet), background-color 180ms var(--ease-quiet);
  will-change: transform;
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-primary);    /* dark text on gold — high contrast */
  border-color: var(--color-accent);
}

.btn--primary:hover {
  transform: translateY(-1px);
  background: var(--color-primary-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--color-surface);
  border-color: rgba(250, 248, 245, 0.4);
}

.btn--ghost:hover {
  background: rgba(250, 248, 245, 0.08);
  border-color: rgba(250, 248, 245, 0.7);
}


/* ---------- 6. Scroll cue --------------------------------------------------- */

.hero__scroll-cue {
  position: absolute;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  opacity: 0.55;
  transition: opacity 240ms var(--ease-quiet);
}

.hero__scroll-cue:hover { opacity: 1; }

.hero__scroll-cue span {
  display: block;
  width: 2px;
  height: 40px;
  background: var(--color-surface);
  animation: scroll-pulse 2.2s var(--ease-quiet) infinite;
  transform-origin: top;
}

@keyframes scroll-pulse {
  0%, 100% { transform: scaleY(0.3); opacity: 0.4; }
  50%      { transform: scaleY(1);   opacity: 0.9; }
}


/* ---------- 7. Sections (generic rhythm used by all Phase-2 content) -------- */

.section {
  padding: var(--space-12) var(--space-6);
  position: relative;
}

@media (min-width: 768px) {
  .section { padding: calc(var(--space-12) * 1.5) var(--space-8); }
}

.section__inner {
  max-width: 1100px;
  margin-inline: auto;
}

.section__inner--narrow {
  max-width: 680px;                /* for text-heavy sections like feedback */
}

/* Section palette variants — the vertical rhythm of the page comes from
   alternating these two tones + one accent zone. Academic, calm, not busy. */
.section--light {
  background: var(--color-surface);     /* parchment */
  color: var(--color-ink);
}

.section--dark {
  background: var(--color-primary);      /* deep manuscript brown */
  color: var(--color-surface);
}

.section--accent {
  /* A warmer parchment tone — signals "this is the important ask" without
     shouting. Still light, still scholarly. */
  background: var(--color-accent-bg);
  color: var(--color-ink);
  border-block: 1px solid rgba(44, 24, 16, 0.08);
}

/* Typographic hierarchy inside sections */
.section__eyebrow {
  display: block;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-3);
}

.section--light .section__eyebrow,
.section--accent .section__eyebrow {
  color: var(--color-accent-dark);
}

.section__heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.75rem, 1.2rem + 2.5vw, 2.75rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  max-width: 24ch;
  text-wrap: balance;
  margin-bottom: var(--space-6);
}

.section__heading--small {
  font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2.25rem);
  max-width: 28ch;
}

.section__lead {
  font-size: var(--step-1);
  line-height: 1.65;
  max-width: 54ch;
  color: var(--color-muted);
  margin-bottom: var(--space-8);
}

.section--dark .section__lead {
  color: rgba(250, 248, 245, 0.75);
}

.section__lead strong {
  color: var(--color-accent);
  font-weight: 500;
}

/* Phase-2 placeholders — italic parenthetical that shows what's coming */
.section__placeholder {
  padding: var(--space-8);
  border: 1px dashed rgba(44, 24, 16, 0.15);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--color-muted);
  font-style: italic;
  background: rgba(250, 248, 245, 0.5);
}

.section--dark .section__placeholder {
  border-color: rgba(250, 248, 245, 0.15);
  background: rgba(250, 248, 245, 0.03);
  color: rgba(250, 248, 245, 0.5);
}

/* ---------- 7b. Works-with strip -------------------------------------------
   Slim compatibility band right under the hero. Positions Warraq as agent-
   agnostic — Claude is one option, not the category. Text tiles (not logos)
   for MVP to avoid trademark issues; swap when permissions land.           */

.works-with {
  background: var(--color-surface);
  border-block: 1px solid rgba(44, 24, 16, 0.1);
  padding-block: var(--space-8);   /* was --space-6, more breathing room */
}

.works-with__inner {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
}

@media (min-width: 768px) {
  .works-with__inner {
    flex-direction: row;
    justify-content: space-between;
    gap: var(--space-8);
  }
}

.works-with__label {
  font-family: var(--font-body);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  white-space: nowrap;
}

.works-with__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-6);
  list-style: none;
  padding: 0;
  margin: 0;
}

.works-with__tile {
  font-family: var(--font-body);      /* Latin typography for brand names */
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-primary);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  background: rgba(250, 248, 245, 0.6);
  letter-spacing: 0.01em;
  transition: background-color 180ms var(--ease-quiet);
}

.works-with__tile:hover {
  background: rgba(196, 149, 106, 0.12);
}

/* Logo tiles — contain an <img> rather than text.
   Height-constrained so mixed-aspect-ratio logos (Claude wide, ChatGPT medium)
   align optically. Padding is tighter vertically to account for logo bounding box. */
.works-with__tile--logo {
  padding: var(--space-2) var(--space-5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

.works-with__tile--logo img {
  display: block;
  height: 22px;
  width: auto;
  max-width: 140px;
}

/* The "coming soon" tile reads as a promise, not a brand — softer styling */
.works-with__tile--muted {
  color: var(--color-muted);
  font-style: italic;
  font-family: var(--font-display);
  background: transparent;
  border-style: dashed;
}


/* ---------- 7c. Graph power section ----------------------------------------
   Two-column layout: text (eyebrow + heading + lead + capabilities) on the
   RIGHT (inline-start in RTL — primary reading position), graph on the LEFT.
   DOM order: .graph-power__main first, .graph-power__viz second.

   Design direction: editorial/scholarly — typographic rhythm, thin rule lines,
   generous whitespace. No card borders. The graph gets real presence.
------------------------------------------------------------------------------ */

.graph-power {
  display: grid;
  gap: var(--space-12);
  align-items: center;
}

@media (min-width: 960px) {
  .graph-power {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: clamp(3rem, 6vw, 6rem);
  }
}

/* --- Text column (right in RTL) --- */

.graph-power__main {
  max-width: 560px;
}

.graph-power__heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem);
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--color-primary);
  margin-top: var(--space-3);
  margin-bottom: var(--space-4);
  max-width: 22ch;
  text-wrap: balance;
}

.graph-power__lead {
  font-size: var(--step-1);
  line-height: 1.7;
  color: var(--color-muted);
  max-width: 46ch;
  margin: 0;
  padding-bottom: var(--space-8);
}

/* --- Capabilities — editorial list, not cards --- */

.capabilities {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid rgba(44, 24, 16, 0.1);
}

.capability {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(var(--space-4), 3vw, var(--space-8));
  align-items: baseline;
  padding: var(--space-6) 0;
  border-bottom: 1px solid rgba(44, 24, 16, 0.1);
  transition: background-color 240ms var(--ease-quiet);
}

/* Hover: subtle row tint that doesn't scream "button" */
.capability:hover {
  background-color: rgba(196, 149, 106, 0.04);
}

.capability__marker {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 3.5vw, 2.75rem);
  font-weight: 400;
  color: var(--color-accent);
  line-height: 1;
  min-width: 1.5ch;
  text-align: center;
  /* Optical adjustment — Arabic abjad sits on a higher baseline than Latin;
     bump it down a touch so it visually aligns with the bold label. */
  align-self: center;
  opacity: 0.8;
}

.capability__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.capability__label {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.6vw, 1.625rem);
  font-weight: 700;
  color: var(--color-primary);
  margin: 0;
  line-height: 1.2;
}

.capability__desc {
  font-size: 0.975rem;
  line-height: 1.7;
  color: var(--color-muted);
  margin: 0;
  max-width: 42ch;
}

/* --- Graph column (left in RTL) --- */

.graph-power__viz {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  /* Optical: pull graph in slightly so it doesn't touch section padding */
  padding-block: var(--space-4);
}

.graph-svg {
  width: 100%;
  max-width: 620px;
  height: auto;
  display: block;
  overflow: visible;              /* let node shadows escape viewBox */
}

/* Edges — warm gold, slightly translucent, rounded caps.
   JS sets stroke-dasharray/dashoffset before the animation plays. */
.graph-edge {
  opacity: 0.55;
  stroke: var(--color-accent);
  transition: opacity 220ms var(--ease-quiet);
}

/* Nodes — three-layer construction:
     1. halo     — soft filled circle (visual mass, subtle)
     2. ring     — stroke-only circle (defines the node silhouette)
     3. dot      — small filled circle (the "point" — shadowed)
*/
.graph-node__halo {
  fill: var(--color-accent);
  opacity: 0.10;
}

.graph-node__ring {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 1.5;
  opacity: 0.55;
}

.graph-node__dot {
  fill: var(--color-accent);
}

/* Book nodes — peer-sized, use deep manuscript brown (the "subject" nodes) */
.graph-node--book .graph-node__halo {
  fill: var(--color-primary);
  opacity: 0.10;
}

.graph-node--book .graph-node__ring {
  stroke: var(--color-primary);
  stroke-width: 2;
  opacity: 0.65;
}

.graph-node--book .graph-node__dot {
  fill: var(--color-primary);
}

/* Bridge node — the shared concept. Warm gold, ties the books together. */
.graph-node--bridge .graph-node__halo {
  fill: var(--color-accent);
  opacity: 0.16;
}

.graph-node--bridge .graph-node__ring {
  stroke: var(--color-accent);
  stroke-width: 1.75;
  opacity: 0.7;
}

.graph-node--bridge .graph-node__dot {
  fill: var(--color-accent);
}

/* Leaf nodes — smaller, supporting (citation, note, author) */
.graph-node--leaf .graph-node__halo {
  fill: var(--color-accent);
  opacity: 0.08;
}

.graph-node--leaf .graph-node__ring {
  stroke: var(--color-accent);
  stroke-width: 1.25;
  opacity: 0.5;
}

.graph-node--leaf .graph-node__dot {
  fill: var(--color-accent);
}

.graph-node__label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 400;
  fill: var(--color-muted);
  direction: rtl;
  letter-spacing: 0;
}

.graph-node__label--book {
  font-size: 16px;
  font-weight: 700;
  fill: var(--color-primary);
}

/* Metadata subtext — author name + Hijri year under each book title */
.graph-node__meta {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  fill: var(--color-text-tertiary);
  direction: rtl;
  letter-spacing: 0;
}

/* Ghost layer — peripheral "8000 library at rest" signal.
   Reduced opacity + smaller label puts these nodes visually behind the main trio. */
.graph-node--ghost { opacity: 0.35; }
.graph-node--ghost .graph-node__label { font-size: 11px; font-weight: 400; }
.graph-edge--ghost { stroke-opacity: 0.3; }


/* ---------- 7d. How-it-works — phone-frame chat demo -----------------------
   Stylized mobile device centered in the section. Chat messages appear
   inside the phone screen sequentially. Pinned by GSAP + ScrollTrigger.
------------------------------------------------------------------------------ */

/* Section sits at its natural content height — heading + phone + padding.
   The scrub animation plays over the user's natural scroll through the
   section (~70% of viewport height), no fake min-height inflation. */
.demo-inner {
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
}

/* --- Section header (above the phone) --- */

.demo-header {
  text-align: center;
  max-width: 640px;
}

.demo-header__heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem);
  line-height: 1.2;
  color: var(--color-surface);
  margin: var(--space-3) 0 var(--space-4);
  text-wrap: balance;
}

.demo-header__lead {
  font-size: var(--step-1);
  line-height: 1.65;
  color: rgba(250, 248, 245, 0.75);
  margin: 0;
  text-wrap: pretty;
}

/* --- Phone frame ---
   Stylized mobile device — realistic enough to read as "phone," abstract
   enough not to clone any specific brand. */

.phone {
  width: 100%;
  display: flex;
  justify-content: center;
}

.phone__frame {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--color-phone-bezel);
  border-radius: 44px;
  padding: 14px;
  box-shadow:
    0  0  0 1px rgba(196, 149, 106, 0.22),     /* warm rim */
    0 30px 60px rgba(0, 0, 0, 0.45),            /* deep drop shadow */
    inset 0 0 0 1px rgba(0, 0, 0, 0.6);         /* inner bevel */
  overflow: hidden;
}

/* Notch — the small pill at the top of modern phones */
.phone__notch {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 26px;
  background: var(--color-phone-notch);
  border-radius: 14px;
  z-index: 3;
}

/* Home indicator — the thin line at the bottom of iOS */
.phone__indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  background: rgba(250, 248, 245, 0.4);
  border-radius: 2px;
  z-index: 3;
}

.phone__screen {
  background: var(--color-chat-bg);
  border-radius: 32px;
  overflow: hidden;
  min-height: 620px;
  display: flex;
  flex-direction: column;
}

/* --- Chat app inside the screen --- */

.chat-app {
  display: flex;
  flex-direction: column;
  height: 620px;
}

.chat-app__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 40px 20px 14px;                      /* extra top for notch clearance */
  border-bottom: 1px solid rgba(44, 24, 16, 0.08);
  background: rgba(255, 255, 255, 0.65);
}

.chat-app__title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
}

.chat-app__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-muted);
}

.chat-app__status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 2px rgba(111, 174, 106, 0.2);
}

.chat-app__messages {
  flex: 1;
  overflow: hidden;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-app__input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 20px;                      /* extra bottom for home indicator */
  border-top: 1px solid rgba(44, 24, 16, 0.08);
  background: rgba(255, 255, 255, 0.6);
}

.chat-app__input-field {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: rgba(44, 24, 16, 0.4);
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  border: 1px solid rgba(44, 24, 16, 0.08);
}

.chat-app__input-send {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--color-accent);
  color: white;
  border-radius: 50%;
  font-size: 1.125rem;
  font-weight: 700;
}

/* --- Messages: user + loading + assistant --- */

.msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

/* RTL chat convention: your own messages align to inline-end (visually LEFT) */
.msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg--assistant {
  align-self: flex-start;
  align-items: flex-start;
  max-width: 92%;
}

.msg--loading {
  align-self: flex-start;
  align-items: flex-start;
  max-width: 60%;
}

.msg__bubble {
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 10px 14px;
  border-radius: 16px;
}

.msg--user .msg__bubble {
  background: var(--color-primary);
  color: var(--color-surface);
  border-bottom-left-radius: 4px;              /* speech-tail corner */
  min-height: 2.6em;
}

.msg--assistant .msg__bubble {
  background: rgba(196, 149, 106, 0.12);
  color: var(--color-primary);
  border-bottom-right-radius: 4px;
}

.msg__text {
  font-family: var(--font-display);
  font-weight: 400;
}

.msg__cursor {
  display: inline-block;
  width: 0.08em;
  color: var(--color-accent);
  font-weight: 400;
  animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
  50% { opacity: 0; }
}

.msg__intro {
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0;
  color: var(--color-primary);
}

.msg__meta {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-top: 4px;
  padding-inline: 4px;
}

/* --- Loading typing dots --- */

.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(196, 149, 106, 0.12);
  border-radius: 16px;
  border-bottom-right-radius: 4px;
}

.typing__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  opacity: 0.6;
  animation: dot-pulse 1.4s var(--ease-quiet) infinite;
}

.typing__dot:nth-child(1) { animation-delay: 0s;    }
.typing__dot:nth-child(2) { animation-delay: 0.2s;  }
.typing__dot:nth-child(3) { animation-delay: 0.4s;  }

@keyframes dot-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.3); }
}

/* --- Mini passages (inside the assistant bubble area) --- */

.mini-passage {
  width: 92%;
  align-self: flex-start;
  background: white;
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 4px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.04);
  border-inline-start: 2px solid var(--color-accent);
}

.mini-passage__cite {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(44, 24, 16, 0.08);
}

.mini-passage__book {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.mini-passage__meta {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-muted);
  letter-spacing: 0.02em;
}

.mini-passage__text {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-ink);
  margin: 0;
}


/* ---------- 7e. Connect section — three-step guide ------------------------
   Three typographic steps. Large Eastern-Arabic digits (thin gold) anchor
   each step. On desktop, thin dashed vertical dividers BETWEEN cards signal
   sequence without being a "process-diagram" cliche. Stacks on mobile.
------------------------------------------------------------------------------ */

.steps {
  list-style: none;
  padding: 0;
  margin: var(--space-12) 0 0 0;
  display: grid;
  gap: var(--space-8);
}

@media (min-width: 880px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 0;                             /* gap handled by per-step padding */
  }
}

.step {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-block: var(--space-6);
  /* Micro-interaction: whole card lifts subtly on hover.
     Pure CSS, no JS. Cubic-bezier inspired by yui540's "natural overshoot"
     aesthetic — a calm rise, not a bounce. */
  transition: transform 380ms cubic-bezier(0.34, 1.35, 0.64, 1);
}

/* Header wrapper: on desktop it's transparent (number + title stack as before).
   On mobile the wrapper becomes a flex row so number and title sit side-by-side,
   and reordering puts it FIRST in the card so the step identity reads before
   the mockup. */
.step__header {
  display: contents;       /* desktop: children behave as direct step children */
}

@media (max-width: 879px) {
  .step {
    gap: var(--space-4);
    padding-block: var(--space-5);
  }

  /* Mobile layout order: header (number + title) → mockup → desc → help */
  .step__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    order: 1;
  }
  .step__preview { order: 2; margin-bottom: 0; }
  .step__desc    { order: 3; }
  .step__help    { order: 4; }

  /* Mobile number: smaller, inline with title, no bottom margin */
  .step__number {
    font-size: 2.25rem;
    line-height: 1;
    margin-bottom: 0;
    flex-shrink: 0;
    opacity: 0.75;
  }

  .step__title {
    margin: 0;
    font-size: 1.25rem;
    max-width: none;
  }

  .step__preview {
    min-height: 160px;
    padding: var(--space-3);
  }
}

.step:hover {
  transform: translateY(-4px);
}

.step:hover .step__number {
  transform: scale(1.04);
  opacity: 0.95;
}

.step:hover .step__preview {
  box-shadow: 0 24px 48px rgba(44, 24, 16, 0.14),
              0 2px 6px rgba(196, 149, 106, 0.18);
}

/* Dashed divider between cards on desktop.
   `border-inline-start` in RTL = physical right edge. Since DOM order step1-2-3
   renders right-to-left, each step's right edge butts against the previous
   step. So a border-inline-start on every step EXCEPT the first draws the
   divider BETWEEN cards. */
@media (min-width: 880px) {
  .step {
    padding: var(--space-6) var(--space-6);
  }

  .step:not(:first-child) {
    border-inline-start: 1px dashed rgba(44, 24, 16, 0.18);
  }
}

/* Step number transitions with the hover */
.step__number {
  transition: transform 380ms cubic-bezier(0.34, 1.35, 0.64, 1),
              opacity 380ms ease;
  transform-origin: center left;        /* RTL start side */
}

.step__number {
  font-family: var(--font-display);
  font-size: clamp(4rem, 4vw + 2rem, 5.5rem);
  font-weight: 400;
  color: var(--color-accent);
  line-height: 1;
  opacity: 0.82;
  margin-bottom: var(--space-3);
}

.step__title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.6vw, 1.5rem);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.25;
  margin: 0;
  max-width: 22ch;
  text-wrap: balance;
}

.step__desc {
  font-size: 0.975rem;
  line-height: 1.75;
  color: var(--color-muted);
  margin: 0;
  max-width: 34ch;
}

/* Inline term — the technical words (MCP, Connectors) get a subtle
   monospace-like treatment so they read as UI/code references, not marketing. */
.step__term {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  padding: 0.08em 0.35em;
  background: rgba(196, 149, 106, 0.1);
  border-radius: 3px;
  font-size: 0.92em;
  letter-spacing: 0.01em;
}

/* ---------- Step mini-UI mockups -------------------------------------------
   Each step has a small visualized preview of what happens. All three
   mockups share the same outer frame (.step__preview) for alignment, and
   each has its own inner content (form, panel, or chat).                   */

.step__preview {
  background: white;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow:
    0 1px 2px rgba(44, 24, 16, 0.04),
    0 8px 20px rgba(44, 24, 16, 0.06);
  transition: box-shadow 380ms cubic-bezier(0.34, 1.35, 0.64, 1);
  overflow: hidden;
}

.mock {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- Mock 1: Signup form with URL pill underneath --- */

.mock--form {
  gap: 8px;
}

.mock-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mock-field__label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  color: var(--color-muted);
  letter-spacing: 0.02em;
}

.mock-field__bar {
  height: 8px;
  background: rgba(44, 24, 16, 0.06);
  border-radius: 3px;
}

.mock-button {
  margin-top: 6px;
  align-self: flex-start;
  background: var(--color-accent);
  color: white;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 5px;
  letter-spacing: 0.02em;
}

.mock-url {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(196, 149, 106, 0.1);
  border: 1px dashed rgba(196, 149, 106, 0.5);
  border-radius: 5px;
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--color-primary);
  letter-spacing: 0.01em;
}

.mock-url__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  flex-shrink: 0;
}

.mock-url__text {
  font-variant-numeric: tabular-nums;
  direction: ltr;                       /* URL reads left-to-right */
}

/* --- Mock 2: Connectors panel --- */

.mock--panel {
  gap: 4px;
}

.mock-panel__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(44, 24, 16, 0.08);
  margin-bottom: 4px;
}

.mock-panel__dot {
  width: 6px;
  height: 6px;
  background: var(--color-muted);
  border-radius: 2px;
}

.mock-panel__title {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.02em;
}

.mock-panel__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 4px;
}

.mock-panel__icon {
  width: 16px;
  height: 16px;
  background: rgba(44, 24, 16, 0.08);
  border-radius: 3px;
  flex-shrink: 0;
}

.mock-panel__row-label {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--color-muted);
  flex: 1;
}

.mock-panel__row--active {
  background: rgba(196, 149, 106, 0.1);
  border: 1px solid rgba(196, 149, 106, 0.3);
}

.mock-panel__icon--active {
  background: var(--color-accent);
}

.mock-panel__row--active .mock-panel__row-label {
  color: var(--color-primary);
  font-weight: 600;
}

.mock-panel__badge {
  font-family: var(--font-body);
  font-size: 8.5px;
  font-weight: 700;
  color: var(--color-accent);
  padding: 2px 6px;
  background: white;
  border-radius: 3px;
  border: 1px solid rgba(196, 149, 106, 0.3);
  letter-spacing: 0.05em;
}

/* --- Mock 3: Chat with question + passage result --- */

.mock--chat {
  gap: 10px;
}

.mock-chat__user {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  background: var(--color-primary);
  color: var(--color-surface);
  border-radius: 12px;
  border-bottom-left-radius: 3px;
  max-width: 85%;
}

.mock-chat__q {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent);
}

.mock-chat__text {
  font-family: var(--font-display);
  font-size: 10.5px;
  line-height: 1.4;
}

.mock-chat__passage {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  background: rgba(250, 248, 245, 0.9);
  border-inline-start: 2px solid var(--color-accent);
  border-radius: 6px;
  max-width: 92%;
}

.mock-chat__book {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.mock-chat__meta {
  font-family: var(--font-body);
  font-size: 8.5px;
  color: var(--color-muted);
  letter-spacing: 0.01em;
}

.mock-chat__quote {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--color-ink);
  line-height: 1.5;
  margin-top: 2px;
}

/* --- Help links (beneath step 2) --- */

.step__help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px dashed rgba(44, 24, 16, 0.12);
  font-family: var(--font-body);
  font-size: 0.85rem;
}

.step__help-label {
  color: var(--color-muted);
  letter-spacing: 0.02em;
}

.step__help-link {
  color: var(--color-primary);
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(196, 149, 106, 0.08);
  transition: background-color 200ms var(--ease-quiet),
              color 200ms var(--ease-quiet);
}

.step__help-link:hover {
  background: rgba(196, 149, 106, 0.2);
  color: var(--color-accent);
}

.step__help-link::after {
  content: " ↗";
  font-size: 0.85em;
  opacity: 0.6;
}

.step__help-sep {
  color: var(--color-muted);
  opacity: 0.4;
}


/* ---------- 7f. Forms (early access + footer ask) --------------------------
   Shared form styling for both the early-access signup and the feedback form.
   HTMX handles submission — loading state shown via `.htmx-request` class on
   the form, success/error handled by swapping the form element itself.
------------------------------------------------------------------------------ */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-top: var(--space-8);
  max-width: 520px;
}

.form__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form__label {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-primary);
  letter-spacing: 0.01em;
}

.form__hint {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--color-muted);
  font-style: normal;
}

.form__input,
.form__textarea,
.form__select {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.55;
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(44, 24, 16, 0.18);
  border-radius: var(--radius-md);
  color: var(--color-ink);
  transition: border-color 200ms var(--ease-quiet),
              background-color 200ms var(--ease-quiet),
              box-shadow 200ms var(--ease-quiet);
  appearance: none;         /* reset native select chrome */
  -webkit-appearance: none;
}

.form__input::placeholder,
.form__textarea::placeholder {
  color: rgba(44, 24, 16, 0.35);
}

.form__input:focus-visible,
.form__textarea:focus-visible,
.form__select:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  background: white;
  box-shadow: 0 0 0 3px rgba(196, 149, 106, 0.18);
}

.form__textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.7;
}

/* Custom chevron for <select> (no native select styling) */
.form__select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232C1810' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;       /* RTL: chevron on the left */
  padding-inline-end: var(--space-4);
  padding-inline-start: 40px;
  cursor: pointer;
}

.form__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

/* Loading dots — hidden by default, shown during HTMX request */
.form__loading {
  display: none;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-muted);
}

.htmx-request .form__loading {
  display: inline-flex;
}

.htmx-request .form__submit {
  opacity: 0.55;
  pointer-events: none;
}

.form__loading-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
  animation: dot-pulse 1.4s var(--ease-quiet) infinite;
}

.form__loading-dot:nth-child(1) { animation-delay: 0s;    }
.form__loading-dot:nth-child(2) { animation-delay: 0.2s;  }
.form__loading-dot:nth-child(3) { animation-delay: 0.4s;  }

/* --- Success panel (swapped in by HTMX after a successful submit) --- */

.form-success {
  margin-top: var(--space-8);
  padding: var(--space-6);
  background: rgba(111, 174, 106, 0.08);
  border: 1px solid rgba(111, 174, 106, 0.25);
  border-radius: var(--radius-md);
  max-width: 520px;
}

.form-success__icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(111, 174, 106, 0.18);
  color: var(--color-success-ink);
  margin-bottom: var(--space-4);
}

.form-success__title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0 0 var(--space-3);
  line-height: 1.3;
}

.form-success__body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-ink);
  margin: 0;
  max-width: 46ch;
}

.form-success__body strong {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--color-primary);
  background: rgba(196, 149, 106, 0.14);
  padding: 0.08em 0.4em;
  border-radius: 3px;
}

.form-success__hint {
  margin-top: var(--space-4);
  font-size: 0.95rem;
  color: var(--color-muted);
  line-height: 1.7;
}

.form-success__hint a {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(196, 149, 106, 0.4);
}

.form-success__hint a:hover {
  text-decoration-color: var(--color-accent);
}

/* Error slot container — empty by default, populated by HTMX on validation
   failure (HX-Retarget points to #<form-id>-errors). Keeps form intact. */
.form-errors {
  display: contents;
}

.form-errors:empty {
  display: none;
}

/* --- Error panel (injected into .form-errors slot on validation failure) --- */

.form-error {
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--color-danger);
  line-height: 1.6;
  max-width: 520px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
}

.form-error strong {
  font-weight: 700;
  margin-inline-end: 4px;
}

/* Error panel sits inside .form-errors slot — auto-scrolls into view when
   HTMX injects it, triggering the aria-live region. */
.form-errors .form-error {
  animation: form-error-flash 380ms var(--ease-quiet);
}

@keyframes form-error-flash {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ---------- 8. Footer ------------------------------------------------------- */

.footer {
  background: var(--color-ink);
  color: var(--color-surface);
  padding: var(--space-8) var(--space-6);
}

.footer__inner {
  max-width: 1100px;
  margin-inline: auto;
  display: grid;
  gap: var(--space-6);
  align-items: center;
}

@media (min-width: 768px) {
  .footer__inner {
    grid-template-columns: 1fr auto 1fr;
    gap: var(--space-8);
  }
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer__brand strong {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--color-surface);
}

.footer__tagline {
  font-size: 0.875rem;
  color: rgba(250, 248, 245, 0.55);
}

.footer__links {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.95rem;
}

.footer__links a {
  color: rgba(250, 248, 245, 0.75);
  transition: color 180ms var(--ease-quiet);
}

.footer__links a:hover {
  color: var(--color-accent);
}

.footer__meta {
  font-size: 0.85rem;
  color: rgba(250, 248, 245, 0.5);
  text-align: start;
}

@media (min-width: 768px) {
  .footer__meta { text-align: end; }
}


/* ---------- 8. Accessibility — focus rings + reduced motion + skip link ----
   Global keyboard-navigation safety net. Every interactive element gets a
   visible focus indicator; reduced-motion is respected for every animation
   (including the decorative CSS keyframes); skip link appears on focus only.
------------------------------------------------------------------------------ */

/* Global focus-visible — shown only for keyboard navigation, not mouse click.
   Warm gold outline offset from the element so it doesn't collide with rounded
   corners. Applies to all <a>, <button>, <input>, <select>, <textarea>, and
   any element with tabindex="0". */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Form inputs already have their own focus treatment (border + ring).
   Keep that, but suppress the default outline ring to avoid doubling up. */
.form__input:focus-visible,
.form__textarea:focus-visible,
.form__select:focus-visible {
  outline-offset: -1px;
  outline-color: transparent;
}

/* Skip link — visually hidden until focused, then appears at the top.
   Lets keyboard users jump past the nav + hero directly to main content. */
.skip-link {
  position: absolute;
  top: var(--space-3);
  inset-inline-start: var(--space-3);
  z-index: 1000;
  padding: var(--space-3) var(--space-5);
  background: var(--color-primary);
  color: var(--color-surface);
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: var(--radius-md);
  transform: translateY(-150%);
  transition: transform 180ms var(--ease-quiet);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* Reduced motion — suppress every animation + transition for vestibular safety */
@media (prefers-reduced-motion: reduce) {
  .hero__video { display: none; }

  .hero {
    background-image: var(--hero-poster-url);   /* overridden inline in template */
    background-size: cover;
    background-position: center;
  }

  /* Kill every CSS keyframe + transition — GSAP scripts also respect this */
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}


/* ---------- 9. Mobile navigation — slide-down menu -------------------------
   Under 640px, the 3 nav links hide — replaced by a hamburger button that
   toggles a full-width slide-down panel. Pure CSS + a small vanilla-JS
   aria-expanded toggle (in _scripts.html). Touch target: 44×44 min.
------------------------------------------------------------------------------ */

.nav__toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(250, 248, 245, 0.22);
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 0;
  transition: background-color 180ms var(--ease-quiet),
              border-color 180ms var(--ease-quiet);
}

.nav__toggle:hover {
  background: rgba(250, 248, 245, 0.08);
  border-color: rgba(250, 248, 245, 0.45);
}

.nav__toggle-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 20px;
}

.nav__toggle-bars span {
  display: block;
  height: 2px;
  background: var(--color-surface);
  border-radius: 1px;
  transition: transform 240ms var(--ease-quiet),
              opacity 240ms var(--ease-quiet);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bars span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav__toggle[aria-expanded="true"] .nav__toggle-bars span:nth-child(2) {
  opacity: 0;
}
.nav__toggle[aria-expanded="true"] .nav__toggle-bars span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 640px) {
  .nav__toggle {
    display: inline-flex;
  }

  /* Slide-down panel; hidden by default, revealed when aria-expanded=true */
  .nav__links {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    padding: var(--space-4) var(--space-6) var(--space-6);
    background: rgba(10, 6, 3, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    gap: var(--space-4);
    font-size: 1.125rem;
    border-top: 1px solid rgba(250, 248, 245, 0.1);

    /* Hidden state */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 240ms var(--ease-quiet),
                transform 240ms var(--ease-quiet),
                visibility 0s linear 240ms;
  }

  .nav__toggle[aria-expanded="true"] ~ .nav__links,
  .nav[data-menu-open="true"] .nav__links {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
  }

  .nav__links a {
    padding: var(--space-2) 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}


/* ---------- 10. Touch-target increases on mobile --------------------------- */

@media (max-width: 640px) {
  /* Help links under step 2 — bumped from 2px×6px to 44px min height */
  .step__help-link {
    padding: 8px 12px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .step__help {
    gap: var(--space-2);
    row-gap: var(--space-3);
  }
}
