/* v4 pages rendered by the React SPA (home, /tr, prompts, search, 404, legal). Tokens and shared components
   come from /v4.css; template blocks are ported from redesign-v4/src/tpl.css. Everything is scoped to .v4. */

/* SPA base fixes: index.css sets `:root h1 { font: ... }` and index.html pins .adsbygoogle to position:relative. */
html.v4 h1{ font-family: var(--display); font-weight: 800; line-height: .95; letter-spacing: -0.02em; }
.v4 .ad-bay ins.adsbygoogle{ position: absolute !important; }
.v4 main{ display: block; }
.v4 ::selection{ background: var(--lime); color: var(--on-light); }
.v4 .acts{ display: flex; flex-wrap: wrap; gap: 8px; }
.v4 .mini{ height: 40px; padding: 0 14px; font-size: .85rem; width: max-content; }

/* hero */
.v4 .hero{ padding: 20px 0 clamp(32px, 5vw, 64px); border-bottom: 2px solid var(--ink); }
.v4 .hero-in{ display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(14px, 2.2vw, 26px); }
.v4 .hero h1{ font-family: var(--display); font-size: clamp(2.7rem, 1.5rem + 5.6vw, 7.4rem); font-weight: 900; font-stretch: 62%; line-height: .87; letter-spacing: -0.03em; text-transform: uppercase; max-width: 8em; }
.v4 .hero h1.long{ font-size: clamp(2.2rem, 1.5rem + 3vw, 4.4rem); line-height: .92; max-width: 13em; }
.v4 .hero h1 em{ font-style: normal; color: var(--red-ink); }
.v4 .hero .dek{ max-width: 23em; }
.v4 .hero .byline{ font: 600 .86rem var(--ui); display: flex; flex-wrap: wrap; gap: 4px 18px; } .v4 .hero .byline span{ font-weight: 500; }
.v4 .t-red{ background: var(--b-red); color: var(--on-light); }
.v4 .t-cobalt{ background: var(--b-cobalt); color: var(--on-dark); }
.v4 .hero[class*="t-"]{ border-bottom-color: var(--on-light); }
.v4 .hero[class*="t-"] :is(.crumbs, .kicker, h1 em){ color: inherit; }
.v4 .t-cobalt .btn{ background: var(--on-dark); color: var(--on-light); border-color: var(--on-dark); }
.v4 .t-red .btn{ background: var(--b-ink); color: var(--on-dark); border-color: var(--b-ink); }

/* facts: label and value pairs */
.v4 .facts{ margin: 36px 0 0; display: grid; border-top: 2px solid var(--ink); }
@media (min-width: 800px){ .v4 .facts{ grid-template-columns: 1fr 1fr; column-gap: 56px; } }
.v4 .facts > div{ display: grid; grid-template-columns: 9.5em 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.v4 .facts dt{ font: 700 .74rem/1.3 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.v4 .facts dd{ margin: 0; font: 600 1.02rem/1.4 var(--ui); min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px){ .v4 .facts > div{ grid-template-columns: 1fr; gap: 2px; } }

/* prompt cards */
.v4 .cards{ display: grid; margin-top: 32px; border-top: 2px solid var(--ink); }
@media (min-width: 700px){ .v4 .cards{ grid-template-columns: 1fr 1fr; column-gap: 48px; } }
@media (min-width: 1200px){ .v4 .cards{ grid-template-columns: 1fr 1fr 1fr; } }
.v4 .card{ padding: 20px 0 22px; border-bottom: 1px solid var(--rule); display: grid; gap: 8px; align-content: start; }
.v4 .card h3{ font-size: 1.5rem; line-height: 1.02; } .v4 .card h3 a{ text-decoration: none; } .v4 .card h3 a:hover{ color: var(--red-ink); }
.v4 .card p{ font: 400 .95rem/1.45 var(--ui); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.v4 .card .tag{ width: max-content; color: var(--ink-2); }

/* horizontal bars with a label and a value */
.v4 .hbars{ margin-top: 32px; display: grid; gap: 8px; max-width: 900px; }
.v4 .hbar{ display: grid; grid-template-columns: minmax(7em, 12em) 1fr 3.4em; gap: 12px; align-items: center; font: 600 .95rem var(--ui); }
.v4 .hbar i{ height: 22px; background: var(--ink); width: calc(var(--w) * 100%); min-width: 2px; }
.v4 .hbar b{ font-weight: 800; text-align: right; }
.v4 .hbar:first-child i{ background: var(--red); }

/* reading column with a contents rail (legal) */
.v4 .art{ display: grid; gap: 48px; padding: clamp(36px, 5vw, 72px) 0 var(--sec); }
@media (min-width: 1100px){ .v4 .art{ grid-template-columns: minmax(0, 33em) 260px; justify-content: space-between; } }
.v4 .art .prose{ font-size: 1.16rem; line-height: 1.62; min-width: 0; overflow-wrap: anywhere; }
.v4 .art .prose h2{ font-size: clamp(1.7rem, 1.4rem + 1vw, 2.3rem); scroll-margin-top: calc(var(--stick) + 16px); }
.v4 .art .prose a{ text-decoration: underline; }
.v4 .art .prose table{ width: 100%; border-collapse: collapse; font: 500 .92rem/1.4 var(--ui); }
.v4 .art .prose :is(th, td){ text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); }
.v4 .art .prose th{ font-weight: 800; border-bottom: 2px solid var(--ink); }
.v4 .art .table-scroll{ overflow-x: auto; }
.v4 .legal{ counter-reset: legal; }
.v4 .legal section{ scroll-margin-top: calc(var(--stick) + 16px); }
.v4 .legal section > * + *{ margin-top: 1em; }
.v4 .legal section h2::before{ counter-increment: legal; content: counter(legal) ". "; }
.v4 .toc-rail{ display: none; }
@media (min-width: 1100px){
  .v4 .toc-rail{ display: block; position: sticky; top: calc(var(--stick) + 24px); align-self: start; font: 600 .9rem/1.35 var(--ui); }
  .v4 .toc-rail ol{ list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; border-left: 2px solid var(--rule); }
  .v4 .toc-rail a{ display: block; padding: 6px 0 6px 14px; text-decoration: none; color: var(--ink-2); }
  .v4 .toc-rail a:hover{ color: var(--ink); }
}
.v4 .callout{ border-left: 4px solid var(--red); padding: 4px 0 4px 18px; max-width: var(--measure); }
.v4 .callout b{ font-family: var(--ui); }

/* search box and filter chips */
.v4 .sbox{ display: flex; align-items: center; gap: 10px; border-bottom: 3px solid var(--ink); max-width: 760px; margin-top: 20px; }
.v4 .sbox:focus-within{ border-color: var(--red); }
.v4 .sbox input{ flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: 800 clamp(1.6rem, 1.1rem + 2vw, 2.8rem)/1.4 var(--display); font-stretch: 75%; padding: 4px 0; }
.v4 .sbox input::placeholder{ color: var(--ink-3); opacity: .7; }
.v4 .sbox input:focus-visible{ outline: 0; box-shadow: none; }
.v4 .sbox svg{ flex: none; }
.v4 .chips{ display: flex; flex-wrap: wrap; gap: 2px 20px; margin-top: 18px; font: 700 .92rem var(--ui); }
.v4 .chips button{ background: none; border: 0; padding: 10px 0 6px; min-height: 44px; font: inherit; color: var(--ink-2); cursor: pointer; border-bottom: 3px solid transparent; }
.v4 .chips button[aria-pressed="true"]{ color: var(--ink); border-color: var(--red); }

/* 404 */
.v4 .big404{ font: 900 clamp(8rem, 34vw, 30rem)/.74 var(--display); font-stretch: 62%; letter-spacing: -0.04em; }
.v4 .hero h1.nf-h{ font-size: var(--t-h2); }
.v4 .hero code{ font: 500 .85em var(--mono); overflow-wrap: anywhere; }
.v4 .nf-rows{ margin-top: 28px; max-width: 860px; }
.v4 .nf-home{ margin-top: 32px; }

/* cookie choices: src/lib/siteAnalyticsControls.ts ships dark-template colours, restated in v4 tokens */
.v4 .privacy-settings{ color: var(--ink-2); border-color: var(--rule); font-family: var(--ui); }
.v4 .privacy-settings h2{ color: var(--ink); }
.v4 .privacy-settings button{ border: 2px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); font-weight: 700; }
.v4 .privacy-settings button[aria-pressed="true"]{ background: var(--ink); color: var(--paper); }

@supports (animation-timeline: view()){ @media (prefers-reduced-motion: no-preference){
  .v4 :is(.card, .facts > div){ animation: sd-rise linear both; animation-timeline: view(); animation-range: entry 0% contain 8%; }
  .v4 .hbar i{ transform-origin: left; animation: sd-grow linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
} }
.v4 .hero:has(.big404){ overflow: clip; }
.v4 .big404 span{ display: inline-block; margin-inline: .04em .14em; transform-origin: 50% 85%; animation: nf-tip 900ms var(--ease-out) 500ms both; }
@keyframes nf-tip{ 0%{ transform: none; } 45%{ transform: rotate(14deg); } 70%{ transform: rotate(7deg); } 100%{ transform: rotate(10deg); } }
@media (prefers-reduced-motion: reduce){ .v4 .big404 span{ transform: rotate(10deg); } }
