/* Interactive Biology — homepage.
   An anatomy-atlas layout (serif titles, hairline rules, each lesson a numbered plate) on a neutral charcoal that sits
   between the two lessons' own backgrounds, so opening a lesson feels continuous. Warm ink from the Joints film UI.
   One screen on desktop; tablets and phones stack. */
:root {
  --paper: #111316;
  --ink: #f2f0ea;
  --ink-2: #c9c6be;
  --muted: #9a978f;
  --rule: rgba(242, 240, 234, 0.13);
  --rule-strong: rgba(242, 240, 234, 0.5);
  --terracotta: #ef8f78;
  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --gutter: clamp(18px, 4vw, 64px);
  --max: 1400px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 500; text-wrap: balance; }
p, ul { margin: 0; }
::selection { background: rgba(239, 143, 120, 0.3); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 10; padding: 10px 14px; background: var(--ink); color: var(--paper); text-decoration: none; }
.skip:focus { top: 12px; }

.site-header, main, .site-footer { width: 100%; max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding-inline: var(--gutter); }

/* ── Masthead ─────────────────────────────────────────────────────────────── */
.site-header { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-header::after { content: ""; position: absolute; left: var(--gutter); right: var(--gutter); bottom: 0; border-bottom: 1px solid var(--rule-strong); }
.brand, .header-meta { padding-block: 20px 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 500 19px/1 var(--serif); letter-spacing: -0.005em; }
.brand-mark { color: var(--terracotta); flex: none; }
.header-meta { font-size: 13.5px; color: var(--muted); }

/* ── Layout ───────────────────────────────────────────────────────────────── */
main { display: flex; align-items: center; padding-block: clamp(20px, 4vh, 48px); }
.home { width: 100%; display: grid; grid-template-columns: minmax(280px, 0.72fr) minmax(0, 2fr); gap: clamp(32px, 3.6vw, 76px); align-items: center; }

/* ── Intro ────────────────────────────────────────────────────────────────── */
.intro-kicker { font: italic 400 19px/1.3 var(--serif); color: var(--terracotta); }
.intro h1 { margin-top: 14px; font: 450 clamp(40px, 3.4vw, 54px)/1 var(--serif); letter-spacing: -0.022em; font-optical-sizing: auto; }
.lede { margin-top: 24px; font-size: clamp(17px, 1.35vw, 19px); line-height: 1.5; color: var(--ink-2); max-width: 30ch; }
.intro-body { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--rule); font-size: 14.5px; line-height: 1.6; color: var(--muted); max-width: 40ch; }

/* ── Lessons ──────────────────────────────────────────────────────────────── */
.modules-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 10px; margin-bottom: 24px; border-bottom: 1px solid var(--rule); font: 500 21px/1.2 var(--serif); }
.count { font: 400 13.5px/1 var(--sans); color: var(--muted); }

/* auto-fit keeps every lesson in one row while they fit; a fourth or fifth wraps to a second row. */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: clamp(16px, 1.6vw, 28px); padding: 0; list-style: none; }
.card { --accent: var(--terracotta); display: flex; }
.card article { position: relative; display: flex; flex-direction: column; width: 100%; }

/* The plate: the 3D render, framed by a hairline so it reads as mounted on the dark page. */
.card-media {
  aspect-ratio: 16 / 10; max-height: 33vh; overflow: hidden; border-radius: 3px; background: #0a0c0f;
  box-shadow: 0 0 0 1px rgba(242, 240, 234, 0.12), 0 24px 40px -28px rgba(0, 0, 0, 0.9);
}
.card:hover .card-media { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 24px 40px -28px rgba(0, 0, 0, 0.9); }
.card-media { transition: box-shadow 0.3s ease; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.card:hover .card-media img { transform: scale(1.025); }
.card-placeholder { display: grid; place-items: center; height: 100%; font: 400 64px/1 var(--serif); color: #3a3d42; }

.card-kicker { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.plate { font: italic 400 15px/1 var(--serif); color: var(--accent); }
.card-eyebrow::before { content: "—"; margin-right: 8px; color: var(--rule); }
.card h3 { margin-top: 6px; font: 500 clamp(19px, 1.5vw, 26px)/1.12 var(--serif); letter-spacing: -0.012em; }
.card-link { text-decoration: none; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.card-link::after { content: ""; position: absolute; inset: -8px; z-index: 1; }            /* the whole plate is the link */
.card:hover .card-link { text-decoration-line: underline; text-decoration-color: var(--accent); }
.card-link:focus-visible { outline: none; }
.card-link:focus-visible::after { outline: 2px solid var(--ink); outline-offset: 2px; }
.card-desc { margin-top: 8px; font-size: clamp(13.5px, 1.05vw, 15px); line-height: 1.55; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.facts { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.card-cta {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--rule);
  font-weight: 600; font-size: 13.5px; color: var(--accent);
}
.card article > :nth-last-child(2) { margin-bottom: 16px; }   /* space above the link row, whatever precedes it */
.card-cta .arrow { transition: transform 0.25s ease; }
.card:hover .card-cta .arrow { transform: translateX(4px); }
.card-cta--soon { color: var(--muted); font-weight: 500; }

.upcoming { margin-top: 30px; font: 400 16px/1.4 var(--serif); color: var(--ink-2); }
.upcoming em { color: var(--ink); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer p { padding-block: 14px 20px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--muted); }

/* ── 404 ──────────────────────────────────────────────────────────────────── */
.not-found { max-width: 620px; }
.not-found h1 { margin-top: 14px; font: 450 clamp(40px, 5vw, 64px)/1 var(--serif); letter-spacing: -0.02em; }
.nf-home { margin-top: 28px; font-weight: 600; }
.nf-home a { color: var(--terracotta); text-underline-offset: 4px; }
.nf-links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 22px; padding: 16px 0 0; border-top: 1px solid var(--rule); list-style: none; font: 400 18px/1.4 var(--serif); }
.nf-links a { text-decoration: none; }
.nf-links a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ── Short desktop screens (e.g. 1280×720) ────────────────────────────────── */
@media (min-width: 1024px) and (max-height: 780px) {
  .brand, .header-meta { padding-block: 14px 12px; }
  .intro h1 { font-size: clamp(42px, 4vw, 60px); }
  .lede { margin-top: 18px; }
  .intro-body { margin-top: 20px; }
  .card-media { max-height: 29vh; }
  .modules-title { margin-bottom: 18px; }
  .upcoming { margin-top: 26px; }
}

/* ── Tablet: stack ────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  main { align-items: flex-start; }
  .home { grid-template-columns: 1fr; gap: 44px; }
  .intro { max-width: 640px; }
  .card-media { max-height: none; }
}

/* ── Phone ────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-meta { display: none; }
  .intro h1 { font-size: 44px; }
  .home { gap: 36px; }
  .grid { gap: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
