@font-face { font-family: 'Anton'; src: url('/fonts/anton.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Space Mono'; src: url('/fonts/mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Space Mono'; src: url('/fonts/mono-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

/* Colors and fonts from the Squash Marker brand. */
:root {
  --paper: #0d0e11;       /* background */
  --sheet: #16181d;       /* panel */
  --sheet-live: #1d1f26;  /* raised / active */
  --line: #26282f;        /* hairline */
  --ink: #f3f1ea;         /* primary text */
  --muted: #83868f;       /* secondary text */
  --accent: #f5a623;      /* amber, the one accent */
  --on-accent: #1a1407;   /* text on amber */
  --hold: #e23b2e;        /* blocked, rejected */
  --ok: #3ecf8e;          /* approved */
  --display: 'Anton', 'Arial Narrow', sans-serif;
  --sans: 'Archivo', system-ui, Arial, sans-serif;
  --mono: 'Space Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { max-width: 100%; overflow-x: clip; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

button {
  font: inherit; color: inherit; cursor: pointer; background: var(--sheet);
  border: 1px solid var(--line); border-radius: 6px; padding: .5rem .9rem; min-height: 40px;
}
button:disabled { opacity: .4; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }
.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--muted); text-decoration: underline; }
.button { display: inline-block; text-decoration: none; padding: .6rem 1rem; border-radius: 6px; }
.approve { border-color: var(--ok); color: var(--ok); }
.reject { border-color: var(--hold); color: var(--hold); }

/* Masthead bar */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--paper);
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem;
  padding: .9rem clamp(1rem, 4vw, 3rem); border-bottom: 2px solid var(--ink);
}
.mast { font: 2rem/1 var(--display); text-transform: uppercase; letter-spacing: .01em; text-decoration: none; }
nav { display: flex; gap: .15rem; }
nav button { border: 0; background: none; padding: .4rem .75rem; border-radius: 4px; }
nav button[aria-current="page"] { background: var(--sheet-live); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.badge:not(:empty) { margin-left: .4rem; background: var(--accent); color: var(--on-accent); border-radius: 99px; padding: 0 .45rem; font: 700 .72rem/1.5 var(--mono); }
.actions { margin-left: auto; display: flex; gap: .5rem; }

main#view { max-width: 1200px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 3rem) 3rem; }

/* Read: sections and the page you flip */
.sections { display: flex; gap: 1.5rem; overflow-x: auto; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.sections button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: .5rem 0; color: var(--muted); white-space: nowrap; font: 700 .8rem/1.5 var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.sections button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.book { display: grid; perspective: 2200px; touch-action: pan-y; }
.page {
  grid-area: 1 / 1; background: var(--sheet); border: 1px solid var(--line);
  padding: clamp(1rem, 3vw, 2.25rem); display: grid; gap: 1.75rem; min-height: 72vh; align-content: start;
  box-shadow: 0 22px 44px -28px rgba(0, 0, 0, .8);
  backface-visibility: hidden;
}
.page.lead { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "a b c" "a d e"; }
.page.pair { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-areas: "a a a b b b" "c c d d e e"; }
.s0 { grid-area: a; } .s1 { grid-area: b; } .s2 { grid-area: c; } .s3 { grid-area: d; } .s4 { grid-area: e; }

.story { display: flex; flex-direction: column; min-width: 0; }
.story a { display: flex; flex-direction: column; gap: .65rem; flex: 1; text-decoration: none; }
.story img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--line); }
.story h3 { margin: 0; font: 800 1.15rem/1.22 var(--sans); letter-spacing: -.01em; text-wrap: balance; overflow-wrap: break-word; }
@media (hover: hover) { .story a:hover h3 { color: var(--accent); } }
.lead .s0 img { aspect-ratio: 4 / 3; }
.lead .s0 h3 { font: clamp(2.2rem, 4vw, 3.6rem)/.98 var(--display); text-transform: uppercase; letter-spacing: .005em; }
.pair .s0 h3, .pair .s1 h3 { font-size: 1.55rem; line-height: 1.15; }
.dek {
  margin: 0; color: var(--muted); overflow-wrap: break-word; font: 1rem/1.6 var(--sans); max-width: 62ch;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.byline { display: flex; gap: .75rem; align-items: baseline; margin: .7rem 0 0; padding-top: .5rem; border-top: 1px solid var(--line); font: .72rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.byline .remove { margin-left: auto; font: inherit; text-transform: inherit; letter-spacing: inherit; }

/* The page turn: the old page hinges on its spine and swings away over the new one. */
.page.turning { z-index: 2; pointer-events: none; transform-origin: left center; animation: turn-next .6s cubic-bezier(.45, .05, .3, 1) forwards; }
.page.turning.to-prev { transform-origin: right center; animation-name: turn-prev; }
@keyframes turn-next { to { transform: rotateY(-100deg); filter: brightness(.7); } }
@keyframes turn-prev { to { transform: rotateY(100deg); filter: brightness(.7); } }

.turn { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1.25rem; }
#count { color: var(--ink); font: 700 .8rem/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; min-width: 6ch; text-align: center; }

/* Inbox */
.inbox-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button[aria-selected="true"] { background: var(--sheet-live); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.hint { margin: 0; color: var(--muted); font-size: .9rem; }
.note { margin: 0 0 1rem; padding: .6rem .9rem; border-left: 3px solid var(--accent); background: var(--sheet); color: var(--muted); font-size: .92rem; }
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.row {
  display: grid; grid-template-columns: 120px 1fr auto; gap: 1rem; align-items: start;
  background: var(--sheet); border: 1px solid var(--line); border-left: 4px solid transparent; padding: 1rem;
}
.row[aria-current="true"] { border-left-color: var(--accent); background: var(--sheet-live); }
.row.held { grid-template-columns: 1fr auto; }
.row img, .row .noimg { width: 120px; aspect-ratio: 3 / 2; object-fit: cover; background: var(--line); }
.row h3 { margin: 0 0 .25rem; font: 800 1.1rem/1.3 var(--sans); }
.row h3 a { text-decoration: none; }
.row p { margin: .25rem 0 0; color: var(--muted); font-size: .92rem; max-width: 70ch; }
.row .reason { color: var(--hold); }
.row .do { display: flex; flex-direction: column; gap: .4rem; }

/* Sources and rules */
.panel { background: var(--sheet); border: 1px solid var(--line); padding: 1.25rem 1.4rem; margin-bottom: 1.5rem; }
.panel h2 { margin: 0 0 .35rem; font: 800 1.3rem/1.25 var(--sans); }
.panel .help { margin: 0 0 1rem; color: var(--muted); font-size: .92rem; max-width: 66ch; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; align-items: end; }
label { display: grid; gap: .3rem; font: .72rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
input, select {
  font: inherit; color: var(--ink); background: var(--paper); width: 100%;
  border: 1px solid var(--line); border-radius: 6px; padding: .5rem .6rem; min-height: 40px;
  color-scheme: dark; text-transform: none; letter-spacing: normal;
}
.inline { display: flex; gap: .5rem; }
.inline input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; font-size: .85rem; color: var(--muted); }
.chips button { border-style: dashed; border-color: var(--accent); color: var(--accent); border-radius: 99px; padding: .2rem .8rem; min-height: 32px; }
.terms { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.terms li { display: flex; align-items: center; gap: .35rem; border: 1px solid var(--line); background: var(--paper); border-radius: 99px; padding: .15rem .25rem .15rem .8rem; }
.terms li button { border: 0; background: none; border-radius: 99px; padding: .1rem .5rem; min-height: 28px; color: var(--muted); }
.src { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.src h3 { margin: 0; font: 800 1.05rem/1.3 var(--sans); }
.src p { margin: .15rem 0 0; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.src p.err { color: var(--hold); }
.src .do { display: flex; gap: .4rem; align-items: start; }
.bookmarklet { display: inline-block; border: 1px dashed var(--accent); color: var(--accent); border-radius: 6px; padding: .4rem .9rem; text-decoration: none; }

.empty { text-align: center; padding: 4rem 1rem; }
.empty h2 { margin: 0 0 .5rem; font: 2.2rem/1.05 var(--display); text-transform: uppercase; }
.empty p { color: var(--muted); }

.foot { display: flex; justify-content: space-between; padding: 1rem clamp(1rem, 4vw, 3rem); border-top: 1px solid var(--line); color: var(--muted); font: .72rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.foot .link { font: inherit; text-transform: inherit; letter-spacing: inherit; }

dialog { width: min(520px, 92vw); border: 1px solid var(--line); background: var(--sheet); color: var(--ink); padding: 1.5rem; }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
dialog h2 { margin: 0 0 1rem; font: 1.8rem/1 var(--display); text-transform: uppercase; }
dialog form { display: grid; gap: .9rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: .5rem; }

#toast {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 20; max-width: 90vw;
  transform: translate(-50%, 180%); transition: transform .25s, visibility .25s; visibility: hidden;
  background: var(--sheet-live); color: var(--ink); border: 1px solid var(--line); padding: .7rem 1rem; border-radius: 6px;
}
#toast.show { transform: translate(-50%, 0); visibility: visible; }
#toast.bad { border-color: var(--hold); color: var(--hold); }

.signin { max-width: 420px; margin: 14vh auto; padding: 0 1rem; }
.signin .mast { display: block; font-size: 4rem; margin: 0 0 .5rem; }
.signin form { display: grid; gap: .75rem; margin-top: 1.5rem; }

@media (max-width: 760px) {
  .page.lead, .page.pair { grid-template-columns: minmax(0, 1fr); grid-template-areas: "a" "b" "c" "d" "e"; }
  .page { min-height: 0; padding: 1.1rem; gap: 1.5rem; }
  main#view { padding: 1rem 1rem 2.5rem; }

  /* Phone header: name and buttons on one row, the four views on a full-width row below. */
  .top { gap: .6rem .75rem; padding: .7rem 1rem; }
  .mast { font-size: 1.55rem; }
  .actions { order: 1; margin-left: auto; gap: .4rem; }
  .actions button { padding: .4rem .75rem; min-height: 38px; }
  nav { order: 2; flex: 1 0 100%; justify-content: space-between; overflow-x: auto; }
  nav button { padding: .4rem .6rem; }

  .lead .s0 h3 { font-size: clamp(1.7rem, 8.5vw, 2.4rem); line-height: 1; }
  .pair .s0 h3, .pair .s1 h3 { font-size: 1.3rem; }
  .sections { gap: 1.1rem; }
  .turn { gap: .5rem; }
  .turn button { padding: .45rem .7rem; }
}
@media (max-width: 360px) {
  nav button { padding: .4rem .4rem; font-size: .95rem; }
  .actions button { padding: .4rem .6rem; }
}
@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; }
  .row img, .row .noimg { display: none; }
  .row .do { flex-direction: row; }
}
@media (hover: none) {
  .keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
