/* Ninaiva site. Colour chapters: every section is one flat field in a thread colour.
   Colours and faces come from design/tokens.json (Ninaiva's design system). */
:root {
  --surface: #f6f2ea;
  --surface-raised: #fffdf8;
  --surface-sunken: #ece6da;
  --ink: #1b1916;
  --ink-muted: #5c554a;
  --paper: #fffdf8;
  --night: #1b1916;
  --mayil: #0b6461;
  --mayil-soft: #d5ece8;
  --manjal: #e4a419;
  --manjal-ink: #7a5200;
  --manjal-soft: #fbebc2;
  --kumkum: #b3261e;
  --thread-mayil: #0b6461;
  --thread-manjal: #9a6600;
  --thread-arakku: #8e2436;
  --thread-neem: #4f6b1f;
  --thread-avuri: #2f4596;
  --thread-sembu: #a04a1a;

  --font-display: "Newsreader", Georgia, serif;
  --font-sans: "Hanken Grotesk", -apple-system, system-ui, sans-serif;

  /* Five type steps */
  --t-display: clamp(96px, 14vw, 220px);
  --t-big: clamp(44px, 6.4vw, 104px);
  --t-lead: clamp(24px, 2.2vw, 32px);
  --t-body: 18px;
  --t-small: 14px;

  --m: clamp(16px, 3vw, 44px);
  --r: 8px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 400 var(--t-body)/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4, p, figure, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
::selection { background: var(--manjal); color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--m); top: -60px; z-index: 30; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r); }
.skip:focus { top: 12px; }

/* Fields */
.field { position: relative; min-height: 90svh; padding: clamp(96px, 12vh, 140px) var(--m) clamp(64px, 10vh, 120px); }
.f-manjal { background: var(--manjal); color: var(--ink); }
.f-night { background: var(--night); color: var(--paper); }
.f-paper { background: var(--surface); color: var(--ink); }
.f-sunken { background: var(--surface-sunken); color: var(--ink); }
.f-avuri { background: var(--thread-avuri); color: var(--paper); }
.f-mayil { background: var(--mayil); color: var(--paper); }
.f-arakku { background: var(--thread-arakku); color: var(--paper); }

/* Type */
.big { font: 600 var(--t-big)/0.96 var(--font-display); letter-spacing: -0.025em; max-width: 14ch; }
.mid { font: 600 var(--t-lead)/1.15 var(--font-display); letter-spacing: -0.01em; }
.small-h { font: 600 var(--t-lead)/1.15 var(--font-display); }
.statement { font: 500 var(--t-lead)/1.3 var(--font-display); max-width: 30ch; }
.soft { color: var(--soft-ink, inherit); }

/* Buttons: one shape, fully round */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px;
  border-radius: 999px; border: 0; font: 600 16px/1 var(--font-sans); text-decoration: none; cursor: pointer;
  background: var(--ink); color: var(--paper);
  transition: transform .18s var(--ease), background-color .18s var(--ease), color .18s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-paper { background: var(--paper); color: var(--thread-arakku); }
.btn-mayil { background: var(--mayil); color: var(--paper); }

/* Header: takes the colours of the chapter beneath it */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 20; height: 64px;
  display: flex; align-items: center; gap: 28px; padding: 0 var(--m);
  background: var(--bar-bg, var(--manjal)); color: var(--bar-ink, var(--ink));
  transition: background-color .3s ease, color .3s ease;
}
.wordmark { display: inline-flex; align-items: center; gap: 8px; font: 600 20px/1 var(--font-display); text-decoration: none; }
.wordmark svg { color: var(--bar-accent, var(--ink)); transition: color .3s ease; }
.bar-links { display: flex; gap: 24px; margin-left: auto; }
.bar-links a { font: 500 16px/1 var(--font-sans); text-decoration: none; padding: 14px 0; position: relative; }
.bar-links a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 8px; height: 2px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .25s var(--ease); }
.bar-links a:hover::after { transform: scaleX(1); }
.bar-action { background: var(--bar-ink, var(--ink)); color: var(--bar-bg, var(--manjal)); min-height: 44px; padding: 0 20px; }

/* 1 · Hero */
.hero { min-height: 100svh; padding-top: 15vh; display: flex; flex-direction: column; justify-content: space-between; --soft-ink: var(--manjal-ink); }
.hero-title { font: 600 var(--t-display)/0.84 var(--font-display); letter-spacing: -0.035em; }
.hero-title span { display: block; }
.hero-foot { align-self: flex-end; width: min(30vw, 420px); min-width: 300px; display: grid; gap: 24px; justify-items: start; }
.hero-foot p { font-size: var(--t-body); line-height: 1.5; }

/* 3 · How: stages as one bar */
.how { display: flex; flex-direction: column; justify-content: center; gap: 64px; }
.stages { display: flex; gap: 6px; min-height: 22vh; }
.stage { flex: var(--grow) 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-start; }
.stage b { display: block; padding: 20px; font: 600 var(--t-lead)/1.1 var(--font-display); min-height: 22vh; color: var(--paper); border-radius: var(--r); }
.stage p { font-size: var(--t-body); max-width: 24ch; margin-top: 16px; }
.s-sembu b { background: var(--thread-sembu); }
.s-avuri b { background: var(--thread-avuri); }
.s-mayil b { background: var(--thread-mayil); }
.s-manjal b { background: var(--manjal); color: var(--ink); }

/* 4 · Try: the capture line */
.try { min-height: 92svh; display: flex; flex-direction: column; gap: 48px; justify-content: center; }
.capture-line { position: relative; }
.capture {
  width: 100%; background: transparent; border: 0; padding: 0; caret-color: var(--manjal);
  font: 600 clamp(36px, 4.6vw, 76px)/1.1 var(--font-display); letter-spacing: -0.02em; color: var(--paper);
}
.capture:focus-visible { outline: none; }
.capture-line::after { content: ""; display: block; height: 4px; width: 100%; background: var(--manjal); transform-origin: left; transform: scaleX(.12); transition: transform .4s var(--ease); }
.capture-line:focus-within::after { transform: scaleX(1); }
.reply { max-width: 560px; display: grid; gap: 10px; }
.bubble { justify-self: end; background: var(--paper); color: var(--ink); padding: 10px 16px; border-radius: 20px 20px 6px 20px; font-size: 17px; max-width: 100%; overflow-wrap: anywhere; }
.reply-text { font: 500 var(--t-lead)/1.25 var(--font-display); }
.reply-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; color: #dfe4f5; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 2px solid var(--paper); }
.undo { background: none; border: 0; padding: 12px 8px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; color: var(--paper); }
.reply.flash { animation: pop .45s var(--ease); }
@keyframes pop { from { opacity: .2; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.examples { display: grid; gap: 14px; }
.examples-note { font-size: var(--t-body); max-width: 60ch; }
.example-row { display: flex; flex-wrap: wrap; gap: 8px; }
.example {
  background: rgba(255, 253, 248, .14); border: 0; border-radius: 999px; min-height: 44px; padding: 0 18px; cursor: pointer; font-size: 16px;
  transition: background-color .2s ease, transform .2s var(--ease);
}
.example:hover { background: rgba(255, 253, 248, .26); transform: translateY(-2px); }
.example:active { transform: scale(.97); }

/* 5 · Weave: fixed brief, live controls */
.weave { display: grid; grid-template-columns: 1fr 1fr; }
.weave-fixed { position: sticky; top: 0; height: 100svh; display: grid; place-items: center; padding: 80px var(--m) 24px; }
.weave-read { padding: 136px var(--m) 30vh clamp(24px, 6vw, 96px); display: grid; gap: 0; align-content: start; }
.weave-read h2 { margin-bottom: 18vh; }
.cap { min-height: 50vh; display: grid; gap: 14px; align-content: start; max-width: 44ch; }
.cap-lead { font: 600 var(--t-lead)/1.2 var(--font-display); }
.ctl { margin-top: 8px; display: flex; align-items: center; gap: 14px; font-weight: 500; min-height: 48px; cursor: pointer; }
.ctl-range { flex-direction: column; align-items: stretch; gap: 8px; }
.ctl-range input { width: 100%; accent-color: var(--mayil); height: 32px; }
.ctl-toggle input { appearance: none; width: 52px; height: 32px; border-radius: 999px; background: #cfc6b6; position: relative; cursor: pointer; transition: background-color .2s ease; flex: none; }
.ctl-toggle input::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); transition: transform .2s var(--ease); }
.ctl-toggle input:checked { background: var(--mayil); }
.ctl-toggle input:checked::after { transform: translateX(20px); }

.brief {
  width: min(420px, 100%); background: var(--surface-raised); color: var(--ink); border-radius: 16px; padding: 24px; display: grid; gap: 16px;
  font-size: 16px;
}
.brief-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brief-title { font: 500 30px/1.1 var(--font-display); letter-spacing: -0.01em; }
.brief-date { font-size: 14px; color: var(--ink-muted); }
.brief-line { font: 500 19px/1.35 var(--font-display); }
.brief-sec { display: grid; gap: 8px; transition: opacity .25s ease; }
.brief-sec[hidden] { display: none; }
.brief-sec h4 { font: 600 14px/1.2 var(--font-sans); color: var(--manjal-ink); }
.brief-items { display: grid; gap: 4px; }
.brief-items li { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 40px; }
.brief-items li[hidden] { display: none; }
.brief-items label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brief-items input { width: 20px; height: 20px; accent-color: var(--mayil); flex: none; }
.brief-items input:checked + span { text-decoration: line-through; color: var(--ink-muted); }
.brief em { font-style: normal; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.brief em::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.brief-p { line-height: 1.45; }
.brief-p em { margin-right: 6px; }
.brief-actions { display: flex; gap: 8px; }
.chip { font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 999px; background: var(--surface-sunken); }
.chip-solid { background: var(--mayil); color: var(--paper); }
.woven { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-muted); }

/* Shared: a words column beside one interface fragment */
.lead { font-size: var(--t-lead); line-height: 1.3; font-family: var(--font-display); font-weight: 500; max-width: 32ch; }
.memory-words p:not(.lead) { max-width: 46ch; }
.projects, .research, .memory { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 40px 24px; align-items: center; }

/* Projects: first-class */
.split-words { grid-column: 1 / 7; display: grid; gap: 24px; }
.points { display: grid; gap: 16px; max-width: 46ch; }
.points li { font-size: var(--t-body); }
.points b { font-weight: 700; }
.project { grid-column: 8 / 13; width: min(460px, 100%); background: var(--surface-raised); color: var(--ink); border-radius: 16px; overflow: hidden; font-size: 16px; }
.project-head { padding: 24px; background: var(--c); color: var(--paper); display: grid; gap: 8px; }
.project-head h3 { font: 600 28px/1.1 var(--font-display); }
.project-head p { font-size: 16px; }
.project-stats { display: flex; gap: 28px; margin: 8px 0 0; }
.project-stats dt { font-size: 14px; }
.project-stats dd { margin: 0; font: 600 28px/1 var(--font-display); }
.project-sec { padding: 18px 24px 0; display: grid; gap: 8px; }
.project-sec:last-child { padding-bottom: 24px; }
.project-sec h4, .mem-sec h4 { font: 600 14px/1.2 var(--font-sans); color: var(--manjal-ink); }
.project-list { display: grid; gap: 4px; }
.project-list li { padding: 10px 12px; background: var(--surface); border-radius: var(--r); }
.decision { padding: 12px; background: var(--mayil-soft); border-radius: var(--r); }
.decision p + p { font-size: 14px; color: var(--ink-muted); }

/* Research: suggestions found overnight */
.research-words { grid-column: 1 / 7; display: grid; gap: 24px; }
.research-words p:not(.lead) { max-width: 46ch; }
.suggestions { grid-column: 7 / 13; display: grid; gap: 12px; }
.suggestion { background: var(--surface-raised); color: var(--ink); border-radius: 16px; padding: 22px; display: grid; gap: 8px; border-left: 6px solid var(--c); }
.suggestion:nth-child(2) { margin-left: 48px; }
.sug-source { font-size: 14px; font-weight: 600; color: var(--ink-muted); }
.sug-title { font: 600 22px/1.25 var(--font-display); }
.sug-why { font-size: 16px; }
.sug-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; align-items: center; }
.sug-btn { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; font-size: 15px; font-weight: 600; cursor: pointer; background: var(--surface-sunken); transition: transform .18s var(--ease), background-color .18s ease; }
.sug-btn:hover { transform: translateY(-2px); }
.sug-btn:active { transform: scale(.97); }
.sug-save { background: var(--mayil); color: var(--paper); }
.sug-done { font-size: 15px; font-weight: 600; color: var(--mayil); }

/* Memory: what Ninaiva knows */
.memory-words { grid-column: 1 / 7; display: grid; gap: 24px; }
.mem { grid-column: 8 / 13; width: min(460px, 100%); background: var(--surface-raised); color: var(--ink); border-radius: 16px; padding: 24px; display: grid; gap: 18px; font-size: 16px; }
.mem-title { font: 600 24px/1.2 var(--font-display); }
.mem-sec { display: grid; gap: 6px; }
.mem-sec ul { display: grid; gap: 4px; }
.mem-sec li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border-radius: var(--r); transition: opacity .25s ease, transform .25s var(--ease); }
.mem-sec li.gone { opacity: 0; transform: translateX(16px); }
.mem-sec small { display: block; font-size: 14px; color: var(--ink-muted); }
.forget { flex: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--kumkum-soft, #f9deda); color: #8f1d17; font-weight: 600; font-size: 15px; cursor: pointer; transition: transform .18s var(--ease); }
.forget:hover { transform: translateY(-2px); }
.mem-toast { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 15px; }
.mem-toast[hidden] { display: none; }
.mem-toast button { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--manjal); color: var(--ink); font-weight: 600; cursor: pointer; }

/* 8 · FAQ: filled tiles */
.faq { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; align-items: start; }
.faq-title { grid-column: 1 / 5; position: sticky; top: 96px; font: 600 var(--t-big)/1 var(--font-display); letter-spacing: -0.025em; }
.qs { grid-column: 5 / 13; display: grid; gap: 8px; }
.q { background: var(--surface-raised); border-radius: var(--r); transition: background-color .25s ease, color .25s ease; }
.q summary {
  list-style: none; cursor: pointer; min-height: 72px; padding: 20px 64px 20px 24px; position: relative;
  font-size: var(--t-body); font-weight: 600; line-height: 1.3; display: flex; align-items: center;
}
.q summary::-webkit-details-marker { display: none; }
.q summary::before, .q summary::after { content: ""; position: absolute; right: 24px; top: 50%; width: 16px; height: 3px; margin-top: -1.5px; background: currentColor; transition: transform .25s var(--ease); }
.q summary::after { transform: rotate(90deg); }
.q[open] { background: var(--mayil); color: var(--paper); }
.q[open] summary::after { transform: rotate(0deg); }
.q p { padding: 0 24px 24px; font-size: var(--t-body); max-width: 52ch; }
.q summary:hover { opacity: .85; }

/* 9 · CTA: the first step, already open */
.cta { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; align-items: center; }
.cta-words { grid-column: 1 / 6; align-self: end; display: grid; gap: 20px; }
.cta-words .big { max-width: 9ch; line-height: .92; }
.cta-words p { font-size: var(--t-body); max-width: 40ch; }
.dialog {
  grid-column: 7 / 12; width: min(440px, 100%); justify-self: start; background: var(--surface-raised); color: var(--ink);
  border-radius: 20px; padding: 28px; display: grid; gap: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28); /* an open dialog, the one thing that floats. taste-skill-ignore */
}
.dialog-title { font: 600 22px/1.2 var(--font-sans); }
.dialog-label { font-size: 15px; font-weight: 500; color: var(--ink-muted); }
.dialog-input { min-height: 52px; border-radius: 12px; border: 2px solid var(--surface-sunken); background: var(--surface); padding: 0 14px; font-size: 18px; }
.dialog-input:focus-visible { outline: none; border-color: var(--mayil); }
.dialog-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface-sunken); border-radius: 999px; padding: 4px; }
.dialog-seg label { position: relative; }
.dialog-seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.dialog-seg span { display: grid; place-items: center; min-height: 44px; border-radius: 999px; font-weight: 600; font-size: 16px; transition: background-color .2s ease; }
.dialog-seg input:checked + span { background: var(--surface-raised); color: var(--mayil); }
.dialog-seg input:focus-visible + span { outline: 3px solid var(--mayil); }
.dialog-go { width: 100%; min-height: 52px; margin-top: 6px; }

/* 10 · Footer: one plain band */
.foot { background: var(--night); color: var(--paper); padding: 40px var(--m) 48px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 16px 40px; }
.foot-mark { font: 600 24px/1 var(--font-display); text-decoration: none; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.foot-nav a, .foot-small a { text-decoration: none; }
.foot-nav a { font-size: 16px; padding: 10px 0; }
.foot-nav a:hover, .foot-small a:hover { text-decoration: underline; text-underline-offset: 4px; }
.foot-small { margin-left: auto; font-size: var(--t-small); color: #d8d0c2; }

/* Entrances: content is visible without script; with it, parts rise once as they enter */
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.js .rise { opacity: 0; transform: translateY(24px); transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: var(--d, 0ms); }
.js .rise.in { opacity: 1; transform: none; }
.js .hero-title span { opacity: 0; transform: translateY(40px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .hero-title span + span { transition-delay: 120ms; }
.js .hero.on .hero-title span { opacity: 1; transform: none; }
.js .stage b { transform-origin: left; transform: scaleX(.2); transition: transform .9s var(--ease); }
.js .stages.in .stage b { transform: none; }
.js .stages.in .stage:nth-child(2) b { transition-delay: 90ms; }
.js .stages.in .stage:nth-child(3) b { transition-delay: 180ms; }
.js .stages.in .stage:nth-child(4) b { transition-delay: 270ms; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rise, .js .hero-title span, .js .stage b { opacity: 1; transform: none; transition: none; }
  .btn, .example, .sug-btn, .forget, .mem-sec li { transition: none; }
  .btn:hover, .example:hover, .sug-btn:hover, .forget:hover { transform: none; }
  .reply.flash { animation: none; }
}

/* Tablet */
@media (max-width: 1080px) {
  .projects, .research, .memory { grid-template-columns: 1fr; }
  .split-words, .project, .research-words, .suggestions, .memory-words, .mem { grid-column: 1; }
  .bar-links { display: none; }
  .bar-action { margin-left: auto; }
}

/* Phone: its own composition */
@media (max-width: 720px) {
  .projects, .research, .memory { grid-template-columns: 1fr; }
  .split-words, .project, .research-words, .suggestions, .memory-words, .mem { grid-column: 1; }
  .suggestion:nth-child(2) { margin-left: 0; }
  .lead { font-size: 22px; }
  :root { --t-display: 23vw; --t-body: 17px; }
  .field { min-height: auto; padding: 104px 16px 72px; }
  .bar { height: 56px; padding: 0 16px; }
  .bar-action { min-height: 44px; padding: 0 16px; font-size: 15px; }
  .hero { min-height: 100svh; padding-top: 16vh; padding-bottom: 24px; }
  .hero-foot { align-self: stretch; width: 100%; min-width: 0; }
  .how { gap: 40px; }
  .stages { flex-direction: column; min-height: 0; }
  .stage { flex: none; }
  .stage b { min-height: calc(var(--grow) * 0.7vh + 72px); font-size: 22px; }
  .stage p { margin-top: 10px; max-width: none; }
  .try { min-height: 88svh; gap: 28px; }
  .capture { font-size: 11vw; }
  .example-row { display: grid; }
  .example { text-align: left; }
  .weave { grid-template-columns: 1fr; }
  .weave-fixed { position: static; height: auto; padding: 88px 16px 40px; }
  .brief { padding: 16px; gap: 10px; }
  .brief-title { font-size: 24px; }
  .weave-read { padding: 48px 16px 20vh; }
  .weave-read h2 { margin-bottom: 8vh; }
  .cap { min-height: 0; margin-bottom: 56px; }
  .faq { grid-template-columns: 1fr; }
  .faq-title { grid-column: 1; position: static; font-size: 10vw; }
  .qs { grid-column: 1; gap: 6px; }
  .q summary { min-height: 64px; padding: 16px 56px 16px 20px; }
  .q p { padding: 0 20px 20px; }
  .cta { grid-template-columns: 1fr; min-height: 84svh; align-content: space-between; }
  .cta-words, .dialog { grid-column: 1; }
  .cta-words .big { font-size: 13vw; }
  .dialog { width: 100%; padding: 20px; }
}
