/* ═══════════════════════════════════════════════════════════════
   TIGA Kontraktor — immersive one-page experience
   Ivory museum platform · scroll-driven cinematic hero
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* matched to the hero video's own background so the feather mask vanishes */
  --ivory: #f5ede4;
  --ivory-deep: #eee3d6;
  --ink: #1f1b16;
  --ink-soft: rgba(31, 27, 22, 0.62);
  --ink-faint: rgba(31, 27, 22, 0.34);
  --bronze: #8c6f4e;
  --hairline: rgba(31, 27, 22, 0.14);

  --serif: "Fraunces", "Georgia", serif;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;

  /* PRD safe-area: video 65–72vw × 60–70vh, generous negative space */
  --exhibit-w: min(68vw, 1180px);
  --exhibit-h: 65vh;
  --gutter-x: clamp(28px, 6vw, 96px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden; /* the page never scrolls — scroll drives the timeline */
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body { opacity: 0; transition: opacity 1.1s ease; }
body.is-ready { opacity: 1; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ══════════════════════ PRELOADER ══════════════════════ */

.loader {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--ivory);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  transition: opacity 0.9s ease, visibility 0.9s ease;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__mark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: 0.22em;
}
.loader__bar {
  width: min(240px, 56vw);
  height: 1px;
  background: var(--hairline);
  overflow: hidden;
}
.loader__fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.loader__pct {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* ══════════════════════ STAGE ══════════════════════ */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* ── the museum exhibit ── */

.exhibit {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  width: var(--exhibit-w);
  height: var(--exhibit-h);
  pointer-events: none;
}

/* whisper of depth — never a card */
.exhibit__shadow {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -4%;
  height: 22%;
  background: radial-gradient(ellipse at center, rgba(31, 27, 22, 0.08), transparent 70%);
  filter: blur(48px);
}

/* two nested one-axis masks compose a soft feather on all four edges,
   so the ivory video melts into the ivory page — no visible rectangle */
.exhibit__mask-x,
.exhibit__mask-y {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.exhibit__mask-x {
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 14%, #000 86%, transparent 100%);
          mask-image: linear-gradient(to right, transparent 0%, #000 14%, #000 86%, transparent 100%);
}
.exhibit__mask-y {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 12%, #000 88%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 12%, #000 88%, transparent 100%);
}

.exhibit__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ══════════════════════ TOP BAR ══════════════════════ */

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(20px, 3.4vh, 38px) var(--gutter-x);
  z-index: 20;
}

.topbar__brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.topbar__mark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: 0.14em;
}
.topbar__sub {
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.topbar__nav { display: flex; gap: clamp(18px, 2.6vw, 44px); }

.navlink {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 6px 2px;
  position: relative;
  transition: color 0.35s ease;
}
.navlink::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.navlink:hover { color: var(--ink); }
.navlink:hover::after { transform: scaleX(1); }

.topbar__cta {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  padding: 13px 26px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  transition: background 0.4s ease, color 0.4s ease;
}
.topbar__cta:hover { background: var(--ink); color: var(--ivory); }

.topbar__menu {
  display: none;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ══════════════════════ PROGRESS RAIL ══════════════════════ */

.rail {
  position: absolute;
  left: var(--gutter-x);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 15;
}
.rail__pct {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.rail__track {
  position: relative;
  width: 1px;
  height: 26vh;
  background: var(--hairline);
  overflow: hidden;
}
.rail__fill {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: top;
}
.rail__label {
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
  writing-mode: vertical-rl;
}

/* ══════════════════════ PHASE INDEX ══════════════════════ */

.phases {
  position: absolute;
  right: var(--gutter-x);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 15;
}
.phase-dot {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  transition: color 0.5s ease;
  padding: 4px 6px;
  position: relative;
}
.phase-dot::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 14px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.phase-dot:hover { color: var(--ink); }
.phase-dot:hover::before { transform: scaleX(1); }
.phase-dot.is-active { color: var(--ink); }

/* ══════════════════════ SCROLL COPY ══════════════════════ */

.copy {
  position: absolute;
  left: var(--gutter-x);
  bottom: clamp(72px, 13vh, 132px);
  z-index: 15;
  max-width: min(46vw, 620px);
  pointer-events: none;
}
.copy__stack { position: relative; min-height: clamp(90px, 16vh, 180px); }
.copy__item {
  position: absolute;
  left: 0;
  bottom: 0;
  opacity: 0; /* opacity only — no sliding, per PRD */
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(26px, 3.4vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--ink);
  will-change: opacity;
}
h1.copy__item { font-weight: 400; }

/* ══════════════════════ BASELINE ══════════════════════ */

.baseline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 var(--gutter-x) clamp(18px, 3.2vh, 34px);
  z-index: 15;
  pointer-events: none;
}
.baseline__note {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.baseline__hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: opacity 1s ease;
}
.baseline__hint.is-hidden { opacity: 0; }
.baseline__line {
  width: 1px;
  height: 34px;
  background: var(--ink-soft);
  overflow: hidden;
  position: relative;
}
.baseline__line::after {
  content: "";
  position: absolute;
  left: 0;
  top: -100%;
  width: 100%;
  height: 100%;
  background: var(--ivory);
  animation: hint-drop 2.2s ease-in-out infinite;
}
@keyframes hint-drop {
  0% { top: -100%; }
  60%, 100% { top: 100%; }
}

/* ══════════════════════ AMBIENCE TOGGLE ══════════════════════ */

.sound {
  position: absolute;
  right: var(--gutter-x);
  bottom: clamp(64px, 11vh, 104px);
  width: 44px;
  height: 44px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5px;
  z-index: 25;
  transition: border-color 0.35s ease, background 0.35s ease;
}
.sound:hover { border-color: var(--ink); }
.sound__bar {
  width: 1.5px;
  height: 5px;
  background: var(--ink-soft);
  border-radius: 1px;
  transition: background 0.35s ease;
}
.sound.is-on .sound__bar { background: var(--ink); }
.sound.is-on .sound__bar { animation: sound-eq 1.15s ease-in-out infinite; }
.sound.is-on .sound__bar:nth-child(1) { animation-delay: 0s; }
.sound.is-on .sound__bar:nth-child(2) { animation-delay: 0.28s; }
.sound.is-on .sound__bar:nth-child(3) { animation-delay: 0.55s; }
.sound.is-on .sound__bar:nth-child(4) { animation-delay: 0.82s; }
@keyframes sound-eq {
  0%, 100% { height: 5px; }
  50% { height: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .sound.is-on .sound__bar { animation: none; height: 12px; }
}

/* ══════════════════════ PANELS ══════════════════════ */

.panels {
  position: fixed;
  inset: 0;
  z-index: 40;
  visibility: hidden;
  pointer-events: none;
}
.panels.is-open { visibility: visible; pointer-events: auto; }

.panel {
  position: absolute;
  inset: 0;
  background: var(--ivory);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.6s ease;
  display: none;
}
.panel.is-active { display: block; }
.panel.is-visible { opacity: 1; }

.panel__inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: clamp(96px, 16vh, 170px) var(--gutter-x) 120px;
}
.panel__kicker {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--bronze);
  margin-bottom: 28px;
}
.panel__title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(38px, 5.6vw, 76px);
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin-bottom: clamp(40px, 7vh, 72px);
}
.panel__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 4vw, 64px);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-soft);
  max-width: 900px;
}

/* stats */
.stats {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: clamp(48px, 8vh, 84px);
  padding-top: 40px;
  border-top: 1px solid var(--hairline);
}
.stats strong {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 3vw, 44px);
  margin-bottom: 8px;
}
.stats span {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* services */
.services { list-style: none; border-top: 1px solid var(--hairline); }
.services li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 24px;
  padding: 34px 0;
  border-bottom: 1px solid var(--hairline);
}
.services__num {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--bronze);
  padding-top: 6px;
}
.services h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(20px, 2.2vw, 28px);
  margin-bottom: 10px;
}
.services p { font-size: 15px; line-height: 1.7; color: var(--ink-soft); max-width: 560px; }

/* projects */
.projects { list-style: none; border-top: 1px solid var(--hairline); }
.projects li {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: baseline;
  gap: 24px;
  padding: 30px 0;
  border-bottom: 1px solid var(--hairline);
}
.projects__year { font-size: 12px; letter-spacing: 0.18em; color: var(--ink-faint); }
.projects h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(20px, 2.2vw, 28px);
  margin-bottom: 6px;
}
.projects p { font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); }
.projects__tag {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bronze);
  white-space: nowrap;
}

/* gallery */
.panel__kicker--section {
  margin-top: clamp(56px, 9vh, 96px);
  padding-top: 40px;
  border-top: 1px solid var(--hairline);
  margin-bottom: 34px;
}
.gallery__lead {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 520px;
  margin-bottom: 36px;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-flow: dense;
  gap: 14px;
}
.gallery__item {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--ivory-deep);
  /* scroll-in reveal */
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.gallery__item.is-in { opacity: 1; transform: none; }
/* editorial mosaic: every 7th photo becomes a 2×2 feature */
.gallery__item:nth-child(7n + 1) {
  grid-column: span 2;
  grid-row: span 2;
  aspect-ratio: auto;
}
.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.gallery__item:hover img { transform: scale(1.05); }
/* soft scrim that lifts on hover */
.gallery__item::after {
  content: "";
  position: absolute;
  inset: 55% 0 0 0;
  background: linear-gradient(to top, rgba(31, 27, 22, 0.42), transparent);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.gallery__item:hover::after { opacity: 1; }
.gallery__num {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 1;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 6px rgba(31, 27, 22, 0.5);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: none;
}
.gallery__item:hover .gallery__num { opacity: 1; transform: none; }

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(31, 27, 22, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 5vh, 60px) clamp(64px, 9vw, 130px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s ease;
  cursor: zoom-out;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.4);
}
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: 1px solid rgba(246, 243, 238, 0.32);
  border-radius: 50%;
  color: rgba(246, 243, 238, 0.9);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.lightbox__nav:hover { border-color: rgba(246, 243, 238, 0.9); background: rgba(246, 243, 238, 0.08); }
.lightbox__nav--prev { left: clamp(14px, 3vw, 40px); }
.lightbox__nav--next { right: clamp(14px, 3vw, 40px); }
.lightbox__counter {
  position: absolute;
  bottom: clamp(16px, 3.4vh, 32px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: rgba(246, 243, 238, 0.7);
  font-variant-numeric: tabular-nums;
}

/* contact */
.contact__row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}
.contact__row span {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-top: 3px;
}
.contact__row a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--hairline); }
.contact__row a:hover { border-color: var(--ink); }

/* big mobile nav */
.bignav { display: flex; flex-direction: column; gap: 8px; padding-top: 6vh; }
.bignav__link {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(40px, 9vw, 72px);
  text-align: left;
  padding: 10px 0;
  color: var(--ink);
  transition: color 0.3s ease;
}
.bignav__link:hover { color: var(--bronze); }

/* close */
.panels__close {
  position: fixed;
  top: clamp(18px, 3vh, 32px);
  right: var(--gutter-x);
  width: 46px;
  height: 46px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  z-index: 50;
  transition: border-color 0.3s ease, transform 0.3s ease;
}
.panels__close:hover { border-color: var(--ink); transform: rotate(90deg); }
.panels__close span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 1px;
  background: var(--ink);
}
.panels__close span:first-child { transform: translate(-50%, -50%) rotate(45deg); }
.panels__close span:last-child { transform: translate(-50%, -50%) rotate(-45deg); }

/* ══════════════════════ RESPONSIVE ══════════════════════ */

@media (max-width: 900px) {
  :root {
    --exhibit-w: 94vw;
    --exhibit-h: 54vh;
    --gutter-x: 22px;
  }
  .topbar__nav, .topbar__cta { display: none; }
  .topbar__menu { display: block; }
  .rail { display: none; }
  .phases { display: none; }
  .copy { max-width: 86vw; bottom: 104px; }
  .exhibit { transform: translate(-50%, -56%); }
  .baseline { justify-content: center; }
  .baseline__note { display: none; }
  .panel__cols { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .services li { grid-template-columns: 48px 1fr; }
  .projects li { grid-template-columns: 60px 1fr; }
  .projects__tag { display: none; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .lightbox { padding: 16px 12px 64px; }
  .lightbox__nav { width: 42px; height: 42px; top: auto; bottom: 12px; transform: none; }
  .sound { bottom: 18px; width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .baseline__line::after { animation: none; }
}
