/* The Open Files — platform stylesheet
   Void black, amber / ash, Georgia. Mobile first. */

:root {
  --void: #000000;
  --surface: #0c0906;
  --surface-2: #151009;
  --line: #2a2118;
  --line-strong: #4a3a28;
  --amber: #c8631a;
  --gold: #d4a060;
  --rust: #9a6030;
  --ink: #dcd2c2;
  --ash: #a0968a;
  --muted: #6b6259;
  --danger: #b8503a;
  --ok: #8f9f5a;

  --font: Georgia, "Times New Roman", "Noto Serif", serif;
  --measure: 40rem;
  --tap: 3rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--void); }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--void);
  position: relative;
  overflow-x: hidden;
}

/* Candlelight: one warm source near the top, fading to true black. */
.candle {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 40vh at 50% -5vh, rgba(200, 99, 26, .22), transparent 70%),
    radial-gradient(120vw 90vh at 50% 110%, rgba(0,0,0,.9), transparent 60%);
}
@media (min-width: 48rem) {
  .candle { background:
    radial-gradient(40vw 32vh at 50% -6vh, rgba(200, 99, 26, .18), transparent 70%),
    radial-gradient(120vw 90vh at 50% 110%, rgba(0,0,0,.9), transparent 60%); }
}

a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: .15em; }
a:hover { color: var(--amber); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

h1, h2, h3 { font-weight: normal; line-height: 1.15; margin: 0 0 .5rem; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; margin-top: 2rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }
.lede { color: var(--ash); font-size: 1.05rem; }
.fineprint { color: var(--muted); font-size: .9rem; margin-top: 1.5rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Frame -------------------------------------------------------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 10;
}
.brand { color: var(--gold); text-decoration: none; font-size: 1.1rem; letter-spacing: .04em; }
.brand small { color: var(--muted); font-size: .8rem; margin-left: .4rem; }

.nav { display: flex; align-items: center; gap: 1.1rem; }
.nav a { color: var(--ash); text-decoration: none; font-size: .95rem; padding: .3rem 0; }
.nav a.active, .nav a:hover { color: var(--ink); }
.nav a.nav-cta { color: var(--gold); }
.nav .inline { display: inline; }

/* Logged-in investigators get a thumb bar on phones; the top nav stays for desktop. */
.nav-bottom { display: none; }
@media (max-width: 47.99rem) {
  body.is-investigator .nav-top { display: none; }
  body.is-investigator .nav-bottom {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: rgba(0,0,0,.92);
    border-top: 1px solid var(--line);
    padding-bottom: var(--safe-bottom);
  }
  .nav-bottom a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
    min-height: var(--tap); padding: .5rem 0; font-size: .75rem; position: relative;
  }
  .nav-bottom .nb-icon { font-size: 1rem; line-height: 1; color: var(--muted); }
  .nav-bottom a.active .nb-icon { color: var(--amber); }
  .nb-badge {
    position: absolute; top: .35rem; left: calc(50% + .5rem);
    min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 999px;
    background: var(--amber); color: #000; font-size: .7rem; line-height: 1.15rem; text-align: center;
  }
  body.is-investigator .page { padding-bottom: 5.5rem; }
  body.is-investigator .footer { display: none; }
}

.page { max-width: var(--measure); margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.page-wide { max-width: 64rem; }

.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 2rem 1rem 3rem; }
.rule { display: flex; align-items: center; gap: .75rem; margin: 0 auto 1rem; max-width: 16rem; color: var(--rust); }
.rule span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.rule i { font-style: normal; font-size: .6rem; }

.flash { padding: .75rem 1rem; margin-bottom: 1.25rem; border: 1px solid var(--line-strong); background: var(--surface); }
.flash-error { border-color: var(--danger); color: #e7b0a3; }
.flash-success { border-color: var(--ok); color: #cfd8a8; }

/* ---- Landing ------------------------------------------------------ */

.hero { padding: 2.5rem 0 1.5rem; }
.hero h1 { font-size: clamp(2.6rem, 9vw, 4rem); margin: .25rem 0 .75rem; }
.hero-kicker { color: var(--rust); margin: 0; font-style: italic; }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }

.how { margin-top: 2.5rem; }
.how-list { margin: 0; padding: 0; }
.how-list > div { padding: .9rem 0; border-top: 1px solid var(--line); }
.how-list dt { color: var(--gold); margin-bottom: .2rem; }
.how-list dd { margin: 0; color: var(--ash); }

.prose h1 { margin-bottom: 1rem; }

/* ---- Documents (in-fiction paper) -------------------------------- */

.document {
  position: relative;
  margin: 1.5rem 0;
  padding: 1.25rem 1.25rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background-image: repeating-linear-gradient(180deg, transparent 0 1.55rem, rgba(212,160,96,.05) 1.55rem 1.6rem);
}
.document::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 60px rgba(0,0,0,.6);
}
.doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; margin-bottom: .75rem; color: var(--gold); border-bottom: 1px solid var(--line-strong); padding-bottom: .5rem; }
.doc-meta { color: var(--ash); font-style: italic; font-size: .95rem; }
.doc-continue { margin: .5rem 0 0; }
.document-teaser p { font-style: italic; }

/* ---- Forms -------------------------------------------------------- */

.form-page h1 { margin-bottom: .25rem; }
.form { margin-top: 1.5rem; }
.form + .form { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.field { margin-bottom: 1.25rem; }
.field label { display: block; margin-bottom: .35rem; color: var(--ash); }
.opt { color: var(--muted); font-size: .85rem; font-style: italic; }
input[type=text], input[type=password], input[type=email], input[type=number], textarea, select {
  width: 100%; min-height: var(--tap);
  padding: .65rem .8rem;
  font: inherit; font-size: 1rem; /* 16px+ stops iOS zooming on focus */
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 2px;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); outline: none; }
.hint { color: var(--muted); font-size: .9rem; margin: .35rem 0 0; }
.error { color: #e7b0a3; font-size: .95rem; margin: .35rem 0 0; }
.has-error input { border-color: var(--danger); }
.check { display: flex; align-items: flex-start; gap: .6rem; color: var(--ink); cursor: pointer; }
.check.small { color: var(--muted); font-size: .9rem; margin-top: .5rem; }
.check input { width: 1.25rem; height: 1.25rem; margin: .2rem 0 0; accent-color: var(--amber); flex: none; }
.alt { color: var(--muted); margin-top: 1rem; }

.warning { border: 1px solid var(--rust); background: rgba(154, 96, 48, .12); padding: 1rem; margin-bottom: 1.5rem; }
.warning p { margin-bottom: .75rem; }
.warning.has-error { border-color: var(--danger); }
.warning[hidden] { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: .6rem 1.25rem;
  font: inherit; font-size: 1rem;
  color: var(--ink); background: transparent; border: 1px solid var(--line-strong); border-radius: 2px;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--gold); color: var(--ink); }
.btn-primary { background: var(--amber); border-color: var(--amber); color: #000; }
.btn-primary:hover { background: var(--gold); border-color: var(--gold); color: #000; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: .3rem 0; font: inherit; font-size: .95rem; color: var(--ash); cursor: pointer; }
.linklike:hover { color: var(--ink); }

.callout { margin-bottom: 1.5rem; }
.callout h1 { color: var(--gold); }

/* ---- The Bureau --------------------------------------------------- */

.bureau-head h1 { margin-bottom: .2rem; }

.runner-strip { border: 1px solid var(--line-strong); background: var(--surface); padding: .9rem 1rem; margin: 1rem 0 1.5rem; }
.runner-strip p { margin: 0; }
.runner-strip p + p { margin-top: .4rem; }
.runner-filed strong { color: var(--gold); }
.runner-out { color: var(--ash); }

.board h2 { margin-top: 1.5rem; }
.board-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.slot { border-bottom: 1px solid var(--line); }
.slot a, .slot-sealed {
  display: grid; grid-template-columns: 3.2rem 1fr auto; align-items: center; gap: .75rem;
  min-height: 3.6rem; padding: .7rem .25rem; text-decoration: none; color: var(--ink);
}
.slot a:hover { background: var(--surface); }
.slot-num { color: var(--rust); }
.slot-title { color: var(--ink); }
.slot-status { color: var(--muted); font-size: .85rem; font-style: italic; }
.slot-sealed .slot-title { color: var(--muted); }
.slot-available .slot-status { color: var(--gold); font-style: normal; }
.slot-in_progress .slot-status { color: var(--ash); }
.slot-reviewed .slot-status { color: var(--gold); }
.slot-full_disclosure .slot-status { color: var(--amber); font-style: normal; }

/* ---- Badge card --------------------------------------------------- */

.idcard {
  position: relative; overflow: hidden;
  aspect-ratio: 1.586;
  max-width: 26rem;
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  display: flex; flex-direction: column;
  color: #1a1410;
  background:
    repeating-linear-gradient(180deg, transparent 0 1.2rem, rgba(90, 60, 30, .10) 1.2rem 1.25rem),
    linear-gradient(160deg, #e9dcc3, #d8c5a1 60%, #cdb58c);
  border: 1px solid #5a4530;
  border-radius: 6px;
  box-shadow: 0 20px 50px rgba(0,0,0,.7), inset 0 0 40px rgba(120, 80, 30, .25);
}
.idcard-top { display: flex; justify-content: space-between; font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: #5a4530; }
.idcard-number { font-size: clamp(2.1rem, 9vw, 3rem); letter-spacing: .06em; margin: auto 0 0; line-height: 1; color: #1a1410; }
.idcard-name { font-size: 1.05rem; margin: .35rem 0 .6rem; color: #3a2c20; font-style: italic; }
.idcard-meta { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0; font-size: .82rem; }
.idcard-meta div { display: flex; gap: .4rem; }
.idcard-meta dt { color: #6a5540; }
.idcard-meta dd { margin: 0; color: #1a1410; }
.idcard-stamp {
  position: absolute; right: -.4rem; top: 2.2rem;
  padding: .15rem .6rem; border: 2px solid rgba(154, 60, 30, .6); border-radius: 3px;
  color: rgba(154, 60, 30, .65); font-size: .8rem; letter-spacing: .25em; text-transform: uppercase;
  transform: rotate(-12deg);
  mix-blend-mode: multiply;
}

/* ---- Ranks -------------------------------------------------------- */

.meter { height: 6px; background: var(--surface-2); border: 1px solid var(--line); margin: 1rem 0 1.5rem; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--rust), var(--amber)); }
.ladder { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ladder li { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem .25rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.ladder li.reached { color: var(--ash); }
.ladder li.current { color: var(--ink); }
.ladder li.current .ladder-name { color: var(--gold); }
.ladder-min { font-size: .9rem; font-style: italic; }

/* ---- Editor ------------------------------------------------------- */

.admin-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.admin-head .actions { margin: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: normal; }
.table small { color: var(--muted); display: block; }
.pill { display: inline-block; padding: .05rem .55rem; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .8rem; }
.pill-live { color: var(--gold); border-color: var(--rust); }
.pill-draft { color: var(--ash); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- Inside a case ------------------------------------------------- */

.preview-bar { background: rgba(200, 99, 26, .15); border: 1px solid var(--rust); padding: .5rem .8rem; margin-bottom: 1rem; font-size: .9rem; color: var(--gold); }
.case-head { margin-bottom: .75rem; }
.case-num { color: var(--muted); margin: 0; font-size: .9rem; }
.case-num a { color: var(--muted); }
.case-head h1 { margin: .1rem 0 .2rem; }
.case-progress { color: var(--gold); margin: 0; font-size: .95rem; }
.case-tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin: .75rem 0 1.25rem; scrollbar-width: none; }
.case-tabs a { flex: none; padding: .55rem .7rem; color: var(--ash); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; position: relative; }
.case-tabs a.active { color: var(--ink); border-bottom-color: var(--amber); }
.tab-badge { display: inline-block; margin-left: .35rem; min-width: 1.1rem; padding: 0 .3rem; border-radius: 999px; background: var(--amber); color: #000; font-size: .7rem; line-height: 1.1rem; text-align: center; vertical-align: middle; }
.archive-note { color: var(--ash); font-style: italic; border-left: 2px solid var(--rust); padding-left: .9rem; margin: 1rem 0; }
.profile-list { margin: 1rem 0 0; }
.profile-list > div { display: grid; grid-template-columns: 8rem 1fr; gap: .5rem; padding: .4rem 0; border-top: 1px solid var(--line); }
.profile-list dt { color: var(--muted); }
.profile-list dd { margin: 0; }
.cast, .zones, .items, .found { list-style: none; padding: 0; margin: 0; }
.cast li, .zones li, .items li { padding: .6rem 0; border-top: 1px solid var(--line); }
.zone-locked strong { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.map img { width: 100%; height: auto; border: 1px solid var(--line-strong); }

.requests { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.request { display: flex; justify-content: space-between; gap: 1rem; padding: .9rem .25rem; border-bottom: 1px solid var(--line); }
.request-main p { margin: .3rem 0 0; font-size: .9rem; }
.request-action { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.request.is-done strong { color: var(--muted); }
.request.is-locked strong { color: var(--ash); }
.hint-soft { color: var(--gold); font-style: italic; }
.shredded { color: #c98a78; font-size: .9rem; margin: 0 0 .4rem; max-width: 18rem; }
.btn-small { min-height: 2.4rem; padding: .35rem .9rem; font-size: .95rem; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
@media (max-width: 30rem) { .request { flex-direction: column; } .request-action { align-items: flex-start; text-align: left; } }

.report .runner-voice { margin: 1rem 0; padding: 1rem 1.2rem; border-left: 3px solid var(--amber); background: var(--surface); font-style: italic; color: var(--ink); }
.report audio { width: 100%; margin-top: .5rem; }
.found li { padding: .4rem 0; border-top: 1px solid var(--line); }

.archive { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .archive { grid-template-columns: 1fr 1fr; } }
.card { position: relative; border: 1px solid var(--line-strong); background: var(--surface-2); padding: .9rem 1rem; min-height: 5rem; display: flex; flex-direction: column; gap: .35rem; }
.card-link { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: .2rem; }
.card-title { font-size: 1.05rem; }
.card-locked { border-style: dashed; border-color: var(--line); background: transparent; justify-content: center; }
.card-redacted { color: var(--line-strong); letter-spacing: -.05em; }
.card-keyed { border-color: var(--line); }
.card-keyed .card-title { color: var(--muted); }
.card-thumb { width: 100%; max-height: 10rem; object-fit: cover; border: 1px solid var(--line); margin-bottom: .3rem; }
.card.is-lead { border-color: var(--rust); }
.card.is-dead_end { opacity: .8; }
.tagger { display: flex; gap: .4rem; align-items: center; margin-top: auto; padding-top: .4rem; }
.tagger-large { margin: 1.5rem 0; }
.tag { min-height: 2.2rem; padding: .25rem .8rem; font: inherit; font-size: .9rem; color: var(--ash); background: transparent; border: 1px solid var(--line-strong); border-radius: 2px; cursor: pointer; }
.tag.on { color: #000; background: var(--gold); border-color: var(--gold); }
.dead-stamp { position: absolute; right: .6rem; top: .6rem; font-size: .65rem; letter-spacing: .15em; color: var(--rust); border: 1px solid var(--rust); padding: .1rem .4rem; transform: rotate(6deg); }

.photo { margin: 1rem 0; }
.photo img { width: 100%; height: auto; border: 1px solid var(--line-strong); }
video { width: 100%; background: #000; }
.player audio { width: 100%; }
.captions { margin-top: .75rem; }
.decoder { display: flex; align-items: center; gap: .75rem; margin-top: .75rem; padding: .6rem .8rem; border: 1px solid var(--line-strong); background: var(--surface); }
.lamp { width: 14px; height: 14px; border-radius: 50%; background: #2a1a0a; box-shadow: 0 0 0 2px var(--line-strong); flex: none; transition: background .04s, box-shadow .04s; }
.lamp.on { background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form input { flex: 1 1 10rem; }
.terminal { margin: 1.25rem 0; padding: 1rem; border: 1px solid var(--rust); background: rgba(154, 96, 48, .08); }
.terminal p { margin-bottom: .6rem; }
.morse-reveal { color: var(--gold); font-style: italic; }

.cipher-prompt { font-size: 1.2rem; color: var(--gold); text-align: center; margin: 1.5rem 0; }
.cryptex { text-align: center; }
.dials { display: flex; justify-content: center; gap: .6rem; margin: 1rem 0 1.5rem; }
.dial { display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.dial-btn { width: 3rem; height: 3rem; font: inherit; font-size: 1rem; color: var(--ash); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 2px; cursor: pointer; }
.dial-btn:active { background: var(--surface-2); color: var(--gold); }
.dial-value { width: 3.2rem; height: 4rem; text-align: center; font-size: 2.2rem; padding: 0; background: var(--surface-2); border-color: var(--rust); color: var(--gold); }
@media (max-width: 24rem) { .dial-btn { width: 2.6rem; } .dial-value { width: 2.8rem; font-size: 1.8rem; } }

.flash-achievement { border-color: var(--gold); background: rgba(212, 160, 96, .12); color: var(--gold); font-size: 1.05rem; }
.flash-warning { border-color: var(--rust); color: var(--gold); }
.flash ul.tight { margin: .4rem 0 0 1rem; padding: 0; }

/* ---- Editor extras ------------------------------------------------- */

.form-2col { display: grid; grid-template-columns: 1fr; gap: 0 1.25rem; }
@media (min-width: 48rem) { .form-2col { grid-template-columns: 1fr 1fr; } .form-2col .span2 { grid-column: span 2; } }
.editor-item { border: 1px solid var(--line); margin-bottom: .5rem; background: var(--surface); }
.editor-item summary { padding: .7rem .9rem; cursor: pointer; color: var(--ink); }
.editor-item summary .muted { font-size: .85rem; }
.editor-item.is-missing summary { border-left: 3px solid var(--rust); }
.editor-item .form { margin: 0; padding: .5rem .9rem 1rem; }
.editor-item > form:last-child { padding: 0 .9rem .6rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.dropzone.is-over { border: 1px dashed var(--gold); }
code { color: var(--gold); font-size: .9em; }
