/* ==========================================================================
   General Science — Legal documents
   "Field Notebook" system: an editorial lab-notebook aesthetic built from
   the app's own brand tokens (teal / amber / warm paper).
   ========================================================================== */

:root {
  --paper: #FAF7F2;
  --paper-alt: #F2ECDE;
  --paper-line: #E4DDC9;
  --ink: #1E2622;
  --ink-soft: #5B6B65;
  --teal: #0F6B5C;
  --teal-dark: #0B4F44;
  --amber: #F2A93B;
  --amber-soft: #FBF0DC;
  --amber-line: #E7C687;
  --clay: #D96C4F;
  --clay-soft: #FBEAE6;
  --outline: #D8DED9;

  --font-display: "Fraunces", "Iowan Old Style", ui-serif, georgia, serif;
  --font-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --measure: 40rem;
  --radius: 14px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Paper grain texture — subtle noise overlay via SVG filter, no external assets */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.06  0 0 0 0 0.15  0 0 0 0 0.12  0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--teal-dark); }
a:hover { color: var(--teal); }

::selection {
  background: var(--amber);
  color: var(--teal-dark);
}

/* ---------- Reading progress bar ---------- */
.progress-rail {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  z-index: 60;
  background: transparent;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--amber), var(--clay));
  transition: width 80ms linear;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 242, 0.86);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid var(--outline);
}
.site-header__inner {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}
.brand__mark {
  width: 34px;
  height: 34px;
  flex: none;
}
.brand__word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.18rem;
  letter-spacing: -0.01em;
  color: var(--teal-dark);
}
.brand__tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 1px;
}

.doc-switch {
  display: flex;
  background: var(--paper-alt);
  border: 1px solid var(--outline);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.doc-switch a {
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}
.doc-switch a:hover { color: var(--teal-dark); }
.doc-switch a.is-active {
  background: var(--teal-dark);
  color: var(--paper);
}

/* ---------- Layout shell ---------- */
.shell {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
  position: relative;
  z-index: 1;
}

/* ---------- Hero ---------- */
.hero {
  padding: 4.2rem 0 2.6rem;
  border-bottom: 1px dashed var(--outline);
  margin-bottom: 2.8rem;
  position: relative;
}
.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
  animation: rise 0.7s ease both;
}
.hero__eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 5.4vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 0 0 1.1rem;
  color: var(--teal-dark);
  animation: rise 0.7s 0.05s ease both;
}
.hero__lede {
  max-width: 40rem;
  font-size: 1.12rem;
  color: var(--ink-soft);
  margin: 0 0 1.8rem;
  animation: rise 0.7s 0.1s ease both;
}
.stamp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
  animation: rise 0.7s 0.16s ease both;
}
.stamp {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--clay);
  border: 1.5px dashed var(--clay);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  transform: rotate(-2deg);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.stamp strong { color: var(--clay); font-weight: 700; }
.hero__meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

/* Plain-English summary callout */
.tldr {
  margin-top: 2.2rem;
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  max-width: 44rem;
  animation: rise 0.7s 0.22s ease both;
}
.tldr__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a5300;
  margin-bottom: 0.5rem;
  display: block;
}
.tldr ul {
  margin: 0;
  padding-left: 1.1rem;
}
.tldr li { margin-bottom: 0.35rem; }
.tldr li:last-child { margin-bottom: 0; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Content grid ---------- */
.doc-grid {
  display: grid;
  grid-template-columns: 15rem minmax(0, var(--measure));
  gap: 3.2rem;
  align-items: start;
}

/* Sticky index / ToC, styled like binder tabs */
.toc {
  position: sticky;
  top: 5.2rem;
  align-self: start;
}
.toc__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.9rem;
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--outline);
}
.toc li { margin: 0; }
.toc a {
  display: block;
  text-decoration: none;
  padding: 0.5rem 0 0.5rem 1rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 0.87rem;
  color: var(--ink-soft);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.toc a .num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--amber-line);
  margin-right: 0.5rem;
}
.toc a:hover { color: var(--ink); }
.toc a.is-active {
  color: var(--teal-dark);
  border-left-color: var(--teal);
  font-weight: 600;
}
.toc a.is-active .num { color: var(--teal); }

.toc__contact {
  margin-top: 2rem;
  padding-top: 1.3rem;
  border-top: 1px dashed var(--outline);
}
.toc__contact a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--teal-dark);
  text-decoration: none;
  font-weight: 600;
}
.toc__contact a:hover { color: var(--teal); }

/* Mobile ToC (details/summary) */
.toc-mobile { display: none; }

/* ---------- Article body ---------- */
article.doc {
  min-width: 0;
}
.doc section {
  padding-top: 0.3rem;
  margin-bottom: 3rem;
  scroll-margin-top: 5.5rem;
}
.doc section:last-of-type { margin-bottom: 0.5rem; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin-bottom: 1rem;
}
.section-head .tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  border-radius: 6px;
  padding: 0.1rem 0.45rem;
  flex: none;
}
.doc h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.55rem;
  letter-spacing: -0.01em;
  color: var(--teal-dark);
  margin: 0;
}
.doc h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.12rem;
  color: var(--ink);
  margin: 1.6rem 0 0.6rem;
}
.doc p { margin: 0 0 1rem; color: var(--ink); }
.doc p.soft { color: var(--ink-soft); }
.doc ul, .doc ol.plain {
  margin: 0 0 1.1rem;
  padding-left: 1.3rem;
}
.doc li { margin-bottom: 0.5rem; }
.doc li:last-child { margin-bottom: 0; }
.doc strong { color: var(--teal-dark); }

dfn {
  font-style: normal;
  font-weight: 600;
  border-bottom: 1.5px dotted var(--teal);
  color: var(--teal-dark);
}

/* data table for "what we collect" */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.2rem;
  font-size: 0.92rem;
  border: 1px solid var(--outline);
  border-radius: 10px;
  overflow: hidden;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--outline);
  vertical-align: top;
}
.data-table th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--paper-alt);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table td:first-child { color: var(--teal-dark); font-weight: 600; white-space: nowrap; }

/* callout variants */
.callout {
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 0 0 1.3rem;
  border: 1px solid var(--outline);
  border-left-width: 4px;
}
.callout__label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.4rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout--info {
  background: #EEF6F3;
  border-color: var(--outline);
  border-left-color: var(--teal);
}
.callout--info .callout__label { color: var(--teal-dark); }
.callout--warn {
  background: var(--clay-soft);
  border-left-color: var(--clay);
}
.callout--warn .callout__label { color: var(--clay); }
.callout--amber {
  background: var(--amber-soft);
  border-left-color: var(--amber);
}
.callout--amber .callout__label { color: #8a5300; }

.divider-icon {
  display: block;
  margin: 2.6rem 0;
  color: var(--amber-line);
  text-align: center;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--outline);
  margin-top: 3rem;
  padding-top: 2.4rem;
}
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
}
.footer-contact h4 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--teal-dark);
  margin: 0 0 0.5rem;
}
.footer-contact p { color: var(--ink-soft); max-width: 26rem; margin: 0 0 1rem; }
.mail-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--teal-dark);
  color: var(--paper) !important;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  transition: background 0.2s ease, transform 0.2s ease;
}
.mail-btn:hover { background: var(--teal); transform: translateY(-1px); }
.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--teal-dark); }
.footer-legal {
  margin-top: 2.4rem;
  padding-top: 1.4rem;
  border-top: 1px dashed var(--outline);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .doc-grid { grid-template-columns: 1fr; gap: 1.6rem; }
  .toc { display: none; }
  .toc-mobile {
    display: block;
    position: sticky;
    top: 4rem;
    z-index: 20;
    background: var(--paper);
    border: 1px solid var(--outline);
    border-radius: 12px;
    margin-bottom: 1rem;
  }
  .toc-mobile summary {
    list-style: none;
    cursor: pointer;
    padding: 0.8rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--teal-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile[open] summary { border-bottom: 1px solid var(--outline); }
  .toc-mobile ol {
    list-style: none;
    margin: 0;
    padding: 0.4rem 0.4rem 0.8rem;
  }
  .toc-mobile a {
    display: block;
    padding: 0.5rem 0.6rem;
    text-decoration: none;
    color: var(--ink-soft);
    font-size: 0.9rem;
    border-radius: 8px;
  }
  .toc-mobile a .num { font-family: var(--font-mono); color: var(--amber-line); margin-right: 0.5rem; font-size: 0.75rem; }
  .toc-mobile a:hover { background: var(--paper-alt); }
  .site-header__inner { padding: 0.75rem 1.1rem; }
  .brand__word { font-size: 1.02rem; }
  .doc-switch a { padding: 0.4rem 0.65rem; font-size: 0.66rem; }
  .hero { padding: 2.6rem 0 1.8rem; }
}

@media (max-width: 480px) {
  .stamp-row { gap: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
