/* ——— 25 Years in the Making · editorial styles ——— */
:root {
  --paper: #f6f2e9;
  --paper-deep: #efe9db;
  --ink: #221f19;
  --ink-soft: #6b6355;
  --ink-faint: rgba(34, 31, 25, 0.14);
  --gold: #a9812f;
  --gold-bright: #c9a35c;
  --kz-teal: #147e96;        /* Kazakhstan sky-blue, deepened for premium use */
  --kz-teal-soft: #2fa3b8;
  --dark: #14110c;
  --dark-soft: #d8d2c4;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, "Helvetica Neue", sans-serif;
  --measure: 41.5rem;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.16rem;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }

/* status-bar scrim: keeps the clock legible while content scrolls beneath (iPhone, viewport-fit=cover) */
#statusbar-scrim {
  position: fixed; top: 0; left: 0; right: 0;
  height: env(safe-area-inset-top, 0px); z-index: 55;
  -webkit-backdrop-filter: blur(16px) saturate(1.1); backdrop-filter: blur(16px) saturate(1.1);
  background: rgba(20, 17, 12, 0.10);
  pointer-events: none;
}

/* progress bar */
#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--gold-bright); z-index: 60;
  transition: width 80ms linear;
}

/* chapter dot nav */
#chapter-nav {
  position: fixed; right: 1.4rem; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 0.3rem; z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity 0.5s;
}
#chapter-nav.visible { opacity: 1; pointer-events: auto; }
#chapter-nav a {
  width: 22px; height: 22px; position: relative;
  display: flex; align-items: center; justify-content: center;
}
#chapter-nav a::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-faint); transition: background 0.3s, transform 0.3s;
}
#chapter-nav a:hover::after { transform: scale(1.6); background: var(--gold-bright); }
#chapter-nav a.active::after { background: var(--gold); transform: scale(1.4); }
#chapter-nav a .dot-tip {
  position: absolute; right: 1.5rem; top: 50%; transform: translateY(-50%) translateX(4px);
  width: 148px; pointer-events: none;
  background: var(--paper); border: 1px solid rgba(34, 31, 25, 0.12);
  border-radius: 6px; padding: 5px; box-shadow: 0 10px 30px rgba(20, 17, 12, 0.16);
  opacity: 0; transition: opacity 0.22s, transform 0.22s;
}
#chapter-nav a .dot-tip img {
  width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 3px;
  background: var(--paper-deep); display: block;
}
#chapter-nav a .dot-tip b {
  display: block; font-family: var(--sans); font-weight: 600;
  font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft); padding: 0.4rem 0.2rem 0.15rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
#chapter-nav a:hover .dot-tip { opacity: 1; transform: translateY(-50%) translateX(0); }
#chapter-nav.on-dark a::after { background: rgba(246, 242, 233, 0.35); }
#chapter-nav.on-dark a.active::after { background: var(--gold-bright); }

/* mobile chapter navigation: current-chapter pill + full-screen index */
#m-nav-pill {
  position: fixed; right: 1rem; bottom: max(1.1rem, env(safe-area-inset-bottom, 0px)); z-index: 60;
  display: none; align-items: center; gap: 0.5rem; max-width: 62vw;
  font-family: var(--sans); font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft);
  background: rgba(246, 242, 233, 0.9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(34, 31, 25, 0.12); border-radius: 999px;
  padding: 0.62rem 0.95rem; cursor: pointer;
  box-shadow: 0 6px 24px rgba(20, 17, 12, 0.14);
  opacity: 0; pointer-events: none; transition: opacity 0.4s;
}
#m-nav-pill.visible { opacity: 1; pointer-events: auto; }
#m-nav-pill .pill-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#m-nav-pill::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--kz-teal-soft); flex: none; }
#m-nav-pill:active { transform: scale(0.96); }
#m-nav {
  position: fixed; inset: 0; z-index: 98; background: var(--paper);
  display: none; flex-direction: column; overflow-y: auto;
  padding: max(1.2rem, env(safe-area-inset-top, 0px)) 1.2rem max(1.2rem, env(safe-area-inset-bottom, 0px));
}
#m-nav.open { display: flex; }
#m-nav .mn-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.4rem 0.2rem 1rem;
}
#m-nav .mn-title {
  font-family: var(--sans); font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--kz-teal);
}
#m-nav .mn-close {
  background: none; border: none; font-family: var(--serif); font-size: 2rem;
  line-height: 1; color: var(--ink-soft); padding: 0.2rem 0.5rem; cursor: pointer;
}
#m-nav a {
  display: flex; align-items: center; gap: 0.9rem; text-decoration: none;
  padding: 0.65rem 0.2rem; border-bottom: 1px solid rgba(34, 31, 25, 0.07);
  -webkit-tap-highlight-color: transparent;
}
#m-nav a:active { background: rgba(47, 163, 184, 0.06); }
#m-nav a img {
  width: 72px; height: 48px; object-fit: cover; border-radius: 4px; flex: none;
  background: var(--paper-deep);
}
#m-nav a .mn-kicker {
  font-family: var(--sans); font-size: 0.56rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft);
  display: block; margin-bottom: 0.15rem;
}
#m-nav a .mn-name { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); }
#m-nav a.current .mn-name { color: var(--kz-teal); }
#m-nav a.current img { outline: 2px solid var(--kz-teal-soft); }

/* route mini-map */
#route-map {
  position: fixed; left: 1.4rem; bottom: 1.4rem; width: 120px; z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity 0.6s;
  background: rgba(246, 242, 233, 0.82);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(34, 31, 25, 0.08); border-radius: 6px;
  padding: 6px;
}
#route-map.visible { opacity: 1; }
#route-map svg { width: 100%; height: auto; display: block; }
@media (max-width: 900px) { #route-map { display: none; } }

/* ——— hero ——— */
#hero {
  position: relative; height: 100svh; min-height: 560px;
  display: flex; align-items: flex-end; overflow: hidden;
  background: var(--dark);
}
.hero-media {
  position: absolute; inset: -6% 0; background-size: cover;
  background-position: center 38%;
  animation: heroDrift 26s ease-out forwards;
}
@keyframes heroDrift {
  from { transform: scale(1.09); }
  to { transform: scale(1); }
}
.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(20,17,12,0.30) 0%, rgba(20,17,12,0) 30%, rgba(20,17,12,0) 45%, rgba(20,17,12,0.78) 100%);
}
.hero-content {
  position: relative; z-index: 2; color: #f6f2e9;
  padding: 0 clamp(1.4rem, 6vw, 6rem) calc(clamp(4.2rem, 9vh, 7rem) + env(safe-area-inset-bottom, 0px));
  padding-left: max(clamp(1.4rem, 6vw, 6rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(1.4rem, 6vw, 6rem), env(safe-area-inset-right, 0px));
  max-width: 60rem;
}
.overline {
  font-family: var(--sans); font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--gold-bright); margin-bottom: 1.3rem;
}
#hero h1 {
  font-family: var(--serif); font-weight: 340;
  font-size: clamp(2.9rem, 7.6vw, 5.6rem);
  line-height: 1.04; letter-spacing: -0.012em;
  text-wrap: balance;
}
.hero-sub {
  margin-top: 1.5rem; max-width: 34rem;
  font-size: clamp(1.02rem, 1.6vw, 1.18rem); line-height: 1.62;
  font-style: italic; color: rgba(246, 242, 233, 0.85);
}
.scroll-cue {
  position: absolute; bottom: 1.6rem; left: 50%; transform: translateX(-50%);
  z-index: 2; width: 1px; height: 52px; overflow: hidden;
}
.scroll-cue span {
  display: block; width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent, rgba(246,242,233,0.9));
  animation: cueDrop 2.2s ease-in-out infinite;
}
@keyframes cueDrop {
  0% { transform: translateY(-100%); }
  60% { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* ——— intro + route ——— */
.intro {
  padding: clamp(5rem, 11vh, 8.5rem) 1.4rem clamp(3.5rem, 7vh, 5.5rem);
  text-align: center;
}
.intro p.lede {
  font-family: var(--serif); font-weight: 380;
  font-size: clamp(1.45rem, 3vw, 2.05rem); line-height: 1.5;
  max-width: 46rem; margin: 0 auto; text-wrap: balance;
  letter-spacing: -0.004em;
}
.route {
  margin: clamp(3rem, 6vh, 4.5rem) auto 0; max-width: 54rem;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 0.4rem 0;
  font-family: var(--sans); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-soft);
}
.route .city { padding: 0 0.85rem; white-space: nowrap; }
.route .city.em { color: var(--gold); }
.route .leg {
  width: clamp(1.6rem, 5vw, 4rem); height: 1px;
  background: var(--ink-faint); position: relative; flex: none;
}
.route .leg::after {
  content: ""; position: absolute; right: -1px; top: -2.2px;
  width: 5.5px; height: 5.5px; border-radius: 50%; background: var(--kz-teal-soft);
  transform: scale(0.6);
}

/* ——— chapters ——— */
.chapter { padding: clamp(4.5rem, 10vh, 8rem) 0 clamp(2.5rem, 5vh, 4rem); scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 0.5rem); }
.chapter-head {
  max-width: var(--measure); margin: 0 auto; padding: 0 1.4rem;
}
.kicker {
  font-family: var(--sans); font-size: 0.71rem; font-weight: 600;
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold);
  margin-bottom: 1.1rem; display: flex; align-items: center; gap: 1rem;
}
.kicker::before { content: ""; width: 2.2rem; height: 1px; background: var(--kz-teal-soft); opacity: 0.85; }
.chapter h2 {
  font-family: var(--serif); font-weight: 380;
  font-size: clamp(2.15rem, 4.6vw, 3.4rem); line-height: 1.08;
  letter-spacing: -0.01em; margin-bottom: 2.6rem; text-wrap: balance;
}
.chapter .prose { max-width: var(--measure); margin: 0 auto; padding: 0 1.4rem; }
.chapter .prose p { margin-bottom: 1.55rem; text-wrap: pretty; }
.chapter .prose p.drop::first-letter {
  font-family: var(--serif); font-weight: 500;
  font-size: 2.5em; line-height: 0.85; float: left;
  padding: 0.07em 0.14em 0 0; color: var(--gold);
}

/* pull quote */
.pull {
  max-width: 40rem; margin: clamp(4rem, 9vh, 6.5rem) auto;
  padding: 0 1.4rem; text-align: center;
}
.pull p {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.5rem, 3.1vw, 2.15rem); line-height: 1.42;
  color: var(--ink); text-wrap: balance;
}
.pull::before {
  content: "”"; display: block; font-family: var(--serif);
  font-size: 3.2rem; line-height: 0.55; color: var(--gold-bright);
  margin-bottom: 0.55rem;
}

/* ——— photo blocks ——— */
figure.photo { position: relative; }
figure.photo img {
  width: 100%; height: 100%; object-fit: cover;
  background: var(--paper-deep); cursor: zoom-in;
}
/* living photos */
figure.photo video.live {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
figure.photo video.live.playing { opacity: 1; }
figure.photo .live-badge {
  position: absolute; top: 0.6rem; left: 0.6rem; z-index: 2;
  font-family: var(--sans); font-size: 0.56rem; font-weight: 600;
  letter-spacing: 0.12em; color: rgba(246, 242, 233, 0.92);
  background: rgba(20, 17, 12, 0.38);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  padding: 0.22rem 0.45rem; border-radius: 3px; pointer-events: none;
  display: flex; align-items: center; gap: 0.3rem;
  opacity: 0.85; transition: opacity 0.3s;
}
figure.photo .live-badge::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold-bright);
}
figure.photo.live-playing .live-badge { opacity: 0; }

/* people: tappable names + identity cards */
.person {
  background: none; border: none; padding: 0; font: inherit; color: inherit;
  border-bottom: 1px dotted rgba(47, 163, 184, 0.65); cursor: pointer;
}
.person:hover { border-bottom-color: var(--kz-teal); color: var(--kz-teal); }
#person-card {
  position: fixed; z-index: 90; width: min(300px, calc(100vw - 2rem));
  background: var(--paper); border: 1px solid rgba(34, 31, 25, 0.14);
  border-radius: 8px; box-shadow: 0 14px 44px rgba(20, 17, 12, 0.18);
  padding: 1rem 1.1rem; display: none;
}
#person-card.open { display: flex; gap: 0.9rem; align-items: flex-start; }
#person-card .pc-avatar {
  width: 58px; height: 58px; border-radius: 50%; flex: none;
  object-fit: cover; background: var(--paper-deep);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 1.5rem; color: var(--gold);
}
#person-card .pc-name { font-family: var(--serif); font-size: 1.1rem; margin-bottom: 0.25rem; }
#person-card .pc-role { font-family: var(--sans); font-size: 0.76rem; line-height: 1.5; color: var(--ink-soft); }
@media (max-width: 680px) {
  #person-card { left: 1rem !important; right: 1rem; width: auto; bottom: max(1rem, env(safe-area-inset-bottom)); top: auto !important; }
}

/* record translations */
#lang-toggle {
  position: fixed; top: max(0.9rem, env(safe-area-inset-top, 0px)); right: 1.2rem; z-index: 60;
  display: flex; align-items: center; gap: 0.35rem;
  font-family: var(--sans); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.12em;
  background: rgba(246, 242, 233, 0.88);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(34, 31, 25, 0.14); border-radius: 999px;
  padding: 0.42rem 0.8rem; cursor: pointer; color: var(--ink-soft);
  opacity: 0; pointer-events: none; transition: opacity 0.4s;
}
#lang-toggle.visible { opacity: 1; pointer-events: auto; }
#lang-toggle b { color: var(--kz-teal); font-weight: 700; }
#lang-toggle i { font-style: normal; }
#lang-toggle.ru b { color: var(--ink-soft); font-weight: 600; }
#lang-toggle.ru i { color: var(--kz-teal); font-weight: 700; }
#lang-toggle span { opacity: 0.4; }
.translation { margin-top: 0.9rem; padding: 0.9rem 1rem; border-left: 2px solid var(--gold-bright); background: rgba(34, 31, 25, 0.03); }
.translation h4 { font-family: var(--sans); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--kz-teal); margin-bottom: 0.6rem; }
.translation .tr-row { margin-bottom: 0.45rem; }
.translation .tr-en { font-family: var(--body); font-size: 0.92rem; line-height: 1.5; color: var(--ink); }

/* inline language flips (the trip ran on Google Translate) */
.lang-flip { border-bottom: 1px dotted var(--gold); cursor: pointer; }

figcaption, .cap {
  font-family: var(--sans); font-size: 0.74rem; letter-spacing: 0.02em;
  color: var(--ink-soft); margin-top: 0.7rem; line-height: 1.5;
}
figcaption::before, .cap::before {
  content: "— "; color: var(--gold-bright);
}

.ph-wide { max-width: 62rem; margin: clamp(2.8rem, 6vh, 4.2rem) auto; padding: 0 1.4rem; }
.ph-wide img { aspect-ratio: 3 / 2; }
.ph-wide.tall img { aspect-ratio: 4 / 4.4; }
.ph-wide.inset { max-width: 44rem; }
.ph-wide.inset img { aspect-ratio: 4 / 4.6; }

.ph-grid {
  max-width: 62rem; margin: clamp(2.8rem, 6vh, 4.2rem) auto; padding: 0 1.4rem;
  display: grid; gap: 1.1rem;
}
/* grid cells stretch to the row — height:100% images would swallow captions/panels */
.ph-grid figure.photo img { height: auto; }
.ph-grid.pair { grid-template-columns: 1fr 1fr; }
.ph-grid.pair figure.photo img { aspect-ratio: 4 / 5; }
.ph-grid.pair.land figure.photo img { aspect-ratio: 3 / 2.1; }
.ph-grid.trio { grid-template-columns: 1fr 1fr 1fr; }
.ph-grid.trio figure.photo img { aspect-ratio: 3 / 3.8; }
.ph-grid .span2 { grid-column: span 2; }
.ph-grid .span2 img { aspect-ratio: auto; }

/* full-bleed breaker */
.ph-full {
  position: relative; margin: clamp(4.5rem, 10vh, 7.5rem) 0;
  height: clamp(30rem, 92vh, 58rem); overflow: hidden; background: var(--dark);
}
.ph-full img {
  position: absolute; inset: -12% 0; height: 124%; width: 100%;
  object-fit: cover; will-change: transform; cursor: zoom-in;
}
.ph-full .cap {
  position: absolute; bottom: 1.4rem; right: 1.5rem; margin: 0;
  font-size: 0.78rem;
  color: rgba(246, 242, 233, 0.88);
  background: rgba(20, 17, 12, 0.42);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  padding: 0.42rem 0.85rem; border-radius: 3px; z-index: 2;
}
.ph-full .cap::before { color: var(--gold-bright); }

.ph-full + .ph-full { margin-top: clamp(6rem, 14vh, 10rem); }

/* mosaic (epilogue) */
.ph-mosaic {
  max-width: 74rem; margin: clamp(2.8rem, 6vh, 4.2rem) auto; padding: 0 1.4rem;
  columns: 3; column-gap: 1.1rem;
}
.ph-mosaic figure.photo { break-inside: avoid; margin-bottom: 1.1rem; }
.ph-mosaic figure.photo img { aspect-ratio: auto; }

/* dark band (used for shapagat emphasis + epilogue) */
.band-dark {
  background: var(--dark); color: var(--dark-soft);
  padding: clamp(4.5rem, 10vh, 8rem) 0;
  margin-top: clamp(3rem, 7vh, 5rem);
}
.band-dark .kicker { color: var(--gold-bright); }
.band-dark h2, .band-dark .pull p { color: #f2ede2; }
.band-dark figcaption, .band-dark .cap { color: rgba(216, 210, 196, 0.75); }
.band-dark .prose p.drop::first-letter { color: var(--gold-bright); }

/* ——— chapter-end galleries (every remaining photo) ——— */
.more { max-width: 76rem; margin: clamp(3rem, 6vh, 4.5rem) auto 0; padding: 0 1.4rem; }
.more-head {
  display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--ink-faint); padding-top: 1.1rem; margin-bottom: 1rem;
}
.more-head h3 {
  font-family: var(--sans); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--kz-teal);
}
.more-count { font-family: var(--sans); font-size: 0.68rem; color: var(--ink-soft); }

/* strip: horizontal film rail */
.strip {
  display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; padding: 0.2rem 0 1rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--gold-bright) transparent;
}
.strip::-webkit-scrollbar { height: 5px; }
.strip::-webkit-scrollbar-thumb { background: rgba(169, 129, 47, 0.4); border-radius: 3px; }
.strip img {
  height: clamp(130px, 20vh, 190px); width: auto; flex: none;
  scroll-snap-align: start; border-radius: 3px; cursor: zoom-in;
  background: var(--paper-deep);
}

/* wall: dense masonry with expander */
.wall-clip { max-height: 420px; overflow: hidden; position: relative; }
.wall-clip.expanded { max-height: none; }
.wall { columns: 5 150px; column-gap: 8px; }
.wall img { width: 100%; margin-bottom: 8px; border-radius: 3px; cursor: zoom-in; background: var(--paper-deep); break-inside: avoid; }
.wall-fade {
  position: absolute; bottom: 0; left: 0; right: 0; height: 120px;
  background: linear-gradient(transparent, var(--paper)); pointer-events: none;
}
.wall-clip.expanded .wall-fade { display: none; }
.more-btn {
  display: block; margin: 0.9rem auto 0;
  font-family: var(--sans); font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--kz-teal);
  background: none; border: 1px solid rgba(20, 126, 150, 0.35); border-radius: 999px;
  padding: 0.5rem 1.3rem; cursor: pointer; transition: border-color 0.3s;
}
.more-btn:hover { border-color: var(--kz-teal); }

/* carousel: one-at-a-time viewer with thumb rail */
.carousel { background: #0f2026; border-radius: 6px; overflow: hidden; }
.car-stage {
  position: relative; aspect-ratio: 3 / 2; max-height: 74vh;
  display: flex; align-items: center; justify-content: center;
}
.car-stage > img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.car-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(15, 25, 30, 0.55); border: none; color: rgba(246, 242, 233, 0.92);
  font-family: var(--serif); font-size: 1.7rem; line-height: 1;
  width: 44px; height: 44px; cursor: pointer; border-radius: 50%;
  transition: background 0.25s;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.car-btn:hover { background: rgba(20, 126, 150, 0.75); }
.car-prev { left: 1rem; }
.car-next { right: 1rem; }
.car-counter {
  position: absolute; bottom: 0.9rem; right: 1.1rem;
  font-family: var(--sans); font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(246, 242, 233, 0.85); background: rgba(15, 25, 30, 0.55);
  padding: 0.32rem 0.65rem; border-radius: 999px;
}
.car-rail {
  display: flex; gap: 6px; overflow-x: auto; padding: 8px;
  background: rgba(0, 0, 0, 0.3); -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
}
.car-rail img { height: 52px; width: auto; flex: none; opacity: 0.5; cursor: pointer; border-radius: 2px; transition: opacity 0.25s; }
.car-rail img:hover { opacity: 0.85; }
.car-rail img.cur { opacity: 1; outline: 2px solid var(--kz-teal-soft); }

/* chapter rule */
.chapter-rule {
  width: 3.2rem; height: 1px; background: var(--kz-teal-soft);
  margin: clamp(3rem, 7vh, 5rem) auto 0; opacity: 0.65;
}

/* ——— footer ——— */
#footer { background: var(--dark); color: var(--dark-soft); padding: clamp(5rem, 12vh, 8rem) 1.4rem; text-align: center; }
.footer-quote {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1.3rem, 2.6vw, 1.85rem); line-height: 1.5; color: #f2ede2;
  max-width: 44rem; margin: 0 auto;
}
.footer-rule { width: 2.6rem; height: 1px; background: var(--gold-bright); margin: 2.2rem auto; opacity: 0.7; }
.footer-meta {
  font-family: var(--sans); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.3em; text-transform: uppercase; color: rgba(216, 210, 196, 0.6);
}

/* ——— lightbox ——— */
#lightbox[hidden] { display: none; }
#lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(12, 10, 7, 0.96);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.25s;
}
#lightbox.open { opacity: 1; }
#lightbox figure {
  max-width: min(94vw, 1500px); max-height: 92vh;
  display: flex; flex-direction: column; align-items: center;
}
#lightbox img {
  max-width: 94vw; max-height: 84vh; object-fit: contain;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
#lightbox figcaption { color: rgba(246, 242, 233, 0.8); margin-top: 1rem; text-align: center; }
.lb-btn {
  position: absolute; z-index: 2; background: none; border: none;
  color: rgba(246, 242, 233, 0.75); font-family: var(--serif);
  cursor: pointer; transition: color 0.2s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.lb-btn:hover { color: #fff; }
.lb-close { top: 0.8rem; right: 1.4rem; font-size: 2.6rem; line-height: 1; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 3.4rem; padding: 1rem; }
.lb-prev { left: 0.6rem; }
.lb-next { right: 0.6rem; }
.lb-prev:hover { transform: translateY(-50%) translateX(-3px); }
.lb-next:hover { transform: translateY(-50%) translateX(3px); }

/* ——— reveal animations ——— */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 0.9s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.in { opacity: 1; transform: none; }
.ph-grid .reveal { transform: none; }
.reveal.d1 { transition-delay: 0.12s; }
.reveal.d2 { transition-delay: 0.24s; }
.reveal.d3 { transition-delay: 0.36s; }

/* keep content clear of the notch/island in landscape (viewport-fit=cover) */
.chapter-head, .chapter .prose, .intro, .ph-wide, .ph-grid, .ph-mosaic, .pull, .footer-inner {
  padding-left: max(1.4rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.4rem, env(safe-area-inset-right, 0px));
}

/* touch devices: no JS parallax — static cover avoids iOS compositing jank */
@media (hover: none) {
  .ph-full img { position: static; height: 100%; inset: auto; will-change: auto; transform: none !important; }
  .lb-close { top: max(0.8rem, env(safe-area-inset-top)); }
  .lb-prev, .lb-next { display: none; } /* swipe instead */
  #lightbox figcaption { padding: 0 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-media { animation: none; }
  .scroll-cue { display: none; }
  .ph-full img { position: static; height: 100%; inset: auto; }
}

/* ——— responsive ——— */
@media (min-width: 681px) and (max-width: 1023px) {
  .ph-wide { padding: 0 3.4rem; }
  .ph-grid { padding: 0 2.4rem; }
  .ph-grid.trio { grid-template-columns: 1fr 1fr; }
  .ph-grid.trio figure.photo:last-child { grid-column: span 2; }
  .ph-grid.trio figure.photo:last-child img { aspect-ratio: 3 / 1.9; }
}
@media (max-width: 820px) {
  .ph-full .cap {
    position: static; background: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
    color: var(--ink-soft); padding: 0.7rem 1.4rem 0; border-radius: 0; font-size: 0.8rem;
  }
}
@media (max-width: 900px) {
  .ph-mosaic { columns: 2; }
  .wall { columns: 3 110px; }
}
@media (max-width: 680px) {
  body { font-size: 1.08rem; }
  #m-nav-pill { display: flex; }
  .translate-chip { padding: 0.55rem 1rem; font-size: 0.64rem; }
  .more-btn { padding: 0.7rem 1.5rem; }
  .car-btn { width: 42px; height: 42px; font-size: 1.5rem; }
  .strip img:active, .wall img:active, .ph-mosaic img:active, .car-rail img:active { opacity: 0.7; }
  #chapter-nav { display: none; }
  /* full-bleeds become plain full-width figures: no fixed height, caption below the image */
  .ph-full { height: auto; overflow: visible; margin: clamp(2.2rem, 5vh, 3.2rem) 0; background: none; }
  .ph-full img { position: static; inset: auto; width: 100%; height: auto; aspect-ratio: 4 / 4.6; object-fit: cover; }
  .ph-full .cap {
    position: static; background: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
    color: var(--ink-soft); padding: 0.7rem 1.4rem 0; border-radius: 0;
  }
  .ph-grid.pair, .ph-grid.trio { grid-template-columns: 1fr; }
  .ph-grid.trio figure.photo img, .ph-grid.pair figure.photo img { aspect-ratio: 4 / 3.4; }
  .ph-grid .span2 { grid-column: auto; }
  figcaption, .cap { font-size: 0.8rem; line-height: 1.55; color: #57503f; }
  .ph-wide.tall img, .ph-wide.inset img { max-height: 88svh; }
  .scroll-cue { height: 40px; }
  .ph-mosaic { columns: 1; }
  .wall { columns: 2 100px; }
  .strip img { height: 118px; }
  .car-stage { aspect-ratio: 4 / 3; }
  .car-btn { width: 36px; height: 52px; font-size: 1.6rem; }
  .ph-full { height: 72vh; }
  .br-desk { display: none; }
  .lb-prev, .lb-next { font-size: 2.6rem; padding: 0.6rem; }
}
