/* Shared course stylesheet: Tufte-inspired, print-friendly */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --paper: #fffff8;
  --ink: #1f1b16;
  --muted: #6b6257;
  --rule: #d9d2c3;
  --accent: #7a2e1f;        /* madder red */
  --linen: #f3eee2;
  --good: #2f6b3a;
  --bad: #9a2d22;
  --measure: 38rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1b1915; --ink: #ece6d8; --muted: #a89f90; --rule: #3a352d;
    --accent: #e0876f; --linen: #26231d; --good: #7cc48a; --bad: #ef8a7c;
  }
}

* { box-sizing: border-box; }
html { font-size: 19px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  line-height: 1.55; padding: 3rem 16px 5rem;
}
main { max-width: var(--measure); margin: 0 auto; }

h1 { font-weight: 400; font-size: 2.2rem; line-height: 1.15; margin: 0 0 .3rem; }
h2 { font-weight: 400; font-style: italic; font-size: 1.45rem; margin: 2.4rem 0 .6rem; }
h3 { font-weight: 600; font-size: 1.05rem; margin: 1.6rem 0 .4rem; }
p, li { hyphens: auto; }
.subtitle { font-style: italic; color: var(--muted); font-size: 1.15rem; margin: 0 0 2rem; }
.kicker { font-variant: small-caps; letter-spacing: .08em; color: var(--accent); font-size: .9rem; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

/* Citations: small superscript links */
sup.cite a { font-size: .7rem; text-decoration: none; padding-left: 1px; }

/* Sidenotes (Tufte-ish): float right on wide screens, inline on narrow */
.sidenote {
  font-size: .82rem; color: var(--muted); line-height: 1.4;
  border-left: 2px solid var(--rule); padding-left: .7rem; margin: .8rem 0;
}
@media (min-width: 1100px) {
  .sidenote { float: right; clear: right; width: 15rem; margin-right: -18rem; border: 0; padding: 0; margin-top: .2rem; }
}

/* Callouts */
.callout { background: var(--linen); border-left: 3px solid var(--accent); padding: .9rem 1.1rem; margin: 1.5rem 0; }
.callout p:first-child { margin-top: 0; } .callout p:last-child { margin-bottom: 0; }
.debate { border-left-color: var(--muted); }
.debate .kicker { color: var(--muted); }

/* Layer diagram */
.layers { margin: 1.5rem 0; border: 1px solid var(--rule); }
.layers div { padding: .55rem .9rem; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 1rem; }
.layers div:first-child { border-top: 0; }
.layers span:last-child { color: var(--muted); font-style: italic; text-align: right; }
.layers .hl { background: var(--linen); }

/* Predict box */
details.predict { border: 1px dashed var(--rule); padding: .8rem 1rem; margin: 1.5rem 0; }
details.predict summary { cursor: pointer; font-style: italic; }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: .95rem; margin: 1rem 0; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; }

/* Footer blocks */
.primary-source, .ask { margin: 2rem 0; padding: 1rem 1.1rem; border: 1px solid var(--rule); }
.nav { display: flex; justify-content: space-between; font-size: .95rem; margin-top: 3rem; }
ol.refs { font-size: .85rem; color: var(--muted); }

@media print {
  body { background: #fff; color: #000; padding: 0; font-size: 11pt; }
  .quiz button { display: none; }
  .quiz .explain { display: block !important; }
  a { color: #000; }
  .nav, .ask { display: none; }
}

/* Course home */
.meta { font-size: .85rem; color: var(--muted); font-style: italic; }
main > ol li, main > ul li { margin: .35rem 0; }
.home-link { font-size: .9rem; margin-top: 3rem; }
