/* CRDM 790 site styles. Colors from the Hilda Daylight and Night systems.

   Contrast record (WCAG 2.1 relative luminance, measured November 2026).
   Use only these pairs for text. Body text needs 4.5:1, large text 3:1, focus rings and controls 3:1.
   Light mode
     umber on cream        12.44   body text
     umber on white        13.32   tiles
     umber on mist          8.77   Movement I hero, chip
     umber on parchment     9.80   Movement II hero, chip
     umber on scarf gold    8.18   Movement III hero, chip
     deep red on cream      8.82   links
     deep red on white      9.44   links in tiles, fold buttons
     deep red on mist       6.22   links in Movement I hero
     deep red on parchment  6.95   links in Movement II hero
     deep red on scarf gold 5.80   links in Movement III hero
     white on mountain red  5.83   Due chip
     deep teal on cream     4.66   focus ring
   Dark mode
     cream on night ink    11.67   body text
     cream on night plum    8.80   hero, tiles
     scarf gold on ink      7.67   links
     scarf gold on plum     5.79   links in hero and tiles
   Decorative only, never for text: ochre on cream 2.09, clay on cream 3.89. */
:root {
  --cream: #FCF7E9;
  --parchment: #EBDCB7;
  --scarf-gold: #F1C476;
  --ochre: #CAA876;
  --clay: #A4714B;
  --mountain-red: #C22627;
  --deep-red: #891A17;
  --hair-teal: #588D8E;
  --deep-teal: #457877;
  --mist: #C3D6CE;
  --forest: #4C8174;
  --umber: #41292B;
  --night-ink: #383140;
  --night-plum: #583B65;
  --white: #FFFFFF;

  --bg: var(--cream);
  --surface: var(--white);
  --text: var(--umber);
  --link: var(--deep-red);
  --link-hover: var(--mountain-red);
  --rule: var(--ochre);
  --focus: var(--deep-teal);
  --m1-fill: var(--mist);
  --m2-fill: var(--parchment);
  --m3-fill: var(--scarf-gold);
  --m1-rule: var(--deep-teal);
  --m2-rule: var(--clay);
  --m3-rule: var(--mountain-red);
  --badge-bg: var(--mountain-red);
  --badge-text: var(--white);

  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --measure: 70ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--night-ink);
    --surface: var(--night-plum);
    --text: var(--cream);
    --link: var(--scarf-gold);
    --link-hover: var(--cream);
    --rule: var(--clay);
    --focus: var(--scarf-gold);
    --m1-fill: var(--night-plum);
    --m2-fill: var(--night-plum);
    --m3-fill: var(--night-plum);
    --m1-rule: var(--mist);
    --m2-rule: var(--ochre);
    --m3-rule: var(--scarf-gold);
  }
}
:root[data-theme="dark"] {
  --bg: var(--night-ink);
  --surface: var(--night-plum);
  --text: var(--cream);
  --link: var(--scarf-gold);
  --link-hover: var(--cream);
  --rule: var(--clay);
  --focus: var(--scarf-gold);
  --m1-fill: var(--night-plum);
  --m2-fill: var(--night-plum);
  --m3-fill: var(--night-plum);
  --m1-rule: var(--mist);
  --m2-rule: var(--ochre);
  --m3-rule: var(--scarf-gold);
}

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

html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: 0.2em 0 0.4em; }
h2 { font-size: 1.45rem; margin: 2.2rem 0 0.6rem; }
h3 { font-size: 1.12rem; margin: 1.6rem 0 0.4rem; }
p, li { max-width: var(--measure); }
ul, ol { padding-left: 1.3rem; }
li + li { margin-top: 0.35rem; }

.wrap { max-width: 60rem; margin: 0 auto; padding: 0 1rem; }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: baseline; justify-content: space-between; padding-top: 0.9rem; padding-bottom: 0.9rem; }
.site-name { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; }
.site-nav li + li { margin-top: 0; }

.site-footer { margin-top: 4rem; background: var(--night-ink); color: var(--cream); }
.site-footer .wrap { padding-top: 1.6rem; padding-bottom: 2rem; }
.site-footer a { color: var(--scarf-gold); }
.site-footer p { margin: 0.3rem 0; }

main { padding-bottom: 1rem; }

.eyebrow { font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; margin: 2rem 0 0; }
.lede { font-size: 1.12rem; }

/* Fact list: label and value pairs */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.2rem; margin: 1.2rem 0; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }
@media (max-width: 30rem) {
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: 0.5rem; }
}

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 1rem 1.2rem; margin: 1.2rem 0; }
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }

/* Movement bands on the home page */
.movement { border-left: 6px solid var(--rule); padding: 0.2rem 0 0.2rem 1.1rem; margin: 2.6rem 0; }
.movement.m1 { border-color: var(--m1-rule); }
.movement.m2 { border-color: var(--m2-rule); }
.movement.m3 { border-color: var(--m3-rule); }
.movement h2 { margin-top: 0.2rem; }

.weeks { list-style: none; padding: 0; margin: 1rem 0 0; }
.weeks li { max-width: none; margin: 0; border-top: 1px solid var(--rule); }
.weeks li:last-child { border-bottom: 1px solid var(--rule); }
.weeks a, .weeks .pending { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.2rem 1rem; padding: 0.8rem 0.2rem; text-decoration: none; color: var(--text); }
.weeks a .week-title { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.weeks a:hover .week-title { text-decoration-thickness: 2px; }
.week-when { font-size: 0.9rem; }
.week-when b { display: block; font-size: 1rem; }
.week-title { font-family: var(--serif); font-weight: 600; font-size: 1.08rem; }
.week-meta { grid-column: 2; font-size: 0.92rem; }
@media (max-width: 30rem) {
  .weeks a, .weeks .pending { grid-template-columns: 1fr; }
  .week-meta { grid-column: 1; }
}

.chip { display: inline-block; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.03em; padding: 0.05rem 0.5rem; border-radius: 3px; margin-right: 0.4rem; color: var(--umber); }
.chip.m1 { background: var(--mist); }
.chip.m2 { background: var(--parchment); }
.chip.m3 { background: var(--scarf-gold); }
.chip.due { background: var(--badge-bg); color: var(--badge-text); }

.break-row { padding: 0.8rem 0.2rem; font-style: italic; border-top: 1px solid var(--rule); }

/* Week pages */
.week-head { border-left: 6px solid var(--rule); padding-left: 1.1rem; margin-top: 2rem; }
.week-head.m1 { border-color: var(--m1-rule); }
.week-head.m2 { border-color: var(--m2-rule); }
.week-head.m3 { border-color: var(--m3-rule); }
.week-head .eyebrow { margin-top: 0; }

.schedule { width: 100%; max-width: var(--measure); border-collapse: collapse; margin: 0.8rem 0; }
.schedule th, .schedule td { text-align: left; vertical-align: top; padding: 0.55rem 0.7rem 0.55rem 0; border-top: 1px solid var(--rule); }
.schedule th { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }

.steps li { margin-top: 0.5rem; }

.milestone { border-left: 6px solid var(--mountain-red); }

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin: 3rem 0 0; padding-top: 1rem; border-top: 1px solid var(--rule); }
.pager a, .pager span { max-width: 45%; }
@media (max-width: 30rem) { .pager a { max-width: 100%; } }

@media print {
  .site-header, .site-footer, .pager, .skip-link { display: none; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Rubric and reference tables */
.rubric { width: 100%; border-collapse: collapse; margin: 0.8rem 0 1.4rem; font-size: 0.95rem; }
.rubric caption { text-align: left; font-weight: 700; margin-bottom: 0.4rem; }
.rubric th, .rubric td { text-align: left; vertical-align: top; padding: 0.6rem 0.7rem; border: 1px solid var(--rule); }
.rubric thead th { background: var(--surface); }
.rubric tbody th { width: 22%; }
@media (max-width: 40rem) {
  .rubric, .rubric tbody, .rubric tr, .rubric th, .rubric td { display: block; width: 100%; }
  .rubric thead { position: absolute; left: -9999px; }
  .rubric tr { margin-bottom: 0.8rem; }
  .rubric td::before { content: attr(data-label); display: block; font-weight: 700; }
}
.example { border-left: 4px solid var(--m1-rule); padding: 0.2rem 0 0.2rem 1rem; margin: 0.8rem 0; }
.example.thin { border-color: var(--rule); }
.example p { margin: 0.3rem 0; }
.doc-list { padding-left: 1.3rem; }

/* Friendlier week pages */
.icon { width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin-right: 0.45em; flex: none; }
.week-hero { border-radius: 10px; padding: 1.6rem 1.4rem 1.4rem; margin-top: 1.6rem; color: var(--umber); }
.week-hero.m1 { background: var(--mist); }
.week-hero.m2 { background: var(--parchment); }
.week-hero.m3 { background: var(--scarf-gold); }
.week-hero .eyebrow { margin-top: 0; }
.week-hero h1 { margin-bottom: 0.6rem; }
.welcome { background: var(--cream); border-radius: 8px; padding: 0.9rem 1.1rem; margin-top: 1rem; max-width: 46rem; }
.welcome p { margin: 0; color: var(--umber); }
.welcome .sig { margin-top: 0.5rem; font-family: var(--serif); font-style: italic; }
.glance dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.8rem; margin: 1.2rem 0 1.4rem; }
.tile { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 0.8rem 1rem; }
.tile dt { font-weight: 700; display: flex; align-items: center; margin-bottom: 0.25rem; }
.tile dd { margin: 0; }
main h2 { margin-top: 2.8rem; }
h3 { display: flex; align-items: center; }
section.fold { position: relative; border-top: 1px solid var(--rule); margin: 0; }
section.fold:last-of-type { border-bottom: 1px solid var(--rule); }
section.fold + :not(section.fold) { margin-top: 1.4rem; }
section.fold > h3 { margin: 0; padding: 0.95rem 5.5rem 0.95rem 0; min-height: 3.4rem; font-size: 1.08rem; }
section.fold summary { position: absolute; top: 0.5rem; right: 0; cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 0.3rem; min-height: 44px; padding: 0 0.7rem; border: 1px solid var(--rule); border-radius: 999px; font-size: 0.9rem; font-weight: 700; color: var(--link); background: var(--surface); }
section.fold summary::-webkit-details-marker { display: none; }
section.fold summary::after { content: "+"; font-size: 1.2rem; line-height: 1; }
section.fold details[open] summary::after { content: "\2212"; }
section.fold details:not([open]) .when-open, section.fold details[open] .when-closed { display: none; }
.fold-body { padding: 0 0 1rem 1.6rem; }
.fold-body > :first-child { margin-top: 0; }
.in-short { margin: 0.2rem 0 0.8rem; max-width: var(--measure); }
.in-short-label { font-weight: 700; margin-right: 0.35rem; }
.alt-route { border-left: 4px solid var(--rule); padding-left: 0.8rem; }
ul.after li { margin-top: 0.5rem; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .week-hero { background: var(--night-plum); color: var(--cream); }
  :root:not([data-theme="light"]) .welcome { background: var(--night-ink); }
  :root:not([data-theme="light"]) .welcome p { color: var(--cream); }
}
@media print { .week-hero { background: none !important; padding: 0; } section.fold summary { display: none; } section.fold > h3 { padding-right: 0; } }
@media (max-width: 30rem) {
  .fold-body { padding-left: 0; }
  .schedule th { white-space: normal; }
  .schedule td { overflow-wrap: anywhere; }
}
.aside { font-size: 0.95rem; font-style: italic; }

/* Plates on the marginalia guide */
.plate { margin: 1.6rem 0; max-width: 40rem; }
.plate img { display: block; max-width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface); }
.plate figcaption { font-size: 0.92rem; margin-top: 0.5rem; }
.plate .credit { display: block; font-size: 0.85rem; opacity: 0.85; margin-top: 0.25rem; }

/* Reading links: label each so it reads as a link to the text */
.readings a[href*="drive.google.com"], .readings a[href*="prox.lib.ncsu.edu"] { font-weight: 600; text-underline-offset: 3px; }
.readings a[href*="drive.google.com"]::after { content: " (PDF, NC State sign-in)"; font-weight: 400; font-size: 0.85em; }
.readings a[href*="prox.lib.ncsu.edu"]::after { content: " (library, NC State sign-in)"; font-weight: 400; font-size: 0.85em; }
.example-label { font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em; color: var(--muted, inherit); margin-bottom: 0.1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
