/* =========================================================
   ERGO — THE BRUTAL EDITION
   Swiss-brutalist editorial broadsheet. Loud, gridded, legible.
   ========================================================= */

/* ---------- THEME TOKENS ---------- */
:root {
  --ink:        #0a0a0a;   /* primary text + blocks */
  --paper:      #f4f1ea;   /* page background (warm newsprint) */
  --paper-2:    #ffffff;   /* card surface */
  --line:       #0a0a0a;   /* rules */
  --muted:      #5a5650;   /* secondary text */
  --neon:       #00e676;   /* the bulb-glow accent */
  --neon-ink:   #064d2b;   /* readable neon-on-paper text */
  --hot:        #ff3b1f;   /* loud secondary accent */
  --shadow:     #0a0a0a;   /* hard offset shadow */
  --chip-bg:    #ffffff;
  --field-bg:   #ffffff;
  --inv-bg:     #0a0a0a;   /* inverted block bg */
  --inv-ink:    #f4f1ea;   /* inverted block text */
  --focus:      #ff3b1f;
  --sel:        #00e676;
}
:root[data-theme="dark"] {
  --ink:        #f4f1ea;
  --paper:      #050505;
  --paper-2:    #0e0e0e;
  --line:       #f4f1ea;
  --muted:      #9a958c;
  --neon:       #00ff88;
  --neon-ink:   #00ff88;
  --hot:        #ff5a3c;
  --shadow:     #00ff88;
  --chip-bg:    #0e0e0e;
  --field-bg:   #0e0e0e;
  --inv-bg:     #f4f1ea;
  --inv-ink:    #050505;
  --focus:      #00ff88;
  --sel:        #00ff88;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 600;
  line-height: 1.4;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
::selection { background: var(--sel); color: #050505; }

.mono, .dateline, .kicker, .num, .chip__id, .chip__tag, .answer__speed,
.answer__model, .answer__cost, .costpill__label, .costpill__tok,
.receipt, .tool__no, .tool__sub, .fig, .persona__no, .persona__model,
.foot__copy, .foot__cols, .section-head__note small {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

img { display: block; max-width: 100%; }

a { color: inherit; }

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; z-index: 100; font-family: ui-monospace, monospace;
}
.skip:focus { left: 8px; top: 8px; }

/* ---------- RULES ---------- */
.rule { width: 100%; background: var(--line); }
.rule--thick { height: 8px; }

/* ---------- TICKER ---------- */
.ticker {
  background: var(--ink);
  color: var(--paper);
  border-bottom: 4px solid var(--line);
  overflow: hidden;
  white-space: nowrap;
}
.ticker__track {
  display: inline-flex;
  font-family: ui-monospace, monospace;
  font-weight: 700;
  font-size: clamp(11px, 2.4vw, 14px);
  letter-spacing: .12em;
  padding: 8px 0;
  animation: marquee 28s linear infinite;
}
.ticker__track span { padding-right: 0; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- LAYOUT WRAP ---------- */
.masthead, main, .foot__grid {
  max-width: 1280px; margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 56px);
}
.masthead { padding-top: clamp(16px, 3vw, 28px); }

/* ---------- MASTHEAD ---------- */
.masthead__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: clamp(12px, 2vw, 20px);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand__icon {
  width: clamp(48px, 8vw, 72px); height: auto;
  border: 4px solid var(--line);
  border-radius: 0;
  box-shadow: 6px 6px 0 var(--shadow);
}
.brand__word {
  font-size: clamp(34px, 8vw, 64px);
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: .8;
}
.masthead__meta { flex: 1 1 auto; text-align: center; min-width: 180px; }
.dateline {
  font-size: clamp(10px, 1.6vw, 13px);
  letter-spacing: .14em; font-weight: 700; color: var(--muted);
}

/* Theme switch — big hard-edged labeled toggle */
.themeswitch {
  position: relative;
  display: inline-flex; align-items: center; gap: 0;
  background: var(--chip-bg);
  border: 4px solid var(--line);
  box-shadow: 5px 5px 0 var(--shadow);
  padding: 0; cursor: pointer;
  font-family: ui-monospace, monospace; font-weight: 800;
  font-size: 12px; letter-spacing: .1em;
  color: var(--ink);
  overflow: hidden;
}
.themeswitch__face { padding: 9px 12px; transition: opacity .2s; }
.themeswitch__face--light { background: transparent; }
.themeswitch__face--dark  { background: transparent; }
.themeswitch__knob {
  width: 18px; align-self: stretch;
  background: var(--ink);
}
:root:not([data-theme="dark"]) .themeswitch__face--light { background: var(--ink); color: var(--paper); }
:root[data-theme="dark"] .themeswitch__face--dark { background: var(--ink); color: var(--paper); }
.themeswitch:hover { transform: translate(1px,1px); box-shadow: 4px 4px 0 var(--shadow); }

.masthead__sub {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px;
  font-family: ui-monospace, monospace; font-weight: 700;
  font-size: clamp(10px, 1.7vw, 13px); letter-spacing: .1em;
  color: var(--muted);
  padding: 10px 0;
}

/* ---------- SECTION HEAD ---------- */
.section-head { padding: clamp(28px,5vw,56px) 0 clamp(16px,3vw,28px); }
.section-head__title {
  font-size: clamp(44px, 13vw, 132px);
  font-weight: 900; letter-spacing: -.05em; line-height: .82;
  margin: 0 0 .25em; text-transform: uppercase;
}
.section-head__note {
  max-width: 52ch; margin: 0;
  font-size: clamp(15px, 2.4vw, 20px); font-weight: 600; color: var(--muted);
}
.section-head__note strong { color: var(--ink); font-weight: 800; }

/* ---------- MANIFESTO HERO ---------- */
.manifesto { padding: clamp(24px,5vw,64px) 0; }
.kicker {
  font-size: clamp(11px, 2vw, 15px); font-weight: 800; letter-spacing: .2em;
  margin: 0 0 .4em; color: var(--hot); text-transform: uppercase;
}
.bigtype {
  font-size: clamp(72px, 24vw, 280px);
  font-weight: 900; letter-spacing: -.055em; line-height: .82;
  margin: 0 0 clamp(20px,4vw,44px); text-transform: uppercase;
  word-break: break-word; hyphens: none;
}
.bigtype__neon {
  color: var(--neon-ink);
  text-shadow: 0 0 1px var(--neon);
  -webkit-text-stroke: 2px var(--ink);
}
:root[data-theme="dark"] .bigtype__neon {
  color: var(--neon);
  -webkit-text-stroke: 0;
  text-shadow: 0 0 24px rgba(0,255,136,.55);
}
.manifesto__grid {
  display: grid; grid-template-columns: 1fr; gap: clamp(20px,4vw,44px);
}
@media (min-width: 820px) {
  .manifesto__grid { grid-template-columns: 1.3fr 1fr; align-items: start; }
}
.lede { font-size: clamp(17px, 2.8vw, 26px); font-weight: 600; margin: 0; line-height: 1.45; }
.lede strong { font-weight: 900; background: var(--neon); color: #050505; padding: 0 .15em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
:root[data-theme="dark"] .lede strong { background: var(--neon); color: #050505; }
.manifesto__claims { list-style: none; margin: 0; padding: 0; border-top: 4px solid var(--line); }
.manifesto__claims li {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: baseline;
  padding: 14px 0; border-bottom: 2px solid var(--line);
  font-size: clamp(14px, 2.2vw, 18px); font-weight: 800; letter-spacing: .01em;
}
.num { font-weight: 800; color: var(--hot); font-size: .85em; }

/* ---------- FLIP THE MODEL ---------- */
.flip__deck {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: clamp(24px,4vw,40px);
}
@media (min-width: 640px){ .flip__deck { grid-template-columns: repeat(3,1fr); } }
@media (min-width: 1024px){ .flip__deck { grid-template-columns: repeat(6,1fr); } }

.chip {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  background: var(--chip-bg); color: var(--ink);
  border: 4px solid var(--line); box-shadow: 6px 6px 0 var(--shadow);
  padding: 14px 12px; cursor: pointer; text-align: left;
  transition: transform .1s, box-shadow .1s, background .15s;
  min-height: 92px; justify-content: space-between;
}
.chip:hover { transform: translate(2px,2px); box-shadow: 4px 4px 0 var(--shadow); }
.chip[aria-checked="true"] {
  background: var(--ink); color: var(--paper);
  box-shadow: 6px 6px 0 var(--neon);
}
.chip__id { font-family: ui-monospace, monospace; font-size: 10px; font-weight: 700; letter-spacing: .12em; opacity: .8; }
.chip__name { font-size: clamp(14px,2.4vw,17px); font-weight: 900; letter-spacing: -.02em; line-height: 1; }
.chip__tag {
  font-family: ui-monospace, monospace; font-size: 11px; font-weight: 800;
  border: 2px solid currentColor; padding: 1px 6px; align-self: flex-start;
}
.chip__tag--free { background: var(--neon); color: #050505; border-color: #050505; }
.chip[aria-checked="true"] .chip__tag--free { border-color: #050505; }

/* answer stage */
.flip__stage {
  display: grid; grid-template-columns: 1fr; gap: clamp(16px,3vw,24px);
}
@media (min-width: 900px){ .flip__stage { grid-template-columns: 1.6fr 1fr; align-items: stretch; } }

.answer {
  background: var(--paper-2); border: 4px solid var(--line);
  box-shadow: 8px 8px 0 var(--shadow); padding: 0; display: flex; flex-direction: column;
  transition: transform .25s ease;
}
.answer.flip-anim { animation: cardflip .4s ease; }
@keyframes cardflip {
  0% { transform: perspective(900px) rotateX(0); }
  50% { transform: perspective(900px) rotateX(-8deg); opacity: .55; }
  100% { transform: perspective(900px) rotateX(0); }
}
.answer__head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 3px solid var(--line); background: var(--ink); color: var(--paper);
}
.answer__q { font-family: ui-monospace, monospace; font-weight: 700; font-size: 13px; }
.answer__speed { font-family: ui-monospace, monospace; font-weight: 800; font-size: 11px; letter-spacing: .1em; border: 2px solid var(--paper); padding: 2px 8px; }
.answer__body { padding: clamp(16px,3vw,24px); font-size: clamp(15px,2.3vw,18px); font-weight: 600; line-height: 1.5; min-height: 130px; }
.answer__body p { margin: 0 0 .8em; }
.answer__body p:last-child { margin: 0; }
.answer__foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-top: 3px solid var(--line);
  font-family: ui-monospace, monospace; font-weight: 800;
}
.answer__model { font-size: 13px; }
.answer__cost { font-size: clamp(16px,3vw,22px); background: var(--neon); color:#050505; padding: 2px 10px; }

.costpill {
  display: flex; flex-direction: column; gap: 8px; justify-content: center;
  background: var(--inv-bg); color: var(--inv-ink);
  border: 4px solid var(--line); box-shadow: 8px 8px 0 var(--shadow);
  padding: clamp(18px,3vw,28px);
}
.costpill__label { font-family: ui-monospace,monospace; font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.costpill__big { font-family: ui-monospace,monospace; font-size: clamp(40px,9vw,72px); font-weight: 800; letter-spacing: -.03em; line-height: .9; }
.costpill__tok { font-family: ui-monospace,monospace; font-size: clamp(14px,2.5vw,18px); font-weight: 700; }
.costpill__note { font-family: ui-monospace,monospace; font-size: 12px; font-weight: 600; opacity: .8; margin: 4px 0 0; }

/* ---------- RECEIPT ---------- */
.receipt {
  max-width: 460px; margin-inline: auto; position: relative;
  filter: drop-shadow(8px 8px 0 var(--shadow));
}
.receipt__perf {
  height: 14px; background:
    radial-gradient(circle at 7px 14px, transparent 6px, var(--paper-2) 7px) repeat-x;
  background-size: 14px 14px;
  border-left: 4px solid var(--line); border-right: 4px solid var(--line);
}
.receipt__inner {
  background: var(--paper-2); color: var(--ink);
  border: 4px solid var(--line); border-top: 0;
  padding: clamp(18px,3vw,26px);
  font-family: ui-monospace, monospace; font-weight: 600;
  font-size: clamp(12px,2.4vw,14px); line-height: 1.6;
}
.receipt__top { text-align: center; }
.receipt__store { display: block; font-weight: 800; letter-spacing: .08em; font-size: 1.05em; }
.receipt__addr { display: block; font-size: .82em; color: var(--muted); margin-top: 2px; }
.receipt__hr { border-top: 2px dashed var(--line); margin: 12px 0; }
.receipt__hr--dot { border-top-style: dotted; }
.receipt__cols, .receipt__total {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; font-weight: 800;
}
.receipt__cols span:nth-child(2), .receipt__cols span:nth-child(3),
.receipt__total span:nth-child(2), .receipt__total span:nth-child(3) { text-align: right; }
.receipt__lines { list-style: none; margin: 0; padding: 0; }
.receipt__lines li {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px;
  padding: 3px 0;
}
.receipt__lines li span:nth-child(2), .receipt__lines li span:nth-child(3) { text-align: right; }
.receipt__lines .tool-line { color: var(--neon-ink); }
:root[data-theme="dark"] .receipt__lines .tool-line { color: var(--neon); }
.receipt__total { font-size: 1.15em; font-weight: 900; }
.receipt__total span:nth-child(3) { background: var(--neon); color:#050505; padding: 0 6px; }
.receipt__stamp {
  text-align: center; font-weight: 900; letter-spacing: .1em; margin: 12px 0 6px;
  border: 3px solid var(--hot); color: var(--hot); padding: 8px; transform: rotate(-2deg);
  display: inline-block; position: relative; left: 50%; translate: -50% 0;
}
.receipt__barcode { text-align: center; letter-spacing: -1px; font-size: 18px; margin: 8px 0 0; }

/* ---------- TOOL INDEX (readability fix) ---------- */
.toolgrid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2,1fr); gap: 0;
  border-top: 4px solid var(--line); border-left: 4px solid var(--line);
}
@media (min-width: 560px){ .toolgrid { grid-template-columns: repeat(3,1fr); } }
@media (min-width: 900px){ .toolgrid { grid-template-columns: repeat(6,1fr); } }
.tool {
  border-right: 4px solid var(--line); border-bottom: 4px solid var(--line);
  padding: 14px 12px 16px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--paper);
  transition: background .12s, color .12s;
}
.tool__no { font-size: 11px; font-weight: 800; color: var(--hot); letter-spacing: .1em; }
.tool__glyph {
  font-size: clamp(30px,6vw,40px); line-height: 1; font-weight: 700;
  /* HIGH CONTRAST: solid ink glyph on paper; inverts on hover */
  color: var(--ink);
}
.tool__name { font-size: clamp(12px,2.2vw,15px); font-weight: 900; letter-spacing: -.01em; line-height: 1.05; }
.tool__sub { font-size: 11px; font-weight: 600; color: var(--muted); }
.tool:hover, .tool:focus-within { background: var(--ink); }
.tool:hover .tool__glyph, .tool:hover .tool__name { color: var(--paper); }
.tool:hover .tool__sub { color: var(--neon); }
.tool:hover .tool__no { color: var(--neon); }
:root[data-theme="dark"] .tool:hover { background: var(--neon); }
:root[data-theme="dark"] .tool:hover .tool__glyph,
:root[data-theme="dark"] .tool:hover .tool__name { color: #050505; }
:root[data-theme="dark"] .tool:hover .tool__sub,
:root[data-theme="dark"] .tool:hover .tool__no { color: #050505; }

/* ---------- PLATES ---------- */
.plates {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: clamp(16px,3vw,28px);
}
.plates .section-head { grid-column: 1 / -1; }
@media (min-width: 720px){ .plates { grid-template-columns: repeat(4,1fr); } }
.plate {
  margin: 0; background: var(--paper-2);
  border: 4px solid var(--line); box-shadow: 8px 8px 0 var(--shadow);
}
.plate--wide { grid-column: span 2; }
@media (min-width: 720px){ .plate--wide { grid-column: span 2; } }
.plate img { width: 100%; height: auto; border-bottom: 4px solid var(--line); filter: grayscale(.15) contrast(1.04); }
.plate figcaption {
  font-family: ui-monospace, monospace; font-weight: 700; font-size: 11px;
  letter-spacing: .06em; padding: 10px 12px; display: flex; gap: 8px; align-items: baseline;
}
.fig { color: var(--hot); font-weight: 800; }

/* ---------- PERSONAS ---------- */
.personalist {
  display: grid; grid-template-columns: 1fr; gap: 0;
  border: 4px solid var(--line); box-shadow: 8px 8px 0 var(--shadow);
}
@media (min-width: 760px){ .personalist { grid-template-columns: repeat(3,1fr); } }
.persona {
  padding: clamp(20px,4vw,36px);
  border-bottom: 4px solid var(--line);
  background: var(--paper-2);
}
@media (min-width: 760px){
  .persona { border-bottom: 0; border-right: 4px solid var(--line); }
  .persona:last-child { border-right: 0; }
}
.persona:last-child { border-bottom: 0; }
.persona__no { font-family: ui-monospace,monospace; font-size: 12px; font-weight: 800; color: var(--hot); letter-spacing: .12em; }
.persona__name { font-size: clamp(26px,5vw,42px); font-weight: 900; letter-spacing: -.03em; margin: .15em 0 .35em; line-height: .9; }
.persona__tools { font-family: ui-monospace,monospace; font-size: 12px; font-weight: 700; margin: 0 0 8px; line-height: 1.5; }
.persona__model { font-family: ui-monospace,monospace; font-size: 13px; font-weight: 800; background: var(--neon); color:#050505; display: inline-block; padding: 3px 8px; margin: 0; }

/* ---------- CTA ---------- */
.cta { padding: clamp(40px,7vw,90px) 0; text-align: left; }
.cta__head {
  font-size: clamp(72px, 22vw, 240px); font-weight: 900; letter-spacing: -.055em;
  line-height: .82; margin: 0 0 .3em; text-transform: uppercase;
}
.cta__line { font-size: clamp(16px,2.8vw,24px); font-weight: 700; max-width: 40ch; margin: 0 0 clamp(24px,4vw,40px); }
.cta__stores { display: flex; flex-wrap: wrap; gap: 16px; }
.store {
  display: inline-flex; align-items: center; gap: 12px; text-decoration: none;
  background: var(--ink); color: var(--paper);
  border: 4px solid var(--line); box-shadow: 7px 7px 0 var(--shadow);
  padding: 14px 24px; transition: transform .1s, box-shadow .1s;
}
.store:hover { transform: translate(2px,2px); box-shadow: 5px 5px 0 var(--shadow); }
:root[data-theme="dark"] .store { box-shadow: 7px 7px 0 var(--neon); }
.store svg { width: 30px; height: 30px; fill: currentColor; }
.store span { display: flex; flex-direction: column; line-height: 1; }
.store small { font-family: ui-monospace,monospace; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.store strong { font-size: 20px; font-weight: 900; letter-spacing: -.02em; }

/* ---------- FOOTER ---------- */
.foot { margin-top: clamp(24px,4vw,40px); }
.foot__grid {
  display: grid; grid-template-columns: 1fr; gap: 16px;
  padding-top: clamp(20px,4vw,36px); padding-bottom: clamp(28px,5vw,48px);
}
@media (min-width: 760px){ .foot__grid { grid-template-columns: auto 1fr auto; align-items: center; gap: 32px; } }
.foot__brand { display: flex; align-items: center; gap: 12px; font-size: 28px; font-weight: 900; letter-spacing: -.03em; }
.foot__icon { width: 40px; height: auto; border: 3px solid var(--line); box-shadow: 4px 4px 0 var(--shadow); }
.foot__copy { font-size: 11px; font-weight: 700; line-height: 1.7; letter-spacing: .04em; margin: 0; color: var(--muted); }
.foot__cols { font-size: 11px; font-weight: 700; letter-spacing: .06em; margin: 0; color: var(--muted); text-align: right; }
@media (max-width: 759px){ .foot__cols { text-align: left; } }

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; transform: none; }
  .answer.flip-anim { animation: none; }
  * { scroll-behavior: auto !important; }
}
