/* Unravelling the city — essay page (green theme). Needs css/style.css first. */

.ut-page {
  --pad: clamp(20px, 9vw, 130px);
  --hero: clamp(44px, 6.67vw, 96px);    /* 96px */
  --title: clamp(30px, 4.44vw, 64px);   /* 64px */
  color: var(--blue);
}
.ut-wrap { padding: clamp(40px, 5.35vw, 77px) var(--pad) clamp(64px, 8vw, 120px); }

/* ---------- Hero ---------- */
.ut-title {
  margin: 0 0 26px 8px;
  font-family: var(--display);
  font-size: var(--hero);
  font-weight: 400;
  line-height: 100%;
}
.ut-intro { max-width: 549px; margin: 0; }

/* ---------- Feature row ---------- */
.ut-feature {
  display: grid;
  grid-template-columns: minmax(0, 549fr) minmax(0, 593fr);
  column-gap: clamp(20px, 2.64vw, 38px);
  margin-top: 40px;
  align-items: stretch;
}
.ph { margin: 0; background: #D9D9D9; overflow: hidden; }
.ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ut-cover { aspect-ratio: 549 / 319; }
.ut-feature-title {
  margin: 0;
  font-family: var(--display);
  font-size: var(--title);
  font-weight: 400;
  line-height: 100%;
}
.ut-feature-copy { display: flex; flex-direction: column; align-items: flex-start; }
.ut-teaser, .ut-label { margin: 25px 0 0 3px; max-width: 510px; }
.ut-open {
  display: inline-block;
  margin: auto 0 0 3px;
  padding-top: 33px;
  padding-right: 0;
  padding-bottom: 0;
  padding-left: 0;
  background: none;
  border: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.ut-open:hover { text-decoration-thickness: 2px; }
.ut-label { display: none; }
.ut-page.is-open .ut-teaser,
.ut-page.is-open .ut-open { display: none; }
.ut-page.is-open .ut-label { display: block; }

/* ---------- Essay (expands under the feature) ---------- */
.essay {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows .5s ease, visibility 0s .5s;
}
.essay.is-open {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows .5s ease, visibility 0s 0s;
}
.essay:focus { outline: none; }
.essay-inner { min-height: 0; overflow: hidden; }
.essay-body { padding-top: 28px; text-align: justify; }
.essay h3, .essay figcaption { text-align: left; }

.essay p { margin: 0; }
.dense p, .dense-p { line-height: normal; }                 /* single-spaced, line breaks */
.prose p { margin: 0 0 25px; line-height: normal; }
.prose p:last-child { margin-bottom: 0; }
.dense--after { margin-top: 0; }

.essay h3 {
  margin: 32px 0 0;
  font-family: var(--body);
  font-size: 20.777px;
  font-weight: 700;
  line-height: normal;
}
.essay h3 + * { margin-top: 30px; }
.essay h3.sec-gap { margin-top: 84px; }
.essay h3.sec-gap + .ba { margin-top: 40px; }
.essay h3.sec-gap--media + .split { margin-top: 56px; }
.essay .prose,
.essay .ba + .prose { margin-top: 44px; }
.essay .triptych + .prose { margin-top: 56px; }
.essay .split + .dense { margin-top: 45px; }

/* 3 satellite photos */
.triptych { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(8px, 1.3vw, 19px); }
.triptych figure { margin: 0; }
.triptych .ph { aspect-ratio: 381 / 283; }
.triptych figcaption { margin-top: 23px; }

/* image beside text */
.split { display: grid; gap: clamp(12px, 1.46vw, 21px); align-items: start; }
.split--square { grid-template-columns: minmax(0, 569fr) minmax(0, 590fr); }
.split--square .ph { aspect-ratio: 569 / 567; }
.split--wide { grid-template-columns: minmax(0, 604fr) minmax(0, 555fr); }
.split--wide .ph { aspect-ratio: 604 / 313; }
.split .prose { margin-top: 0; }

/* before / after slider */
.ba {
  --pos: 50%;
  position: relative;
  aspect-ratio: 1180 / 285;
  overflow: hidden;
  user-select: none;
}
.ba-layer { position: absolute; inset: 0; }
.ba-layer img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ba-after  { background: #C9C9C9; }
.ba-before { background: #D9D9D9; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 3px;
  margin-left: -1.5px;
  background: var(--bg);
  pointer-events: none;
}
.ba-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--blue);
}
.ba-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}
.ba:focus-within .ba-handle::after { box-shadow: 0 0 0 3px var(--blue); border-color: var(--bg); }

.essay-body > *:last-child { padding-bottom: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .ut-page { --hero: clamp(40px, 12.5vw, 64px); --title: clamp(30px, 8.4vw, 44px); }
  .ut-feature { grid-template-columns: 1fr; row-gap: 28px; }
  .essay h3 { font-size: 18px; }
  .essay-body { text-align: left; }
  .essay h3.sec-gap { margin-top: 56px; }
  .triptych { grid-template-columns: 1fr; gap: 16px; }
  .split--square, .split--wide { grid-template-columns: 1fr; }
  .ba { aspect-ratio: 16 / 9; }
}

@media (prefers-reduced-motion: reduce) {
  .essay, .essay.is-open { transition: none; }
}