/* loupe site — the page is a review session: diff rows, hunk pills, comment cards.
   charcoal editor skin, terracotta + diff tints only. mobile-first. */
:root {
  --bg: #1f1e1b;
  --panel: #262624;
  --panel-2: #2e2d2a;
  --line: #3a3833;
  --text: #e8e5da;
  --muted: #a39f90;
  --faint: #6e6a5e;
  --clay: #d97757;
  --clay-soft: #e08a6d;
  --add-bg: #273020;
  --add-tint: #9dc07c;
  --del-bg: #3a2620;
  --del-tint: #e08d74;
  --term-bg: #171613;
  --serif: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
  --maxw: 880px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--mono); font-size: 14px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--clay); text-decoration: none; }
a:hover { color: var(--clay-soft); text-decoration: underline; text-underline-offset: 3px; }
::selection { background: #5a3526; color: #f5e9e2; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── top bar (mimics the app) ── */
.bar {
  position: sticky; top: 0; z-index: 10; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.bar-in { display: flex; align-items: center; gap: 10px; height: 52px; }
.brand { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 21px; color: var(--text); flex: none; }
.brand .spark { color: var(--clay); font-style: normal; margin-right: 5px; }
.brand:hover { text-decoration: none; color: var(--text); }
.mode-pill {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #c9c4b4;
  background: #3a372f; border-radius: 10px; padding: 2px 9px; flex: none;
}
.refpair { display: none; color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.refpair b { color: var(--muted); font-weight: 400; }
.bar .links { margin-left: auto; display: flex; gap: 14px; font-size: 12.5px; flex: none; }
.bar .links a { color: var(--muted); }
.bar .links a.here, .bar .links a:hover { color: var(--clay); text-decoration: none; }

/* ── diff primitives ── */
.fsect { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 26px 0; background: var(--panel); }
.fhead {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  background: var(--panel-2); border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.badge {
  width: 17px; height: 17px; border-radius: 3px; flex: none; color: #1f1e1b;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 10.5px;
}
.badge.m { background: #e8b34b; }
.badge.a { background: #7fae5c; }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.fdelta { margin-left: auto; white-space: nowrap; flex: none; }
.fdelta .plus { color: var(--add-tint); }
.fdelta .minus { color: var(--del-tint); margin-left: 5px; }
.fchip {
  flex: none; font-size: 11px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 3px; padding: 2px 8px;
}

.hunk {
  display: inline-block; font-size: 11.5px; color: #c9b8a4; background: #34302a;
  border-radius: 10px; padding: 2px 12px; margin: 0;
}
.hunk-row { padding: 7px 12px; background: #2a2825; border-bottom: 1px solid var(--line); }

.drow { display: grid; grid-template-columns: 16px 1fr; line-height: 1.85; font-size: 13px; }
.drow .no { display: none; color: var(--faint); text-align: right; padding-right: 9px; user-select: none; }
.drow .sg { color: var(--faint); user-select: none; padding-left: 8px; }
.drow .tx { padding: 0 12px 0 4px; white-space: pre-wrap; word-break: break-word; }
.drow.ctx .tx { color: var(--muted); }
.drow.add { background: var(--add-bg); }
.drow.add .sg { color: var(--add-tint); }
.drow.add .tx { color: #d9e8c8; }
.drow.del { background: var(--del-bg); }
.drow.del .sg { color: var(--del-tint); }
.drow.del .tx { color: #f0cfc2; text-decoration: line-through; text-decoration-color: #a06a58; text-decoration-thickness: 1px; }
.drow mark { background: #50653a; color: #e4f2d4; border-radius: 2px; padding: 0 1px; }
.drow.del mark { background: #6e4032; color: #ffd9c9; text-decoration: none; }

/* ── comment card (the human voice — serif) ── */
.ccard {
  border-left: 3px solid var(--clay); background: var(--panel-2);
  margin: 0 12px 14px 12px; border-radius: 3px; padding: 14px 18px 16px;
  font-family: var(--serif); font-size: 17px; line-height: 1.6; color: #efece1;
}
.ccard-meta {
  display: flex; align-items: center; gap: 10px; font-family: var(--mono);
  font-size: 11px; color: var(--faint); margin-bottom: 8px;
}
.ccard h1, .ccard h2 { font-size: 26px; font-weight: 500; font-style: italic; margin: 0 0 8px; letter-spacing: -.01em; }
.ccard p { margin: 0 0 10px; }
.ccard p:last-of-type { margin-bottom: 0; }
.ccard strong { color: #fff; font-weight: 600; }
.ccard em { color: var(--clay-soft); }
.tag-pill {
  font-size: 10px; letter-spacing: .06em; border-radius: 9px; padding: 2px 9px; color: #1f1e1b; font-weight: 600;
}
.tag-praise { background: #7fae5c; }
.tag-issue { background: #d97757; }
.tag-nit { background: #9b968a; }
.tag-question { background: #6f9fd8; }
.gap { margin-top: 13px; }

/* buttons */
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; font-family: var(--mono); margin-top: 14px; }
.btn {
  font-size: 13px; padding: 9px 18px; border-radius: 5px; border: 1px solid var(--clay);
  color: var(--clay); white-space: nowrap;
}
.btn:hover { text-decoration: none; background: #33271f; color: var(--clay-soft); }
.btn.solid { background: var(--clay); color: #1f1e1b; font-weight: 600; }
.btn.solid:hover { background: var(--clay-soft); }

/* ── terminal ── */
.term {
  background: var(--term-bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; font-size: 12px; line-height: 1.9; white-space: pre;
  overflow-x: auto; -webkit-overflow-scrolling: touch; color: #cfccc0;
}
.term .ps1 { color: var(--clay); user-select: none; }
.term .cmd { color: #e8e5da; font-weight: 500; }
.term .dim { color: var(--faint); }
.term .ok { color: var(--add-tint); }

/* ── feature blocks: each one styled as an added line + annotation ── */
.feats { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 22px 0; }
.feat { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--panel); }
.feat-line {
  display: flex; gap: 9px; background: var(--add-bg); color: #d9e8c8;
  padding: 7px 12px; font-size: 13px;
}
.feat-line b { color: var(--add-tint); font-weight: 400; flex: none; }
.feat p {
  margin: 0; padding: 10px 14px 13px; font-family: var(--serif);
  font-size: 15.5px; line-height: 1.55; color: #cdc9bb;
}
.feat p code { font-size: .8em; }

/* inline code */
code {
  font-family: var(--mono); font-size: .85em; background: #34322c;
  border: 1px solid var(--line); border-radius: 4px; padding: .1em .4em; color: #e4e0d2;
}

/* ── screenshots ── */
.strip { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 22px 0; }
.strip figure { margin: 0; }
.strip .frame { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.strip .chrome { display: flex; gap: 6px; padding: 8px 11px; border-bottom: 1px solid var(--line); }
.strip .chrome i { width: 9px; height: 9px; border-radius: 50%; background: #46433c; }
.strip .chrome i:first-child { background: var(--clay); opacity: .75; }
.strip img { display: block; width: 100%; }
.strip figcaption { font-size: 11.5px; color: var(--faint); margin-top: 8px; }
.strip figcaption::before { content: "# "; color: var(--clay); }
.strip .frame video { display: block; width: 100%; }

/* ── demos: a single wide gif/video in browser chrome (hero + inline docs) ── */
.demo { margin: 22px 0; }
.demo .frame { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.demo .chrome { display: flex; gap: 6px; padding: 8px 11px; border-bottom: 1px solid var(--line); }
.demo .chrome i { width: 9px; height: 9px; border-radius: 50%; background: #46433c; }
.demo .chrome i:first-child { background: var(--clay); opacity: .75; }
.demo .frame img, .demo .frame video { display: block; width: 100%; }
.demo figcaption { font-size: 11.5px; color: var(--faint); margin-top: 8px; }
.demo figcaption::before { content: "# "; color: var(--clay); }
.prose .demo { margin: 18px 0 6px; }

/* ── lightbox: click any framed shot/gif to view it full-size ── */
.frame img.zoomable { cursor: zoom-in; }
.lb-backdrop {
  position: fixed; inset: 0; z-index: 1000; padding: 4vmin; cursor: zoom-out;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 9, 8, .85); opacity: 0; transition: opacity .18s ease;
}
.lb-backdrop.on { opacity: 1; }
.lb-img {
  max-width: 95vw; max-height: 92vh; border-radius: 8px;
  border: 1px solid var(--line); box-shadow: 0 16px 60px rgba(0, 0, 0, .6);
  transform: scale(.98); transition: transform .18s ease;
}
.lb-backdrop.on .lb-img { transform: scale(1); }
.lb-hint { position: fixed; bottom: 18px; left: 0; right: 0; text-align: center; color: var(--faint); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .lb-backdrop, .lb-img { transition: none; } }

/* ── sections ── */
section { margin: 56px 0 0; }
.sect-label { margin-bottom: 6px; }
.zoom-tip { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }

/* ── footer ── */
footer { margin-top: 70px; border-top: 1px solid var(--line); background: var(--panel); }
.foot { padding: 22px 0 30px; font-size: 12.5px; color: var(--faint); }
.no-newline { color: var(--faint); margin: 0 0 12px; }
.no-newline b { color: var(--del-tint); font-weight: 400; }
.foot-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.foot-row .spark { color: var(--clay); }
.foot-row .links { margin-left: auto; display: flex; gap: 14px; }

/* ── docs layout ── */
.docs { padding: 30px 0 10px; }
/* mobile: a sticky, horizontally-scrollable strip of section pills under the top bar */
.toc {
  position: sticky; top: 52px; z-index: 9;
  display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  padding: 8px; margin-bottom: 26px; font-size: 12.5px;
}
.toc::-webkit-scrollbar { display: none; }
.toc-title { display: none; }
.toc a { display: flex; flex: none; align-items: center; gap: 7px; white-space: nowrap; color: var(--muted); border-radius: 6px; padding: 5px 11px; }
.toc a:hover { background: #31302c; color: var(--clay); text-decoration: none; }
.toc a.active { color: var(--clay); background: #322a26; }
.toc .badge { display: none; width: 15px; height: 15px; font-size: 9.5px; }
.prose h1 { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 34px; margin: 8px 0 6px; }
.prose > p, .prose li { font-family: var(--serif); font-size: 16.5px; line-height: 1.65; color: #d5d1c4; }
.prose h2 { margin: 52px 0 14px; font-size: inherit; font-weight: 400; scroll-margin-top: 108px; }
.prose h3 { font-family: var(--serif); font-style: italic; font-size: 19px; font-weight: 500; margin: 26px 0 6px; color: #efece1; }
.prose .term { margin: 16px 0; }
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 14px 0; }
.prose table { border-collapse: collapse; width: 100%; min-width: 430px; font-size: 13px; }
.prose th {
  text-align: left; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); font-weight: 500; padding: 0 18px 7px 0;
}
.prose td { border-top: 1px solid var(--line); padding: 8px 18px 8px 0; vertical-align: top; }
.prose td:first-child { white-space: nowrap; }
.prose tr:hover td { background: #2a2926; }
kbd {
  font-family: var(--mono); font-size: 11px; background: #34322c; color: var(--text);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 2px 7px;
}
.note {
  border-left: 3px solid var(--clay); background: var(--panel-2); border-radius: 3px;
  padding: 12px 16px; margin: 16px 0; font-family: var(--serif); font-size: 15.5px; color: #d5d1c4;
}

/* entrance — hero rows slide in like a diff loading */
.rise { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
.rise.d1 { animation-delay: .06s; } .rise.d2 { animation-delay: .12s; }
.rise.d3 { animation-delay: .18s; } .rise.d4 { animation-delay: .26s; }
@keyframes rise { from { opacity: 0; transform: translateX(-7px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } html { scroll-behavior: auto; } }

/* ── ≥640px: line numbers appear, grids widen, type breathes ── */
@media (min-width: 640px) {
  body { font-size: 15px; }
  .wrap { padding: 0 24px; }
  .refpair { display: block; }
  .drow { grid-template-columns: 38px 38px 18px 1fr; font-size: 13.5px; }
  .drow .no { display: block; background: rgba(0,0,0,.14); }
  .drow.add .no { background: rgba(127,174,92,.1); }
  .drow.del .no { background: rgba(224,141,116,.08); }
  .term { font-size: 13px; padding: 16px 20px; }
  .ccard { margin: 4px 16px 16px 16px; padding: 16px 22px 18px; font-size: 18px; }
  .ccard h1, .ccard h2 { font-size: 32px; }
  .feats { grid-template-columns: 1fr 1fr; gap: 14px; }
  .strip { grid-template-columns: repeat(3, 1fr); }
  .strip.m2 { grid-template-columns: 1fr 1fr; } /* motion gifs: fewer, larger tiles */
  .docs { display: grid; grid-template-columns: 205px 1fr; gap: 40px; align-items: start; }
  /* desktop: back to a vertical, sticky list in the left column */
  .toc { position: sticky; top: 76px; z-index: auto; display: block; overflow: visible; padding: 10px 0; margin-bottom: 0; font-size: 13px; }
  .toc-title { display: block; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); padding: 2px 14px 8px; }
  .toc a { border-radius: 0; gap: 9px; padding: 4px 14px; }
  .toc .badge { display: inline-flex; }
  .prose { min-width: 0; }
  .prose h1 { font-size: 40px; }
  .prose h2 { scroll-margin-top: 66px; }
}

@media (min-width: 880px) {
  .ccard h1, .ccard h2 { font-size: 38px; }
}
