/* ─────────────────────────────────────────────────────────────────────────────
   Narrative — marketing site stylesheet.

   Hand-rolled (no Tailwind build step), speaking the same design language as
   the rest of the Renkara marketing estate: HSL-triplet custom properties, a
   `.dark` class on <html>, an --accent token every component reads through,
   and a card helper. Narrative's brand accent is rose; everything else
   inherits the shared navy/slate scale.

   Contrast: every colour pairing below clears WCAG 2.1 AA (4.5:1 body text,
   3:1 large text / non-text UI) on BOTH themes. The rose scale is split into
   three tokens for exactly that reason — --brand is decorative only,
   --brand-text is the AA-safe text/fill colour on light surfaces,
   --brand-on-tint is the AA-safe colour on the rose tint.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --background: 210 33% 98%;
  --foreground: 217 48% 20%;
  --card: 0 0% 100%;
  --card-foreground: 217 48% 20%;
  --muted: 210 20% 95%;
  --muted-foreground: 216 14% 30%;
  --border: 214 32% 91%;
  --navy: 217 48% 20%;

  /* Rose brand scale */
  --brand: 347 77% 50%;          /* rose-600 — decorative / large text */
  --brand-text: 345 83% 41%;     /* rose-700 — AA text on white, AA fill w/ white text */
  --brand-on-tint: 343 80% 35%;  /* rose-800 — AA text on the rose tint */
  --brand-tint: 356 100% 95%;    /* rose-100 */

  --accent: var(--brand-text);
  --radius: 0.625rem;
  --shell-max: 1200px;

  /* Terminal card — deliberately theme-invariant */
  --term-bg: 222 22% 12%;
  --term-fg: 210 25% 88%;
  --term-dim: 215 12% 58%;
  --term-ok: 152 60% 60%;
}

.dark {
  --background: 220 18% 14%;
  --foreground: 210 33% 95%;
  --card: 220 16% 18%;
  --card-foreground: 210 33% 95%;
  --muted: 220 14% 22%;
  --muted-foreground: 216 14% 74%;
  --border: 220 14% 28%;
  --navy: 210 33% 95%;

  /* Lifted so rose-as-text clears 4.5:1 on the dark card surface. */
  --brand: 351 95% 71%;          /* rose-400 */
  --brand-text: 351 95% 71%;
  --brand-on-tint: 352 96% 80%;
  --brand-tint: 345 45% 20%;
}

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

img { max-width: 100%; display: block; }
a { color: hsl(var(--accent)); }
code { font-family: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.925em; }

.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── A11y helpers ────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: hsl(var(--brand-text));
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  z-index: 100;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid hsl(var(--brand));
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Theme-conditional assets ────────────────────────────────────────── */
.mark-dark, .shot-dark, .dark .mark-light, .dark .shot-light { display: none; }
.dark .mark-dark, .dark .shot-dark { display: block; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.8rem 1.5rem;
  min-height: 44px;
  border-radius: 999px;
  border: 2px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
.btn svg { width: 1.1em; height: 1.1em; }
.btn-sm { font-size: 0.9rem; padding: 0.5rem 1.1rem; }

.btn-primary {
  background: hsl(var(--brand-text));
  color: #fff;
}
.btn-primary:hover { box-shadow: 0 8px 24px hsl(var(--brand) / 0.35); }
.dark .btn-primary { background: hsl(345 83% 46%); color: #fff; }

.btn-ghost {
  background: transparent;
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}
.btn-ghost:hover { border-color: hsl(var(--brand)); color: hsl(var(--brand-text)); }

/* ── Header ──────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border));
}
.site-header .shell {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: hsl(var(--foreground));
}
.brand img { border-radius: 7px; }
.brand-word { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-word span { color: hsl(var(--brand)); }

.site-nav {
  display: flex;
  gap: 1.4rem;
  margin-left: auto;
}
.site-nav a {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 0;
}
.site-nav a:hover { color: hsl(var(--brand-text)); }

.header-actions { display: flex; align-items: center; gap: 0.6rem; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 10px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-sun, .dark .icon-moon { display: none; }
.dark .icon-sun { display: block; }

#menu-btn { display: none; }

#mobile-menu {
  display: none;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}
#mobile-menu.open { display: block; }
#mobile-menu .shell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.75rem;
  padding-bottom: 1rem;
}
#mobile-menu a {
  text-decoration: none;
  color: hsl(var(--foreground));
  font-weight: 600;
  padding: 0.7rem 0.25rem;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.mobile-cta { justify-content: center; margin-top: 0.5rem; }

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5.5rem 0 4.5rem;
  background:
    radial-gradient(1100px 500px at 15% -10%, hsl(var(--brand) / 0.10), transparent 60%),
    radial-gradient(900px 480px at 95% 0%, hsl(207 55% 40% / 0.10), transparent 55%),
    hsl(var(--background));
}
.hero-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 3rem;
  align-items: center;
}

.eyebrow, .kicker {
  color: hsl(var(--brand-text));
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 5.2vw, 3.75rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin-bottom: 1.2rem;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, hsl(var(--brand)) 0%, hsl(15 80% 55%) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: 1.15rem;
  color: hsl(var(--muted-foreground));
  max-width: 34rem;
  margin-bottom: 1.8rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 1.1rem; }
.hero-fine { font-size: 0.9rem; color: hsl(var(--muted-foreground)); }

/* ── Terminal card ───────────────────────────────────────────────────── */
.hero-terminal {
  border-radius: 14px;
  overflow: hidden;
  background: hsl(var(--term-bg));
  border: 1px solid hsl(222 18% 24%);
  box-shadow: 0 24px 60px hsl(222 40% 8% / 0.35);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0.7rem 1rem;
  background: hsl(222 20% 16%);
  border-bottom: 1px solid hsl(222 18% 24%);
}
.term-bar span {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: hsl(215 12% 40%);
}
.term-bar span:nth-child(1) { background: #F87171; }
.term-bar span:nth-child(2) { background: #FBBF24; }
.term-bar span:nth-child(3) { background: #34D399; }
.term-bar em {
  margin-left: auto;
  font-style: normal;
  font-family: 'Fira Code', monospace;
  font-size: 0.72rem;
  color: hsl(var(--term-dim));
}
.term-body {
  padding: 1.2rem 1.25rem 1.35rem;
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 0.83rem;
  line-height: 1.75;
  color: hsl(var(--term-fg));
  overflow-x: auto;
}
.term-body code { font-size: inherit; }
.t-prompt { color: hsl(var(--term-ok)); font-weight: 600; }
.t-dim { color: hsl(var(--term-dim)); }
.t-ok { color: hsl(var(--term-ok)); font-weight: 600; }

/* ── Stat band ───────────────────────────────────────────────────────── */
.stat-band {
  border-top: 1px solid hsl(var(--border));
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  padding: 2.2rem 0;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  text-align: center;
}
.stat dd {
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  font-weight: 800;
  color: hsl(var(--brand-text));
  letter-spacing: -0.02em;
  order: -1;
}
.stat dt {
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  margin-top: 0.15rem;
}
.stat { display: flex; flex-direction: column; }

/* ── Bands & sections ────────────────────────────────────────────────── */
.band { padding: 5rem 0; }
.band-alt { background: hsl(var(--muted) / 0.55); }
.dark .band-alt { background: hsl(220 18% 11%); }

.section-head { max-width: 46rem; margin-bottom: 2.6rem; }
.section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.8rem;
}
.section-head p { color: hsl(var(--muted-foreground)); font-size: 1.06rem; }

/* ── Flow steps ──────────────────────────────────────────────────────── */
.flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  list-style: none;
  margin-bottom: 2.6rem;
  counter-reset: flow;
}
.flow-step {
  position: relative;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem 1.3rem;
}
.flow-step::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -1.05rem;
  width: 0.85rem;
  height: 2px;
  background: hsl(var(--brand) / 0.55);
}
.flow-step:last-child::after { display: none; }
.flow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.95rem;
  background: hsl(var(--brand-tint));
  color: hsl(var(--brand-on-tint));
  margin-bottom: 0.8rem;
}
.flow-step h3 { font-size: 1.08rem; margin-bottom: 0.35rem; }
.flow-step p { font-size: 0.92rem; color: hsl(var(--muted-foreground)); }

/* ── Cards & feature grids ───────────────────────────────────────────── */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.feature-grid.cols-3 { margin-top: 2rem; }

.card.feature {
  padding: 1.5rem 1.4rem 1.4rem;
  position: relative;
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.card.feature::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, hsl(var(--brand)), hsl(15 80% 55%));
  opacity: 0;
  transition: opacity 160ms ease;
}
@media (hover: hover) {
  .card.feature:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 34px hsl(222 40% 8% / 0.10);
    border-color: hsl(var(--brand) / 0.45);
  }
  .card.feature:hover::before { opacity: 1; }
}
.card.feature h3 {
  font-size: 1.06rem;
  margin-bottom: 0.45rem;
  letter-spacing: -0.01em;
}
.card.feature h3 code { color: hsl(var(--brand-text)); font-size: 1rem; }
.card.feature p { font-size: 0.93rem; color: hsl(var(--muted-foreground)); }
.card.feature p + p { margin-top: 0.7rem; }
.effect-demo { text-align: center; padding-top: 0.4rem; }
.demo-count { font-weight: 800; color: hsl(var(--brand-text)); font-variant-numeric: tabular-nums; }

/* ── Chips ───────────────────────────────────────────────────────────── */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}
.chip code { color: hsl(var(--brand-text)); }

/* ── Speed table ─────────────────────────────────────────────────────── */
.speed-table-wrap {
  overflow-x: auto;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  margin-bottom: 0.5rem;
}
.speed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 560px;
}
.speed-table th, .speed-table td {
  text-align: left;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid hsl(var(--border));
}
.speed-table tbody tr:last-child th,
.speed-table tbody tr:last-child td { border-bottom: none; }
.speed-table thead th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.6);
}
.speed-table td strong { color: hsl(var(--brand-text)); font-variant-numeric: tabular-nums; }

/* ── Screenshots ─────────────────────────────────────────────────────── */
.shots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.shot {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  box-shadow: 0 16px 40px hsl(222 40% 8% / 0.10);
}
.shot img { width: 100%; height: auto; }
.shots-note {
  margin-top: 1.4rem;
  text-align: center;
  font-size: 0.92rem;
  color: hsl(var(--muted-foreground));
}

/* ── CTA ─────────────────────────────────────────────────────────────── */
.cta {
  padding: 5.5rem 0;
  text-align: center;
  background:
    radial-gradient(800px 380px at 50% 120%, hsl(var(--brand) / 0.14), transparent 60%),
    hsl(var(--muted) / 0.55);
  border-top: 1px solid hsl(var(--border));
}
.dark .cta { background:
    radial-gradient(800px 380px at 50% 120%, hsl(var(--brand) / 0.12), transparent 60%),
    hsl(220 18% 11%);
}
.cta h2 {
  font-size: clamp(1.8rem, 3.6vw, 2.5rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.9rem;
}
.cta p {
  color: hsl(var(--muted-foreground));
  max-width: 40rem;
  margin: 0 auto 1.8rem;
  font-size: 1.08rem;
}
.cta-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.9rem; }

/* ── Footer ──────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid hsl(var(--border));
  padding: 3.5rem 0 2.5rem;
  background: hsl(var(--background));
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}
.footer-brand p {
  margin-top: 1rem;
  font-size: 0.92rem;
  color: hsl(var(--muted-foreground));
  max-width: 22rem;
}
.footer-col h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.9rem;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.55rem; }
.footer-col a {
  color: hsl(var(--foreground));
  text-decoration: none;
  font-size: 0.95rem;
  display: inline-block;
  padding: 0.3rem 0;
}
.footer-col a:hover { color: hsl(var(--brand-text)); }
.footer-legal {
  border-top: 1px solid hsl(var(--border));
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; gap: 2.4rem; }
  .hero-terminal { max-width: 620px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .flow { grid-template-columns: repeat(2, 1fr); }
  .flow-step:nth-child(2)::after { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .site-nav, .header-cta { display: none; }
  #menu-btn { display: inline-flex; }
  .hero { padding: 3.5rem 0 3rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .feature-grid, .feature-grid.cols-3 { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr; }
  .flow-step::after { display: none; }
  .shots { grid-template-columns: 1fr; }
  .band { padding: 3.5rem 0; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.8rem; }
}

/* ── Reduced motion ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .btn, .card.feature { transition: none; }
  .card.feature:hover { transform: none; }
}
