:root {
  --bg: #e8e8e8;
  --paper: #fbfbfb;
  --stone: #cfcdc7;
  --footer: #342e2e;
  --ink: #222221;
  --ink-soft: #3f3e3c;
  --muted: #6e6b66;
  --line: rgba(34, 34, 33, 0.14);
  --accent: #8a6a45;
  --accent-soft: #c4a882;
  --header-h: 4rem;

  /*
   * Fluid-Engine-style grid, mirrored from the reference site:
   * 24 fluid columns spanning the near-full viewport, uniform base rows
   * (~1.56vw) that grow to fit content, 11px-equivalent gaps.
   */
  --edge: clamp(1rem, 2.65vw, 3rem);
  --fe-gap: clamp(6px, 0.86vw, 14px);
  --fe-row: clamp(12px, 1.56vw, 26px);

  --display: "Marcellus", "Times New Roman", serif;
  --body: "PT Serif", Georgia, serif;
  --ui: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  vertical-align: middle;
}

a {
  color: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* ---------------------------------------------------------------------------
 * The grid. Each section's children are pinned to explicit column/row spans
 * copied from the reference site's Fluid Engine placements.
 * ------------------------------------------------------------------------- */
.fe {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: var(--fe-gap);
  grid-auto-rows: minmax(var(--fe-row), auto);
  width: calc(100% - 2 * var(--edge));
  margin-inline: auto;
}

.fe > * {
  margin: 0;
  min-width: 0;
}

/* Images pinned to a grid area fill and crop it; --natural ones keep their
   own aspect and simply start at a row. */
.fe-img {
  overflow: hidden;
}

.fe-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fe-img--natural img {
  height: auto;
  object-fit: unset;
}

/* Header */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}

.site-header__inner {
  height: 100%;
  width: calc(100% - 2 * var(--edge));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.menu-toggle {
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  margin-right: -0.4rem;
}

.menu-toggle__bars,
.menu-toggle__bars::before,
.menu-toggle__bars::after {
  display: block;
  width: 1.15rem;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle__bars {
  position: relative;
}

.menu-toggle__bars::before,
.menu-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-toggle__bars::before {
  top: -6px;
}

.menu-toggle__bars::after {
  top: 6px;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bars {
  background: transparent;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bars::before {
  top: 0;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bars::after {
  top: 0;
  transform: rotate(-45deg);
}

.site-menu {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-content: center;
  gap: 1.1rem;
  background: rgba(244, 243, 239, 0.97);
  text-align: center;
}

.site-menu[hidden] {
  display: none;
}

.site-menu a {
  font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  text-decoration: none;
}

.site-menu a:hover {
  color: var(--accent);
}

/* Type */
.eyebrow {
  margin: 0 0 0.85rem;
  font-family: var(--ui);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.display {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.1rem, 4.7vw, 4.5rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
}

.display--sm {
  font-size: clamp(1.85rem, 3.5vw, 3.3rem);
  text-transform: none;
}

.lede,
.section-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink);
}

.lede {
  font-size: clamp(1.4rem, 2.5vw, 2.35rem);
}

.section-title {
  font-size: clamp(1.6rem, 2.5vw, 2.35rem);
}

.section-title--center {
  text-align: center;
}

.prose p {
  margin: 0 0 1.15rem;
  color: var(--ink-soft);
  text-align: justify;
}

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

.prose strong {
  color: var(--ink);
  font-weight: 700;
}

.prose em {
  font-style: italic;
  color: var(--ink);
}

/* Sections */
.section {
  padding: clamp(2.75rem, 6vw, 4.5rem) 0;
  scroll-margin-top: calc(var(--header-h) + 0.5rem);
}

.section--grey {
  background: var(--bg);
}

.section--paper {
  background: var(--paper);
}

.section--stone {
  background: var(--stone);
}

/* Faded blueprint grid — quiet architectural texture behind two sections */
.section--blueprint {
  position: relative;
  isolation: isolate;
}

.section--blueprint::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgba(34, 34, 33, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(34, 34, 33, 0.05) 1px, transparent 1px);
  background-size: clamp(36px, 4vw, 60px) clamp(36px, 4vw, 60px);
  -webkit-mask-image: radial-gradient(120% 90% at 18% 12%, black 0%, transparent 68%);
  mask-image: radial-gradient(120% 90% at 18% 12%, black 0%, transparent 68%);
  pointer-events: none;
}

.snippets.section--blueprint::before {
  -webkit-mask-image: radial-gradient(120% 90% at 85% 85%, black 0%, transparent 68%);
  mask-image: radial-gradient(120% 90% at 85% 85%, black 0%, transparent 68%);
}

/* --- Vision (reference: title 1/25 r7-10, image 11/25 r4-23, copy 1/10) --- */
.vision {
  padding-top: calc(var(--header-h) + clamp(1.5rem, 4vw, 2.5rem));
}

.vision__title {
  grid-column: 1 / 11;
  grid-row: 4 / 16;
  align-self: center;
}

.vision__media {
  grid-column: 11 / 25;
  grid-row: 4 / 23;
  z-index: 1;
}

.vision__lede {
  grid-column: 1 / 10;
  grid-row: 17 / 19;
  align-self: end;
  z-index: 2;
}

.vision__prose {
  grid-column: 1 / 10;
  grid-row: 19 / 24;
  z-index: 2;
}

/* --- Concept (title left, villa image left, text right, board full below) --- */
.concept__title {
  grid-column: 1 / 9;
  grid-row: 1 / 3;
}

.concept__side {
  grid-column: 4 / 10;
  grid-row: 3;
}

.concept__side img {
  height: auto;
  object-fit: unset;
}

.concept__text {
  grid-column: 11 / 22;
  grid-row: 3;
  align-self: center;
}

.concept__board {
  grid-column: 2 / 24;
  grid-row: 10;
  margin-top: var(--fe-row);
}

/* --- Planning (centered title, wide plan) --- */
.planning__title {
  grid-column: 9 / 17;
  grid-row: 1 / 3;
}

.planning__board {
  grid-column: 4 / 22;
  grid-row: 3;
}

/* --- Palette (copy left, mood board right) --- */
.palette__head {
  grid-column: 1 / 9;
  grid-row: 1 / 4;
}

.palette__title-caps {
  text-transform: uppercase;
  font-size: 1em;
}

.palette__text {
  grid-column: 1 / 11;
  grid-row: 5 / 16;
}

.palette__board {
  grid-column: 11 / 25;
  grid-row: 1 / 16;
  align-self: center;
}

/* --- Snippets intro (copy left, heading right, four sketches in a row) --- */
.snippets__text {
  grid-column: 1 / 15;
  grid-row: 2 / 11;
}

.snippets__heading {
  grid-column: 16 / 25;
  grid-row: 6 / 10;
  align-self: center;
  text-align: right;
}

.snippets__sketch {
  grid-row: 12 / 18;
}

.snippets__sketch--1 {
  grid-column: 1 / 7;
}

.snippets__sketch--2 {
  grid-column: 7 / 13;
}

.snippets__sketch--3 {
  grid-column: 13 / 19;
}

.snippets__sketch--4 {
  grid-column: 19 / 25;
}

/* --- Landing: the daylight scrub is the hero --- */
.landing {
  background: #111;
}

.scrub-stage-wrap {
  position: relative;
  height: 340vh;
}

.landing-stage {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: hidden;
}

#scrub {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
}

.landing-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(17, 15, 13, 0.55) 0%,
    rgba(17, 15, 13, 0.12) 38%,
    rgba(17, 15, 13, 0) 60%
  );
  pointer-events: none;
}

.landing-copy {
  position: absolute;
  left: var(--edge);
  right: var(--edge);
  bottom: clamp(4.5rem, 12vh, 7.5rem);
  color: #f4f3ef;
  max-width: 46rem;
}

.landing-eyebrow {
  color: rgba(244, 243, 239, 0.72);
}

.landing-title {
  color: #f4f3ef;
  margin-bottom: 1rem;
}

.landing-sub {
  margin: 0 0 1.6rem;
  max-width: 34rem;
  color: rgba(244, 243, 239, 0.82);
}

.landing-enter {
  appearance: none;
  cursor: pointer;
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f4f3ef;
  background: rgba(244, 243, 239, 0.08);
  border: 1px solid rgba(244, 243, 239, 0.45);
  padding: 0.85rem 1.6rem;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.landing-enter:hover {
  background: rgba(244, 243, 239, 0.18);
  border-color: rgba(244, 243, 239, 0.8);
  transform: translateY(-2px);
}

.landing-enter:focus-visible {
  outline: 2px solid #f4f3ef;
  outline-offset: 3px;
}

.landing .scrub-hud {
  color: rgba(244, 243, 239, 0.65);
}

.landing .scrub-bar {
  background: rgba(244, 243, 239, 0.2);
}

.scrub-hud {
  position: absolute;
  left: 50%;
  bottom: 0.85rem;
  transform: translateX(-50%);
  width: calc(100% - 2 * var(--edge));
  max-width: 1400px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  font-family: var(--ui);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.scrub-bar {
  height: 2px;
  background: var(--line);
  overflow: hidden;
}

.scrub-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
}

.scrub-status {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  color: rgba(244, 243, 239, 0.8);
  background: rgba(17, 15, 13, 0.6);
  font-family: var(--ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.75rem;
  transition: opacity 0.35s ease;
}

.scrub-status.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* --- Gallery carousel: one render at a time, scroll contained in the track --- */
.gallery__heading {
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.carousel {
  width: calc(100% - 2 * var(--edge));
  margin-inline: auto;
}

.carousel-track {
  display: flex;
  gap: clamp(1.5rem, 4vw, 4rem);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  cursor: grab;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-track:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

.carousel-item {
  flex: 0 0 100%;
  margin: 0;
  scroll-snap-align: center;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.9rem;
}

.carousel-item img {
  width: 100%;
  max-height: min(64vh, 640px);
  object-fit: contain;
  background: transparent;
}

.carousel-item figcaption {
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 46rem;
  justify-self: center;
  text-align: center;
  min-height: 3em;
}

.carousel-nav {
  margin-top: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
}

.carousel-btn {
  appearance: none;
  cursor: pointer;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.carousel-btn:hover {
  border-color: var(--accent);
  background: rgba(138, 106, 69, 0.06);
}

.carousel-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.carousel-counter {
  font-family: var(--ui);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  min-width: 4.5em;
  text-align: center;
}

/* --- Expandable boards + lightbox --- */
.img-expand {
  appearance: none;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  position: relative;
}

.img-expand__hint {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  padding: 0.35rem 0.7rem;
  font-family: var(--ui);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(244, 243, 239, 0.88);
  border: 1px solid var(--line);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.img-expand:hover .img-expand__hint,
.img-expand:focus-visible .img-expand__hint {
  opacity: 1;
}

.img-expand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(17, 15, 13, 0.93);
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100dvh - clamp(2rem, 8vw, 6rem));
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 61;
  appearance: none;
  cursor: pointer;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  color: #f4f3ef;
  background: rgba(244, 243, 239, 0.08);
  border: 1px solid rgba(244, 243, 239, 0.4);
  border-radius: 50%;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.lightbox-close:hover {
  background: rgba(244, 243, 239, 0.2);
  border-color: rgba(244, 243, 239, 0.85);
}

.lightbox-close:focus-visible {
  outline: 2px solid #f4f3ef;
  outline-offset: 2px;
}

/* --- Closing (centered on stone ground) --- */
.closing__title {
  grid-column: 7 / 19;
  grid-row: 1 / 3;
}

.closing__text {
  grid-column: 5 / 21;
  grid-row: 3;
}

/* --- Footer (dark) --- */
.site-footer {
  padding: 3.5rem 0 4rem;
  background: var(--footer);
  color: #f4f3ef;
}

.footer-title {
  grid-column: 1 / 12;
  grid-row: 1 / 3;
  font-family: var(--display);
  font-size: clamp(1.6rem, 3.4vw, 3.1rem);
  line-height: 1.15;
}

.footer-sub {
  grid-column: 12 / 21;
  grid-row: 1 / 2;
  align-self: center;
  color: rgba(244, 243, 239, 0.75);
  font-size: 0.95rem;
}

.footer-link {
  grid-column: 19 / 25;
  grid-row: 2 / 3;
  align-self: end;
  justify-self: end;
  white-space: nowrap;
  font-family: var(--ui);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 0.15rem;
}

/* Reveal — fade + rise. Hidden state only applies once JS has booted (.js),
   so content is never lost without JavaScript. */
.reveal {
  transform: translateY(0.6rem);
  transition: transform 0.9s cubic-bezier(0.2, 0.65, 0.25, 1), opacity 0.9s ease;
}

.js .reveal {
  opacity: 0;
  transform: translateY(1.4rem);
}

.js .reveal.is-in,
.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* Sketches deal in like cards */
.snippets__sketch--2 {
  transition-delay: 70ms;
}

.snippets__sketch--3 {
  transition-delay: 140ms;
}

.snippets__sketch--4 {
  transition-delay: 210ms;
}

/* Images settle from a slight zoom as their block reveals */
.js .fe-img img {
  transform: scale(1.035);
  transition: transform 1.2s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.js .reveal.is-in img,
.js .fe-img.is-in img {
  transform: none;
}

/* ---------------------------------------------------------------------------
 * Mobile: collapse every grid to a single column in source order,
 * exactly as Fluid Engine does.
 * ------------------------------------------------------------------------- */
/* Lenis drives scrolling when active; CSS smooth-scroll must not fight it */
html.lenis {
  height: auto;
  scroll-behavior: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

@media (max-width: 760px) {
  .fe {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }

  .landing-copy {
    bottom: 5.5rem;
  }

  .carousel-item img {
    max-height: 55vh;
  }

  .vision__title {
    order: -1;
  }

  .snippets__heading {
    text-align: left;
  }

  .palette__board,
  .concept__board,
  .planning__board {
    margin-top: 0;
  }

  .fe-img img {
    height: auto;
    object-fit: unset;
  }

  .vision__media img {
    aspect-ratio: 4 / 5;
    object-fit: cover;
    height: auto;
  }

  .masonry {
    columns: 1;
  }

  .footer-sub {
    align-self: auto;
  }

  .footer-link {
    align-self: flex-start;
  }
}

@media (min-width: 761px) and (max-width: 980px) {
  .masonry {
    columns: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal,
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .js .fe-img img {
    transform: none;
    transition: none;
  }

  .scrub-stage-wrap {
    height: 100dvh;
  }

  .carousel-track {
    scroll-behavior: auto;
  }
}
