/* ══════════════════════════════════════════════════════════════════════════
   Krat13 — krat13.app
   Support · Privacy · Terms · Legal

   Design language: analog-editorial. Espresso + cream surfaces, a single
   disciplined amber accent reserved for interactive elements, New York / Georgia
   serif display, and a quiet spinning-vinyl motif. Flat, paper-like surfaces —
   depth comes from layered shadow and hairline borders, not glow.

   Display type: New York (Apple system serif) with Georgia fallback — an
   editorial serif, no web-font download. One stylesheet skins every page.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --font-display: "New York", "Georgia", "Times New Roman", serif;
  color-scheme: dark;

  /* Warm — Dark (default) */
  --bg:            #17110c;
  --bg-2:          #120d09;
  --surface:       #241d16;
  --surface-2:     #2b241b;
  --surface-hover: #322a20;
  --surface-glass: rgba(36, 29, 22, 0.68);
  --surface-glass-hover: rgba(50, 42, 32, 0.78);

  --border:        rgba(245, 241, 232, 0.09);
  --border-strong: rgba(245, 241, 232, 0.16);
  --border-acc:    rgba(245, 158, 11, 0.42);
  --border-glass:  rgba(245, 235, 215, 0.14);

  /* Accent — amber = "tappable or active" only. */
  --gold:        #f59e0b;
  --gold-light:  #fbbf24;
  --amber:       var(--gold);   /* legacy alias used inline on some pages */

  --text:        #f6efe3;
  --text-muted:  #b4a992;
  --text-soft:   #9a8f7a;   /* AA 4.5:1+ on both --bg and --surface */

  --gold-glow:   rgba(245, 158, 11, 0.30);
  --disc-opacity: 0.34;  /* dark: near-black record on espresso needs a lift */
  --groove:      rgba(245, 235, 215, 0.05);
  --groove-soft: rgba(245, 158, 11, 0.045);

  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:   0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg:   0 30px 70px rgba(0, 0, 0, 0.55);

  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 16px;

  --container: 940px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: light) {
  /* :not([data-theme]) — a manual override (set by theme.js) always wins
     over the OS-level preference. */
  :root:not([data-theme]) {
    color-scheme: light;

    /* Warm — Light (cream + espresso ink) */
    --bg:            #fbf4e8;
    --bg-2:          #f3e9d7;
    --surface:       #fffaf1;
    --surface-2:     #f6eddd;
    --surface-hover: #f1e6d2;
    --surface-glass: rgba(255, 250, 241, 0.72);
    --surface-glass-hover: rgba(255, 250, 241, 0.88);

    --border:        rgba(44, 31, 15, 0.12);
    --border-strong: rgba(44, 31, 15, 0.20);
    --border-acc:    rgba(146, 64, 14, 0.45);
    --border-glass:  rgba(44, 31, 15, 0.10);

    --gold:        #a45410;   /* rich amber-rust, AA on cream */
    --gold-light:  #b45309;

    --text:        #2a1d0e;
    --text-muted:  #6a5b47;
    --text-soft:   #6d5f4c;   /* AA 4.5:1+ on both --bg and --surface */

    --gold-glow:   rgba(146, 64, 14, 0.18);
    --disc-opacity: 0.13;   /* light: dark record on cream reads clearly at low opacity */
    --groove:      rgba(60, 40, 15, 0.06);
    --groove-soft: rgba(146, 64, 14, 0.05);

    --shadow-sm:   0 1px 2px rgba(60, 40, 15, 0.10);
    --shadow-md:   0 12px 30px rgba(60, 40, 15, 0.12);
    --shadow-lg:   0 30px 60px rgba(60, 40, 15, 0.16);
  }
}

/* Explicit override set by theme.js (data-theme="light"/"dark"), independent
   of the OS-level prefers-color-scheme — lets the in-page toggle win even
   when it disagrees with system appearance. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg:            #fbf4e8;
  --bg-2:          #f3e9d7;
  --surface:       #fffaf1;
  --surface-2:     #f6eddd;
  --surface-hover: #f1e6d2;
  --surface-glass: rgba(255, 250, 241, 0.72);
  --surface-glass-hover: rgba(255, 250, 241, 0.88);
  --border:        rgba(44, 31, 15, 0.12);
  --border-strong: rgba(44, 31, 15, 0.20);
  --border-acc:    rgba(146, 64, 14, 0.45);
  --border-glass:  rgba(44, 31, 15, 0.10);
  --gold:        #a45410;
  --gold-light:  #b45309;
  --text:        #2a1d0e;
  --text-muted:  #6a5b47;
  --text-soft:   #6d5f4c;
  --gold-glow:   rgba(146, 64, 14, 0.18);
  --disc-opacity: 0.13;
  --groove:      rgba(60, 40, 15, 0.06);
  --groove-soft: rgba(146, 64, 14, 0.05);
  --shadow-sm:   0 1px 2px rgba(60, 40, 15, 0.10);
  --shadow-md:   0 12px 30px rgba(60, 40, 15, 0.12);
  --shadow-lg:   0 30px 60px rgba(60, 40, 15, 0.16);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    /* Concentric vinyl grooves radiating from the disc in the top-right —
       the whole page reads as the surface of a spinning record. */
    repeating-radial-gradient(circle at 90% -60px,
      var(--groove) 0 1.5px, transparent 1.5px 11px),
    /* A second, tighter groove field lower-left for depth. */
    repeating-radial-gradient(circle at 6% 118%,
      var(--groove-soft) 0 1px, transparent 1px 9px),
    radial-gradient(1200px 620px at 82% -6%, var(--gold-glow), transparent 62%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Fine paper grain — analog texture, barely there. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: var(--grain);
  opacity: 0.35;
  mix-blend-mode: overlay;
}

@media (prefers-color-scheme: light) {
  body::before { opacity: 0.5; mix-blend-mode: multiply; }
}

/* A slow-spinning vinyl disc tucked into the top-right — reads as the record
   the groove field radiates from. Tasteful presence, not a dominant block.
   Opacity is a per-theme token (not a media query) so it tracks the manual
   toggle override, not just the OS setting. */
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
  width: 560px;
  height: 560px;
  right: -170px;
  top: -140px;
  background: url("vinyl-disc-plain.png") center / contain no-repeat;
  opacity: var(--disc-opacity);
  filter: saturate(0.85) contrast(1.05);
  animation: spin 90s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout ─────────────────────────────────────────────────────────────── */

.page {
  position: relative;
  z-index: 1;
  width: min(var(--container), calc(100% - 36px));
  margin: 0 auto;
  /* Top floor (76px) clears the fixed header (~64px tall) so hero content —
     the app tile / disc logo-mark — never sits under the header controls. */
  padding: clamp(76px, 8vw, 96px) 0 52px;
}

/* ── Hero (home) ────────────────────────────────────────────────────────── */

.hero {
  text-align: center;
  margin-bottom: clamp(40px, 7vw, 68px);
}

/* App tile with a record sliding out from behind it. */
.app-tile {
  position: relative;
  width: 128px;
  height: 128px;
  margin: 0 auto 30px;
  display: grid;
  place-items: center;
}

.app-tile-img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 28px;
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px var(--border-strong),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.app-tile .disc {
  position: absolute;
  z-index: 1;
  width: 108px;
  height: 108px;
  right: -34px;
  top: 10px;
  background: url("vinyl-disc.png") center / contain no-repeat;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.5));
  animation: spin 12s linear infinite;
  transition: transform 0.6s var(--ease);
}

.app-tile:hover .disc { right: -46px; }

/* Legacy CSS logo mark — still used by interior page heroes. */
.logo-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: var(--gold);
  background:
    linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.logo-mark::before {
  content: "";
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--gold-light) 0 15%, #0e0a06 16% 17%, transparent 18%),
    repeating-radial-gradient(circle, rgba(255, 255, 255, 0.10) 0 1px, transparent 1px 4px),
    #17110c;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.eyebrow .dot { color: var(--gold); }

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(58px, 10vw, 112px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  color: var(--text);
}

/* Home hero only — a restrained foil-stamp sheen on the wordmark itself
   (brand logotype, not a UI label, so a touch of gold here doesn't break
   the "amber = interactive only" rule). `color` is the fallback for any
   browser without background-clip:text support, so it never goes unreadable. */
.hero .brand-title {
  color: var(--text);
  /* Two clipped layers: a diagonal "glint" band over the base foil gradient.
     The glint sweeps across once on load (see @keyframes foil), like light
     catching gold leaf. */
  background-image:
    linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.55) 49%, transparent 57%),
    linear-gradient(180deg, var(--gold-light) 0%, var(--text) 52%);
  background-size: 260% 100%, 100% 100%;
  background-position: 220% 0, 0 0;
  background-repeat: no-repeat;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  /* background-clip:text paints only within the padding box — pad the block
     axis so tall serif ascenders/descenders aren't clipped top or bottom. */
  padding-block: 0.1em;
  animation: foil 2.4s var(--ease) 0.35s both;
}

@keyframes foil {
  from { background-position: 220% 0, 0 0; }
  to   { background-position: -140% 0, 0 0; }
}

.hero-subtitle {
  max-width: 540px;
  margin: 20px auto 0;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.5;
  color: var(--text-muted);
}

/* Trust chips */
.trust-row {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.trust-row li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.trust-row li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

/* Interior page hero */
.page-hero { margin-bottom: clamp(32px, 5vw, 48px); }
.page-hero .brand-title {
  font-size: clamp(30px, 5vw, 44px);
  letter-spacing: -0.02em;
}
.page-hero .hero-subtitle { font-size: 15px; margin-top: 12px; }

/* ── Sections ───────────────────────────────────────────────────────────── */

.section { margin-top: clamp(36px, 6vw, 56px); }

.section-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 20px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.section-title::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-glow);
  flex: 0 0 auto;
}

.section-title::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

/* ── Cards ──────────────────────────────────────────────────────────────── */

.card-grid { display: grid; gap: 16px; }
.card-grid.main   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-grid.policy { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  position: relative;
  min-height: 116px;
  padding: 24px 56px 24px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-glass);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition:
    transform 0.4s var(--ease),
    border-color 0.4s var(--ease),
    background 0.4s var(--ease),
    box-shadow 0.4s var(--ease);
}

/* Warm top-edge sheen that grows on hover. */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.4), transparent 42%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-6px) scale(1.012);
  background: var(--surface-glass-hover);
  border-color: var(--border-acc);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-acc);
}

.card:hover::before { opacity: 1; }
.card:active { transform: translateY(-2px) scale(1.005); }

.card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.card-icon {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: var(--gold);
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.22), rgba(245, 158, 11, 0.05));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 0.4s var(--ease), color 0.4s var(--ease), transform 0.4s var(--ease);
}

.card:hover .card-icon {
  border-color: var(--border-acc);
  color: var(--gold-light);
  transform: scale(1.06);
}

.card-icon svg { width: 26px; height: 26px; stroke: currentColor; }

.card-content { min-width: 0; }

.card-title {
  margin: 0 0 7px;
  font-size: 17.5px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-description {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

.card::after {
  content: "";
  position: absolute;
  right: 24px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-soft);
  border-top: 2px solid var(--text-soft);
  transform: translateY(-50%) rotate(45deg);
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease);
}

.card:hover::after {
  border-color: var(--gold);
  transform: translate(4px, -50%) rotate(45deg);
}

/* Policy cards — a touch more compact */
.policy .card { min-height: 104px; padding: 20px 48px 20px 20px; gap: 16px; }
.policy .card-icon { width: 48px; height: 48px; border-radius: 14px; }
.policy .card-icon svg { width: 23px; height: 23px; }
.policy .card-title { font-size: 16px; }
.policy .card-description { font-size: 13.5px; }

/* ── Footer ─────────────────────────────────────────────────────────────── */

.footer {
  margin-top: clamp(48px, 8vw, 72px);
  padding-top: 28px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-soft);
}

.footer-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.25s var(--ease);
}

.footer-nav a:hover { color: var(--gold); }
.footer-dot { color: var(--text-soft); opacity: 0.5; }

.copyright { margin: 0; font-size: 13.5px; color: var(--text-soft); }

/* ── Entrance motion ────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .hero, .section, .cta-panel { animation: rise 0.7s var(--ease) both; }
  /* fill-mode: backwards (not "both") — .card also sets `transform` on :hover;
     "both" would hold the keyframe's translateY(0) forever and permanently
     block the hover lift once the entrance animation finishes. */
  .card-grid .card { animation: rise 0.6s var(--ease) backwards; }
  .card-grid .card:nth-child(2) { animation-delay: 60ms; }
  .card-grid .card:nth-child(3) { animation-delay: 120ms; }
  .card-grid .card:nth-child(4) { animation-delay: 180ms; }
  .card-grid .card:nth-child(5) { animation-delay: 240ms; }
  .section:nth-child(n+2) { animation-delay: 80ms; }

  @keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  body::after, .app-tile .disc, .hero .brand-title { animation: none; }
  html { scroll-behavior: auto; }
  /* keep the wordmark on its final (fully-lit) foil position, not mid-sweep */
  .hero .brand-title { background-position: -140% 0, 0 0; }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .card-grid.main, .card-grid.policy { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body::after { width: 460px; height: 460px; right: -200px; top: -120px; }
  .page { width: min(100% - 26px, 480px); }
  .app-tile { width: 104px; height: 104px; }
  .app-tile .disc { width: 88px; height: 88px; right: -26px; }
  .card { min-height: auto; padding: 20px 46px 20px 18px; gap: 15px; }
  .card-icon { width: 48px; height: 48px; }
}

/* ════════════════════════════════════════════════════════════════════════
   .doc — prose / legal-document pages
   (Support, Terms, Privacy, Acceptable Use, AI Policy, Cookies, Copyright,
   Subprocessors). These pages mark up content with .card / .highlight /
   <details>; this scope reskins those exact selectors so the legal text
   itself never needs to change.
   ════════════════════════════════════════════════════════════════════════ */

.doc .card {
  display: block;
  min-height: auto;
  padding: 24px 26px;
  /* Solid, fully opaque — legal/support copy is dense reading, so this
     scope intentionally opts out of the glass treatment on nav .card. */
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: visible;
}

.doc .card::after, .doc .card::before { content: none; }

.doc .card:hover {
  transform: none;
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.doc .card h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 12px;
}

.doc .card p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; margin: 0; }
.doc .card p + p { margin-top: 10px; }

.doc .card ul, .doc .card ol {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  padding-left: 20px;
  margin: 10px 0 0;
}

.doc .card li { margin-bottom: 6px; }
.doc .card li::marker { color: var(--gold); }

.doc strong, .doc .strong-note { color: var(--text); font-weight: 600; }

.doc a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--border-acc);
}

.doc a:hover { text-decoration-color: var(--gold); }

.doc .highlight {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 16px 20px;
  margin-bottom: 18px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

.doc code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.86em;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  color: var(--text);
}

.doc table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.doc th, .doc td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.doc thead th {
  color: var(--text);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom-color: var(--border-strong);
}

/* FAQ accordions (Support page) */
.doc .card details { margin: 0; }

.doc .card summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.doc .card summary::-webkit-details-marker { display: none; }

.doc .card summary::after {
  content: "";
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-soft);
  border-bottom: 2px solid var(--text-soft);
  transform: rotate(45deg);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

.doc details[open] summary { margin-bottom: 12px; color: var(--gold); }
.doc details[open] summary::after {
  transform: rotate(-135deg);
  border-color: var(--gold);
}

/* ── CTA / contact panel ────────────────────────────────────────────────── */

.cta-panel {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 40px 32px;
  text-align: center;
  margin-top: clamp(36px, 6vw, 52px);
}

.cta-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 300px at 50% -40%, var(--gold-glow), transparent 70%);
  pointer-events: none;
}

.cta-panel > * { position: relative; }

.cta-panel h2 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.cta-panel p {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
  max-width: 460px;
  margin: 0 auto;
}

/* Scoped above `.doc a` (0-1-1) so the near-black ink and no-underline win. */
.cta-panel .cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  /* Brand primary CTA — always the bright gold "gold leaf" fill with
     near-black ink, in both light and dark (matches vvAmberFill). */
  background: linear-gradient(180deg, #fcc843, #f59e0b 55%, #d97706);
  color: #1c1206;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  padding: 14px 32px;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(245, 158, 11, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), filter 0.25s var(--ease);
}

.cta-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow: 0 14px 32px rgba(245, 158, 11, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.cta-btn:active { transform: translateY(0) scale(0.98); }

.cta-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ── Theme toggle (injected by theme.js — progressive enhancement) ────────
   No-JS visitors never see this and simply get the OS-level preference,
   which the rest of this file already handles via prefers-color-scheme. */

.theme-toggle {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
  color: var(--gold);
  cursor: pointer;
  padding: 0;
  transition:
    transform 0.3s var(--ease),
    border-color 0.3s var(--ease),
    background 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

.theme-toggle:hover {
  transform: translateY(-1px) scale(1.06);
  border-color: var(--border-acc);
  background: var(--surface-glass-hover);
  box-shadow: var(--shadow-md);
}

.theme-toggle:active { transform: translateY(0) scale(0.94); }

.theme-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.theme-toggle-icon {
  grid-area: 1 / 1;
  width: 21px;
  height: 21px;
  transition: opacity 0.35s var(--ease), transform 0.45s var(--ease);
}

.theme-toggle .icon-sun { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(-45deg) scale(0.6); }

.theme-toggle.is-light .icon-sun { opacity: 0; transform: rotate(45deg) scale(0.6); }
.theme-toggle.is-light .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }

@media (prefers-reduced-motion: reduce) {
  .theme-toggle, .theme-toggle-icon { transition: none; }
}

@media (max-width: 560px) {
  .theme-toggle { width: 38px; height: 38px; }
  .theme-toggle-icon { width: 19px; height: 19px; }
}

/* ── Text selection & scrollbar ─────────────────────────────────────────── */

::selection { background: rgba(245, 158, 11, 0.28); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) ::selection { background: rgba(164, 84, 16, 0.22); }
}
:root[data-theme="light"] ::selection { background: rgba(164, 84, 16, 0.22); }
:root[data-theme="dark"] ::selection { background: rgba(245, 158, 11, 0.28); }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-acc); background-clip: padding-box; }

/* ── Sticky site header (injected by theme.js) ──────────────────────────────
   Transparent while at the top of the page, frosts + gains a hairline on
   scroll. Holds the brand, primary nav, and the theme toggle. */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  padding: 12px clamp(14px, 4vw, 28px);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease),
    box-shadow 0.35s var(--ease), padding 0.35s var(--ease);
}

.site-header.scrolled {
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom-color: var(--border-glass);
  box-shadow: var(--shadow-sm);
  padding-top: 9px;
  padding-bottom: 9px;
}

.site-header-inner {
  width: min(var(--container), 100%);
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Brand is the persistent "back to main" affordance — always visible on every
   page (including home) so the way back is obvious, not hidden until scroll. */
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.02em;
  transition: color 0.2s var(--ease);
}

.site-brand:hover { color: var(--gold); }

.site-brand .brand-disc {
  width: 22px; height: 22px; border-radius: 50%;
  background: url("vinyl-disc.png") center / contain no-repeat;
  flex: 0 0 auto;
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 22px);
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.2s var(--ease);
}

.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--gold); }

@media (max-width: 620px) {
  .site-nav { display: none; }
}

/* ── Reading progress bar ───────────────────────────────────────────────── */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  z-index: 102;
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
  box-shadow: 0 0 12px var(--gold-glow);
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ── Contents block on long legal pages (injected by theme.js) ──────────── */
.doc-toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 22px;
}

.doc-toc-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 14px;
}

.doc-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 32px;
}

@media (max-width: 620px) { .doc-toc ol { columns: 1; } }

.doc-toc li {
  break-inside: avoid;
  margin-bottom: 9px;
  font-size: 14px;
  line-height: 1.4;
}

.doc-toc a {
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  gap: 8px;
  transition: color 0.2s var(--ease);
}

.doc-toc a:hover { color: var(--gold); }
.doc-toc a .toc-num { color: var(--gold); font-variant-numeric: tabular-nums; flex: 0 0 auto; }

/* fixed header shouldn't cover an anchored section when jumped to */
.doc .card h2[id], .doc .section-title[id] { scroll-margin-top: 90px; }

/* ── Back to top ────────────────────────────────────────────────────────── */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-md);
  color: var(--gold);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease),
    border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { transform: translateY(-2px) scale(1.05); border-color: var(--border-acc); background: var(--surface-glass-hover); }
.to-top:active { transform: scale(0.94); }
.to-top:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.to-top svg { width: 20px; height: 20px; }

@media (max-width: 560px) {
  .to-top { right: 14px; bottom: 14px; width: 42px; height: 42px; }
}

/* ── Language switcher (injected by theme.js) ───────────────────────────── */
.lang-switch { position: relative; flex: 0 0 auto; }

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
  color: var(--gold);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.lang-btn:hover { transform: translateY(-1px); border-color: var(--border-acc); background: var(--surface-glass-hover); }
.lang-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.lang-btn svg { width: 18px; height: 18px; }
.lang-code { font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; color: var(--text); }

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  z-index: 60;
}

.lang-switch.open .lang-menu { opacity: 1; transform: none; pointer-events: auto; }

.lang-item {
  display: block;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.lang-item:hover { background: var(--surface-2); color: var(--text); }
.lang-item[aria-current="true"] { color: var(--gold); font-weight: 700; }

@media (max-width: 400px) { .lang-code { display: none; } .lang-btn { padding: 0; width: 40px; justify-content: center; } }

/* ── "English governs" convenience-translation notice (legal pages) ─────── */
.lang-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.lang-notice svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; color: var(--gold); }
.lang-notice a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
