/* PipTCG site — shared styles.
   Tokens mirror lib/theme.ts in the app (monochrome colorway, 2026-08-31):
   true-black ground, white accent, neutral gray steps, red only for errors.
   Dark is the default; light mirrors the app's light palette. */

*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: dark light;
  --bg: #000000;
  --surface: #131315;
  --surface-2: #1A1A1D;
  --surface-3: #1F1F22;
  --border: #232326;
  --border-strong: #3A3A3E;
  --fg: #F5F5F5;
  --fg-2: #8E8E93;
  --fg-3: #86868B;
  --accent: #FFFFFF;
  --accent-press: #E5E5E7;
  --on-accent: #000000;
  --error: #F85149;
  --glow: rgba(255,255,255,0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --max: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #F2F2F7;
    --surface: #FFFFFF;
    --surface-2: #FFFFFF;
    --surface-3: #F2F2F7;
    --border: #D1D1D6;
    --border-strong: #76767A;
    --fg: #000000;
    --fg-2: #636366;
    --fg-3: #6E6E73;
    --accent: #17171A;
    --accent-press: #48484C;
    --on-accent: #FFFFFF;
    --error: #D70015;
    --glow: rgba(0,0,0,0.06);
  }
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; font-weight: 700; }
p { margin: 0; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

/* ── Header ──────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em;
  text-decoration: none;
}
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.site-nav { display: flex; align-items: center; gap: 1.6rem; }
.site-nav a { color: var(--fg-2); text-decoration: none; font-size: 0.95rem; font-weight: 500; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--fg); }
.site-nav .btn { margin-left: 0.4rem; }
@media (max-width: 720px) {
  .site-nav a:not(.btn) { display: none; }
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  font: inherit; font-size: 0.98rem; font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-press); }
.btn-secondary { background: transparent; color: var(--fg); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface); }
.btn-sm { padding: 0.55rem 1rem; font-size: 0.9rem; }
.btn svg { width: 18px; height: 18px; }
.btn[aria-disabled="true"] { opacity: 0.55; cursor: default; }

/* ── Footer ──────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 5rem;
  padding: 2.5rem 0 3rem;
  color: var(--fg-2);
  font-size: 0.9rem;
}
.site-footer .wrap {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1.5rem;
}
.site-footer .brand { color: var(--fg); font-size: 1.05rem; }
.site-footer .tag { margin-top: 0.35rem; max-width: 34ch; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; }
.site-footer a { color: var(--fg-2); text-decoration: none; }
.site-footer a:hover { color: var(--fg); text-decoration: underline; }
.site-footer .legal { width: 100%; border-top: 1px solid var(--border); padding-top: 1.25rem; font-size: 0.82rem; color: var(--fg-3); }

/* ── Document pages (support / privacy / terms) ─────────────────────── */
.doc main { max-width: 760px; margin: 0 auto; padding: 3.5rem 1.25rem 1rem; }
.doc h1 { font-size: clamp(2rem, 4vw, 2.6rem); margin-bottom: 0.5rem; }
.doc .tagline { color: var(--fg-2); font-size: 1.05rem; margin: 0 0 2.25rem; }
.doc h2 { font-size: 1.3rem; margin: 2.4rem 0 0.7rem; }
.doc h3 { font-size: 1.05rem; margin: 1.6rem 0 0.4rem; }
.doc p { margin: 0.7rem 0; }
.doc ul, .doc ol { margin: 0.7rem 0; padding-left: 1.4rem; }
.doc li { margin: 0.35rem 0; }
.doc main a { color: var(--fg); text-decoration: underline; text-underline-offset: 0.15em; text-decoration-color: var(--border-strong); }
.doc main a:hover { text-decoration-color: var(--fg); }
.doc strong { font-weight: 650; }
.doc table { border-collapse: collapse; width: 100%; margin: 0.9rem 0; font-size: 0.95rem; }
.doc th, .doc td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc th { color: var(--fg-2); font-weight: 600; }
.doc .muted { color: var(--fg-2); font-size: 0.95rem; }
.doc .error-title { color: var(--error); }
.doc .hidden { display: none; }

/* Utility */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
