:root {
  --hudson-slate: #2c3539;
  --river-mist: #e5e8e8;
  --lowland-moss: #4a5d4e;
  --clay-timber: #a89f91;
  --iron-forge: #1a1a1a;
  --font-sans: Arial, Helvetica, sans-serif;
  --font-logo: "EB Garamond", Garamond, Georgia, serif;
  --font-logo-decorative: "EB Garamond", Garamond, Georgia, serif;
  --logo-tracking: 0.04em;
  --logo-r-gap: 0.11em;
  --logo-amp-pad: 0.24em;
  --logo-size: clamp(3rem, 9.75vw, 5.25rem);
  --logo-size-half: clamp(1.5rem, 4.875vw, 2.625rem);
  --contact-icon-size: clamp(1.625rem, 5vw, 2rem);
  --pad-x: clamp(1.25rem, 4vw, 3rem);
  --pad-y: clamp(1.25rem, 3.5vh, 2.5rem);
  --footer-gap: clamp(1.5rem, 4vh, 3rem);
  --ui-opacity: 0.75;
  --footer-band: calc(
    var(--contact-icon-size) +
    max(var(--pad-y), env(safe-area-inset-bottom, 0px)) +
    clamp(0.5rem, 1.5vh, 0.875rem)
  );
  --center-y: calc(
    env(safe-area-inset-top, 0px) +
    (
      100svh -
      env(safe-area-inset-top, 0px) -
      env(safe-area-inset-bottom, 0px) -
      var(--footer-band)
    ) / 2
  );
  --dock-top: calc(env(safe-area-inset-top, 0px) + clamp(3.25rem, 10vh, 5.5rem));
  --dock-ease: cubic-bezier(0.65, 0, 0.35, 1);
  --dock-duration: 1.3s;
}

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

html,
body {
  height: 100%;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  background: var(--iron-forge);
  color: var(--river-mist);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

.stage {
  position: relative;
  width: 100%;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
}

.bg-media {
  position: absolute;
  inset: 0;
  background: var(--hudson-slate) center / cover no-repeat;
  filter: saturate(0.82) sepia(0.16) brightness(0.88);
  pointer-events: none;
  touch-action: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  background: var(--hudson-slate);
  pointer-events: none;
  touch-action: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Fully transparent during the logo stage; faded in via JS from stage 2 on.
   Gradient alphas are slightly stronger than v1 since they arrive gradually. */
.overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(28, 22, 18, 0.4), rgba(28, 22, 18, 0.4)),
    radial-gradient(
      ellipse 120% 90% at 50% 50%,
      transparent 38%,
      rgba(22, 18, 14, 0.52) 100%
    ),
    linear-gradient(
      180deg,
      rgba(22, 18, 14, 0.42) 0%,
      transparent 24%,
      transparent 72%,
      rgba(22, 18, 14, 0.48) 100%
    );
  opacity: 0;
  pointer-events: none;
}

.center {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* ---- Brand (stage 1 center -> stage 2+ docked top) ---- */

.brand {
  position: absolute;
  top: var(--center-y);
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  padding: 0 var(--pad-x);
  text-align: center;
  min-width: 0;
  overflow: visible;
  transition: top var(--dock-duration) var(--dock-ease);
}

.is-docked .brand {
  top: var(--dock-top);
}

.brand-name {
  font-family: var(--font-logo);
  font-size: var(--logo-size);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  color: #fff;
  opacity: var(--ui-opacity);
  text-shadow: 0 2px 28px rgba(26, 26, 26, 0.55);
  overflow: visible;
  font-kerning: normal;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  transition: font-size var(--dock-duration) var(--dock-ease);
}

.is-docked .brand-name {
  font-size: calc(var(--logo-size) * 0.46);
}

.brand-word {
  letter-spacing: var(--logo-tracking);
}

.brand-leading {
  font-family: var(--font-logo-decorative);
  letter-spacing: 0;
  margin-right: var(--logo-r-gap);
}

.brand-amp {
  letter-spacing: 0;
  padding: 0 var(--logo-amp-pad);
}

.tagline {
  font-family: var(--font-logo);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1rem, 1.9vw, 1.375rem);
  letter-spacing: 0.03em;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 16px rgba(26, 26, 26, 0.55);
  margin-top: clamp(1rem, 2.4vh, 1.5rem);
  opacity: 0;
  visibility: hidden;
  transition:
    font-size var(--dock-duration) var(--dock-ease),
    margin-top var(--dock-duration) var(--dock-ease);
}

.is-docked .tagline {
  font-size: clamp(0.75rem, 1.15vw, 0.9375rem);
  margin-top: clamp(0.5rem, 1.3vh, 0.75rem);
}

/* ---- Stage 2: poem ---- */

.poem {
  position: absolute;
  top: var(--center-y);
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(calc(100% - 2 * var(--pad-x)), 46rem);
  text-align: center;
  visibility: hidden;
}

.poem-text {
  font-family: var(--font-logo);
  font-weight: 500;
  font-size: clamp(1.1875rem, 2.5vw, 1.875rem);
  line-height: 1.55;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 1px 18px rgba(26, 26, 26, 0.6);
}

.poem-word {
  display: inline-block;
  opacity: 0;
  will-change: opacity, transform;
}

/* ---- Stage 3: pillars ---- */

.pillars {
  position: absolute;
  top: var(--center-y);
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(calc(100% - 2 * var(--pad-x)), 46rem);
  text-align: center;
  visibility: hidden;
  pointer-events: auto;
}

.pillar-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.75rem, 2vh, 1.25rem);
}

.pillar-list li {
  opacity: 0;
}

.pillar {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-logo);
  font-weight: 500;
  font-size: clamp(1.375rem, 3.1vw, 2.25rem);
  letter-spacing: 0.03em;
  line-height: 1.2;
  color: #fff;
  opacity: 0.5;
  text-shadow: 0 1px 18px rgba(26, 26, 26, 0.6);
  transition: opacity 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.pillar:hover,
.pillar:focus-visible,
.pillar.is-active {
  opacity: 0.95;
}

.pillar:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.45);
  outline-offset: 6px;
}

.pillar-info {
  height: 0;
  opacity: 0;
  overflow: hidden;
}

.pillar-info-text {
  font-family: var(--font-sans);
  font-size: clamp(0.875rem, 1.4vw, 1.0625rem);
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.68);
  text-shadow: 0 1px 12px rgba(26, 26, 26, 0.55);
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(0.625rem, 1.6vh, 1rem) 0 clamp(0.25rem, 0.8vh, 0.5rem);
}

/* Detail for desktop/landscape (horizontal pillars) — absolutely positioned
   below the row and anchored under the active pillar's title, so the row
   itself stays vertically centered and the copy reads as belonging to it. */
.pillar-detail {
  display: none;
  opacity: 0;
  position: absolute;
  top: calc(100% + clamp(1rem, 2.6vh, 1.75rem));
  left: 0;
  width: min(26rem, 100%);
}

.pillar-detail-text {
  font-family: var(--font-sans);
  font-size: clamp(0.875rem, 1.4vw, 1.0625rem);
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.68);
  text-shadow: 0 1px 12px rgba(26, 26, 26, 0.55);
  text-align: center;
}

@media (min-width: 768px) and (orientation: landscape) {
  .pillars {
    width: min(calc(100% - 2 * var(--pad-x)), 64rem);
  }

  .pillar-list {
    flex-direction: row;
    justify-content: center;
    align-items: baseline;
    gap: clamp(1.75rem, 4.5vw, 4rem);
  }

  .pillar {
    font-size: clamp(1.25rem, 2.1vw, 1.75rem);
    white-space: nowrap;
  }

  .pillar-item .pillar-info {
    display: none;
  }

  .pillar-detail {
    display: block;
  }
}

/* ---- Progress (stage wait indicator) ---- */

.progress {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--footer-band) + clamp(0.75rem, 2.2vh, 1.5rem));
  width: min(40vw, 8.5rem);
  height: 1px;
  background: rgba(229, 232, 232, 0.16);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
}

.progress-fill {
  width: 100%;
  height: 100%;
  background: var(--clay-timber);
  opacity: 0.9;
  transform: scaleX(0);
  transform-origin: left center;
}

/* ---- Footer ---- */

.footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(0.5rem, 1.2vh, 0.75rem);
  padding:
    0
    var(--pad-x)
    max(var(--pad-y), env(safe-area-inset-bottom));
  pointer-events: none;
}

.footer .contact {
  pointer-events: auto;
}

.contact {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  color: #fff;
  opacity: var(--ui-opacity);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.contact::after {
  content: "";
  position: absolute;
  inset: -0.625rem;
}

.contact-icon {
  display: block;
  flex-shrink: 0;
  width: var(--contact-icon-size);
  height: var(--contact-icon-size);
  object-fit: contain;
  filter: brightness(0) invert(1);
  -webkit-user-drag: none;
  user-select: none;
  transition: transform 0.15s ease;
}

.contact:active .contact-icon {
  transform: scale(0.94);
}

@media (min-width: 768px) {
  .contact:hover,
  .contact:focus-visible {
    opacity: 0.9;
  }
}

.contact:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.45);
  outline-offset: 4px;
}

.copy-toast {
  font-family: var(--font-logo);
  font-size: clamp(0.6875rem, 1.05vw, 0.8125rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1;
  color: rgba(255, 255, 255, 0.62);
  text-shadow: 0 1px 12px rgba(26, 26, 26, 0.55);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.copy-toast[hidden] {
  display: none;
}

/* ---- Breakpoints ---- */

@media (min-width: 1024px) {
  :root {
    --pad-x: clamp(2rem, 5vw, 4rem);
    --pad-y: clamp(1.75rem, 4vh, 3rem);
    --logo-size: clamp(4.5rem, 6.75vw, 6rem);
    --logo-size-half: clamp(2.25rem, 3.375vw, 3rem);
  }
}

@media (max-width: 520px) {
  :root {
    --logo-size: clamp(2.8125rem, 12.75vw, 3.5625rem);
    --logo-size-half: clamp(1.40625rem, 6.375vw, 1.78125rem);
  }

  .poem-text {
    font-size: clamp(1.0625rem, 4.6vw, 1.25rem);
  }

  .pillar {
    font-size: clamp(1.25rem, 6vw, 1.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-video {
    display: none;
  }

  .progress {
    display: none;
  }

  .brand,
  .brand-name {
    transition: none;
  }

  .stage {
    background:
      linear-gradient(165deg, var(--hudson-slate) 0%, var(--iron-forge) 55%, var(--lowland-moss) 100%);
  }
}
