/* Layout: a gallery wall. One maxim set large and left-aligned, a wall label beside it giving its age,
   and a ten-step bar scale beneath that turns into the crowd's histogram once you rate. */
:root {
  --wall: #f4f4f1;
  --panel: #ffffff;
  --ink: #111218;
  --muted: #5d606b;
  --rule: #d5d6d0;
  --lapis: #1f31d1;
  --on-lapis: #ffffff;
  --bar: #d7d8e0;
  --bar-result: #c0c2cd;
  --vermilion: #e0442a;
  --foot-bg: #151a46; --foot-ink: #f4f4f1; --foot-muted: #b3b8dc;

  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --ui: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wall: #0c0d12; --panel: #14161e; --ink: #ecedf2; --muted: #9196a6; --rule: #262935;
    --lapis: #8e9cff; --on-lapis: #0c0d12; --bar: #2a2d3a; --bar-result: #3e4252;
    --vermilion: #ff7f61; --foot-bg: #141842;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --wall: #0c0d12; --panel: #14161e; --ink: #ecedf2; --muted: #9196a6; --rule: #262935;
  --lapis: #8e9cff; --on-lapis: #0c0d12; --bar: #2a2d3a; --bar-result: #3e4252;
  --vermilion: #ff7f61; --foot-bg: #141842;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { scrollbar-color: var(--bar-result) var(--wall); accent-color: var(--lapis); caret-color: var(--lapis); }
::selection { background: var(--lapis); color: var(--on-lapis); }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 400 var(--step-0)/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lapis); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Header ─────────────────────────────────────────── */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.5rem;
  padding: 0.5rem var(--gutter-r) 0.5rem var(--gutter);
  max-width: 76rem; margin: 0 auto;
}
.mark { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 44px; text-decoration: none; }
.mark .glyph { width: 30px; height: 24px; overflow: visible; }
.mark .glyph rect {
  fill: color-mix(in oklch, var(--lapis) calc(var(--t) * 100%), var(--vermilion));
  transform-box: fill-box; transform-origin: bottom;
}
.mark:hover .glyph rect { animation: hop 700ms cubic-bezier(.3,1.6,.5,1) calc(var(--t) * 240ms); }
@keyframes hop { 40% { transform: scaleY(0.45); } }
.mark .word { font: 500 1.45rem/1 var(--display); letter-spacing: -0.01em; }
.mark .word i { display: inline-block; margin-left: 0.04em; color: var(--vermilion); font-weight: 400; transition: transform 300ms cubic-bezier(.3,1.6,.5,1); }
.mark:hover .word i { transform: rotate(14deg) translateY(-2px); }
nav.views { display: flex; gap: 0 1.25rem; flex-wrap: wrap; }
nav.views a {
  display: inline-flex; align-items: center; min-height: 44px;
  text-decoration: none; color: var(--muted); font-size: 0.9375rem; font-weight: 500;
  border-bottom: 2px solid transparent;
}
nav.views a[aria-current="page"] { color: var(--ink); border-color: var(--lapis); }
nav.views a:hover { color: var(--ink); }
.tally { margin-left: auto; font-size: var(--step--1); color: var(--muted); font-variant-numeric: tabular-nums; }
.theme {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--rule); border-radius: 999px;
  background: none; color: var(--muted); cursor: pointer; transition: color 200ms, border-color 200ms;
}
.theme:hover { color: var(--ink); border-color: var(--ink); }
.theme[data-mode="light"] .sun, .theme[data-mode="dark"] .moon, .theme:not([data-mode]) svg { display: none; }
.theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;; animation: spin-in 450ms cubic-bezier(.3,1.4,.5,1); }
@keyframes spin-in { from { transform: rotate(-90deg) scale(0.5); opacity: 0; } }

main { max-width: 76rem; margin: 0 auto; padding: 0 var(--gutter-r) 3rem var(--gutter); }
[hidden] { display: none !important; }

/* ── Rate view ──────────────────────────────────────── */
.stage {
  display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 2rem 3.5rem;
  align-items: end; padding-block: clamp(1.5rem, 7vh, 5rem) 1.5rem;
}
.stage > * { min-width: 0; }
blockquote.maxim {
  margin: 0; font-family: var(--display); font-weight: 400;
  font-optical-sizing: auto; line-height: 1.18;
  text-wrap: pretty; hanging-punctuation: first;
}
blockquote.maxim em { font-style: italic; }
blockquote.maxim .ti { font-weight: 500; color: var(--muted); }
.maxim[data-size="xl"] { font-size: clamp(2.3rem, 6.4vw, 5rem); line-height: 1.08; }
.maxim[data-size="l"]  { font-size: clamp(1.9rem, 4.6vw, 3.6rem); line-height: 1.12; }
.maxim[data-size="m"]  { font-size: clamp(1.6rem, 3.5vw, 2.7rem); }
.maxim[data-size="s"]  { font-size: clamp(1.4rem, 2.6vw, 2.05rem); line-height: 1.28; }

.label { align-self: end; display: grid; gap: 0.1rem; font-size: 0.875rem; line-height: 1.4; }
.label .who { font-weight: 700; font-size: 1rem; }
.label .work { font-style: italic; font-family: var(--display); font-size: 1.0625rem; }
.label .ref { color: var(--muted); font-size: var(--step--1); }
.label .age { margin-top: 0.75rem; font-variant-numeric: tabular-nums; }

/* Scale ─ ten bars stepping up; after a vote they become the crowd histogram */
.rate { padding-top: 1.75rem; display: grid; gap: 0.9rem; }
.scale {
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px;
  height: clamp(7.5rem, 22vh, 11rem); align-items: end;
}
.scale button {
  --c: color-mix(in oklch, var(--lapis) calc(var(--t, 1) * 100%), var(--vermilion));
  position: relative; height: 100%; border: 0; padding: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch;
}
.scale .fill {
  display: block; height: var(--h); min-height: 4px;
  background: color-mix(in oklch, var(--c) 16%, var(--bar));
  transition: height 560ms cubic-bezier(.16,1,.3,1), background-color 200ms;
}
.scale .num {
  display: block; padding-top: 0.45rem; text-align: center;
  font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
}
.scale .pct { position: absolute; left: 0; right: 0; text-align: center; font-size: 0.75rem; line-height: 1; font-variant-numeric: tabular-nums; color: var(--muted); bottom: calc(var(--h) + 1.9rem); opacity: 0; transition: opacity 300ms 200ms; }
.scale button:hover .fill, .scale button:focus-visible .fill { background: var(--c); }
.scale[data-mode="result"] .fill { background: var(--bar-result); }
.scale[data-mode="result"] .pct { opacity: 1; }
.scale button[aria-pressed="true"] .fill { background: var(--c); }
.scale button[aria-pressed="true"] .num { color: var(--c); }
.ends { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: var(--step--1); }
.ends span:first-child { color: var(--vermilion); }
.ends span:last-child { color: var(--lapis); }

.outcome { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; min-height: 3rem; }
.verdict { font-size: 1rem; flex: 1 1 18rem; min-width: 0; }
.verdict strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.verdict .note { color: var(--muted); font-size: var(--step--1); display: block; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn {
  min-height: 44px; border: 1px solid var(--rule); background: var(--panel); padding: 0.6rem 1rem; cursor: pointer;
  font-weight: 500; font-size: 0.9375rem; border-radius: 2px;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--wall); border-color: var(--ink); font-weight: 600; padding-inline: 1.4rem; min-width: 10.5rem; font-variant-numeric: tabular-nums; }
.btn.primary:hover { background: var(--lapis); border-color: var(--lapis); color: var(--on-lapis); }
.btn:disabled, .btn:disabled:hover { background: transparent; border-color: var(--rule); color: var(--muted); cursor: default; }
.keys { color: var(--muted); font-size: var(--step--1); }

/* ── Ranked lists ───────────────────────────────────── */
.listhead { padding-block: clamp(1.5rem, 6vh, 3.5rem) 1.25rem; border-bottom: 1px solid var(--ink); display: grid; gap: 0.6rem; }
.listhead h1 { margin: 0; font: 400 clamp(2.2rem, 5vw, 3.8rem)/1.05 var(--display); text-wrap: balance; }
.listhead p { margin: 0; color: var(--muted); max-width: 62ch; }
ol.ranked { list-style: none; margin: 0; padding: 0; }
ol.ranked li {
  display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) 7.5rem; gap: 0.25rem 1.5rem;
  padding-block: 1.35rem; border-bottom: 1px solid var(--rule); align-items: start;
}
.rk { font: 400 2.4rem/0.9 var(--display); font-variant-numeric: tabular-nums lining-nums; }
li:nth-child(-n+3) .rk { color: var(--lapis); }
.entry { min-width: 0; }
.entry a { text-decoration: none; display: block; }
.entry q { quotes: none; font: 400 1.3125rem/1.38 var(--display); text-wrap: pretty; }
.entry a:hover q { text-decoration: underline; }
.entry .meta { margin-top: 0.45rem; color: var(--muted); font-size: var(--step--1); }
.score { text-align: right; font-variant-numeric: tabular-nums; }
.score b { display: block; font-size: 1.5rem; font-weight: 600; line-height: 1; }
.score small { color: var(--muted); font-size: var(--step--1); line-height: 1.8; }
.empty { padding: 3rem 0; color: var(--muted); max-width: 52ch; }
.empty strong { color: var(--ink); }

/* ── About ──────────────────────────────────────────── */
.prose { max-width: 64ch; padding-block: clamp(1.5rem, 6vh, 3.5rem) 1rem; }
.prose h1 { margin: 0 0 1rem; font: 400 clamp(2.2rem, 5vw, 3.8rem)/1.05 var(--display); }
.prose h2 { margin: 2.5rem 0 0.5rem; font: 500 1.6rem/1.2 var(--display); }
.prose p { margin: 0 0 1rem; }
.tablewrap { overflow-x: auto; }
table.sources { border-collapse: collapse; width: 100%; font-size: 0.9rem; min-width: 34rem; }
.sources th, .sources td { text-align: left; padding: 0.55rem 0.75rem 0.55rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.sources th { font-weight: 600; font-size: var(--step--1); color: var(--muted); }
.sources th.n { text-align: right; }
.sources td.n { font-variant-numeric: tabular-nums; text-align: right; }
.sources td em { font-family: var(--display); }

footer {
  --edge: max(0px, (100% - 76rem) / 2);
  margin-top: 3rem; padding: 3rem calc(var(--edge) + var(--gutter-r)) calc(3rem + env(safe-area-inset-bottom, 0px)) calc(var(--edge) + var(--gutter));
  background: linear-gradient(90deg in oklch, var(--vermilion), var(--lapis)) top / 100% 6px no-repeat, var(--foot-bg);
  color: var(--foot-muted); font-size: var(--step--1);
}
footer a { color: var(--foot-ink); }
footer .btn { background: transparent; color: var(--foot-ink); border-color: rgb(255 255 255 / .3); }
footer .btn:hover { background: var(--foot-ink); color: var(--foot-bg); border-color: var(--foot-ink); }
footer .newsletter .btn { background: var(--vermilion); border-color: var(--vermilion); color: #fff; font-weight: 600; }
footer .newsletter .btn:hover { background: var(--foot-ink); border-color: var(--foot-ink); color: var(--foot-bg); }
footer ::selection { background: var(--vermilion); color: #fff; }
footer p { margin: 0 0 1.25rem; }
.support { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.25rem 3rem; align-items: end; }
.newsletter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.newsletter label { flex-basis: 100%; }
.newsletter-row { display: flex; gap: 0.5rem; }
.newsletter input[type="email"] {
  width: 16rem; min-width: 0; min-height: 44px; padding: 0 0.75rem;
  font: inherit; font-size: 0.9375rem; color: var(--ink);
  background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .25); border-radius: 2px; color: var(--foot-ink);
}
.newsletter input[type="email"]::placeholder { color: var(--foot-muted); }
.newsletter-note:empty { display: none; }
.newsletter-note { color: var(--foot-ink); }
.tip { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.tip .btn { display: inline-flex; align-items: center; text-decoration: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--wall); padding: 0.6rem 1rem; font-size: 0.875rem; border-radius: 2px;
}

.fade { animation: rise 480ms cubic-bezier(.16,1,.3,1); }
@keyframes rise { from { transform: translateY(6px); } to { transform: none; } }

@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr; align-items: start; padding-top: 1.25rem; }
  .label { align-self: start; }
  ol.ranked li { grid-template-columns: 2.75rem minmax(0, 1fr); }
  .rk { font-size: 1.8rem; }
  .score { grid-column: 2; text-align: left; display: flex; gap: 0.75rem; align-items: baseline; }
  .score b { display: inline; font-size: 1.1rem; }
  .tally { margin-left: 0; width: 100%; order: 3; }
  .theme { order: 1; margin-left: auto; }
  nav.views { order: 2; flex-basis: 100%; }
  .keys { display: none; }
  /* Keep the way forward in reach: actions pinned to the bottom of the screen */
  .scale { height: clamp(5rem, 15vh, 7.5rem); }
  #view-rate { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px)); }
  .actions {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; flex-wrap: nowrap;
    padding: 0.625rem var(--gutter-r) calc(0.625rem + env(safe-area-inset-bottom, 0px)) var(--gutter);
    background: var(--wall); border-top: 1px solid var(--rule);
  }
  .actions .btn { min-height: 48px; }
  .actions .btn.primary { flex: 1; font-size: 1rem; }
  .toast { bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }
  .support { grid-template-columns: 1fr; }
  .newsletter-row { flex-basis: 100%; }
  .newsletter input[type="email"] { flex: 1; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .fade { animation: none; }
  .mark:hover .glyph rect { animation: none; }
  .theme svg { animation: none; }
  .scale .fill, .scale .pct { transition: none; }
}

/* ── Flourishes ─────────────────────────────────────── */
blockquote.maxim::before {
  content: "\201C"; display: block; height: 0.42em; margin-bottom: 0.1em;
  font-size: 1.9em; line-height: 0.85; color: var(--lapis);
}
.verdict .quip { display: block; font: italic 400 1.35rem/1.25 var(--display); margin-bottom: 0.15rem; }
.scale .pop {
  position: absolute; left: 50%; bottom: calc(var(--h) + 1.6rem); font-size: 1.8rem; line-height: 1;
  pointer-events: none; animation: float-up 900ms cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes float-up {
  0% { transform: translate(-50%, 10px) scale(0.4); opacity: 0; }
  25% { transform: translate(-50%, -6px) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -48px) scale(1) rotate(-8deg); opacity: 0; }
}
.scale button:hover .num { color: var(--c); }
footer::before {
  content: "\2766"; display: block; text-align: center; margin-bottom: 1.5rem;
  font: 1.75rem/1 var(--display); color: var(--vermilion);
}

/* ── Rounds of ten ──────────────────────────────────── */
.round { display: flex; gap: 6px; padding-top: clamp(1rem, 4vh, 2rem); }
.round span { width: 22px; height: 4px; background: var(--bar); transition: background-color 300ms; }
.round span.done { background: var(--lapis); }
.round span.now { background: var(--bar-result); }
.round + .break + .stage { padding-top: clamp(1rem, 4vh, 3rem); }

.break { padding-block: clamp(1.5rem, 7vh, 5rem) 2rem; animation: rise 480ms cubic-bezier(.16,1,.3,1); }
.break .kicker { margin: 0 0 0.5rem; color: var(--vermilion); font-weight: 600; font-size: var(--step--1); letter-spacing: 0.08em; text-transform: uppercase; }
.break h2 { margin: 0; font: 400 clamp(2.3rem, 6vw, 4.5rem)/1.05 var(--display); }
.break .avg { margin: 1rem 0 2.5rem; font-size: 1.125rem; }
.break .avg strong { font-variant-numeric: tabular-nums; }
.picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 2rem 3rem; margin-bottom: 2.5rem; }
.picks figure { margin: 0; padding-top: 1rem; border-top: 1px solid var(--ink); }
.picks figcaption { color: var(--muted); font-size: var(--step--1); }
.picks figcaption b { color: var(--ink); }
.picks blockquote { margin: 0.6rem 0; font: 400 1.5rem/1.3 var(--display); text-wrap: pretty; }
.picks cite { font-style: normal; font-weight: 700; font-size: 0.9375rem; }
.break .actions { position: static; padding: 0; border: 0; background: none; }
.break .actions .btn { display: inline-flex; align-items: center; text-decoration: none; }
