/* Site pages (PLAN.md §3, §9 WP6): the bits the landing shares with the content and legal pages, and the 404/410/error pages.
   Prefix: site-. Motion: transform, opacity and filter only (§3.6); reduced motion and Calm mode at the end of the file.
   The landing's own rules live in src/views/pages/site/landing/css/ (joined into /css/landing.css, loaded after this file).
   Colours: tokens.css's semantic ones, so these pages follow the light or dark scheme; the art (the ticket, the shield, the candle)
   keeps its own colours in both. */

/* ── Shared bits ───────────────────────────────────────────────────────────────────────────────────────────── */
.site-eyebrow {
  color: var(--accent-ink);
  font: 700 .8125rem/1.2 var(--font-ui);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.site-h2 {
  margin-top: var(--space-3);
  font-size: clamp(2.125rem, 1.25rem + 3.2vw, 4rem);
  font-weight: 800;
  font-stretch: 75%;
  line-height: .95;
  letter-spacing: -0.03em;
}
.site-head { max-width: 40rem; }
.site-head--row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4) var(--space-6);
  max-width: none;
}
.site-more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--accent-ink);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.site-more:hover { text-decoration: underline; }
.site-arrow { flex: none; transition: transform var(--dur-2) var(--ease-out); }
a:hover > .site-arrow { transform: translateX(3px); }
.site-round {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  transition: transform var(--dur-1) var(--ease-out);
}
.site-round:hover:not(:disabled) { border-color: var(--text-2); }
.site-round:active:not(:disabled) { transform: scale(.94); }
.site-round:disabled { opacity: .35; }

/* ── Shared with the landing: the pages below use these too, so they stay here ─────────────────────────────── */
@keyframes site-twinkle { from { opacity: .3; } to { opacity: .95; } }
/* CSS fireworks: the static decorative layer (§3.6) that also blooms gently when motion is allowed */
.site-burst {
  --c: var(--candle);
  position: absolute;
  width: var(--size, 190px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  transform: scale(.3);
  animation: site-bloom 6.6s var(--ease-out) infinite;
}
.site-burst::before, .site-burst::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.site-burst::before {
  background: repeating-conic-gradient(from 4deg, var(--c) 0 1.8deg, transparent 1.8deg 12deg);
  -webkit-mask: radial-gradient(circle, transparent 0 19%, #000 23% 41%, transparent 47%);
  mask: radial-gradient(circle, transparent 0 19%, #000 23% 41%, transparent 47%);
}
.site-burst::after {
  background: repeating-conic-gradient(from 4deg, #fff 0 2.4deg, transparent 2.4deg 12deg);
  -webkit-mask: radial-gradient(circle, transparent 0 46.5%, #000 47.5% 50%, transparent 50.5%);
  mask: radial-gradient(circle, transparent 0 46.5%, #000 47.5% 50%, transparent 50.5%);
  opacity: .9;
}
@keyframes site-bloom {
  0%, 6% { opacity: 0; transform: scale(.3); }
  12% { opacity: 1; }
  36% { opacity: .8; transform: scale(1); }
  58%, 100% { opacity: 0; transform: scale(1.12); }
}

/* The hero CTA and its sheen: one sweep every 6 s (§3.3; the only other use of the brand gradient). */
.site-cta {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--candle) 70%, transparent);
}
.site-cta > span { position: relative; z-index: 1; }
.site-cta::after {
  content: "";
  position: absolute;
  inset: -2px;
  background: linear-gradient(100deg, transparent 32%, rgb(255 255 255 / .7) 44%,
    color-mix(in srgb, #FF7A59 45%, transparent) 50%, color-mix(in srgb, #FF3D8B 30%, transparent) 54%, transparent 66%);
  transform: translateX(-110%);
  animation: site-sheen 6s var(--ease-io) 1.2s infinite;
  pointer-events: none;
}
@keyframes site-sheen {
  0%, 74% { transform: translateX(-110%); }
  92%, 100% { transform: translateX(110%); }
}
.site-cta-ghost { gap: var(--space-2); white-space: nowrap; }

/* the ticket: the landing's "free" art and the content pages' header art (.site-art-ticket--doc) */
.site-art-ticket { display: flex; transform: rotate(-4deg); filter: drop-shadow(0 10px 16px rgb(var(--shadow-rgb) / calc(.45 * var(--shadow-a)))); }
.site-art-ticket__main, .site-art-ticket__stub {
  display: grid;
  align-content: center;
  height: 74px;
  background: var(--candle);
  color: var(--night-900);
}
.site-art-ticket__main {
  gap: 4px;
  padding: 0 18px;
  border-radius: 10px 0 0 10px;
  -webkit-mask: radial-gradient(circle at 100% 0, transparent 7px, #000 7.5px) top / 100% 51% no-repeat,
    radial-gradient(circle at 100% 100%, transparent 7px, #000 7.5px) bottom / 100% 51% no-repeat;
  mask: radial-gradient(circle at 100% 0, transparent 7px, #000 7.5px) top / 100% 51% no-repeat,
    radial-gradient(circle at 100% 100%, transparent 7px, #000 7.5px) bottom / 100% 51% no-repeat;
}
.site-art-ticket__main small { font: 750 .625rem/1 var(--font-ui); letter-spacing: .2em; text-transform: uppercase; opacity: .75; }
.site-art-ticket__main b { font: 800 1.125rem/1 var(--font-display); font-stretch: 75%; }
.site-art-ticket__stub {
  padding: 0 16px;
  border-left: 2px dashed rgb(11 10 26 / .35);
  border-radius: 0 10px 10px 0;
  font: 800 1.5rem/1 var(--font-display);
  -webkit-mask: radial-gradient(circle at 0 0, transparent 7px, #000 7.5px) top / 100% 51% no-repeat,
    radial-gradient(circle at 0 100%, transparent 7px, #000 7.5px) bottom / 100% 51% no-repeat;
  mask: radial-gradient(circle at 0 0, transparent 7px, #000 7.5px) top / 100% 51% no-repeat,
    radial-gradient(circle at 0 100%, transparent 7px, #000 7.5px) bottom / 100% 51% no-repeat;
}

/* ── Content and legal pages ───────────────────────────────────────────────────────────────────────────────── */
/* A compact header (copy on the left, one piece of art on the right) so the first section of a legal page shows above
   the fold at 1280×720; the art differs per page: fireworks, a ticket, a shield, a candle. */
.site-doc__head {
  position: relative;
  overflow: clip;
  isolation: isolate;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(70% 140% at 92% -10%, color-mix(in srgb, var(--violet) 30%, transparent), transparent 62%),
    var(--bg-deep);
}
.site-doc__head-inner {
  display: grid;
  align-items: center;
  gap: var(--space-5) var(--space-7);
  padding-block: clamp(32px, 4.4vw, 56px) clamp(28px, 3.6vw, 44px);
}
.site-doc__head-copy { min-width: 0; }
.site-doc__title {
  max-width: 22ch;
  margin-top: var(--space-3);
  font-size: clamp(2.25rem, 1.3rem + 3.6vw, 4.25rem);
  font-weight: 800;
  font-stretch: 75%;
  line-height: .94;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.site-doc__lead { max-width: 52ch; margin-top: var(--space-3); color: var(--text-2); font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem); }
.site-doc__updated { margin-top: var(--space-2); color: var(--text-3); font-size: var(--step-small); }
.site-doc__draft { padding-bottom: clamp(20px, 2.6vw, 28px); }
.site-draft {
  padding: 10px var(--space-4);
  border: 1px dashed color-mix(in srgb, var(--candle) 65%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--candle) 9%, transparent);
  color: var(--text-2);
  font-size: .875rem;
  line-height: 1.5;
}
.site-draft__title { color: var(--accent-ink); }

/* header art: decorative, from 900 px up (phones keep the header short) */
.site-docart { display: none; position: relative; width: 240px; height: 190px; justify-self: end; }
@media (min-width: 900px) {
  .site-doc__head-inner { grid-template-columns: minmax(0, 1fr) auto; }
  .site-docart { display: grid; place-items: center; }
}
/* the header's fireworks draw in the ink versions of the brand colours: the colours themselves on night, deeper ones on light, where
   the candle and the volt would barely show */
.site-burst--d1, .site-burst--d2, .site-burst--d3 { --c: var(--accent-ink); --size: 150px; top: 20px; left: 45px; }
.site-burst--d2 { --c: var(--party-ink); --size: 96px; top: 0; left: 6px; animation-delay: 2.2s; }
.site-burst--d3 { --c: var(--volt-ink); --size: 84px; top: 96px; left: 150px; animation-delay: 4.1s; }
.site-art-ticket--doc { transform: rotate(-7deg) scale(1.28); }
.site-docart__shield { overflow: visible; filter: drop-shadow(0 0 26px color-mix(in srgb, var(--violet) 55%, transparent)); }
.site-docart__shield-body { fill: color-mix(in srgb, var(--violet) 22%, var(--night-900)); stroke: var(--candle); stroke-width: 3.5; stroke-linejoin: round; }
.site-docart__shield-check { fill: none; stroke: var(--lime); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.site-docart__spark { fill: var(--candle); animation: site-twinkle 3.4s ease-in-out infinite alternate; }
.site-docart__spark--2 { fill: var(--volt); animation-delay: -1.2s; }
.site-docart__spark--3 { fill: var(--party); animation-delay: -2.1s; }
.site-docart--candle .site-candle { --k: .8; margin-top: 0; }
.site-doc__body { display: grid; gap: var(--space-6); padding-block: clamp(28px, 3.6vw, 48px) var(--space-8); }
.site-doc__toc { display: none; }
.site-doc__toc-title { margin-bottom: var(--space-3); color: var(--text-3); font: 650 .75rem/1.2 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; }
.site-doc__toc ol { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.site-doc__toc a {
  display: block;
  padding: 6px 0 6px 12px;
  border-left: 2px solid var(--line);
  color: var(--text-3);
  font-size: .9375rem;
  line-height: 1.35;
  text-decoration: none;
}
.site-doc__toc a:hover { border-left-color: var(--accent); color: var(--text); }
.site-doc__prose { min-width: 0; }
.site-doc__prose > .site-doc__section + .site-doc__section { margin-top: 2.75rem; }
.site-doc__section > * + * { margin-top: .85em; }
.site-doc__section h2 {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: 0;
  font-size: clamp(1.25rem, 1.1rem + .5vw, 1.5rem);
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.site-doc__badge {
  flex: none;
  min-width: 2.6em;
  padding: .3em .55em;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--candle) 16%, transparent);
  color: var(--accent-ink);
  font: 750 .8125rem/1 var(--font-ui);
  letter-spacing: .04em;
  text-align: center;
}
.site-doc__prose a { color: var(--accent-ink); }
.site-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.site-table th, .site-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.site-table th { color: var(--text-3); font-weight: 650; }
.site-table td:first-child { color: var(--text); width: 44%; }
@media (min-width: 1024px) {
  .site-doc__body { grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-8); align-items: start; }
  .site-doc__toc { position: sticky; top: calc(var(--header-h) + 24px); display: block; }
}

/* ── 404 / 410 / error pages ───────────────────────────────────────────────────────────────────────────────── */
.site-error {
  position: relative;
  overflow: clip;
  padding-block: clamp(32px, 6vw, 72px) clamp(56px, 9vw, 112px);
  text-align: center;
  background:
    radial-gradient(45% 55% at 50% 22%, color-mix(in srgb, var(--candle) 11%, transparent), transparent 70%),
    radial-gradient(70% 60% at 50% 120%, color-mix(in srgb, var(--violet) 30%, transparent), transparent 70%),
    var(--bg-deep);
}
.site-error__inner { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.site-error__eyebrow { margin-top: var(--space-2); }
.site-error__title {
  max-width: 14ch;
  font-size: clamp(2.5rem, 1.3rem + 4.4vw, 5.25rem);
  font-weight: 800;
  font-stretch: 75%;
  line-height: .9;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.site-error--status .site-error__title { max-width: 18ch; font-size: clamp(2.25rem, 1.3rem + 3.6vw, 4.5rem); }
.site-error__lede { max-width: 46ch; color: var(--text-2); font-size: 1.125rem; }
.site-error__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin-top: var(--space-4); }
/* stacked on phones, both buttons share one width */
@media (max-width: 559px) {
  .site-error__actions { flex-direction: column; align-items: stretch; width: min(100%, 320px); }
}
/* Short viewports (a 1280×720 laptop with a dev banner and the header): a smaller candle and headline keep "Make one"
   above the fold. */
@media (max-height: 800px) {
  .site-error { padding-block: 20px 48px; }
  .site-error__title { max-width: 22ch; font-size: clamp(2.25rem, 1.2rem + 3.2vw, 4rem); }
  .site-error__lede { font-size: 1.0625rem; }
  .site-error__actions { margin-top: var(--space-3); }
}

/* The candle: out, a wisp of smoke, then it relights and flickers (transform and opacity only). */
/* --k scales the candle; the margin gives back (or reserves) the layout space a transform does not take. */
.site-candle {
  --k: 1;
  position: relative;
  width: 140px;
  height: 210px;
  margin-top: calc(24px + (var(--k) - 1) * 210px);
  transform: scale(var(--k));
  transform-origin: 50% 100%;
}
@media (min-height: 860px) { .site-candle { --k: 1.18; } }
@media (max-height: 800px) { .site-candle { --k: .8; } }
@media (max-height: 640px) { .site-candle { --k: .6; } }
.site-candle__saucer {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 120px;
  height: 20px;
  margin-left: -60px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #463E7E 0%, #2C2853 55%, #1F1C3D 100%);
  box-shadow: 0 10px 24px -8px rgb(var(--shadow-rgb) / calc(.7 * var(--shadow-a)));
}
.site-candle__body {
  position: absolute;
  bottom: 12px;
  left: 50%;
  width: 44px;
  height: 118px;
  margin-left: -22px;
  overflow: hidden;
  border-radius: 9px 9px 5px 5px;
  background:
    linear-gradient(90deg, rgb(255 255 255 / .38) 0%, transparent 35%, transparent 65%, rgb(11 10 26 / .25) 100%),
    repeating-linear-gradient(-38deg, #FFF6E6 0 13px, #FF5C9C 13px 20px);
}
.site-candle__drip {
  position: absolute;
  top: 0;
  left: 6px;
  width: 14px;
  height: 22px;
  border-radius: 0 0 8px 8px;
  background: #FFF6E6;
}
.site-candle__wick { position: absolute; bottom: 128px; left: 50%; width: 3px; height: 14px; margin-left: -1.5px; border-radius: 2px; background: #3A3164; }
.site-candle__flame {
  position: absolute;
  bottom: 137px;
  left: 50%;
  width: 26px;
  height: 44px;
  margin-left: -13px;
  border-radius: 50% 50% 50% 50% / 64% 64% 36% 36%;
  background: radial-gradient(ellipse 60% 55% at 50% 72%, #FFF8DE 0%, #FFE08A 30%, #FFC94D 52%, #FF7A59 78%, rgb(255 61 139 / 0) 100%);
  transform-origin: 50% 92%;
  animation: site-relight 2.4s var(--ease-out) both, site-flicker 2.8s ease-in-out 2.4s infinite;
}
.site-candle__core {
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 8px;
  height: 14px;
  margin-left: -4px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: rgb(123 92 255 / .55);
}
.site-candle__glow {
  position: absolute;
  bottom: 70px;
  left: 50%;
  width: 260px;
  height: 260px;
  margin-left: -130px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--candle) 38%, transparent), transparent);
  animation: site-glow 2.4s var(--ease-out) both;
}
.site-candle__smoke {
  position: absolute;
  bottom: 142px;
  left: 50%;
  width: 10px;
  height: 48px;
  margin-left: -5px;
  border-radius: 50%;
  background: linear-gradient(to top, color-mix(in srgb, var(--text-2) 60%, transparent), transparent);
  filter: blur(3px);
  opacity: 0;
  animation: site-smoke 1.8s ease-out .15s both;
}
@keyframes site-relight {
  0%, 46% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.22, 1.12); opacity: 1; }
  74% { transform: scale(.9, .95); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes site-flicker {
  0%, 100% { transform: scale(1) rotate(-1deg); }
  25% { transform: scale(.95, 1.05) rotate(1.6deg); }
  50% { transform: scale(1.04, .97) rotate(-.6deg); }
  75% { transform: scale(.97, 1.03) rotate(1deg); }
}
@keyframes site-glow { 0%, 50% { opacity: 0; } 100% { opacity: 1; } }
@keyframes site-smoke {
  0% { opacity: 0; transform: translateY(6px) scaleX(1); }
  20% { opacity: .9; }
  100% { opacity: 0; transform: translateY(-46px) scaleX(2.4); }
}
.site-candle--lit .site-candle__flame { animation: site-flicker 2.8s ease-in-out infinite; }
.site-candle--lit .site-candle__glow { animation: none; }
.site-candle--lit .site-candle__smoke { display: none; }

/* ── Reduced motion and Calm mode: same content, no motion (§3.6) ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .site-cta::after, .site-candle__flame, .site-candle__glow, .site-docart__spark { animation: none; }
  .site-cta::after, .site-candle__smoke { display: none; }
  .site-burst { animation: none; opacity: .4; transform: none; }
  .site-arrow, .site-round { transition: none; }
  .site-candle__flame { transform: none; opacity: 1; }
  .site-candle__glow { opacity: 1; }
}
:root[data-calm] :is(.site-candle__flame, .site-candle__glow, .site-docart__spark) { animation: none; }
:root[data-calm] .site-cta::after { display: none; }
:root[data-calm] .site-burst { animation: none; opacity: .4; transform: none; }
:root[data-calm] .site-candle__smoke { display: none; }
:root[data-calm] .site-candle__flame { transform: none; opacity: 1; }
:root[data-calm] .site-candle__glow { opacity: 1; }

@media (forced-colors: active) {
  .site-burst, .site-candle, .site-docart { display: none; }
}
