/* ══════════════════════════════════════════════════════════
   FiatSucks.com — shared styles
   Page-specific rules live in a <style> block on each page.

   THEMING: every colour comes from a token below. Dark is the
   default (and the no-JS fallback); :root[data-theme="light"]
   redefines the same tokens. Never hard-code a colour in page
   CSS or it will not follow the theme.

   LAYOUT: content is centred on one of two rails (see RAILS).
   Blocks stay full-bleed and push their content inward with
   padding, so borders and backgrounds still span the viewport.
   Page CSS therefore sets padding-block only — never a padding
   shorthand, which would clobber the rail.
   ══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── TYPE ──
     Display faces stay for brand; running prose uses a text face. */
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Bebas Neue', Impact, 'Arial Narrow', sans-serif;
  --font-alt:     'Syne', var(--font-body);
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* ── LAYOUT ── */
  --gutter:     2.5rem;
  --rail-wide:  1180px;   /* header, footer, hero, card grids */
  --rail-prose:  880px;   /* article body, FAQ, contact, podcasts */
  --tap:          44px;   /* minimum comfortable touch target */

  /* ── DARK THEME (default) ── */
  color-scheme: dark;

  --bg:         #080808;
  --surface:    #111111;
  --surface2:   #1a1a1a;
  --border:     #2a2a2a;

  --text:       #e8e0d0;   /* headings + strong text */
  --body:       #a09880;   /* running prose            6.96:1 */
  --muted:      #8a8a8a;   /* secondary text           5.80:1 */
  --muted-dim:  #7a7a7a;   /* tertiary text            4.67:1 */

  --orange:      #F7931A;  /* accent TEXT — retoned in light mode */
  --orange-fill: #F7931A;  /* brand FILL — identical in both themes */
  --orange-dim:  #b8650d;
  --orange-ink:  #000;     /* text sitting on --orange-fill */

  --ghost-num:  #262626;   /* big ordinals    (decorative, aria-hidden) */
  --stroke:     #2a2a2a;   /* outlined ₿      (decorative) */
  --dim-head:   #6b6b6b;   /* the dim H1 line          3.76:1 */

  --header-bg:  rgba(8,8,8,0.88);
  --tint:       rgba(247,147,26,0.05);
  --shadow:     rgba(0,0,0,0.55);
  --scanline:   rgba(0,0,0,0.07);
  --noise-opacity: 0.4;
  --tap-flash:  rgba(247,147,26,0.22);

  /* ── MOTION SWITCHES ──
     Referenced by animation shorthands so motion can be disabled
     without duplicating every rule. See the motion block below. */
  --anim-up:      fadeUp;
  --anim-in:      fadeIn;
  --anim-opacity: 0;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg:         #f4f1ea;
  --surface:    #ffffff;
  --surface2:   #eae5da;
  --border:     #d4cec0;

  --text:       #14120e;
  --body:       #3f3a30;   /* 10.02:1 */
  --muted:      #5d564a;   /*  6.43:1 */
  --muted-dim:  #6b6558;   /*  5.13:1 */

  --orange:     #8a4f00;   /*  5.82:1 — bright orange is unreadable on paper */
  --orange-dim: #b8650d;

  --ghost-num:  #ddd7c9;
  --stroke:     #d4cec0;
  --dim-head:   #8a8274;   /*  3.37:1, large text */

  --header-bg:  rgba(244,241,234,0.9);
  --tint:       rgba(247,147,26,0.12);
  --shadow:     rgba(60,50,30,0.18);
  --scanline:   rgba(0,0,0,0.022);
  --noise-opacity: 0.22;
}

html {
  scroll-behavior: smooth;
  /* Stop iOS inflating text when a phone is turned to landscape. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: var(--tap-flash);
}

/* ── NOISE OVERLAY ── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 200px;
  pointer-events: none;
  z-index: 0;
  opacity: var(--noise-opacity);
}

/* ── SCANLINES ── */
body::after {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    var(--scanline) 2px, var(--scanline) 4px
  );
  pointer-events: none;
  z-index: 0;
}

.page { position: relative; z-index: 1; }

/* ── ACCESSIBILITY ── */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.8rem 1.4rem;
  background: var(--orange-fill);
  color: var(--orange-ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ── HEADER ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: var(--tap);
  font-family: var(--font-display);
  font-size: 1.65rem;
  letter-spacing: 0.08em;
  color: var(--orange);
  text-decoration: none;
  white-space: nowrap;
}
/* The mark is inline SVG rather than an <img> so its three colours can
   follow the theme tokens — a baked-in black plate would look wrong on
   the light background. */
.logo-mark {
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 auto;
  display: block;
}
.logo-text { display: inline-block; }
.logo-text span { color: var(--text); }

.header-right { display: flex; align-items: center; gap: 1.5rem; }
.header-tools { display: flex; align-items: center; gap: 0.5rem; }

nav { display: flex; gap: 1.4rem; align-items: center; }
nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}
nav a:hover, nav a.active { color: var(--orange); }

/* ── ICON BUTTONS (settings + mobile nav) ── */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.icon-btn:hover { border-color: var(--orange); color: var(--orange); }
.icon-btn[aria-expanded="true"] { border-color: var(--orange); color: var(--orange); }

.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 5px; padding: 0 11px; }
.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── SETTINGS PANEL ── */
.settings-wrap { position: relative; display: flex; }

.settings-panel {
  position: absolute;
  top: calc(100% + 0.7rem);
  right: 0;
  width: 260px;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px var(--shadow);
  z-index: 150;
}
.settings-panel[hidden] { display: none; }

.settings-heading {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 0.7rem;
}
.settings-heading + .seg { margin-bottom: 1.25rem; }
.settings-panel .seg:last-child { margin-bottom: 0; }

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.seg button {
  min-height: var(--tap);
  padding: 0.5rem 0.3rem;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.seg button:hover { color: var(--orange); background: var(--surface2); }
.seg button[aria-checked="true"] {
  background: var(--orange-fill);
  color: var(--orange-ink);
  font-weight: 700;
}

/* ── PAGE HERO ── */
.page-hero {
  padding-block: 5rem 3rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 1.2rem;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 7vw, 7rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
h1 em { color: var(--orange); font-style: normal; display: block; }

.page-desc {
  font-size: 1.1rem;
  color: var(--body);
  max-width: 62ch;
  line-height: 1.75;
}

/* ── RAILS ──
   One rule centres everything. Blocks keep full-bleed borders and
   backgrounds; only their content is pulled onto the rail. max()
   collapses to the plain gutter once the viewport is narrower than
   the rail, so this is inert on phones.                          */
header,
footer,
.hero,
.links-section {
  padding-inline: max(var(--gutter), calc((100% - var(--rail-wide)) / 2));
}

.page-hero,
.content,
.faq-section,
.podcast-list,
.contact-section {
  padding-inline: max(var(--gutter), calc((100% - var(--rail-prose)) / 2));
}

.divider {
  margin-inline: max(var(--gutter), calc((100% - var(--rail-wide)) / 2));
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--tap);
  padding: 0.85rem 1.8rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--orange-fill);
  color: var(--orange-ink);
  font-weight: 700;
}
.btn-primary:hover {
  background: #ffaa33;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(247,147,26,0.35);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--orange);
  color: var(--orange);
  transform: translateY(-2px);
}
.btn-row { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── PUNCHLINE ── */
.punchline {
  display: block;
  margin-top: 1.2rem;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--orange-fill);
  background: var(--tint);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--orange);
}

/* ── CTA BLOCK ── */
.cta-block {
  margin-top: 4rem;
  padding: 3rem;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}
.cta-block h2 {
  font-family: var(--font-display);
  font-size: 2.8rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.8rem;
  color: var(--text);
}
.cta-block h2 span { color: var(--orange); }
.cta-block p {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 2rem;
  line-height: 1.65;
}

/* ── CARD PARTS (index + contact) ── */
.card-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
}
.card-title {
  font-family: var(--font-alt);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
}
.card-desc {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.65;
  margin-top: 0.2rem;
}
.card-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--orange);
  letter-spacing: 0.03em;
  line-height: 1.55;
  word-break: break-all;
  margin-top: 0.4rem;
}
.card-arrow {
  margin-top: auto;
  padding-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--orange);
  letter-spacing: 0.08em;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s, transform 0.2s;
}

/* ── FOOTER ── */
footer {
  padding-block: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-left {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}
/* Inline links get vertical padding so they clear the 24px minimum
   touch target without disturbing the line they sit in. */
.footer-left a {
  display: inline-block;
  padding-block: 0.35rem;
  color: var(--orange);
  text-decoration: none;
}
.footer-social {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: var(--tap);
  padding-block: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-social:hover { color: var(--orange); }
.footer-social svg { flex: 0 0 auto; }

.footer-right {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted-dim);
  letter-spacing: 0.08em;
}
/* FTC requires affiliate disclosure to be clear and conspicuous —
   this needs to stay readable. Do not dim it back down.            */
.footer-disclaimer {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1.7;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ══════════════ RESPONSIVE ══════════════ */

@media (max-width: 900px) {
  .nav-toggle { display: flex; }

  /* Opaque on phones: drops a full-viewport backdrop blur that the
     compositor otherwise re-runs on every scroll frame. */
  header {
    background: var(--bg);
    backdrop-filter: none;
  }

  #site-nav {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0 var(--gutter) 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 18px 30px var(--shadow);
    max-height: calc(100vh - 4.5rem);
    max-height: calc(100svh - 4.5rem);
    overflow-y: auto;
  }
  #site-nav.open { display: flex; }
  #site-nav a {
    padding: 0.95rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
  }
  #site-nav a:last-child { border-bottom: none; }
}

@media (max-width: 768px) {
  :root { --gutter: 1.25rem; }

  h1 { font-size: clamp(2.6rem, 11vw, 3.5rem); }

  .page-hero { padding-block: 2.75rem 1.75rem; }
  .cta-block { padding: 2rem 1.25rem; margin-top: 2.5rem; }
  .cta-block h2 { font-size: 2.2rem; }
  footer { padding-block: 1.5rem; }

  /* The 2px scanline grid turns to moiré on high-DPI phone screens and
     costs a full-viewport repeat to rasterise. Not worth it here. */
  body::after { display: none; }

  .settings-panel { width: min(260px, calc(100vw - 2.5rem)); }
  .punchline { padding: 0.9rem 1rem; font-size: 0.85rem; }
}

/* Stack the calls to action on small phones so each is a full-width
   target instead of two cramped buttons wrapping onto two lines. */
@media (max-width: 560px) {
  .cta-row, .btn-row { flex-direction: column; align-items: stretch; }
  .cta-row .btn, .btn-row .btn { justify-content: center; width: 100%; }
}

/* Smallest phones: the logo lockup plus two 44px icon buttons overruns
   a 320px header, so tighten the lockup rather than drop the wordmark. */
@media (max-width: 400px) {
  header { gap: 0.75rem; }
  .logo { font-size: 1.4rem; gap: 0.45rem; }
  .logo-mark { width: 1.5rem; height: 1.5rem; }
  .header-tools { gap: 0.35rem; }
}

/* ── REDUCED MOTION ──
   The hero elements start at opacity:0 and are revealed by their
   animation, so motion must be removed by restoring opacity — never by
   simply cancelling the animation, which would leave them invisible.
   The switches below feed the animation shorthands declared above, so
   the OS preference and the in-page Motion setting share one path.
   Motion still governs the hero reveal and every transition.        */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) {
    --anim-up: none;
    --anim-in: none;
    --anim-opacity: 1;
  }
}
:root[data-motion="reduced"] {
  --anim-up: none;
  --anim-in: none;
  --anim-opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) *,
  :root:not([data-motion="full"]) *::before,
  :root:not([data-motion="full"]) *::after { transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
:root[data-motion="reduced"] *,
:root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after { transition-duration: 0.01ms !important; }
:root[data-motion="reduced"] { scroll-behavior: auto; }
