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

:root {
  --paper: #eee8df;
  --ink: #1b1815;
  --muted: #857c71;
  --clay: #a4502a;
  --kiln: #13110f;
  --bone: #ede6da;
  --ash: #776f65;
  --rule: rgba(237, 230, 218, 0.12);
  --pad: clamp(1.25rem, 3vw, 2.5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html.lenis,
html.lenis body {
  height: auto;
}

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

::-webkit-scrollbar {
  display: none;
}

html {
  scrollbar-width: none;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

a {
  color: inherit;
  text-decoration: none;
}

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

h1,
h2,
h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 300;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.025em;
  line-height: 0.98;
}

em {
  font-style: italic;
  color: var(--clay);
}

.eyebrow,
.scroll-cue,
figcaption span,
.stage-index,
.clock,
.footer-base,
.nav-links {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 1px solid var(--clay);
  outline-offset: 4px;
}

/* ─────────── Nav ─────────── */

.nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.logo {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.logo span {
  margin-left: 0.3em;
  font-size: 0.8em;
  color: var(--clay);
}

.nav-links {
  display: flex;
  gap: clamp(1rem, 2.4vw, 2rem);
}

.nav-links a {
  transition: color 0.3s var(--ease);
}

.nav-links a:hover {
  color: var(--clay);
}

/* ─────────── Intro ─────────── */

.intro {
  min-height: 100svh;
  padding: calc(var(--pad) * 3.2) var(--pad) var(--pad);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 1.25rem;
  align-items: end;
}

.intro-copy {
  grid-column: 1 / 7;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 1rem;
}

.intro h1 {
  font-size: clamp(3rem, 7.4vw, 7.6rem);
}

.intro h1 em {
  display: block;
}

.lede {
  max-width: 30rem;
  font-size: clamp(1rem, 1.2vw, 1.12rem);
  line-height: 1.45;
  color: #4b443d;
}

.scroll-cue {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
}

.scroll-cue span {
  position: relative;
  width: 3rem;
  height: 1px;
  background: rgba(27, 24, 21, 0.18);
  overflow: hidden;
}

.scroll-cue span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: translateX(-100%);
  animation: cue 2.4s var(--ease) infinite;
}

@keyframes cue {
  60%,
  100% {
    transform: translateX(100%);
  }
}

.intro-photo {
  grid-column: 8 / 13;
}

.frame {
  overflow: hidden;
  border-radius: 2px;
  background: #ddd5ca;
}

.intro-photo .frame {
  aspect-ratio: 4 / 5;
  max-height: 78svh;
  margin-left: auto;
}

figcaption {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

figcaption span {
  margin-right: 0.75rem;
  color: var(--ink);
}

/* ─────────── Pieces ─────────── */

.pieces {
  padding: calc(var(--pad) * 2.5) var(--pad) calc(var(--pad) * 3);
}

.pieces-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(27, 24, 21, 0.12);
}

.pieces-head h2 {
  font-size: clamp(2rem, 4vw, 3.8rem);
  max-width: 14ch;
  text-align: right;
}

.pieces-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.piece .frame {
  aspect-ratio: 3 / 4;
}

.piece .frame img {
  transition: transform 1.2s var(--ease);
}

.piece:hover .frame img {
  transform: scale(1.04);
}

.piece figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.piece h3 {
  font-size: 1.35rem;
  color: var(--ink);
}

.piece:nth-child(2) {
  margin-top: 4rem;
}

.piece:nth-child(3) {
  margin-top: 8rem;
}

/* Page reveals */
[data-reveal] {
  opacity: 0;
  transform: translateY(2.5rem);
  transition: opacity 1s var(--ease), transform 1.2s var(--ease);
  transition-delay: calc(var(--d, 0) * 110ms);
}

[data-reveal] .frame {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.3s var(--ease);
  transition-delay: calc(var(--d, 0) * 110ms + 80ms);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

[data-reveal].is-in .frame {
  clip-path: inset(0 0 0 0);
}

/* ─────────── Footer ─────────── */

.footer {
  position: relative;
  background: var(--kiln);
  color: var(--bone);
  overflow: hidden;
}

.footer-inner {
  position: relative;
  min-height: 100svh;
  padding: calc(var(--pad) * 1.6) var(--pad) var(--pad);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto 1fr auto;
  column-gap: 1.25rem;
  row-gap: 2.5rem;
  will-change: transform;
}

.footer-head {
  grid-column: 1 / 8;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.footer-head .eyebrow {
  color: var(--ash);
}

.footer-title {
  font-size: clamp(2.6rem, 5.6vw, 6.2rem);
  max-width: 11ch;
}

/* Vessel stage */
.stage {
  grid-column: 8 / 13;
  grid-row: 1 / 3;
  position: relative;
  min-height: 26rem;
  display: flex;
  flex-direction: column;
}

.stage canvas {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: block;
  cursor: grab;
  touch-action: pan-y;
}

.stage canvas.is-dragging {
  cursor: grabbing;
}

.stage-fallback {
  display: none;
  flex: 1;
  min-height: 0;
  border-radius: 2px;
}

.no-webgl .stage canvas {
  display: none;
}

.no-webgl .stage-fallback {
  display: block;
}

.stage-caption {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.stage-index {
  color: var(--ash);
  font-variant-numeric: tabular-nums;
}

.stage-name {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  transition: opacity 0.35s var(--ease), transform 0.5s var(--ease);
}

.stage-name.is-swapping {
  opacity: 0;
  transform: translateY(0.4rem);
}

.stage-name span {
  margin-left: 0.6rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.82rem;
  color: var(--ash);
  letter-spacing: 0;
}

.stage-controls {
  display: flex;
  gap: 0.4rem;
}

.stage-controls button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--rule);
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.stage-controls button:hover {
  background: var(--bone);
  border-color: var(--bone);
  color: var(--kiln);
}

/* Columns */
.footer-cols {
  grid-column: 1 / 8;
  grid-row: 2;
  align-self: end;
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr;
  gap: 2rem;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #b9b1a5;
}

.col h4 {
  margin-bottom: 0.6rem;
  font-family: "DM Mono", ui-monospace, monospace;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ash);
}

.clock {
  margin-top: 0.4rem;
  color: var(--ash);
}

.clock span {
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}

.links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.links li {
  overflow: hidden;
}

.roll {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.3rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--bone);
}

.roll span {
  position: relative;
  display: inline-block;
  transition: transform 0.6s var(--ease);
}

.roll span::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 100%;
  font-style: italic;
  color: #d9895f;
}

.roll:hover span,
.roll:focus-visible span {
  transform: translateY(-100%);
}

.news {
  margin-top: 0.6rem;
  display: flex;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.3s var(--ease);
}

.news:focus-within {
  border-color: var(--bone);
}

.news input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0;
  font: inherit;
  font-size: 1rem;
  color: var(--bone);
  background: none;
  border: 0;
  outline: none;
}

.news input::placeholder {
  color: #5c554c;
}

.news button {
  padding: 0 0.25rem 0 1rem;
  font-size: 1.1rem;
  transition: transform 0.4s var(--ease);
}

.news button:hover {
  transform: translateX(4px);
}

.news.is-invalid {
  border-color: #d9895f;
}

.news-note {
  min-height: 1.3em;
  font-size: 0.8rem;
  color: #d9895f;
}

.news-note.is-ok {
  color: var(--bone);
}

/* Base row */
.footer-base {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--ash);
}

.to-top {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--bone);
  transition: color 0.3s var(--ease);
}

.to-top:hover {
  color: #d9895f;
}

/* Footer reveals — lines rise from a mask, blocks lift */
[data-lines] .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

[data-lines] .line > span {
  display: block;
  transform: translateY(110%);
  transition: transform 1.1s var(--ease);
  transition-delay: calc(var(--i, 0) * 55ms);
}

.footer.is-in [data-lines] .line > span {
  transform: none;
}

[data-rise] {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.9s var(--ease), transform 1.1s var(--ease);
  transition-delay: calc(var(--i, 0) * 55ms);
}

.footer.is-in [data-rise] {
  opacity: 1;
  transform: none;
}

/* ─────────── Responsive ─────────── */

@media (max-width: 900px) {
  .intro {
    grid-template-columns: 1fr;
    row-gap: 2.5rem;
    align-items: start;
  }

  .intro-copy,
  .intro-photo {
    grid-column: 1;
  }

  .intro-photo .frame {
    max-height: none;
  }

  .pieces-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .pieces-head h2 {
    text-align: left;
  }

  .pieces-grid {
    grid-template-columns: 1fr 1fr;
  }

  .piece:nth-child(2) {
    margin-top: 3rem;
  }

  .piece:nth-child(3) {
    margin-top: 0;
    grid-column: 1 / -1;
  }

  .piece:nth-child(3) .frame {
    aspect-ratio: 16 / 10;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    row-gap: 2rem;
  }

  .footer-head,
  .stage,
  .footer-cols,
  .footer-base {
    grid-column: 1;
    grid-row: auto;
  }

  .stage {
    min-height: 0;
    height: min(110vw, 32rem);
  }

  .footer-cols {
    grid-template-columns: 1fr 1fr;
    gap: 2rem 1.25rem;
  }

  .col-news {
    grid-column: 1 / -1;
  }

  .footer-title {
    font-size: clamp(2.6rem, 8.5vw, 4.6rem);
  }
}

@media (max-width: 560px) {
  .nav-links a:not(:last-child) {
    display: none;
  }

  .pieces-grid {
    gap: 0.75rem;
  }

  .piece h3 {
    font-size: 1.1rem;
  }

  .piece figcaption {
    flex-direction: column;
    gap: 0.15rem;
  }

  .roll {
    font-size: 1.12rem;
  }

  .stage-name span {
    display: block;
    margin: 0.2rem 0 0;
  }

  .base-mid {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-reveal] .frame,
  [data-lines] .line > span,
  [data-rise] {
    transition: none !important;
  }

  .scroll-cue span::after {
    animation: none;
  }
}

/* A faint pool of light behind the vessel */
.stage::before {
  content: "";
  position: absolute;
  inset: 0 0 4rem;
  background: radial-gradient(closest-side, rgba(237, 222, 196, 0.075), transparent 75%);
  pointer-events: none;
}
