/* agyani — tokens lifted from the "organic" design system, then trimmed to
   what these three pages actually use. */

:root {
  /* Paper, the live theme. Values are docs/design-system/tokens.json's; the
     Night theme redefines them at the end of this file. */
  --color-bg: #f5ead8;
  --color-surface: #ebddc5;
  --color-text: #201e1d;
  --color-text-muted: rgba(32, 30, 29, 0.74);
  --color-text-subtle: rgba(32, 30, 29, 0.66);
  --color-text-faint: rgba(32, 30, 29, 0.35);
  --color-divider: rgba(32, 30, 29, 0.16);

  --color-accent-2-100: #f0fae1;
  --color-accent-2-200: #e1eecc;
  --color-accent-2-300: #ccdbb2;
  --color-accent-2-400: #aebf92;
  --color-accent-2-500: #8fa073;
  --color-accent-2-600: #728157;
  --color-accent-2-700: #56633f;
  --color-accent-2-800: #3d472b;
  --color-accent-2-900: #272e1b;

  /* Roles (design system, step 2). Components use these, never a ramp step
     or an alpha of their own, so a theme only redefines the colours above. */
  --ink: var(--color-text);
  --ink-muted: var(--color-text-muted);
  --ink-subtle: var(--color-text-subtle);
  --ink-faint: var(--color-text-faint); /* decoration only, never text */
  --accent: var(--color-accent-2-700);
  --on-accent: var(--color-bg);
  --accent-strong: var(--color-accent-2-800);
  --accent-soft: var(--color-accent-2-200);
  --rule: var(--color-divider);
  --rule-strong: var(--color-accent-2-600);
  --edge-dashed: var(--color-accent-2-400);

  --font-heading: "Caprasimo", Georgia, serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Caprasimo and Figtree have no Devanagari: Hindi and Sanskrit take these. */
  --font-deva-display: "Yatra One", "Caprasimo", serif;
  --font-deva-body: "Mukta", "Figtree", system-ui, sans-serif;

  --radius-xs: 5px;
  --radius-md: 16px;
  --radius-lg: 28px;
  --radius-gloss: 32.2px;
  --radius-quote: 44.8px;
  --radius-pill: 999px;

  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-22: 22px;
  --space-26: 26px;
  --space-48: 48px;
  --space-96: 96px;

  --shell: 1080px;
  --reader-width: 820px;
  --measure-prose: 50ch;
  --gutter: clamp(24px, 6vw, 80px);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 96px;
  background: var(--color-bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: pretty;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

/* Hover keeps the accent (600 is 3.5:1 on Paper) and thickens the line. */
a:hover {
  color: var(--accent);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.muted {
  color: var(--ink-muted);
}

/* — header — */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 24px;
  padding-top: 26px;
}

.brand {
  font-family: var(--font-heading);
  font-size: 20px;
  color: var(--accent-strong);
  text-decoration: none;
  margin-right: auto;
}

/* "All letters" and "Feed": quiet, always there, in muted control type. */
.site-nav {
  display: flex;
  gap: var(--space-16);
  font-size: 14px;
}

.site-nav a {
  color: var(--ink-muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* — hero — */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
  padding-top: clamp(56px, 9vw, 112px);
}

.kicker {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(40px, 6vw, 86px);
  line-height: 1.04;
  margin-bottom: 22px;
}

.hero .lede {
  font-size: 19px;
  line-height: 1.6;
  max-width: 40ch;
}

.hero-mark {
  display: grid;
  place-items: center;
}

.hero-mark svg {
  width: min(100%, 300px);
  height: auto;
}

/* — sections — */

.section {
  margin-top: clamp(48px, 7vw, 96px);
}

.section h2 {
  font-size: clamp(26px, 3vw, 36px);
  margin-bottom: 26px;
}

/* — the name: अ / ज्ञान / अज्ञानी — */

.gloss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.gloss {
  background: var(--color-surface);
  border-radius: var(--radius-gloss);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gloss-part {
  font-family: var(--font-heading);
  font-size: 28px;
  line-height: 1;
  color: var(--accent-strong);
}

.gloss-meaning {
  font-size: 15px;
  color: var(--ink-muted);
}

/* — who is agyani: one short paragraph under the letter — */

.who-body {
  font-size: 19px;
  line-height: 1.6;
  max-width: 46ch;
}

/* — a letter: the home page's first read, and /letters/<id>/ —
   The reader layout, so the letter's first line sits high on the page. */

.letter .reader-head h1 {
  max-width: 24ch;
}

/* On the home page the title, the number and the date link to the letter's
   own page; they should still read as a heading and a kicker, not as links. */
.permalink {
  color: inherit;
  text-decoration: none;
}

.permalink:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* A letter's beginning (design system, step 7): the kicker, and beside it
   "Letter N of M · All letters" and the language switch, in meta type. */
.letter-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-8) var(--space-26);
  margin-bottom: var(--space-12);
}

.reader-head .letter-head .kicker {
  margin-bottom: 0;
}

.letter-head-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-16);
  font-size: 13px;
  color: var(--ink-subtle);
}

.letter-head-line .dot,
.letter-foot .dot {
  color: var(--ink-subtle);
}

.letter-head-line .lang-switch a,
.letter-head-line .lang-switch a[aria-current="page"] {
  text-decoration: none;
}

/* Only on paper: where the letter lives. */
.print-url {
  display: none;
}

/* A letter's end: one block on the surface, with the letters either side,
   the feed, and when it last changed. */
.letter-foot {
  max-width: var(--reader-width);
  margin-top: var(--space-48);
  padding: var(--space-26);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-22);
}

.letter-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-16) var(--space-26);
}

.letter-nav a {
  display: grid;
  gap: var(--space-8);
  max-width: 32ch;
  text-decoration: none;
}

.letter-nav-next {
  margin-left: auto;
  text-align: right;
}

.letter-nav-label {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}

.letter-nav-title {
  font-family: var(--font-heading);
  font-size: 19px;
  line-height: 1.3;
}

.letter-nav a:hover .letter-nav-title {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.letter-foot-meta {
  font-size: 13px;
  color: var(--ink-subtle);
}

.letter-foot-meta time {
  font-variant-numeric: tabular-nums;
}

/* The home page: below the letter, a thin rule and a kicker-sized label,
   so the letter and "Who is agyani?" read as two things. */
.who-after-letter {
  padding-top: var(--space-48);
  border-top: 1px solid var(--rule);
}

.section h2.who-label {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.14em;
  margin-bottom: var(--space-16);
}

/* The 404 and 500 pages. */
.error-links {
  margin-top: var(--space-8);
  font-size: 17px;
}

/* "New here? Start with the first letter.", above a later letter. */
.start-here {
  margin-top: 24px;
  margin-bottom: 0;
  font-size: 15px;
}

.start-here a {
  color: var(--accent);
}

.earlier-letters a {
  font-size: 15px;
  color: var(--accent);
}

/* — tenets — */

.tenets {
  display: flex;
  flex-direction: column;
}

.tenets p {
  font-family: var(--font-heading);
  font-size: clamp(19px, 2.1vw, 25px);
  line-height: 1.3;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  text-wrap: pretty;
}

.tenets p:last-child {
  border-bottom: 1px solid var(--rule);
}

/* — pull quote — */

.pull-quote {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-quote);
  padding: clamp(32px, 5vw, 64px);
}

.pull-quote p {
  font-family: var(--font-heading);
  font-size: clamp(26px, 3.4vw, 46px);
  line-height: 1.2;
  max-width: 24ch;
}

/* — lane tags —
   A lane's glyph + Sanskrit name, shrunk to a chip so it can ride along a line
   of metadata (the desk's material). */

.lane-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}

/* — metadata line — */

.story-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-subtle);
}

.story-meta time {
  font-variant-numeric: tabular-nums;
}

.story-meta .dot {
  color: var(--ink-faint);
}

/* — a list of writing: /letters/ —
   Rows on rules rather than cards: each entry is a line to be read, and the
   list should not compete with the reading surface it leads to. */

.story-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.story {
  border-top: 1px solid var(--rule);
  padding: 22px 0 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.story:last-child {
  border-bottom: 1px solid var(--rule);
}

.story-title {
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.2;
  max-width: 24ch;
}

.story-title a {
  color: inherit;
  text-decoration: none;
}

.story-title a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* — the empty state —
   A list that starts at zero will sit there a while. The dashed outline is
   the shape of something not filled in yet, rather than a grey "no results"
   box. */

.empty {
  /* Sized to the copy rather than to the shell: a full-bleed panel whose text
     stops 250px short of its own border reads as an accident. */
  max-width: 820px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(20px, 4vw, 44px);
  align-items: start;
  border: 2px dashed var(--edge-dashed);
  border-radius: var(--radius-gloss);
  padding: clamp(28px, 4vw, 48px);
}

.empty-count {
  font-family: var(--font-heading);
  font-size: clamp(64px, 9vw, 104px);
  line-height: 0.8;
  /* A real count, so it has to be readable: 3.5:1 at this size. */
  color: var(--rule-strong);
}

.empty-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 56ch;
}

.empty-lead {
  font-family: var(--font-heading);
  font-size: clamp(19px, 2.1vw, 25px);
  line-height: 1.3;
  text-wrap: pretty;
}

.empty-body .muted {
  text-wrap: pretty;
}

/* — reader: one letter —
   No hero mark here. The page has a single job, and the mark would
   push the first line of text down the screen to win nothing. */

.reader {
  max-width: 820px;
  padding-top: clamp(44px, 7vw, 84px);
}

.reader-head {
  margin-bottom: clamp(26px, 4vw, 38px);
}

.reader-head .kicker {
  margin-bottom: 14px;
}

.reader-head h1 {
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.1;
  margin-bottom: 18px;
  max-width: 20ch;
}

/* — prose —
   Markdown output, so every tag has to be dressed blind. Nothing inside is
   allowed to widen the page.

   The measure is 53ch, not 66ch: `ch` is the width of a zero, and Figtree's
   digits are much wider than its lowercase, so 66ch of this face sets about 80
   characters of prose. 50ch measures out at roughly 67. */

.prose {
  max-width: 50ch;
  font-size: 17px;
  line-height: 1.7;
  overflow-wrap: break-word;
}

.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose pre,
.prose blockquote,
.prose figure,
.prose table {
  margin: 0 0 1.15em;
}

.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 1.7em 0 0.5em;
  text-wrap: pretty;
}

.prose h2 {
  font-size: 26px;
}

.prose h3 {
  font-size: 21px;
}

.prose h4 {
  font-size: 18px;
}

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

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose li {
  margin-bottom: 0.35em;
}

.prose li::marker {
  color: var(--color-accent-2-500);
}

/* The markdown renderer runs the `extra` extension, so definition lists and
   footnotes can appear in a body without warning. */
.prose dt {
  font-weight: 600;
  margin-top: 0.8em;
}

.prose dd {
  margin: 0.2em 0 0 1.3em;
}

.prose .footnote {
  font-size: 15px;
  color: var(--ink-muted);
}

.prose blockquote {
  margin-inline: 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--color-accent-2-300);
  color: var(--ink-muted);
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.87em;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 0.12em 0.38em;
  border-radius: 5px;
}

.prose pre {
  background: var(--color-accent-2-900);
  color: var(--color-accent-2-100);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.55;
  overflow-x: auto;
}

.prose pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.2em 0;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 15px;
}

.prose th,
.prose td {
  border-bottom: 1px solid var(--rule);
  padding: 8px 14px 8px 0;
  text-align: left;
}

/* — footer — */

.site-footer {
  margin-top: clamp(48px, 7vw, 88px);
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-subtle);
}

.site-footer .mark {
  margin-right: auto;
}

.site-footer a {
  text-decoration: none;
}

/* The language selector: two words in the footer's own small, muted type,
   with the current language in the accent colour like the current nav link.
   Plain links to this page in each language (R11). */
.lang-switch {
  display: flex;
  gap: 12px;
}

.lang-switch a {
  color: inherit;
}

.lang-switch a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.lang-switch a[aria-current="page"] {
  color: var(--accent);
}

@media (max-width: 720px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .hero-mark {
    order: -1;
    justify-items: start;
  }

  .hero-mark svg {
    width: min(60%, 200px);
  }

  /* The big zero goes above the copy rather than beside it — at 360px a column
     for each leaves the paragraph about twelve characters wide. */
  .empty {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .empty-count {
    line-height: 0.9;
  }

  .prose {
    font-size: 16px;
  }

  .story-title,
  .reader-head h1 {
    max-width: none;
  }
}

/* — the chat window —
   Staff-only, reached by typing the URL, so it never appears in the site nav.
   It has to read as a notebook you think in rather than a product chat: no
   avatars, no bubbles pointing at each other, no typing dots. Your turns sit
   on the surface colour like something pinned to the page; its turns are plain
   prose on the paper, the way a story is. */

:root {
  /* Only the chat needs to say something went wrong, so the two warning inks
     live here rather than up in the shared palette. Brick, not signal red —
     anything brighter fights the paper. */
  --color-warn: #9d4526;
  --color-warn-ink: #6b2e18;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The honest line. It says once, plainly, what the agent remembers and how:
   notes mined from the owner's own messages, looked up when needed, a little
   behind the conversation. Dashed, like the empty state: the mark of
   something still filling in. */

.chat-memory {
  max-width: 58ch;
  margin-top: 26px;
  padding-top: 12px;
  border-top: 1px dashed var(--edge-dashed);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-subtle);
  text-wrap: pretty;
}

.chat-memory-label {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.chat-empty {
  margin-bottom: 8px;
}

/* — the transcript — */

.transcript {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.turn {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.turn-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}

.turn-who {
  color: var(--accent);
}

.turn-label time {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.turn-body {
  max-width: 50ch;
  /* Plain text in, newlines and all — the model's output is never HTML. */
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.turn-you .turn-body {
  /* Sized to what was typed. A two-word question inside a 50ch slab reads as a
     product chat bubble; this reads as something pinned to the page. */
  width: fit-content;
  background: var(--color-surface);
  border-radius: calc(var(--radius-lg) * 0.8);
  padding: 15px 20px;
  font-size: 16px;
  line-height: 1.6;
}

/* A reply that was stopped or cut off keeps a dashed edge on its last run of
   text, so a half-sentence never reads as a finished answer. */
.turn-cut .turn-body:last-of-type {
  border-left: 2px dashed var(--edge-dashed);
  padding-left: 14px;
  margin-left: -16px;
}

/* — the cursor —
   The only motion on the page, and it is one block, not three bouncing dots.
   It stands in for a "typing" indicator: while it blinks, more is coming. */

.turn-streaming .turn-body:last-of-type::after {
  content: "";
  display: inline-block;
  width: 0.42em;
  height: 1.05em;
  margin-left: 1px;
  border-radius: 2px;
  vertical-align: -0.17em;
  background: var(--color-accent-2-500);
  animation: chat-blink 1.15s ease-in-out infinite;
}

@keyframes chat-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.14; }
}

@keyframes chat-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.72); }
}

@media (prefers-reduced-motion: reduce) {
  .turn-streaming .turn-body:last-of-type::after,
  .tool-running .tool-dot,
  .status-dot {
    animation: none;
  }
}

/* — tool lines —
   Worth seeing: knowing that it went and looked something up is half of
   trusting the answer. Worth keeping small: it is not the answer. */

.tool-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  max-width: 52ch;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-subtle);
}

/* A tool line rendered from history sits between turns rather than inside one,
   so it pulls up to the same 9px it would have had as part of a turn. */
.transcript > .tool-line {
  margin-top: -21px;
}

.transcript > .tool-line:first-child {
  margin-top: 0;
}

.tool-dot {
  flex: none;
  align-self: center;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent-2-400);
}

.tool-running .tool-dot {
  background: var(--color-accent-2-600);
  animation: chat-pulse 1.5s ease-in-out infinite;
}

.tool-error .tool-dot {
  background: var(--color-warn);
}

.tool-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  color: var(--accent-strong);
}

.tool-summary {
  overflow-wrap: break-word;
  min-width: 0;
}

.tool-error .tool-summary {
  color: var(--color-warn-ink);
}

/* — the quiet trailing lines: counts, notes, errors — */

.turn-meta {
  font-size: 11px;
  letter-spacing: 0.07em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-subtle);
}

.turn-note {
  max-width: 50ch;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-subtle);
  text-wrap: pretty;
}

.turn-note-label {
  margin-right: 8px;
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.turn-error {
  max-width: 50ch;
  padding: 13px 18px;
  border-radius: calc(var(--radius-lg) * 0.7);
  background: color-mix(in srgb, var(--color-warn) 11%, transparent);
  color: var(--color-warn-ink);
  font-size: 14px;
  line-height: 1.55;
  text-wrap: pretty;
}

.turn-error-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--color-warn);
}

.turn-system {
  max-width: 52ch;
  font-size: 13px;
  color: var(--ink-subtle);
  text-wrap: pretty;
}

.turn-system-label {
  margin-right: 8px;
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

/* — the composer — */

.composer {
  margin-top: clamp(34px, 5vw, 52px);
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.composer-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.composer textarea {
  display: block;
  width: 100%;
  max-height: 320px;
  resize: none;
  overflow-y: hidden;
  padding: 15px 18px;
  border: 1px solid var(--rule-strong);
  border-radius: calc(var(--radius-lg) * 0.7);
  background: color-mix(in srgb, var(--color-surface) 45%, var(--color-bg));
  color: inherit;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
}

.composer textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.composer textarea[readonly] {
  color: var(--ink-subtle);
  border-style: dashed;
}

.composer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.composer-hint,
.composer-status {
  margin-right: auto;
  font-size: 12.5px;
  color: var(--ink-subtle);
}

.composer-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
}

.composer-hint[hidden],
.composer-status[hidden],
.composer-stop[hidden] {
  display: none;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent-2-600);
  animation: chat-pulse 1.5s ease-in-out infinite;
}

.composer-send,
.composer-stop {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  padding: 9px 22px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
}

.composer-send {
  background: var(--accent);
  color: var(--on-accent);
}

.composer-send:hover:not(:disabled) {
  background: var(--accent-strong);
}

.composer-send:disabled {
  opacity: 0.4;
  cursor: default;
}

.composer-stop {
  background: transparent;
  border-color: var(--rule-strong);
  color: var(--accent-strong);
}

.composer-stop:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

@media (max-width: 720px) {
  .turn-cut .turn-body:last-of-type {
    margin-left: 0;
  }

  .composer-foot {
    gap: 10px;
  }

  .composer-hint,
  .composer-status {
    /* The hint takes the whole first line rather than squeezing the buttons
       into a column of one word each. */
    flex: 1 0 100%;
    margin-right: 0;
  }

  .composer-send,
  .composer-stop {
    flex: 1 1 auto;
  }
}

/* — cards in talk: an old proposal (read-only), a revision, a letter —
   One frame for all three; `.proposal` is the name it had in the review room. */

.proposal {
  padding: 20px 22px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-surface) 40%, var(--color-bg));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.proposal-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.proposal-target {
  font-size: 20px;
}

.proposal-diff {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.proposal-diff th,
.proposal-diff td {
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--rule);
  overflow-wrap: anywhere;
}

.proposal-error {
  color: var(--color-warn-ink);
}

.proposal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.proposal-actions button,
.proposal-actions input {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule-strong);
  background: var(--color-bg);
  color: inherit;
}

.proposal-actions .proposal-approve {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}

.proposal-actions .proposal-reject {
  cursor: pointer;
}

/* — a card inline in talk —
   Drawn under the tool line it came from. Changed fields are the point;
   unchanged ones are folded away as context. */

.proposal-inline {
  max-width: 62ch;
  padding: 16px 18px;
  gap: 8px;
  font-size: 14px;
}

.proposal-inline .proposal-target {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
}

/* The thing changed, by its glossary name ('milestone'), not a code label. */
.proposal-model {
  text-transform: none;
  letter-spacing: 0;
}

.proposal-status {
  margin-left: auto;
}

.proposal-applied { border-color: var(--color-accent-2-500); }
.proposal-rejected,
.proposal-stale { opacity: 0.8; }
.proposal-failed { border-color: var(--color-warn); }

.proposal-diff td {
  white-space: pre-wrap;
}

.proposal-diff .is-changed .proposal-after {
  background: color-mix(in srgb, var(--color-accent-2-300) 45%, transparent);
}

.proposal-diff .is-changed .proposal-before {
  text-decoration: line-through;
  text-decoration-color: var(--ink-faint);
}

.proposal-diff .is-same {
  color: var(--ink-subtle);
}

.proposal-same summary,
.proposal-notes summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-subtle);
}

.proposal-rationale {
  font-style: italic;
}

.proposal-outcome:empty {
  display: none;
}

.proposal-outcome {
  font-size: 13px;
  color: var(--accent-strong);
}

.proposal-outcome.is-bad {
  color: var(--color-warn-ink);
}

.proposal-inline .proposal-actions input {
  flex: 1 1 14ch;
  min-width: 0;
}

.proposal-actions button:disabled {
  opacity: 0.55;
  cursor: progress;
}

/* — the letter card, in talk's letter panel —
   The approval card's frame, holding the letter as editable fields: English
   and Hindi, each a title and a text. */

.letter-language {
  border: 0;
  border-top: 1px solid var(--rule);
  padding: 10px 0 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.letter-language legend {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0 6px 0 0;
}

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

.letter-field-label {
  font-size: 13px;
  color: var(--ink-subtle);
}

.letter-field input,
.letter-field textarea {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: inherit;
  width: 100%;
  resize: vertical;
}

.letter-published { border-color: var(--color-accent-2-500); }

.letter-live a {
  color: var(--accent);
}

.letter-draft {
  margin-top: 14px;
}

.letter-draft-button {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.letter-draft-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.letter-draft-label {
  margin: 0 0 6px;
  font-size: 13px;
}

.letter-draft-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

/* Guard 4 (R10): the text reads as being about the making of agyani. A
   warning, not a refusal: the owner may publish it all the same. */
.letter-warning {
  font-size: 13px;
  color: var(--accent);
  border-left: 2px solid var(--edge-dashed);
  padding-left: 8px;
}

/* — talk: the one private room —
   The conversation in the middle; beside it, on a wide screen, a quiet column
   of panels (conversations, this week's letter, recent changes, in memory)
   that keeps its place while the transcript scrolls. On a narrow screen the
   column stacks under the conversation. */

.talk {
  max-width: 1240px;
  padding-top: clamp(20px, 3vw, 36px);
}

.talk-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13px;
}

.talk-nav a {
  color: var(--ink-subtle);
  text-decoration: none;
}

.talk-nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: underline;
}

.talk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(36px, 5vw, 56px);
  margin-top: clamp(22px, 3vw, 34px);
}

@media (min-width: 1000px) {
  .talk-grid {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    align-items: start;
  }

  .talk-side {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding-right: 4px;
  }
}

.talk-main {
  max-width: 820px;
}

.conversation-head {
  margin-bottom: clamp(24px, 3vw, 36px);
}

.conversation-head .kicker {
  margin-bottom: 10px;
}

.conversation-head h1 {
  font-size: clamp(26px, 3.6vw, 40px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.conversation-when {
  margin-top: 8px;
  font-size: 13px;
}

.talk-messages {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.talk-message {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--color-accent-2-100);
}

.talk-message-warning,
.talk-message-error {
  background: var(--color-surface);
  color: var(--color-warn-ink);
}

.talk-side {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.talk-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
}

.talk-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: 13px;
}

.talk-panel-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.talk-panel-action {
  font-size: 13px;
}

.talk-panel-sub {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0;
}

.talk-panel-note,
.talk-panel-empty {
  font-size: 13px;
}

.talk-panel .proposal-inline {
  max-width: none;
}

.conversation-list,
.changes,
.memory-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.conversation-list {
  max-height: 16rem;
  overflow-y: auto;
}

.conversation-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  color: inherit;
  text-decoration: none;
}

.conversation-list a:hover .conversation-label {
  text-decoration: underline;
}

.conversation-list a[aria-current="page"] .conversation-label {
  color: var(--accent);
  font-weight: 600;
}

.conversation-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-list time {
  flex: none;
  font-size: 12px;
}

.changes {
  gap: 14px;
}

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

.change-head {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.change-meta {
  font-size: 12px;
}

.change-diff {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.change-field {
  color: var(--ink-subtle);
}

.change-diff del {
  text-decoration-color: var(--ink-faint);
}

.change-diff ins {
  text-decoration: none;
  background: color-mix(in srgb, var(--color-accent-2-300) 45%, transparent);
}

.change.is-undone .change-head,
.change.is-undone .change-diff {
  opacity: 0.6;
}

.change-state {
  font-size: 13px;
  color: var(--ink-subtle);
}

.change-undo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.change-undo button {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
}

.change-undo button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.change-outcome {
  font-size: 12.5px;
  color: var(--accent-strong);
}

.change-outcome.is-bad {
  color: var(--color-warn-ink);
}

.memory-list {
  gap: 6px;
  font-size: 13px;
}

.memory-list li {
  padding-left: 10px;
  border-left: 2px solid var(--color-accent-2-300);
  overflow-wrap: anywhere;
}

.letter-panel .letter-draft {
  margin-top: 0;
}

.letter-panel-note:empty {
  display: none;
}

/* — crossing out (design system, step 5) —
   A change of mind shown, not hidden: the struck line stays readable, in
   muted ink with one clean line through it in ink at 35%, and the line that
   replaced it follows in full ink. In a letter: <del>…</del><br><ins>…</ins>. */
.prose del {
  color: var(--ink-muted);
  text-decoration: line-through;
  text-decoration-color: var(--ink-faint);
  text-decoration-thickness: 2px;
}

.prose ins {
  color: var(--ink);
  text-decoration: none;
}

/* — Devanagari (design system, step 4) —
   Caprasimo and Figtree have no Devanagari, so Hindi and Sanskrit runs take
   Yatra One (display) and Mukta (text): a Hindi page throughout, and a
   phrase marked with `lang` inside English text (a verse as <span lang="sa">).
   The first two rules are bundle.css's. Hindi prose is one size up and
   looser (deva-prose, 18px at 1.85): matras and conjuncts need the room.
   English inside a Hindi page (a letter with no Hindi text yet, the
   "English" link, the brand) keeps Figtree and Caprasimo.

   On a Hindi page the two families are redefined, so every rule that sets
   var(--font-heading) (a pull quote, a tenet, a letter's title) gets the
   Devanagari display face without a rule of its own. */
:lang(hi),
:lang(sa) {
  --font-heading: var(--font-deva-display);
  --font-body: var(--font-deva-body);
  font-family: var(--font-deva-body);
}

:is(h1, h2, h3, .pull-quote p, .gloss-part, .letter-nav-title) :lang(sa) {
  font-family: var(--font-deva-display);
}

h1:lang(hi),
h2:lang(hi),
.gloss-part:lang(hi),
.gloss-part:lang(sa) {
  font-family: var(--font-deva-display);
  line-height: 1.25;
}

.prose:lang(hi) {
  font-size: 18px;
  line-height: 1.85;
}

:lang(hi) [lang="en"] {
  --font-heading: "Caprasimo", Georgia, serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: var(--font-body);
}

:lang(hi) :is(h1, h2, h3, .brand, .letter-nav-title)[lang="en"] {
  font-family: var(--font-heading);
}

.section h2.who-label:lang(hi) {
  font-family: var(--font-deva-body);
}

/* Devanagari is not spaced out or set in capitals; a kicker label in Hindi
   (or अज्ञानी inside an English one) sits at its natural spacing. */
.kicker:lang(hi),
.kicker :lang(sa),
.letter-nav-label:lang(hi),
h2.who-label:lang(hi) {
  letter-spacing: 0;
}

/* — the language switch: a bigger target without a bigger look (step 8) — */
.lang-switch a {
  padding-block: 10px;
}

/* — print (design system, step 8) —
   A letter on paper: no header, footer, switch or closing block; the prose
   at 11pt in the same faces (Devanagari kept); the letter's URL under its
   title. */
@media print {
  .site-header,
  .site-footer,
  .letter-head-line,
  .letter-foot,
  .start-here,
  .who,
  .section,
  .earlier-letters {
    display: none;
  }

  body {
    min-height: 0;
    padding-bottom: 0;
    background: none;
  }

  .reader {
    max-width: none;
    padding: 0;
  }

  .prose,
  .prose:lang(hi) {
    max-width: none;
    font-size: 11pt;
  }

  .print-url {
    display: block;
    font-size: 13px;
    color: var(--ink-subtle);
    margin-bottom: var(--space-16);
  }

  .permalink {
    text-decoration: none;
  }
}

/* — Night (design system, step 3) —
   tokens.json's dark values: the accent ramp mirrored on a warm near-black,
   so the paper feel survives. Components use roles, which follow. Chosen by
   the reader's system setting, or by data-theme="dark" (the design system's
   previews); data-theme="light" keeps Paper. Code blocks stay dark on dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #1b1915;
    --color-surface: #28241d;
    --color-text: #f1e6d3;
    --color-text-muted: rgba(241, 230, 211, 0.74);
    --color-text-subtle: rgba(241, 230, 211, 0.66);
    --color-text-faint: rgba(241, 230, 211, 0.35);
    --color-divider: rgba(241, 230, 211, 0.16);
    --color-accent-2-100: #232a17;
    --color-accent-2-200: #33402a;
    --color-accent-2-300: #4d5a37;
    --color-accent-2-400: #6f7f54;
    --color-accent-2-500: #8fa073;
    --color-accent-2-600: #aebf92;
    --color-accent-2-700: #c3d4a5;
    --color-accent-2-800: #dcebc4;
    --color-accent-2-900: #141810;
    --color-warn: #e0896a;
    --color-warn-ink: #f0b49b;
  }

  :root:not([data-theme="light"]) .prose pre {
    color: var(--ink);
  }
}

:root[data-theme="dark"] {
  --color-bg: #1b1915;
  --color-surface: #28241d;
  --color-text: #f1e6d3;
  --color-text-muted: rgba(241, 230, 211, 0.74);
  --color-text-subtle: rgba(241, 230, 211, 0.66);
  --color-text-faint: rgba(241, 230, 211, 0.35);
  --color-divider: rgba(241, 230, 211, 0.16);
  --color-accent-2-100: #232a17;
  --color-accent-2-200: #33402a;
  --color-accent-2-300: #4d5a37;
  --color-accent-2-400: #6f7f54;
  --color-accent-2-500: #8fa073;
  --color-accent-2-600: #aebf92;
  --color-accent-2-700: #c3d4a5;
  --color-accent-2-800: #dcebc4;
  --color-accent-2-900: #141810;
  --color-warn: #e0896a;
  --color-warn-ink: #f0b49b;
}

:root[data-theme="dark"] .prose pre {
  color: var(--ink);
}
