/* ─────────────────────────────────────────
   Smart Inventory — shared subpage styles

   Source: design handoff (May 2026). The :root token block from the original
   file is intentionally omitted here — design tokens come from
   design-tokens.css, imported below to make the dependency explicit.

   Tracking: GitHub issue #838 (umbrella) and per-page child issues.
───────────────────────────────────────── */

@import url('design-tokens.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── NAV ─────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 0 max(24px, 5%);
  height: 68px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(15,30,80,0.06);
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}
.nav-brand,
.nav-brand:hover,
.nav-brand:focus-visible,
.nav-brand * { text-decoration: none !important; }
.nav-brand img { width: 38px; height: 38px; border-radius: 9px; box-shadow: 0 4px 12px rgba(11,30,90,0.18); }
.nav-brand span { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a {
  font-size: 14.5px; font-weight: 500; color: var(--ink); opacity: 0.78;
  text-decoration: none;
  /* Tap-target padding so the clickable area meets WCAG 2.5.5 (44x44px).
     The text itself is ~22px tall; adding 11px above and below brings the
     element's hit-box to 44px without affecting the visual line height. */
  padding-block: 11px;
  display: inline-flex;
  align-items: center;
}
.nav-links a:hover { opacity: 1; text-decoration: none; }

/* ── SKIP-TO-CONTENT LINK ─────────────────────────────
   WCAG 2.4.1 (Level A): a keyboard user must be able to skip the long
   navigation chrome and jump straight to <main>. Hidden off-screen by
   default; appears at the top-left of the viewport on keyboard focus. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--ink, #0A1628);
  color: #fff;
  padding: 10px 18px;
  font-family: var(--font-sans, 'DM Sans', sans-serif);
  font-size: 14px;
  font-weight: 600;
  border-radius: 0 0 8px 0;
  text-decoration: none;
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 0;
  outline: 2px solid var(--blue, #1E5FE6);
  outline-offset: 2px;
}
.nav-cta {
  display: flex; align-items: center; gap: 10px;
}
.nav-cta a.secondary {
  font-size: 14px; font-weight: 600; color: var(--ink); opacity: 0.78;
  padding: 8px 14px; border-radius: 10px; text-decoration: none;
}
.nav-cta a.primary {
  background: linear-gradient(135deg, var(--blue), var(--red));
  color: #fff; font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 10px; text-decoration: none;
  box-shadow: 0 6px 20px rgba(30,95,230,0.35);
  transition: transform 0.15s;
}
.nav-cta a.primary:hover { transform: translateY(-1px); text-decoration: none; }

/* ── PAGE HEADER (hero strip) ────────────────────────── */
.page-hero {
  background: linear-gradient(140deg, var(--blueDark) 0%, var(--blueDeep) 50%, #2a0d4a 100%);
  color: #fff;
  padding: 140px 5% 80px;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  pointer-events: none;
}
.page-hero-inner {
  max-width: 900px; margin: 0 auto;
  position: relative; z-index: 1;
}
.page-hero .crumbs {
  display: flex; align-items: center; gap: 8px;
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 24px;
}
.page-hero .crumbs a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
}
.page-hero .crumbs a:hover { color: #fff; }
.page-hero .crumbs span { opacity: 0.4; }
.page-hero h1 {
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-bottom: 16px;
  text-wrap: balance;
}
.page-hero .lead {
  font-size: 18px;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  max-width: 640px;
}
.page-hero .meta {
  margin-top: 24px;
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.06em;
}

/* ── CONTENT ────────────────────────────────────────── */
.page-content {
  max-width: 840px;
  margin: 0 auto;
  padding: 80px 5%;
}
.page-content h2 {
  font-size: 28px; font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin: 56px 0 20px;
  scroll-margin-top: 100px;
}
.page-content h2:first-child { margin-top: 0; }
.page-content h3 {
  font-size: 19px; font-weight: 600;
  color: var(--ink);
  margin: 32px 0 12px;
  letter-spacing: -0.01em;
}
.page-content p, .page-content li {
  font-size: 16px;
  color: var(--ink2);
  line-height: 1.75;
  margin-bottom: 14px;
}
.page-content ul, .page-content ol { padding-left: 24px; margin-bottom: 14px; }
.page-content strong { color: var(--ink); font-weight: 600; }
.page-content code {
  font-family: 'DM Mono', monospace;
  background: var(--surface2);
  padding: 2px 6px; border-radius: 4px;
  font-size: 14px; color: var(--blueDeep);
}

/* TOC (anchor list) */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 48px;
}
.toc-title {
  font-family: 'DM Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink3); font-weight: 600;
  margin-bottom: 12px;
}
.toc ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 32px; }
.toc li { margin-bottom: 8px; }
.toc a {
  display: block; padding: 4px 0;
  font-size: 14.5px; color: var(--ink2);
  border-radius: 4px;
}
.toc a:hover { color: var(--blue); text-decoration: none; }

@media (max-width: 600px) {
  .toc ul { columns: 1; }
}

/* FAQ accordion */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.faq-item[open] {
  border-color: rgba(30,95,230,0.4);
  box-shadow: 0 4px 16px rgba(30,95,230,0.08);
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  font-size: 16.5px; font-weight: 600; color: var(--ink);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff; color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 400; line-height: 1;
  transition: all 0.2s;
}
.faq-item[open] summary::after {
  background: var(--blue); color: #fff;
  transform: rotate(45deg);
}
.faq-body {
  padding: 0 24px 22px;
  font-size: 15px; color: var(--ink2); line-height: 1.75;
}
.faq-body p, .faq-body ul, .faq-body ol { font-size: 15px; }
.faq-body :first-child { margin-top: 0; }
.faq-body :last-child { margin-bottom: 0; }

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(11,30,90,0.08);
}
.card-title {
  font-size: 16px; font-weight: 700;
  color: var(--ink); letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.card-meta {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--blue); letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.card-desc {
  font-size: 13.5px; color: var(--ink2);
  line-height: 1.6;
}
.card a {
  margin-top: 12px;
  display: inline-block;
  font-size: 13px; font-weight: 600;
  color: var(--blue);
}

/* Boxed info/contact card inside .page-content. Replaces the per-page inline
   `background:var(--surface)` style so the box gets a real dark-mode override
   (the --surface/--border tokens have no dark value; #2140). Text colour is
   inherited from `.page-content p/strong`, which is already mode-correct. */
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}
/* faq.html "still have questions" variant. */
.info-card.is-centered {
  margin-top: 64px;
  font-size: 15px;
  text-align: center;
}

/* CTA strip */
.cta-strip {
  background: linear-gradient(135deg, var(--blueDark), var(--blueDeep) 50%, #2a0d4a);
  color: #fff;
  padding: 64px 5%;
  text-align: center;
  position: relative; overflow: hidden;
}
.cta-strip h2 {
  color: #fff;
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}
.cta-strip p {
  font-size: 17px; color: rgba(255,255,255,0.7);
  max-width: 520px; margin: 0 auto 28px;
}
.cta-strip .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta-btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; color: var(--blueDark);
  padding: 12px 22px; border-radius: 12px;
  font-weight: 700; font-size: 15px;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}
.cta-btn-primary:hover { transform: translateY(-2px); text-decoration: none; }
.cta-btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  color: #fff;
  padding: 12px 22px; border-radius: 12px;
  font-weight: 600; font-size: 15px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(8px);
}
.cta-btn-secondary:hover { background: rgba(255,255,255,0.08); text-decoration: none; }

/* FOOTER */
.footer {
  background: #040712;
  padding: 56px 5% 32px;
  color: rgba(255,255,255,0.7);
}
.footer-inner { max-width: 1280px; margin: 0 auto; }
.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; text-decoration: none; }
.footer-brand,
.footer-brand:hover,
.footer-brand:focus-visible,
.footer-brand * { text-decoration: none !important; }
.footer-brand img { width: 34px; height: 34px; border-radius: 8px; }
.footer-brand span { color: #fff; font-weight: 700; font-size: 16px; }
.footer-desc { color: rgba(255,255,255,0.45); font-size: 14px; max-width: 300px; line-height: 1.65; }
.footer-col-title {
  color: rgba(255,255,255,0.4);
  font-family: 'DM Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 18px; font-weight: 600;
}
.footer-col-links { display: flex; flex-direction: column; gap: 11px; }
.footer-col-links a {
  color: rgba(255,255,255,0.7); font-size: 14px; text-decoration: none;
  transition: color 0.2s;
}
.footer-col-links a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  padding-top: 24px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 14px;
}
.footer-bottom span { color: rgba(255,255,255,0.3); font-size: 13px; font-family: 'DM Mono', monospace; }
.footer-bottom span:last-child { color: rgba(255,255,255,0.25); font-size: 11.5px; font-family: inherit; }

@media (max-width: 900px) {
  .nav-links { display: none; }
  .footer-top { grid-template-columns: 1fr 1fr; gap: 32px; }
  .page-hero h1 { font-size: 40px; }
}

/* ── MOBILE HAMBURGER (≤900px) ──────────────────────────
   Design handoff README §11 — the prototype omits a mobile menu; this is the
   project's implementation. Driven by web/public/web/js/subpage-nav.js. */
.nav-toggle {
  display: none;
  background: transparent; border: 0; padding: 8px;
  margin-left: 8px; cursor: pointer; color: var(--ink);
}
.nav-toggle svg { display: block; }
.nav-drawer {
  display: none;
  position: fixed; top: 68px; left: 0; right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(15,30,80,0.06);
  padding: 16px max(24px, 5%); z-index: 99;
  flex-direction: column; gap: 4px;
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px; font-weight: 500;
  color: var(--ink); opacity: 0.85;
  text-decoration: none; padding: 12px 4px;
  border-bottom: 1px solid rgba(15,30,80,0.05);
}
.nav-drawer a:last-child { border-bottom: 0; }
.nav-drawer a:hover { color: var(--blue); opacity: 1; }
@media (max-width: 900px) {
  .nav-cta a.secondary { display: none; }
  .nav-cta a.primary { display: none; }
  .nav-toggle { display: inline-flex; }
}


/* ── DARK MODE ─────────────────────────────────────────
   Auto-applies on FAQ, Privacy, Terms, Acknowledgments pages whenever the
   user's OS prefers dark. Page hero, CTA strip and footer are ALREADY dark
   in light mode — they don't need overrides. The big surfaces to flip are:
   body canvas, glass nav, TOC card, content typography, FAQ items, generic
   .card grid, and code chips. */
@media (prefers-color-scheme: dark) {
  body { background: #070a14; color: rgba(255, 255, 255, 0.85); }

  ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); }

  /* Glass nav */
  .nav {
    background: rgba(10, 15, 31, 0.85);
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }
  .nav-brand,
  .nav-brand span,
  .nav-links a,
  .nav-cta a.secondary { color: #ffffff; }
  .nav-drawer {
    background: rgba(10, 15, 31, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }
  .nav-drawer a {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }
  .nav-toggle { color: #ffffff; }
  .skip-link { background: #1c2747; }

  /* Page content typography */
  .page-content h2,
  .page-content h3 { color: #ffffff; }
  .page-content p,
  .page-content li { color: rgba(255, 255, 255, 0.72); }
  .page-content strong { color: #ffffff; }
  .page-content code {
    background: rgba(30, 95, 230, 0.18);
    color: #93c5fd;
  }
  .page-content [data-text$="_p_contact_box"] {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.78);
  }
  .page-content [data-text$="_p_contact_box"] strong { color: #ffffff; }
  .page-content [data-text$="_p_contact_box"] a { color: #93c5fd; }

  /* TOC card */
  .toc {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
  }
  .toc-title { color: rgba(255, 255, 255, 0.5); }
  .toc a { color: rgba(255, 255, 255, 0.72); }
  .toc a:hover { color: #93c5fd; }

  /* FAQ accordion */
  .faq-item {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
  }
  .faq-item[open] {
    background: rgba(30, 95, 230, 0.08);
    border-color: rgba(30, 95, 230, 0.4);
    box-shadow: 0 4px 16px rgba(30, 95, 230, 0.18);
  }
  .faq-item summary { color: #ffffff; }
  .faq-item summary::after {
    background: rgba(255, 255, 255, 0.08);
    color: #93c5fd;
  }
  .faq-item[open] summary::after { background: var(--blue); color: #ffffff; }
  .faq-body { color: rgba(255, 255, 255, 0.7); }

  /* Generic .card grid (acknowledgments) */
  .card {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
  }
  .card-title { color: #ffffff; }
  .card-desc { color: rgba(255, 255, 255, 0.7); }

  /* Boxed info/contact card (#2140): flip the box surface so its text — set
     by .page-content p/strong to light values in dark mode — stays readable. */
  .info-card {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
  }
}
