/* Essay page — Aeon-like measure + maroon accent (body.topic-essay only)
   Saved style guide: ESSAY_STYLE.md
   Reference page: when-nothing-moves.html
*/
body.topic-essay {
  --essay-red: #8f2a3a;
  --essay-ink: #111111;
  --essay-muted: #666666;
  --essay-line: #dcdcdc;
  --essay-bg: #ffffff;
  --essay-serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --essay-space: 0.25rem;
  background: #ffffff;
  color: var(--essay-ink);
}

body.topic-essay .top {
  background: rgba(255, 255, 255, 0.96);
  border-bottom-color: var(--essay-line);
}

body.topic-essay .nav a.is-on {
  background: var(--essay-red);
}

body.topic-essay .nav a:hover {
  background: #6b2430;
}

body.topic-essay .jump a:hover,
body.topic-essay .jump a.is-on {
  color: var(--essay-red);
}

body.topic-essay a {
  color: var(--essay-red);
}

body.topic-essay .essay-hero {
  position: relative;
  width: 100%;
  min-height: clamp(28rem, 78vh, 46rem);
  margin: 0;
  overflow: hidden;
  background: #1a1a1a;
}

/* Portrait covers (e.g. i-am.jpg) — keep native aspect, never full-bleed stretch */
body.topic-essay .essay-hero--portrait {
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background: #111111;
  overflow: hidden;
}

body.topic-essay .essay-hero--portrait .essay-hero-portrait {
  position: relative;
  width: min(838px, 100%);
  aspect-ratio: 838 / 1111;
  max-height: min(85vh, 1111px);
  flex: 0 1 auto;
  margin: 0 auto;
  overflow: hidden;
  background: #1a1a1a;
}

body.topic-essay .essay-hero--portrait .essay-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center center;
  display: block;
}

body.topic-essay .essay-hero--portrait .essay-hero-copy {
  width: auto;
  left: 0;
  right: 0;
  margin: 0;
  padding: 1.6rem 1.25rem 1.35rem;
  box-sizing: border-box;
}

body.topic-essay .essay-hero--portrait .essay-hero-copy h1 {
  max-width: none;
  font-size: clamp(1.85rem, 6vw, 2.75rem);
}

body.topic-essay .essay-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center 40%;
  display: block;
}

body.topic-essay .essay-hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.35) 42%,
    rgba(0, 0, 0, 0.12) 100%
  );
  pointer-events: none;
}

body.topic-essay .essay-hero-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  width: min(1360px, calc(100% - 2 * var(--pad)));
  margin: 0 auto;
  padding: 2.4rem 0 2rem;
  color: #fff;
}

body.topic-essay .essay-hero-copy .kicker {
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 0.55rem;
}

body.topic-essay .essay-hero-copy h1 {
  margin: 0;
  color: #fff;
  font-family: var(--read);
  font-weight: 400;
  font-size: clamp(2.1rem, 5.4vw, 3.5rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  max-width: none;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.35);
}

body.topic-essay .wrap.topic-page {
  width: min(1360px, calc(100% - 2 * var(--pad)));
  grid-template-columns: 14.5rem minmax(0, 1fr);
  gap: 2rem;
  padding-top: 1.8rem;
}

body.topic-essay .topic-body {
  max-width: none;
}

body.topic-essay .toc {
  border-right-color: #dcdcdc;
}

body.topic-essay .toc a {
  color: #666;
}

body.topic-essay .toc a:hover {
  color: #111;
}

body.topic-essay .toc a.is-on {
  border-left-color: #111;
  color: #111;
}

body.topic-essay .toc-group,
body.topic-essay .toc-now {
  color: #666;
}

body.topic-essay .toc-now strong {
  color: #111;
}

body.topic-essay .essay-lede {
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--essay-line);
  margin: 0 0 1.5rem;
}

body.topic-essay .essay-lede .meta li {
  color: var(--essay-muted);
}

body.topic-essay .essay-lede .promise {
  margin-top: 0.75rem;
  font-family: var(--essay-serif);
  font-size: 22px;
  line-height: 1.4;
  max-width: none;
  color: var(--essay-ink);
  text-align: left; /* Aeon body is left-aligned, not justified */
  hyphens: none;
  -webkit-hyphens: none;
  word-break: normal;
  overflow-wrap: break-word;
  letter-spacing: normal;
  word-spacing: normal;
}

body.topic-essay .essay-article {
  font-family: var(--essay-serif);
}

body.topic-essay .essay-sec {
  padding: 0;
  scroll-margin-top: 6.2rem;
}

body.topic-essay .essay-sec + .essay-sec {
  margin-top: 2.5rem;
  padding-top: 0;
  border-top: none;
}

body.topic-essay .essay-sec h2 {
  margin: 0 0 0.75rem;
  font-family: var(--essay-serif);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
  color: var(--essay-red);
}

/* Aeon .article-content p — 22px / 1.4, left-aligned, margin-block 1.25rem */
body.topic-essay .essay-prose p {
  margin-block: 1.25rem; /* calc(0.25rem * 5) */
  margin-inline: 0;
  font-family: var(--essay-serif);
  font-size: 22px;
  line-height: 1.4;
  color: var(--essay-ink);
  text-align: left;
  hyphens: none;
  -webkit-hyphens: none;
  word-break: normal;
  overflow-wrap: break-word;
  letter-spacing: normal;
  word-spacing: normal;
}

body.topic-essay .essay-prose p:first-child {
  margin-top: 0;
}

body.topic-essay .essay-prose p:last-child {
  margin-bottom: 0;
}

/* Pull lines: larger than body, regular weight, tab + air */
body.topic-essay .essay-prose p.essay-pull {
  display: block;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  margin: 1.25rem 0 0;
  padding: 0.5rem 0 0.375rem 1.5rem;
  font-family: var(--essay-serif);
  font-size: 29px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.3;
  color: var(--essay-red);
  text-align: left;
  hyphens: none;
  letter-spacing: normal;
  word-spacing: normal;
}

body.topic-essay .essay-prose p.essay-pull + p {
  margin-top: 1.25rem;
}

body.topic-essay .essay-prose p.essay-pull::first-letter {
  text-transform: uppercase;
}

/* Aeon .has-dropcap > p:first-of-type::first-letter */
body.topic-essay .essay-sec:first-of-type .essay-prose > p:first-child::first-letter {
  float: left;
  margin-top: 0.375rem;
  margin-right: 0.375rem;
  margin-bottom: -0.375rem;
  padding: 0;
  font-size: 3.25em;
  line-height: 0.8;
  font-weight: 400;
  color: var(--essay-red);
}

body.topic-essay .essay-tags {
  margin: 2.75rem 0 0;
  padding-top: 1.35rem;
  border-top: 1px solid var(--essay-line);
}

body.topic-essay .essay-tags .tag {
  color: var(--essay-muted);
}

body.topic-essay .essay-tags .tag:hover {
  color: var(--essay-red);
}

body.topic-essay .foot {
  margin-top: 2.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--essay-line);
  color: var(--essay-muted);
}

body.topic-essay .frame-foot {
  background: #111111;
}

@media (max-width: 980px) {
  body.topic-essay .wrap.topic-page {
    width: min(1180px, calc(100% - 2 * var(--pad)));
  }
  body.topic-essay .essay-hero-copy {
    width: min(1180px, calc(100% - 2 * var(--pad)));
  }

  /* Free the viewport for the article while scrolling */
  body.topic-essay .top {
    position: static;
  }
  body.topic-essay .jump {
    display: none;
  }
  body.topic-essay .essay-sec {
    scroll-margin-top: 1rem;
  }
}

@media (max-width: 700px) {
  body.topic-essay .essay-hero {
    min-height: clamp(16rem, 42vh, 22rem);
  }
  body.topic-essay .essay-hero--portrait {
    min-height: 0;
  }
  body.topic-essay .essay-hero--portrait .essay-hero-portrait {
    width: 100%;
    max-height: min(70vh, 1111px);
  }
  body.topic-essay .essay-hero-copy {
    padding: 1.25rem 0 1.1rem;
  }
  body.topic-essay .essay-hero--portrait .essay-hero-copy {
    padding: 1.25rem 1rem 1.1rem;
  }
  body.topic-essay .essay-hero-copy h1 {
    font-size: clamp(1.75rem, 8vw, 2.4rem);
  }
  body.topic-essay .top-inner {
    min-height: 0;
    padding-top: 0.45rem;
    padding-bottom: 0.4rem;
  }
  body.topic-essay .essay-prose p {
    font-size: 18px; /* Aeon text-lg base */
    line-height: 1.4;
  }
  body.topic-essay .essay-lede .promise {
    font-size: 18px;
    line-height: 1.4;
  }
  body.topic-essay .essay-prose p.essay-pull {
    font-size: 24px;
    line-height: 1.3;
    padding-left: 1.15rem;
    max-width: none;
    width: 100%;
  }
  body.topic-essay .essay-sec + .essay-sec {
    margin-top: 2rem;
  }
  body.topic-essay .essay-sec:first-of-type .essay-prose > p:first-child::first-letter {
    font-size: 3.25em;
    line-height: 0.8;
  }
}

@media (min-width: 701px) and (max-width: 1279px) {
  body.topic-essay .essay-prose p,
  body.topic-essay .essay-lede .promise {
    font-size: 20px;
    line-height: 1.4;
  }
  body.topic-essay .essay-prose p.essay-pull {
    font-size: 26px;
    line-height: 1.3;
  }
}

@media (min-width: 1280px) {
  body.topic-essay .essay-prose p.essay-pull {
    font-size: 32px;
    line-height: 1.3;
  }
}

/* Tools guides (e.g. Attention) — tables and lists inside essay layout */
body.topic-essay.topic-tools .essay-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.35rem;
  font-size: 0.92em;
  line-height: 1.35;
}
body.topic-essay.topic-tools .essay-prose th,
body.topic-essay.topic-tools .essay-prose td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid #e8e8e8;
  vertical-align: top;
}
body.topic-essay.topic-tools .essay-prose th {
  font-weight: 700;
  color: #8f2a3a;
}
body.topic-essay.topic-tools .essay-prose ul,
body.topic-essay.topic-tools .essay-prose ol {
  margin: 0.35rem 0 1.15rem;
  padding: 0 0 0 1.2rem;
}
body.topic-essay.topic-tools .essay-prose li {
  margin: 0 0 0.45rem;
}
body.topic-essay.topic-tools .essay-prose p.tool-lead {
  margin-top: 0.85rem;
}
body.topic-essay.topic-tools .essay-prose p.tool-lead:first-child {
  margin-top: 0;
}

/* Wide heroes are painted 16:9. Show that frame; do not scale a portrait up to fill it. */
body.topic-essay .essay-hero.essay-hero--wide {
  min-height: 0;
  aspect-ratio: 16 / 9;
  max-height: min(78vh, 46rem);
}
body.topic-essay .essay-hero.essay-hero--wide .essay-hero-img {
  object-position: center center;
}
@media (max-width: 700px) {
  body.topic-essay .essay-hero.essay-hero--wide {
    min-height: 0;
    max-height: 42vh;
  }
}
