/* The Crease War Daily. Tokens and rules: DESIGN.md.
   The whole page is the inner screen of one foldable: the bezel hugs the browser window,
   and the crease runs across the entire screen at the score. */
:root {
  --paper: #e4e2dc;      /* newsprint */
  --paper-2: #d6d3cb;    /* the Duo half of the screen */
  --ink: #141414;
  --ink-2: #44413b;
  --fold: #1e6b47;
  --duo: #c8281e;
  --duo-text: #9e1d15;   /* small Duo text on paper-2 (AA) */
  --hi: #ffe14d;
  --defect: #39ff6a;
  --rule: 2px solid var(--ink);
  --display: "Anybody", "Arial Narrow", sans-serif;
  --text: "Newsreader", Georgia, serif;
  --data: "IBM Plex Mono", ui-monospace, monospace;
  --burn-shadow: 3px 4px 6px rgba(20, 20, 20, 0.35);
  --gutter: clamp(16px, 4vw, 40px);
  --bezel: clamp(6px, 1.2vw, 12px);
  --screen-h: calc(100svh - 2 * var(--bezel));
  --topbar: 90px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { background: var(--ink); }
html, body { margin: 0; }
body {
  background: var(--ink);
  color: var(--ink);
  font: 18px/1.5 var(--text);
  caret-color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
::selection { background: var(--hi); color: var(--ink); }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { background: var(--hi); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
code { font: 600 0.9em var(--data); background: var(--hi); padding: 0 4px; }
h1, h2, h3 { font-family: var(--display); font-weight: 900; text-transform: uppercase; line-height: 0.95; margin: 0; text-wrap: balance; }
main { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter) 48px; }

/* The handset: bezel around the window, one screen inside it */
.handset { position: relative; padding: var(--bezel); min-height: 100svh; }
.display { position: relative; isolation: isolate; min-height: var(--screen-h); border-radius: 18px; overflow: clip; }
/* The two halves of the screen stay put while the page scrolls, like the crease. */
.display::before {
  content: ""; position: fixed; inset: var(--bezel); z-index: -1; border-radius: 18px; pointer-events: none;
  background: linear-gradient(90deg, var(--paper) 0 var(--fold-w), var(--paper-2) var(--fold-w) 100%);
}
.screen-crease {
  position: fixed; z-index: 5; pointer-events: none;
  top: var(--bezel); bottom: var(--bezel); width: 28px; margin-left: -14px;
  left: calc(var(--bezel) + (100% - 2 * var(--bezel)) * var(--fold-r));
  background: linear-gradient(90deg, rgba(20,20,20,0), rgba(20,20,20,.30) 44%, rgba(255,255,255,.45) 56%, rgba(20,20,20,0));
  animation: crease-in .5s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes crease-in { from { left: 50%; } }
@keyframes crease-in-v { from { top: 50%; } }
.crease-label {
  position: fixed; z-index: 6; margin: 0; bottom: calc(var(--bezel) + 12px); pointer-events: none;
  left: calc(var(--bezel) + (100% - 2 * var(--bezel)) * var(--fold-r)); transform: translateX(-50%);
  font: 600 14px/1 var(--data); background: var(--ink); color: var(--paper); padding: 7px 9px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Status bar of the screen: masthead + chyron */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 6px 24px;
  height: 52px; padding: 0 var(--gutter); border-bottom: 4px double var(--ink); overflow: hidden;
}
.masthead .title { margin: 0; font: 900 clamp(22px, 3.4vw, 34px)/1 var(--display); text-transform: uppercase; white-space: nowrap; }
.masthead .title a { text-decoration: none; }
.masthead .title a:hover { background: none; }
.mh-a { font-stretch: 62%; }
.mh-b { font-stretch: 150%; }
.dateline { margin: 0; font: 400 14px/1.2 var(--data); color: var(--ink-2); text-align: right; }

.chyron { display: flex; height: 38px; background: var(--hi); border-bottom: var(--rule); font: 600 15px/1 var(--data); overflow: hidden; }
.chyron-tag { background: var(--ink); color: var(--hi); padding: 11px 10px; text-transform: uppercase; flex: none; }
.chyron-window { overflow: hidden; flex: 1; }
.chyron .track { display: inline-flex; gap: 14px; padding: 11px 12px; white-space: nowrap; animation: scroll 70s linear infinite; }
.chyron:hover .track, .chyron:focus-within .track { animation-play-state: paused; }
.chyron a { text-decoration: none; }
.chyron a:hover { text-decoration: underline; background: none; }
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* First screen: the two halves, split exactly at the crease */
.hero { height: calc(var(--screen-h) - 52px); display: flex; flex-direction: column; }
.hero .chyron { flex: none; }
.panes { flex: 1; display: flex; min-height: 0; }
.pane { padding: clamp(14px, 3vw, 32px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 12px; min-width: 0; }
.pane-fold { flex: 0 0 var(--fold-w); color: var(--fold); }
.pane-duo { flex: 1 1 auto; color: var(--duo-text); align-items: flex-end; text-align: right; }
.side { font-size: 16px; font-stretch: 100%; letter-spacing: 0.04em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pane-duo .side { justify-content: flex-end; }
.score { margin: 0; font: 900 clamp(56px, 12vw, 168px)/0.82 var(--display); font-stretch: 52%; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.pane-duo .score { color: var(--duo); }
.burn-hint { margin: 0; font: 400 14px/1.3 var(--data); color: var(--ink-2); }
.taunt {
  margin: 0; color: var(--ink); font: 900 clamp(24px, 3.6vw, 48px)/0.95 var(--display); font-stretch: 70%;
  text-transform: uppercase; text-wrap: balance; max-width: 16ch;
}
/* After a burn click: a toast pinned to the bottom of the screen, above the crease label, visible on every size. */
.tag-hint {
  position: fixed; z-index: 7; left: 50%; bottom: calc(var(--bezel) + 56px); transform: translateX(-50%);
  width: min(560px, calc(100% - 2 * var(--bezel) - 24px)); margin: 0; padding: 10px 14px;
  font: 600 15px/1.4 var(--data); background: var(--hi); border: var(--rule); box-shadow: var(--burn-shadow);
}
.tag-hint[hidden] { display: none; }

/* Portrait phones: the crease turns horizontal. Fold on top, Duo below. */
@media (max-width: 640px) {
  .display::before { background: linear-gradient(180deg, var(--paper) 0 calc(var(--screen-h) * var(--fold-r)), var(--paper-2) 0); }
  .screen-crease {
    left: var(--bezel); right: var(--bezel); width: auto; margin-left: 0; bottom: auto;
    top: calc(var(--bezel) + var(--screen-h) * var(--fold-r)); height: 28px; margin-top: -14px;
    background: linear-gradient(180deg, rgba(20,20,20,0), rgba(20,20,20,.30) 44%, rgba(255,255,255,.45) 56%, rgba(20,20,20,0));
    animation-name: crease-in-v;
  }
  .crease-label { left: auto; right: calc(var(--bezel) + 10px); bottom: auto; transform: translateY(-50%); top: calc(var(--bezel) + var(--screen-h) * var(--fold-r)); }
  .dateline { display: none; }
  .hero { height: var(--screen-h); margin-top: -52px; padding-top: 52px; }
  .panes { flex-direction: column; }
  /* The boundary between panes must sit exactly on the crease: fold-r of the whole screen, minus the bars above. */
  .pane-fold { flex: 0 0 calc(var(--screen-h) * var(--fold-r) - 52px - 38px); justify-content: flex-end; padding-bottom: 22px; }
  .pane-duo { align-items: flex-start; text-align: left; justify-content: flex-start; padding-top: 22px; }
  .pane-duo .side { justify-content: flex-start; }
  .pane .burn-hint { display: none; }
  .taunt { font-size: 26px; }
}

/* Buttons and stamps */
.burn, .act {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 16px;
  font: 900 18px/1 var(--display); font-stretch: 85%; text-transform: uppercase; text-decoration: none; cursor: pointer;
  border: var(--rule);
}
.burn { white-space: nowrap; color: #fff; box-shadow: var(--burn-shadow); transition: transform .12s ease-out, box-shadow .12s ease-out; }
.burn:hover { transform: translate(-1px, -1px); }
.burn:active { transform: translate(2px, 3px); box-shadow: 1px 1px 2px rgba(20,20,20,.35); }
.burn-fold, .burn-fold:hover { background: var(--fold); }
.burn-duo, .burn-duo:hover { background: var(--duo); }
.act { background: var(--paper); color: var(--ink); }
.act:hover { background: var(--hi); }
.mark { width: 22px; height: 22px; flex: none; }
.stamp {
  display: inline-block; border: 3px solid currentColor; padding: 3px 8px; transform: rotate(-4deg);
  font: 900 16px/1 var(--display); font-stretch: 70%; text-transform: uppercase; letter-spacing: 0.02em;
}

/* Rules + price list */
.rules { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; margin: 28px 0 0; padding: 14px 0; border-top: 4px double var(--ink); border-bottom: var(--rule); }
.rules p { margin: 0; max-width: 62ch; }
.price-list { border-collapse: collapse; font: 400 15px/1.4 var(--data); min-width: 260px; }
.price-list caption { font: 900 16px/1 var(--display); text-transform: uppercase; text-align: left; padding-bottom: 6px; }
.price-list th { text-align: left; font-weight: 400; padding: 6px 16px 6px 0; border-bottom: 1px dashed var(--ink); }
.price-list td { text-align: right; padding: 6px 0; border-bottom: 1px dashed var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .rules { grid-template-columns: 1fr; } }

section > h2 { font-size: clamp(28px, 5vw, 44px); font-stretch: 70%; margin: 44px 0 14px; padding-bottom: 6px; border-bottom: var(--rule); }

/* Demo phones */
.demo-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; }
.demo { border-top: 4px double var(--ink); padding-top: 12px; }
.demo h3 { font-size: 24px; font-stretch: 80%; display: flex; align-items: center; gap: 8px; }
.demo-fold h3 { color: var(--fold); }
.demo-duo h3 { color: var(--duo); }
.phone-stage { position: relative; display: flex; justify-content: center; margin: 14px 0 6px; }
.phone { width: min(240px, 80%); height: auto; display: block; }
.phone .body { fill: var(--ink); }
.phone .screen { fill: #faf7ef; }
.phone .hinge { stroke: #5a5750; stroke-width: 2; }
.phone .crack { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linejoin: miter; opacity: 0; }
.phone .defect-line { stroke: var(--defect); stroke-width: 4; opacity: 0; }
.phone .protector { fill: rgba(255,255,255,.55); stroke: var(--ink-2); stroke-width: 1.5; transform-origin: 182px 22px; transition: transform .6s cubic-bezier(.16,1,.3,1); }
.phone .crease-line { stroke: var(--ink); stroke-width: 8; opacity: var(--crease, .12); }
/* Closed = only the outer half shows, full height. Opening unfolds it from the hinge. */
.demo .phone { clip-path: inset(0 0 0 50%); transform: translateX(-25%); transition: clip-path .4s cubic-bezier(.16,1,.3,1), transform .4s cubic-bezier(.16,1,.3,1); }
.demo.open .phone { clip-path: inset(0); transform: none; }
.demo.cracked .crack, .rival .phone-duo .crack { opacity: 1; }
.demo.cracked .defect-line, .rival .phone-duo .defect-line { opacity: 1; animation: flicker 1.6s steps(2) infinite; }
@keyframes flicker { 50% { opacity: .45; } }
.demo.peeled .protector, .rival .phone-fold .protector { transform: rotate(-9deg) translate(-14px, 8px); }
.rival .phone-fold { --crease: .6; }
.crunch { position: absolute; top: 18%; right: 8%; color: var(--duo); font-size: 26px; opacity: 0; pointer-events: none; }
.demo.crunching .crunch { animation: stamp .9s ease-out both; }
@keyframes stamp { 0% { opacity: 0; transform: rotate(-8deg) scale(1.25); } 15% { opacity: 1; transform: rotate(-8deg) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.device-status { min-height: 1.5em; margin: 6px 0; font: 900 20px/1.1 var(--display); font-stretch: 80%; text-transform: uppercase; }
.demo-fold .device-status { color: var(--fold); }
.demo-duo .device-status { color: var(--duo); }
.count { font: 400 14px/1.4 var(--data); color: var(--ink-2); margin: 10px 0; }
.count strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.issue { border-top: var(--rule); border-bottom: 1px solid var(--ink); padding: 10px 0; margin-top: 12px; }
.issue p { margin: 0 0 6px; }
.issue-label { font: 600 14px/1 var(--data); text-transform: uppercase; }
.demo-fold .issue-label { color: var(--fold); }
.demo-duo .issue-label { color: var(--duo); }
.source { font: 600 14px/1.4 var(--data); }

/* Dust test */
.dust-pick { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.dust-stage {
  position: relative; height: 200px; max-width: 560px; margin-top: 12px; background: var(--paper-2);
  border: var(--rule); cursor: crosshair; overflow: hidden; touch-action: pan-y;
}
.dust-stage[hidden] { display: none; }
.dust-stage .hinge { position: absolute; left: 50%; top: 14px; bottom: 44px; width: 40px; transform: translateX(-50%); background: repeating-linear-gradient(0deg, var(--ink) 0 6px, #3a3833 6px 12px); }
.dust-fold .hinge { outline: 3px solid var(--fold); outline-offset: 3px; }
.dust-duo .hinge { outline: 3px solid var(--duo); outline-offset: 3px; }
.dust-stage.jammed .hinge { animation: grind .12s linear 6; }
@keyframes grind { 50% { transform: translateX(calc(-50% + 3px)); } }
.grain { position: absolute; width: 6px; height: 6px; background: #8a7a55; pointer-events: none; }
.dust-meter { position: absolute; bottom: 10px; left: 12px; margin: 0; font: 400 14px/1 var(--data); color: var(--ink-2); }
.dust-result { font: 900 22px/1.1 var(--display); font-stretch: 80%; text-transform: uppercase; margin-top: 12px; }
.dust-result a { font: 600 14px var(--data); text-transform: none; }

/* Rich list */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 12px; border: var(--rule); text-decoration: none; font: 900 16px/1 var(--display); font-stretch: 85%; text-transform: uppercase; }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.tabs .mark { width: 18px; height: 18px; }
.board { list-style: none; padding: 0; margin: 0; max-width: 760px; }
.board li { display: flex; align-items: center; gap: 10px; min-height: 52px; border-bottom: 1px solid var(--ink); }
.board li.top { border-bottom: var(--rule); }
.board li.top .name { font-weight: 600; }
.rank { width: 3ch; flex: none; font: 600 16px/1 var(--data); font-variant-numeric: tabular-nums; }
.dot { width: 18px; height: 18px; flex: none; }
.dot-fold { color: var(--fold); } .dot-duo { color: var(--duo); } .dot-swiss { color: var(--ink-2); }
.name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 12px 0; }
.tier { font: 900 14px/1 var(--display); font-stretch: 75%; text-transform: uppercase; border: 2px solid var(--ink); padding: 3px 6px; white-space: nowrap; }
.amt { font: 600 16px/1 var(--data); font-variant-numeric: tabular-nums; }
.empty { font-style: italic; }
.then { margin: 48px 0 0; padding-top: 14px; border-top: 4px double var(--ink); font-style: italic; font-size: 20px; }

/* Brag page */
.brag { max-width: 760px; }
.brag-name { font-size: clamp(36px, 8vw, 72px); font-stretch: 70%; margin: 28px 0 0; overflow-wrap: anywhere; }
.amount { margin: 6px 0; font: 900 clamp(84px, 22vw, 200px)/0.8 var(--display); font-stretch: 50%; font-variant-numeric: tabular-nums; }
.brag-fold .amount { color: var(--fold); }
.brag-duo .amount { color: var(--duo); }
.brag-meta { font-size: 18px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.tag-fold { color: var(--fold); } .tag-duo { color: var(--duo); }
.crown { color: var(--ink); background: var(--hi); margin: 8px 0; }
blockquote { margin: 18px 0; font-size: 22px; font-style: italic; }
.rival { margin: 20px 0; }
.rival figcaption { font: 400 14px var(--data); color: var(--ink-2); }
.rival .phone { width: min(260px, 70%); margin-top: 8px; }
.nudge { background: var(--paper-2); padding: 10px 12px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0; }

.colophon { max-width: 1120px; margin: 0 auto; padding: 14px var(--gutter) 40px; border-top: var(--rule); font: 400 14px/1.5 var(--data); color: var(--ink-2); }
.colophon p { margin: 0; max-width: 80ch; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .chyron .track { flex-wrap: wrap; white-space: normal; }
  .chyron .copy { display: none; }
}
p, li, blockquote { text-wrap: pretty; }
.crown { padding: 7px 12px; }
