/* =====================================================================
   Elphinston Wells — Pages CSS
   Interior page chrome (static header, page hero) and the menu overlay
   shared across all pages. Per CLAUDE.md §3.
   ===================================================================== */

/* =====================================================================
   MENU OVERLAY
   Full-screen frosted panel. Toggled by .is-open class on #menu.
   z-index 200 sits above the site header (z-index 100).
   ===================================================================== */

.ew-menu {
  position: fixed;
  inset: 0;
  z-index: 200;

  /* Dark frost — matches the EW dark palette with strong blur */
  background: rgba(33, 36, 41, 0.94);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);

  color: var(--c6);

  /* Hidden state */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 380ms var(--ease), visibility 380ms var(--ease);
}

.ew-menu.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Inner layout: flex column, full height, page margins */
.ew-menu__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0 var(--page-margin);
  box-sizing: border-box;
}

/* ----- Top bar: logo left, Close button right --------------------- */

.ew-menu__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: var(--frost-pad) 0;
  min-height: calc(var(--frost-block-h) + 2 * var(--frost-pad));
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.12);
}

.ew-menu__logo-link {
  display: block;
  color: var(--c6);
  line-height: 0;
}

.ew-menu__logo-wrap {
  display: block;
  height: var(--logo-h-sm);
  color: var(--c6);
}

.ew-menu__logo-svg {
  display: block;
  height: 100%;
  width: auto;
}

.ew-menu__close {
  /* Inherits .btn .btn--outline — just needs white colour context */
  color: var(--c6);
  border-color: rgba(255, 255, 255, 0.5);
}
.ew-menu__close:hover,
.ew-menu__close:focus-visible {
  color: var(--c-action);
  border-color: var(--c-action);
}

/* ----- Navigation: right-aligned large links ---------------------- */

.ew-menu__nav {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: var(--gutter) 0;
  overflow: hidden;
}

.ew-menu__list {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: right;
}

.ew-menu__item {
  overflow: hidden; /* clips the translateY entry */
}

.ew-menu__link {
  display: block;
  color: var(--c6);
  line-height: 1.15;
  padding: 6px 0;

  /* Larger than t-medium-title (52px cap) at desktop; same scaling curve below */
  font-size: clamp(30px, 5.2vw, 68px);

  /* Entry state: below + invisible */
  transform: translateY(110%);
  opacity: 0;
  transition:
    transform 550ms var(--ease),
    opacity   550ms var(--ease),
    color     180ms var(--ease);
}

/* Open: links animate into view with staggered delays */
.ew-menu.is-open .ew-menu__link {
  transform: translateY(0);
  opacity: 1;
}

/* Stagger: delay only the entry transforms, not color hover */
.ew-menu.is-open .ew-menu__item:nth-child(1) .ew-menu__link { transition-delay:  80ms,  80ms, 0ms; }
.ew-menu.is-open .ew-menu__item:nth-child(2) .ew-menu__link { transition-delay: 140ms, 140ms, 0ms; }
.ew-menu.is-open .ew-menu__item:nth-child(3) .ew-menu__link { transition-delay: 200ms, 200ms, 0ms; }
.ew-menu.is-open .ew-menu__item:nth-child(4) .ew-menu__link { transition-delay: 260ms, 260ms, 0ms; }
.ew-menu.is-open .ew-menu__item:nth-child(5) .ew-menu__link { transition-delay: 320ms, 320ms, 0ms; }

.ew-menu__link:hover,
.ew-menu__link:focus-visible {
  color: var(--c-action);
}

/* Current page: muted */
.ew-menu__link--current {
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

/* ----- Footer: contact details + Get in Touch CTA ----------------- */

.ew-menu__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: var(--gutter) 0;
  border-top: 0.5px solid rgba(255, 255, 255, 0.12);

  /* Entry: fade + slide up */
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 450ms var(--ease), transform 450ms var(--ease);
  transition-delay: 380ms;
}

.ew-menu.is-open .ew-menu__foot {
  opacity: 1;
  transform: translateY(0);
}

.ew-menu__contact {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ew-menu__contact-link {
  color: var(--c5);
  transition: color 180ms var(--ease);
}

.ew-menu__contact-link:hover,
.ew-menu__contact-link:focus-visible {
  color: var(--c6);
}

.ew-menu__cta {
  color: var(--c6);
  border-color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}
.ew-menu__cta:hover,
.ew-menu__cta:focus-visible {
  color: var(--c-action);
  border-color: var(--c-action);
}

/* ----- Suppress the view-project cursor when menu is open --------- */

/* .project-cursor is a later sibling of #menu in the DOM */
.ew-menu.is-open ~ .project-cursor {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ----- Reduced motion -------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .ew-menu,
  .ew-menu__link,
  .ew-menu__foot {
    transition: none;
  }
  .ew-menu__link {
    transform: none;
    opacity: 1;
  }
  .ew-menu__foot {
    transform: none;
    opacity: 1;
  }
}

/* ----- Structural (≤ 600px): compact top bar, left-align links, stack footer */

@media (max-width: 600px) {
  .ew-menu__topbar {
    padding: calc(var(--frost-pad) * 0.75) 0;
    min-height: 0;
  }

  /* Left-align at the structural breakpoint — avoids small text hanging right */
  .ew-menu__nav {
    justify-content: flex-start;
  }
  .ew-menu__list {
    text-align: left;
  }

  /* Larger floor so phone links feel substantial in a full-screen overlay */
  .ew-menu__link {
    font-size: clamp(36px, 8vw, 52px);
  }

  .ew-menu__foot {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--gutter);
  }
}

/* =====================================================================
   INTERIOR PAGE HEADER — static, white, sticky
   Shares .hdr-row / .hdr-block / .hdr-logo / .hdr-cta from header.css.
   No scroll choreography; just sits at the top.
   ===================================================================== */
.ew-page-header {
  background: var(--c6);
  padding: var(--frost-pad) var(--page-margin);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 0.5px solid rgba(54, 57, 66, 0.12);
}
.ew-page-header .hdr-block {
  min-height: var(--frost-block-h);
}
/* Base logo SVG wrapper sets color: white (for frost bar context).
   Interior page header has a white background, so override to dark. */
.ew-page-header .hdr-logo__svgwrap {
  color: var(--c1);
}

/* =====================================================================
   INTERIOR PAGE HERO
   White section below the static header, framed by thin strokes.
   Title uses the large-title scale (same as homepage hero).
   ===================================================================== */
.ew-page-hero {
  background: var(--c6);
  color: var(--c1);
  padding: 120px var(--page-margin);
  border-top: 0.5px solid rgba(54, 57, 66, 0.12);
  border-bottom: 0.5px solid rgba(54, 57, 66, 0.12);
}
.ew-page-hero__eyebrow {
  color: var(--c2);
  margin: 0 0 24px;
}
.ew-page-hero__title {
  margin: 0 0 32px;
  max-width: none;
  font-size: var(--medium-title-size);
  line-height: var(--medium-title-lh);
  font-variation-settings: "wght" var(--medium-title-wght), "wdth" var(--medium-title-wdth);
}
.ew-page-hero__intro {
  margin: 0;
  max-width: 52ch;
  color: var(--c1);
}

/* =====================================================================
   ACCREDITATIONS strip — used on About page
   ===================================================================== */
.sec-accred {
  border-top: 0.5px solid rgba(54, 57, 66, 0.18);
}
.sec-accred__item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sec-accred__label {
  color: var(--c2);
  margin: 0;
}
.sec-accred__name {
  margin: 0;
  color: var(--c1);
}

/* =====================================================================
   RESPONSIVE — page header at <= 600px
   ===================================================================== */
/* =====================================================================
   INTERIOR PAGE — content alignment overrides
   The grid system defaults to right-aligned. Interior page content
   (service cards, contact details, accreditations) reads better
   left-aligned — it's multi-line body copy per CLAUDE.md §5.
   ===================================================================== */
.sec-service,
.sec-work__item,
.sec-accred__item,
.ew-page-contact-details {
  align-items: flex-start;
  text-align: left;
}
/* Contact page details column: same rhythm as the form beside it
   (gutter between groups, a third of a gutter between label and value).
   Title top aligns with the first form label; the coverage line drops to
   the foot so it lines up with the privacy note under the form. */
.ew-page-contact-details__title,
.ew-page-contact-details p { margin: 0; }
.ew-page-contact-details__list { display: flex; flex-direction: column; gap: var(--gutter); }
.ew-page-contact-details__item { display: flex; flex-direction: column; gap: calc(var(--gutter) / 3); }
.ew-page-contact-details .ew-page-contact-details__coverage { margin-top: auto; }

/* Work page: placeholder image div needs explicit width so aspect-ratio
   can calculate its height. Without it, align-items:flex-end collapses
   a contentless block to 0 width. */
.sec-work__img {
  width: 100%;
  display: block;
}
/* Caption row: title left, location right, baseline-aligned */
.sec-work__caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  gap: var(--gutter);
  margin-top: 16px;
}
.sec-work__name {
  margin: 0;
  color: var(--c1);
  flex-shrink: 0;
}
.sec-work__location {
  margin: 0;
  color: var(--c2);
  text-align: right;
}

/* Service icon — grey square above each service title (grey shows if icon absent) */
.sec-service__icon {
  width: 120px;
  height: 120px;
  background: var(--c2);
  flex-shrink: 0;
  overflow: hidden;
}
.sec-service__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Service cards: match the Our Difference (sec-craft) pattern.
   gap: var(--gutter) between icon / heading / body, margins zeroed so
   browser defaults don't compound on top of the flex gap. */
.sec-service {
  gap: var(--gutter);
}
.sec-service__heading,
.sec-service__body {
  margin: 0;
}
.sec-service__body {
  max-width: 36ch;
}

/* About page values: same icon/heading/body pattern (ready for icons later) */
.sec-about-values .block {
  gap: var(--gutter);
}
.sec-about-values h3,
.sec-about-values p {
  margin: 0;
}
.sec-value__img {
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--c2);
}
.sec-value__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* S9: tighten the gap between the two-para intro and the three-value columns.
   They read as one block; the full --section-gap (120px) reads as a page break. */
.body-flow > .sec-how-we-work + .sec-about-values { margin-top: 48px; }

/* Services grid: row-gap to breathe between the 4 rows of 3 */
.sec-services__grid {
  row-gap: 96px;
}

/* Interior page: space between the dark page-hero and the first body module.
   Matches the section-gap rhythm used between homepage modules. */
.ew-page-hero + .module {
  margin-top: 72px;
}


/* =====================================================================
   LEGAL pages (privacy.html, terms.html)
   Each clause is its own 12-col row: heading 6 | body 6, keyline above.
   Below 600px the heading stacks over the body.
   ===================================================================== */
.sec-legal__clause { border-top: 1px solid var(--keyline); }
.sec-legal__clause .block { padding-bottom: var(--gutter); }
.sec-legal__body { gap: calc(var(--gutter) / 2); }
.sec-legal h2,
.sec-legal p,
.sec-legal ul { margin: 0; color: var(--c1); }
.sec-legal ul {
  padding-left: 1.2em;
  display: flex;
  flex-direction: column;
  gap: calc(var(--gutter) / 3);
}
.sec-legal a { text-decoration: underline; }
.sec-legal a:hover,
.sec-legal a:focus-visible { color: var(--c-action); }
@media (max-width: 600px) {   /* bp-structural */
  .sec-legal__clause .block { grid-column: 1 / -1; }
  .sec-legal__clause .block + .block { padding-top: 0; }
}

/* Reusable left-align override for interior page blocks that hold
   multi-line body copy. Beats .block specificity via source order. */
.block--left {
  align-items: flex-start;
  text-align: left;
}

/* =====================================================================
   RESPONSIVE — services stacking
   3-across is too narrow for body copy below 820px. Fold to 2-across at
   the soft breakpoint, then single-column at the structural breakpoint.
   ===================================================================== */

/* bp-soft (820px): services, about values and accreditations fold to 2-across.
   3-across and 4-across are too narrow for body copy below this width. */
@media (max-width: 820px) {
  .sec-services .block { grid-column: span 6; }
  .sec-about-values .block { grid-column: span 6; }
  .sec-accred .sec-accred__item { grid-column: span 6; }
}

/* bp-structural (600px): services single-column */
@media (max-width: 600px) {
  .sec-services .block { grid-column: 1 / -1; }
}

/* =====================================================================
   RESPONSIVE — page header at <= 820px
   Matches the homepage frostbar compact layout at all mobile/tablet sizes.
   ===================================================================== */
@media (max-width: 820px) { /* --bp-soft */
  .ew-page-header {
    padding: 14px var(--page-margin);
  }
  .ew-page-header .hdr-block { min-height: 0; }
  .ew-page-header .hdr-strap,
  .ew-page-header .hdr-block[aria-hidden="true"] { display: none; }
  .ew-page-header .hdr-cta__group .btn--filled { display: none; }
  /* Switch from 4-column grid to compact flex row: logo left, CTA right */
  .ew-page-header .hdr-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    column-gap: 16px;
  }
  /* Hide desktop icon logo; show mobile horizontal logo at same size as homepage frostbar */
  .ew-page-header .hdr-logo__svgwrap--top { display: none; }
  .ew-page-header .hdr-logo__svgwrap.hdr-logo__svgwrap--mobile {
    display: block;
    height: 32px;
    color: var(--c1);
  }
}

/* =====================================================================
   RESPONSIVE — page header at <= 600px  (now largely redundant — kept
   for hero section sizing which doesn't apply at 820px)
   ===================================================================== */
@media (max-width: 600px) {
  .ew-page-hero {
    padding: 80px var(--page-margin);
  }
  .ew-page-hero__title {
    max-width: 100%;
  }
}

@media (max-width: 481px) {
  .ew-page-hero {
    padding: 60px var(--page-margin);
  }
  /* Contact page: clear break between the stacked details and the form */
  .ew-page-contact-details { padding-bottom: calc(var(--gutter) * 2); }
  /* More vertical breathing room between stacked accreditation items and values cards */
  .sec-accred .module__grid { row-gap: 40px; }
  .sec-about-values .module__grid { row-gap: 36px; }
}

/* =====================================================================
   WORK GALLERY — horizontal sticky scroll (work2.html)
   Wrapper: tall div that creates vertical scroll budget.
   Section: sticky panel that stays in viewport.
   Track: translates horizontally as the wrapper scrolls.
   ===================================================================== */

/* Tall wrapper — height set by JS to (sectionH + maxShift) */
.work-gallery-wrapper {
  position: relative;
}

/* Sticky panel. top and height overridden by JS to sit below the header. */
.sec-work-gallery {
  position: sticky;
  top: 0;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  padding-top: 80px;
  padding-bottom: 40px;   /* clears space for the progress bar */
  box-sizing: border-box; /* so JS height includes padding */
}

/* Horizontal track — translateX driven by JS */
.work-gallery__track {
  display: flex;
  gap: var(--gutter);
  padding: 0 var(--page-margin);
  will-change: transform;
  flex-shrink: 0;
}

/* Each project card */
.work-gallery__item {
  flex-shrink: 0;
}

/* Image placeholder.
   Width scales fluidly with viewport width (clamped), height derives from
   the 3:2 aspect-ratio. Images shrink as the screen narrows until the
   600px stacking breakpoint kicks in. */
.work-gallery__img {
  display: block;
  width: clamp(360px, 55vw, 700px);
  height: auto;
  aspect-ratio: 3 / 2;
}

/* Caption: name left, location right — mirrors the work.html pattern */
.work-gallery__caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--gutter);
  margin-top: 16px;
  width: 100%;
}
.work-gallery__name {
  margin: 0;
  color: var(--c1);
  flex-shrink: 0;
}
.work-gallery__location {
  margin: 0;
  color: var(--c2);
  text-align: right;
}

/* Real images inside gallery cards */
.work-gallery__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Gallery link item — dark placeholder to distinguish from project cards */
.work-gallery__item--link { text-decoration: none; display: block; }
.work-gallery__img--gallery {
  background: var(--c1);
  position: relative;
  overflow: hidden;
}
.work-gallery__img--gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.45;
  display: block;
}
.work-gallery__gallery-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c6);
  letter-spacing: -0.01em;
  pointer-events: none;
}

/* Progress bar — sits at the bottom of the sticky gallery section, always visible.
   position: sticky creates the containing block for this absolutely-positioned element. */
.work-gallery-progress {
  position: absolute;
  bottom: 40px;
  left: 0;
  right: 0;
  padding: 0 var(--page-margin);
}
.work-gallery-progress__fill {
  height: 1px;
  width: 0%;
  background: var(--c1);
  transition: width 80ms linear;
  position: relative;
}
.work-gallery-progress::before {
  content: "";
  display: block;
  height: 1px;
  background: rgba(54, 57, 66, 0.18);
  margin-bottom: -1px;
}

/* Work CTA section (below gallery) — image on the right */
.sec-work-cta__media {
  overflow: hidden;
  padding: 0;
  background: var(--c2);
}
.sec-work-cta__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Services — Where we work: inset image, mirrors .sec-who__media pattern */
.sec-where-we-work__media {
  grid-column: 2 / 6;
  align-self: center;
  overflow: hidden;
  background: var(--c2);
  aspect-ratio: 1 / 1;
}
/* Services / Work — standalone image block on the right of a 6+6 module */
.sec-services-cta__media {
  overflow: hidden;
  padding: 0;
  background: var(--c2);
}
.sec-where-we-work__img,
.sec-services-cta__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* About — accreditation logo box */
.sec-accred__logo {
  width: 80px;
  height: 80px;
  background: var(--c6);
  flex-shrink: 0;
  overflow: hidden;
}
.sec-accred__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* bp-soft (820px): stack gallery to vertical list at tablet and below.
   The horizontal-scroll experience needs enough width to feel like a gallery;
   below 820px the single-item-per-row vertical list is cleaner. */
@media (max-width: 820px) { /* --bp-soft */
  .work-gallery-wrapper {
    height: auto !important;
  }
  .sec-work-gallery {
    position: static !important;
    top: auto !important;
    height: auto !important;
    display: block;
    padding: var(--page-margin);
  }
  .work-gallery__track {
    flex-direction: column;
    padding: 0;
    gap: 48px;
  }
  .work-gallery__img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
  }
  /* Hide progress bar in the stacked layout */
  .work-gallery-progress { display: none; }
}

@media (max-width: 600px) {
  /* Right-side image blocks stack below text; reset padding so they fill correctly */
  .sec-work-cta .module__grid > .block { grid-column: 1 / -1; }
  .sec-work-cta__media { aspect-ratio: 4 / 3; }
  /* Where we work: reset subgrid column so image fills block on narrow screens */
  .sec-where-we-work__media { aspect-ratio: 4 / 3; grid-column: 1 / -1; }
}

@media (max-width: 481px) {
}

/* =====================================================================
   LIGHTBOX
   Desktop and tablet only (≥481px). JS adds .lb-open to body.
   ===================================================================== */

.lb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(33, 36, 41, 0.93);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}
.lb-overlay--visible { display: flex; }
body.lb-open { overflow: hidden; }

.lb-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-img {
  display: block;
  max-width: 90vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Arrow buttons */
.lb-prev,
.lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--c6);
  font-size: 1.5rem;
  font-family: var(--font);
  font-variation-settings: 'wght' 200, 'wdth' 100;
  cursor: pointer;
  padding: 16px 20px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  z-index: 9001;
}
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-prev:hover,
.lb-next:hover { opacity: 1; }

/* Close button */
.lb-close {
  position: fixed;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: var(--c6);
  font-size: 1rem;
  font-family: var(--font);
  font-variation-settings: 'wght' 200, 'wdth' 100;
  cursor: pointer;
  padding: 8px 12px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  z-index: 9001;
  letter-spacing: 0.02em;
}
.lb-close:hover { opacity: 1; }

/* Counter */
.lb-counter {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--c2);
  font-family: var(--font);
  font-size: 0.75rem;
  font-variation-settings: 'wght' 300, 'wdth' 100;
  letter-spacing: 0.08em;
}

/* Cursor hint on gallery images at desktop/tablet */
@media (min-width: 481px) {
  .lb-trigger {
    cursor: zoom-in;
  }
}

/* =====================================================================
   PROJECT PAGE
   Full-bleed hero + sticky sidebar + editorial image grid.
   ===================================================================== */

/* ----- Hero --------------------------------------------------------- */

.proj-hero {
  position: relative;
  width: 100%;
  height: clamp(380px, 68vh, 760px);
  overflow: hidden;
}

/* Placeholder — replace with <img> + object-fit: cover when image is ready */
.proj-hero__image {
  position: absolute;
  inset: 0;
  background: var(--c1);
}
.proj-hero__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.proj-hero__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px var(--page-margin) 52px;
  /* Gradient: dark at top for back link, clear mid, dark at bottom for title */
  background: linear-gradient(
    to bottom,
    rgba(33, 36, 41, 0.55) 0%,
    transparent 30%,
    transparent 55%,
    rgba(33, 36, 41, 0.80) 100%
  );
  color: var(--c6);
}

/* btn--outline inherits white from .proj-hero__overlay context.
   width: fit-content prevents the flex column from stretching it full-width. */
.proj-hero__back {
  align-self: flex-start;
  width: fit-content;
  opacity: 0.75;
  transition: opacity 240ms var(--ease);
  text-decoration: none;
}
.proj-hero__back:hover { opacity: 1; }

.proj-hero__foot {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.proj-hero__title {
  margin: 0;
  color: var(--c6);
}

.proj-hero__type {
  margin: 0;
  color: rgba(255, 255, 255, 0.70);
}

/* ----- Body layout -------------------------------------------------- */

.proj-body {
  display: grid;
  grid-template-columns: 25% 75%;
}

/* ----- Sidebar ------------------------------------------------------ */

.proj-sidebar {
  background: var(--c6);
  border-right: 0.5px solid rgba(54, 57, 66, 0.12);
  padding: 48px var(--gutter) 48px var(--page-margin);
  display: flex;
  flex-direction: column;
  gap: 52px;
  box-sizing: border-box;
}

.proj-sidebar__meta {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 20px;
  row-gap: 8px;
  margin: 0;
  padding: 0;
}
.proj-sidebar__meta dt {
  color: var(--c2);
}
.proj-sidebar__meta dd {
  margin: 0;
  color: var(--c1);
}

/* Shared section wrapper — border + label + content pattern */
.proj-sidebar__overview,
.proj-sidebar__scope {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 0.5px solid rgba(54, 57, 66, 0.12);
  padding-top: 20px;
}

.proj-sidebar__overview-label,
.proj-sidebar__scope-label {
  margin: 0;
  color: var(--c1);
}

.proj-sidebar__desc {
  margin: 0;
  color: var(--c1);
  text-align: left;
}

.proj-sidebar__scope-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--c2);
  text-align: left;
}
.proj-sidebar__scope-list li {
  padding-left: 12px;
}

/* ----- Image grid --------------------------------------------------- */

.proj-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gutter);
  padding: var(--gutter) var(--page-margin) 80px var(--gutter);
  background: var(--c6);
  align-content: start;
}

.proj-img {
  background: var(--c2);
  overflow: hidden;
  display: block;
}
.proj-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Explicit grid placement — each row's height is set directly on the element */
.proj-img--r1  { grid-column: 1 / -1;     height: 420px; }  /* full-width cinematic */
.proj-img--r2a { grid-column: 1 / span 2; height: 360px; }  /* two-thirds */
.proj-img--r2b { grid-column: 3;           height: 360px; }  /* one-third, same height */
.proj-img--r3a { grid-column: 1;           height: 480px; }  /* one-third, taller */
.proj-img--r3b { grid-column: 2 / span 2; height: 480px; }  /* two-thirds, same height */
.proj-img--r4a { grid-column: 1;           height: 300px; }  /* three equal */
.proj-img--r4b { grid-column: 2;           height: 300px; }
.proj-img--r4c { grid-column: 3;           height: 300px; }
.proj-img--r5  { grid-column: 1 / -1;     height: 400px; }  /* full-width close-out */

/* ----- Responsive --------------------------------------------------- */

/* bp-soft (820px): STACK sidebar above gallery.
   Stack earlier than most sections because the 25% sidebar gets too narrow
   for comfortable reading below 1000px — body copy should never be squeezed
   into a thin column. */
@media (max-width: 820px) {
  .proj-body {
    grid-template-columns: 1fr;
  }
  .proj-sidebar {
    border-right: none;
    border-bottom: 0.5px solid rgba(54, 57, 66, 0.12);
    padding: 40px var(--page-margin);
    gap: 44px;
  }
  /* 2-col image grid once gallery is full-width */
  .proj-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px var(--page-margin) 60px;
  }
  /* Reset all desktop 3-col placements, then define 2-col layout.
     Without this, items using grid-column:3 would escape the 2-col grid. */
  .proj-img { grid-column: span 1; }
  .proj-img--r1,
  .proj-img--r5,
  .proj-img--r4c { grid-column: 1 / -1; }  /* full-width accent rows */
  /* Heights for 2-col layout */
  .proj-img--r1,
  .proj-img--r5  { height: 280px; }
  .proj-img--r2a,
  .proj-img--r2b,
  .proj-img--r3a,
  .proj-img--r3b,
  .proj-img--r4a,
  .proj-img--r4b { height: 240px; }
  .proj-img--r4c { height: 200px; }
}

/* bp-structural (600px): still stacked, tighten heights for narrower viewport */
@media (max-width: 600px) {
  .proj-gallery {
    gap: var(--gutter);
    padding: var(--page-margin) var(--page-margin) 48px;
  }
  .proj-img--r1,
  .proj-img--r5  { height: 220px; }
  .proj-img--r2a,
  .proj-img--r2b,
  .proj-img--r3a,
  .proj-img--r3b,
  .proj-img--r4a,
  .proj-img--r4b { height: 200px; }
  .proj-img--r4c { height: 180px; }
}

/* bp-phone (481px): single-column gallery, aspect-ratio hero.
   aspect-ratio: 4/5 scales the hero with page width — prevents the
   viewport-height-based sizing from making it too tall on portrait phones. */
@media (max-width: 481px) {
  .proj-hero {
    height: auto;
    aspect-ratio: 4 / 5;
  }
  .proj-hero__title {
    font-size: var(--medium-title-size);
    line-height: var(--medium-title-lh);
    font-variation-settings: "wght" var(--medium-title-wght), "wdth" var(--medium-title-wdth);
  }
  .proj-sidebar {
    gap: 36px;
    padding: 32px var(--page-margin);
  }
  .proj-gallery {
    grid-template-columns: 1fr;
    padding: var(--page-margin) var(--page-margin) 40px;
  }
  .proj-img--r1, .proj-img--r2a, .proj-img--r2b,
  .proj-img--r3a, .proj-img--r3b, .proj-img--r4a,
  .proj-img--r4b, .proj-img--r4c, .proj-img--r5 {
    grid-column: 1;
    height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .proj-hero__back { transition: none; }
}

/* =====================================================================
   GALLERY PAGE — masonry columns layout
   ===================================================================== */

.gal-hero {
  padding: 80px var(--page-margin) 48px;
  background: var(--c6);
}
.gal-hero__title {
  margin: 0;
  color: var(--c1);
}
.gal-hero__sub {
  margin: 12px 0 0;
  color: var(--c2);
}

.gal-grid {
  columns: 4;
  column-gap: 6px;
  padding: 6px var(--page-margin) 80px;
}
.gal-grid__item {
  break-inside: avoid;
  margin-bottom: 6px;
  overflow: hidden;
  display: block;
}
.gal-grid__item img {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 820px) {
  .gal-grid { columns: 3; }
}
@media (max-width: 600px) {
  .gal-grid { columns: 2; column-gap: 4px; padding: 4px var(--page-margin) 48px; }
  .gal-grid__item { margin-bottom: 4px; }
  .gal-hero { padding: 60px var(--page-margin) 32px; }
}
@media (max-width: 481px) {
  .gal-grid { columns: 2; }
}

/* =====================================================================
   GALLERY — Lightbox overlay
   ===================================================================== */
.gal-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(33, 36, 41, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}
.gal-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}
.gal-lightbox__img {
  max-width: 90vw;
  max-height: 90svh;
  object-fit: contain;
  display: block;
}
.gal-lightbox__close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: var(--c6);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
  opacity: 0.7;
  transition: opacity 180ms ease;
}
.gal-lightbox__close:hover { opacity: 1; }
