/* eleMusic legal pages (/terms, /privacy, /refunds, /contact, each a folder with an index.html so the
   URL needs no .html suffix on any static host): one stylesheet for long documents, linked by absolute
   path (/legal.css) so it loads with or without a trailing slash. No scripts, no external hosts: system
   fonts, the player's dark tokens (web/index.html) and the landing page's light tokens
   (landing/index.html). The theme follows the reader's system setting. Text tokens meet WCAG AA on
   their backgrounds; --accent is decorative only on the light theme. */

:root {
  color-scheme: light dark;
  --bg: #f6f4ee;
  --surface: #fffdf8;
  --fg: #1f2a3a;
  --muted: #5f6975;
  --line: #e2ddd2;
  --edge: #8b8576;
  --accent: #e8c36b;
  --link: #7a5710;
  --mark-accent: #9a7215;
  --callout-bg: #fbf3dc;
  --callout-edge: #9a7215;
  --focus: #1f2a3a;
  --target: #fbf3dc;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: 16px;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
    --surface: #121620;
    --fg: #f3f1ea;
    --muted: #9aa3ad;
    --line: #2a3446;
    --edge: #55647f;
    --accent: #e8c36b;
    --link: #e8c36b;
    --mark-accent: #e8c36b;
    --callout-bg: #1c1a12;
    --callout-edge: #e8c36b;
    --focus: #e8c36b;
    --target: #1c1a12;
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 12px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 17px; line-height: 1.65;
  overflow-wrap: break-word; overflow-x: hidden;
  min-height: 100vh; display: flex; flex-direction: column;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* The reading column: about 72 characters plus 16px gutters, shared by the top bar, the document and
   the footer. */
.wrap { width: 100%; max-width: calc(72ch + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 10; background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* Top bar: the wordmark (links to the player at /) and the legal nav. They share a row when the column
   is wide enough and stack on a phone. */
.topbar { border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 20px; padding-top: 10px; padding-bottom: 6px; }
.mark { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); color: var(--fg); text-decoration: none; font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.mark img { width: 28px; height: 28px; border-radius: 7px; flex: 0 0 auto; }
.mark .mark-accent { color: var(--mark-accent); }
.mark:hover { text-decoration: none; }

/* Legal nav (top bar and footer): one wrapping row of 44px targets; aria-current marks the open page. */
.legalnav ul { list-style: none; margin: 0 -10px; padding: 0; display: flex; flex-wrap: wrap; gap: 0 2px; }
.legalnav a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 10px; color: var(--muted); font-size: 15px; text-decoration: none; border-radius: 8px; }
.legalnav a:hover { color: var(--fg); text-decoration: underline; }
.legalnav a[aria-current="page"] { color: var(--fg); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }

main { flex: 1 0 auto; }
main:focus { outline: none; }

/* The document. */
.doc p, .doc ul, .doc ol, .doc dl, .doc address, .doc .table-wrap, .doc .callout, .doc .summary { margin: 0 0 14px; }
.doc a, .doc code, .contact { overflow-wrap: anywhere; }
.doc code { font-family: var(--mono); font-size: 0.9em; }
.doc strong { font-weight: 700; }
.doc { padding: 28px 0 24px; }
.doc-header { margin-bottom: 24px; }
.doc-header h1 { font-size: clamp(28px, 6vw, 38px); line-height: 1.15; letter-spacing: -0.015em; font-weight: 700; margin: 0 0 10px; text-wrap: balance; }
.updated { display: flex; flex-wrap: wrap; gap: 0 14px; color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.lede { font-size: 18.5px; line-height: 1.55; }

/* Table of contents: a compact ordered list of links to the section ids, two columns on a wide screen. */
.toc { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 14px 18px 10px; margin: 0 0 32px; }
.toc-title { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { break-inside: avoid; }
.toc a { display: block; padding: 5px 0; line-height: 1.4; text-decoration: none; color: var(--fg); }
.toc a:hover { color: var(--link); text-decoration: underline; }
.toc .num { color: var(--muted); }
@media (min-width: 720px) { .toc ol { columns: 2; column-gap: 32px; } }

/* Numbered sections. Numbers are literal text in a .num span (they survive copy, print and cross
   references such as "Section 14"); ids are stable slugs, not numbers. */
.clause { margin: 0 0 30px; scroll-margin-top: 12px; }
.clause h2 { font-size: 22px; line-height: 1.3; font-weight: 700; letter-spacing: -0.005em; margin: 0 0 12px; padding-top: 18px; border-top: 1px solid var(--line); text-wrap: balance; }
.clause h3 { font-size: 18px; line-height: 1.35; font-weight: 600; margin: 22px 0 8px; scroll-margin-top: 12px; }
.clause h4 { font-size: 17px; font-weight: 600; margin: 18px 0 6px; }
.num { font-variant-numeric: tabular-nums; margin-right: 0.3em; }
.clause:target > h2, h3:target { background: var(--target); box-shadow: -8px 0 0 var(--target), 8px 0 0 var(--target); border-radius: 2px; }

/* Lists. Plain ul and ol keep browser markers; ol.alpha gives (a) (b) (c) and ol.roman (i) (ii) (iii)
   with a hanging indent, for clause items. */
.doc ul, .doc ol { padding-left: 1.4em; }
.doc li { margin: 0 0 6px; }
.doc li > ul, .doc li > ol { margin: 6px 0 0; }
.doc ol.alpha, .doc ol.roman { list-style: none; padding-left: 2.2em; counter-reset: clause-item; }
.doc ol.alpha > li, .doc ol.roman > li { position: relative; counter-increment: clause-item; }
.doc ol.alpha > li::before { content: "(" counter(clause-item, lower-alpha) ")"; position: absolute; left: -2.2em; width: 2em; }
.doc ol.roman > li::before { content: "(" counter(clause-item, lower-roman) ")"; position: absolute; left: -2.2em; width: 2em; }

/* Callouts: the conspicuous disclaimer, limitation and arbitration notices. Bold body, a heading in
   capitals, a 2px border and a tinted ground, so the text stands apart from the surrounding terms. */
.callout { border: 2px solid var(--callout-edge); background: var(--callout-bg); border-radius: 10px; padding: 14px 16px; font-weight: 600; }
.callout-title { font-size: 15px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 8px; }
.callout p, .callout ul, .callout ol { margin: 0 0 10px; }
.callout > :last-child { margin-bottom: 0; }
.caps { text-transform: uppercase; letter-spacing: 0.01em; }

/* Summary: a plain-English, non-binding overview (the box itself says it is not part of the terms). */
.summary { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 14px 16px; }
.summary-title { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.summary > :last-child { margin-bottom: 0; }

/* Tables (subprocessors, data categories): the wrapper scrolls sideways on a phone, never the page. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table.data { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
table.data caption { caption-side: top; text-align: left; padding: 10px 12px 4px; color: var(--muted); font-size: 14px; }
table.data th, table.data td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
table.data thead th { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); border-bottom: 1px solid var(--edge); white-space: nowrap; }
table.data tbody tr:last-child > * { border-bottom: 0; }
table.data tbody th { font-weight: 600; }

/* Definitions: a term per dt, its meaning in the dd; two columns on a wide screen. */
dl.defs dt { font-weight: 700; margin: 10px 0 2px; }
dl.defs dd { margin: 0 0 6px; }
@media (min-width: 720px) {
  dl.defs { display: grid; grid-template-columns: minmax(140px, max-content) minmax(0, 1fr); gap: 8px 20px; }
  dl.defs dt, dl.defs dd { margin: 0; }
}

/* Contact block (notices, privacy requests, the DMCA agent). */
.contact { font-style: normal; border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 1.5; }

/* Footer: the legal nav again and the copyright line. */
/* Font sizes sit on the children: .wrap's 72ch is measured in the footer's own font, so a smaller
   footer font would narrow the column. */
footer.site { border-top: 1px solid var(--line); color: var(--muted); line-height: 1.6; padding: 12px 0 calc(28px + env(safe-area-inset-bottom, 0px)); }
footer.site .copyright { margin: 8px 0 0; font-size: 14px; }

/* Print: black on white, no navigation, link targets spelled out, notices kept whole. */
@media print {
  :root {
    color-scheme: light;
    --bg: #fff; --surface: #fff; --fg: #000; --muted: #333; --line: #999; --edge: #666;
    --link: #000; --mark-accent: #000; --callout-bg: #fff; --callout-edge: #000; --target: transparent;
  }
  @page { margin: 16mm 14mm; }
  html, body { background: #fff; color: #000; }
  body { font-size: 11pt; line-height: 1.45; display: block; min-height: 0; }
  .wrap { max-width: none; padding: 0; }
  .skip, .topbar .legalnav, footer.site .legalnav { display: none; }
  .topbar { border: 0; }
  .topbar-inner { padding: 0 0 8pt; }
  .mark img { display: none; }
  .doc { padding: 0; }
  .toc { border: 1px solid #999; break-inside: avoid; }
  .toc ol { columns: 2; }
  .clause h2, .clause h3, .clause h4, .callout-title, .summary-title { break-after: avoid; }
  .callout, .summary, .contact, tr, dl.defs dt { break-inside: avoid; }
  .callout { border: 2px solid #000; }
  p, li { orphans: 3; widows: 3; }
  .doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.9em; }
  .doc a[href^="/"]::after { content: " (elemusic.fm" attr(href) ")"; font-size: 0.9em; }
  .table-wrap { overflow: visible; border: 0; }
  table.data { min-width: 0; font-size: 9.5pt; }
  table.data th, table.data td { border-bottom: 1px solid #999; padding: 4pt 6pt; }
  footer.site { border-top: 1px solid #999; padding: 8pt 0 0; }
}
