/* =============================================================================
   RealityScore — prototype design system
   Black/white contrast, colour reserved for verdicts, with the option of a
   full colour flood as a deliberate moment. Shared by every page (design v2).
   ========================================================================== */

:root {
  --paper: #ffffff;
  --ink: #0a0a0a;
  --ink-2: #55575c;
  --ink-3: #6e7076;   /* AA: 4.95:1 on paper (was #8b8d93, 3.32:1) */
  --rule: #e4e4e6;
  --rule-2: #f0f0f1;
  --flat: #f4f4f5;

  /* Verdicts — the only colour that means anything. */
  --feasible: #147a3d;
  --strained: #8a5a06;
  --debunked: #b3261e;

  --display: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sidebar: 232px;

  /* Motion: archetype CORPORATE — one curve, three durations, zero overshoot. */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t-quick: 160ms;
  --t-base: 280ms;
  --t-slow: 420ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0a0a0b; --ink: #f2f2f3; --ink-2: #a1a3a9; --ink-3: #8a8c93;   /* AA: 5.89:1 on dark paper (was #6e7076, 4.00:1) */
    --rule: #232427; --rule-2: #161719; --flat: #131416;
    --feasible: #4ac97a; --strained: #d9a441; --debunked: #e5645a;
  }
}

/* A section can invert entirely — the "colour flood" moment. Used sparingly. */
.flood {
  --paper: #0a0a0a; --ink: #ffffff; --ink-2: #a8a8ad; --ink-3: #8a8a91;
  --rule: #2a2a2d; --rule-2: #1a1a1d; --flat: #151517;
  background: var(--paper); color: var(--ink);
}
.flood-debunk { --paper: #b3261e; --ink: #ffffff; --ink-2: rgba(255,255,255,.88);
  --ink-3: rgba(255,255,255,.80); --rule: rgba(255,255,255,.28); --rule-2: rgba(255,255,255,.14);
  background: var(--paper); color: var(--ink); }
.flood-feasible { --paper: #0d5c2f; --ink: #ffffff; --ink-2: rgba(255,255,255,.88);
  --ink-3: rgba(255,255,255,.70); --rule: rgba(255,255,255,.28); --rule-2: rgba(255,255,255,.14);
  background: var(--paper); color: var(--ink); }

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
::selection { background: var(--ink); color: var(--paper); }

/* ---------------------------------------------------------------- SIDEBAR */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky; top: 0; align-self: start; height: 100vh;
  padding: 2.2rem 1.6rem; display: flex; flex-direction: column;
  border-right: 1px solid var(--rule);
}
.mark {
  font-family: var(--display); font-weight: 700; font-size: 1.02rem;
  letter-spacing: -0.03em; text-decoration: none; display: flex; align-items: center; gap: 0.45rem;
}
.mark i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--feasible);
  display: inline-block; transition: transform var(--t-base) var(--ease);
}
.mark:hover i { transform: scale(1.5); }
.mark-sub {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-3); margin: 0.5rem 0 0 1.15rem;
}

.side nav { margin-top: 2.6rem; display: flex; flex-direction: column; gap: 0.1rem; }
/* Rollover: the label steps aside for a tick, the way a measurement snaps. */
.side nav a {
  position: relative; text-decoration: none; color: var(--ink-2); font-size: 0.895rem;
  padding: 0.36rem 0 0.36rem 0; transition: color var(--t-quick) var(--ease), padding-left var(--t-base) var(--ease);
}
.side nav a::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 0; height: 1px;
  background: currentColor; transform: translateY(-50%);
  transition: width var(--t-base) var(--ease);
}
.side nav a:hover, .side nav a:focus-visible { color: var(--ink); padding-left: 1.05rem; outline: none; }
.side nav a:hover::before, .side nav a:focus-visible::before { width: 0.7rem; }
.side nav a[aria-current] { color: var(--ink); font-weight: 500; padding-left: 1.05rem; }
.side nav a[aria-current]::before { width: 0.7rem; background: var(--feasible); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.55rem; }
.side-foot a {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); text-decoration: none;
  transition: color var(--t-quick) var(--ease);
}
.side-foot a:hover { color: var(--ink); }

/* ------------------------------------------------------------------- MAIN */
.main { padding: 0 clamp(1.5rem, 5vw, 5.5rem); }
.section { padding: clamp(3.5rem, 9vh, 7rem) 0; border-bottom: 1px solid var(--rule); max-width: 1080px; }
.section:last-of-type { border-bottom: 0; }
/* The hero (first section on every page) flows into the page — no divider line
   under it, and no heavy bottom gap. Consistent across the whole site. */
.main > .section:first-child { border-bottom: 0; padding-bottom: 0; }
.section.wide { max-width: none; }
/* A flooded section breaks the main padding to go full-bleed. */
.bleed { margin: 0 calc(-1 * clamp(1.5rem, 5vw, 5.5rem)); padding-left: clamp(1.5rem, 5vw, 5.5rem); padding-right: clamp(1.5rem, 5vw, 5.5rem); }

.label {
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 1.6rem;
}
h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2.6rem, 6.4vw, 5.1rem);
  line-height: 0.97; letter-spacing: -0.045em; max-width: 17ch; text-wrap: balance;
}
h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }
.lede {
  margin-top: 1.6rem; max-width: 46ch; font-size: clamp(1rem, 1.35vw, 1.14rem);
  color: var(--ink-2); line-height: 1.55;
}

/* Link with a rule that draws on hover — used for every inline nav-out. */
.lnk {
  display: inline-block; font-family: var(--mono); font-size: 0.72rem;
  letter-spacing: 0.09em; text-transform: uppercase; text-decoration: none;
  position: relative; padding-bottom: 4px;
}
.lnk::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 1px;
  background: currentColor; transform: scaleX(1); transform-origin: right;
  transition: transform var(--t-base) var(--ease);
}
.lnk:hover::after { transform: scaleX(0); }
.lnk span { display: inline-block; transition: transform var(--t-base) var(--ease); }
.lnk:hover span { transform: translateX(4px); }

/* ----------------------------------------------------------------- BUTTON */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center;
  gap: 0.6rem; padding: 0.85rem 1.5rem; border: 1px solid var(--ink);
  background: transparent; color: var(--ink); cursor: pointer; text-decoration: none;
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase;
  transition: color var(--t-base) var(--ease);
}
/* Rollover: the fill sweeps up from the baseline. */
.btn::before {
  content: ""; position: absolute; inset: 0; background: var(--ink);
  transform: translateY(101%); transition: transform var(--t-base) var(--ease); z-index: 0;
}
.btn > * { position: relative; z-index: 1; }
.btn:hover { color: var(--paper); }
.btn:hover::before { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ================================================================== ICONS
   Our own mark language: MEASUREMENT, not node-graphs.
   Every icon is built from three parts —
     · a baseline with tick marks   (the scale we measure against)
     · a plotted value              (what the claim asserts)
     · a delta                      (the gap between claim and reality)
   Filled = stated and verified. Hollow = the claim never said it.
   ======================================================================= */
.ico { display: block; color: currentColor; overflow: visible; }
.ico .ax { stroke: currentColor; stroke-width: 1; fill: none; }            /* baseline */
.ico .tk { stroke: currentColor; stroke-width: 1; opacity: .45; }           /* ticks */
.ico .pl { stroke: currentColor; stroke-width: 1.5; fill: none; }           /* plotted */
.ico .dl { stroke: currentColor; stroke-width: 1; stroke-dasharray: 2 2.5; fill: none; } /* delta */
.ico .nd { fill: currentColor; }                                            /* stated */
.ico .nh { fill: var(--paper); stroke: currentColor; stroke-width: 1; }      /* unstated */

/* Icons animate on hover of their owning block. */
.ico .pl { stroke-dasharray: var(--plen, 120); stroke-dashoffset: 0; transition: stroke-dashoffset var(--t-slow) var(--ease); }
.ico-host:hover .ico .pl { stroke-dashoffset: var(--plen, 120); }
.ico-host:hover .ico .nd { transform: scale(1.35); transform-origin: center; transition: transform var(--t-base) var(--ease); }
.ico .nd { transition: transform var(--t-base) var(--ease); }

/* ------------------------------------------------------------ INDEX TABLE */
.idx { width: 100%; border-collapse: collapse; }
.idx th {
  text-align: left; font-family: var(--mono); font-weight: 400;
  font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 1rem 0.7rem 0; border-bottom: 1px solid var(--ink);
}
.idx td { padding: 1.05rem 1rem; border-bottom: 1px solid var(--rule-2); vertical-align: baseline; }
.idx td:first-child { padding-left: 0.6rem; }
.idx tr:last-child td { border-bottom: 0; }
.idx .n { font-family: var(--mono); font-size: 1.24rem; font-variant-numeric: tabular-nums; width: 1%; white-space: nowrap; }
.idx .v { font-family: var(--mono); font-size: 0.63rem; letter-spacing: 0.12em; text-transform: uppercase; width: 1%; white-space: nowrap; }
.idx .who { font-size: 0.85rem; color: var(--ink-2); width: 1%; white-space: nowrap; }

/* Source cell: platform mark + handle + a link out to the original post.
   Brand marks are drawn in currentColor — colour stays reserved for verdicts. */
.src { display: inline-flex; align-items: center; gap: 0.5rem; }
.src-ico { width: 13px; height: 13px; flex: none; color: var(--ink-3); transition: color var(--t-base) var(--ease); }
.src-ico svg { width: 100%; height: 100%; display: block; fill: currentColor; }
.idx tbody tr:hover .src-ico { color: var(--ink); }
/* The external link is its own target — it must not open the teardown. */
.src-out {
  display: inline-flex; align-items: center; margin-left: 0.15rem;
  font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3);
  text-decoration: none; opacity: 0; transform: translate(-3px, 2px);
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease), color var(--t-quick) var(--ease);
}
.idx tbody tr:hover .src-out { opacity: 1; transform: none; }
.src-out:hover { color: var(--ink); }
.src-out:focus-visible { opacity: 1; transform: none; outline: 2px solid var(--ink); outline-offset: 2px; }
.idx .claim { font-size: 0.925rem; line-height: 1.5; }
/* Rollover: the row lifts its number, floods faintly, and pushes an arrow out. */
.idx tbody tr { transition: background var(--t-base) var(--ease); cursor: pointer; }
.idx tbody tr:hover { background: var(--flat); }
.idx tbody tr .n { display: inline-block; transition: transform var(--t-base) var(--ease); }
.idx tbody tr:hover .n { transform: scale(1.12); }
.idx tbody tr .go {
  display: inline-block; opacity: 0; transform: translateX(-6px);
  font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3);
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.idx tbody tr:hover .go { opacity: 1; transform: none; }
.is-feasible { color: var(--feasible); }
.is-strained { color: var(--strained); }
.is-debunked { color: var(--debunked); }

/* ===================================================================== PILL
   The one status pill for the whole site — verdicts, tags, plan/account badges.
   Colour comes only from a verdict tone (.is-feasible/.is-strained/.is-debunked)
   or stays neutral (.is-muted); nothing else spends colour. Replaces the old
   .verdict-chip / .tag / .plan-chip / .badge, which were six near-duplicates. */
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.22rem 0.6rem; border: 1px solid currentColor;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em;
  text-transform: uppercase; white-space: nowrap; line-height: 1.4;
}
.pill .pn { font-size: 0.86rem; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.pill.is-muted { color: var(--ink-3); border-color: var(--rule); }

/* ------------------------------------------------------------------ MOTION */
/* Fail-open. These used to be opacity:0 by default, so anything that stopped
   the entrance from running left the content invisible: no JS, a hidden tab
   where IntersectionObserver never fires, a script error. The page's own
   findings would simply not be there. Now content is visible unless the inline
   head script has confirmed — before paint, so there is no flash — that motion
   can actually run. Hiding is the exception and it is opt-in. */
.reveal { opacity: 1; }
:root[data-motion] .reveal { opacity: 0; }
:root[data-motion] .reveal.in { opacity: 1; }
body.motion-on .reveal { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
  .ico .pl { stroke-dashoffset: 0 !important; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------------------------ FOOTER */
footer { padding: 2.4rem 0 4rem; font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3); letter-spacing: 0.05em; }
footer a { text-decoration: none; transition: color var(--t-quick) var(--ease); }
footer a:hover { color: var(--ink); }

.foot-sub { display: flex; align-items: stretch; border-bottom: 1px solid var(--ink); max-width: 420px; margin-top: 1.1rem; }
.foot-sub input {
  flex: 1; min-width: 0; padding: 0.65rem 0; font: inherit; font-size: 0.92rem;
  background: transparent; color: var(--ink); border: 0;
}
.foot-sub input::placeholder { color: var(--ink-3); }
.foot-sub input:focus-visible { outline: none; }
.foot-sub button {
  background: none; border: 0; cursor: pointer; padding: 0.65rem 0 0.65rem 1rem;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink); white-space: nowrap;
  transition: color var(--t-quick) var(--ease);
}
.foot-sub button:hover { color: var(--feasible); }

/* The newsletter handler in js/app.js replaces a submitted form with
   <p class="confirm mono">. Without these it renders as unstyled body text on
   every v2 page — the signup silently looks like it did nothing. */
.confirm { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.04em; color: var(--feasible); }
.mono { font-family: var(--mono); }

/* ------------------------------------------------------------------ MODAL */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 1.5rem; z-index: 90;
}
.modal-scrim.open { display: flex; }
.modal {
  background: var(--paper); border: 1px solid var(--ink); max-width: 430px; width: 100%;
  padding: clamp(1.6rem, 4vw, 2.3rem); position: relative;
  animation: modal-in var(--t-slow) var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px); } }
.modal h2 { font-size: 1.45rem; max-width: 18ch; }
.modal p { color: var(--ink-2); font-size: .92rem; margin-top: .7rem; }
.modal .close {
  position: absolute; top: .6rem; right: .8rem; background: none; border: 0; cursor: pointer;
  font-family: var(--mono); font-size: 1rem; color: var(--ink-3); line-height: 1; padding: .35rem;
  transition: color var(--t-quick) var(--ease);
}
.modal .close:hover { color: var(--ink); }

/* ---------------------------------------------------------------- READING
   Long-form pages — teardowns and legal — put the sidebar across the top instead
   of down the side. A 232px rail is 18% of a 1280px viewport spent on navigation
   nobody uses mid-document, and these are the two page types people actually
   read rather than scan. Reuses the mobile treatment rather than inventing a
   second one; the links stay in the same place in the DOM, so this costs nothing
   in markup or crawlability.
   -------------------------------------------------------------------------- */
body[data-reading] .shell { grid-template-columns: 1fr; }
body[data-reading] .side {
  position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule);
  padding: 1.2rem clamp(1.5rem, 5vw, 5.5rem);
  flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 0 1.6rem;
}
body[data-reading] .side nav { margin-top: 0; flex-direction: row; flex-wrap: wrap; gap: 0.3rem 1.15rem; }
body[data-reading] .side nav a { padding: 0; }
body[data-reading] .side nav a::before { display: none; }
body[data-reading] .side nav a[aria-current] { padding-left: 0; text-decoration: underline; text-underline-offset: 5px; }
body[data-reading] .mark-sub { display: none; }
body[data-reading] .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; gap: 1rem; }
body[data-reading] .theme-tog { margin-top: 0; }
/* Reading measure: the main column no longer has a rail holding it in. */
body[data-reading] .section { max-width: 900px; }

/* ------------------------------------------------------------------ MOBILE */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule);
    padding: 1.2rem 1.5rem;
  }
  .side nav { margin-top: 1.2rem; flex-direction: row; flex-wrap: wrap; gap: 0.4rem 1.15rem; }
  .side nav a:hover, .side nav a[aria-current] { padding-left: 0; }
  .side nav a::before { display: none; }
  .mark-sub, .side-foot { display: none; }
}

/* ---------------------------------------------------------------------------
   Explicit theme. The media query above follows the OS; these two rules follow
   the reader, and must win in both directions — a reader on a dark OS who picks
   light gets light. Set by js/shell.js on <html data-theme>.
   --------------------------------------------------------------------------- */
:root[data-theme="dark"] {
  --paper: #0a0a0b; --ink: #f2f2f3; --ink-2: #a1a3a9; --ink-3: #8a8c93;   /* AA: 5.89:1 on dark paper (was #6e7076, 4.00:1) */
    --rule: #232427; --rule-2: #161719; --flat: #131416;
    --feasible: #4ac97a; --strained: #d9a441; --debunked: #e5645a;
}
:root[data-theme="light"] {
  --paper: #ffffff;
  --ink: #0a0a0a;
  --ink-2: #55575c;
  --ink-3: #6e7076;   /* AA: 4.95:1 on paper (was #8b8d93, 3.32:1) */
  --rule: #e4e4e6;
  --rule-2: #f0f0f1;
  --flat: #f4f4f5;

  /* Verdicts — the only colour that means anything. */
  --feasible: #147a3d;
  --strained: #8a5a06;
  --debunked: #b3261e;

  --display: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sidebar: 232px;

  /* Motion: archetype CORPORATE — one curve, three durations, zero overshoot. */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t-quick: 160ms;
  --t-base: 280ms;
  --t-slow: 420ms;
}

/* Theme toggle in the sidebar foot */
.theme-tog { display: flex; gap: 0.35rem; align-items: center; margin-top: 0.9rem; }
.theme-tog button {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase;
  background: none; border: 1px solid var(--rule); color: var(--ink-3);
  padding: 0.3rem 0.5rem; cursor: pointer;
  transition: color var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.theme-tog button:hover { color: var(--ink); }
.theme-tog button[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); }
