/* ============================================================
   SITE.CSS — base design system for all training pages.
   ------------------------------------------------------------
   This is the single source of truth for the shared page chrome:
   palette, reset, body, header, hero, and footer.

   Every page links this file. Page-specific styles stay in that
   page's own <style> block — do NOT re-declare header/hero/footer
   rules there, or pages will drift apart again.

   The header and footer markup is rendered by template-apply.js
   into <header id="site-header"> and <footer id="site-footer">.
   ============================================================ */

:root {
  /* ── UMD Design System brand accents (accents only, not surfaces) ── */
  --umd-red: #e21833;        /* Maryland Red — 4.75:1 on white */
  --umd-red-dark: #a90007;   /* hover/depth */
  --umd-gold: #ffd200;       /* accent only, sparing */
  --umd-blue: #2f7eda;       /* utility/link blue */

  /* ── UMD neutral gray ramp (surfaces + text) ── */
  --umd-gray-lightest: #fafafa;
  --umd-gray-lighter:  #f1f1f1;
  --umd-gray-light:    #e6e6e6;
  --umd-gray-mediumAA: #757575;  /* AA muted text / borders */
  --umd-gray-dark:     #454545;  /* body copy on white — 9.58:1 */
  --umd-gray-darker:   #242424;  /* dark surfaces; headline near-black */

  /* ── Semantic aliases mapped onto the UMD ramp ── */
  --umd-dark: var(--umd-gray-darker);   /* dark surfaces + headlines */
  --umd-charcoal: var(--umd-gray-dark); /* primary body/text ink #454545 */
  --umd-mid: #6a6a6a;  /* muted secondary text — darkened from #757575 for AA on #fafafa/#f1f1f1 */
  --umd-page: var(--umd-gray-lightest);
  --umd-light: var(--umd-gray-lighter);
  --umd-panel: #fff;
  --umd-border: var(--umd-gray-light);
  --umd-blue-light: #e8f0fe;
  --umd-green: #157a52;  /* darkened from #1D9E75 so white-on-green badges & green text pass AA */
  --umd-red-light: #fde8e8;
  --umd-gold-light: #fff3cc;
  --umd-content-wide: 1180px;
  --umd-content-reading: 1040px;

  /* ── Type ── */
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Overpass', Helvetica, Arial, Verdana, sans-serif;
  --display: 'Barlow Condensed', 'Overpass', Helvetica, Arial, sans-serif; /* hero titles + stats only */

  /* ── Semantic accents ── */
  --green: var(--umd-green);
  --green-light: #f0faf3;
  --green-border: #b8e0c4;
  --amber: #7a5c00;
  --amber-light: #fffbf0;
  --amber-border: #ffe8a0;

  /* ── Aliases for exercise-page content styles ──
     The Gemini/TerpAI exercise pages were authored against a
     separate palette. These aliases map their variable names onto
     the UMD palette so their content styles stay coherent with the
     rest of the site. Prefer the --umd-* names in new work. */
  --red: var(--umd-red);
  --dark: var(--umd-dark);
  --ink: var(--umd-charcoal);
  --muted: var(--umd-mid);
  --line: var(--umd-border);
  --soft: var(--umd-light);
  --panel: var(--umd-panel);
  --blue: var(--umd-blue);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--umd-page);
  color: var(--umd-charcoal); /* body copy #454545 on light — never near-black */
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

body > main {
  flex: 1 0 auto;
  width: 100%;
}

/* Reusable content surfaces shared by the training modules. */
.card,
.step {
  background: var(--umd-panel);
}

/* Official-source cards used by training modules. */
.official-resource {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: center;
  margin: 0 0 2.5rem;
  padding: 1.35rem 1.5rem;
  background: var(--umd-panel);
  border: 1px solid var(--umd-border);
  border-left: 5px solid var(--umd-red);
  border-radius: 9px;
}
.official-resource-kicker {
  color: var(--umd-red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.official-resource h2 {
  margin: .2rem 0 .35rem;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.25;
}
.official-resource p { max-width: 780px; color: var(--umd-mid); }
.official-resource-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: .75rem; }
.official-resource-topic {
  padding: 3px 8px;
  background: var(--umd-light);
  border: 1px solid var(--umd-border);
  border-radius: 999px;
  color: var(--umd-charcoal);
  font-size: 11px;
  font-weight: 700;
}
.official-resource-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: .65rem 1rem;
  background: var(--umd-red);
  border: 1px solid var(--umd-red);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.official-resource-link:hover { background: #fff; color: var(--umd-red); }
.official-resource-link:focus-visible { outline: 3px solid var(--umd-gold); outline-offset: 2px; box-shadow: 0 0 0 2px var(--umd-dark); }

/* ── Skip link (WCAG 2.4.1) — hidden until focused, above the sticky header ── */
.skip-link {
  position: absolute; left: 8px; top: -64px; z-index: 200;
  background: var(--umd-dark); color: #fff;
  padding: 10px 16px; border-radius: 0 0 6px 6px;
  font: 700 14px var(--sans); text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; outline: 3px solid var(--umd-gold); outline-offset: 2px; box-shadow: 0 0 0 2px var(--umd-dark); }
#main-content:focus { outline: none; }

/* ── Header ──────────────────────────────────────────────── */
header {
  background: var(--umd-dark);
  border-bottom: 4px solid var(--umd-red);
  padding: 0 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-lockup { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.umd-wordmark { height: 28px; flex-shrink: 0; }
.logo-divider { width: 1px; height: 22px; background: rgba(255,255,255,0.2); flex-shrink: 0; }

.program-label {
  font-family: var(--sans);
  font-size: 11px; font-weight: 400;
  color: var(--umd-gold);
  letter-spacing: 0.10em; text-transform: uppercase; line-height: 1;
}

.back-link {
  font-size: 12px; font-weight: 500;
  color: #cfcfcf;
  text-decoration: none;
  letter-spacing: 0.06em; text-transform: uppercase;
  transition: color 0.15s;
}
.back-link:hover { color: var(--umd-gold); }

.header-nav { display: flex; align-items: center; gap: 1.25rem; }

.header-nav-link {
  font-size: 11px; font-weight: 500;
  color: #cfcfcf;
  text-decoration: none;
  letter-spacing: 0.08em; text-transform: uppercase;
  transition: color 0.15s;
}
.header-nav-link:hover { color: var(--umd-gold); }
.header-nav-link.active { color: var(--umd-gold); }

/* Hamburger toggle — hidden on desktop, shown below the breakpoint.
   The bars->X animation is driven purely by aria-expanded. */
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 8px;
}
.hamburger span {
  display: block; width: 22px; height: 2px; background: #fff;
  border-radius: 2px; transition: transform .2s, opacity .2s;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.hamburger:focus-visible { outline: 3px solid var(--umd-gold); outline-offset: 2px; box-shadow: 0 0 0 2px var(--umd-dark); }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  background: var(--umd-dark);
  padding: 3.5rem 2.5rem 3rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 50%; height: 100%;
  background: repeating-linear-gradient(
    -45deg, transparent, transparent 20px,
    rgba(226,24,51,0.05) 20px, rgba(226,24,51,0.05) 21px);
  pointer-events: none;
}

.hero-inner { max-width: 820px; position: relative; }

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--umd-gold);
  margin-bottom: 1rem;
}
.hero-eyebrow::before { content: ''; display: block; width: 24px; height: 2px; background: var(--umd-gold); }

h1 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.5vw, 2.7rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 0.875rem;
  max-width: 600px;
}
h1 span { color: var(--umd-red); }

.hero-desc {
  font-size: 15px; font-weight: 400;
  color: #cfcfcf;
  line-height: 1.75;
  max-width: 560px;
}

/* Hero stat row (landing page) */
.hero-meta { display: flex; gap: 2rem; flex-wrap: wrap; }
.hero-meta-item { display: flex; flex-direction: column; gap: 2px; }
/* Stat figures use the "Fearlessly Forward" display face (Barlow Condensed). */
.hero-meta-item .val { font-family: var(--display); font-weight: 800; font-style: italic; font-size: 30px; line-height: 1; color: #fff; }
.hero-meta-item .lbl {
  font-size: 11px; font-weight: 400;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #cfcfcf;
}

/* ── Footer ──────────────────────────────────────────────── */
footer {
  background: #fff;
  border-top: 1px solid var(--umd-gray-light);
  padding: 2.5rem 2.5rem 3rem;
  width: 100%;
  margin-top: auto;
  flex-shrink: 0;
  text-align: center;
  color: var(--umd-charcoal);
  font-size: 13px;
  line-height: 1.6;
}
footer .footer-logo {
  display: block;
  height: 52px;
  width: auto;
  max-width: 100%;
  margin: 0 auto 1.1rem;
}
footer p { margin: 0; }
footer p + p { margin-top: 0.4rem; }
footer a {
  color: var(--umd-red);
  text-decoration: none;
  font-weight: 700;
}
footer a:hover { text-decoration: underline; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1180px) {
  .header-nav { gap: 0.95rem; }
}

/* ── Mobile: inline nav collapses to the hamburger dropdown ── */
@media (max-width: 768px) {
  /* Declutter the header: just the UMD wordmark + hamburger.
     The long training label wraps and crowds the toggle otherwise. */
  .program-label, .logo-divider { display: none; }

  .hamburger {
    display: flex;
    min-width: 44px; min-height: 44px; align-items: center;  /* WCAG 2.5.5 tap target */
  }
  .header-nav {
    display: none;                       /* revealed by .open */
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;  /* clear the header's red border */
    flex-direction: column; align-items: stretch; gap: 0;
    /* Sit under the sticky header (68px) and scroll internally on short screens.
       Use dvh so the mobile address bar can't clip the menu. */
    max-height: calc(100dvh - 68px);
    overflow-y: auto;
    padding: 0;
    background: var(--umd-dark);         /* solid, on-brand — no blur/translucency */
    border-bottom: 4px solid var(--umd-red);
    z-index: 150;
  }
  .header-nav.open { display: flex; }
  .header-nav-link {
    font-size: 13px;
    color: #ebebeb;
    padding: 0.95rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .header-nav-link:first-child { border-top: none; }
  .header-nav-link.active { color: var(--umd-gold); }
}

@media (max-width: 600px) {
  header { padding: 0 1.25rem; }
  .hero { padding: 2.5rem 1.25rem 2rem; }
  footer { padding: 1.5rem 1.25rem; align-items: flex-start; }
  .official-resource { grid-template-columns: 1fr; gap: 1rem; }
  .official-resource-link { width: 100%; white-space: normal; text-align: center; }
}
