@font-face { font-family: "DM Serif"; src: url("assets/dm-serif.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Work Sans"; src: url("assets/work-sans.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("assets/ibm-plex-mono.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Literata"; src: url("assets/literata.ttf") format("truetype"); font-display: swap; }

:root {
  --bg: #f2eddf;
  --surface: #fbf8ef;
  --ink: #20211e;
  --muted: #66655e;
  --accent: #bd3215;
  --accent-ink: #fffaf0;
  --accent-light: #ff795b;
  --rule: #2e302b;
  --soft-rule: #bdb8aa;
  --font-display: "DM Serif", Georgia, serif;
  --font-body: "Work Sans", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 17px; line-height: 1.6; overflow-x: clip; }
body.detail-open { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }

.skip-link { position: fixed; z-index: 100; inset: 8px auto auto 8px; min-height: 44px; padding: 10px 16px; background: var(--ink); color: var(--surface); transform: translateY(-150%); transition: transform 180ms var(--ease); }
.skip-link:focus { transform: translateY(0); outline: 2px solid var(--accent); outline-offset: 2px; }

.site-header { min-height: 76px; padding-inline: clamp(20px, 4vw, 64px); border-bottom: 2px solid var(--rule); display: flex; align-items: stretch; justify-content: space-between; }
.wordmark { display: inline-flex; min-height: 44px; align-items: center; font-family: var(--font-mono); font-size: 18px; font-weight: 700; letter-spacing: .06em; text-decoration: none; }
.wordmark-dot { color: var(--accent); margin-left: 3px; font-size: 11px; }
.top-nav { display: flex; align-items: stretch; }
.top-nav a, .top-nav .edition { min-height: 44px; padding: 0 24px; border-left: 1px solid var(--soft-rule); display: flex; align-items: center; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; }
.top-nav .edition { padding-right: 0; color: var(--muted); }

.hero { min-height: 655px; padding: 64px clamp(20px, 4vw, 64px) 72px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); gap: clamp(48px, 7vw, 120px); align-items: center; border-bottom: 2px solid var(--rule); position: relative; }
.hero::after { content: "RECEIVED"; position: absolute; left: 45%; bottom: 22px; color: rgba(32, 33, 30, .22); border: 2px solid currentColor; border-radius: 50%; padding: 8px 18px; font: 600 11px/1 var(--font-mono); letter-spacing: .14em; transform: rotate(-8deg); }
.hero-copy { max-width: 840px; animation: settle-in 650ms var(--ease) both; }
.eyebrow { margin: 0 0 24px; font: 600 12px/1.3 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-family: var(--font-display); font-size: clamp(76px, 10.2vw, 164px); line-height: .82; letter-spacing: -.04em; font-weight: 400; }
h1 span, h1 strong { display: block; }
h1 span { font-size: .42em; line-height: 1; margin-bottom: 12px; font-family: var(--font-body); font-weight: 520; letter-spacing: -.045em; }
h1 strong { color: var(--accent); font-weight: 400; }
.standfirst { max-width: 55ch; margin: 36px 0 28px; font-size: clamp(18px, 1.5vw, 22px); line-height: 1.55; }
.primary-link { min-height: 48px; width: fit-content; padding: 12px 20px; display: inline-flex; gap: 28px; align-items: center; background: var(--ink); color: var(--surface); font-weight: 650; text-decoration: none; transition: transform 180ms var(--ease), background-color 180ms var(--ease); }

.claim-artifact { align-self: stretch; min-height: 500px; padding: 24px 28px 42px; background: var(--surface); border: 2px solid var(--rule); position: relative; overflow: hidden; box-shadow: 12px 12px 0 var(--ink); transform: rotate(1.25deg); animation: ticket-in 700ms 90ms var(--ease) both; transition: transform 220ms var(--ease); }
.claim-artifact::before, .claim-artifact::after { content: ""; position: absolute; bottom: -11px; width: 22px; height: 22px; background: var(--bg); border: 2px solid var(--rule); border-radius: 50%; }
.claim-artifact::before { left: 12%; box-shadow: 52px 0 0 var(--bg), 52px 0 0 2px var(--rule), 104px 0 0 var(--bg), 104px 0 0 2px var(--rule), 156px 0 0 var(--bg), 156px 0 0 2px var(--rule); }
.claim-artifact::after { right: 12%; box-shadow: -52px 0 0 var(--bg), -52px 0 0 2px var(--rule), -104px 0 0 var(--bg), -104px 0 0 2px var(--rule); }
.ticket-topline { display: flex; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--rule); font: 600 10px/1.3 var(--font-mono); letter-spacing: .09em; text-transform: uppercase; }
.ticket-number { color: var(--accent); font-family: var(--font-display); font-size: clamp(80px, 9vw, 138px); line-height: .95; letter-spacing: -.04em; }
.city-trace { display: block; width: 100%; height: auto; margin: -12px 0 2px; }
.trace-grid { fill: none; stroke: #bdb8aa; stroke-width: 1; stroke-dasharray: 3 7; }
.trace-route { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 700; animation: draw-route 1200ms 450ms var(--ease) both; }
.trace-stops { fill: var(--surface); stroke: var(--accent); stroke-width: 4; }
.ticket-caption { padding-top: 14px; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.ticket-caption span { font: 500 10px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.ticket-caption strong { font-size: 16px; line-height: 1.35; }
.tear-note { position: absolute; bottom: 8px; left: 28px; margin: 0; color: var(--muted); font: 500 9px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }

.registry-shell { padding: 112px clamp(20px, 4vw, 64px) 144px; }
.registry-heading { display: grid; grid-template-columns: 1fr minmax(280px, 520px); gap: 48px; align-items: end; margin-bottom: 48px; }
.registry-heading .eyebrow { margin-bottom: 12px; }
.registry-heading h2, .manifesto h2 { margin: 0; font-family: var(--font-display); font-size: clamp(52px, 6vw, 92px); font-weight: 400; letter-spacing: -.035em; line-height: .98; }
.registry-heading > p { max-width: 44ch; margin: 0 0 4px auto; color: #51514b; }

.controls { border: 2px solid var(--rule); display: grid; grid-template-columns: minmax(280px, 1.4fr) minmax(240px, .8fr) 260px; background: var(--surface); }
.field { min-width: 0; padding: 14px 18px; display: flex; flex-direction: column; gap: 7px; border-right: 1px solid var(--rule); }
.field > span:first-child, .saved-filter small { font: 600 10px/1.2 var(--font-mono); letter-spacing: .09em; text-transform: uppercase; }
.input-wrap { display: flex; align-items: center; gap: 10px; }
.input-wrap > span { color: var(--accent); font-size: 26px; line-height: 1; }
input, select { width: 100%; min-height: 44px; border: 0; border-bottom: 1px solid var(--soft-rule); background: transparent; border-radius: 0; font-size: 16px; }
input { padding: 7px 4px; }
select { padding: 7px 34px 7px 4px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 3px; border-color: var(--ink); }
.saved-filter { min-height: 76px; padding: 12px 16px; border: 0; background: var(--ink); color: var(--surface); display: grid; grid-template-columns: 32px 1fr auto; gap: 8px; align-items: center; text-align: left; transition: background-color 180ms var(--ease), transform 180ms var(--ease); }
.saved-filter[aria-pressed="true"] { background: var(--accent); }
.saved-mark { font-size: 22px; }
.saved-filter small, .saved-filter b { display: block; }
.saved-filter b { font-size: 15px; }
.saved-count { font: 500 26px/1 var(--font-mono); }

.ledger-status { min-height: 46px; padding: 8px 0; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--rule); color: var(--muted); font: 500 11px/1.4 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; }
#scan-readout { color: var(--accent); }
.ledger { border-bottom: 2px solid var(--rule); }
.story-row { min-height: 174px; display: grid; grid-template-columns: 72px 140px minmax(0, 1fr) 210px; gap: 24px; align-items: center; padding-block: 24px; border-top: 1px solid var(--rule); position: relative; transition: background-color 180ms var(--ease), color 180ms var(--ease), padding 180ms var(--ease); }
.story-row:first-child { border-top: 0; }
.story-row::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink); transform: scaleY(0); transform-origin: bottom; transition: transform 200ms var(--ease); }
.story-row.is-scanned::before, .story-row:focus-within::before { transform: scaleY(1); }
.story-row.is-scanned, .story-row:focus-within { color: var(--surface); padding-inline: 16px; }
.case-number { align-self: start; font: 500 13px/1.3 var(--font-mono); }
.category-tag { align-self: start; width: fit-content; padding: 5px 9px; border: 1px solid currentColor; font: 500 10px/1.1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.story-copy h3 { max-width: 720px; margin: 0 0 8px; font-family: var(--font-display); font-size: clamp(26px, 2.4vw, 38px); font-weight: 400; line-height: 1.08; letter-spacing: -.025em; }
.story-copy p { max-width: 62ch; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.story-row.is-scanned .story-copy p, .story-row:focus-within .story-copy p { color: #d7d4ca; }
.row-meta { align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; text-align: right; }
.row-meta > span { font: 500 10px/1.4 var(--font-mono); text-transform: uppercase; }
.row-meta button { min-height: 44px; padding: 10px 0 10px 18px; border: 0; border-bottom: 2px solid currentColor; background: transparent; color: inherit; font-weight: 650; transition: color 180ms var(--ease), transform 180ms var(--ease); }
.story-row.is-scanned .row-meta button, .story-row:focus-within .row-meta button { color: var(--accent-light); }
.story-row[hidden] { display: none; }

.empty-state { min-height: 330px; padding: 48px; border: 2px solid var(--rule); border-top: 0; display: grid; grid-template-columns: auto 1fr auto; gap: 32px; align-items: center; background: var(--surface); }
.empty-state[hidden] { display: none; }
.empty-number { color: var(--accent); font: 400 120px/.8 var(--font-display); }
.empty-state h3 { margin: 0; font: 400 36px/1.1 var(--font-display); }
.empty-state p { margin: 8px 0 0; color: var(--muted); }
.empty-state button { min-height: 48px; padding: 12px 20px; border: 2px solid var(--ink); background: var(--ink); color: var(--surface); font-weight: 650; transition: transform 180ms var(--ease), background-color 180ms var(--ease), color 180ms var(--ease); }

.manifesto { padding: 112px clamp(20px, 4vw, 64px) 128px; background: var(--accent); color: var(--accent-ink); }
.manifesto-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 9vw; align-items: end; }
.manifesto h2 { max-width: 930px; font-size: clamp(60px, 8vw, 126px); }
.manifesto-grid p { margin: 0 0 28px; font-size: 18px; line-height: 1.6; }
.manifesto-grid a { min-height: 44px; padding-block: 9px; display: inline-flex; gap: 24px; border-bottom: 2px solid currentColor; font-weight: 650; text-decoration: none; transition: transform 180ms var(--ease); }
.site-footer { min-height: 190px; padding: 48px clamp(20px, 4vw, 64px); display: grid; grid-template-columns: 1fr 1fr auto; gap: 32px; align-items: center; background: var(--ink); color: var(--surface); }
.site-footer p { margin: 0; color: #cfcdc4; font-size: 14px; }
.site-footer > a:last-child { min-height: 44px; padding-block: 9px; border-bottom: 1px solid currentColor; text-decoration: none; transition: color 180ms var(--ease), transform 180ms var(--ease); }

.detail-dialog { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: var(--ink); color: #f5f0e5; overflow: auto; }
.detail-dialog::backdrop { background: rgba(21, 22, 20, .8); }
.detail-dialog[open] { animation: dialog-in 260ms var(--ease) both; }
.detail-chrome { min-height: 100%; display: grid; grid-template-columns: 112px 1fr; }
.detail-rail { position: sticky; top: 0; height: 100vh; border-right: 1px solid #5c5d58; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 24px 14px; }
.detail-brand { color: inherit; font: 700 13px/1 var(--font-mono); text-decoration: none; writing-mode: vertical-rl; }
.detail-brand span { color: var(--accent); }
.detail-case-label { color: #b8b6ae; font: 500 10px/1.3 var(--font-mono); letter-spacing: .09em; text-transform: uppercase; writing-mode: vertical-rl; transform: rotate(180deg); }
.detail-case-label b { color: var(--accent); font-size: 28px; }
.close-detail { min-width: 44px; min-height: 44px; padding: 9px 12px; border: 1px solid #88877f; background: transparent; color: inherit; font: 600 11px/1.2 var(--font-mono); text-transform: uppercase; transition: background-color 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--ease); }
.detail-rail .close-detail { writing-mode: vertical-rl; transform: rotate(180deg); }
.detail-article { width: min(100%, 1240px); padding: 72px clamp(28px, 8vw, 140px) 96px; }
.detail-header { padding-bottom: 64px; border-bottom: 1px solid #5c5d58; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-bottom: 32px; color: #bbb9b1; font: 500 11px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.detail-meta span:first-child { color: var(--accent-light); }
.detail-header h2 { max-width: 980px; margin: 0; font-family: var(--font-display); font-size: clamp(54px, 8vw, 118px); line-height: .98; letter-spacing: -.04em; font-weight: 400; }
.detail-summary { max-width: 56ch; margin: 36px 0; color: #d2d0c7; font-size: clamp(19px, 2vw, 25px); line-height: 1.5; }
.byline { min-height: 60px; display: flex; justify-content: space-between; gap: 32px; align-items: center; font-size: 14px; }
.save-item { min-height: 48px; padding: 11px 18px; border: 1px solid #e0ddd3; background: transparent; color: #f5f0e5; display: inline-flex; gap: 10px; align-items: center; font-weight: 650; transition: background-color 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--ease); }
.save-item[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.detail-body { max-width: 760px; margin: 72px auto; font-family: "Literata", Georgia, serif; font-size: 19px; line-height: 1.72; }
.detail-body p { margin: 0 0 1.55em; }
.detail-body p:first-child::first-letter { float: left; margin: .08em .1em 0 0; color: var(--accent); font-family: var(--font-display); font-size: 5.2em; line-height: .74; }
.detail-end { padding-top: 32px; border-top: 1px solid #5c5d58; display: flex; justify-content: space-between; align-items: center; gap: 24px; color: #bbb9b1; font: 500 11px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.secondary-close { min-width: 190px; }

@keyframes settle-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ticket-in { from { opacity: 0; transform: translate(32px, 20px) rotate(4deg); } to { opacity: 1; transform: translate(0, 0) rotate(1.25deg); } }
@keyframes draw-route { from { stroke-dashoffset: 700; } to { stroke-dashoffset: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

.wordmark:focus, .wordmark:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.top-nav a:focus, .top-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.primary-link:focus, .primary-link:focus-visible { outline: 3px double var(--accent); outline-offset: 3px; }
.saved-filter:focus, .saved-filter:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.row-meta button:focus, .row-meta button:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }
.empty-state button:focus, .empty-state button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.manifesto a:focus, .manifesto a:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 4px; }
.site-footer a:focus, .site-footer a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 4px; }
.close-detail:focus, .close-detail:focus-visible, .save-item:focus, .save-item:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }
.story-row:focus-within { outline: 2px solid var(--accent); outline-offset: -4px; }
.input-wrap input:active, .select-field select:active { border-color: var(--accent); }
.top-nav a:active, .wordmark:active, .primary-link:active, .saved-filter:active, .row-meta button:active, .empty-state button:active, .manifesto a:active, .site-footer a:active, .close-detail:active, .save-item:active { transform: scale(.97); }

@media (hover: hover) and (pointer: fine) {
  .wordmark:hover { color: var(--accent); }
  .top-nav a:hover { background: var(--ink); color: var(--surface); }
  input:hover, select:hover { border-color: var(--accent); }
  .primary-link:hover { background: var(--accent); transform: translateY(-2px); }
  .claim-artifact:hover { transform: rotate(0); }
  .saved-filter:hover { background: var(--accent); }
  .story-row:hover::before { transform: scaleY(1); }
  .story-row:hover { color: var(--surface); padding-inline: 16px; }
  .story-row:hover .story-copy p { color: #d7d4ca; }
  .story-row:hover .row-meta button { color: var(--accent-light); transform: translateY(-2px); }
  .empty-state button:hover { background: var(--surface); color: var(--ink); transform: translateY(-2px); }
  .manifesto a:hover { transform: translateX(4px); }
  .site-footer a:hover { color: var(--accent-light); transform: translateY(-2px); }
  .close-detail:hover { background: #f5f0e5; color: var(--ink); }
  .detail-rail .close-detail:hover { transform: rotate(180deg) translateY(2px); }
  .save-item:hover { background: #f5f0e5; color: var(--ink); }
}

@media (max-width: 900px) {
  .site-header { min-height: auto; padding-inline: 20px; display: block; }
  .site-header > .wordmark { min-height: 56px; }
  .top-nav { margin-inline: -20px; padding-left: 20px; overflow-x: auto; border-top: 1px solid var(--soft-rule); }
  .top-nav a, .top-nav .edition { flex: 0 0 auto; padding-inline: 18px; }
  .top-nav .edition { padding-right: 24px; }
  .hero { grid-template-columns: 1fr; min-height: auto; gap: 56px; }
  .claim-artifact { min-height: 430px; width: min(100%, 620px); }
  .hero::after { left: auto; right: 24px; bottom: 28px; }
  .registry-heading { grid-template-columns: 1fr; gap: 24px; }
  .registry-heading > p { margin-left: 0; }
  .controls { grid-template-columns: 1fr 1fr; }
  .field { border-bottom: 1px solid var(--rule); }
  .select-field { border-right: 0; }
  .saved-filter { grid-column: 1 / -1; }
  .story-row { grid-template-columns: 54px 110px minmax(0, 1fr); }
  .row-meta { grid-column: 3; min-height: 50px; flex-direction: row; align-items: center; text-align: left; }
  .manifesto-grid { grid-template-columns: 1fr; gap: 48px; }
  .manifesto-grid > div { max-width: 620px; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero { padding-block: 48px 72px; }
  h1 { font-size: clamp(70px, 24vw, 94px); }
  h1 span { font-size: .35em; }
  .standfirst { margin-block: 28px 24px; }
  .claim-artifact { min-height: 350px; padding: 18px 18px 36px; box-shadow: 7px 7px 0 var(--ink); transform: rotate(.7deg); }
  .ticket-number { font-size: 74px; }
  .city-trace { margin-top: -10px; }
  .ticket-caption { grid-template-columns: 1fr; gap: 5px; }
  .tear-note { left: 18px; }
  .registry-shell { padding-block: 80px 96px; }
  .registry-heading { margin-bottom: 32px; }
  .registry-heading h2 { font-size: 50px; }
  .controls { grid-template-columns: 1fr; }
  .field { border-right: 0; }
  .saved-filter { grid-column: auto; }
  .ledger-status { align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; padding-block: 10px; }
  .story-row { min-height: 0; grid-template-columns: 42px 1fr; gap: 10px 14px; padding-block: 24px; }
  .category-tag { grid-column: 2; grid-row: 1; }
  .story-copy { grid-column: 1 / -1; }
  .story-copy h3 { font-size: 29px; }
  .story-copy p { font-size: 15px; }
  .row-meta { grid-column: 1 / -1; min-height: 50px; }
  .empty-state { padding: 32px 20px; grid-template-columns: 1fr; gap: 20px; }
  .empty-number { font-size: 90px; }
  .empty-state button { width: 100%; }
  .manifesto { padding-block: 88px 96px; }
  .manifesto h2 { font-size: 60px; }
  .site-footer { grid-template-columns: 1fr; padding-block: 48px; }
  .site-footer > a:last-child { width: fit-content; }
  .detail-chrome { display: block; }
  .detail-rail { position: sticky; z-index: 5; top: 0; width: 100%; height: 62px; padding: 8px 20px; border-right: 0; border-bottom: 1px solid #5c5d58; background: var(--ink); flex-direction: row; }
  .detail-brand, .detail-case-label { writing-mode: horizontal-tb; transform: none; }
  .detail-case-label b { font-size: 18px; }
  .detail-rail .close-detail { writing-mode: horizontal-tb; transform: none; }
  .detail-article { padding: 48px 20px 72px; }
  .detail-header { padding-bottom: 48px; }
  .detail-header h2 { font-size: clamp(48px, 14vw, 64px); }
  .detail-summary { margin-block: 28px; }
  .byline { align-items: stretch; flex-direction: column; }
  .save-item { justify-content: center; }
  .detail-body { margin-block: 56px; font-size: 18px; }
  .detail-end { align-items: stretch; flex-direction: column; }
  .secondary-close { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
