/*
  The desk. A charcoal work surface: the board is a plain table, a piece is a paper sheet with one stamp.
  Palette and type from the hub kit (site/src/kit/kit.css). Brief: docs/design/DESK.md.
  Chartreuse appears on Approve, the Approved mark and stamp, and the one call to the review stack. Nowhere else.
*/
@font-face { font-family: "Saira"; src: url("/fonts/saira.woff2") format("woff2"); font-style: italic; font-weight: 100 900; font-stretch: 50% 125%; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/instrument-sans.woff2") format("woff2"); font-style: normal; font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/instrument-sans-italic.woff2") format("woff2"); font-style: italic; font-weight: 400 700; font-display: swap; }

:root {
  color-scheme: dark;
  --desk: #111111;
  --desk-2: #1D1D1B;
  --rule: #363530;
  --paper: #F5F2EA;
  --paper-2: #E9E5DA;
  --paper-rule: #D3CEC0;
  --ink: #111111;
  --ink-2: #57544B;
  --dim: #BDB9AE;
  --chart: #DFFF00;
  --flag: #A8480A;
  --display: "Saira", Impact, "Arial Black", sans-serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pad: clamp(18px, 3.2vw, 28px);
  --side: clamp(16px, 4vw, 44px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--desk); color: var(--paper); font: 400 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ol, ul { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--chart); outline-offset: 2px; }
.sheet :focus-visible { outline-color: var(--ink); }

.desk {
  max-width: calc(760px + 2 * var(--side)); margin: 0 auto; padding-block: 18px 96px;
  padding-left: max(var(--side), env(safe-area-inset-left, 0px));
  padding-right: max(var(--side), env(safe-area-inset-right, 0px));
}
.desk.wide { max-width: calc(1240px + 2 * var(--side)); }

/* ---- top of every page ---------------------------------------------------- */
.bar { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-size: 14px; color: var(--dim); }
.bar a { text-decoration: none; }
.bar a:hover { color: var(--paper); }
.bar .home { font-weight: 600; color: var(--paper); }

.tabs { display: flex; gap: clamp(18px, 3vw, 30px); margin-top: 14px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px 0 12px; color: var(--dim); font-weight: 500; text-decoration: none; white-space: nowrap; }
.tab .n { font-variant-numeric: tabular-nums; margin-left: 7px; font-weight: 400; }
.tab[aria-current="page"] { color: var(--paper); border-bottom-color: var(--paper); font-weight: 600; }
.tab:hover { color: var(--paper); }

.top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px 28px; margin-top: clamp(26px, 4vw, 44px); }
.top h1 { font-family: var(--display); font-weight: 900; font-stretch: 125%; font-style: italic; text-transform: uppercase; line-height: .9; letter-spacing: -.012em; font-size: clamp(38px, 6.4vw, 64px); }
.how { color: var(--dim); font-size: 15px; max-width: 60ch; grid-column: 1 / -1; }
.clear { color: var(--dim); font-size: 15px; padding-bottom: 6px; }
.flash { margin-top: 18px; color: var(--paper); font-size: 15px; }
.ep-top { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.ep-top h1 { font-size: clamp(30px, 4.6vw, 46px); line-height: .96; max-width: 20ch; }
.eyebrow { color: var(--dim); font-size: 14px; }
.links { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--dim); font-size: 14px; }
main { margin-top: clamp(22px, 3.4vw, 34px); }

/* ---- buttons -------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border: 1.5px solid currentColor; border-radius: 3px; background: transparent; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--desk-2); }
.sheet .btn { border-color: var(--ink); color: var(--ink); }
.sheet .btn:hover { background: var(--paper-2); }
.btn.approve, .sheet .btn.approve { background: var(--chart); border-color: var(--chart); color: var(--ink); padding-inline: 26px; }
.sheet .btn.approve { border-color: var(--ink); }
.btn.approve:hover, .sheet .btn.approve:hover { background: #CDEB00; }
.btn.quiet, .sheet .btn.quiet { border-color: transparent; text-decoration: underline; text-underline-offset: 3px; padding-inline: 8px; font-weight: 500; }
.sheet .btn.quiet { color: var(--ink-2); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.err { color: #FF9E6B; font-size: 14px; font-weight: 600; }
.sheet .err { color: var(--flag); }

/* ---- the board ------------------------------------------------------------ */
.board { width: 100%; border-collapse: collapse; font-size: 15px; }
.board th, .board td { text-align: left; vertical-align: top; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--rule); font-weight: 400; }
.board thead th { font-size: 13px; font-weight: 600; color: var(--dim); padding-block: 0 10px; white-space: nowrap; }
.board tbody th { width: 30%; min-width: 220px; }
.board td { width: 11.6%; }
.board tr > :last-child { padding-right: 0; }
.board a { text-decoration: none; display: grid; gap: 1px; }
.board .ti { font-weight: 600; text-wrap: balance; }
.board .no { font-size: 13px; color: var(--dim); }
.board .ep:hover .ti, .board.list th a:hover .ti { text-decoration: underline; text-underline-offset: 3px; }
.c { display: grid; gap: 1px; line-height: 1.35; }
.c .t { white-space: nowrap; }
.c .s, .board td .s { font-size: 13px; color: var(--dim); }
.c.with .t { color: var(--paper); }
.c.you .t { font-weight: 700; }
.c.settled .t, .c.skipped .t, .c.none { color: var(--dim); }
.c.skipped .t { text-decoration: line-through; text-decoration-color: var(--rule); }
.c.approved { grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline; }
.c.approved .s { grid-column: 2; }
a.c:hover .t { text-decoration: underline; text-underline-offset: 3px; }
.dot { display: inline-block; width: 9px; height: 9px; background: var(--chart); flex: none; }
.board.list tbody th { width: 34%; }
.board.list td { width: auto; }
.board.list td .t { display: block; }
.board .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--dim); }

.add { margin-top: 26px; font-size: 15px; }
.add summary, .more summary, .rest summary, .passage summary { cursor: pointer; color: var(--dim); text-decoration: underline; text-underline-offset: 3px; width: fit-content; list-style: none; }
.add summary::-webkit-details-marker, .more summary::-webkit-details-marker, .rest summary::-webkit-details-marker, .passage summary::-webkit-details-marker, .piece summary::-webkit-details-marker { display: none; }
.add summary:hover { color: var(--paper); }
.add-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px; margin-top: 14px; max-width: 560px; }
.add-form label { flex-basis: 100%; font-size: 13px; font-weight: 600; color: var(--dim); }
.add-form input { flex: 1 1 240px; min-height: 44px; }
input[type="text"], input[type="password"], input:not([type]), select { background: transparent; border: 1px solid var(--dim); border-radius: 3px; padding: 9px 12px; min-height: 44px; }
input:focus-visible, select:focus-visible { outline-offset: 0; }

.state { color: var(--dim); font-size: 17px; max-width: 46ch; padding-block: 8px 40px; }
.state b { color: var(--paper); font-weight: 600; display: block; margin-bottom: 6px; }

/* ---- the review stack ----------------------------------------------------- */
.feed { display: grid; gap: 40px; }
.issue { display: grid; gap: var(--pad); }
.issue-title { font-size: 14px; line-height: 1.35; font-weight: 600; }
.issue-title a { text-decoration: none; }
.issue-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.issue-title .gloss { font-weight: 400; color: var(--dim); margin-left: 8px; }
.anchor { scroll-margin-top: 20px; }

.sheet { color-scheme: light; background: var(--paper); color: var(--ink); border-radius: 3px; padding: var(--pad); display: grid; gap: 18px; }
.sheet > form.editor { display: grid; gap: 18px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 30px; }
.sheet-head .who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; font-size: 14px; color: var(--ink-2); padding-top: 3px; }
.sheet-head .name { color: var(--ink); font-weight: 600; font-size: 15px; }
.stamp { flex: none; font-family: var(--display); font-weight: 900; font-stretch: 125%; font-style: italic; text-transform: uppercase; font-size: 17px; line-height: 1; padding: 7px 11px 5px; transform: rotate(-1.5deg); }
.stamp.ok { background: var(--chart); color: var(--ink); }
.stamp.no { color: var(--ink-2); box-shadow: inset 0 0 0 2px var(--ink-2); }

.content { display: grid; gap: 14px; font-size: 17px; line-height: 1.55; max-width: 62ch; min-width: 0; overflow-wrap: anywhere; }
.rejected .content, .skipped .content { opacity: .5; }
.content .empty { color: var(--ink-2); font-size: 15px; }
.content audio { width: 100%; max-width: 520px; }
.content video, .content .still { width: 100%; max-height: 70vh; background: var(--ink); border-radius: 2px; }
.content a { text-underline-offset: 3px; }
.nothis { background: var(--paper-2); padding: .12em 0; box-shadow: -4px 0 0 var(--paper-2), 4px 0 0 var(--paper-2); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.content .ask { text-decoration: underline; text-decoration-color: var(--flag); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.approved .content .ask, .rejected .content .ask, .live .content .ask { text-decoration-color: var(--paper-rule); }
.fold { display: inline-block; width: 2px; height: .82em; margin: 0 .22em; background: var(--ink-2); vertical-align: -.06em; }
.rest, .passage { display: grid; gap: 14px; }
.rest summary, .passage summary { color: var(--ink-2); font-size: 14px; }
.rest[open] summary, .passage[open] summary { margin-bottom: 14px; }
.rest p + p, .passage p + p { margin-top: 14px; }

.essay { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 8px 20px; align-items: center; }
.cover { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 2px; background: var(--paper-2); }
.essay-title { font-size: clamp(20px, 3vw, 24px); line-height: 1.18; font-weight: 700; }
.essay .fields { grid-column: 1 / -1; display: grid; gap: 14px; margin-top: 8px; }
.essay .fields:empty { display: none; }
.essay .fields p { text-wrap: balance; }
.field-name { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 3px; }

.takes { list-style: none; padding: 0; display: grid; max-width: none; }
.takes > li { display: grid; grid-template-columns: 2ch minmax(0, 1fr) auto; gap: 4px 14px; padding: 14px 0; border-top: 1px solid var(--paper-rule); align-items: baseline; }
.takes > li:first-child { border-top: 0; padding-top: 0; }
.takes > li:last-child { padding-bottom: 0; }
.takes .no { font-weight: 700; font-variant-numeric: tabular-nums; }
.takes .t { font-weight: 600; }
.takes .secs { color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.takes .q { grid-column: 2 / -1; font-size: 17px; line-height: 1.45; }
.takes .beats { grid-column: 2 / -1; list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 3px; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.takes .first { grid-column: 2 / -1; color: var(--ink-2); font-size: 16px; text-wrap: balance; }
.takes .passage { grid-column: 2 / -1; font-size: 16px; max-width: 62ch; display: block; }

.notes { display: grid; gap: 8px; font-size: 14px; line-height: 1.45; color: var(--ink-2); border-top: 1px solid var(--paper-rule); padding-top: 16px; }
.notes p { text-wrap: balance; overflow-wrap: anywhere; }
.notes b { color: var(--ink); font-weight: 600; margin-right: 6px; }
.notes .flag { color: var(--ink); font-size: 15px; }
.notes .flag b { color: var(--flag); }
.notes .flag.past { color: var(--ink-2); font-size: 14px; }
.notes .flag.past b { color: var(--ink); }
.notes .mine { color: var(--ink); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.actions form { display: contents; }
.when { font-size: 14px; color: var(--ink-2); }

/* editing happens on the paper: the rule sits in the sheet's padding so the words stay where they were */
.content textarea, .notefield textarea { display: block; font: inherit; color: var(--ink); background: transparent; border: 1px solid var(--ink-2); border-radius: 2px; padding: 10px 12px; margin: -11px -13px; width: calc(100% + 26px); resize: none; overflow: hidden; min-height: 3.2em; }
.content textarea:focus, .notefield textarea:focus { outline: none; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.essay .fields textarea { margin-top: 0; margin-bottom: 0; }
.editor .notes { border-top: 0; padding-top: 6px; }
.notefield { display: grid; gap: 18px; margin-bottom: 11px; font-size: 15px; line-height: 1.5; max-width: 68ch; }
.notefield span { font-size: 13px; font-weight: 600; color: var(--ink-2); }

.more { border-top: 1px solid var(--paper-rule); padding-top: 14px; font-size: 14px; }
.more summary { color: var(--ink-2); }
.more-in { display: grid; gap: 14px; margin-top: 14px; justify-items: start; }
.more form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.more label { font-weight: 600; color: var(--ink-2); font-size: 13px; }
.more select { border-color: var(--ink-2); color: var(--ink); min-height: 36px; padding: 5px 10px; }
.history { list-style: none; padding: 0; display: grid; gap: 4px; color: var(--ink-2); max-width: 68ch; }
.history .hw { display: inline-block; min-width: 4.2em; font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---- one episode ---------------------------------------------------------- */
.episode { display: grid; gap: 34px; }
.format { display: grid; scroll-margin-top: 20px; }
.format h2 { font-size: 13px; font-weight: 600; color: var(--dim); padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.piece { border-bottom: 1px solid var(--rule); scroll-margin-top: 20px; }
.piece summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; align-items: baseline; padding: 13px 0; cursor: pointer; list-style: none; }
.piece summary:hover .nm { text-decoration: underline; text-underline-offset: 3px; }
.piece .nm { font-weight: 600; min-width: 0; }
.piece .kd { grid-column: 1; grid-row: 2; font-size: 13px; color: var(--dim); }
.piece .kd:empty { display: none; }
.piece .st { grid-column: 2; grid-row: 1; font-size: 15px; white-space: nowrap; display: inline-flex; align-items: baseline; gap: 8px; }
.piece.review .st { font-weight: 700; }
.piece.live .st, .piece.skipped .st, .piece.rejected .st, .piece.scheduled .st { color: var(--dim); }
.piece.skipped .nm, .piece.rejected .nm { color: var(--dim); text-decoration: line-through; text-decoration-color: var(--rule); }
.piece[open] { padding-bottom: 18px; }
.piece[open] summary { padding-bottom: 14px; }

/* ---- sign in and account -------------------------------------------------- */
.gate { display: grid; gap: 26px; margin-top: 14vh; justify-items: start; }
.gate h1 { font-family: var(--display); font-weight: 900; font-stretch: 125%; font-style: italic; text-transform: uppercase; line-height: .9; font-size: clamp(44px, 9vw, 76px); }
.gate-form { display: grid; gap: 10px; width: min(100%, 340px); }
.gate-form label { font-size: 13px; font-weight: 600; color: var(--dim); margin-top: 8px; }
.gate-form .btn { margin-top: 10px; justify-self: start; }
.hint { color: var(--dim); font-size: 14px; }
.account { display: grid; gap: 34px; justify-items: start; }

/* ---- narrow --------------------------------------------------------------- */
@media (max-width: 860px) {
  .board, .board tbody, .board tr, .board th, .board td { display: block; width: auto; }
  .board thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .board tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; padding: 16px 0 14px; border-bottom: 1px solid var(--rule); }
  .board tr:first-child { padding-top: 0; }
  .board th, .board td { border: 0; padding: 0; min-width: 0; }
  .board tbody th { grid-column: 1 / -1; padding-bottom: 10px; width: auto; }
  .board td { display: grid; grid-template-columns: 5.6em minmax(0, 1fr); gap: 0 8px; padding-block: 4px; align-items: baseline; }
  .board td::before { content: attr(data-f); font-size: 13px; color: var(--dim); }
  .board .num { text-align: left; }
  .board.list tr { grid-template-columns: minmax(0, 1fr); }
  .board.list tbody th { width: auto; }
}
@media (max-width: 520px) {
  .tabs { gap: 18px; margin-inline: calc(-1 * var(--side)); padding-inline: var(--side); }
  .tab { font-size: 15px; }
  .board tr { grid-template-columns: minmax(0, 1fr); }
  .sheet-head .who { flex-direction: column; gap: 0; }
  .essay { grid-template-columns: 112px minmax(0, 1fr); gap: 8px 14px; align-items: start; }
  .actions .btn.approve { flex: 1 1 100%; }
  .top { grid-template-columns: minmax(0, 1fr); }
  .top .call { justify-self: stretch; }
  .piece summary { grid-template-columns: minmax(0, 1fr); }
  .piece .st { grid-column: 1; grid-row: auto; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
