/* ==========================================================================
   Dillett Labs — Compliance Hub
   Shared stylesheet. Dependency-free. WCAG-conscious.
   Visual language adapted from mydillettlabs.com brand tokens.
   ========================================================================== */

@font-face { font-family: "Inter"; src: url("../assets/Inter-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../assets/Inter-SemiBold.otf") format("opentype"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Jost"; src: url("../assets/Jost-Variable.ttf") format("truetype"); font-weight: 500 800; font-display: swap; }

:root {
  /* Brand tokens (from mydillettlabs.com computed styles) */
  --bg: #090c15;
  --bg-2: #0d111c;
  --card: #111522;
  --card-2: #151a28;
  --fg: #f0f2f5;
  --muted: #9da1af;        /* contrast vs --bg ~7.6:1 (passes AAA) */
  --muted-strong: #b8bdc9; /* higher-emphasis secondary text */
  --border: #20273c;
  --border-strong: #2b3450;
  --primary: #ebebeb;
  --accent: #d7c9a3;       /* warm "longevity gold" accent for links/brand */
  --accent-ink: #1b160d;
  --danger: #ec7979;

  /* Draft treatment */
  --draft-bg: #2a2110;
  --draft-border: #c9a227;
  --draft-fg: #ffe9a8;

  /* Layout */
  --radius: 14px;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --maxw: 1180px;
  --reading: 760px;
  --nav-h: 68px;

  --sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --serif: "Jost", Inter, system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
  overflow-x: hidden;
}

h1, h2, h3, h4, .serif, .brand-name {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: #fff;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 0.4em; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); margin: 2.2em 0 0.6em; }
h3 { font-size: clamp(1.2rem, 2.4vw, 1.4rem); margin: 1.8em 0 0.5em; }
h4 { font-size: 1.05rem; margin: 1.6em 0 0.5em; }
p { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.4em; }
li { margin: 0 0 0.5em; }
strong { font-weight: 600; color: #fff; }
small { font-size: 0.85em; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

/* --------------------------------------------------- Accessibility utils */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 1000;
  background: #fff;
  color: #060c16;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: top 0.18s ease;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===================================================== Background aura */
.bg-aura {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.bg-aura::before, .bg-aura::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
}
.bg-aura::before {
  width: 540px; height: 540px;
  top: -140px; left: -160px;
  background: radial-gradient(circle, rgba(31, 77, 122, 0.5), transparent 65%);
}
.bg-aura::after {
  width: 640px; height: 640px;
  bottom: -220px; right: -180px;
  background: radial-gradient(circle, rgba(28, 78, 95, 0.4), transparent 65%);
}

/* ===================================================== Site header / nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 12, 21, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--fg);
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  width: clamp(120px, 18vw, 168px);
  height: auto;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: 0.02em;
}

/* Primary nav — desktop */
.primary-nav {
  margin-left: auto;
}
.primary-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.primary-nav a {
  display: inline-block;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 0.86rem;
  color: var(--muted-strong);
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.primary-nav a:hover {
  background: var(--card);
  color: #fff;
  text-decoration: none;
}
.primary-nav a[aria-current="page"] {
  color: #fff;
  background: var(--card-2);
}

/* Mobile nav toggle — works without JS via <details> */
.nav-toggle {
  display: none;
  margin-left: auto;
}
.nav-toggle summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--fg);
  font-size: 0.85rem;
  font-weight: 600;
}
.nav-toggle summary::-webkit-details-marker { display: none; }
.nav-toggle summary svg { width: 18px; height: 18px; }

@media (max-width: 940px) {
  .primary-nav { display: none; }
  .nav-toggle { display: block; }
  .nav-toggle[open] .mobile-nav {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px 20px;
  }
  .nav-toggle[open] .mobile-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .nav-toggle[open] .mobile-nav a {
    padding: 12px 14px;
    font-size: 0.95rem;
  }
}

/* ===================================================== Layout shells */
.shell {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  flex-direction: column;
}
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* Hero band on hub index */
.hero {
  position: relative;
  padding: clamp(56px, 9vw, 96px) 0 clamp(36px, 6vw, 64px);
  text-align: center;
  background:
    linear-gradient(180deg, rgba(9, 12, 21, 0.62) 0%, rgba(9, 12, 21, 0.9) 420px, var(--bg) 680px),
    url("../assets/hero-bg.webp") top center / 1600px auto no-repeat,
    var(--bg);
  border-bottom: 1px solid var(--border);
}
.hero__eyebrow {
  display: inline-block;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 18px;
}
.hero__title {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  margin: 0 auto 0.5em;
  max-width: 16ch;
}
.hero__lede {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted-strong);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

/* ===================================================== Draft banner */
.draft-banner {
  background: linear-gradient(180deg, rgba(42, 33, 16, 0.96), rgba(34, 27, 12, 0.96));
  border-bottom: 1px solid var(--draft-border);
  color: var(--draft-fg);
}
.draft-banner__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
}
.draft-banner__icon {
  flex-shrink: 0;
  width: 22px; height: 22px;
  color: var(--draft-fg);
}
.draft-banner strong { color: var(--draft-fg); }
.draft-banner a { color: #fff; text-decoration: underline; }

/* Inline draft badge near titles */
.draft-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--draft-border);
  background: rgba(201, 162, 39, 0.14);
  color: var(--draft-fg);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

/* ===================================================== Hub card grid */
.policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
  margin-top: 12px;
}
.policy-card {
  display: flex;
  flex-direction: column;
  padding: 26px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  text-decoration: none;
  color: var(--fg);
  min-height: 100%;
}
.policy-card:hover, .policy-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.policy-card__icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--accent);
  margin-bottom: 16px;
}
.policy-card__icon svg { width: 22px; height: 22px; }
.policy-card__title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
  margin: 0 0 8px;
}
.policy-card__desc {
  color: var(--muted-strong);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 0 16px;
  flex: 1;
}
.policy-card__cta {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.policy-card__tag {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  margin-bottom: 14px;
}
.policy-card__tag[data-tag="data"] {
  color: #a9d6c0; border-color: rgba(120, 190, 160, 0.4);
}
.policy-card__tag[data-tag="legal"] {
  color: #c7b8e8; border-color: rgba(150, 130, 200, 0.4);
}

/* ===================================================== Article / policy page */
.article {
  padding: clamp(40px, 6vw, 72px) 0 64px;
}
.article__head {
  max-width: var(--reading);
  margin: 0 auto 8px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.article__eyebrow {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  display: block;
  margin-bottom: 12px;
}
.article__title {
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
  margin: 0 0 10px;
}
.article__meta {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0;
}
.prose {
  max-width: var(--reading);
  margin: 32px auto 0;
}
.prose > p,
.prose > ul,
.prose > ol { margin-bottom: 1.15em; }
.prose h2 { padding-top: 6px; }
.prose h2:first-child { margin-top: 0; }

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 24px;
}
.back-link:hover { color: #fff; text-decoration: none; }

/* Callout boxes */
.callout {
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--card);
  margin: 1.6em 0;
}
.callout--warning {
  border-color: rgba(201, 162, 39, 0.5);
  background: rgba(42, 33, 16, 0.4);
}
.callout--info {
  border-color: rgba(120, 150, 200, 0.4);
  background: rgba(24, 38, 64, 0.4);
}
.callout__title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-strong);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.callout__title svg { width: 16px; height: 16px; }

/* Placeholder chip for unconfirmed facts */
.ph {
  background: rgba(201, 162, 39, 0.16);
  color: var(--draft-fg);
  padding: 1px 6px;
  border-radius: 5px;
  font-weight: 500;
  font-size: 0.92em;
  white-space: nowrap;
}
.ph-inline {
  border-bottom: 2px dotted var(--draft-border);
}

/* Definition / key-value list */
dl.kv {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 10px 20px;
  margin: 1.4em 0;
}
dl.kv dt {
  font-weight: 600;
  color: var(--muted-strong);
  font-size: 0.9rem;
}
dl.kv dd { margin: 0; }
@media (max-width: 540px) {
  dl.kv { grid-template-columns: 1fr; gap: 4px; }
  dl.kv dt { margin-top: 8px; }
}

/* Data-flow distinction panel */
.dual-flow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 1.6em 0;
}
.flow-card {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--card);
}
.flow-card h4 {
  margin: 0 0 10px;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-strong);
}
.flow-card--marketing h4 { color: var(--accent); }
.flow-card--health h4 { color: #a9d6c0; }
.flow-card ul { margin: 0; padding-left: 1.1em; font-size: 0.9rem; }
@media (max-width: 620px) {
  .dual-flow { grid-template-columns: 1fr; }
}

/* Table */
.table-wrap { overflow-x: auto; margin: 1.4em 0; }
table.policy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 460px;
}
.policy-table th, .policy-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.policy-table th {
  font-weight: 600;
  color: var(--muted-strong);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--card);
}

/* Last-updated bar + on-this-page */
.article__utilities {
  max-width: var(--reading);
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.84rem;
}
.toc { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.toc a { color: var(--muted-strong); font-size: 0.84rem; }
.toc a:hover { color: #fff; }

/* ===================================================== Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 48px 0 30px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 32px;
}
.footer-brand .brand-logo { width: 150px; margin-bottom: 14px; }
.footer-brand p { color: var(--muted); font-size: 0.88rem; max-width: 30ch; margin: 0; }
.footer-col h4 {
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-strong);
  margin: 0 0 14px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 0 0 9px; }
.footer-col a { color: var(--muted); font-size: 0.9rem; }
.footer-col a:hover { color: #fff; }
.footer-link-button { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: .9rem; padding: 0; }
.footer-link-button:hover { color: #fff; text-decoration: underline; }
.footer-fda {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}
.footer-fda p { margin: 0 0 6px; }
.footer-bottom {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.footer-draft {
  color: var(--draft-fg);
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
}

/* Back-to-top */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 90;
  cursor: pointer;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { border-color: var(--accent); color: var(--accent); }
.to-top svg { width: 20px; height: 20px; }

/* ------------------------------------------------------- Motion prefs */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .policy-card:hover { transform: none; }
}

/* ------------------------------------------------------- Print */
@media print {
  .site-header, .to-top, .nav-toggle, .draft-banner, .back-link, .primary-nav, .consent-banner, .consent-backdrop { display: none !important; }
  body { background: #fff; color: #000; }
  .article__head { border-color: #999; }
  h1, h2, h3 { color: #000; }
  a { color: #000; text-decoration: underline; }
}

/* Cookie consent preview */
.consent-banner { position: fixed; z-index: 1000; left: 18px; right: 18px; bottom: 18px; max-width: 760px; margin: 0 auto; padding: 20px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #111522; box-shadow: var(--shadow); }
.consent-banner h2, .consent-modal h2 { margin: 0 0 8px; font: 700 1.25rem var(--serif); }
.consent-banner p { color: var(--muted-strong); font-size: .92rem; margin: 0 0 14px; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.consent-btn { border: 1px solid var(--border-strong); border-radius: 9px; background: var(--card-2); color: var(--fg); cursor: pointer; font: 600 .88rem var(--sans); padding: 10px 15px; }
.consent-btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.consent-btn:focus-visible, .footer-link-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.consent-backdrop { position: fixed; z-index: 1001; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.72); }
.consent-modal { width: min(620px, 100%); max-height: 90vh; overflow: auto; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--card); padding: 24px; box-shadow: var(--shadow); }
.consent-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; padding: 16px 0; border-top: 1px solid var(--border); }
.consent-row h3 { margin: 0 0 4px; font: 600 1rem var(--sans); }
.consent-row p { color: var(--muted); font-size: .84rem; margin: 0; }
.consent-row input { width: 22px; height: 22px; accent-color: var(--accent); }
.consent-note { color: var(--draft-fg); font-size: .78rem; }
[hidden] { display: none !important; }
