/* =============================================================
   shared.css — EDC Index shared styles
   Source of truth: app.html. When pages differ, app.html wins.

   Linked in: app.html, index.html, flashlight-guide.html, optics-guide.html
   Load order: <link rel="stylesheet" href="/shared.css"> BEFORE any
               embedded <style> tag so page-specific rules override cleanly.

   NOTE on index.html: index.html uses a different font (Barlow/Barlow
   Condensed) and a different CSS variable naming convention (--text-primary,
   --surface, etc.) inherited from an earlier build. shared.css is linked
   there for future normalization, but index.html's own <style> block
   overrides these rules until its design system is aligned in a later phase.
   ============================================================= */

/* FONTS
   Inter + JetBrains Mono loaded via @import.
   index.html loads Barlow / Barlow Condensed separately in its own <head>. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── CSS VARIABLES ────────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --bg2: #f7f7f7;
  --bg3: #efefef;
  --border: #e4e4e4;
  --border2: #cecece;
  --text: #0a0a0a;
  --text2: #4a4a4a;
  --text3: #8a8a8a;
  --text4: #b8b8b8;
  --accent: #1a56ff;
  --accent-dim: #e8edff;
  --accent-hover: #0f3fd4;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --r: 10px;
  --r-sm: 7px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --bg2: #1c1c1c;
    --bg3: #272727;
    --border: #2d2d2d;
    --border2: #3d3d3d;
    --text: #f0f0f0;
    --text2: #a0a0a0;
    --text3: #686868;
    --text4: #484848;
    --accent: #4d7cff;
    --accent-dim: #181e38;
    --accent-hover: #6b93ff;
  }
}

/* ─── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ─── BASE ──────────────────────────────────────────────────── */
html, body {
  font-family: var(--sans);
  background: var(--bg2);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ─── PAGE CONTAINER (static pages: index.html, guide pages) ──
   app.html uses #app instead — see its embedded <style>.        */
.page-wrap {
  background: var(--bg);
  height: 100dvh;
  overflow: hidden;
  position: relative;
}
.page-scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ─── DESKTOP LAYOUT (static pages: guide pages) ─────────────
   index.html handles its own breakpoints in its embedded style.
   app.html uses #app — see its embedded style.
   Below 768px: no changes — mobile layout is pixel-perfect.    */
@media (min-width: 768px) {
  /* Full-width layout — no centered panel, no dark sidebars */
  html, body { background: var(--bg); }

  /* Hero images taller on desktop, constrained to content width */
  .art-hero { height: 400px; max-width: 800px; margin-left: auto; margin-right: auto; }

  /* Guide/article content centered for readability */
  .art-top  { max-width: 800px; margin-left: auto; margin-right: auto; }
  .art-wrap { max-width: 800px; margin-left: auto; margin-right: auto; }
}

/* ─── HAMBURGER BUTTON (overlaid on hero images) ───────────── */
.nav-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text);
  transition: background .12s;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-btn svg { width: 20px; height: 20px; }
.cat-hero-btn { position: absolute; top: 8px; left: 4px; color: #fff; background: rgba(0,0,0,.32); }
.cat-hero-btn:hover { background: rgba(0,0,0,.52); }

/* ─── SLIDE-OUT MENU ────────────────────────────────────────── */
.menu-ov { position: absolute; inset: 0; z-index: 200; display: none; }
.menu-ov.open { display: block; }
.menu-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.menu-panel {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 76%;
  max-width: 320px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .26s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.menu-ov.open .menu-panel { transform: translateX(0); }
.menu-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
/* .menu-head-name used on static pages; .menu-name used in app.html */
.menu-head-name,
.menu-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.3px;
  flex: 1;
  color: var(--text);
}
.menu-head-name span,
.menu-name span { color: var(--accent); }
.menu-x {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text2);
  flex-shrink: 0;
}
.menu-x svg { width: 13px; height: 13px; }
.menu-sec { padding: 6px 0; border-bottom: 1px solid var(--border); }
.menu-sec:last-child { border-bottom: none; }
.menu-sec-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 8px 18px 4px;
}
.menu-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  text-decoration: none;
  color: var(--text);
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--sans);
  transition: background .1s;
}
.menu-row:hover { background: var(--bg2); }
.menu-row.active { background: var(--accent-dim); }
.menu-ri {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-row.active .menu-ri { background: var(--accent-dim); }
.menu-ri svg { width: 14px; height: 14px; color: var(--text2); }
.menu-row.active .menu-ri svg { color: var(--accent); }
.menu-rl { font-size: 13px; font-weight: 500; flex: 1; color: var(--text); }
.menu-row.active .menu-rl { font-weight: 600; color: var(--accent); }
.menu-rb {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text3);
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
}
.menu-row.active .menu-rb { background: var(--accent-dim); color: var(--accent); }

/* ─── ARTICLE / GUIDE SHARED STYLES ────────────────────────── */
/* Used by flashlight-guide.html, optics-guide.html,
   and app.html's article screen.                               */
.art-hero {
  height: 280px;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.art-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
.art-top {
  padding: 16px 18px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.art-top-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  margin-top: 2px;
}
.art-top-icon svg { width: 22px; height: 22px; color: #fff; }
.art-top-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 5px;
}
.art-h1 { font-size: 20px; font-weight: 800; letter-spacing: -.5px; line-height: 1.2; }
.art-wrap { padding: 16px 16px 56px; }
.art-lead { font-size: 13px; color: var(--text2); line-height: 1.7; margin-bottom: 22px; }
.art-sec { margin-bottom: 22px; }
.art-sh {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.art-p { font-size: 13px; color: var(--text2); line-height: 1.7; }
.art-p + .art-p { margin-top: 8px; }

/* NOTE / HIGHLIGHT BOX — optics-guide.html, flashlight-guide.html */
.art-note { background: var(--accent-dim); border-radius: var(--r-sm); padding: 11px 13px; margin-top: 10px; }
.art-note-label { font-size: 10px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.art-note-body { font-size: 12px; color: var(--text2); line-height: 1.65; }

/* DATA TABLE — optics-guide.html, flashlight-guide.html */
.moa-tbl { width: 100%; border-collapse: collapse; margin-top: 10px; }
.moa-tbl th { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.moa-tbl td { font-size: 12px; color: var(--text2); padding: 8px 8px; border-bottom: 1px solid var(--border); line-height: 1.5; vertical-align: top; }
.moa-tbl tr:last-child td { border-bottom: none; }
.moa-tbl td:first-child { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--text); white-space: nowrap; width: 72px; }

/* FORMULA BOX — flashlight guide + app.html article screen */
.formula {
  margin: 10px 0;
  padding: 11px 13px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
  line-height: 1.6;
}
.formula-lbl {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 3px;
}

/* DIVIDER */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* CTA LINK BUTTON */
.learn-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 11px;
  padding: 8px 13px;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  background: none;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--sans);
  transition: all .15s;
}
.learn-btn:hover { background: var(--bg2); color: var(--text); }
.learn-btn svg { width: 12px; height: 12px; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 1000;
  animation: toast-fade 2s ease forwards;
  pointer-events: none;
}
@keyframes toast-fade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(8px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* SITE FOOTER */
.site-footer {
  padding: 24px 16px 28px;
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  line-height: 1.55;
}
@media (min-width: 768px) {
  .site-footer { max-width: 800px; margin-left: auto; margin-right: auto; }
}
