/* ==========================================================================
   ScienceHutch: shared styles (every page).
   Dark mode, built on red, orange and black. The logo is black ink, so it
   always sits on a cream badge (.logo-badge) to stay visible on dark pages.
   ========================================================================== */

/* ======= FONTS ======= */
/* Archivo Black (SIL Open Font License, see /fonts/ArchivoBlack-OFL.txt), stored
   with the site. Used for big headings only; body text stays the system font.
   The file name carries a version (v5) because fonts are cached for a year:
   to swap the file, give it a new name and update it here. */
@font-face {
  font-family: "Archivo Black";
  src: url("/fonts/archivo-black-latin-400-v5.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ======= DESIGN CONTROLS (change one value, it updates sitewide) ======= */
:root {
  color-scheme: dark;
  --bg: #0A0908;          /* page background (near black) */
  --surface: #151110;     /* panels and cards */
  --surface-2: #1F1715;   /* boxes inside panels */
  --border: #3A2622;      /* panel outlines */
  --ink: #F6EEE8;         /* main text (warm white) */
  --muted: #BFAEA5;       /* secondary text */
  --orange: #FF8A2B;      /* main accent: buttons, highlights, links */
  --red: #E2412F;         /* second accent: lines, dots, wrong answers (not body text) */
  --on-accent: #1A0E08;   /* text that sits on an orange button */
  --focus: #FFC27A;       /* keyboard focus ring */
  --badge: #F5EFE6;       /* cream circle behind the black logo */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Archivo Black", "Arial Black", var(--font);   /* big headings */
}

/* ======= BASICS ======= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
}
a { color: var(--orange); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
/* Hidden on screen but still read aloud by screen readers. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ======= SKIP LINK (every page; appears when tabbing in from the keyboard) ======= */
.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--orange);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ======= LOGO BADGE ======= */
.logo-badge {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--badge);
  box-shadow: 0 0 0 3px var(--orange), 0 0 0 6px var(--bg), 0 0 0 8px var(--red);
}
.logo-badge img { display: block; height: auto; }

/* ======= SITE HEADER (every page: logo + name on the left, links on the right) ======= */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--border);
}
.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}
.site-header .logo-badge { width: 44px; height: 44px; box-shadow: 0 0 0 2px var(--orange); }
.site-header .logo-badge img { width: 24px; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}
.site-nav a:hover { border-color: #9A6A58; }
.site-nav a[aria-current="page"] { border-color: var(--orange); }
.site-nav .nav-icon { width: 18px; height: 18px; color: var(--red); flex: none; }
/* Small phones: keep the logo, tuck the name away (still read aloud). */
@media (max-width: 479px) {
  .site-header { padding-inline: 12px; }
  .site-header .brand-name {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .site-nav a { padding: 8px 12px; font-size: 0.9rem; }
}

/* ======= HOME HERO (photo right, fades to black on the left) ======= */
main { flex: 1; }
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: clamp(540px, 80vh, 780px);
  overflow: hidden;
  background: var(--bg);
}
.hero-photo {
  position: absolute;
  top: 0;
  right: 0;
  width: 62%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 40%;     /* keeps Hutch and the glowing bench in view */
}
/* The fade: solid black on the left, melting into the photo; plus a soft
   fade at the bottom so the hero blends into the page below. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--bg) 0%, var(--bg) 38%, rgba(10, 9, 8, 0.85) 50%, rgba(10, 9, 8, 0.35) 64%, rgba(10, 9, 8, 0) 80%),
    linear-gradient(0deg, var(--bg) 0%, rgba(10, 9, 8, 0) 22%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px clamp(16px, 5vw, 64px);
}
.hero-text { max-width: min(600px, 50vw); text-align: left; }
.hero-eyebrow {
  margin: 0 0 14px;
  color: var(--orange);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0;
  font-family: var(--font-display);   /* Archivo Black: thick sans serif */
  font-size: clamp(2.2rem, 4.9vw, 4.2rem);
  font-weight: 400;                   /* the font is already black-weight */
  line-height: 1.04;
  letter-spacing: -0.01em;
}
.hero h1 span { color: var(--orange); }
.hero-sub {
  max-width: 32em;
  margin: 20px 0 32px;
  color: var(--muted);
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
}
.hero .cta-row { justify-content: flex-start; }

/* Phones and tablets: photo on top, fading down into the text. */
@media (max-width: 899px) {
  .hero { display: block; min-height: 0; }
  .hero-photo {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-position: 68% 35%;
  }
  .hero::after { background: linear-gradient(0deg, var(--bg) 0%, rgba(10, 9, 8, 0.7) 18%, rgba(10, 9, 8, 0) 40%); bottom: auto; height: calc(100vw * 0.75); }
  .hero-text { max-width: 600px; }
  .hero-inner { margin-top: -48px; padding: 0 clamp(16px, 5vw, 40px) 40px; }
}

/* ======= HOME PAGE CONTENT (below the hero) ======= */
.home-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 16px 48px;
}

/* ======= BUTTONS ======= */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 24px;
  border: 2px solid var(--orange);
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--orange); color: var(--on-accent); }
.btn-primary:hover { background: #FF9D4D; border-color: #FF9D4D; }
.btn-secondary { background: transparent; color: var(--ink); border-color: #9A6A58; }  /* 4.3:1 against the page */
.btn-secondary:hover { border-color: var(--red); }
.btn-secondary .btn-icon { color: var(--red); }
.btn-icon { width: 22px; height: 22px; flex: none; }
@media (max-width: 480px) {
  .cta-row { flex-direction: column; width: 100%; max-width: 340px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}

/* ======= VIDEO SECTIONS (home: Halloween, Physics, Chemistry, Biology) ======= */
.videos { width: 100%; max-width: 960px; margin-top: 56px; text-align: left; }
.videos + .videos { margin-top: 48px; }
.section-title {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 400;
  padding-left: 12px;
  border-left: 4px solid var(--red);
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  line-height: 1.2;
}
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.video-grid--shorts { grid-template-columns: repeat(5, 1fr); }
.video-card {
  position: relative;          /* keeps its screen-reader-only hint inside the card */
  display: block;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s;
}
.video-card:hover { border-color: var(--orange); }
.video-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;          /* trims the black bars on the 4:3 fallback size */
  background: var(--surface-2);
}
.video-card--short img { aspect-ratio: 9 / 16; }
.video-title { display: block; padding: 12px 14px 14px; font-weight: 600; line-height: 1.35; }
.video-card--short .video-title { padding: 10px 10px 12px; font-size: 0.85rem; font-weight: 500; }
.videos-more { margin: 16px 0 0; color: var(--muted); font-size: 0.95rem; }
.videos-more a { color: var(--ink); font-weight: 600; text-decoration-color: var(--orange); text-underline-offset: 4px; }
.topic-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.topic-links a {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid #9A6A58;   /* 4.3:1 against the page */
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.9rem;
  text-decoration: none;
}
.topic-links a:hover { border-color: var(--orange); }
/* Tablets: two across (Shorts three across). */
@media (max-width: 899px) {
  .video-grid { grid-template-columns: repeat(2, 1fr); }
  .video-grid--shorts { grid-template-columns: repeat(3, 1fr); }
}
/* Phones: each section is one swipeable row instead of a long stack. */
@media (max-width: 599px) {
  .video-grid, .video-grid--shorts {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
    margin-inline: -16px;
    padding-inline: 16px;
    scroll-padding-inline: 16px;
  }
  .video-grid > li { flex: 0 0 78%; scroll-snap-align: start; }
  .video-grid--shorts > li { flex: 0 0 44%; }
}
@media (prefers-reduced-motion: reduce) { .video-card { transition: none; } }

/* ======= PAGE NOT FOUND (404.html) ======= */
.not-found {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 16px;
  text-align: center;
}
.not-found .hero-eyebrow { margin: 0 0 10px; color: var(--orange); }
.not-found h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 1.05;
}
.not-found p { max-width: 32em; margin: 16px 0 28px; color: var(--muted); font-size: 1.1rem; }

/* ======= FOOTER ======= */
.site-footer {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.site-footer p { margin: 0; }
