/* ============================================================================
   Layout — canvas, navigation, opening sequence, sections, footer
   ========================================================================== */

/* --- the stone --------------------------------------------------------- */
.gem-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  contain: strict;
}
.gem-stage canvas { width: 100%; height: 100%; }

.page { position: relative; z-index: 2; }

/* --- opening sequence -------------------------------------------------- */

/* the ivory sheet that hides the page until the stone has done its work */
.veil {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--ivory);
  transition: opacity 0.9s var(--ease-out);
}
.veil.is-lifting { opacity: 0; }
.veil[hidden], .intro-ui[hidden] { display: none; }

/* the stone is raised ABOVE the veil for the duration of the opening */
body.is-intro .gem-stage { z-index: 58; }

.intro-ui {
  position: fixed;
  inset: 0;
  z-index: 62;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: opacity 0.5s var(--ease-out);
}
.intro-ui.is-done { opacity: 0; }

.intro__logo {
  position: relative;
  width: min(46vw, 430px);
  /* lifted off centre so the stone can settle beneath the mark without ever
     crossing a glyph. No transform here: the hand-off to the navbar animates
     transform from none, and a base transform would make it jump. */
  margin-bottom: 15vh;
  color: var(--ink);
  transform-origin: center center;
  /* light travels left to right and the mark appears in its wake */
  -webkit-mask-image: linear-gradient(
    96deg,
    #000 0%, #000 var(--wipe, 0%),
    rgba(0, 0, 0, 0.16) calc(var(--wipe, 0%) + 7%),
    transparent calc(var(--wipe, 0%) + 15%));
  mask-image: linear-gradient(
    96deg,
    #000 0%, #000 var(--wipe, 0%),
    rgba(0, 0, 0, 0.16) calc(var(--wipe, 0%) + 7%),
    transparent calc(var(--wipe, 0%) + 15%));
}
.intro__logo svg { width: 100%; height: auto; }

/* the sheen that does the revealing */
.intro__sheen {
  position: absolute;
  top: -40%;
  bottom: -40%;
  width: 26%;
  left: calc(var(--wipe, 0%) - 13%);
  background: linear-gradient(100deg,
    transparent, rgba(255, 255, 255, 0.92) 46%, transparent);
  filter: blur(9px);
  opacity: var(--sheen, 0);
  pointer-events: none;
}

/* ============================================================================
   NAVIGATION

   Three tracks: 1fr | auto | 1fr. Because the flanking tracks are equal by
   construction, the bubble sits on the centre of the VIEWPORT rather than
   halfway between the mark and the button — which would shift every time
   either of them changed width, and is the usual reason a "centred" nav
   looks a few pixels off.
   ========================================================================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: clamp(0.7rem, 1.3vw, 1.1rem) var(--gutter);
  transition: background var(--med) var(--ease), border-color var(--med),
              padding var(--med) var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-stuck {
  background: rgba(250, 247, 242, 0.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom-color: var(--line);
  padding-top: 0.58rem;
  padding-bottom: 0.58rem;
}

.nav__brand {
  justify-self: start;
  display: block;
  width: clamp(104px, 11vw, 146px);
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
}
.nav__brand.is-shown { opacity: 1; }
.nav__brand svg { width: 100%; height: auto; }

/* --- the bubble -------------------------------------------------------- */
.nav__bubble {
  justify-self: center;
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  box-shadow:
    0 1px 2px rgba(21, 18, 15, 0.03),
    0 12px 28px -22px rgba(21, 18, 15, 0.4);
  backdrop-filter: saturate(150%) blur(13px);
  -webkit-backdrop-filter: saturate(150%) blur(13px);
  transition: border-color var(--med) var(--ease), background var(--med) var(--ease);
}
.nav.is-stuck .nav__bubble {
  background: rgba(255, 255, 255, 0.86);
  border-color: var(--line-firm);
}

/* One highlight that travels, rather than a rule appearing under each link.
   Position and width are written from layout, so it stays true through
   resizes and the font swap. */
.nav__thumb {
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 0;
  z-index: 0;
  border-radius: 100px;
  background: var(--ivory-2);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  opacity: 0;
  transition:
    transform 0.55s var(--ease-out),
    width 0.55s var(--ease-out),
    opacity 0.3s var(--ease);
  will-change: transform, width;
}

.nav__link {
  position: relative;
  z-index: 1;
  font-size: 0.78rem;
  letter-spacing: 0.012em;
  color: var(--ink-2);
  white-space: nowrap;
  padding: 0.48rem 0.86rem;
  border-radius: 100px;
  transition: color var(--fast) var(--ease);
}
.nav__link:hover { color: var(--ink); }
.nav__link.is-active { color: var(--ink); }

/* --- the right-hand end ------------------------------------------------ */
.nav__end {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav__contact {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.56rem 1.05rem;
  font-size: 0.72rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  border-radius: 100px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  transition: background var(--med) var(--ease), color var(--med) var(--ease),
              border-color var(--med) var(--ease);
}
.nav__contact:hover,
.nav__contact.is-on {
  background: transparent;
  color: var(--ink);
}
.nav__contact-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold-2);
  flex: none;
  transition: transform var(--med) var(--ease-out);
}
.nav__contact.is-on .nav__contact-dot { transform: scale(1.6); }

.nav__toggle {
  display: none;
  width: 42px; height: 42px;
  margin-right: -8px;
  position: relative;
}
.nav__toggle span {
  position: absolute;
  left: 10px; right: 10px;
  height: 1px;
  background: var(--ink);
  transition: transform var(--med) var(--ease), opacity var(--fast);
}
.nav__toggle span:nth-child(1) { top: 16px; }
.nav__toggle span:nth-child(2) { top: 22px; }
.nav__toggle span:nth-child(3) { top: 28px; }
.nav.is-open .nav__toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav.is-open .nav__toggle span:nth-child(2) { opacity: 0; }
.nav.is-open .nav__toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* --- sections ---------------------------------------------------------- */
.section {
  position: relative;
  padding: var(--section-y) var(--gutter);
}
.section__inner { max-width: var(--max); margin-inline: auto; }
.section--tint { background: linear-gradient(180deg, transparent, var(--ivory-2) 14%, var(--ivory-2) 86%, transparent); }

/* a pinned section supplies its own padding from inside the sticky frame */
.section--flush { padding: 0; }

/* --- hero -------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: clamp(7rem, 16vh, 11rem) var(--gutter) clamp(4rem, 10vh, 7rem);
}
.hero__inner {
  max-width: var(--max);
  margin-inline: auto;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
}
.hero__copy { display: grid; gap: clamp(1.4rem, 2.6vw, 2.1rem); max-width: 30rem; }
.hero__title { margin: 0; }
.hero__title .line { display: block; overflow: hidden; }
.hero__title .line > span {
  display: block;
  transform: translateY(102%);
  transition: transform 1.15s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.is-revealed .hero__title .line > span { transform: none; }

.hero__sub { display: grid; gap: 0.55rem; }
.hero__rule { width: 3.25rem; height: 1px; background: var(--gold); }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 0.4rem;
}
.hero__scroll {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(1.6rem, 4vh, 2.6rem);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.hero__scroll-line {
  width: 44px; height: 1px;
  background: var(--line-firm);
  position: relative;
  overflow: hidden;
}
.hero__scroll-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gold);
  transform-origin: left;
  animation: scrollhint 2.6s var(--ease) infinite;
}
@keyframes scrollhint {
  0%   { transform: scaleX(0); transform-origin: left; }
  45%  { transform: scaleX(1); transform-origin: left; }
  55%  { transform: scaleX(1); transform-origin: right; }
  100% { transform: scaleX(0); transform-origin: right; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__scroll-line::after { animation: none; transform: scaleX(0.5); }
  .hero__title .line > span { transform: none; }
}

/* --- footer ------------------------------------------------------------ */
.footer {
  position: relative;
  z-index: 2;
  background: var(--ivory-2);
  border-top: 1px solid var(--line);
  padding: clamp(3.25rem, 6vw, 5rem) var(--gutter) 2rem;
}
.footer__inner {
  max-width: var(--max);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 5vw, 4rem);
}
.footer__brand { display: grid; gap: 1.15rem; align-content: start; }
.footer__logo { width: clamp(142px, 16vw, 188px); color: var(--ink); }
.footer__col { display: grid; gap: 0.85rem; align-content: start; }
.footer__col h4 { margin-bottom: 0.15rem; }
.footer__list { display: grid; gap: 0.6rem; }
.footer__list a, .footer__list span { font-size: var(--t-small); color: var(--ink-2); }
.footer__list a { transition: color var(--fast) var(--ease); }
.footer__list a:hover { color: var(--gold); }

.footer__bottom {
  max-width: var(--max);
  margin: clamp(2.25rem, 4.5vw, 3.5rem) auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  justify-content: space-between;
  align-items: center;
}

/* ============================ responsive ================================= */
@media (max-width: 1140px) {
  .nav__link { font-size: 0.745rem; padding: 0.46rem 0.7rem; }
}

@media (max-width: 1040px) {
  .footer__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .footer__brand { grid-column: 1 / -1; }
}

/* Below this the bubble cannot hold five labels without crowding the mark,
   so it becomes a sheet — the same links, the same order, full width. */
@media (max-width: 1080px) {
  .nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  /* Both selectors, deliberately: the stuck-state rule above is three
     classes deep, so a plainer selector here would lose to it and the sheet
     would keep the bar's translucent background — with the page legible
     straight through the open menu. */
  .nav .nav__bubble,
  .nav.is-stuck .nav__bubble {
    /* justify-self must be released here. The bar carries a backdrop-filter
       when stuck, which makes IT the containing block for fixed children —
       and an out-of-flow box with justify-self:center is shrink-wrapped and
       centred inside its inset box, so left:0/right:0 stop filling and the
       sheet collapses to the width of its longest link. */
    justify-self: stretch;
    position: fixed;
    inset: 0 0 auto;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.1rem;
    padding: 5.6rem var(--gutter) 2.1rem;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: var(--ivory);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 18px 40px -30px rgba(21, 18, 15, 0.5);
    transform: translateY(-101%);
    transition: transform 0.5s var(--ease-out);
    z-index: -1;
  }
  .nav.is-open .nav__bubble { transform: none; }
  .nav__thumb { display: none; }
  .nav__link {
    font-size: 1.08rem;
    padding: 0.62rem 0.1rem;
    border-radius: 0;
  }
  .nav__toggle { display: block; }
}

@media (max-width: 820px) {
  .hero {
    min-height: 100svh;
    align-items: end;
    /* reserve the upper band for the stone so the headline never sits on it */
    padding-top: clamp(13rem, 44vh, 22rem);
    padding-bottom: clamp(2.5rem, 6vh, 4rem);
  }
  .hero__inner { grid-template-columns: minmax(0, 1fr); }
  .hero__copy { max-width: 100%; }
  .hero__scroll { position: static; margin-top: 2.25rem; }
}

@media (max-width: 460px) {
  .nav__contact { padding: 0.5rem 0.85rem; letter-spacing: 0.1em; }
}

/* anchored navigation must clear the fixed bar */
.section, .hero { scroll-margin-top: clamp(6.25rem, 8vw, 7.5rem); }
