/*
 * "The motor is not the transformation" — full-screen scrollytelling (fixed page).
 * Each chapter is pinned: first its title fills the screen, then the visual takes most of
 * the screen while large captions change step by step.
 */
.dhx-essay {
  --dhx-accent: var(--accent, #6C60BF); --dhx-accent-rgb: var(--accent-rgb, 108, 96, 191);
  --dhx-bg: var(--bg, #F3F3F3); --dhx-text: var(--text, #0C0B14); --dhx-line: var(--line, rgba(12, 11, 20, .12));
  --dhx-muted: var(--muted, rgba(12, 12, 12, .58)); --dhx-muted-strong: var(--muted-strong, rgba(12, 12, 12, .72));
  --dhx-ease: var(--ease, cubic-bezier(.22, 1, .36, 1)); --dhx-display: var(--font-display, "Syne", system-ui, sans-serif);
  --dhx-gutter: var(--page-gutter, clamp(20px, 5vw, 80px)); --hh: var(--header-h, 64px);
  display: block; overflow: clip;
}

/* ---------- hero ---------- */
.ess-hero { position: relative; min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1fr); align-content: end; padding: calc(var(--hh) + 6vh) var(--dhx-gutter) calc(4vh + 110px); }
.ess-hero__inner { max-width: 1400px; }
.ess-hero__kicker { display: inline-flex; align-items: center; gap: 12px; margin: 0 0 22px !important; color: var(--dhx-accent); font-size: 13px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.ess-hero__kicker::before { content: ""; width: 34px; height: 1px; background: currentColor; }
.ess-hero__title { margin: 0 !important; font-family: var(--dhx-display); font-weight: 700; font-size: min(clamp(28px, min(7.8vw, 13vh), 146px), calc((100vw - 2 * var(--dhx-gutter)) / 10.6)) !important; line-height: .86; letter-spacing: -.07em; text-transform: uppercase; color: var(--dhx-text); }
.ess-hero__title > span { display: block; }
.ess-hero__title > .is-accent { color: var(--dhx-accent); }
.ess-hero__lede { max-width: 40ch; margin: 28px 0 0 !important; color: var(--dhx-muted-strong); font-size: clamp(17px, 1.3vw, 21px); line-height: 1.5; }
.ess-cue { position: absolute; left: 50%; bottom: 4vh; translate: -50% 0; display: grid; justify-items: center; gap: 10px; color: var(--dhx-muted); font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; pointer-events: none; }
.ess-cue i { width: 1px; height: 46px; background: linear-gradient(var(--dhx-text), transparent); transform-origin: top; animation: ess-cue 2.2s var(--dhx-ease) infinite; }
@keyframes ess-cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- pinned chapter ---------- */
/* one screen pinned + 1.15 screens of title + 1.4 screens per step (ess.js uses the same numbers) */
.ess-ch { position: relative; height: calc(215vh + var(--steps) * 140vh); height: calc(215svh + var(--steps) * 140svh); }
.ess-stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 4.2fr) minmax(0, 7.8fr); grid-template-rows: minmax(0, 1fr) auto;
  column-gap: clamp(28px, 4.5vw, 84px); padding: calc(var(--hh) + 3vh) var(--dhx-gutter) 2.6vh;
}
.ess-stage > * { transition: opacity .7s ease, transform .9s var(--dhx-ease), translate .9s var(--dhx-ease); }

/* the title screen */
.ess-intro { position: absolute; inset: 0; display: grid; align-content: center; padding: var(--hh) var(--dhx-gutter) 0; pointer-events: none; }
.ess-kicker { margin: 0 0 clamp(14px, 1.6vw, 22px) !important; color: color-mix(in srgb, var(--dhx-text) 58%, transparent); font-family: var(--dhx-display); font-size: clamp(14px, 1.2vw, 20px); font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.ess-kicker span { color: var(--dhx-accent); }
.ess-title { margin: 0 !important; max-width: 17ch; font-family: var(--dhx-display); font-weight: 700; font-size: clamp(40px, min(6.2vw, 11vh), 112px) !important; line-height: .96; letter-spacing: -.055em; color: var(--dhx-text); text-wrap: balance; }
/* title and working screen never show at the same time: one leaves, then the other enters */
.ess-stage > .ess-intro { transition: opacity .45s ease .32s, transform .8s var(--dhx-ease) .25s; }
.ess-stage:not(.is-intro) .ess-intro { opacity: 0; transform: translateY(-8vh); transition: opacity .28s ease, transform .5s var(--dhx-ease); }
.ess-stage:not(.is-intro) > :is(.ess-caps, .ess-visual, .ess-foot) { transition-delay: .3s; }
.ess-stage.is-intro > :is(.ess-caps, .ess-visual, .ess-foot) { transition-duration: .28s; transition-delay: 0s; }

/* the working screen */
.ess-foot { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; gap: clamp(14px, 2vw, 28px); padding-top: 2vh; min-width: 0; }
.ess-head { min-width: 0; margin: 0 !important; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--dhx-muted); font-size: 13px; font-weight: 600; letter-spacing: 0; }
.ess-head span { margin-right: 10px; color: var(--dhx-text); font-weight: 800; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.ess-caps { grid-column: 1; grid-row: 1; position: relative; min-height: 0; }
.ess-cap {
  position: absolute; left: 0; right: 0; top: 50%; margin: 0 !important; translate: 0 calc(-50% + 26px); opacity: 0;
  font-family: var(--dhx-display); font-weight: 600; font-size: clamp(22px, min(2.2vw, 4.2vh), 38px); line-height: 1.2; letter-spacing: -.03em; color: var(--dhx-text);
  transition: opacity .26s ease, translate .5s var(--dhx-ease);
}
.ess-cap strong { color: var(--dhx-accent); font-weight: 700; }
.ess-cap.is-on { opacity: 1; translate: 0 -50%; transition: opacity .45s ease .26s, translate .8s var(--dhx-ease) .2s; }
/* exhibit state labels: the old one leaves before the new one arrives */
.ess-visual .dhx-viz__states span { transition: opacity .22s ease, translate .4s var(--dhx-ease); }
.ess-visual .dhx-viz[data-state="0"] .dhx-viz__states [data-s="0"], .ess-visual .dhx-viz[data-state="0"] .ev-fl__metrics [data-s="0"], .ess-visual .dhx-viz[data-state="1"] .dhx-viz__states [data-s="1"], .ess-visual .dhx-viz[data-state="1"] .ev-fl__metrics [data-s="1"], .ess-visual .dhx-viz[data-state="2"] .dhx-viz__states [data-s="2"], .ess-visual .dhx-viz[data-state="2"] .ev-fl__metrics [data-s="2"], .ess-visual .dhx-viz[data-state="3"] .dhx-viz__states [data-s="3"], .ess-visual .dhx-viz[data-state="3"] .ev-fl__metrics [data-s="3"], .ess-visual .dhx-viz[data-state="4"] .dhx-viz__states [data-s="4"], .ess-visual .dhx-viz[data-state="4"] .ev-fl__metrics [data-s="4"], .ess-visual .dhx-viz[data-state="5"] .dhx-viz__states [data-s="5"], .ess-visual .dhx-viz[data-state="5"] .ev-fl__metrics [data-s="5"] { transition: opacity .4s ease .22s, translate .6s var(--dhx-ease) .2s; }
.ess-cap.is-past { translate: 0 calc(-50% - 26px); }
.ess-visual { grid-column: 2; grid-row: 1; align-self: center; min-width: 0; max-height: 100%; }
.ess-bar { flex: none; display: flex; gap: 6px; }
.ess-bar i { flex: none; width: clamp(34px, 4.4vw, 72px); height: 2px; border-radius: 2px; background: var(--dhx-line); transition: background-color .4s; }
.ess-bar i.is-done { background: rgba(var(--dhx-accent-rgb), .45); }
.ess-bar i.is-on { background: var(--dhx-accent); }
.ess-stage.is-intro :is(.ess-foot, .ess-caps) { opacity: 0; }
.ess-stage.is-intro .ess-visual { opacity: 0; transform: translateY(5vh) scale(.97); }

/* bigger visuals than in the editable chapters */
.ess-visual .dhx-f { max-height: 66vh; }
.ess-visual .dhx-tm { height: min(60vh, 560px); }
.ess-visual .dhx-ch { max-height: 46vh; }
.ess-visual .dhx-stat__num { font-size: clamp(56px, min(6.4vw, 11vh), 120px); }
.ess-visual .dhx-stat__lab { font-size: 15px; }
.ess-visual .dhx-cmp__row { font-size: 15px; padding: 9px 0; }
.ess-visual .dhx-cmp__head b { font-size: clamp(22px, 2vw, 32px); }
.ess-visual .dhx-chip { font-size: 15px; padding: 11px 16px; }
.ess-visual .dhx-dcard__q { font-size: clamp(20px, 1.9vw, 28px); }
.ess-visual .dhx-viz__states span { font-size: clamp(16px, 1.3vw, 20px); }

/* ---------- tablet & phone: visual on top, caption below ---------- */
@media (max-width: 900px) {
  .ess-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; padding: calc(var(--hh) + 18px) var(--dhx-gutter) 3vh; }
  .ess-head { display: none; }
  .ess-visual { grid-column: 1; grid-row: 1; }
  .ess-caps { grid-column: 1; grid-row: 2; }
  .ess-foot { grid-row: 3; padding-top: 1vh; }
  .ess-cap { font-size: clamp(19px, 5.2vw, 24px); }
  .ess-title { font-size: clamp(34px, 11vw, 60px) !important; }
  .ess-visual .dhx-f { max-height: 36vh; }
  .ess-visual .dhx-tm { height: 34vh; }
  .ess-visual .dhx-ch { max-height: 26vh; }
  .ess-visual .dhx-stat__num { font-size: clamp(34px, 10vw, 54px); }
  .ess-visual .dhx-stat__lab { font-size: 12.5px; }
  .ess-visual .dhx-cmp__row { font-size: 13px; padding: 6px 0; }
  .ess-visual .dhx-cmp__head b { font-size: 18px; }
  .ess-visual .dhx-chip { font-size: 13px; padding: 7px 11px; }
  .ess-visual .dhx-dcard { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; padding: 10px 12px; }
  .ess-visual .dhx-dcard__q { margin: 0; font-size: 16px; }
  .ess-visual .dhx-dcard__ai { flex-basis: 100%; margin: 0; font-size: 11px; }
  .ess-visual .dhx-viz--decisions:not([data-state="2"]) .dhx-dcard__ai { display: none; }
  .ess-visual .dhx-dec__note { display: none; }
  .ess-hero { padding-bottom: calc(3vh + 96px); }
  .ess-hero__kicker { font-size: 11px; letter-spacing: .12em; gap: 10px; }
  .ess-hero__kicker::before { width: 22px; }
  .ess-cue { bottom: 3vh; gap: 8px; }
  .ess-cue i { height: 34px; }
}
/* tablets in portrait: use the extra height */
@media (min-width: 600px) and (max-width: 900px) and (min-height: 800px) {
  .ess-visual .dhx-f { max-height: 50vh; }
  .ess-visual .dhx-tm { height: 46vh; }
  .ess-visual .dhx-ch { max-height: 34vh; }
  .ess-visual .dhx-stat__num { font-size: clamp(56px, 10vw, 88px); }
  .ess-visual .dhx-stat__lab { font-size: 15px; }
  .ess-visual .dhx-cmp__row { font-size: 15px; padding: 9px 0; }
  .ess-visual .dhx-cmp__head b { font-size: 24px; }
  .ess-visual .dhx-chip { font-size: 16px; padding: 11px 16px; }
  .ess-visual .dhx-dcard__q { font-size: 22px; }
  .ess-cap { font-size: clamp(24px, 3.9vw, 32px); }
  .ess-title { font-size: clamp(56px, 9vw, 80px) !important; }
}
/* short phones (iPhone SE): a little more room for the caption */
@media (max-width: 900px) and (max-height: 720px) {
  .ess-visual .dhx-f { max-height: 31vh; }
  .ess-visual .dhx-tm { height: 30vh; }
  .ess-visual .dhx-ch { max-height: 22vh; }
  .ess-cap { font-size: 18px; }
}
/* logged-in: keep the pinned stage below the fixed admin bar */
@media (min-width: 783px) { .admin-bar .ess-stage { top: 32px; height: calc(100svh - 32px); } }
@media (max-width: 782px) { .admin-bar .ess-stage { padding-top: calc(var(--hh) + 64px); } }
@media (prefers-reduced-motion: reduce) {
  .ess-stage > *, .ess-cap { transition: none; }
  .ess-cue i { animation: none; }
}

/* ---------- 10. the playbook: a rail that fills as you scroll ---------- */
.ess-pb { --dhx-accent: var(--accent, #6C60BF); --dhx-accent-rgb: var(--accent-rgb, 108, 96, 191); padding: clamp(100px, 16vh, 190px) 0 clamp(40px, 8vh, 90px); }
.ess-pb__inner { width: min(100% - 2 * var(--dhx-gutter), 1240px); margin-inline: auto; }
.ess-pb__head { max-width: 920px; margin-bottom: clamp(36px, 6vh, 72px); }
.ess-pb__title { margin: 0 !important; color: var(--dhx-text); font-family: var(--dhx-display); font-weight: 700; font-size: clamp(34px, 4.6vw, 72px) !important; line-height: 1; letter-spacing: -.05em; text-wrap: balance; max-width: 18ch; }
.ess-pb__body { position: relative; }
.ess-pb__rail { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--dhx-line); border-radius: 2px; }
.ess-pb__fill { position: absolute; inset: 0; background: var(--dhx-accent); transform-origin: top; transform: scaleY(0); border-radius: 2px; }
.ess-pb__list { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(28px, 5vh, 56px); }
.ess-pb__move { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.ess-pb__node { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 2; display: grid; place-items: center; width: clamp(52px, 4.6vw, 68px); height: clamp(52px, 4.6vw, 68px); border-radius: 50%; background: var(--dhx-bg); border: 2px solid var(--dhx-line); color: var(--dhx-muted); transition: background-color .5s ease, color .5s ease, border-color .5s ease, box-shadow .6s ease; }
.ess-pb__node .ev-ico { width: 46%; height: 46%; }
.ess-pb__move.is-on .ess-pb__node { background: var(--dhx-accent); border-color: var(--dhx-accent); color: #fff; box-shadow: 0 0 0 8px rgba(var(--dhx-accent-rgb), .18); }
.ess-pb__card { padding: clamp(20px, 2vw, 32px); border: 1px solid var(--dhx-line); border-radius: 24px; background: color-mix(in srgb, var(--dhx-text) 2.5%, transparent); max-width: 520px; }
.ess-pb__move.is-left .ess-pb__card { grid-column: 1; justify-self: end; margin-right: clamp(40px, 5vw, 72px); }
.ess-pb__move.is-right .ess-pb__card { grid-column: 2; justify-self: start; margin-left: clamp(40px, 5vw, 72px); }
.ess-pb__meta { display: flex; align-items: center; gap: 10px; margin: 0 0 10px !important; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--dhx-accent); }
.ess-pb__meta span { padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(var(--dhx-accent-rgb), .45); letter-spacing: .08em; }
.ess-pb__name { margin: 0 0 10px !important; color: var(--dhx-text); font-family: var(--dhx-display); font-weight: 700; font-size: clamp(22px, 2.2vw, 34px) !important; line-height: 1.02; letter-spacing: -.04em; }
.ess-pb__text { margin: 0 !important; color: var(--dhx-muted-strong); font-size: clamp(15px, 1.15vw, 17.5px); line-height: 1.5; }
.ess-pb__ask { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0 0 !important; padding-top: 14px; border-top: 1px solid var(--dhx-line); color: var(--dhx-text); font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.ess-pb__ask .ev-ico { width: 18px; height: 18px; margin-top: 1px; color: var(--dhx-accent); }
.ess-pb__ask span { flex: none; color: var(--dhx-accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin-top: 3px; }
.pg-motion .ess-pb__head, .pg-motion .ess-pb__card { opacity: 0; translate: 0 36px; transition: opacity .8s var(--dhx-ease), translate 1s var(--dhx-ease); }
.pg-motion .ess-pb__head.is-in, .pg-motion .ess-pb__move.is-in .ess-pb__card { opacity: 1; translate: 0 0; }
@media (max-width: 760px) {
  .ess-pb__rail { left: 26px; }
  .ess-pb__move { grid-template-columns: minmax(0, 1fr); }
  .ess-pb__node { left: 26px; top: 28px; translate: -50% 0; width: 48px; height: 48px; }
  .ess-pb__move.is-left .ess-pb__card, .ess-pb__move.is-right .ess-pb__card { grid-column: 1; justify-self: stretch; margin: 0 0 0 64px; max-width: none; }
}

/* ---------- closing + bibliography ---------- */
.dhx-essay .dhx-statement { padding-bottom: clamp(30px, 5vh, 60px); }
.ess-biblio { width: 100%; }
.ess-biblio__note { max-width: 1240px; margin: 0 auto !important; padding: 0 var(--dhx-gutter) clamp(40px, 8vh, 90px); color: var(--dhx-muted); font-size: 12px; font-style: italic; }

/* hero title: letters rise out of a mask, like the homepage */
.ess-w { display: inline-block; white-space: nowrap; }
.ess-m { display: inline-block; overflow: hidden; vertical-align: top; padding: .06em 0 .14em; margin: -.06em 0 -.14em; }
.ess-c { display: inline-block; will-change: transform; }
.pg-motion .ess-hero__title.is-split .ess-c { transform: translate3d(0, 108%, 0); transition: transform 1.1s var(--dhx-ease); transition-delay: calc(var(--i) * 28ms + 150ms); }
.pg-motion .ess-hero__title.is-split.is-in .ess-c { transform: none; }
.pg-motion .ess-hero__kicker, .pg-motion .ess-hero__lede { opacity: 0; translate: 0 18px; transition: opacity .9s var(--dhx-ease), translate 1.1s var(--dhx-ease); }
.pg-motion .ess-hero__kicker { transition-delay: .05s; }
.pg-motion .ess-hero__lede { transition-delay: .9s; }
.pg-motion .ess-hero.is-in :is(.ess-hero__kicker, .ess-hero__lede) { opacity: 1; translate: 0 0; }
@media (prefers-reduced-motion: reduce) { .pg-motion .ess-hero__title.is-split .ess-c { transform: none; transition: none; } .pg-motion .ess-hero__kicker, .pg-motion .ess-hero__lede { opacity: 1; translate: 0 0; transition: none; } }
