/* ============================================================
   SP COD Form — Legal pages stylesheet
   Brand tokens mirror the app (Polaris + indigo/violet accent)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root{
  --content: 820px;                 /* reading measure */
  --pad: clamp(20px, 5vw, 56px);    /* fluid gutter     */
  --ink:        #1a1c1d;            /* Polaris text      */
  --ink-soft:   #454749;
  --muted:      #6d7175;
  --line:       #e4e5e7;
  --surface:    #f6f6f7;
  --accent:     #2563eb;            /* app blue          */
  --accent-2:   #7c3aed;            /* app violet        */
  --accent-3:   #22d3ee;            /* cyan highlight    */
  --indigo-50:  #eef2ff;
  --indigo-200: #c7d2fe;
  --indigo-700: #4338ca;
  --slate-900:  #0f172a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 12px 32px -12px rgba(15,23,42,.18);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body{
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: clamp(15.5px, 1.05vw + 13px, 17px);
  line-height: 1.75;
  color: var(--ink-soft);
  background-color: #f8fafc;
  /* layered: dot-grid  +  soft white "sheet" column  +  brand glow  +  base */
  background-image:
    radial-gradient(circle at 1px 1px, rgba(100,116,139,.10) 1px, transparent 0),
    linear-gradient(90deg, transparent 0, rgba(255,255,255,.92) 13%, rgba(255,255,255,.92) 87%, transparent 100%),
    radial-gradient(1100px 520px at 50% -10%, var(--indigo-50) 0%, rgba(238,242,255,0) 62%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  background-size: 24px 24px, auto, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  background-position: 0 0, center top, center top, center top;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection{ background: var(--indigo-200); color: var(--slate-900); }

/* ---------- Constrain every top-level block to the reading column ----------
   (the hero is excluded so it can stay full-bleed) */
body > *:not(#title-block-header){
  width: 100%;
  max-width: calc(var(--content) + 2 * var(--pad));
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ============================================================
   HERO  (pandoc's <header id="title-block-header">)
   ============================================================ */
#title-block-header{
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: clamp(44px, 8vw, 84px) var(--pad) clamp(40px, 7vw, 72px);
  background:
    radial-gradient(680px 320px at 88% -20%, rgba(124,58,237,.55), transparent 60%),
    radial-gradient(560px 300px at 8% 120%, rgba(37,99,235,.55), transparent 60%),
    linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #312e81 100%);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
/* thin brand rule across the very top */
#title-block-header::before{
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2) 50%, var(--accent-3));
}
/* faint grid texture */
#title-block-header::after{
  content: "";
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 75%);
          mask-image: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 75%);
}
#title-block-header h1.title{
  position: relative; z-index: 1;
  max-width: var(--content);
  margin: 0 auto;
  font-size: clamp(28px, 4.4vw, 46px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 1px 24px rgba(2,6,23,.35);
}
/* CSS-only eyebrow so the band reads as branded without touching the HTML */
#title-block-header h1.title::before{
  content: "SP COD FORM  ·  LEGAL DOCUMENT";
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #c7d2fe;
  margin-bottom: 14px;
  text-shadow: none;
}

/* ============================================================
   DOCUMENT TITLE  (the first <h1> inside the column)
   ============================================================ */
body > h1{
  margin: clamp(28px, 5vw, 48px) auto 6px;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -.015em;
  color: var(--ink);
  padding-bottom: 18px;
  position: relative;
}
body > h1::after{                 /* gradient underline */
  content: "";
  position: absolute; left: var(--pad); bottom: 0;
  width: 64px; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* the "SP COD Form" sub-line right under the title */
h2#sp-cod-form{
  margin: 22px auto 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  background: none;
  padding: 0 var(--pad);
  border: 0;
}
h2#sp-cod-form::before{ display: none; }

/* meta row: Effective / Last Updated  ->  label chips + values */
h2#sp-cod-form + p{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 14px auto 8px;
  padding: 14px var(--pad);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: linear-gradient(90deg, var(--indigo-50), rgba(238,242,255,.35));
  border: 1px solid var(--indigo-200);
  border-radius: 12px;
}
h2#sp-cod-form + p br{ display: none; }
h2#sp-cod-form + p strong{
  display: inline-block;
  background: #fff;
  border: 1px solid var(--indigo-200);
  color: var(--indigo-700);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}

/* ============================================================
   SECTION HEADINGS
   ============================================================ */
h2{
  position: relative;
  margin: clamp(34px, 5vw, 52px) auto 14px;
  padding: .55em .9em .55em 1.05em;
  font-size: clamp(19px, 2.1vw, 23px);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
  background: linear-gradient(90deg, var(--indigo-50), rgba(238,242,255,0) 72%);
  border-radius: 10px;
}
h2::before{                        /* accent rail */
  content: "";
  position: absolute; left: 0; top: .35em; bottom: .35em;
  width: 4px; border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

h3{
  position: relative;
  margin: 26px auto 8px;
  padding-left: 14px;
  font-size: clamp(15.5px, 1.4vw, 17.5px);
  font-weight: 700;
  color: var(--ink);
}
h3::before{
  content: "";
  position: absolute; left: 0; top: .28em; bottom: .28em;
  width: 3px; border-radius: 3px;
  background: var(--accent-2);
  opacity: .8;
}

/* ============================================================
   TEXT
   ============================================================ */
p{ margin: 0 auto 1.05em; color: var(--ink-soft); }
p:last-child{ margin-bottom: 0; }
strong{ color: var(--ink); font-weight: 700; }
em{ color: var(--ink); }

a{
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1.5px solid rgba(37,99,235,.32);
  padding-bottom: 1px;
  transition: color .18s ease, border-color .18s ease;
}
a:hover{ color: var(--accent-2); border-color: var(--accent-2); }
a:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================================
   LISTS  (custom gradient markers)
   ============================================================ */
ul, ol{ margin: 0 auto 1.15em; padding-left: 1.5em; }
ul{ list-style: none; padding-left: 1.55em; }
ul > li{ position: relative; margin: .45em 0; padding-left: .35em; }
ul > li::before{
  content: "";
  position: absolute; left: -1.05em; top: .66em;
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
ol > li{ margin: .45em 0; padding-left: .25em; }
ol > li::marker{ color: var(--accent); font-weight: 700; }
li > ul, li > ol{ margin: .4em 0 .2em; }

/* ============================================================
   CODE / QUOTE / RULE / TABLE / MEDIA  (future-proofing)
   ============================================================ */
code{
  font-family: var(--mono);
  font-size: .88em;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--indigo-700);
  padding: .12em .42em;
  border-radius: 6px;
}
pre{
  background: var(--slate-900);
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow: auto;
  box-shadow: var(--shadow);
}
pre code{ background: none; border: 0; color: inherit; padding: 0; font-size: .85em; }
blockquote{
  margin: 1.2em auto;
  padding: .4em 1.1em;
  border-left: 4px solid var(--accent-2);
  background: var(--indigo-50);
  border-radius: 0 10px 10px 0;
  color: var(--ink-soft);
}
hr{ border: 0; height: 1px; margin: 2em auto; background: linear-gradient(90deg, transparent, var(--line) 20% 80%, transparent); }
table{ width: 100%; border-collapse: collapse; margin: 1.2em auto; font-size: .95em; }
th, td{ text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
thead th{ background: var(--surface); color: var(--ink); font-weight: 700; }
img{ max-width: 100%; height: auto; border-radius: 10px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px){
  body > h1::after{ left: var(--pad); }
  h2{ padding: .5em .7em .5em .95em; }
  h2#sp-cod-form + p{ font-size: 12.5px; }
}

/* ============================================================
   ACCESSIBILITY — reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{ transition: none !important; animation: none !important; }
}

/* ============================================================
   PRINT  (clean "Save as PDF" for reviewers)
   ============================================================ */
@page{ margin: 16mm 14mm; }
@media print{
  body{
    background: #fff !important;
    color: #000;
    font-size: 11pt;
    line-height: 1.5;
  }
  #title-block-header{
    background: #fff !important;
    color: #000 !important;
    padding: 0 0 10pt;
    border-bottom: 2pt solid #000;
  }
  #title-block-header::before,
  #title-block-header::after{ display: none !important; }
  #title-block-header h1.title,
  #title-block-header h1.title::before{ color: #000 !important; text-shadow: none; }
  body > *{ max-width: none !important; padding-inline: 0 !important; }
  h2{ background: none !important; color: #000; break-after: avoid; }
  h2::before{ background: #000 !important; }
  h3{ break-after: avoid; }
  p, li{ orphans: 3; widows: 3; }
  ul > li::before{ background: #000 !important; box-shadow: none; }
  a{ color: #000 !important; border: 0 !important; text-decoration: underline; }
  h2#sp-cod-form + p{ background: none !important; border: 0 !important; padding: 0 !important; }
  h2#sp-cod-form + p strong{ border-color: #999 !important; color: #000 !important; }
}
