/* ==========================================================================
   Intro to Physics — lecture page theme
   Shared stylesheet for all 38 lecture pages + the series index.
   Edit here once; every lecture page picks up the change.
   ========================================================================== */

/* --- 1. Design tokens ---------------------------------------------------- */
:root {
  /* Warm paper palette */
  --bg:            #fdfcf9;
  --bg-panel:      #f5f2ea;
  --bg-panel-alt:  #efebe0;
  --rule:          #e2ddd1;
  --rule-strong:   #c9c2b2;

  --text:          #232120;
  --text-soft:     #4a4642;
  --muted:         #7c756c;

  --accent:        #a8341f;   /* link red */
  --accent-hover:  #d0442a;
  --accent-tint:   #f6ebe6;
  --title-red:     #a01b10;   /* page / lecture title */

  /* Masthead: pale yellow panel under a darker gold band */
  --band:          #d8a625;
  --header-bg:     #fdf4d0;
  --header-rule:   #e6d49a;

  /* Type */
  --serif:  Georgia, "Iowan Old Style", "Palatino Linotype", Palatino,
            "Times New Roman", serif;
  --sans:   "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono:   "SF Mono", "Consolas", "Liberation Mono", Menlo, monospace;

  /* Layout widths. --measure is the cap on the reading column: set it to
     100% for full width, or e.g. 46rem to bring the lines back in. */
  --page-max:      96rem;              /* outer page width */
  --measure:       100%;               /* main column reading width */
  --aside-w:       23rem;              /* quote panel width */
  --gap:           3.75rem;            /* main <-> aside gutter */
  --radius:        3px;
}

/* --- 2. Reset & base ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(168, 52, 31, 0.28);
  transition: color .15s ease, border-color .15s ease;
}
a:hover { color: var(--accent-hover); border-bottom-color: var(--accent-hover); }

code, kbd, samp { font-family: var(--mono); font-size: .88em; }

/* Accessible skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: .6rem 1rem;
  border: 0; z-index: 100;
}
.skip-link:focus { left: 0; }

/* --- 3. Masthead --------------------------------------------------------- */
.masthead {
  background: var(--header-bg);
  border-top: 6px solid var(--band);      /* darker gold band across the top */
  border-bottom: 1px solid var(--header-rule);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .03);
  position: sticky; top: 0; z-index: 40;
}

.masthead__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: .8rem 2rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.masthead__series {
  font-family: var(--sans);
  font-size: .74rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #8a6d1f;
  border: 0;
}
.masthead__series:hover { color: var(--title-red); }

.masthead__nav {
  font-family: var(--sans);
  font-size: .78rem;
  display: flex;
  gap: 1.4rem;
  align-items: baseline;
}
.masthead__nav a { border: 0; color: #7a6b3e; }
.masthead__nav a:hover { color: var(--title-red); }
.masthead__nav .is-disabled { color: #c4b585; pointer-events: none; }

/* --- 4. Page layout ------------------------------------------------------ */
.wrap {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 2rem 6rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--aside-w);
  gap: var(--gap);
  align-items: start;
}

.main { min-width: 0; max-width: var(--measure); }

/* --- 5. Lecture title block ---------------------------------------------- */
.lecture-head { padding: 3.5rem 0 1.75rem; }

.lecture-head__eyebrow {
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}

.lecture-head h1 {
  font-size: clamp(2rem, 4.2vw, 2.9rem);
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--title-red);
  margin: 0 0 .9rem;
}

.lecture-head__byline {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--muted);
  margin: 0;
}
.lecture-head__byline a { border: 0; }

/* Publication date, under the byline */
.lecture-head__date {
  font-family: var(--sans);
  font-size: .74rem;
  letter-spacing: .04em;
  color: var(--muted);
  margin: .5rem 0 0;
}
.lecture-head__date time { border-bottom: 0; }

/* --- 6. Part label ("Part I — Comprehensive Lecture Report") -------------- */
.part-label {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--title-red);
  margin: 0 0 .3rem;
  padding-bottom: .7rem;
  border-bottom: 3px solid var(--band);
}
.part-label span {
  display: block;
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 400;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: .45rem;
}

/* Generous breathing room between Part I and Part II */
.part-break {
  margin-top: 7rem;
  padding-top: 3rem;
  border-top: 1px solid var(--rule);
}

/* --- 7. Table of contents ------------------------------------------------ */
.toc {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  background: var(--bg-panel);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem 1.2rem;
  margin: 0 0 3rem;
}
.toc__title {
  font-family: var(--sans);
  font-size: .7rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .9rem;
}

/* "Part I — …" divider inside the contents box */
.toc__part {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 700;
  color: var(--title-red);
  margin: 1.3rem 0 .5rem;
  padding-top: .8rem;
  border-top: 1px solid var(--rule);
}
.toc__part:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.toc__part span { font-weight: 400; color: var(--muted); }

.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.toc li { margin: .3rem 0; font-size: .94rem; }
.toc li::before {
  counter-increment: toc;
  content: counter(toc) ".";
  color: var(--muted);
  font-family: var(--sans);
  font-size: .78rem;
  margin-right: .5rem;
}
.toc a { border: 0; color: var(--text-soft); }
.toc a:hover, .toc a.is-active { color: var(--accent); }
.toc a.is-active { font-weight: 700; }

/* --- 8. Body typography -------------------------------------------------- */
.prose h2 {
  font-size: 1.52rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.008em;
  color: var(--title-red);
  margin: 3rem 0 .9rem;
  padding-top: .4rem;
  scroll-margin-top: 5rem;
}
.prose h3 {
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--title-red);
  margin: 2.1rem 0 .7rem;
  scroll-margin-top: 5rem;
}
.prose h4 {
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.8rem 0 .5rem;
}
.prose p { margin: 0 0 1.15rem; }
.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.prose li { margin: .45rem 0; }
.prose li::marker { color: var(--rule-strong); }
.prose strong { font-weight: 700; color: #14120f; }
.prose em { font-style: italic; }

.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 3rem 0;
}

/* Section rule above each h2, like a printed article */
.prose h2::before {
  content: "";
  display: block;
  width: 3.2rem;
  border-top: 2px solid var(--accent);
  margin-bottom: 1rem;
  opacity: .8;
}


/* --- 8b. Part I at 90% -----------------------------------------------------
   Scoped to .report so Part II (the transcript) is untouched. Every size here
   is the base value in section 8/9/10 multiplied by 0.9. To rescale Part I,
   change these nine numbers — nothing else. */
.prose.report            { font-size: .9em; }    /* 18px -> 16.2px body text */
.prose.report h2         { font-size: 1.37rem; } /* was 1.52 */
.prose.report h3         { font-size: 1.04rem; } /* was 1.16 */
.prose.report h4         { font-size: .70rem; }  /* was .78  */
.prose.report table      { font-size: .81rem; }  /* was .90  */
.prose.report thead th   { font-size: .70rem; }  /* was .78  */
.prose.report caption    { font-size: .68rem; }  /* was .76  */
.prose.report .callout   { font-size: .86rem; }  /* was .96  */
.prose.report .chain     { font-size: .77rem; }  /* was .86  */

/* The Part I / Part II labels stay identical in both halves. */
.prose.report > .part-label { font-size: 1.5rem; }

/* --- 9. Tables ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 1.6rem 0 1.9rem; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: .9rem;
  font-family: var(--sans);
}
caption {
  caption-side: bottom;
  text-align: left;
  font-size: .76rem;
  color: var(--muted);
  padding-top: .6rem;
}
th, td {
  border: 1px solid var(--rule);
  padding: .55rem .7rem;
  text-align: left;
  vertical-align: top;
}
thead th {
  background: var(--bg-panel-alt);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .04em;
}
tbody th { background: var(--bg-panel); font-weight: 700; }
tbody tr:nth-child(even) td { background: rgba(245, 242, 234, .45); }

/* Small grey gloss inside a cell or sentence, e.g. "(electron)" */
.muted { color: var(--muted); font-size: .92em; }

/* --- 10. Callouts & figures ---------------------------------------------- */
.callout {
  background: var(--accent-tint);
  border: 1px solid #e8d5cd;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.6rem 0;
  font-size: .96rem;
}
.callout__label {
  font-family: var(--sans);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: .35rem;
}
.callout p:last-child { margin-bottom: 0; }

.pullquote {
  border-left: 3px solid var(--accent);
  padding: .2rem 0 .2rem 1.2rem;
  margin: 1.8rem 0;
  font-style: italic;
  color: var(--text-soft);
}

.chain {
  font-family: var(--sans);
  font-size: .86rem;
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin: 1.4rem 0;
  line-height: 2;
}
.chain b { color: var(--text); }
.chain .arrow { color: var(--accent); padding: 0 .35rem; }


/* --- 10b. Addendum ---------------------------------------------------------
   A box for material added by Claude that was not in the lecture. Visually
   distinct from .callout (which holds the lecturer's own asides). */
.addendum {
  border: 1px solid var(--header-rule);
  border-top: 4px solid var(--band);
  border-radius: var(--radius);
  background: rgba(253, 244, 208, .30);
  padding: 1.15rem 1.4rem 1.3rem;
  margin: 2.6rem 0;
}
.addendum__label {
  display: block;
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #8a6d1f;
  margin-bottom: .7rem;
}
.addendum h4 {
  font-family: var(--serif);
  font-size: 1.04rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--title-red);
  margin: 0 0 .6rem;
}
.addendum > :last-child { margin-bottom: 0; }
.addendum figure { margin: 1.5rem 0 1.2rem; }
.addendum svg { width: 100%; height: auto; display: block; }
.addendum figcaption {
  font-family: var(--sans);
  font-size: .72rem;
  line-height: 1.5;
  color: var(--muted);
  margin-top: .6rem;
}
.addendum__links {
  font-family: var(--sans);
  font-size: .78rem;
  list-style: none;
  margin: 1.1rem 0 0;
  padding: .9rem 0 0;
  border-top: 1px solid var(--header-rule);
}
.addendum__links li { margin: .35rem 0; }
.addendum__links li::before { content: "\2192"; color: var(--band); margin-right: .5rem; }

/* --- 11. Transcript ------------------------------------------------------ */
.transcript-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.btn {
  font-family: var(--sans);
  font-size: .74rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: .35rem .9rem;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--accent-tint); border-color: var(--accent); }

/* Part II is set in exactly the same serif, size and colour as Part I —
   only the headings and the speaker lines tell them apart. */
.transcript {
  font-size: 1rem;
  line-height: 1.62;
  color: var(--text);
  border-top: 1px solid var(--rule);
  padding-top: 1.75rem;
  margin-top: 1rem;
}
.transcript[hidden] { display: none; }
.transcript p { margin: 0 0 1.15rem; }

/* Editorial sub-headings inside the transcript — same weight as .prose h3,
   with a rule to mark the break in the talk. */
.transcript h3 {
  font-family: var(--serif);
  font-size: 1.16rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--title-red);
  margin: 3rem 0 1.1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 5rem;
}
.transcript h3::before {
  content: "";
  display: block;
  width: 2.2rem;
  border-top: 2px solid var(--band);
  margin-bottom: .8rem;
}
.transcript h3:first-child { margin-top: 0; }
.transcript h3 em { font-style: italic; }

/* Optional timestamp marker at the start of a transcript paragraph */
.ts {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: .05rem .35rem;
  margin-right: .55rem;
  vertical-align: .12em;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}
a.ts:hover { color: var(--accent); border-color: var(--accent); }

/* Student question / interjection inside the transcript */
.transcript .qa {
  border-left: 2px solid var(--band);
  background: rgba(253, 244, 208, .35);
  border-radius: 0 2px 2px 0;
  padding: .55rem 0 .55rem 1rem;
  margin: 0 0 1.15rem;
  color: var(--text-soft);
}
.qa__who {
  font-family: var(--sans);
  font-size: .66rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-right: .55rem;
}

/* Editor's note inserted into the transcript */
.ed {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--muted);
}
.ed::before { content: "["; }
.ed::after  { content: "]"; }

/* Paragraph a sidebar quote points at */
.transcript p.is-highlighted {
  background: linear-gradient(transparent 0, var(--accent-tint) 0);
  box-shadow: 0 0 0 .5rem var(--accent-tint);
  border-radius: 2px;
  transition: background .4s ease, box-shadow .4s ease;
}

/* --- 12. Right-hand quote panel ------------------------------------------ */
.aside { min-width: 0; }

/* The panel simply runs the full length of the article — no sticky box,
   no internal scrolling. Quotes are spaced out down the page. */
.aside__sticky {
  padding-top: 3.5rem;   /* aligns with the top of the lecture title */
}

.aside__title {
  font-family: var(--sans);
  font-size: .7rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.4rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--rule);
}

.quote {
  border-left: 2px solid var(--rule-strong);
  padding: .1rem 0 .1rem 1.1rem;
  margin: 0 0 3.5rem;
  font-size: 1rem;          /* same size as the main text */
  line-height: 1.62;
  color: var(--text-soft);
  transition: border-color .2s ease;
}
.quote:hover { border-left-color: var(--accent); }
.quote p { margin: 0 0 .75rem; }
.quote p:first-child::before { content: "\201C"; }
.quote p:last-of-type::after  { content: "\201D"; }
.quote__tag {
  display: block;
  font-family: var(--sans);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: .6rem;
}
.quote__tag a { border: 0; }

/* Quotes are shown in full — the panel has the whole page length to use. */
.quote__body { position: relative; }

/* --- 13. Footer / pager -------------------------------------------------- */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  padding-top: 1.5rem;
  font-family: var(--sans);
  font-size: .82rem;
}
.pager a { border: 0; display: block; max-width: 18rem; }
.pager__dir {
  display: block;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .2rem;
}
.pager__next { text-align: right; margin-left: auto; }

.colophon {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding: 1.5rem 0 0;
  font-family: var(--sans);
  font-size: .76rem;
  color: var(--muted);
}

/* --- 14. Series index page ----------------------------------------------- */
.index-head { padding: 4rem 0 2rem; max-width: 44rem; }
.index-head h1 { font-size: clamp(2.2rem, 5vw, 3.1rem); margin: 0 0 1rem; line-height: 1.14; }
.index-head p  { color: var(--text-soft); font-size: 1.05rem; margin: 0 0 .8rem; }

.lecture-list { list-style: none; margin: 2rem 0 0; padding: 0; max-width: 52rem; }
.lecture-list li { border-top: 1px solid var(--rule); }
.lecture-list li:last-child { border-bottom: 1px solid var(--rule); }
.lecture-list a {
  display: flex; gap: 1.2rem; align-items: baseline;
  padding: .95rem .5rem; border: 0; color: var(--text);
}
.lecture-list a:hover { background: var(--bg-panel); color: var(--accent); }
.lecture-list .num {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted);
  min-width: 2.2rem;
}
.lecture-list .todo { color: var(--muted); font-style: italic; }
.lecture-list .todo:hover { background: transparent; color: var(--muted); }

/* --- 15. Responsive ------------------------------------------------------ */
@media (max-width: 1080px) {
  :root { --aside-w: 17rem; --gap: 2.25rem; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .main { max-width: none; }
  .aside {
    order: 2;
    border-top: 1px solid var(--rule);
    padding-top: 1.75rem;
    margin-top: 2.5rem;
  }
  .aside__sticky { padding-top: 0; }
}

@media (max-width: 620px) {
  body { font-size: 17px; }
  .wrap, .masthead__inner { padding-left: 1.1rem; padding-right: 1.1rem; }
  .lecture-head { padding-top: 2.25rem; }
}

/* --- 16. Print ----------------------------------------------------------- */
@media print {
  .masthead, .pager, .btn { display: none !important; }
  body { font-size: 11pt; background: #fff; }
  .layout { display: block; }
  .aside { margin-top: 2rem; page-break-inside: avoid; }
  .aside__sticky { padding-top: 0; }
  a { color: inherit; border: 0; }
}
