/* ============================================================
   Geography XL 1 — slide archive
   Design tokens
   ============================================================ */
:root {
  --paper: #f5f2ea;
  --paper-2: #eeeae0;
  --card: #fffdf8;
  --ink: #101c24;
  --ink-2: #2b3b46;
  --muted: #5d6d78;
  --line: #d9d3c5;
  --line-2: #c6bfae;
  --blue: #1e3a8a;
  --blue-2: #2b4fb8;
  --blue-soft: #eef1fb;
  --rust: #a8481a;
  --ice: #0e7490;
  --green: #15803d;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 28, 36, .05);
  --shadow: 0 1px 2px rgba(16, 28, 36, .05), 0 18px 40px -28px rgba(16, 28, 36, .45);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Songti SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, "Helvetica Neue", Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bar-h: 64px;
  --side-w: 250px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
}

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--blue-2); }

h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }

.dim { color: var(--muted); }

:focus-visible {
  outline: 3px solid var(--blue-2);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============================================================
   Slide canvas — geometry is expressed in container units so a
   slide is pixel-perfect at any width.
   ============================================================ */
.slide {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #fff;
  container-type: inline-size;
  isolation: isolate;
}
.slide .it { position: absolute; box-sizing: border-box; }
.slide img { display: block; }
.slide .it > img { width: 100%; height: 100%; object-fit: fill; }
.slide .bgimg {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%;
  object-fit: fill; z-index: 0;
}
.slide .cr { position: absolute; inset: 0; display: block; overflow: hidden; }
.slide .cr img { position: absolute; max-width: none; object-fit: fill; }
.slide p { margin: 0; font-kerning: normal; overflow-wrap: break-word; }
.slide .tx { width: 100%; }
.slide .bl { display: inline-block; text-align: left; white-space: nowrap; }
.slide .bli { width: .52em; height: .52em; display: inline-block; vertical-align: -.02em; }
.slide .vposter { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.slide .vid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;      /* PowerPoint stretches the poster/video into the placeholder */
  background: transparent;
}

/* text safety net: PowerPoint "shrink to fit" behaviour, applied by site.js */
.slide .fitbox { transform-origin: top center; }

/* ============================================================
   Hero / index
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1200px 420px at 78% -12%, rgba(30, 58, 138, .16), transparent 70%),
    radial-gradient(900px 380px at 8% 108%, rgba(14, 116, 144, .13), transparent 70%),
    linear-gradient(180deg, #fbf9f4 0%, var(--paper) 70%);
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    repeating-radial-gradient(circle at 20% 120%, transparent 0 46px, rgba(16, 28, 36, .045) 46px 47px),
    repeating-radial-gradient(circle at 88% -10%, transparent 0 60px, rgba(16, 28, 36, .04) 60px 61px);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 78%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 78%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 88px 28px 64px;
}
.eyebrow {
  margin: 0 0 22px;
  font: 600 12px/1 var(--mono);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--blue);
}
.hero h1 {
  font-size: clamp(40px, 7vw, 76px);
  line-height: .98;
  max-width: 15ch;
}
.lede {
  margin: 20px 0 0;
  font-family: var(--serif);
  font-size: clamp(18px, 2.2vw, 23px);
  color: var(--ink-2);
}
.intro {
  margin: 18px 0 0;
  max-width: 60ch;
  color: var(--ink-2);
  font-size: 16.5px;
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 32px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14px;
}
.stat b { font-family: var(--serif); font-size: 21px; color: var(--ink); margin-right: 4px; }
.jump { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 600 14px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.btn:hover { background: rgba(16, 28, 36, .045); border-color: var(--ink-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-2); border-color: var(--blue-2); color: #fff; }
.btn.ghost { background: rgba(255, 253, 248, .7); }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.icon { padding: 8px 14px; font-size: 13px; border-radius: 9px; }
.btn .bi { display: none; font-size: 12px; line-height: 1; }

/* ---- section head ---- */
.sec-head {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 28px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
}
.sec-head h2 { font-size: clamp(24px, 3vw, 32px); }
.sec-head p { margin: 0; font-size: 14px; }

/* ---- lesson grid ---- */
.grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 28px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 26px;
}
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.card-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.cover {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}
.cover-slide { pointer-events: none; }
.cover::after {
  content: "";
  position: absolute; inset: 0;
  box-shadow: inset 0 -14px 24px -18px rgba(16, 28, 36, .55);
  pointer-events: none;
}
.card-body { padding: 20px 22px 22px; }
.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.num {
  font: 600 26px/1 var(--serif);
  color: var(--blue);
  letter-spacing: -.02em;
}
.count { font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.card h3 { font-size: 21px; line-height: 1.28; }
.card .zh { margin: 7px 0 0; font-size: 14.5px; color: var(--rust); letter-spacing: .01em; }
.card .blurb { margin: 12px 0 0; font-size: 14.5px; color: var(--ink-2); }
.topics {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.topics li {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.35;
}
.cta {
  display: inline-block;
  margin-top: 16px;
  font: 600 13.5px/1 var(--sans);
  color: var(--blue);
}

/* ============================================================
   Lecture page chrome
   ============================================================ */
.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--bar-h);
  padding: 0 20px;
  background: rgba(250, 248, 243, .86);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  text-decoration: none;
  color: var(--ink);
  flex: 0 0 auto;
  line-height: 1;
}
.brand .mk { font: 700 12px/1 var(--mono); letter-spacing: .18em; }
.brand .mkt { font: 600 10px/1 var(--mono); letter-spacing: .14em; color: var(--muted); }
.bar-title { min-width: 0; flex: 1 1 auto; }
.kicker { display: block; font: 600 10.5px/1 var(--mono); letter-spacing: .18em; color: var(--blue); }
.bar-title h1 {
  margin-top: 5px;
  font-size: 17px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-tools { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.counter {
  font: 600 13px/1 var(--mono);
  color: var(--muted);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  min-width: 74px;
  text-align: center;
}
.counter b { color: var(--ink); }
.counter .of { font-weight: 500; }

/* progress bar under the top bar */
#progress {
  position: fixed;
  top: var(--bar-h);
  left: 0;
  height: 2px;
  width: 100%;
  z-index: 31;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--blue), var(--ice));
  transition: transform .12s linear;
}

.layout {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  gap: 0;
  align-items: start;
  max-width: 1560px;
  margin: 0 auto;
}

/* ---- sidebar ---- */
.side {
  position: sticky;
  top: var(--bar-h);
  max-height: calc(100dvh - var(--bar-h));
  overflow-y: auto;
  padding: 22px 18px 40px 22px;
  border-right: 1px solid var(--line);
  font-size: 13px;
}
.side-head {
  margin: 0 0 10px;
  font: 600 10.5px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.side-head + .side-head { margin-top: 26px; }
.toc { display: flex; flex-direction: column; gap: 1px; }
.toc a {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 6px;
  align-items: baseline;
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.32;
}
.toc a b { font: 600 11.5px/1 var(--mono); color: var(--muted); }
.toc a:hover { background: rgba(16, 28, 36, .05); color: var(--ink); }
.toc a.on { background: var(--blue); color: #fff; }
.toc a.on b { color: rgba(255, 255, 255, .75); }
.jumpbox { display: flex; gap: 8px; }
.jumpbox input {
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--card);
  font: 500 13px/1 var(--mono);
  color: var(--ink);
}
.side-note {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

/* ---- deck ---- */
.deck {
  min-width: 0;
  padding: 26px 26px 60px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.sw {
  margin: 0;
  scroll-margin-top: calc(var(--bar-h) + 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 1180px;
  width: 100%;
  margin-inline: auto;
}
.frame {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 28, 36, .07), 0 22px 46px -34px rgba(16, 28, 36, .55);
  outline: 1px solid rgba(16, 28, 36, .09);
  outline-offset: -1px;
}
.sw figcaption {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font: 500 11.5px/1 var(--mono);
  letter-spacing: .04em;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink-2);
  font-weight: 600;
}
.sw:target .pill { background: var(--blue); border-color: var(--blue); color: #fff; }

.lectnav {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 26px 70px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.pager {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.pager:hover { border-color: var(--line-2); transform: translateY(-2px); color: var(--ink); }
.pager .k { font: 600 10.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.pager .t { font-family: var(--serif); font-size: 18px; line-height: 1.25; }
.pager:nth-child(2) { text-align: right; align-items: flex-end; }
.pager.ghost { visibility: hidden; }

/* ---- footer ---- */
.site-foot {
  max-width: 1100px;
  margin: 0 auto;
  padding: 34px 28px 60px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
}
.site-foot p { margin: 0 0 6px; }

/* ============================================================
   Presentation mode (one slide per screen)
   ============================================================ */
body.present { overflow: hidden; }
body.present .bar { background: rgba(16, 28, 36, .92); border-bottom-color: rgba(255, 255, 255, .12); color: #fff; }
body.present .bar .kicker { color: #9dc0ff; }
body.present .brand { color: #fff; }
body.present .brand .mkt { color: rgba(255, 255, 255, .6); }
body.present .counter { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #dbe6ff; }
body.present .counter b { color: #fff; }
body.present .bar-tools .btn { border-color: rgba(255, 255, 255, .22); color: #fff; }
body.present .bar-tools .btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
body.present .layout { display: block; }
body.present .side { display: none; }
body.present .deck {
  height: calc(100dvh - var(--bar-h));
  padding: 0;
  gap: 0;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  background: #0b1420;
  scrollbar-width: none;
}
body.present .deck::-webkit-scrollbar { display: none; }
body.present .sw {
  height: calc(100dvh - var(--bar-h));
  justify-content: center;
  gap: 0;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  max-width: none;
}
body.present .frame {
  width: min(100vw - 48px, (100dvh - var(--bar-h)) * 4 / 3);
  border-radius: 6px;
  outline: none;
}
body.present .sw figcaption { display: none; }
body.present .lectnav,
body.present .site-foot { display: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1080px) {
  :root { --side-w: 210px; }
  .deck { padding: 20px 18px 50px; }
}
@media (max-width: 860px) {
  .layout { display: block; }
  .side { display: none; }
  .bar { gap: 12px; padding: 0 14px; }
  .bar-title h1 { font-size: 15px; }
  .counter { min-width: 64px; }
  .deck { padding: 14px 12px 40px; gap: 18px; }
  /* keep slides readable on phones: allow horizontal pan instead of shrinking text to nothing */
  .sw { align-items: stretch; }
  .frame { overflow-x: auto; }
  .frame > .slide { min-width: 680px; }
  .lectnav { grid-template-columns: 1fr; padding: 0 14px 50px; }
  .pager:nth-child(2) { text-align: left; align-items: flex-start; }
  .hero-inner { padding: 64px 20px 44px; }
  .grid { padding: 14px 16px 60px; gap: 18px; }
  .sec-head { padding: 40px 18px 6px; }
  .site-foot { padding: 28px 18px 50px; }
}
@media (max-width: 560px) {
  .brand { display: none; }
  .btn .lbl { display: none; }
  .btn .bi { display: inline; }
  .btn.icon { padding: 8px 11px; }
  .bar { padding: 0 10px; gap: 8px; }
  .bar-title h1 { font-size: 13.5px; margin-top: 4px; }
  .kicker { font-size: 9.5px; letter-spacing: .14em; }
  .btn.icon { padding: 7px 10px; font-size: 12px; }
  .counter { min-width: 54px; padding: 6px 6px; font-size: 12px; }
  .frame { -webkit-overflow-scrolling: touch; }
  .sw { position: relative; padding-bottom: 20px; gap: 4px; }
  .sw::after {
    content: "← 左右滑动查看整页 →";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    white-space: nowrap;
    font: 500 10.5px/1 var(--mono);
    letter-spacing: .04em;
    color: var(--muted);
    opacity: .75;
  }
  .sw figcaption { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  body.present .deck { scroll-behavior: auto; }
}

/* ============================================================
   Print: exactly one slide per 10 × 7.5 in page
   ============================================================ */
@page { size: 10in 7.5in; margin: 0; }
@media print {
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  .bar, .side, #progress, .lectnav, .site-foot, .sw figcaption { display: none !important; }
  .slide .vid { display: none !important; }   /* browsers do not print video; the poster <img> stands in */
  .layout { display: block; }
  .deck { padding: 0; gap: 0; display: block; }
  .sw { display: block; max-width: none; margin: 0; break-after: page; page-break-after: always; }
  .sw:last-child { break-after: auto; page-break-after: auto; }
  .frame { box-shadow: none; outline: none; border-radius: 0; overflow: hidden; }
  .frame > .slide, .slide {
    width: 10in !important;
    height: 7.5in !important;
    min-width: 0 !important;
    aspect-ratio: auto !important;
    break-inside: avoid;
  }
  img { break-inside: avoid; }
}
