/* =============================================================
   paper.css — the whole site in the timeline's design language.

   Load order on every page: decoder.css (components), site.css
   (shared components), then this. It retunes their tokens to the
   timeline's cream paper and ink, sets Fira Sans with italic
   display type, turns buttons into pills, and adds what every page
   shares around its content: the header, the menu, the intro, the
   Quick exit, and on the home page the capsule (#gate) and the
   case file's panel (#sheet).

   Measured off the reference at 1440×900: paper #fff8f5, ink
   #353433, chip borders #f1eae8, panels #fcefeb, pills 36px tall
   with a 20px radius, round buttons that fill with ink from the
   middle on hover, menu links 48px italic.
   ============================================================= */

:root {
  --ink:        #fff8f5;   /* page ground — paper */
  --ink-2:      #fcefeb;   /* panels */
  --ink-3:      #f7e8e2;   /* insets */
  --line:       #eadcd5;
  --line-soft:  #f1eae8;
  --paper:      #353433;   /* primary text — ink */
  --paper-dim:  #686868;
  --paper-faint:#8a8380;

  --accent:     #353433;
  --accent-ink: #fff8f5;
  --sev-1:      #7d6fa8;   /* concerning — the notes lane's violet */
  --sev-2:      #d17a1c;   /* serious — the recordings lane's orange, darkened to read on paper */
  --sev-3:      #c2412b;   /* critical */
  --safe:       #4a4848;

  --sans: "Fira Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Fira Sans", "Segoe UI", system-ui, sans-serif;
  --display: "Fira Sans Condensed", "Fira Sans", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --h-mono: var(--mono);
  --h-sans: var(--sans);
  --radius: 20px;
}

html { color-scheme: light; }
body.paper {
  background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: 15px;
}
body.paper::selection, body.paper ::selection { background: #fcb485; color: #353433; }
:focus-visible { outline-color: var(--paper); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { background: var(--paper); color: var(--ink); border-radius: 20px; }
.noscript { position: fixed; inset: auto 20px 40px; z-index: 200; padding: 16px 20px; border-radius: 20px; background: var(--ink-2); color: var(--paper); text-align: center; }

/* a sky of faint dots (shell.js) behind pages that aren't the timeline */
.page-sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.page-sky svg { width: 100%; height: 100%; }
.page-sky path { fill: none; stroke-width: 1; opacity: .7; }
.page-sky svg { animation: sky-drift 60s ease-in-out infinite alternate; }
@keyframes sky-drift { to { transform: translate(-14px, 10px); } }

/* ---------- type ---------- */
.paper h1:not(.dv *), .paper h2:not(.dv *), .paper h3:not(.dv *), .hero h1, .hero h2, .panel h2, .section-head h3, .verdict h3, .drawer h3, .card h3 {
  font-family: var(--sans); font-style: italic; font-weight: 700; letter-spacing: -.005em;
}
.hero h1 { font: italic 600 clamp(38px, 5vw, 56px)/1.04 var(--display); max-width: 18ch; }
.hero h1 em { font-style: italic; color: inherit; background: linear-gradient(90deg, #f77864, #fe963b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 17px; line-height: 1.6; }
.kicker { font: italic 400 15px var(--sans); color: var(--paper-faint); }
a { color: var(--paper); text-underline-offset: 3px; }

/* ---------- pills: buttons and links ---------- */
.paper button:not(.dv *), .paper a.button, .pill {
  font: 400 14px/1 var(--sans); border-radius: 20px; min-height: 36px; padding: 10px 18px;
  border: 1px solid var(--line-soft); background: var(--ink); color: #585858;
  transition: background-color .2s, color .2s, border-color .2s; box-shadow: none;
}
.paper button:not(.dv *):hover, .paper a.button:hover, .pill:hover { transform: none; background: #f6ebe7; border-color: var(--line-soft); color: var(--paper); }
.paper button.primary:not(.dv *), .paper a.button.primary, .pill.dark {
  background: var(--paper); border-color: var(--paper); color: var(--ink); font: italic 500 16px/1 var(--sans); padding: 12px 24px; min-height: 44px;
}
.paper button.primary:not(.dv *):hover, .paper a.button.primary:hover, .pill.dark:hover { background: #000; border-color: #000; color: var(--ink); box-shadow: none; }
.paper button.quiet { background: transparent; border-color: transparent; color: var(--paper-dim); text-decoration: underline; text-underline-offset: 3px; }
.paper button.quiet:hover { background: transparent; color: var(--paper); }
.pill { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer; }
.round-btn {
  position: relative; isolation: isolate; display: grid; place-items: center; width: 36px; height: 36px; min-height: 0; padding: 0 !important;
  border-radius: 50% !important; border: 1px solid var(--paper) !important; background: transparent !important; color: var(--paper) !important; cursor: pointer;
}
.round-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.round-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 50%; background: var(--paper); transform: scale(0); transition: transform .25s; }
.round-btn:hover { color: var(--ink) !important; }
.round-btn:hover::before { transform: scale(1); }

/* ---------- fields ---------- */
.field, .form input[type="text"], .form input[type="password"], .form input[type="search"],
.form input[type="datetime-local"], .form select, .form textarea, select#you, .file-actions select {
  background: #fff; color: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 10px 16px; font-size: 15px; min-height: 44px;
}
.form textarea, textarea.field { border-radius: 18px; }
.field:focus, .form input:focus, .form select:focus, .form textarea:focus, select#you:focus, .file-actions select:focus {
  border-color: var(--paper); box-shadow: 0 0 0 3px rgba(53, 52, 51, .08);
}
.form label, .form legend, .file-actions label { font-style: italic; font-size: 13.5px; color: var(--paper-dim); }
.form-title { font: italic 700 20px/1.2 var(--sans); }
.kinds label { border-radius: 20px; min-height: 40px; border-color: var(--line); background: #fff; font-size: 14px; }
.kinds label:has(input:checked) { border-color: var(--paper); background: var(--paper); color: var(--ink); }
.kinds label { position: relative; }
.kinds input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kinds label:has(input:focus-visible) { outline: 2px solid var(--paper); outline-offset: 2px; }
.form input[type="file"]::file-selector-button, .uploadzone input[type="file"]::file-selector-button {
  margin-right: 10px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--ink); color: var(--paper); font: italic 400 14px var(--sans); cursor: pointer;
}
.notice { border-radius: 16px; background: #fff; border-color: var(--line); }
.panel .inset, .form.inset { background: #fff8f5; border-color: var(--line); border-radius: 24px; }

/* ---------- the decoder's components on paper ---------- */
.hero .privacy { color: var(--paper-dim); background: var(--ink-2); border-color: var(--line-soft); font-style: italic; }
textarea#input { background: #fff; border-radius: 24px; box-shadow: none; }
textarea#input:focus { border-color: var(--paper); box-shadow: 0 0 0 4px rgba(53, 52, 51, .07); }
.verdict, .annotated, .finding, .answer, .deep-card, .person, .moves li, .panel, .card, .uz-item, .script, .drawer .note, .entry, .proof-list li {
  background: var(--ink-2); border-color: transparent; border-radius: 20px;
}
.finding { border-left: 4px solid var(--sev, var(--paper-faint)); }
.entry { border-left: 4px solid #fe963b; }
.verdict { background: linear-gradient(90deg, rgba(254, 198, 80, .22), rgba(247, 120, 100, .16) 50%, rgba(120, 151, 226, .16)), var(--ink-2); border-radius: 28px; }
.verdict::before { width: 4px; }
.verdict[data-band="clear"] { --band: #6f9b5c; }
.index-row .track { background: #efe3dd; }
.index-row .fill { background: linear-gradient(90deg, #fec650, #f77864 55%, #945b96); background-size: 340px 100%; background-repeat: no-repeat; }
.annotated { font-size: 16.5px; }
.annotated mark[data-sev="1"] { background: rgba(125, 111, 168, .14); }
.annotated mark[data-sev="2"] { background: rgba(254, 150, 59, .2); }
.annotated mark[data-sev="3"] { background: rgba(247, 120, 100, .24); }
.annotated mark:hover { filter: none; background: #353433; color: #fff8f5; }
.safety { border-color: #f3c2a6; background: #fff1e5; border-radius: 20px; }
.safety p, .safety ul { color: var(--paper); }
.safety h3, .safety a { color: #b4471f; }
.drawer { background: #fcefeb; border-left: 0; border-radius: 20px 0 0 20px; box-shadow: -20px 0 60px rgba(80, 50, 40, .14); }
.drawer p, .script, .script .s { color: var(--paper); }
.drawer .close { border-radius: 50%; background: transparent; border: 1px solid var(--paper); color: var(--paper); }
.scrim { background: rgba(244, 235, 235, .75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.vbtn[aria-pressed="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.finding .call[data-v="fits"], .moves .why, .finding .sev-chip, .drawer .chip, .moves h4 .n, .deep-read h4 .n { font-family: var(--sans); font-style: italic; }
.uploadzone { border-radius: 20px; border-color: var(--line); background: #fff; }
.uploadzone.drag { background: #fff1e5; border-color: #fe963b; }
.uz-media, .entry-media { background: #2b2a29; border-color: transparent; border-radius: 16px; }
footer.foot { border-top: 1px solid var(--line-soft); color: var(--paper-faint); }
.proof-list .ok { color: #4f7d3f; }
.proof-list .bad, .proof-list .changed { color: var(--sev-3); }
.felt svg { color: var(--paper-faint); }
.status { font-style: italic; }

/* ---------- the Quick exit: a dark pill at the top right, on every page ---------- */
.quick-exit {
  top: 16px; right: 24px; bottom: auto; z-index: 3000;
  display: inline-flex; align-items: center; height: 42px; padding: 0 20px; border-radius: 21px;
  background: var(--paper); color: var(--ink); font: italic 500 15px/1 var(--sans); box-shadow: none;
}
.quick-exit:hover { background: #000; color: var(--ink); }
.quick-exit:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }

/* ---------- the header on pages that aren't the timeline ---------- */
.ph-top {
  position: relative; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 16px 24px 0; min-height: 58px;
}
.ph-brand { display: flex; align-items: center; gap: 10px; }
.ph-burger { display: grid; place-items: center; width: 36px; height: 36px; padding: 0 !important; border: 0 !important; background: transparent !important; color: var(--paper) !important; border-radius: 50% !important; }
.ph-burger:hover { background: #f6ebe7 !important; }
.ph-burger svg, .ph-tags svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.ph-mark { display: flex; align-items: center; gap: 9px; color: var(--paper); text-decoration: none; }
.ph-mark .lines { display: grid; gap: 3px; width: 26px; }
.ph-mark .lines i { display: block; height: 4px; border-radius: 2px; background: linear-gradient(90deg, #fec650, #fcb485); }
.ph-mark .lines i:nth-child(2) { background: linear-gradient(90deg, #f77864, #fe963b); width: 80%; }
.ph-mark .lines i:nth-child(3) { background: linear-gradient(90deg, #945b96, #7897e2); width: 90%; }
.ph-mark .words { display: grid; line-height: 1.1; }
.ph-mark b { font: italic 600 17px/1.05 var(--sans); }
.ph-mark small { font: italic 400 11px/1.25 var(--sans); color: var(--paper-dim); }
.ph-tags { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.ph-tags a { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border: 1px solid var(--line-soft); border-radius: 20px; color: #585858; text-decoration: none; font-size: 14px; transition: background-color .2s, color .2s; }
.ph-tags a:hover { background: #f6ebe7; color: var(--paper); }
.ph-tags a[aria-current="page"] { background: var(--paper); border-color: var(--paper); color: var(--ink); }
main.wrap, footer.foot { position: relative; z-index: 1; }
@media (max-width: 860px) {
  .ph-top { grid-template-columns: 1fr; padding: 10px 12px 0; }
  .ph-brand { padding-right: 120px; }
  .ph-tags { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 8px; padding-bottom: 4px; }
  .ph-tags a { flex: 0 0 auto; white-space: nowrap; height: 34px; padding: 0 14px; }
  .quick-exit { top: 10px; right: 12px; height: 36px; padding: 0 16px; font-size: 14px; }
}

/* ---------- the menu: a tall panel from the left, the page blurred behind it ---------- */
.mn-bg {
  position: fixed; inset: 0; z-index: 1999; background: #f4ebebd3; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; transition: opacity .25s;
}
.mn-bg.in { opacity: 1; }
.mn {
  position: fixed; left: 16px; top: 16px; z-index: 2000; width: min(550px, calc(100vw - 32px)); height: calc(100% - 32px);
  overflow-y: auto; overscroll-behavior: contain; padding: 0 32px 24px; border-radius: 20px; background: #fcefeb; color: var(--paper);
  display: flex; flex-direction: column; opacity: 0; transition: opacity .25s; outline: none;
}
.mn.in { opacity: 1; }
.mn[hidden], .mn-bg[hidden] { display: none; }
.mn-head { position: sticky; top: 0; z-index: 2; display: flex; gap: 10px; padding: 24px 0; background: linear-gradient(180deg, #fcefea 70%, rgba(252, 239, 234, 0)); }
.mn-items { flex: 1; }
.mn-list { list-style: none; }
.mn-list[hidden] { display: none; }
.mn-list li { position: relative; border-bottom: 1px solid #70707039; }
.mn-list li::after { content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 1px; background: var(--paper); transition: width .5s; }
.mn-list li:hover::after, .mn-list li:focus-within::after { width: 100%; }
.mn-list a, .mn-list button {
  all: unset; box-sizing: border-box; display: block; width: 100%; padding: 24px 0; cursor: pointer;
  font: italic 500 clamp(30px, 3.4vw, 48px)/1 var(--sans); color: var(--paper);
}
.mn-list a:focus-visible, .mn-list button:focus-visible { outline: 2px solid var(--paper); outline-offset: 4px; border-radius: 6px; }
.mn-page { padding-bottom: 20px; font-size: 16px; line-height: 1.6; }
.mn-page[hidden] { display: none; }
.mn-page-h { font: italic 500 clamp(30px, 3.4vw, 48px)/1 var(--sans) !important; margin: 0 0 22px; outline: none; }
.mn-page > p, #seal-demo > p { margin-top: 12px; color: var(--paper); }
.mn-page .families { grid-template-columns: 1fr 1fr; margin: 18px 0; }
.mn-page .families div { border-left: 3px solid #fe963b; }
.mn-page .families div:nth-child(3n+1) { border-color: #fec650; }
.mn-page .families div:nth-child(3n) { border-color: #945b96; }
.mn-page .families dt { font-weight: 600; }
.mn-page .families dd { color: var(--paper-dim); font-size: 14.5px; }
.mn-page .before li { border-left: 3px solid #f0d9c9; color: var(--paper); font-size: 15px; }
.mn-page .before strong { color: var(--paper); }
.mn-page .controls { margin-top: 16px; }
.mn-page .proof-list li { background: #fff8f5; }
.mn-foot { margin-top: 20px; }
.mn-legal { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 20px 0; border-bottom: 1px solid #70707039; border-top: 1px solid #70707039; }
.mn-legal a { font-weight: 600; font-size: 14px; text-decoration: none; color: var(--paper); }
.mn-legal a:hover { text-decoration: underline; }
.mn-small { margin-top: 16px; font-size: 13px; color: var(--paper-dim); }
@media (max-width: 600px) { .mn { padding: 0 20px 20px; } .mn-page .families { grid-template-columns: 1fr; } }

/* ---------- the intro ---------- */
.ob {
  position: fixed; inset: 0; z-index: 2500; display: flex; align-items: center; justify-content: center;
  background: #fff8f5f9; opacity: 0; transition: opacity .25s; overflow-y: auto; padding: 20px;
}
.ob.in { opacity: 1; }
.ob[hidden] { display: none; }
.ob-wrap { width: min(1035px, 100%); }
.ob-title { font: italic 600 24px/1.2 var(--sans); margin: 0 0 30px; outline: none; }
.ob-slides { background: #fcefea; border-radius: 20px; padding: 8px; }
.ob-slide { display: flex; gap: 20px; min-height: min(420px, 60vh); }
.ob-text { flex: 0 0 min(300px, 34%); display: flex; flex-direction: column; padding: 16px 0 16px 16px; }
.ob-count { font-size: 14px; color: var(--paper); }
.ob-slide-h { font: italic 600 24px/1.2 var(--sans); margin: 24px 0 18px; }
.ob-text > p:not(.ob-count) { font-size: 18px; line-height: 1.3; }
.ob-nav { display: flex; gap: 10px; margin-top: auto; padding-top: 24px; }
.ob-pic { flex: 1; min-width: 0; display: grid; place-items: center; border-radius: 14px; overflow: hidden; background: #fff8f5; }
.ob-art { width: 100%; height: 100%; max-height: 404px; }
.ob-btn, .paper .ob-btn {
  padding: 12px 24px; min-height: 0; border-radius: 36px; font: italic 400 18px/1 var(--sans);
  border: 1px solid var(--paper); background: var(--ink); color: var(--paper);
}
.ob-btn.dark, .paper .ob-btn.dark { background: var(--paper); color: var(--ink); }
.ob-btn:hover, .paper .ob-btn:hover { background: #000; color: var(--ink); border-color: #000; }
.ob-dots { display: flex; gap: 14px; justify-content: center; margin-top: 18px; }
.ob-dots i { width: 10px; height: 10px; border-radius: 50%; background: #d8cfcb; }
.ob-dots i.on { background: var(--paper); }
.ob-skip { display: flex; justify-content: flex-end; margin-top: -10px; }
@media (max-width: 720px) {
  .ob { align-items: flex-start; }
  .ob-slide { flex-direction: column-reverse; min-height: 0; }
  .ob-text { flex: 0 0 auto; padding: 4px 12px 12px; }
  .ob-slide-h { margin: 10px 0 8px; font-size: 21px; }
  .ob-text > p:not(.ob-count) { font-size: 16px; }
  .ob-skip { margin-top: 14px; }
  .ob-title { padding-right: 120px; font-size: 21px; }
}

/* ---------- the home page: the capsule over the timeline while the file is locked ---------- */
body.home-app { overflow: hidden; }
.gate { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; outline: none; }
.gate[hidden] { display: none; }
.gate > * { pointer-events: auto; }
.gate-band { position: absolute; left: 0; right: 0; top: 20%; height: 60%; pointer-events: none; background: linear-gradient(90deg, rgba(255, 248, 245, .55), rgba(255, 248, 245, .35)); }
.gate-band i { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: #fff5e882; }
.gate-card {
  --h: min(max(28vw, 380px), 500px, calc(100vh - 220px));
  position: relative; display: flex; gap: 33px; width: min(1000px, calc(100vw - 40px)); height: var(--h);
  border-radius: 800px; background: rgba(255, 248, 245, .9); box-shadow: 0 20px 60px rgba(120, 70, 50, .10);
  overflow: hidden; animation: gate-in .5s ease both;
}
@keyframes gate-in { from { opacity: 0; } }
.gate-disc { flex: 0 0 var(--h); height: var(--h); padding: 10px; }
.gate-disc svg { width: 100%; height: 100%; border-radius: 50%; display: block; }
.gate-text { flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: clamp(28px, 9%, 60px) clamp(40px, 9%, 100px) 30px 0; }
.gate-text h2 { font: italic 700 clamp(24px, 2.4vw, 32px)/1.06 var(--sans); }
.gate-when { margin-top: 6px; font: italic 400 clamp(17px, 1.7vw, 24px)/1.25 var(--sans); color: var(--paper-faint); }
.gate #file-body { margin-top: 16px; }
.gate .form { margin-top: 0 !important; max-width: none !important; }
.gate .form > * + * { margin-top: 12px; }
.gate .form-title { display: none; }
.gate .hint-line { font-size: 14px; margin-top: 0; }
.gate .controls { margin-top: 14px; }
.gate .notice { margin-bottom: 10px; font-size: 14px; }
.gate-links { position: relative; display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; justify-content: center; }
.gate-links .pill { background: var(--ink); }
body.mn-open .gate, body.ob-open .gate { visibility: hidden; }
@media (max-width: 720px) {
  .gate { justify-content: flex-start; padding: 150px 14px 40px; overflow-y: auto; }
  .gate-card { --h: 92px; flex-direction: column; gap: 0; height: auto; max-height: none; border-radius: 26px; width: 100%; flex-shrink: 0; }
  .gate-disc { flex: 0 0 auto; width: var(--h); margin: 8px 0 0 8px; padding: 4px; }
  .gate-text { padding: 10px 18px 20px; overflow: visible; }
  .gate-band { display: none; }
  .gate { background: rgba(255, 248, 245, .7); }
  .gate-card { background: #fff8f5; }
}

/* ---------- the home page: the case file's own panel, from the right ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 1500; background: #f4ebebb0; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s; }
.sheet-bg.in { opacity: 1; }
.sheet {
  position: fixed; right: 16px; top: 70px; z-index: 1600; width: min(680px, calc(100vw - 32px)); height: calc(100% - 86px);
  overflow-y: auto; overscroll-behavior: contain; padding: 0 32px 40px; border-radius: 20px; background: #fcefeb; outline: none;
  opacity: 0; transform: translateX(24px); transition: opacity .25s, transform .35s cubic-bezier(.22, 1, .36, 1);
}
.sheet.in { opacity: 1; transform: none; }
.sheet[hidden], .sheet-bg[hidden] { display: none; }
.sheet-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 16px; padding: 24px 0 16px; background: linear-gradient(180deg, #fcefea 75%, rgba(252, 239, 234, 0)); }
.sheet-title { font: italic 500 clamp(28px, 3vw, 40px)/1 var(--sans) !important; }
.sheet .form.inset { background: #fff8f5; }
.sheet .entry { background: #fff8f5; }
.sheet .entries { margin-bottom: 20px; }
.sheet .filters { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px) {
  .sheet { right: 0; top: 0; width: 100vw; height: 100%; border-radius: 0; padding: 0 16px 60px; }
  .sheet .filters { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .page-sky svg { animation: none; }
}
