/* =============================================================================
   Archangel legal document stylesheet.
   Blue Mobile standard.

   Three view modes:
     * web    — dark cosmic, glass-morphism header, breathing rhythm.
     * print  — high-contrast black-on-white, generous margins, page breaks.
     * court  — @media print with hyperlinks resolved as footnotes, monospace
                for defined terms, per-page numbering, XRYSTAL hash in header.

   No page describes proprietary mechanisms. Every clause describes outcomes.
   ========================================================================== */

:root {
  color-scheme: dark;
  --ink-abyss:  #030410;
  --ink-cosmos: #05060f;
  --ink-navy:   #0a0f1d;
  --ink-panel:  rgba(20, 26, 46, 0.62);
  --line-soft:  rgba(206, 218, 246, 0.10);
  --line-hard:  rgba(206, 218, 246, 0.22);
  --text-lo:    rgba(232, 236, 245, 0.55);
  --text-mid:   rgba(232, 236, 245, 0.80);
  --text-hi:    #e8ecf5;
  --text-max:   #f4f6fb;
  --aqua:       #4a9eff;
  --aurora:     #a078ff;
  --font-display: 'Cinzel', 'DM Serif Display', Georgia, serif;
  --font-heading: 'DM Serif Display', Georgia, serif;
  --font-body:    'Syne', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono:    'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--ink-abyss);
  color: var(--text-hi);
  font-family: var(--font-body);
  line-height: 1.72;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Cosmic background (still, so text stays legible on long docs). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1400px 1000px at 22% 18%, rgba(74,158,255,0.14) 0%, rgba(74,158,255,0) 55%),
    radial-gradient(1200px 900px at 78% 82%, rgba(160,120,255,0.10) 0%, rgba(160,120,255,0) 60%),
    radial-gradient(1800px 1400px at 50% 50%, var(--ink-navy) 0%, var(--ink-cosmos) 55%, var(--ink-abyss) 100%);
  pointer-events: none;
}

/* Skip-nav */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.skip-nav {
  position: absolute;
  left: 50%; top: -200px;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: var(--aqua);
  color: var(--ink-cosmos);
  border-radius: 0 0 12px 12px;
  font-weight: 700;
  text-decoration: none;
  z-index: 10000;
  transition: top 160ms ease;
}
.skip-nav:focus { top: 0; }

/* Sticky header — glass-morphism */
.doc-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, rgba(5,6,15,0.85) 0%, rgba(5,6,15,0.35) 100%);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.doc-header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}
.doc-back,
.doc-print {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-hard);
  background: rgba(15,22,44,0.55);
  color: var(--text-hi);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}
.doc-back:hover, .doc-print:hover,
.doc-back:focus-visible, .doc-print:focus-visible {
  background: rgba(30, 40, 70, 0.72);
  border-color: var(--aqua);
  outline: none;
}
.doc-eyebrow {
  font-family: var(--font-display);
  letter-spacing: 0.30em;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-max);
  text-align: center;
}

/* Main article */
.doc {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}
.doc-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(28px, 5vmin, 44px);
  color: var(--text-max);
  margin: 0 0 8px;
  line-height: 1.15;
}
.doc-sub {
  color: var(--text-mid);
  font-size: 15px;
  margin: 0 0 8px;
}
.doc-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 4px 22px;
  color: var(--text-lo);
  font-size: 13px;
  font-family: var(--font-mono);
  margin: 4px 0 24px;
  letter-spacing: 0.04em;
}
.doc-meta strong { color: var(--text-mid); font-weight: 600; margin-right: 6px; }

.doc-toc {
  margin: 24px 0 32px;
  padding: 22px 24px;
  border-radius: 16px;
  background: var(--ink-panel);
  border: 1px solid var(--line-soft);
}
.doc-toc h2 {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--aqua);
  margin: 0 0 12px;
  text-transform: uppercase;
}
.doc-toc ol {
  margin: 0;
  padding-left: 22px;
  color: var(--text-mid);
  font-size: 14px;
  line-height: 1.85;
}
.doc-toc a {
  color: var(--text-hi);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 160ms, color 160ms;
}
.doc-toc a:hover, .doc-toc a:focus-visible {
  color: var(--aqua);
  border-color: var(--aqua);
  outline: none;
}

.doc h2.section {
  font-family: var(--font-heading);
  font-size: 24px;
  color: var(--text-max);
  margin: 40px 0 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.doc h3.subsection {
  font-family: var(--font-heading);
  font-size: 18px;
  color: var(--text-max);
  margin: 22px 0 4px;
}
.doc h4.clause {
  font-family: var(--font-heading);
  font-size: 15px;
  color: var(--text-max);
  margin: 18px 0 2px;
}
.doc p, .doc li {
  color: var(--text-hi);
  font-size: 16px;
  line-height: 1.72;
}
.doc ul, .doc ol { padding-left: 24px; }
.doc li { margin-bottom: 6px; }
.doc strong { color: var(--text-max); }
.doc a {
  color: var(--aqua);
  text-decoration: none;
  border-bottom: 1px solid rgba(74,158,255,0.35);
  transition: border-color 160ms;
}
.doc a:hover, .doc a:focus-visible { border-color: var(--aqua); outline: none; }

.definition {
  font-family: var(--font-mono);
  color: var(--text-max);
  background: rgba(74,158,255,0.14);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 14px;
}

.notice {
  margin: 24px 0;
  padding: 18px 22px;
  border-radius: 14px;
  background: rgba(74,158,255,0.10);
  border-left: 3px solid var(--aqua);
  color: var(--text-hi);
  font-size: 15px;
}
.notice-strong {
  background: rgba(160,120,255,0.10);
  border-left-color: var(--aurora);
}

.doc-signblock {
  margin-top: 40px;
  padding: 24px;
  border-radius: 16px;
  background: var(--ink-panel);
  border: 1px solid var(--line-hard);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-mid);
  letter-spacing: 0.04em;
}
.doc-signblock strong { color: var(--text-max); }
.doc-hash {
  margin-top: 8px;
  color: var(--text-lo);
  font-size: 11px;
  letter-spacing: 0.16em;
}

/* Footer */
.doc-footer {
  border-top: 1px solid var(--line-soft);
  padding: 24px;
  text-align: center;
  color: var(--text-lo);
  font-size: 12px;
  background: linear-gradient(0deg, rgba(3,4,16,0.9), rgba(5,6,15,0.55));
}
.doc-footer a { color: var(--text-hi); text-decoration: none; }
.doc-footer a:hover, .doc-footer a:focus-visible { color: var(--aqua); outline: none; }

/* ---------- Print / court view ------------------------------------------- */
@media print {
  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt;
    line-height: 1.5;
  }
  body::before { display: none; }
  .doc-header, .doc-footer, .doc-back, .doc-print, .skip-nav { display: none !important; }
  .doc { max-width: none; margin: 0; padding: 0.5in 0.75in; }
  .doc-title { color: #000; font-size: 22pt; }
  .doc-sub, .doc-meta, .doc h2.section, .doc h3.subsection, .doc h4.clause,
  .doc p, .doc li, .doc strong { color: #000 !important; }
  .doc h2.section { border-top: 1px solid #000; margin-top: 24pt; }
  .doc a { color: #000 !important; border-bottom: none; }
  .doc a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #333; }
  .doc-toc { background: none; border: 1px solid #000; }
  .doc-toc a { color: #000; }
  .notice, .doc-signblock { background: none; border: 1px solid #000; color: #000; }
  .definition { background: none; border-bottom: 1px solid #000; color: #000; }

  /* Court mode — page numbering, XRYSTAL hash header, defined-terms mono */
  @page {
    size: letter;
    margin: 0.75in;
    @top-left  { content: "White Crown Enterprises — Archangel"; font-family: 'Cinzel', serif; font-size: 9pt; color: #333; }
    @top-right { content: "XRYSTAL: " attr(data-xrystal); font-family: 'DM Mono', monospace; font-size: 8pt; color: #333; }
    @bottom-center { content: "Page " counter(page) " of " counter(pages); font-family: 'DM Mono', monospace; font-size: 9pt; color: #333; }
  }
}
