/* ============================================================
   Craig M. McGill — personal & professional site
   Palette: muted Easter pastels, each keyed to a content domain.
   Motif: the proscenium arch (a nod to his musical theatre work).
   Type: Fraunces (display) + Karla (body).
   ============================================================ */

/* ---------- Self-hosted variable fonts (SIL Open Font License) ---------- */
/* Fraunces by Undercase Type; Karla by Jonny Pinhorn. See fonts/OFL.txt */

@font-face {
  font-family: "Fraunces";
  src: url("fonts/Fraunces.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("fonts/Fraunces-Italic.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Karla";
  src: url("fonts/Karla.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Karla";
  src: url("fonts/Karla-Italic.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}


:root {
  /* Ink & paper */
  --ink:        #2E2036;
  --ink-soft:   #5E4E67;
  --ink-faint:  #6A5B72;
  --paper:      #F8F2F7;
  --paper-deep: #EFE5F0;
  --rule:       #DDCEE1;
  --white:      #FFFFFF;

  /* Domain accents */
  --lilac:  #C3ABDA;   /* research & scholarship */
  --sage:   #A3C4AC;   /* teaching & advising   */
  --blush:  #EDBAC2;   /* the arts, the personal */
  --sky:    #A4C2DC;   /* service & leadership  */
  --butter: #EFD79B;   /* honours & recognition */

  /* Accent washes */
  --lilac-wash:  #EBE0F4;
  --sage-wash:   #E1EEE4;
  --blush-wash:  #FAE6EA;
  --sky-wash:    #E1ECF5;
  --butter-wash: #FAF0DC;

  /* Type */
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Karla", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Measure & rhythm */
  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --band: clamp(3.5rem, 8vw, 6.5rem);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
:target { scroll-margin-top: 5.5rem; }
[id] { scroll-margin-top: 5.5rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Layout primitives ---------- */
.wrap {
  max-width: 68rem;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.wrap-narrow {
  max-width: 46rem;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.band { padding-block: var(--band); }
.band-tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.hero + .band-tight { padding-top: clamp(1.75rem, 3vw, 2.5rem); }

.band-lilac  { background: var(--lilac-wash); }
.band-sage   { background: var(--sage-wash); }
.band-blush  { background: var(--blush-wash); }
.band-sky    { background: var(--sky-wash); }
.band-butter { background: var(--butter-wash); }
.band-deep   { background: var(--paper-deep); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 500;
  font-variation-settings: "SOFT" 40, "WONK" 1;
  line-height: 1.12;
  margin: 0;
  letter-spacing: -0.015em;
}

h1 { font-size: clamp(2.6rem, 8vw, 5.25rem); }
h2 { font-size: clamp(1.85rem, 4vw, 2.6rem); line-height: 1.16; }
h3 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); line-height: 1.25; }
h4 { font-size: 1.0625rem; line-height: 1.35; font-weight: 600; }

p { margin: 0 0 1.1em; max-width: var(--measure); }
.prose p { max-width: 38rem; }
.prose { font-size: 1.09rem; }

.lead {
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 33rem;
}

.meta {
  font-size: 0.9rem;
  color: var(--ink-faint);
  line-height: 1.5;
}

em, i { font-style: italic; }

/* Section headings carry a coloured rule that indexes the domain */
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--rule);
}

.sec-head h2 { flex: 1 1 auto; }

.sec-head .count {
  font-family: var(--display);
  font-size: 1rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.rule-tag {
  display: block;
  width: 3.5rem;
  height: 6px;
  border-radius: 3px;
  margin-bottom: 1.1rem;
}
.rule-lilac  { background: var(--lilac); }
.rule-sage   { background: var(--sage); }
.rule-blush  { background: var(--blush); }
.rule-sky    { background: var(--sky); }
.rule-butter { background: var(--butter); }

/* ---------- Site header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.25rem;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: clamp(0.85rem, 2.4vw, 1.9rem);
  flex-wrap: wrap;
  align-items: center;
}

.nav a {
  font-size: 0.96rem;
  text-decoration: none;
  color: var(--ink-soft);
  padding-block: 0.35rem;
  border-bottom: 2px solid transparent;
}

.nav a:hover { color: var(--ink); border-bottom-color: var(--lilac); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--lilac); }

/* ---------- The arch: the site's signature frame ---------- */
/* A flat-shouldered proscenium, not a semicircle. */
.arch {
  position: relative;
  overflow: hidden;
  border-radius: 48% 48% 10px 10px / 34% 34% 10px 10px;
  background: var(--paper-deep);
}

.arch img { width: 100%; height: 100%; object-fit: cover; }

.arch-sm {
  border-radius: 48% 48% 8px 8px / 30% 30% 8px 8px;
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2.5rem, 5vw, 4rem);
  background:
    radial-gradient(90rem 40rem at 12% -10%, var(--blush-wash) 0%, transparent 58%),
    radial-gradient(70rem 46rem at 92% 6%,  var(--sky-wash)   0%, transparent 60%),
    linear-gradient(180deg, var(--lilac-wash) 0%, var(--paper) 92%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.hero h1 { margin-bottom: 0.65rem; }

.hero .role {
  font-family: var(--display);
  font-size: clamp(1.02rem, 1.8vw, 1.18rem);
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
  line-height: 1.45;
  max-width: 34rem;
}

.hero-portrait {
  position: relative;
  max-width: 25rem;
  margin-inline: auto;
  width: 100%;
}

/* Layered pastel bands behind the portrait */
.hero-portrait::before {
  content: "";
  position: absolute;
  inset: -1.35rem -1.35rem 2.25rem;
  border-radius: 48% 48% 10px 10px / 34% 34% 10px 10px;
  background: linear-gradient(160deg, var(--blush) 0%, var(--lilac) 48%, var(--sky) 100%);
  opacity: 0.5;
  z-index: 0;
}

.hero-portrait .arch { position: relative; z-index: 1; aspect-ratio: 4 / 5; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-block;
  font-family: var(--body);
  font-size: 0.98rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.7rem 1.35rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  transition: background 0.18s ease, color 0.18s ease;
}

.btn:hover { background: transparent; color: var(--ink); }

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}

.btn-quiet:hover { background: var(--white); border-color: var(--ink); color: var(--ink); }

/* ---------- Impact figures ---------- */
.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1.5rem 2rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding-block: 1.75rem;
}

.figure .n {
  font-family: var(--display);
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  font-variation-settings: "SOFT" 40, "WONK" 1;
  line-height: 1;
  display: block;
}

.figure .l {
  font-size: 0.9rem;
  color: var(--ink-faint);
  margin-top: 0.4rem;
  display: block;
}

.cv-row {
  display: flex; align-items: center; gap: 1rem 1.25rem;
  flex-wrap: wrap; margin-top: 1.5rem;
}
.cv-row .stamp { font-size: 0.85rem; color: var(--ink-faint); }

.figures-note { font-size: 0.85rem; color: var(--ink-faint); margin-top: 1rem; }

/* ---------- Domain blocks ---------- */
.domains {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 46rem) { .domains { grid-template-columns: 1fr; } }

.domain {
  padding: 1.75rem 1.6rem;
  border-radius: 4px 4px 4px 4px;
  background: var(--white);
  border: 1px solid var(--rule);
}

.domain h3 { margin-bottom: 0.6rem; }
.domain p { font-size: 0.99rem; margin-bottom: 0; color: var(--ink-soft); max-width: none; }

/* ---------- Books ---------- */
.books { display: grid; gap: 1.1rem; }

.book {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 1.35rem;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
}

.book .spine { background: var(--lilac); }
.book:nth-child(2n) .spine { background: var(--sage); }
.book:nth-child(3n) .spine { background: var(--blush); }
.book:nth-child(4n) .spine { background: var(--sky); }
.book:nth-child(5n) .spine { background: var(--butter); }

.book .body { padding: 1.4rem 1.5rem 1.5rem 0; }
.book h3 { margin-bottom: 0.45rem; font-size: 1.18rem; }
.book .imprint { font-size: 0.95rem; color: var(--ink-soft); margin: 0; max-width: none; }
.book .status { font-size: 0.85rem; color: var(--ink-faint); margin: 0.4rem 0 0; max-width: none; }

/* ---------- Publication lists ---------- */
.year-group { margin-bottom: 2.75rem; }

.year-group > h3 {
  font-size: 1.5rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.25rem;
  border-bottom: 2px solid var(--lilac);
  display: inline-block;
  min-width: 4.5rem;
}

.pubs { list-style: none; margin: 0; padding: 0; }

.pubs li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1rem;
  line-height: 1.55;
  max-width: 46rem;
}

.pubs li:last-child { border-bottom: 0; }

.pubs .self { font-weight: 700; }
.pubs .venue { font-style: italic; color: var(--ink-soft); }
.pubs .doi { font-size: 0.85rem; color: var(--ink-faint); display: block; margin-top: 0.3rem; }
.pubs .doi a { color: var(--ink-faint); }
.pubs .doi a:hover { color: var(--ink); }

.tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  background: var(--butter-wash);
  border: 1px solid var(--butter);
  color: var(--ink);
  margin-left: 0.4rem;
  vertical-align: 1px;
  white-space: nowrap;
}

.tag-award { background: var(--butter-wash); border-color: var(--butter); }
.tag-forth { background: var(--sage-wash); border-color: var(--sage); }

/* ---------- Plain lists ---------- */
.stack { list-style: none; margin: 0; padding: 0; }

.stack li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
  max-width: 46rem;
  font-size: 1rem;
}

.stack li:last-child { border-bottom: 0; }

.stack .when { color: var(--ink-faint); font-size: 0.9rem; }

.cols-2 {
  columns: 2;
  column-gap: 2.5rem;
  max-width: 52rem;
}

.cols-2 li { break-inside: avoid; }

/* Long reference lists: no rules, tighter rhythm, three columns */
.list-plain { list-style: none; margin: 0; padding: 0; }

.list-plain li {
  padding: 0.22rem 0;
  border: 0;
  font-size: 0.97rem;
  line-height: 1.45;
  break-inside: avoid;
}

.cols-3 {
  columns: 3;
  column-gap: 2.5rem;
  max-width: 60rem;
}

@media (max-width: 62rem) { .cols-3 { columns: 2; } }
@media (max-width: 40rem) { .cols-3 { columns: 1; } }

/* ---------- Pull quote / philosophy ---------- */
.triptych {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.75rem, 3.5vw, 2.75rem);
}

.triptych h3 {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 0 0 0.85rem;
}

.triptych .tq {
  font-family: var(--display);
  font-size: 1.12rem;
  line-height: 1.36;
  color: var(--ink);
  margin-bottom: 0.9rem;
}

.triptych p { font-size: 0.97rem; color: var(--ink-soft); max-width: none; }
.triptych p:last-child { margin-bottom: 0; }

@media (max-width: 56rem) { .triptych { grid-template-columns: 1fr; gap: 2.5rem; } }

.quote {
  font-family: var(--display);
  font-size: clamp(1.3rem, 2.9vw, 1.85rem);
  line-height: 1.38;
  font-variation-settings: "SOFT" 60, "WONK" 1;
  max-width: 30rem;
  margin: 0;
  text-wrap: balance;
}

.quote-cite { font-family: var(--body); font-size: 0.92rem; color: var(--ink-faint); margin-top: 1rem; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.split-even {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.side-portrait { max-width: 20rem; }
.side-portrait .arch { aspect-ratio: 4 / 5; }

/* ---------- Timeline (education / appointments) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1.25rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
  max-width: 46rem;
}

.timeline li:last-child { border-bottom: 0; }

.timeline .yr {
  font-family: var(--display);
  font-size: 1.02rem;
  color: var(--ink-soft);
  padding-top: 0.1rem;
}

.timeline .what { font-weight: 600; display: block; }
.timeline .where { color: var(--ink-soft); font-size: 0.97rem; display: block; }
.timeline .note { color: var(--ink-faint); font-size: 0.9rem; display: block; margin-top: 0.25rem; }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.contact-lines { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.contact-lines li { padding: 0.55rem 0; border-bottom: 1px solid var(--rule); }
.contact-lines li:last-child { border-bottom: 0; }
.contact-lines .k { color: var(--ink-faint); font-size: 0.88rem; display: block; }
.contact-lines .v { font-size: 1.05rem; }

/* ---------- Footer ---------- */
.site-foot {
  border-top: 1px solid var(--rule);
  padding-block: 2.5rem 3rem;
  font-size: 0.93rem;
  color: var(--ink-faint);
}

.site-foot .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.foot-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.foot-nav a { text-decoration: none; color: var(--ink-soft); }
.foot-nav a:hover { text-decoration: underline; }

/* ---------- Page intro ---------- */
.page-intro { padding-block: clamp(2.5rem, 5vw, 4rem) clamp(1rem, 2vw, 1.5rem); }
.page-intro + .band-tight { padding-top: 0; }
.page-intro .lead { max-width: 36rem; }
.page-intro h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); margin-bottom: 0.75rem; }

/* ---------- One orchestrated entrance, hero only ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.hero h1,
.hero .role,
.hero .lead,
.hero .actions,
.hero-portrait {
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.hero h1        { animation-delay: 0.05s; }
.hero .role     { animation-delay: 0.14s; }
.hero .lead     { animation-delay: 0.22s; }
.hero .actions  { animation-delay: 0.3s; }
.hero-portrait  { animation-delay: 0.12s; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 62rem) {
  .hero-grid { grid-template-columns: 1fr; }
  .quote { margin-bottom: 0.5rem; }
  .hero-portrait { order: -1; max-width: 17rem; margin-inline: 0 0 0 1.35rem; }
  .split, .split-even, .contact-grid { grid-template-columns: 1fr; }
  .side-portrait { max-width: 15rem; }
}

@media (max-width: 40rem) {
  body { font-size: 1.02rem; }
  .sec-head { flex-wrap: wrap; }
  .sec-head .count { white-space: normal; }
  .cols-2 { columns: 1; }
  .timeline li { grid-template-columns: 1fr; gap: 0.3rem; }
  .site-head .wrap { min-height: 0; padding-block: 0.75rem; }
  .nav { gap: 0.9rem; }
  .nav a { font-size: 0.9rem; }
  .book { grid-template-columns: 6px 1fr; gap: 1rem; }
  .book .body { padding-right: 1.1rem; }
}

/* ---------- Print ---------- */
@media print {
  .site-head, .site-foot, .actions { display: none; }
  body { background: #fff; font-size: 11pt; }
  .band { padding-block: 1rem; }
}

/* ---------- Research map ---------- */
/* A 3-row grid mirroring Craig's own diagram: theme / concept sub-division / audience.
   Theme I and its children are sage; Theme II and its children are sky;
   Organizational Identity straddles the two because it belongs to both. */
.rmap {
  --rmap-label: 7.5rem;
  display: grid;
  grid-template-columns: var(--rmap-label) repeat(6, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 0.85rem;
  align-items: stretch;
  padding: 1.1rem;
  border-radius: 6px;
  background: var(--white);
  border: 1px solid var(--rule);
}

.rmap-label {
  grid-column: 1;
  align-self: center;
  font-family: var(--display);
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--ink-soft);
  padding-right: 0.5rem;
}

.rmap-node {
  font: inherit;
  font-family: var(--display);
  font-weight: 600;
  font-variation-settings: "SOFT" 40, "WONK" 1;
  letter-spacing: -0.01em;
  color: var(--ink);
  border: 1.5px solid transparent;
  border-radius: 8px;
  padding: 1rem 0.9rem;
  cursor: pointer;
  text-align: center;
  line-height: 1.25;
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.rmap-node:hover,
.rmap-node:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(46, 32, 54, 0.14);
  border-color: var(--ink);
}

.rmap-node:active { transform: none; box-shadow: none; }

.rmap-theme { font-size: clamp(1.15rem, 2vw, 1.45rem); min-height: 5.25rem; }
.rmap-theme .rmap-num { font-weight: 400; margin-right: 0.35em; opacity: 0.75; }
.rmap-sub { font-size: clamp(0.98rem, 1.5vw, 1.08rem); }

.rmap-theme.rmap-i  { grid-column: 2 / span 3; background: var(--sage); }
.rmap-theme.rmap-ii { grid-column: 5 / span 3; background: var(--sky); }

.rmap-sub.rmap-i     { background: var(--sage-wash); border-color: var(--sage); }
.rmap-sub.rmap-ii    { background: var(--sky-wash);  border-color: var(--sky); }
.rmap-sub.rmap-bridge {
  grid-column: span 2;
  background: linear-gradient(100deg, var(--sage-wash) 0%, var(--sky-wash) 100%);
  border-color: var(--lilac);
}

.rmap-aud {
  margin: 0;
  max-width: none;
  padding: 0.9rem 1rem;
  border-radius: 8px;
  font-size: 0.93rem;
  line-height: 1.45;
  color: var(--ink-soft);
  text-align: center;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rmap-aud.rmap-i  { grid-column: 2 / span 3; background: var(--sage-wash); }
.rmap-aud.rmap-ii { grid-column: 5 / span 3; background: var(--sky-wash); }

@media (max-width: 52rem) {
  .rmap { grid-template-columns: 1fr 1fr; }
  .rmap-label {
    grid-column: 1 / -1;
    padding: 0.4rem 0 0;
    border-top: 1px solid var(--rule);
    margin-top: 0.25rem;
  }
  .rmap-label:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
  .rmap-theme.rmap-i, .rmap-theme.rmap-ii,
  .rmap-aud.rmap-i, .rmap-aud.rmap-ii { grid-column: span 1; }
  .rmap-sub.rmap-bridge { grid-column: 1 / -1; }
}

@media (max-width: 34rem) {
  .rmap { grid-template-columns: 1fr; }
  .rmap-theme.rmap-i, .rmap-theme.rmap-ii,
  .rmap-aud.rmap-i, .rmap-aud.rmap-ii { grid-column: 1 / -1; }
}

/* The pop-up */
.rmap-dialog {
  width: min(44rem, calc(100vw - 2rem));
  max-height: min(84vh, 46rem);
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(46, 32, 54, 0.28);
  overflow: hidden;
  display: none;
  flex-direction: column;
}

.rmap-dialog[open] { display: flex; }

.rmap-dialog::backdrop {
  background: rgba(46, 32, 54, 0.45);
  backdrop-filter: blur(2px);
}

.rmap-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.75rem 1rem;
  border-bottom: 1px solid var(--rule);
}

.rmap-dialog-head h3 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); }

.rmap-dialog-kicker {
  font-size: 0.86rem;
  color: var(--ink-faint);
  margin: 0 0 0.35rem;
}

.rmap-close {
  font: inherit;
  font-size: 1.6rem;
  line-height: 1;
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
}

.rmap-close:hover { color: var(--ink); border-color: var(--ink); }

.rmap-dialog-body {
  padding: 1.25rem 1.75rem 1.75rem;
  overflow-y: auto;
  font-size: 1.02rem;
}

.rmap-dialog-body p { max-width: none; }
.rmap-dialog-body p:last-child { margin-bottom: 0; }
.rmap-dialog-body h4 { margin: 1.1rem 0 0.4rem; color: var(--ink-soft); }
.rmap-dialog-body h4:first-child { margin-top: 0; }

/* ---------- Expandable cards (teaching page) ---------- */
.xcards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 56rem) { .xcards { grid-template-columns: 1fr; } }

.xcard {
  font: inherit;
  text-align: left;
  cursor: pointer;
  background: var(--white);
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  padding: 1.5rem 1.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.xcard:hover, .xcard:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(46, 32, 54, 0.13);
  border-color: var(--ink);
}

.xcard:active { transform: none; box-shadow: none; }

.xcard-kicker { font-size: 0.85rem; color: var(--ink-faint); letter-spacing: 0.02em; }

.xcard-quote {
  font-family: var(--display);
  font-size: 1.08rem;
  line-height: 1.36;
  color: var(--ink);
  font-variation-settings: "SOFT" 40, "WONK" 1;
}

.xcard-n {
  font-family: var(--display);
  font-size: clamp(2.2rem, 4vw, 2.9rem);
  line-height: 1;
  color: var(--ink);
}

.xcard-sub { font-size: 0.94rem; color: var(--ink-soft); line-height: 1.45; }

.xcard-more {
  margin-top: auto;
  padding-top: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.xcard:hover .xcard-more { color: var(--ink); }

@media (prefers-reduced-motion: reduce) { .xcard { transition: none; } }
