/* Veridell — one stylesheet, written from the tokens up.
 *
 * The page is paper: a warm sheet in daylight, a deep ink sheet at night. The
 * only loud things are the two accents — a green that means "the site", and a
 * brass that means "you can touch this".
 *
 * Class names are namespaced `em-` so nothing here collides with a component
 * that arrives later, and every colour comes from a token so the two themes
 * can never drift apart.
 */

/* ── 1 · tokens ─────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  --em-paper: #f7f3ea;
  --em-paper-2: #fffdf8;
  --em-paper-3: #efe9dc;
  --em-rule: #e2dacb;
  --em-rule-2: #cfc4b0;

  --em-ink: #16211d;
  --em-ink-2: #3d4b45;
  --em-ink-3: #6a7772;

  --em-green: #1a7a52;
  --em-green-soft: #e6f1ea;
  --em-brass: #a8622c;
  --em-brass-soft: #f3e5d6;

  --em-focus: #1a7a52;
  --em-shadow-1: 0 1px 2px rgba(22, 33, 29, .06);
  --em-shadow-2: 0 18px 44px -28px rgba(22, 33, 29, .5);

  --em-font-body: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Devanagari", Arial, sans-serif;
  --em-font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Tiro Devanagari Hindi", serif;
  --em-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --em-column: 88ch;
  --em-gutter: clamp(16px, 4vw, 40px);
  --em-radius: 14px;
  --em-radius-lg: 22px;
  --em-ease: cubic-bezier(.22, .61, .36, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --em-paper: #0e1512;
  --em-paper-2: #141d19;
  --em-paper-3: #1a2420;
  --em-rule: #23302b;
  --em-rule-2: #33443c;

  --em-ink: #eaf1ed;
  --em-ink-2: #b6c4be;
  --em-ink-3: #8a9a94;

  --em-green: #5fc79a;
  --em-green-soft: #14332a;
  --em-brass: #d99a5e;
  --em-brass-soft: #33251a;

  --em-focus: #5fc79a;
  --em-shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --em-shadow-2: 0 20px 48px -30px rgba(0, 0, 0, .9);
}

/* ── 2 · base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--em-paper);
  color: var(--em-ink);
  font: 16px/1.65 var(--em-font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

img, svg { max-width: 100%; }

a { color: var(--em-green); text-underline-offset: 2px; }
a:hover { color: var(--em-brass); }

h1, h2, h3, h4 { font-family: var(--em-font-display); font-weight: 600; letter-spacing: -.015em; line-height: 1.2; margin: 0 0 .5em; }

:focus-visible { outline: 2px solid var(--em-focus); outline-offset: 3px; border-radius: 6px; }

.em-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.em-skip {
  position: absolute; left: -9999px; top: 0; z-index: 60;
  padding: 10px 16px; background: var(--em-green); color: var(--em-paper-2);
  font-weight: 650; border-radius: 0 0 10px 0; text-decoration: none;
}
.em-skip:focus { left: 0; }

/* ── 3 · the bar at the top ─────────────────────────────────────────────── */
.em-bar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--em-paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--em-rule);
}

.em-bar-in {
  max-width: 1220px; margin: 0 auto;
  padding: 10px var(--em-gutter);
  display: flex; align-items: center; gap: 14px;
}

.em-brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--em-ink); flex: none;
}

.em-brand-mark {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #12564c, #082a26);
  box-shadow: var(--em-shadow-1);
}
.em-brand-mark svg { width: 22px; height: 22px; display: block; }

.em-brand-word {
  font-family: var(--em-font-display);
  font-size: 18px; font-weight: 600; letter-spacing: -.02em;
  white-space: nowrap;
}

.em-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }

.em-nav a {
  padding: 7px 11px; border-radius: 9px;
  color: var(--em-ink-2); text-decoration: none; font-size: 14px; font-weight: 550;
}
.em-nav a:hover { background: var(--em-paper-3); color: var(--em-ink); }
.em-nav a[aria-current="page"] { color: var(--em-green); background: var(--em-green-soft); }

.em-icon-btn {
  width: 38px; height: 38px; flex: none;
  display: inline-grid; place-items: center;
  border: 1px solid var(--em-rule); border-radius: 11px;
  background: var(--em-paper-2); color: var(--em-ink-2);
  cursor: pointer; transition: border-color .15s var(--em-ease), color .15s var(--em-ease);
}
.em-icon-btn:hover { border-color: var(--em-rule-2); color: var(--em-ink); }
.em-icon-btn svg { width: 18px; height: 18px; }

/* ── 4 · the page column ────────────────────────────────────────────────── */
.em-main { max-width: 1220px; margin: 0 auto; padding: 0 var(--em-gutter) 80px; }
.em-column { max-width: var(--em-column); margin: 0 auto; }

/* ── 5 · the ask box ────────────────────────────────────────────────────── */
.em-hero { padding: clamp(28px, 7vh, 76px) 0 8px; text-align: center; }

.em-hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 13px 5px 9px; margin-bottom: 16px;
  border: 1px solid var(--em-rule); border-radius: 999px;
  background: var(--em-paper-2);
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--em-brass);
}
.em-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--em-green); box-shadow: 0 0 0 4px var(--em-green-soft); }

.em-hero h1 {
  font-size: clamp(30px, 5.6vw, 54px);
  letter-spacing: -.035em; margin: 0 auto 12px; max-width: 20ch; text-wrap: balance;
}
.em-hero h1 em { font-style: normal; color: var(--em-brass); }
.em-hero p { margin: 0 auto 26px; max-width: 58ch; color: var(--em-ink-2); }

.em-ask {
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--em-rule-2); border-radius: 999px;
  background: var(--em-paper-2);
  box-shadow: var(--em-shadow-2);
  transition: border-color .16s var(--em-ease), box-shadow .16s var(--em-ease);
}
.em-ask:focus-within { border-color: var(--em-green); }

.em-ask input {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: transparent; color: var(--em-ink);
  font: inherit; font-size: 16px; padding: 11px 0;
}
.em-ask input::placeholder { color: var(--em-ink-3); }
.em-ask input:focus { outline: none; }

.em-ask-go {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--em-green); color: #06231a; cursor: pointer;
}
.em-ask-go:hover { filter: brightness(1.06); }
.em-ask-go svg { width: 18px; height: 18px; }

.em-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }

.em-chip {
  padding: 7px 14px; border: 1px solid var(--em-rule); border-radius: 999px;
  background: var(--em-paper-2); color: var(--em-ink-2);
  font: inherit; font-size: 13.5px; cursor: pointer;
  transition: border-color .15s var(--em-ease), color .15s var(--em-ease), transform .15s var(--em-ease);
}
.em-chip:hover { border-color: var(--em-brass); color: var(--em-ink); transform: translateY(-1px); }

/* ── 6 · cards and grids ────────────────────────────────────────────────── */
.em-section { margin-top: 46px; }
.em-section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.em-section-head h2 { font-size: 20px; margin: 0; }
.em-section-head p { margin: 0; color: var(--em-ink-3); font-size: 13.5px; }

.em-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.em-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px; border: 1px solid var(--em-rule); border-radius: var(--em-radius);
  background: var(--em-paper-2); box-shadow: var(--em-shadow-1);
  color: var(--em-ink); text-decoration: none;
  transition: border-color .15s var(--em-ease), transform .15s var(--em-ease), box-shadow .15s var(--em-ease);
}
.em-card:hover { border-color: var(--em-brass); transform: translateY(-2px); box-shadow: var(--em-shadow-2); color: var(--em-ink); }
.em-card strong { font-size: 15px; font-weight: 650; }
.em-card span { font-size: 13px; color: var(--em-ink-3); line-height: 1.5; }

/* A grid that fills in after the first paint keeps its height while it is
 * empty, so the content below it does not jump down when the cards arrive.
 * That jump is the layout shift a reader notices and a scoreboard counts. */
.em-grid--async { min-height: 132px; }


/* ── 6b · multimorphism ──────────────────────────────────────────────────
 * The house look is layered, not flat: every surface is a sheet resting on the
 * paper with a soft edge, a hairline and a light that comes from the top-left.
 * Corners are squircles where the browser can do it, and plain rounds where it
 * cannot. Nothing here is decoration for its own sake — the layers are what
 * tell a reader which things are separate and which belong together.
 */
:root {
  --em-layer-1: 0 1px 1px rgba(22, 33, 29, .05), 0 2px 6px -2px rgba(22, 33, 29, .08);
  --em-layer-2: 0 1px 2px rgba(22, 33, 29, .06), 0 10px 24px -12px rgba(22, 33, 29, .25);
  --em-layer-3: 0 2px 4px rgba(22, 33, 29, .06), 0 24px 48px -24px rgba(22, 33, 29, .35);
  --em-sheen: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 42%);
}

html[data-theme="dark"] {
  --em-layer-1: 0 1px 1px rgba(0, 0, 0, .4), 0 2px 8px -2px rgba(0, 0, 0, .5);
  --em-layer-2: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 28px -14px rgba(0, 0, 0, .8);
  --em-layer-3: 0 2px 6px rgba(0, 0, 0, .5), 0 28px 56px -26px rgba(0, 0, 0, .9);
  --em-sheen: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0) 46%);
}

@supports (corner-shape: squircle) {
  .em-card, .em-aotd, .em-potd, .em-read, .em-source, .em-starter, .em-chip, .em-hero-figure {
    corner-shape: squircle;
  }
}

.em-card,
.em-aotd,
.em-potd,
.em-read,
.em-hero-figure {
  box-shadow: var(--em-layer-1);
  transition: box-shadow .18s var(--em-ease), transform .18s var(--em-ease), border-color .18s var(--em-ease);
}

.em-card:hover,
.em-aotd:hover,
.em-read:hover {
  box-shadow: var(--em-layer-3);
  transform: translateY(-2px);
}

/* the label above a card: "article of the day", "picture of the day" */
.em-eyebrow {
  display: inline-block;
  font-size: 10.5px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase;
  color: var(--em-brass);
}

/* ── article of the day ─────────────────────────────────────────────────── */
.em-aotd {
  display: grid;
  grid-template-columns: minmax(180px, 34%) 1fr;
  gap: 0;
  border: 1px solid var(--em-rule);
  border-radius: var(--em-radius-lg);
  background: var(--em-paper-2);
  overflow: hidden;
  text-decoration: none;
  color: var(--em-ink);
  box-shadow: var(--em-layer-2);
}

.em-aotd-media {
  position: relative;
  display: block;
  min-height: 190px;
  background:
    var(--em-sheen),
    linear-gradient(150deg, var(--em-green-soft), var(--em-paper-3));
  overflow: hidden;
}

.em-aotd-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 4 / 3;
}

.em-aotd-blank { display: block; width: 100%; height: 100%; }

.em-aotd-body {
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 22px;
}

.em-aotd-body strong {
  font-family: var(--em-font-display);
  font-size: clamp(20px, 2.4vw, 27px);
  letter-spacing: -.02em;
  line-height: 1.18;
}

.em-aotd-extract { font-size: 14.5px; line-height: 1.65; color: var(--em-ink-2); }
.em-aotd-more { margin-top: auto; padding-top: 8px; font-size: 13px; font-weight: 650; color: var(--em-green); }

/* ── picture of the day ─────────────────────────────────────────────────── */
.em-potd {
  margin: 0;
  border: 1px solid var(--em-rule);
  border-radius: var(--em-radius-lg);
  background: var(--em-paper-2);
  overflow: hidden;
  box-shadow: var(--em-layer-2);
}

.em-potd img {
  display: block; width: 100%;
  max-height: 520px;
  object-fit: cover;
  aspect-ratio: 16 / 9;
  background: var(--em-paper-3);
}

.em-potd figcaption {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 18px 16px;
  font-size: 13.5px; color: var(--em-ink-2);
}

.em-potd figcaption strong { font-size: 15px; color: var(--em-ink); }
.em-potd-caption { line-height: 1.55; }
.em-potd-credit { font-size: 12px; color: var(--em-ink-3); }

/* ── most read ──────────────────────────────────────────────────────────── */
.em-readlist {
  display: grid; gap: 8px;
  margin: 0; padding: 0; list-style: none;
  counter-reset: read;
}

.em-read {
  display: grid;
  grid-template-columns: 26px 64px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--em-rule);
  border-radius: var(--em-radius);
  background: var(--em-paper-2);
  text-decoration: none;
  color: var(--em-ink);
}

.em-read-n {
  font-family: var(--em-font-display);
  font-size: 15px; font-weight: 600; color: var(--em-ink-3);
  text-align: center;
}

.em-read-thumb {
  width: 64px; height: 46px;
  object-fit: cover;
  border-radius: 9px;
  background: var(--em-paper-3);
}

.em-read-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.em-read-body strong { font-size: 14.5px; font-weight: 650; }
.em-read-body span { font-size: 12.5px; color: var(--em-ink-3); line-height: 1.45; }
.em-read-views { font-size: 11.5px; color: var(--em-ink-3); white-space: nowrap; }

/* ── the lead picture on an answer ──────────────────────────────────────── */
.em-hero-figure {
  margin: 0 0 20px;
  border: 1px solid var(--em-rule);
  border-radius: var(--em-radius-lg);
  overflow: hidden;
  background: var(--em-paper-2);
}

.em-hero-figure img {
  display: block; width: 100%;
  max-height: 420px;
  object-fit: cover;
  aspect-ratio: 16 / 9;
  background: var(--em-paper-3);
}

.em-hero-figure figcaption {
  padding: 10px 16px 12px;
  font-size: 12.5px; color: var(--em-ink-3);
}

@media (max-width: 720px) {
  .em-aotd { grid-template-columns: 1fr; }
  .em-aotd-media { min-height: 150px; }
  .em-read { grid-template-columns: 22px 1fr auto; }
  .em-read-thumb { display: none; }
}

/* ── 7 · the answer ─────────────────────────────────────────────────────── */
.em-answer { padding: 26px 0 10px; }
.em-answer-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.em-badge {
  padding: 3px 10px; border-radius: 999px;
  background: var(--em-green-soft); color: var(--em-green);
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.em-badge.is-plain { background: var(--em-brass-soft); color: var(--em-brass); }
.em-meta-note { font-size: 12.5px; color: var(--em-ink-3); }

.em-answer h1 { font-size: clamp(26px, 3.6vw, 40px); letter-spacing: -.03em; margin: 0 0 10px; }

.em-lead { font-size: 17.5px; line-height: 1.7; color: var(--em-ink-2); margin: 0 0 20px; }

.em-points { margin: 0 0 22px; padding: 0; list-style: none; display: grid; gap: 8px; }
.em-points li {
  position: relative; padding-left: 22px; font-size: 15px; color: var(--em-ink-2);
}
.em-points li::before {
  content: ""; position: absolute; left: 4px; top: .62em;
  width: 7px; height: 7px; border-radius: 50%; background: var(--em-brass);
}

.em-topic { border-top: 1px solid var(--em-rule); padding: 16px 0; }
.em-topic:first-of-type { border-top: 0; }
.em-topic h2 { font-size: 17px; margin: 0 0 6px; }
.em-topic p { margin: 0 0 8px; color: var(--em-ink-2); }

.em-depth {
  display: inline-flex; gap: 4px; padding: 3px; margin: 6px 0 18px;
  border: 1px solid var(--em-rule); border-radius: 999px; background: var(--em-paper-3);
}
.em-depth button {
  border: 0; border-radius: 999px; padding: 6px 13px;
  background: transparent; color: var(--em-ink-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.em-depth button[aria-pressed="true"] { background: var(--em-paper-2); color: var(--em-ink); box-shadow: var(--em-shadow-1); }

/* ── 8 · sources ────────────────────────────────────────────────────────── */
.em-sources { margin-top: 26px; }
.em-sources h2 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--em-ink-3); font-family: var(--em-font-body); font-weight: 700; }

.em-source-list { display: grid; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.em-source {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--em-rule); border-radius: 12px;
  background: var(--em-paper-2); text-decoration: none; color: var(--em-ink);
}
.em-source:hover { border-color: var(--em-brass); color: var(--em-ink); }
.em-source .n {
  width: 22px; height: 22px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--em-green-soft); color: var(--em-green);
  font-size: 11.5px; font-weight: 700;
}
.em-source .t { font-size: 13.5px; font-weight: 600; }
.em-source .h { margin-left: auto; font-size: 12px; color: var(--em-ink-3); white-space: nowrap; }


/* ── 8b · pictures, facts and the language row ─────────────────────────── */

.em-pics {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 190px);
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scroll-snap-type: x proximity;
}

.em-pic {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--em-rule);
  border-radius: 14px;
  overflow: hidden;
  background: var(--em-paper-2);
  text-decoration: none;
  color: var(--em-ink-3);
  scroll-snap-align: start;
  box-shadow: var(--em-layer-1);
}

.em-pic img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  display: block; background: var(--em-paper-3);
}

.em-pic-credit {
  padding: 0 8px 8px;
  font-size: 10.5px; line-height: 1.35;
  color: var(--em-ink-3);
  overflow-wrap: anywhere;
}

.em-facts {
  display: grid;
  grid-template-columns: minmax(90px, 30%) 1fr;
  gap: 6px 16px;
  margin: 10px 0 8px;
}

.em-facts dt { font-size: 12.5px; font-weight: 650; color: var(--em-ink-3); }
.em-facts dd { margin: 0; font-size: 14px; color: var(--em-ink); }

.em-translate {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 18px 0 6px;
  padding-top: 14px;
  border-top: 1px solid var(--em-rule);
}

.em-lang-chip {
  padding: 5px 12px;
  border: 1px solid var(--em-rule);
  border-radius: 999px;
  background: var(--em-paper-2);
  color: var(--em-ink-2);
  font: inherit; font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s var(--em-ease), color .15s var(--em-ease);
}

.em-lang-chip:hover { border-color: var(--em-brass); color: var(--em-ink); }
.em-lang-chip.is-on { background: var(--em-green-soft); border-color: var(--em-green); color: var(--em-green); font-weight: 650; }

/* ── 9 · chat ───────────────────────────────────────────────────────────── */
body[data-page="chat"] { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }

.em-chat-bar { flex: none; }

.em-chat-scroll { flex: 1 1 auto; overflow-y: auto; scroll-behavior: smooth; }

.em-chat-stage { max-width: 760px; margin: 0 auto; padding: 20px var(--em-gutter) 8px; }

.em-chat-empty { text-align: center; padding: clamp(20px, 8vh, 80px) 0 10px; }
.em-chat-empty h1 { font-size: clamp(26px, 4.6vw, 40px); letter-spacing: -.03em; margin-bottom: 10px; }
.em-chat-empty h1 em { font-style: normal; color: var(--em-green); }
.em-chat-empty p { color: var(--em-ink-2); max-width: 52ch; margin: 0 auto 22px; }

.em-starters { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); text-align: left; }
.em-starter {
  padding: 13px 15px; border: 1px solid var(--em-rule); border-radius: var(--em-radius);
  background: var(--em-paper-2); color: var(--em-ink); font: inherit; font-size: 13.5px;
  text-align: left; cursor: pointer; box-shadow: var(--em-shadow-1);
  transition: border-color .15s var(--em-ease), transform .15s var(--em-ease);
}
.em-starter:hover { border-color: var(--em-brass); transform: translateY(-1px); }

.em-turn { padding: 14px 0; }
.em-turn-q {
  margin-left: auto; max-width: min(88%, 560px); width: fit-content;
  padding: 11px 15px; border-radius: 18px 18px 5px 18px;
  background: var(--em-green-soft); color: var(--em-ink); font-size: 15px;
}

.em-turn-a { display: flex; flex-direction: column; gap: 8px; }
.em-turn-a .em-who {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--em-brass);
}

.em-prose { font-size: 15.5px; line-height: 1.72; color: var(--em-ink); }
.em-prose > *:first-child { margin-top: 0; }
.em-prose > *:last-child { margin-bottom: 0; }
.em-prose h2, .em-prose h3 { font-family: var(--em-font-body); font-size: 15.5px; font-weight: 680; margin: 18px 0 6px; }
.em-prose p { margin: 0 0 10px; }
.em-prose ul, .em-prose ol { margin: 0 0 12px; padding-left: 22px; }
.em-prose li { margin-bottom: 4px; }
.em-prose code { font-family: var(--em-font-mono); font-size: .9em; background: var(--em-paper-3); padding: 1px 5px; border-radius: 5px; }
.em-prose blockquote { margin: 12px 0; padding: 6px 0 6px 14px; border-left: 3px solid var(--em-brass); color: var(--em-ink-2); }
.em-prose a { color: var(--em-green); }

.em-cite {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px;
  margin: 0 1px; padding: 0 4px; border-radius: 5px;
  background: var(--em-green-soft); color: var(--em-green);
  font-size: 10.5px; font-weight: 700; text-decoration: none; vertical-align: super;
}

.em-follow { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--em-rule); }
.em-follow button {
  padding: 6px 12px; border: 1px solid var(--em-rule); border-radius: 999px;
  background: transparent; color: var(--em-ink-2); font: inherit; font-size: 12.5px; cursor: pointer;
}
.em-follow button:hover { border-color: var(--em-green); color: var(--em-ink); }

.em-actions { display: flex; gap: 4px; margin-top: 10px; }
.em-actions button {
  border: 0; background: transparent; color: var(--em-ink-3);
  font: inherit; font-size: 12.5px; padding: 5px 8px; border-radius: 8px; cursor: pointer;
}
.em-actions button:hover { background: var(--em-paper-3); color: var(--em-ink); }

/* the composer */
.em-dock { flex: none; padding: 8px var(--em-gutter) max(14px, env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--em-paper) 64%, transparent); }
.em-dock-in { max-width: 760px; margin: 0 auto; }

.em-composer {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 7px 8px 7px 14px;
  border: 1px solid var(--em-rule-2); border-radius: 24px;
  background: var(--em-paper-2); box-shadow: var(--em-shadow-2);
  transition: border-color .16s var(--em-ease);
}
.em-composer:focus-within { border-color: var(--em-green); }

.em-composer textarea {
  flex: 1 1 auto; min-width: 0; resize: none;
  border: 0; background: transparent; color: var(--em-ink);
  font: inherit; font-size: 15px; line-height: 1.5;
  padding: 9px 0; max-height: 40vh;
}
.em-composer textarea:focus { outline: none; }
.em-composer textarea::placeholder { color: var(--em-ink-3); }

.em-composer .em-send {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--em-green); color: #06231a; cursor: pointer;
}
.em-composer .em-send:disabled { opacity: .4; cursor: default; }
.em-composer .em-send svg { width: 17px; height: 17px; }

.em-chat-tools { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--em-ink-3); }
.em-chat-tools select {
  font: inherit; font-size: 12px; padding: 4px 8px;
  border: 1px solid var(--em-rule); border-radius: 8px;
  background: var(--em-paper-2); color: var(--em-ink-2);
}
.em-chat-tools .em-spacer { flex: 1 1 auto; }

.em-thinking { display: inline-flex; align-items: center; gap: 8px; color: var(--em-ink-3); font-size: 13.5px; }
.em-thinking i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--em-brass);
  animation: em-pulse 1.1s infinite ease-in-out;
}
.em-thinking i:nth-child(2) { animation-delay: .15s; }
.em-thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes em-pulse { 0%, 100% { opacity: .25; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }


/* ── 9b · dictation, attachments, credits ──────────────────────────────── */

.em-mic.is-listening {
  color: var(--em-paper-2);
  background: var(--em-green);
  border-color: var(--em-green);
  animation: em-listen 1.4s ease-in-out infinite;
}

@keyframes em-listen {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--em-green) 45%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--em-green) 0%, transparent); }
}

.em-tray {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}

.em-tray-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 6px 5px 11px;
  border: 1px solid var(--em-rule);
  border-radius: 999px;
  background: var(--em-paper-2);
  font-size: 12.5px;
  color: var(--em-ink-2);
  box-shadow: var(--em-layer-1);
}

.em-tray-name { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.em-tray-x {
  display: grid; place-items: center;
  width: 20px; height: 20px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--em-ink-3); cursor: pointer;
}
.em-tray-x:hover { background: var(--em-paper-3); color: var(--em-ink); }
.em-tray-x svg { width: 11px; height: 11px; }

/* the credits page */
.em-credit-list { display: grid; gap: 8px; margin: 10px 0 6px; padding: 0; list-style: none; }

.em-credit {
  display: grid;
  grid-template-columns: minmax(120px, 22%) 1fr auto;
  align-items: baseline;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--em-rule);
  border-radius: var(--em-radius);
  background: var(--em-paper-2);
  box-shadow: var(--em-layer-1);
}

.em-credit-name { font-weight: 650; font-size: 14px; }
.em-credit-body { font-size: 13.5px; color: var(--em-ink-2); line-height: 1.55; }
.em-credit-link { font-size: 12.5px; white-space: nowrap; }
.em-muted { color: var(--em-ink-3); font-size: 13.5px; }
.em-plain { padding-left: 20px; }

@media (max-width: 720px) {
  .em-credit { grid-template-columns: 1fr; gap: 4px; }
}

/* ── 10 · static pages ──────────────────────────────────────────────────── */
.em-page { padding: 34px 0 20px; }
.em-page h1 { font-size: clamp(26px, 4vw, 40px); letter-spacing: -.03em; }
.em-page .em-sub { color: var(--em-ink-2); font-size: 16.5px; margin: 0 0 24px; }
.em-page h2 { font-size: 19px; margin-top: 32px; }
.em-page p, .em-page li { color: var(--em-ink-2); }
.em-page ul, .em-page ol { padding-left: 22px; }
.em-page li { margin-bottom: 6px; }

.em-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; padding: 0; list-style: none; }
.em-toc a {
  padding: 5px 11px; border: 1px solid var(--em-rule); border-radius: 999px;
  font-size: 12.5px; text-decoration: none; color: var(--em-ink-2);
}
.em-toc a:hover { border-color: var(--em-brass); color: var(--em-ink); }

/* ── 11 · the foot ──────────────────────────────────────────────────────── */
.em-foot {
  border-top: 1px solid var(--em-rule);
  padding: 28px var(--em-gutter) 40px; margin-top: 40px;
  color: var(--em-ink-3); font-size: 13px;
}
.em-foot-in { max-width: 1220px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 18px 34px; }
.em-foot a { color: var(--em-ink-2); text-decoration: none; }
.em-foot a:hover { color: var(--em-brass); }
.em-foot-col { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.em-foot-col strong { color: var(--em-ink); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.em-foot p { margin: 18px 0 0; max-width: 78ch; line-height: 1.6; }

/* ── 12 · small screens ─────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .em-nav { display: none; }
  .em-bar-in { gap: 10px; }
  .em-brand-word { font-size: 16px; }
  .em-hero { padding-top: 26px; }
  .em-grid { grid-template-columns: 1fr; }
  .em-source .h { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .em-chat-scroll { scroll-behavior: auto; }
}

/* ── 13 · the surface system ──────────────────────────────────────────────
 * Three materials, used for three different jobs:
 *
 *   clay   — the cards. Soft, thick, a highlight along the top edge and a
 *            shadow underneath, so a card reads as an object resting on paper.
 *   glass  — anything that floats over the page: the header, the composer, the
 *            option panel. Blurred, translucent, with a hairline that catches
 *            the light.
 *   neumo  — things you press: chips, segmented controls, the depth bar. Inset
 *            shadow when resting, flat when pressed.
 *
 * The point of using all three is not decoration: a reader should be able to
 * tell, without reading, what is a container, what floats, and what is a
 * control.
 */

:root {
  --em-clay-face: linear-gradient(180deg, color-mix(in srgb, var(--em-paper-2) 92%, white) 0%, var(--em-paper-2) 46%, color-mix(in srgb, var(--em-paper-3) 70%, var(--em-paper-2)) 100%);
  --em-clay-edge: inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 -1px 0 rgba(0, 0, 0, .04);
  --em-clay-drop: 0 1px 2px rgba(22, 33, 29, .05), 0 14px 28px -18px rgba(22, 33, 29, .28), 0 30px 60px -40px rgba(22, 33, 29, .3);
  --em-neu-in: inset 1px 1px 2px rgba(22, 33, 29, .10), inset -1px -1px 2px rgba(255, 255, 255, .9);
  --em-neu-out: 1px 1px 2px rgba(22, 33, 29, .08), -1px -1px 2px rgba(255, 255, 255, .85);
  --em-glass: color-mix(in srgb, var(--em-paper-2) 72%, transparent);
  --em-glass-edge: 1px solid color-mix(in srgb, var(--em-rule) 70%, transparent);
}

html[data-theme="dark"] {
  --em-clay-face: linear-gradient(180deg, color-mix(in srgb, var(--em-paper-2) 88%, white) 0%, var(--em-paper-2) 44%, var(--em-paper-3) 100%);
  --em-clay-edge: inset 0 1px 0 rgba(255, 255, 255, .07), inset 0 -1px 0 rgba(0, 0, 0, .4);
  --em-clay-drop: 0 1px 2px rgba(0, 0, 0, .5), 0 16px 30px -20px rgba(0, 0, 0, .8), 0 34px 64px -44px rgba(0, 0, 0, .9);
  --em-neu-in: inset 1px 1px 2px rgba(0, 0, 0, .55), inset -1px -1px 2px rgba(255, 255, 255, .05);
  --em-neu-out: 1px 1px 2px rgba(0, 0, 0, .5), -1px -1px 2px rgba(255, 255, 255, .04);
  --em-glass: color-mix(in srgb, var(--em-paper-2) 62%, transparent);
}

/* ── clay: every card in one material ───────────────────────────────────── */
.em-card,
.em-aotd,
.em-potd,
.em-read,
.em-source,
.em-credit,
.em-panel,
.em-hero-figure {
  background: var(--em-clay-face);
  border: 1px solid var(--em-rule);
  box-shadow: var(--em-clay-edge), var(--em-clay-drop);
}

.em-card,
.em-aotd,
.em-read,
.em-source,
.em-credit,
.em-panel {
  border-radius: var(--em-radius-lg);
}

.em-card:hover,
.em-aotd:hover,
.em-read:hover,
.em-source:hover,
.em-credit:hover {
  transform: translateY(-2px);
  box-shadow: var(--em-clay-edge), 0 2px 4px rgba(22, 33, 29, .06), 0 24px 44px -22px rgba(22, 33, 29, .34), 0 44px 80px -50px rgba(22, 33, 29, .4);
}

/* a panel is a section of the page with its own surface and its own padding */
.em-panel { padding: clamp(16px, 2.4vw, 26px); margin-top: 22px; }
.em-panel > .em-section-head { margin-bottom: 14px; }
.em-panel > .em-section-head h2 { font-size: 19px; }
.em-panel .em-grid { gap: 10px; }

/* ── glass: what floats ─────────────────────────────────────────────────── */
.em-bar {
  background: var(--em-glass);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-bottom: 1px solid color-mix(in srgb, var(--em-rule) 60%, transparent);
}

.em-composer,
.em-ask {
  background: var(--em-glass);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: var(--em-glass-edge);
  box-shadow: var(--em-clay-edge), var(--em-clay-drop);
}

.em-composer:focus-within,
.em-ask:focus-within {
  border-color: color-mix(in srgb, var(--em-green) 60%, var(--em-rule));
  box-shadow: var(--em-clay-edge), 0 0 0 4px color-mix(in srgb, var(--em-green) 12%, transparent), var(--em-clay-drop);
}

/* ── neumo: what you press ──────────────────────────────────────────────── */
.em-chip,
.em-depth,
.em-lang-chip,
.em-starter,
.em-follow button,
.em-actions button {
  background: var(--em-paper-2);
  box-shadow: var(--em-neu-out);
  border: 1px solid color-mix(in srgb, var(--em-rule) 70%, transparent);
}

.em-chip:active,
.em-lang-chip:active,
.em-follow button:active,
.em-actions button:active,
.em-starter:active {
  box-shadow: var(--em-neu-in);
  transform: translateY(1px);
}

.em-depth { box-shadow: var(--em-neu-in); }
.em-depth button[aria-pressed="true"] { box-shadow: var(--em-neu-out); }

/* ── the picture gallery ──────────────────────────────────────────────────
 * One picture is the subject, so it is centred and given the room. Several are
 * a set, so they run in one horizontal line that scrolls sideways — never a
 * column that pushes the article down the page.
 */
.em-pics {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(180px, 24vw, 240px);
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px 14px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.em-pic {
  scroll-snap-align: center;
  border-radius: 18px;
}

.em-pic img { aspect-ratio: 4 / 3; }

/* a single picture: centred, wider, nothing beside it */
.em-pics--single {
  display: block;
  overflow: visible;
  padding: 0 0 6px;
  text-align: center;
}

.em-pics--single .em-pic {
  display: inline-flex;
  width: min(100%, 720px);
  text-align: left;
}

.em-pics--single .em-pic img { aspect-ratio: 16 / 10; }

/* ── no clipped words, anywhere ───────────────────────────────────────────
 * A truncated sentence is a sentence the reader has to guess at. Text wraps,
 * hyphenates where the language allows, and never disappears behind a clamp.
 */
.em-card span,
.em-aotd-extract,
.em-read-body span,
.em-pic-credit,
.em-source .t,
.em-potd-caption {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  hyphens: auto;
}

/* ── the little motion that makes a surface feel alive ──────────────────── */
.em-card,
.em-aotd,
.em-read,
.em-source,
.em-credit,
.em-panel,
.em-pic {
  transition: transform .18s var(--em-ease), box-shadow .18s var(--em-ease), border-color .18s var(--em-ease);
}

@media (prefers-reduced-motion: reduce) {
  .em-card:hover, .em-aotd:hover, .em-read:hover, .em-source:hover, .em-credit:hover { transform: none; }
}

