/* Two Bad Girls
   EB Garamond (subset) for headings. Space Grotesk and Noto Sans TC
   come from the site stylesheet. Essay tokens are not the site tokens:
   overriding --ink here would wash out the header and footer. */

@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/eb-garamond.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0100-024F, U+1E00-1EFF, U+2000-206F, U+2070-209F, U+20A0-20CF, U+2190-21FF, U+2C60-2C7F, U+FB00-FB06;
}
@font-face {
  font-family: "EB Garamond";
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/eb-garamond-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0100-024F, U+1E00-1EFF, U+2000-206F, U+2070-209F, U+20A0-20CF, U+2190-21FF, U+2C60-2C7F, U+FB00-FB06;
}

body.essay {
  --essay-bg: #0c0b0a;
  --essay-bg-2: #141210;
  --essay-ink: #efe6d6;
  --essay-soft: #c9bba8;
  --essay-muted: #8f8678;
  --essay-gold: #d4bf93;
  --essay-gold-dim: rgba(212, 191, 147, 0.28);
  --essay-rule: rgba(239, 230, 214, 0.14);
  --essay-card: rgba(12, 11, 10, 0.82);
  --essay-head: "EB Garamond", "Noto Sans TC", "Palatino Linotype", Palatino, serif;
  --essay-body: "Space Grotesk", "Noto Sans TC", "Segoe UI", system-ui, sans-serif;
  background: var(--essay-bg);
  color: var(--essay-ink);
  font-family: var(--essay-body);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: clip;
}

html { --site-header-h: 6.5rem; }
body.essay .dots-bg { display: none; }
body.essay .site-header { color: var(--ink); }
body.essay .site-footer {
  color: var(--cream);
  background: var(--ink);
  margin-top: 0;
}
body.essay main {
  color: var(--essay-ink);
  font-family: var(--essay-body);
  font-weight: 400;
}

html.is-rewinding { scroll-behavior: auto !important; }
html.is-rewinding body.essay .stage {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 100%;
  margin-bottom: 0;
}

/* Hero — reset the homepage hero, which shares these class names. */
body.essay .hero {
  min-height: 72vh;
  min-height: 72dvh;
  display: grid;
  place-items: center;
  padding: 2.6rem 1.4rem 2.8rem;
  background: radial-gradient(ellipse at 50% 30%, #1c1812 0%, var(--essay-bg) 70%);
}
body.essay .hero-inner { text-align: center; max-width: 52rem; }
body.essay .hero-kicker {
  display: block;
  margin: 0 0 0.85rem;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  transform: none;
  font-family: var(--essay-head);
  font-style: italic;
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--essay-gold);
}
body.essay .hero-title,
body.essay .hero h1 {
  display: block;
  margin: 0;
  font-family: var(--essay-head);
  font-weight: 600;
  font-size: clamp(3.2rem, 10vw, 6.6rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--essay-ink);
  text-shadow: none;
  align-items: unset;
  gap: 0;
}
body.essay .hero-by {
  margin: 1.15rem 0 0;
  font-family: var(--essay-head);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--essay-soft);
}
body.essay .hero-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 1.1rem;
  margin-top: 1.8rem;
}
body.essay .hero-nav a {
  color: var(--essay-gold);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
body.essay .hero-nav a:hover,
body.essay .hero-nav a:focus-visible { border-bottom-color: var(--essay-gold); }

body.essay .act { position: relative; }
body.essay .act-head {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.4rem 1.4rem 1.2rem;
  scroll-margin-top: calc(var(--site-header-h) + 0.6rem);
}
body.essay .act-kicker {
  margin: 0 0 0.3rem;
  font-family: var(--essay-head);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--essay-gold);
}
body.essay .act-title {
  margin: 0;
  font-family: var(--essay-head);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--essay-ink);
}

body.essay .beat { position: relative; }
body.essay .stage {
  position: sticky;
  top: var(--site-header-h);
  height: calc(100vh - var(--site-header-h));
  height: calc(100dvh - var(--site-header-h));
  margin-bottom: calc((100vh - var(--site-header-h)) * -1);
  margin-bottom: calc((100dvh - var(--site-header-h)) * -1);
  z-index: 0;
  background: var(--essay-bg);
}
body.essay .stage-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--essay-bg);
}
body.essay .stage-frame > img,
body.essay .split-pane img,
body.essay .clip video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  display: block;
}
body.essay .stage-frame > img.contain,
body.essay .stage.stage-contain .stage-frame > img,
body.essay #beat-5-1 .split-pane img {
  object-fit: contain;
  background: var(--essay-bg);
}
body.essay .stage-frame > img.monochrome { filter: grayscale(1) contrast(1.05) brightness(0.82); }
body.essay .stage-frame > img.grain { filter: contrast(1.05) sepia(0.35) brightness(0.88); }
body.essay .stage-frame > img.low-contrast { filter: grayscale(0.35) contrast(0.85) brightness(0.55); }
body.essay .stage-frame > img.saturate { filter: saturate(1.35) contrast(1.08); }
body.essay .stage-frame > img.halftone { filter: grayscale(1) contrast(1.4); }

body.essay .scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(12, 11, 10, 0.15), rgba(12, 11, 10, 0.55));
}
body.essay .scrim-heavy {
  background: linear-gradient(180deg, rgba(12, 11, 10, 0.35), rgba(12, 11, 10, 0.7));
}

@keyframes essay-kenburns {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.08) translate3d(1.2%, 0.8%, 0); }
}
body.essay .stage-frame > img.kb,
body.essay .stage-frame > img.kb-slow {
  transform-origin: center center;
  animation: essay-kenburns 28s ease-in-out infinite alternate;
}
body.essay .stage-frame > img.kb-slow { animation-duration: 40s; }

body.essay .stage.stage-split .stage-frame,
body.essay .stage.stage-triptych .stage-frame {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
body.essay .stage.stage-triptych .stage-frame { grid-template-columns: 1fr 1fr 1fr; }
body.essay .split-pane {
  position: relative;
  margin: 0;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--essay-bg);
}
body.essay #beat-4-5 .split-pane:nth-child(3) img { object-position: right center; }

body.essay .split-pane figcaption,
body.essay .stage-caption,
body.essay .layer-caption,
body.essay .postcard figcaption {
  font-size: max(13px, 0.85rem);
}
body.essay .split-pane figcaption,
body.essay .stage-caption,
body.essay .layer-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  margin: 0;
  padding: 0.45rem 0.7rem;
  letter-spacing: 0.03em;
  color: var(--essay-ink);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
}
body.essay #beat-4-2 .stage-caption {
  top: 0.65rem;
  bottom: auto;
  background: linear-gradient(rgba(0, 0, 0, 0.72), transparent);
}

body.essay .layer { transition: opacity 0.6s ease; }
body.essay .layer-b,
body.essay .layer-caption-b { opacity: 0; }
body.essay .beat-crossfade.is-on .layer-b,
body.essay .beat-crossfade.is-on .layer-caption-b { opacity: 1; }
body.essay .beat-crossfade.is-on .layer-a,
body.essay .beat-crossfade.is-on .layer-caption-a { opacity: 0; }
body.essay .beat-desat.is-cold .stage-frame img { filter: grayscale(1) contrast(1.05) brightness(0.8); }
body.essay .beat-drain.is-drained .stage-frame > img { filter: grayscale(1) contrast(1.1) brightness(0.75); }

body.essay .postcard {
  position: absolute;
  right: 6%;
  bottom: 12%;
  z-index: 3;
  width: min(16rem, 34vw);
  margin: 0;
  background: #ebe1cf;
  color: #1a1408;
  padding: 0.45rem 0.45rem 0;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  transform: rotate(-2.2deg);
}
body.essay .postcard img {
  position: static;
  inset: auto;
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  filter: none;
}
body.essay .postcard figcaption {
  position: static;
  background: none;
  color: #3a3226;
  padding: 0.35rem 0.2rem 0.45rem;
}

body.essay .placeholder {
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1.1rem 1.25rem;
  background: repeating-linear-gradient(-45deg, rgba(20, 18, 14, 0.72) 0 12px, rgba(28, 24, 18, 0.72) 12px 24px);
  border: 1px dashed var(--essay-gold-dim);
  color: var(--essay-ink);
  text-shadow: 0 1px 2px #000;
}
body.essay .stage-frame > .placeholder {
  position: absolute;
  inset: auto 5% 8% 5%;
  width: auto;
  height: auto;
  max-width: 36rem;
}
body.essay .stage-frame > .placeholder:only-child {
  inset: 10% 8%;
  max-width: none;
}
body.essay .ph-beat,
body.essay .ph-soon {
  font-size: max(13px, 0.78rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--essay-gold);
}
body.essay .ph-title {
  font-family: var(--essay-head);
  font-size: max(1.2rem, 13px);
  line-height: 1.2;
}
body.essay .ph-detail {
  color: var(--essay-soft);
  font-size: max(13px, 0.9rem);
  max-width: 36rem;
}
body.essay .ph-soon {
  margin-top: 0.25rem;
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--essay-gold);
}

body.essay .crt-wrap {
  position: absolute;
  right: 6%;
  top: 12%;
  width: min(28rem, 42vw);
  height: min(18rem, 34vh);
  z-index: 3;
  padding: 0.9rem 0.9rem 1.3rem;
  background: #1a1a18;
  border-radius: 1.1rem 1.1rem 1.4rem 1.4rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 8px #2a2a26;
}
body.essay .crt-wrap .placeholder {
  position: static;
  width: 100%;
  height: 100%;
  max-width: none;
}

body.essay .clip {
  position: absolute;
  inset: 0;
  background: var(--essay-bg) url("shanghai/essay/new-women-hospital.jpg") center / cover no-repeat;
}
body.essay .clip video { background: transparent; }
body.essay .clip-controls {
  position: absolute;
  z-index: 6;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  gap: 0.5rem;
}
body.essay .clip.is-active .clip-controls {
  position: fixed;
  z-index: 40;
  top: calc(var(--site-header-h) + 0.65rem);
  left: max(0.75rem, env(safe-area-inset-left));
}
body.essay .sound-btn {
  min-width: 48px;
  min-height: 48px;
  padding: 0.55rem 1rem;
  border: 1px solid var(--essay-gold);
  background: rgba(12, 11, 10, 0.88);
  color: var(--essay-ink);
  font-family: var(--essay-body);
  font-size: max(13px, 0.95rem);
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
}
body.essay .sound-btn:hover,
body.essay .sound-btn:focus-visible {
  background: var(--essay-gold);
  color: #1a1408;
}

body.essay .prose {
  position: relative;
  z-index: 2;
  max-width: 44rem;
  min-height: 108vh;
  margin: 0 auto;
  padding: 52vh 1.3rem 10vh;
  display: flex;
  flex-direction: column;
  gap: 12vh;
  pointer-events: none;
}
body.essay .prose-tall {
  padding-top: 38vh;
  padding-bottom: 12vh;
  gap: 10vh;
}
body.essay .prose-left { margin-left: 6vw; margin-right: auto; }
body.essay .prose-right { margin-right: 6vw; margin-left: auto; }
body.essay .card {
  pointer-events: auto;
  max-width: 36rem;
  padding: 1.25rem 1.35rem 1.35rem;
  background: var(--essay-card);
  border: 1px solid var(--essay-rule);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}
body.essay .card p { margin: 0 0 0.9em; }
body.essay .card p:last-child { margin-bottom: 0; }
body.essay .card-thesis { max-width: 38rem; }
body.essay .punch {
  font-family: var(--essay-head);
  font-size: 1.85rem;
  line-height: 1.25;
  margin: 0;
}
body.essay .pullquote {
  position: absolute;
  right: 6%;
  bottom: 14%;
  z-index: 3;
  margin: 0;
  max-width: 16rem;
  color: var(--essay-ink);
  font-family: var(--essay-head);
}
body.essay .pullquote span { display: block; }
body.essay .pullquote span:first-child {
  font-size: max(1.35rem, 13px);
  line-height: 1.25;
}
body.essay .pullquote span:last-child {
  margin-top: 0.35rem;
  font-style: italic;
  font-size: max(13px, 1rem);
  color: var(--essay-gold);
}

body.essay .biblio,
body.essay .credits {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 3rem max(1.4rem, calc((100% - 46rem) / 2)) 2.2rem;
  background: var(--essay-bg);
  scroll-margin-top: calc(var(--site-header-h) + 0.6rem);
}
body.essay .biblio h2,
body.essay .credits h2 {
  font-family: var(--essay-head);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin: 0 0 1.2rem;
  color: var(--essay-ink);
}
body.essay .biblio h3,
body.essay .credits h3 {
  font-family: var(--essay-head);
  font-style: italic;
  font-weight: 500;
  font-size: 1.35rem;
  color: var(--essay-gold);
  margin: 1.7rem 0 0.7rem;
}
body.essay .biblio > p,
body.essay .credits > p {
  color: var(--essay-soft);
}
body.essay .bib {
  list-style: none;
  margin: 0;
  padding: 0;
}
body.essay .bib li {
  margin: 0 0 0.8rem;
  padding-left: 1.2rem;
  text-indent: -1.2rem;
  color: var(--essay-soft);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
body.essay .bib a,
body.essay .credits a,
body.essay .catalogue-note a {
  color: var(--essay-gold);
  overflow-wrap: anywhere;
}
body.essay .catalogue-note {
  margin: 2rem 0 0;
  font-size: 0.85rem;
  color: var(--essay-muted);
}
body.essay .fineprint {
  margin-top: 1.6rem;
  color: var(--essay-muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  body.essay .stage {
    top: 0;
    height: 100vh;
    height: 100dvh;
    margin-bottom: -100vh;
    margin-bottom: -100dvh;
  }
  body.essay .clip.is-active .clip-controls { top: 0.65rem; }
  body.essay .act-head,
  body.essay .biblio,
  body.essay .credits { scroll-margin-top: 0.75rem; }
}

@media (max-width: 768px) {
  body.essay { font-size: 1rem; }
  body.essay .hero {
    min-height: 62vh;
    min-height: 62dvh;
    padding: 1.8rem 1.05rem 2rem;
  }
  body.essay .act-head { padding: 1.8rem 1.05rem 0.8rem; }
  body.essay .stage {
    top: 0;
    height: 33vh;
    height: 33dvh;
    margin-bottom: 0;
    z-index: 5;
  }
  body.essay .prose {
    min-height: 0;
    max-width: none;
    margin: 0;
    padding: 0.95rem 1rem 1.35rem;
    gap: 0.85rem;
    background: var(--essay-bg);
    z-index: 1;
    pointer-events: auto;
  }
  body.essay .prose-tall { padding-top: 0.95rem; padding-bottom: 1.35rem; gap: 0.85rem; }
  body.essay .prose-left,
  body.essay .prose-right { margin-left: 0; margin-right: 0; }
  body.essay .card {
    max-width: none;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
  }
  body.essay .stage .postcard {
    width: min(7.2rem, 42%);
    right: 0.35rem;
    bottom: 0.35rem;
  }
  body.essay .crt-wrap {
    top: 0.35rem;
    right: 0.35rem;
    width: 62%;
    height: calc(100% - 0.7rem);
    padding: 0.4rem 0.45rem 0.55rem;
  }
  body.essay .stage-frame > .placeholder {
    inset: auto 0.4rem 0.35rem 0.4rem;
    max-height: 46%;
    padding: 0.4rem 0.55rem;
  }
  body.essay .ph-detail {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  body.essay .stage-frame > .placeholder:only-child {
    inset: 0.45rem;
    max-height: none;
  }
  body.essay .stage.stage-triptych .stage-frame {
    display: flex;
    grid-template-columns: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  body.essay .stage.stage-triptych .split-pane {
    flex: 0 0 100%;
    scroll-snap-align: start;
    height: 100%;
    min-width: 100%;
  }
  body.essay .pullquote {
    right: 0.45rem;
    bottom: 0.35rem;
    max-width: 9.5rem;
  }
  body.essay .pullquote span:first-child { font-size: max(15px, 0.95rem); }
  body.essay .clip.is-active .clip-controls { top: 0.45rem; }
  body.essay .sound-btn { min-width: 48px; min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  body.essay .stage-frame > img.kb,
  body.essay .stage-frame > img.kb-slow { animation: none; }
  body.essay .layer { transition: none; }
}
