/* ==========================================================================
   UNM Physics 480/581 — Biological Physics
   Light academic theme. UNM cherry as the structural accent; a four-colour
   family system (biology / theory / optics / computation) carries meaning
   through the module list and the recommended sequences.
   ========================================================================== */

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

:root {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* ground + ink */
  --paper: #ffffff;
  --paper-2: #f6f8f9;
  --hero-bg: #fbf6f6;
  --ink: #1e2226;
  --body: #3f454b;
  --muted: #757c83;
  --rule: #e9ecee;
  --rule-2: #dde1e5;

  /* UNM cherry */
  --cherry: #ba0c2f;
  --cherry-deep: #9d0b28;
  --cherry-dark: #7a091f;
  --cherry-tint: #fdecef;

  /* module families */
  --c-bio:    #157a4e;
  --c-theory: #6742bd;
  --c-optics: #a55708;
  --c-comp:   #1a66ab;

  --masthead-h: 56px;
  --maxw: 1000px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--masthead-h) + 16px);
}

body {
  font-family: var(--sans);
  font-size: 1.04rem;
  line-height: 1.68;
  color: var(--body);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* the full-bleed hero paints past the viewport; clip it without creating a
     scroll container, which would break the sticky masthead */
  overflow-x: hidden;
  overflow-x: clip;
}

img { max-width: 100%; height: auto; }
a { color: var(--cherry-deep); text-decoration: none; }
a:hover { color: var(--cherry-dark); text-decoration: underline; text-underline-offset: 2px; }
::selection { background: #fbd7de; }

/* ── Masthead ───────────────────────────────────────────────────────────── */
.masthead {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-top: 3px solid var(--cherry);
  border-bottom: 1px solid var(--rule-2);
}
.masthead__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: var(--masthead-h); padding: 0 1.25rem;
}
.site-title { font-weight: 700; font-size: 1.1rem; color: var(--ink); white-space: nowrap; letter-spacing: -0.012em; }
.site-title:hover { color: var(--cherry); text-decoration: none; }
.site-term { font-weight: 400; color: var(--muted); font-size: 0.84rem; margin-left: 0.2rem; }

.nav { display: flex; align-items: center; gap: 0.05rem; list-style: none; }
.nav a {
  display: block; padding: 0.45rem 0.62rem; color: var(--body);
  font-size: 0.9rem; border-radius: 5px; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--cherry-deep); text-decoration: none; background: var(--cherry-tint); }
.nav a.is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--cherry); }
.nav .ext::after { content: "\2197"; font-size: 0.72em; opacity: 0.5; margin-left: 0.22em; }

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px; }

/* ── Content ────────────────────────────────────────────────────────────── */
.content { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem 4rem; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; font-weight: 700; }

h2 {
  font-size: 1.5rem; margin: 3rem 0 1rem; padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--rule-2); position: relative;
  letter-spacing: -0.012em;
}
h2::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 2.8rem; height: 2px; background: var(--cherry); }

h3 { font-size: 1.08rem; margin: 1.9rem 0 0.45rem; letter-spacing: -0.005em; }

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1.1em 1.35rem; }
li { margin: 0.22em 0; }
hr { border: 0; border-top: 1px solid var(--rule-2); margin: 2.4rem 0; }
strong { color: var(--ink); font-weight: 650; }
em { color: inherit; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--paper-2); padding: 0.12em 0.36em; border-radius: 4px; }

/* ── Hero band ──────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  background: var(--hero-bg);
  box-shadow: 0 0 0 100vmax var(--hero-bg);
  clip-path: inset(0 -100vmax);
  padding: 2.6rem 0 2.1rem;
  margin-bottom: 0.5rem;
}
.hero::after {
  content: ""; position: absolute; left: -100vmax; right: -100vmax; bottom: 0;
  height: 1px; background: var(--rule-2);
}
.eyebrow {
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--cherry); margin: 0 0 0.7rem;
}
.hero h1 {
  font-size: 2.5rem; letter-spacing: -0.03em; margin: 0 0 0.35rem; line-height: 1.08;
}
.course-no {
  font-family: var(--mono); font-size: 0.94rem; letter-spacing: 0.02em;
  color: var(--muted); margin: 0 0 1.15rem;
}
.course-no span { color: var(--rule-2); margin: 0 0.15rem; }
.lede { font-size: 1.15rem; line-height: 1.58; color: var(--body); max-width: 46rem; margin: 0 0 1.7rem; }

.factbox {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.3rem 2.5rem;
  background: var(--paper); border: 1px solid var(--rule-2);
  border-left: 3px solid var(--cherry);
  border-radius: 3px 8px 8px 3px;
  padding: 1.3rem 1.5rem;
}
.factbox dt {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--cherry-deep); font-weight: 700; margin-bottom: 0.25rem;
}
.factbox dd { margin: 0; color: var(--ink); font-size: 0.95rem; line-height: 1.48; font-weight: 400; }
.factbox dd strong { font-weight: 650; }

/* ── Notes ──────────────────────────────────────────────────────────────── */
.note {
  border: 1px solid #f3d3da; border-left: 3px solid var(--cherry);
  background: var(--cherry-tint);
  padding: 0.95rem 1.15rem; border-radius: 3px 6px 6px 3px; margin: 2em 0 0;
  font-size: 0.95rem; color: #5f3239;
}
.note strong { color: var(--cherry-dark); }
.note p:last-child { margin-bottom: 0; }

/* ── Tags ───────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.16em 0.45em; border-radius: 3px; margin-left: 0.42rem;
  vertical-align: 0.11em; white-space: nowrap;
}
.tag-lab   { background: var(--cherry-tint); color: var(--cherry-deep); }
.tag-units { background: #edf1f6; color: #405672; }
.tag-adv   { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--rule-2); font-weight: 600; }

/* ── Legend ─────────────────────────────────────────────────────────────── */
.legend {
  list-style: none; margin: 1.5em 0 2.2em; padding: 0.95rem 1.2rem;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 8px;
  font-size: 0.92rem; color: var(--muted);
}
.legend li { margin: 0.3em 0; }
.legend .tag { margin-left: 0; margin-right: 0.5rem; }

/* ── Module families ────────────────────────────────────────────────────── */
.fam { --fam: var(--muted); margin-bottom: 2.2em; }
.fam-bio    { --fam: var(--c-bio); }
.fam-theory { --fam: var(--c-theory); }
.fam-optics { --fam: var(--c-optics); }
.fam-comp   { --fam: var(--c-comp); }

.fam h3 {
  color: var(--fam); font-size: 0.82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  margin: 0 0 0.6rem; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 0.5rem;
}
.fam h3::before {
  content: ""; width: 0.62rem; height: 0.62rem; border-radius: 2px;
  background: var(--fam); flex: none;
}

.modules { list-style: none; margin: 0; padding: 0; }
.modules li {
  padding: 0.7em 0.9rem 0.75em;
  border-bottom: 1px solid var(--rule);
  border-left: 3px solid var(--fam);
  background: linear-gradient(90deg, color-mix(in srgb, var(--fam) 5%, transparent), transparent 42%);
  transition: background 0.12s ease;
}
.modules li:last-child { border-bottom: 0; }
.modules li:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--fam) 10%, transparent), transparent 60%); }
.mod-name { color: var(--ink); font-weight: 650; }
.mod-desc { display: block; font-size: 0.93rem; line-height: 1.55; color: var(--body); margin-top: 0.2em; }
.mod-desc em { font-style: italic; }

/* ── By-request chips ───────────────────────────────────────────────────── */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.3em 0 0; padding: 0; }
.chips li {
  margin: 0; font-size: 0.87rem; line-height: 1.35;
  padding: 0.32em 0.66em; border-radius: 999px;
  background: var(--paper-2); border: 1px solid var(--rule-2); color: var(--body);
}
.chips b {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--cherry-deep); margin-left: 0.32rem;
}

/* ── Family key ─────────────────────────────────────────────────────────── */
.famkey { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem 1.15rem; margin: 1.2em 0 1.6em; padding: 0; font-size: 0.85rem; color: var(--muted); }
.famkey li { margin: 0; display: flex; align-items: center; gap: 0.42rem; }
.famkey li::before { content: ""; width: 0.6rem; height: 0.6rem; border-radius: 2px; background: var(--fk); }
.famkey .k-bio    { --fk: var(--c-bio); }
.famkey .k-theory { --fk: var(--c-theory); }
.famkey .k-optics { --fk: var(--c-optics); }
.famkey .k-comp   { --fk: var(--c-comp); }

/* ── Sequence cards ─────────────────────────────────────────────────────── */
.seq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.15rem; margin: 0 0 2em; }
.seq {
  border: 1px solid var(--rule-2); border-radius: 8px; padding: 1.15rem 1.35rem 1.25rem;
  background: var(--paper);
}
.seq h3 { margin: 0 0 0.2rem; font-size: 1rem; }
.seq .seq-for { color: var(--muted); font-size: 0.85rem; line-height: 1.45; margin: 0 0 0.85rem; }
.seq ol { margin: 0 0 0 1.2rem; font-size: 0.93rem; }
.seq ol li { margin: 0.3em 0; padding-left: 0.15rem; }
.seq ol li::marker { color: var(--muted); font-size: 0.85em; }
.seq ol li::before {
  content: ""; display: inline-block; width: 0.52rem; height: 0.52rem;
  border-radius: 2px; background: var(--sq, var(--rule-2));
  margin-right: 0.5rem; vertical-align: 0.04em; flex: none;
}
.seq .s-bio    { --sq: var(--c-bio); }
.seq .s-theory { --sq: var(--c-theory); }
.seq .s-optics { --sq: var(--c-optics); }
.seq .s-comp   { --sq: var(--c-comp); }
.seq .s-req    { --sq: var(--rule-2); color: var(--muted); }
.seq ol li i { font-style: normal; font-size: 0.76rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-left: 0.35rem; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 0.94rem; }
th, td { text-align: left; padding: 0.6em 0.85em; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th {
  color: var(--cherry-deep); font-weight: 700; font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.07em;
  background: var(--cherry-tint); border-bottom: 1px solid #f3d3da; white-space: nowrap;
}
thead th:first-child { border-radius: 4px 0 0 0; }
thead th:last-child { border-radius: 0 4px 0 0; }
tbody tr:hover td { background: var(--paper-2); }
tbody td:first-child { color: var(--ink); font-weight: 600; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer { border-top: 3px solid var(--cherry); background: var(--paper-2); margin-top: 3.5rem; }
.site-footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 1.7rem 1.25rem 2.4rem; font-size: 0.87rem; color: var(--muted); }
.site-footer p { margin: 0 0 0.3em; }
.site-footer p:first-child { color: var(--ink); font-weight: 600; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .masthead__inner { flex-wrap: wrap; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 0.6rem; }
  .nav a { border-bottom: 0; border-left: 2px solid transparent; }
  .nav a.is-active { border-left-color: var(--cherry); }
  body.nav-open .nav { display: flex; }
  .hero { padding: 2rem 0 1.7rem; }
  .hero h1 { font-size: 1.85rem; }
  .lede { font-size: 1.05rem; }
  h2 { font-size: 1.3rem; margin-top: 2.4rem; }
  /* narrow screens: let the header cells wrap, and let a table that still
     does not fit scroll inside itself rather than be clipped by the body */
  table { font-size: 0.88rem; display: block; overflow-x: auto; }
  thead th { white-space: normal; }
}

@media print {
  .masthead, .nav-toggle { display: none; }
  .hero { box-shadow: none; clip-path: none; background: none; }
  a { color: var(--ink); }
}
