/* ============================================================
   Erc Games — Legal pages stylesheet
   Brand: Tubu blue #0066CC + Erc Games accent #FF6B35
   WCAG AA contrast, mobile-first, print-friendly.
   ============================================================ */

:root {
  --c-bg: #ffffff;
  --c-text: #1a1f2c;
  --c-muted: #5b6472;
  --c-rule: #e3e7ee;
  --c-card: #f6f8fb;
  --c-link: #0066cc;
  --c-link-hover: #004a99;
  --c-accent: #ff6b35;
  --c-accent-dim: #fde3d8;
  --c-code-bg: #f1f4f8;
  --c-warn-bg: #fff8e1;
  --c-warn-border: #ffd54f;

  --font-sans: "Inter", "Source Sans Pro", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --max-w: 720px;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #0e1320;
    --c-text: #e6ebf2;
    --c-muted: #9aa3b2;
    --c-rule: #25304a;
    --c-card: #161d2e;
    --c-link: #4ea6ff;
    --c-link-hover: #80c0ff;
    --c-accent: #ff8a5c;
    --c-accent-dim: #3a1f12;
    --c-code-bg: #1a2236;
    --c-warn-bg: #2b2410;
    --c-warn-border: #d6a437;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Header ---------- */
header.site {
  border-bottom: 1px solid var(--c-rule);
  padding: 1rem 1.25rem;
  background: var(--c-bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(8px);
}

header.site .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

header.site .brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--c-text);
  text-decoration: none;
}

header.site .brand .accent {
  color: var(--c-accent);
}

header.site nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

header.site nav a {
  color: var(--c-muted);
  text-decoration: none;
}

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

/* ---------- Layout ---------- */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

article > header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--c-accent-dim);
}

article > header h1 {
  font-size: 1.85rem;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

article > header .meta {
  color: var(--c-muted);
  font-size: 0.9rem;
}

article > header .meta .lang-switch {
  margin-left: 0.75rem;
}

article > header .meta .lang-switch a {
  color: var(--c-link);
  text-decoration: none;
}

/* ---------- Headings + body ---------- */
h2 {
  font-size: 1.35rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
  scroll-margin-top: 5rem;
}

h2::before {
  content: counter(section) ". ";
  color: var(--c-accent);
  font-weight: 700;
}

article {
  counter-reset: section;
}

h2 {
  counter-increment: section;
}

h3 {
  font-size: 1.05rem;
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
  color: var(--c-text);
}

p { margin: 0.7rem 0; }

a {
  color: var(--c-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover { color: var(--c-link-hover); }

ul, ol { padding-left: 1.5rem; }

li { margin: 0.3rem 0; }

strong { color: var(--c-text); font-weight: 600; }

code {
  font-family: var(--font-mono);
  background: var(--c-code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ---------- TOC ---------- */
.toc {
  background: var(--c-card);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 2rem;
  font-size: 0.92rem;
}

.toc summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--c-text);
}

.toc ol {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
}

.toc a {
  color: var(--c-link);
  text-decoration: none;
}

.toc a:hover { text-decoration: underline; }

/* ---------- Callouts ---------- */
.callout {
  margin: 1.25rem 0;
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--c-accent);
  background: var(--c-accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.callout.warn {
  border-left-color: var(--c-warn-border);
  background: var(--c-warn-bg);
}

.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--c-rule);
  vertical-align: top;
}

th {
  background: var(--c-card);
  font-weight: 600;
}

/* ---------- Footer ---------- */
footer.site {
  border-top: 1px solid var(--c-rule);
  padding: 1.5rem 1.25rem;
  color: var(--c-muted);
  font-size: 0.85rem;
  text-align: center;
}

footer.site a { color: var(--c-muted); }

/* ---------- Landing-page cards ---------- */
.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 2rem 0;
}

.card {
  display: block;
  padding: 1.25rem;
  background: var(--c-card);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--c-text);
  transition: transform 120ms ease, border-color 120ms ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--c-accent);
  color: var(--c-text);
}

.card h3 {
  margin: 0 0 0.4rem;
  color: var(--c-text);
}

.card p {
  margin: 0;
  color: var(--c-muted);
  font-size: 0.92rem;
}

/* ---------- Print ---------- */
@media print {
  :root {
    --c-bg: #ffffff;
    --c-text: #000000;
    --c-muted: #444444;
    --c-rule: #cccccc;
    --c-card: #ffffff;
    --c-link: #0033aa;
  }
  header.site, footer.site, .toc summary::marker { position: static; }
  header.site nav, .lang-switch { display: none; }
  a { text-decoration: underline; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
  h2, h3 { break-after: avoid; }
  body { font-size: 11pt; line-height: 1.5; }
}

/* ---------- Accessibility ---------- */
:focus-visible {
  outline: 3px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--c-text);
  color: var(--c-bg);
  padding: 0.5rem 1rem;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus { top: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 540px) {
  main { padding: 1.25rem 1rem 3rem; }
  article > header h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
  header.site .inner { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
