/* ═══════════════════════════════════════════════════════════
   TOSALET RESIDENCES — Shared Design System
   ══════════════════════════════════════════════════════════ */

/* ─── RESET ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { background: none; border: none; cursor: pointer; }
ul { list-style: none; }

/* ─── TOKENS ────────────────────────────────────────────── */
:root {
  --bg:        #F4E8C8;
  --bg-warm:   #EEE0B8;
  --bg-dark:   #1e0c05;
  --text:      #1e0c05;
  --text-mid:  #F7DCAA;
  --text-faint:rgba(247,220,170,0.5);
  --accent:    #F7DCAA;
  --gold:      #F7DCAA;
  --stone:     #F7DCAA;
  --line:      rgba(247,220,170,0.2);
  --line-dark: rgba(247,220,170,0.12);

  --f-display: 'Bodoni Moda', Georgia, serif;
  --f-body:    'Tenor Sans', sans-serif;

  /* Spacing scale */
  --s-xs:  0.5rem;
  --s-sm:  1rem;
  --s-md:  2rem;
  --s-lg:  4rem;
  --s-xl:  8rem;
  --s-xxl: 14rem;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── SMOOTH SCROLL SETUP ──────────────────────────────── */
html.lenis { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ─── BASE BODY ────────────────────────────────────────── */
body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.75;
  overflow-x: hidden;
}

/* ─── GRAIN OVERLAY ─────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

/* ─── NAVIGATION ────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2.5rem;
  transition: background 0.5s ease, backdrop-filter 0.5s ease;
}
.nav.scrolled {
  background: rgba(240, 233, 220, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.nav--dark {
  color: #ede4d5;
}
.nav--dark.scrolled {
  background: rgba(26, 18, 9, 0.92);
}

.nav__logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  opacity: 0.65;
  transition: opacity 0.4s;
  text-decoration: none;
}
.nav.scrolled .nav__logo { opacity: 1; }

.nav__logo img {
  height: 52px;
  width: auto;
  display: block;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}
.nav__link {
  font-family: var(--f-body);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  position: relative;
  opacity: 0.65;
  transition: opacity 0.3s;
}
.nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: currentColor;
  transition: width 0.4s var(--ease-out);
}
.nav__link:hover { opacity: 1; }
.nav__link:hover::after { width: 100%; }
.nav__link.active { opacity: 1; }
.nav__link.active::after { width: 100%; }

/* ─── EYEBROW LABELS ────────────────────────────────────── */
.eyebrow {
  display: block;
  font-family: var(--f-body);
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-mid);
}
.eyebrow--gold { color: var(--gold); }
.eyebrow--light { color: var(--stone); }

/* ─── DIVIDER LINE ──────────────────────────────────────── */
.divider {
  width: 1px;
  background: var(--line);
  margin: 0 auto;
}

/* ─── TEXT MASK REVEAL (SplitText line-by-line) ────────── */
.line-mask {
  overflow: hidden;
}

/* ─── IMAGE CLIP REVEAL ─────────────────────────────────── */
.img-reveal {
  clip-path: inset(0 100% 0 0);
}
.img-reveal.visible {
  clip-path: inset(0 0% 0 0);
  transition: clip-path 1.1s var(--ease-out);
}

/* ─── PARALLAX IMG ──────────────────────────────────────── */
.parallax-wrap {
  overflow: hidden;
  position: relative;
}
.parallax-img {
  width: 100%;
  height: 115%;
  object-fit: cover;
  transform: translateY(-7.5%);
  will-change: transform;
}

/* ─── FOOTER ─────────────────────────────────────────────── */
.footer {
  background: var(--bg-dark);
  color: var(--stone);
  padding: 4rem 2.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
  align-items: end;
}
.footer__brand {
  font-family: var(--f-display);
  font-size: 1.8rem;
  font-weight: 300;
  color: #ede4d5;
  line-height: 1.1;
}
.footer__brand em { font-style: italic; color: var(--gold); }
.footer__links { display: flex; flex-direction: column; gap: 0.75rem; }
.footer__link {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--stone);
  opacity: 0.6;
  transition: opacity 0.3s;
}
.footer__link:hover { opacity: 1; }
.footer__meta {
  text-align: right;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  line-height: 2;
  opacity: 0.4;
  text-transform: uppercase;
}
.footer__copy {
  border-top: 1px solid var(--line-dark);
  padding-top: 2rem;
  margin-top: 2rem;
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.3;
}

/* ─── HOUSE CARD (shared grid component) ──────────────── */
.house-card {
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.house-card__photo {
  overflow: hidden;
  background: var(--line);
}
.house-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  transition: transform 0.9s var(--ease-out);
  will-change: transform;
}
.house-card:hover .house-card__photo img { transform: scale(1.0); }
.house-card__info {
  padding: 1.25rem 0 0;
}
.house-card__num {
  font-family: var(--f-body);
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.4rem;
}
.house-card__name {
  font-family: var(--f-display);
  font-size: clamp(1.3rem, 2vw, 1.9rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  transition: color 0.3s;
}
.house-card:hover .house-card__name { color: var(--accent); }
.house-card__location {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mid);
  display: block;
  margin-top: 0.3rem;
}
.house-card__arrow {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 2.5rem; height: 2.5rem;
  background: var(--bg-dark);
  color: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.4s, transform 0.4s var(--ease-out);
}
.house-card:hover .house-card__arrow {
  opacity: 1;
  transform: scale(1);
}

/* ─── SIDENAV DOTS ──────────────────────────────────────── */
.sidenav {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sidenav__dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--stone);
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.3s, transform 0.3s, background 0.3s;
}
.sidenav__dot.active {
  opacity: 1;
  background: var(--accent);
  transform: scale(1.6);
}

/* ─── PAGE TRANSITION OVERLAY ───────────────────────────── */
.page-transition {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  z-index: 9000;
  opacity: 1;
  pointer-events: all;
}

/* ─── HOUSE HERO ─────────────────────────────────────────── */
/* z-index: 9 pushes the hero above the grain layer (z-index: 8)
   so the grain animation does not flicker over the hero image. */
.house-hero {
  background: var(--bg-dark);
  z-index: 9;
}

/* ─── HOUSE HERO MEDIA — remove overflow ─────────────────── */
/* inset: -20% 0 was only needed for the scale entrance animation.
   With that animation removed, collapse the media div to exactly
   fill the hero so there is no overflow boundary to cause
   GPU compositing edge artifacts. Higher specificity overrides
   the inline <style> blocks in house pages. */
.house-hero > .house-hero__media {
  inset: 0;
}

/* ─── BACK LINK ─────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--f-body);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-mid);
  transition: color 0.3s;
}
.back-link::before {
  content: '←';
  transition: transform 0.3s var(--ease-out);
}
.back-link:hover { color: var(--accent); }
.back-link:hover::before { transform: translateX(-4px); }

/* ─── BUTTON / CTA ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--f-body);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 1rem 2rem;
  border: 1px solid currentColor;
  transition: background 0.4s, color 0.4s;
}
.btn:hover {
  background: var(--text);
  color: var(--bg);
}
.btn--gold {
  border-color: var(--gold);
  color: var(--gold);
}
.btn--gold:hover {
  background: var(--gold);
  color: var(--bg-dark);
}
.btn--light {
  border-color: rgba(237,228,213,0.4);
  color: #ede4d5;
}
.btn--light:hover {
  background: #ede4d5;
  color: var(--bg-dark);
}

/* ─── SECTION PADDING UTILITY ───────────────────────────── */
.section-pad {
  padding-block: clamp(5rem, 10vw, 9rem);
}
.section-pad-sm {
  padding-block: clamp(3rem, 6vw, 5rem);
}
.gutter {
  padding-inline: clamp(1.5rem, 5vw, 5rem);
}

/* ─── ANIMATED FILM GRAIN ────────────────────────────────── */
@keyframes grain {
  0%,100% { transform: translate(0,    0);    }
  10%     { transform: translate(-5%,  -10%); }
  20%     { transform: translate(-15%, 5%);   }
  30%     { transform: translate(7%,  -25%);  }
  40%     { transform: translate(-5%,  25%);  }
  50%     { transform: translate(-15%, 10%);  }
  60%     { transform: translate(15%,  0);    }
  70%     { transform: translate(0,    15%);  }
  80%     { transform: translate(3%,   35%);  }
  90%     { transform: translate(-10%, 10%);  }
}
/* grain animation removed — steps(1) caused visible flicker on dark sections */

/* ─── PAGE TRANSITION — starts covering the page ────────── */

/* ─── CARAMEL BREAK ─────────────────────────────────────── */
/* Full-bleed atmospheric sunset image used as visual intermezzo */
.caramel-break {
  height: clamp(220px, 30vh, 380px);
  overflow: hidden;
  position: relative;
}
.caramel-break img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 55%;
  display: block;
}
/* No veil overlay — the caramel images are naturally dark at their edges */

/* ─── READING PROGRESS BAR ───────────────────────────────── */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 1px;
  background: var(--gold);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 2000;
  pointer-events: none;
  will-change: transform;
}

/* ─── HOUSE CARD 3D ──────────────────────────────────────── */
.house-card {
  transform-style: preserve-3d;
  will-change: transform;
}

/* ─── MARQUEE ────────────────────────────────────────────── */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 0;
  display: flex;
  align-items: center;
}
.marquee__track {
  display: inline-flex;
  flex-shrink: 0;
  white-space: nowrap;
  will-change: transform;
}
.marquee__item {
  display: inline-block;
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-mid);
  padding: 0 2.5rem;
  flex-shrink: 0;
}
.marquee__sep {
  color: var(--accent);
  margin: 0 0.4rem;
  opacity: 0.6;
}

/* ─── LOADING SCREEN ─────────────────────────────────────── */
.loader {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: clamp(2rem, 4vw, 4rem);
}
.loader__logo {
  font-family: var(--f-display);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 300;
  color: #ede4d5;
  letter-spacing: -0.01em;
  opacity: 0;
  padding-bottom: 0.2rem;
}
.loader__logo em { font-style: italic; color: var(--gold); }
.loader__count {
  font-family: var(--f-display);
  font-size: clamp(5rem, 16vw, 14rem);
  font-weight: 300;
  color: rgba(237,228,213,0.07);
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
  text-align: right;
  user-select: none;
}
.loader__bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 1px;
  background: var(--gold);
  width: 0;
  opacity: 0.5;
}

/* ─── PINNED FILM STRIP GALLERY ─────────────────────────── */
.filmstrip-pin {
  overflow: hidden;
  height: 88vh;
  width: 100%;
}

.filmstrip-active {
  display: flex !important;
  flex-wrap: nowrap !important;
  width: max-content !important;
  height: 88vh !important;
  grid-template-columns: none !important;
  gap: 3px !important;
  will-change: transform;
}

.filmstrip-active .filmstrip-frame,
.filmstrip-active .photo-item,
.filmstrip-active .essay-trio__item {
  width: 62vw !important;
  height: 88vh !important;
  flex-shrink: 0 !important;
  overflow: hidden !important;
}

.filmstrip-img {
  width: 125% !important;
  height: 100% !important;
  object-fit: cover !important;
  margin-left: -12.5% !important;
  will-change: transform;
}

/* Frame number counter on each strip item */
.filmstrip-active .filmstrip-frame::before,
.filmstrip-active .photo-item::before {
  content: attr(data-index);
  position: absolute;
  top: 1.2rem;
  left: 1.4rem;
  font-size: 0.55rem;
  letter-spacing: 0.22em;
  color: rgba(237,228,213,0.35);
  text-transform: uppercase;
  z-index: 3;
  pointer-events: none;
}

/* ─── IMAGE TOOLTIP (editorial hover preview) ────────────── */
.img-tooltip {
  position: fixed;
  width: 280px;
  aspect-ratio: 4 / 3;
  pointer-events: none;
  z-index: 800;
  overflow: hidden;
  box-shadow: 0 24px 72px rgba(26,18,9,0.4);
}
.img-tooltip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── NEXT HOUSE LINK ────────────────────────────────────── */
.next-house {
  display: grid;
  grid-template-columns: 50vw 1fr;
  min-height: 50vh;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.next-house__photo {
  overflow: hidden;
}
.next-house__photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  transition: transform 1.2s var(--ease-out);
  will-change: transform;
}
.next-house:hover .next-house__photo img { transform: scale(1.0); }
.next-house__content {
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(3rem, 6vw, 6rem);
  gap: 1rem;
}
.next-house__label {
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--stone);
  opacity: 0.5;
}
.next-house__name {
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 300;
  color: #ede4d5;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.next-house__cta {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
  transition: gap 0.3s var(--ease-out);
}
.next-house:hover .next-house__cta { gap: 1.2rem; }
