/* AI at Work: the fact-service look (docs/ui-patterns.md in fact-service). Type does the work:
   one paper colour, hairlines as the only dividers, no cards or fills, one green mark, everything on a grid. */
@font-face { font-family: 'Geist'; src: url('/assets/fonts/geist-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --col-n: 5.5rem; --col-aside: 21rem; --col-gap: 3rem; --space: 1.75rem;
  --paper: #fcfcf7; --ink: #1b2118; --soft: #7b8075; --hair: #dedccf; --mark: #3f7a22;
  --tint: #f1efe6; --warn: #a8660b; --bad: #b3392f;
  --f-body: 'Geist', 'Helvetica Neue', system-ui, sans-serif;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--f-body); display: grid; grid-template-rows: auto 1fr auto; min-height: 100vh; }
h1, h2, h3, p, ol, ul { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--mark); outline-offset: 3px; }
::selection { background: var(--tint); }

.label { font: 500 0.68rem/1.6 var(--f-body); letter-spacing: 0.18em; text-transform: uppercase; color: var(--soft); }
.chip { font: 500 0.66rem/1.6 var(--f-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--soft); white-space: nowrap; }
.chip.ok { color: var(--mark); }
.chip.warn { color: var(--warn); }
.quiet { color: var(--soft); }
.link { text-decoration: underline; text-decoration-color: var(--hair); text-underline-offset: 4px; }
.link:hover { text-decoration-color: var(--ink); }

/* Top bar: the name, the sections as words, the issue on the right */
.top { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 2rem; padding: 1.1rem var(--gutter) 0; border-bottom: 1px solid var(--hair); }
.brand { padding-bottom: 0.85rem; font-weight: 500; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 2rem; }
.seg a { padding: 0 0 0.85rem; color: var(--soft); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.seg a:hover { color: var(--ink); }
.seg a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--ink); }
.top .meta { padding-bottom: 0.85rem; font-size: 0.85rem; color: var(--soft); white-space: nowrap; font-variant-numeric: tabular-nums; }

main { width: 100%; max-width: 76rem; margin: 0 auto; padding: 0 var(--gutter) 4rem; display: grid; align-content: start; }

/* Masthead */
.mast { display: grid; gap: 1.5rem; padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(2rem, 5vw, 3.5rem); }
.mast .line { display: grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 1.5rem; }
.mast .line .label { white-space: nowrap; }
.mast h1 { font: 300 clamp(2.4rem, 6.2vw, 4.9rem)/1.02 var(--f-body); letter-spacing: -0.045em; max-width: 18ch; }
.standfirst { font: 300 clamp(1.15rem, 2vw, 1.45rem)/1.4 var(--f-body); letter-spacing: -0.015em; color: var(--soft); max-width: 46rem; }

/* In this issue */
.contents { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 3rem; border-bottom: 1px solid var(--hair); }
.contents li { border-top: 1px solid var(--hair); }
.contents a { display: grid; grid-template-columns: 2.5rem 1fr; gap: 0.2rem 0.75rem; padding: 0.85rem 0; text-decoration: none; }
.contents .n { font: 300 1.05rem/1.4 var(--f-body); color: var(--soft); font-variant-numeric: tabular-nums; grid-row: span 2; }
.contents .t { font: 400 1rem/1.4 var(--f-body); }
.contents a:hover .t { color: var(--mark); }
.section-label { padding: 3rem 0 0.9rem; }

/* One move this week */
.move { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem 3rem; padding: 2rem 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--hair); margin-top: 3.5rem; }
.move .label { grid-column: 1 / -1; color: var(--ink); }
.move .big { font: 300 clamp(1.4rem, 2.6vw, 2rem)/1.2 var(--f-body); letter-spacing: -0.025em; }
.move p:last-child { color: var(--soft); font-size: 1.05rem; align-self: end; }

/* Items: number, the story, then why it matters and the sources */
.items { display: grid; }
.item { display: grid; grid-template-columns: var(--col-n) minmax(0, 1fr) minmax(0, var(--col-aside)); gap: 0 var(--col-gap); padding: 2.5rem 0 2.75rem; border-top: 1px solid var(--hair); scroll-margin-top: 1rem; }
.item:first-child { border-top: 1px solid var(--ink); }
.item .n { font: 300 2.6rem/1 var(--f-body); letter-spacing: -0.04em; color: var(--soft); font-variant-numeric: tabular-nums; }
.item .story { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-content: start; }
.item .tags { display: grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 1.25rem; }
.item h2 { font: 300 clamp(1.5rem, 2.6vw, 2.15rem)/1.15 var(--f-body); letter-spacing: -0.03em; }
.item .body { font-size: 1.02rem; line-height: 1.65; max-width: 40rem; }
.item aside { display: grid; gap: var(--space); align-content: start; padding-top: 0.15rem; }
.item .group { display: grid; gap: 0.6rem; align-content: start; }
.item .why { font: 400 1rem/1.55 var(--f-body); }
.sources { list-style: none; padding: 0; display: grid; }
.sources li { border-top: 1px solid var(--hair); padding: 0.5rem 0; font-size: 0.88rem; }
.sources li:last-child { border-bottom: 1px solid var(--hair); }
.sources a { text-decoration: none; display: grid; grid-template-columns: 1fr auto; gap: 0.75rem; }
.sources a::after { content: '↗'; color: var(--soft); }
.sources a:hover { color: var(--mark); }

/* Archive */
.archive { list-style: none; padding: 0; display: grid; border-bottom: 1px solid var(--hair); }
.archive li { border-top: 1px solid var(--hair); }
.archive li:first-child { border-top: 1px solid var(--ink); }
.archive a { display: grid; grid-template-columns: 9rem 5rem minmax(0, 1fr) auto; gap: 0.5rem 2rem; align-items: baseline; padding: 1.25rem 0; text-decoration: none; }
.archive .d { font-variant-numeric: tabular-nums; color: var(--soft); font-size: 0.9rem; }
.archive .h { font: 300 clamp(1.2rem, 2.2vw, 1.6rem)/1.25 var(--f-body); letter-spacing: -0.02em; }
.archive a:hover .h { color: var(--mark); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding: 2rem 0 0; }
.pager a { display: grid; gap: 0.3rem; text-decoration: none; }
.pager a:hover .h { color: var(--mark); }
.pager .next { text-align: right; }
.pager .h { font: 300 1.15rem/1.3 var(--f-body); }

/* Foot: hairline above, words in --soft, on a grid */
.foot { display: grid; grid-template-columns: 1fr auto; gap: 1rem 2rem; padding: 1.1rem var(--gutter); border-top: 1px solid var(--hair); font-size: 0.8rem; color: var(--soft); }
.foot nav { display: grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 1.5rem; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }

@media (max-width: 960px) {
  :root { --col-n: 3.5rem; --col-gap: 2rem; }
  .item { grid-template-columns: var(--col-n) minmax(0, 1fr); }
  .item aside { grid-column: 2; padding-top: 2rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--col-gap); }
  .item aside .tune { grid-column: 1 / -1; max-width: var(--col-aside); }
  .item .n { font-size: 1.9rem; }
}
@media (max-width: 680px) {
  .top { grid-template-columns: auto 1fr; }
  .top .meta { display: none; }
  .contents, .move, .pager { grid-template-columns: 1fr; }
  .item { grid-template-columns: minmax(0, 1fr); }
  .item .tags { grid-auto-flow: row; gap: 0.25rem; }
  .item .n { padding-bottom: 1rem; }
  .item aside { grid-column: 1; grid-template-columns: minmax(0, 1fr); }
  .item aside .tune { max-width: none; }
  .mast .line { gap: 1rem; }
  .mast .line .label { letter-spacing: 0.12em; }
  .archive a { grid-template-columns: 1fr auto; }
  .archive .h { grid-column: 1 / -1; grid-row: 2; }
  .foot { grid-template-columns: 1fr; }
}
@media print {
  .top, .foot, .pager { display: none; }
  .item { break-inside: avoid; }
}

/* Listen: a band on the same three columns as the items below (number | story | aside).
   Play sits in the number column, title and scrubber in the story column, speed and feed in the aside column. */
.listen { display: grid; grid-template-columns: var(--col-n) minmax(0, 1fr) minmax(0, var(--col-aside)); grid-template-areas: 'play text ctrl' 'play scrub ctrl'; gap: 0.75rem var(--col-gap); align-items: center; padding: var(--space) 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--hair); margin-bottom: 0.5rem; }
.listen .play { grid-area: play; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--ink); cursor: pointer; display: grid; place-items: center; }
.listen .ico { width: 0; height: 0; border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent var(--paper); margin-left: 4px; }
.listen.on .ico { width: 14px; height: 16px; border: 0; margin: 0; background: linear-gradient(90deg, var(--paper) 0 5px, transparent 5px 9px, var(--paper) 9px 14px); }
.listen.on .play { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px var(--hair); } }
.listen-text { grid-area: text; display: grid; gap: 0.15rem; align-self: end; }
.listen-text .label { margin: 0; color: var(--ink); }
.listen-sub { color: var(--soft); font-size: 0.95rem; }
.speed { grid-area: ctrl; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; align-self: center; }
.scrub { grid-area: scrub; display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 1rem; align-items: center; align-self: start; }
.scrub .t { font-size: 0.78rem; color: var(--soft); font-variant-numeric: tabular-nums; min-width: 2.25rem; }
.scrub .dur { text-align: right; }
.scrub input { -webkit-appearance: none; appearance: none; width: 100%; min-width: 0; height: 20px; margin: 0; background: transparent; cursor: pointer; }
.scrub input::-webkit-slider-runnable-track { height: 1px; background: var(--ink); }
.scrub input::-moz-range-track { height: 1px; background: var(--ink); }
.scrub input::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%; background: var(--mark); margin-top: -5px; border: 0; }
.scrub input::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--mark); border: 0; }
main > *, .mast > *, .listen > *, .scrub > *, .speed > *, .votes > * { min-width: 0; }

/* Pills: one hairline button style for speed, feed and the votes; ink when chosen */
.pill { display: grid; place-items: center; min-height: 40px; padding: 0.45rem 0.9rem; font: 500 0.85rem/1.3 var(--f-body); color: var(--ink); background: none; border: 1px solid var(--hair); border-radius: 999px; cursor: pointer; text-decoration: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill:hover { border-color: var(--ink); }
.pill[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* Tune next week */
.votes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; }
.tune-note { font-size: 0.8rem; color: var(--soft); line-height: 1.45; }
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 0.6rem 1.2rem; border-radius: 999px; font-size: 0.9rem; margin: 0; z-index: 10; white-space: nowrap; }
.toast[hidden] { display: none; }

@media (max-width: 960px) {
  .listen { grid-template-areas: 'play text' 'play scrub' '. ctrl'; grid-template-columns: var(--col-n) minmax(0, 1fr); }
  .speed { max-width: var(--col-aside); padding-top: 0.5rem; }
}
@media (max-width: 680px) {
  .listen { grid-template-columns: 56px minmax(0, 1fr); grid-template-areas: 'play text' 'scrub scrub' 'ctrl ctrl'; column-gap: 1rem; row-gap: 1rem; }
  .speed { max-width: none; padding-top: 0; }
}
