/* =========================================================================
   Come Hack presentations — stylesheet
   Same design language as the CISA site (cisa.cybernet.rocks):
   navy hero, off-white page, one blue accent, heavy Roboto headlines.
   Vanilla CSS, no build step, no third-party requests.
   ========================================================================= */

@font-face {
  font-family: "Roboto";
  src: url("../../../assets/fonts/roboto-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

:root {
  /* -------- dark palette (default) -------- */
  --bg: #0b1220;
  --surface: #101a2c;
  --ink: #e8edf5;
  --body: #c7d0de;
  --line: #22314b;
  --navy: #070e1c;
  --navy-line: #1c2a44;
  --accent: #1d5fd6;
  --accent-hover: #2a6ee6;
  --accent-text: #8fb4ff;
  --red: #f58a8a;
  --red-bg: #2a1519;
  --green: #5fd3a5;
  --green-bg: #0f2a22;
  /* Fixed colors for always-dark and always-light surfaces */
  --on-navy: #ffffff;
  --on-navy-body: #c3cdde;
  --on-navy-muted: #a9b6cc;
  --on-navy-line: #2a4470;
  --on-navy-kicker: #8fb4ff;
  --live: #3ddc97;

  --font: "Roboto", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --container: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 16px;
  color-scheme: dark;
}

/* -------- light palette: OS preference, no explicit choice stored -------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f6f2;
    --surface: #ffffff;
    --ink: #0f1b2d;
    --body: #3c4a5e;
    --line: #dddad1;
    --navy: #0b1f3a;
    --navy-line: #1e3558;
    --accent-text: #1d5fd6;
    --red: #b42318;
    --red-bg: #fbeae7;
    --green: #0f7a55;
    --green-bg: #e3f4ec;
    color-scheme: light;
  }
}

/* -------- light palette: explicit choice made via the theme toggle -------- */
:root[data-theme="light"] {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --ink: #0f1b2d;
  --body: #3c4a5e;
  --line: #dddad1;
  --navy: #0b1f3a;
  --navy-line: #1e3558;
  --accent-text: #1d5fd6;
  --red: #b42318;
  --red-bg: #fbeae7;
  --green: #0f7a55;
  --green-bg: #e3f4ec;
  color-scheme: light;
}

/* ---------- reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* scrollbar-gutter keeps the layout width identical whether or not a page is
   tall enough to scroll, so the header doesn't shift between pages. */
html { scroll-behavior: smooth; scroll-padding-top: 84px; scrollbar-gutter: stable; }
@media (max-width: 1140px) { html { scroll-padding-top: 72px; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button { font: inherit; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

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

.container {
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 1000;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  transition: top .15s ease;
}
.skip-link:focus { top: 8px; }

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

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 17px; }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: 15px; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-line { border-color: var(--line); color: var(--ink); background: transparent; }
.btn-line:hover { background: var(--surface); }
.btn-light { background: #fff; color: #0b1f3a; }
.btn-outline-light { border-color: rgba(255, 255, 255, .45); color: #fff; font-weight: 500; }
.btn-outline-light:hover { background: rgba(255, 255, 255, .08); }

.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--on-navy-line);
  border-radius: 999px;
  color: var(--on-navy-body);
  cursor: pointer;
}
.icon-btn { transition: background .18s ease, color .18s ease; }
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  /* Blends into the navy hero at the top of the page; the edge and shadow
     fade in once the visitor scrolls (JS toggles .is-scrolled). */
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, box-shadow .25s ease, background-color .25s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--navy-line);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .22);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header.is-scrolled {
    background: color-mix(in srgb, var(--navy) 90%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    backdrop-filter: saturate(160%) blur(12px);
  }
}
.nav {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  text-decoration: none;
  color: #fff;
}
.brand img { width: 44px; height: 44px; border-radius: 50%; background: #fff; }
.brand-name { font-weight: 900; font-size: 22px; letter-spacing: .02em; }
/* Hidden to make room for eight nav links (same as the main site). */
.brand-sub { display: none; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  color: var(--on-navy-body);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.nav-links a:hover { color: #fff; }
.nav-links a.active { color: #fff; border-bottom-color: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }

#theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] #theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] #theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) #theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="dark"]) #theme-toggle .icon-moon { display: block; }
}

@media (max-width: 1240px) {
  .nav { gap: 20px; }
  .nav-links { gap: 20px; }
}
@media (max-width: 1140px) {
  .nav { height: 64px; }
  .menu-btn { display: inline-flex; }
  .nav-cta { display: none; }
  .nav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 16px;
    background: var(--navy);
    border-bottom: 1px solid var(--navy-line);
    box-shadow: 0 16px 32px rgba(0, 0, 0, .28);
    /* Slides and fades in instead of popping; visibility keeps it out of
       the tab order while closed. */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
  }
  .nav-links.open { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
  .nav-links a { padding: 14px 0; font-size: 17px; border-bottom: 1px solid var(--navy-line); }
  .nav-links a.active { border-bottom-color: var(--navy-line); box-shadow: inset 3px 0 0 var(--accent); padding-left: 12px; }
  .nav-links a:last-child { border-bottom: none; }
}

/* ---------- hero ---------- */
.hero {
  background: var(--navy);
  color: #fff;
  padding: clamp(40px, 7vw, 88px) 0 clamp(48px, 7vw, 88px);
}
.hero-copy { display: flex; flex-direction: column; gap: 28px; }
.pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--on-navy-line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-navy-body);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.hero h1 {
  font-weight: 900;
  font-size: clamp(46px, 7vw, 84px);
  line-height: .98;
  letter-spacing: -.03em;
}
.lede { max-width: 560px; font-size: clamp(17px, 1.6vw, 21px); line-height: 1.5; color: var(--on-navy-body); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- sections ---------- */
.section { padding: clamp(64px, 9vw, 112px) 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kicker {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 16px;
}
.section h2 {
  font-weight: 900;
  font-size: clamp(32px, 4.2vw, 52px);
  line-height: 1.04;
  letter-spacing: -.025em;
  max-width: 760px;
}
.section-head-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px 40px;
  margin-bottom: 40px;
}
.note { margin-top: 24px; font-size: 15px; color: var(--body); }
.note a { color: var(--ink); font-weight: 500; }
.empty-msg { color: var(--body); }

/* footer */
.site-footer { background: var(--navy); color: var(--on-navy-muted); padding: 48px 0; font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 24px 40px; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand img { width: 44px; height: 44px; border-radius: 50%; background: #fff; flex-shrink: 0; }
.footer-fine { font-size: 13px; color: #8494b0; margin-top: 2px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.footer-links a { color: var(--on-navy-muted); text-decoration: none; }
.footer-links a:hover { color: #fff; }

@media (max-width: 560px) {
  .nav { height: 64px; gap: 14px; }
  .brand-name { font-size: 19px; }
  .brand img { width: 38px; height: 38px; }
  .cta-row .btn { width: 100%; white-space: normal; text-align: center; }
}

/* ---------- index: search + cards ---------- */
.search {
  position: relative;
  width: min(100%, 360px);
}
.search svg {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--body);
  pointer-events: none;
}
.search input {
  width: 100%;
  min-height: 48px;
  padding: 0 18px 0 46px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.search input::placeholder { color: var(--body); opacity: .8; }
.search input:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-text) 30%, transparent); }
.result-count { margin-bottom: 20px; font-size: 15px; color: var(--body); }

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
/* Loading / empty / error messages span the whole grid instead of one column. */
.deck-grid > .empty-msg { grid-column: 1 / -1; }
.deck {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 200px;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .12s ease, transform .12s ease;
}
.deck:hover { border-color: var(--accent-text); transform: translateY(-2px); }
.deck-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 26px; }
.deck-session { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.deck-title { margin-top: 10px; font-size: 22px; font-weight: 900; line-height: 1.2; letter-spacing: -.01em; overflow-wrap: anywhere; }
.deck-date { font-size: 15px; color: var(--body); }
.deck-foot { margin-top: auto; padding-top: 16px; font-size: 14px; font-weight: 700; color: var(--ink); }
.deck-latest { background: var(--navy); border-color: var(--on-navy-line); color: #fff; }
.deck-latest .deck-session { color: var(--on-navy-kicker); }
.deck-latest .deck-date { color: var(--on-navy-body); }
.deck-latest .deck-foot { color: #fff; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--green-bg);
  color: var(--green);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.deck-latest .badge { background: rgba(61, 220, 151, .14); color: var(--live); }

@media (max-width: 560px) {
  .search { width: 100%; }
  .deck-grid { grid-template-columns: 1fr; gap: 12px; }
  .deck { min-height: 0; padding: 20px; }
}

/* ---------- viewer ---------- */
.back-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--on-navy-body);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}
.back-link:hover { color: #fff; }
.back-link svg { width: 16px; height: 16px; }
.viewer-hero .hero-copy { gap: 20px; }
.viewer-hero h1 { font-size: clamp(36px, 5.5vw, 64px); overflow-wrap: anywhere; }
.viewer-meta { font-size: 14px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--on-navy-kicker); }
.pill-soon { color: var(--on-navy-body); }
.pill-soon .dot { background: var(--on-navy-muted); }

.viewer { padding: clamp(24px, 4vw, 48px) 0 clamp(48px, 7vw, 88px); }
.pdf-frame {
  display: block;
  width: 100%;
  height: min(85vh, 900px);
  min-height: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
@media (max-width: 560px) {
  .pdf-frame { height: 70vh; min-height: 320px; }
}
