/* Frontier Recap. One stylesheet for the news page, story pages and the forum shell. */
@font-face {
  font-family: 'Libre Franklin';
  src: url('/assets/libre-franklin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #fff;
  --ink: #111;
  --dim: #5c5c5c;
  --rule: #d6d6d6;
  --hi: #ffe14a; /* highlighter: nameplate, selected filters, saved stories, button hover */
  --bad: #b3261e;
  /* One colour per topic, used as a mark beside the label, never as text. Checked for colour-blind separation. */
  --c-models: #2a78d6;
  --c-research: #1baf7a;
  --c-industry: #eb6834;
  --c-tools: #6250d6;
  --c-policy: #e87ba4;
  --sans: 'Libre Franklin', 'Franklin Gothic Medium', 'Helvetica Neue', Arial, sans-serif;
  --serif: Charter, 'Bitstream Charter', 'Iowan Old Style', Georgia, serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, Menlo, monospace;
}
/* Dark follows the system unless the reader picked a side (.light / .dark on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not(.light) { --bg: #131313; --ink: #ececec; --dim: #a0a0a0; --rule: #363636; --bad: #ff8a80; --c-models: #3987e5; --c-research: #199e70; --c-industry: #d95926; --c-tools: #9085e9; --c-policy: #d55181; }
}
:root.dark { --bg: #131313; --ink: #ececec; --dim: #a0a0a0; --rule: #363636; --bad: #ff8a80; --c-models: #3987e5; --c-research: #199e70; --c-industry: #d95926; --c-tools: #9085e9; --c-policy: #d55181; }
[data-topic="Models"] { --t: var(--c-models); }
[data-topic="Research"] { --t: var(--c-research); }
[data-topic="Industry"] { --t: var(--c-industry); }
[data-topic="Tools"] { --t: var(--c-tools); }
[data-topic="Policy"] { --t: var(--c-policy); }

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-text-size-adjust: 100%; }
body { margin: 0; }
a { color: inherit; text-underline-offset: .15em; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
[aria-pressed="true"], [aria-current] { background: var(--hi); color: #111; }
.wrap { width: min(1200px, 100% - 40px); margin-inline: auto; }
.skip { position: absolute; left: 8px; top: -100px; background: var(--hi); color: #111; padding: 10px 14px; z-index: 5; }
.skip:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* Black band: nameplate at the top, sign-off at the bottom. Same in light and dark. */
.band { background: #0b0b0b; color: #f4f4f4; border-bottom: 6px solid var(--hi); }
.band :focus-visible { outline-color: var(--hi); }
.mast { padding: 26px 0 20px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 32px; flex-wrap: wrap; }
.logo { font-weight: 900; font-size: clamp(2.5rem, 8vw, 4.6rem); line-height: .9; letter-spacing: -.05em; text-decoration: none; white-space: nowrap; }
.logo b, .foot b { font-weight: inherit; background: var(--hi); color: #0b0b0b; padding: 0 .13em; margin-left: .04em; }
.mast.compact { padding: 16px 0 14px; align-items: center; }
.mast.compact .logo { font-size: 1.9rem; }
.tagline { margin: 0; max-width: 34ch; font: 1.02rem/1.35 var(--serif); color: #c4c4c4; }
.dateline { border-top: 1px solid #3a3a3a; padding: 9px 0 10px; display: flex; justify-content: space-between; gap: 6px 20px; flex-wrap: wrap; font: .75rem/1.4 var(--mono); color: #c4c4c4; }
.dateline button { text-decoration: underline; text-underline-offset: .2em; }

/* Topic marks */
.kicker { display: inline-flex; align-items: center; margin: 0; font: 700 .7rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.kicker i, .tabs i, .legend i { flex: none; display: inline-block; width: .7em; height: .7em; margin-right: .5em; background: var(--t); }

/* Topic bar */
.bar { position: sticky; top: 0; z-index: 2; background: var(--bg); border-bottom: 1px solid var(--rule); padding: 9px 0; display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; }
.tabs, .tools { display: flex; flex-wrap: wrap; gap: 2px; margin-inline: -8px; }
.tabs > *, .tools > * { padding: 5px 8px; font-size: .92rem; font-weight: 650; white-space: nowrap; text-decoration: none; }
.tools > * { font-weight: 500; }
.tabs span, #saved-count { font: .7rem var(--mono); opacity: .65; margin-left: 4px; }
.tabs > :hover, .tools > :hover { text-decoration: underline; }

.notice { margin: 16px 0 0; padding: 10px 12px; border: 1px solid var(--ink); font: .8rem/1.5 var(--mono); }

/* Headline, excerpt, byline: shared by the front block, the wire and story pages */
.hl { margin: 0; font-size: 1.1rem; font-weight: 650; line-height: 1.26; letter-spacing: -.012em; text-wrap: balance; }
.hl a { text-decoration: none; }
.hl a:hover { text-decoration: underline; }
.hl a:visited { color: var(--dim); }
.ex { margin: 4px 0 0; max-width: 68ch; font: .98rem/1.5 var(--serif); }
.by { margin: 6px 0 0; font: .74rem/1.7 var(--mono); color: var(--dim); }
.by b { color: var(--ink); font-weight: 600; }
.by a, .by button { text-decoration: none; }
.by a:hover, .by button:hover { color: var(--ink); text-decoration: underline; }
.by button[aria-pressed="true"] { padding: 0 4px; }

/* Front block: newest story on a tinted panel, three from other sources beside it */
.front { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 36px; padding: 28px 0 0; }
.lead { border-top: 8px solid var(--t); padding: 18px 26px 26px; background: color-mix(in srgb, var(--t) 9%, var(--bg)); }
.lead .hl { margin-top: 14px; font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 850; line-height: 1; letter-spacing: -.04em; }
.lead .hl a:visited { color: inherit; }
.lead .ex { margin-top: 18px; font-size: 1.22rem; max-width: 52ch; }
.lead .by { margin-top: 16px; }
.seconds { display: grid; align-content: start; gap: 20px; }
.seconds article { border-top: 4px solid var(--t); padding-top: 9px; }
.seconds .hl { margin-top: 6px; font-size: 1.28rem; font-weight: 750; line-height: 1.15; letter-spacing: -.022em; }

/* By-topic strip */
.sections { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px; margin-top: 34px; padding-bottom: 30px; border-bottom: 3px double var(--ink); }
.sections section { border-top: 8px solid var(--t); }
.sections h2 { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 0 2px; font-size: 1.3rem; font-weight: 850; letter-spacing: -.03em; }
.sections h2 button:hover { text-decoration: underline; }
.sections h2 span { font: .72rem var(--mono); color: var(--dim); letter-spacing: 0; }
.sections .hl { padding: 9px 0; border-top: 1px solid var(--rule); font-size: .95rem; font-weight: 600; text-wrap: pretty; }

/* Wire + rail */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 56px; padding-top: 24px; }
.find { display: flex; gap: 8px; }
.find input, .find select { font: .92rem var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--ink); border-radius: 0; padding: 8px 10px; }
.find input { flex: 1; min-width: 0; }
.find select { border-color: var(--rule); max-width: 11rem; }
.source-pick { display: none; }
.count { margin: 10px 0 0; font: .74rem/1.7 var(--mono); color: var(--dim); }
.count button { margin-left: 8px; color: var(--ink); text-decoration: underline; }
.day { display: flex; align-items: flex-end; gap: 12px; margin: 0; padding: 34px 0 9px; border-bottom: 2px solid var(--ink); }
.day b { font-size: 3rem; font-weight: 900; line-height: .78; letter-spacing: -.05em; }
.day span { font: 700 .76rem/1.25 var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.day em { margin-left: auto; font: normal .74rem var(--mono); color: var(--dim); }
.row { display: grid; grid-template-columns: 6.6rem minmax(0, 1fr); padding: 14px 0 15px; border-bottom: 1px solid var(--rule); }
.row > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.row time { font: .76rem/1.85 var(--mono); color: var(--dim); }
.more { margin: 24px 0 0; padding: 9px 14px; border: 1px solid var(--ink); font-weight: 650; font-size: .9rem; }
.more:hover, .btn:hover { background: var(--hi); color: #111; }
.empty { padding: 48px 0; border-bottom: 1px solid var(--rule); }
.empty p { margin: 0 0 12px; font: 1.1rem/1.5 var(--serif); }

.rail { align-self: start; position: sticky; top: 58px; padding-bottom: 24px; }
.rail h2 { margin: 0; padding: 28px 0 6px; border-bottom: 2px solid var(--ink); font: 700 .78rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.rail h2:first-child { padding-top: 0; }
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail p { margin: 10px 0 0; font: .9rem/1.5 var(--serif); color: var(--dim); }
/* Source rows: the grey bar behind each name is its share of stories */
#source-list li { border-bottom: 1px solid var(--rule); }
#source-list button { position: relative; z-index: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; padding: 7px 6px; font-size: .9rem; text-align: left; }
#source-list button::before { content: ''; position: absolute; z-index: -1; inset: 3px auto 3px 0; width: var(--w); background: var(--rule); opacity: .55; }
#source-list button[aria-pressed="true"]::before { display: none; }
#source-list button:hover { text-decoration: underline; }
#source-list span { font: .72rem var(--mono); opacity: .75; }
#source-list small { display: block; padding: 0 6px 6px; font: .7rem var(--mono); color: var(--bad); }
.more-list li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.more-list a { display: block; font-weight: 650; line-height: 1.25; text-decoration: none; }
.more-list a:hover { text-decoration: underline; }
.more-list span { font: .7rem/1.8 var(--mono); color: var(--dim); }

/* Stories-per-day chart */
.chart { display: block; width: 100%; height: auto; margin-top: 12px; overflow: visible; }
.chart .seg { fill: var(--t); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--ink); fill-opacity: .07; }
.chart line { stroke: var(--rule); }
.chart text { font: 9px var(--mono); fill: var(--dim); text-anchor: middle; }
.chart .peak { fill: var(--ink); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 8px; font: .68rem/1.6 var(--mono); color: var(--dim); }
.legend span { display: inline-flex; align-items: center; }
.tip { position: fixed; z-index: 20; max-width: 240px; padding: 7px 10px; background: var(--ink); color: var(--bg); font: .74rem/1.5 var(--mono); pointer-events: none; white-space: pre-line; }

.foot { margin-top: 72px; border-bottom: 0; border-top: 6px solid var(--hi); font-size: .88rem; }
.foot .wrap { padding: 22px 0 46px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.foot nav > * { text-decoration: underline; }

/* Buttons, dialogs, toast */
.btn { display: inline-block; background: var(--ink); color: var(--bg); padding: 9px 14px; font-size: .9rem; font-weight: 650; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: wait; }
dialog { width: min(680px, 100% - 28px); max-height: 86vh; padding: 22px 26px 26px; border: 2px solid var(--ink); border-top: 8px solid var(--hi); border-radius: 0; background: var(--bg); color: var(--ink); }
dialog::backdrop { background: rgb(0 0 0 / .6); }
dialog h2 { margin: 0 0 12px; font-size: 1.7rem; font-weight: 850; line-height: 1.1; letter-spacing: -.03em; }
dialog h3 { margin: 22px 0 4px; font-size: 1rem; }
dialog p, dialog li { font: 1rem/1.55 var(--serif); }
dialog p { margin: 0 0 12px; }
dialog .by { font: .74rem/1.7 var(--mono); }
.close { float: right; margin-left: 16px; font: .74rem/2 var(--mono); text-decoration: underline; }
.list { list-style: none; margin: 16px 0; padding: 0; border-top: 2px solid var(--ink); }
.list li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.list .hl { font-family: var(--sans); }
.toast { position: fixed; left: 50%; bottom: 20px; z-index: 10; max-width: 90vw; padding: 9px 14px; background: var(--ink); color: var(--bg); font-size: .85rem; transform: translate(-50%, 80px); opacity: 0; pointer-events: none; transition: transform .2s, opacity .2s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Story pages (generated by desktop/publisher.py) */
.story-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 64px; padding-top: 40px; }
.story { border-top: 8px solid var(--t); padding-top: 14px; }
.story h1 { margin: 14px 0 12px; font-size: clamp(2.1rem, 5.4vw, 3.6rem); font-weight: 850; line-height: 1; letter-spacing: -.04em; text-wrap: balance; }
.story .ex { margin: 26px 0 6px; font-size: 1.28rem; max-width: 60ch; }
.recap { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--rule); }
.recap p { margin: 0 0 1em; max-width: 62ch; font: 1.2rem/1.65 var(--serif); }
.recap p:first-child::first-letter { float: left; padding: .06em .1em 0 0; font: 900 3.9em/.78 var(--sans); }
.story .actions { margin: 28px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }

@media (max-width: 900px) {
  .bar { position: static; }
  .front, .cols, .story-layout { display: block; }
  .lead { padding: 16px 18px 22px; }
  .seconds { margin-top: 24px; }
  .sections { grid-template-columns: 1fr 1fr; }
  .rail { position: static; margin-top: 40px; }
  .home .rail { display: none; }
  .source-pick { display: block; }
  .find { flex-wrap: wrap; }
  .find input { flex-basis: 100%; }
  .find select { max-width: none; flex: 1; }
  .row { grid-template-columns: 1fr; gap: 4px; }
  .row > div:first-child { flex-direction: row; align-items: center; gap: 12px; }
  .day b { font-size: 2.5rem; }
}
@media (max-width: 480px) { .sections { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
