/* Padel Rivals — shared styles for the public legal pages.
   Palette mirrors lib/frontend/theme/app_colors.dart (limestone + clay), so the
   site and the app read as one thing. Dark mode is a real second palette, not
   an inversion. */

:root {
  --bg:        #E9DFCD;
  --surface:   #FBF6EC;
  --surface-2: #F3EADB;
  --ink:       #2A2218;
  --ink-soft:  #6E6149;
  --ink-faint: #A2937A;
  --line:      #DBCEB6;
  --line-soft: #E7DCC8;
  --clay:      #C2502A;
  --clay-press:#A8431F;
  --pine:      #2F6B57;
  --hero:      #21372F;
  --hero-2:    #2B463B;
  --hero-ink:  #F4EFE2;
  --radius:    16px;
  --measure:   68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #14100B;
    --surface:   #1D1811;
    --surface-2: #262017;
    --ink:       #F2EADC;
    --ink-soft:  #BFB19A;
    --ink-faint: #8B7F6B;
    --line:      #342C20;
    --line-soft: #2A2318;
    --clay:      #E0714A;
    --clay-press:#C2502A;
    --pine:      #5D9A83;
    --hero:      #1B2C25;
    --hero-2:    #24382F;
    --hero-ink:  #F4EFE2;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Anchored headings must clear the sticky masthead. */
:target { scroll-margin-top: 84px; }

a { color: var(--clay); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Masthead ─────────────────────────────────────────────── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.masthead .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }

.brand .mark {
  width: 30px; height: 30px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--clay), var(--clay-press));
  color: #FDF6EE;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
  letter-spacing: -0.5px;
}

.brand .name {
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.masthead nav { margin-left: auto; display: flex; gap: 4px; }

.masthead nav a {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-radius: 8px;
}
.masthead nav a:hover { background: var(--surface-2); text-decoration: none; }
.masthead nav a[aria-current="page"] { color: var(--clay); background: var(--surface-2); }

@media (max-width: 560px) {
  .masthead nav a { padding: 6px 7px; font-size: 12.5px; }
  .brand .name { display: none; }
}

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

.page { max-width: 1080px; margin: 0 auto; padding: 34px 20px 80px; }

.doc {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

@media (min-width: 940px) {
  .doc { grid-template-columns: 226px minmax(0, 1fr); gap: 46px; align-items: start; }
}

/* ── Document head ────────────────────────────────────────── */

.doc-head { grid-column: 1 / -1; margin-bottom: 4px; }

.doc-head h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
}

.stamp {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--ink-faint);
  font-weight: 600;
}

/* ── Contents rail ────────────────────────────────────────── */

.toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
}

@media (min-width: 940px) {
  .toc { position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow-y: auto; }
}

.toc h2 {
  margin: 0 0 10px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }

.toc li { margin: 0 0 1px; }

.toc a {
  display: block;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-soft);
  font-weight: 500;
}
.toc a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }

/* On narrow screens the rail becomes a disclosure so it doesn't push the
   document itself below the fold. */
.toc-mobile { display: block; }
.toc-mobile > summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.toc-mobile > summary::-webkit-details-marker { display: none; }
.toc-mobile > summary::after { content: " ▾"; color: var(--ink-faint); }
.toc-mobile[open] > summary { border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; }
.toc-mobile[open] .toc { border-radius: 0 0 var(--radius) var(--radius); border-top: 0; }

@media (min-width: 940px) {
  .toc-mobile > summary { display: none; }
  .toc-mobile { display: block; }
}

/* ── Prose ────────────────────────────────────────────────── */

.prose { max-width: var(--measure); }

.prose h2 {
  margin: 38px 0 12px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.3;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}
.prose > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.prose h3 {
  margin: 24px 0 8px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
}

.prose p { margin: 0 0 14px; color: var(--ink-soft); }

.prose ul { margin: 0 0 16px; padding: 0; list-style: none; }

.prose li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 9px;
  color: var(--ink-soft);
}

.prose li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 10px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--clay);
  opacity: 0.7;
}

.prose strong { color: var(--ink); font-weight: 700; }

/* A pulled-out passage for the things that genuinely matter to a reader —
   assumption of risk, what survives deletion. */
.callout {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--clay);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 16px;
}
.callout p:last-child { margin-bottom: 0; }

/* ── Hub cards (index) ────────────────────────────────────── */

.hero {
  background: linear-gradient(135deg, var(--hero), var(--hero-2));
  color: var(--hero-ink);
  border-radius: 22px;
  padding: 40px 30px;
  margin-bottom: 26px;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
}
.hero p { margin: 0; max-width: 46ch; opacity: 0.82; font-size: 15.5px; }

.cards { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover {
  text-decoration: none;
  border-color: var(--clay);
  transform: translateY(-1px);
}
.card h2 { margin: 0 0 5px; font-size: 16.5px; font-weight: 800; letter-spacing: -0.2px; }
.card p  { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.55; }
.card .go { display: inline-block; margin-top: 12px; font-size: 13.5px; font-weight: 700; color: var(--clay); }

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

.foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 20px 60px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.7;
}
.foot a { color: var(--ink-soft); font-weight: 600; }

/* ── Print ────────────────────────────────────────────────── */

@media print {
  .masthead, .toc, .toc-mobile, .foot nav { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .doc { display: block; }
  .prose { max-width: none; }
  .prose h2 { break-after: avoid; }
  .prose li, .prose p { break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
}
