:root {
  --ink:        #062a33;
  --ink-deep:   #031a21;
  --tint:       #2fd6c3;
  --tint-soft:  #7fe3d4;
  --gold:       #f4c26b;
  --sand:       #f2f7f7;

  --glass-bg:     linear-gradient(158deg, rgba(255,255,255,.11), rgba(255,255,255,.035));
  --glass-border: rgba(255,255,255,.17);

  --font-he: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-num: "Outfit", var(--font-he);

  --marker-shift: 50%;
  --boat-flip: 1;

  /* How far the heading and countdown ride above the progress bar.
     Applied as a negative margin on .head and cancelled by an equal
     positive margin on .journey: the two cancel, so the stage keeps its
     exact height and the journey bar and stats never move. Raise it to
     lift the top pair further. */
  --rise: clamp(.5rem, 20vh, 10em);

  /* written by script.js on every tick */
  --progress: 0;
}

html[dir="ltr"] {
  --marker-shift: -50%;
  --boat-flip: -1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--ink-deep);
  color: var(--sand);
  font-family: var(--font-he);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ─── hero ─────────────────────────────────────────────────── */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1rem, 4vw, 2.5rem);
  isolation: isolate;
  overflow: hidden;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-color: var(--ink);
  background-size: cover;
  background-position: 50% 45%;
}

.hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 1.1s ease;
  animation: kenburns 34s ease-in-out infinite alternate;
}

.hero__img.is-loaded { opacity: 1; }

@keyframes kenburns {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to   { transform: scale(1.13) translate3d(0, -1.2%, 0); }
}

.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 85% at 50% 42%, rgba(3,26,33,.42) 0%, rgba(3,26,33,.68) 55%, rgba(3,26,33,.88) 100%),
    linear-gradient(to bottom, rgba(3,26,33,.55) 0%, rgba(3,26,33,.18) 30%, rgba(3,26,33,.80) 100%);
}

/* warm golden light that grows as the retirement date approaches */
.hero__glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  mix-blend-mode: screen;
  pointer-events: none;
  background:
    radial-gradient(70% 50% at 72% 30%, rgba(244,194,107,.55) 0%, rgba(244,194,107,0) 70%),
    radial-gradient(90% 60% at 50% 88%, rgba(47,214,195,.35) 0%, rgba(47,214,195,0) 75%);
  opacity: calc(.12 + var(--progress) * .72);
  transition: opacity 1.6s ease;
}

/* ─── stage ────────────────────────────────────────────────── */

.stage {
  position: relative;
  width: 100%;
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.6rem, 3.4vh, 2.9rem);
  text-align: center;
}

.head {
  display: grid;
  gap: .55rem;
  margin-block-start: calc(var(--rise) * -1);
}

.title {
  margin: 0;
  font-size: clamp(2.1rem, 6.2vw, 4.6rem);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -.01em;
  color: #fff;
  text-shadow: 0 4px 40px rgba(3,26,33,.85), 0 1px 3px rgba(3,26,33,.6);
}

/* ─── countdown ────────────────────────────────────────────── */

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(.6rem, 1.6vw, 1.25rem);
  width: 100%;
}

.unit {
  position: relative;
  display: grid;
  gap: .45rem;
  place-items: center;
  padding: clamp(.9rem, 2.4vw, 1.6rem) clamp(.35rem, 1.2vw, 1rem);
  border: 1px solid var(--glass-border);
  border-radius: clamp(14px, 1.6vw, 22px);
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.22),
    0 18px 50px -20px rgba(3,26,33,.9);
  overflow: hidden;
}

/* soft light gliding across the glass */
.unit::after {
  content: "";
  position: absolute;
  top: 0;
  inset-inline-start: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,.16) 50%, rgba(255,255,255,0) 100%);
  animation: sweep 7.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sweep {
  0%,   62% { inset-inline-start: -60%; }
  100%     { inset-inline-start: 115%; }
}

.unit__value {
  display: flex;
  font-family: var(--font-num);
  font-weight: 200;
  font-size: clamp(2.1rem, 7.4vw, 4.6rem);
  line-height: 1;
  letter-spacing: -.02em;
  color: #fff;
  direction: ltr;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 34px rgba(127,227,212,.35);
}

.unit--accent .unit__value { color: var(--tint-soft); }

.unit__label {
  font-size: clamp(.72rem, 1.7vw, .92rem);
  font-weight: 400;
  letter-spacing: .06em;
  color: rgba(242,247,247,.82);
}

.digit {
  display: inline-block;
  will-change: transform, opacity;
}

.digit.is-tick { animation: digit-tick .44s cubic-bezier(.2,.85,.24,1); }

@keyframes digit-tick {
  from { transform: translateY(.22em); opacity: 0; filter: blur(2px); }
  to   { transform: none; opacity: 1; filter: none; }
}

/* ─── journey track ────────────────────────────────────────── */

.journey {
  width: min(100%, 780px);
  display: grid;
  gap: .7rem;
  margin-block-start: var(--rise);
}

.journey__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: clamp(.72rem, 1.6vw, .85rem);
  font-weight: 400;
  letter-spacing: .12em;
  color: rgba(242,247,247,.72);
}

.journey__pct {
  color: var(--gold);
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}

.journey__track {
  position: relative;
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}

.journey__fill {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: calc(var(--progress) * 100%);
  border-radius: inherit;
  background: linear-gradient(to left, var(--gold) 0%, var(--tint) 62%, var(--tint-soft) 100%);
  box-shadow: 0 0 18px rgba(47,214,195,.55);
  transition: width 1.1s cubic-bezier(.32,.72,.24,1);
}

.journey__boat {
  position: absolute;
  top: 50%;
  inset-inline-start: calc(var(--progress) * 100%);
  width: 44px;
  height: 35px;
  transform: translate(var(--marker-shift), -50%) scaleX(var(--boat-flip));
  transition: inset-inline-start 1.1s cubic-bezier(.32,.72,.24,1);
  filter: drop-shadow(0 5px 14px rgba(3,26,33,.75));
}

.journey__rig { animation: bob 3.6s ease-in-out infinite; transform-origin: 20px 24px; }

@keyframes bob {
  0%, 100% { transform: translateY(0)    rotate(0deg); }
  50%      { transform: translateY(-1.6px) rotate(-1.4deg); }
}

.journey__wake path {
  fill: none;
  stroke: rgba(255,255,255,.42);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.journey__hull { fill: #fff; }
.journey__mast { stroke: rgba(255,255,255,.9); stroke-width: 1.1; stroke-linecap: round; }
.journey__sail-main { fill: var(--gold); }
.journey__sail-jib  { fill: rgba(255,255,255,.92); }

/* ─── stats ────────────────────────────────────────────────── */

.stats {
  list-style: none;
  margin: 0;
  padding: 0;
  width: min(100%, 780px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(.6rem, 1.6vw, 1.1rem);
}

.stat {
  display: grid;
  gap: .2rem;
  padding: clamp(.7rem, 1.8vw, 1.05rem) .5rem;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: clamp(12px, 1.4vw, 16px);
  background: rgba(255,255,255,.045);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.stat__value {
  font-family: var(--font-num);
  font-weight: 300;
  font-size: clamp(1.15rem, 3.1vw, 1.85rem);
  line-height: 1.1;
  direction: ltr;
  font-variant-numeric: tabular-nums;
  color: var(--tint-soft);
}

.stat__label {
  font-size: clamp(.68rem, 1.5vw, .8rem);
  color: rgba(242,247,247,.7);
  letter-spacing: .04em;
}

/* ─── config error ─────────────────────────────────────────── */

.config-error {
  margin: 0;
  padding: .8rem 1.1rem;
  border: 1px solid rgba(244,194,107,.5);
  border-radius: 12px;
  background: rgba(244,194,107,.12);
  color: var(--gold);
  font-size: .88rem;
  direction: ltr;
}

.config-error code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ─── arrival ──────────────────────────────────────────────── */

.arrival {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: radial-gradient(80% 60% at 50% 50%, rgba(244,194,107,.16), rgba(3,26,33,.72) 70%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 1.2s ease both;
}

.arrival[hidden] { display: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.arrival__card {
  display: grid;
  gap: .7rem;
  text-align: center;
  padding: clamp(2rem, 6vw, 3.6rem) clamp(1.6rem, 6vw, 4rem);
  border: 1px solid rgba(244,194,107,.34);
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(244,194,107,.16), rgba(255,255,255,.04));
  box-shadow: 0 30px 90px -30px rgba(0,0,0,.85), inset 0 1px 0 rgba(255,255,255,.25);
  animation: rise 1s cubic-bezier(.2,.85,.24,1) both;
}

@keyframes rise {
  from { transform: translateY(18px) scale(.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.arrival__eyebrow {
  margin: 0;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
}

.arrival__title {
  margin: 0;
  font-size: clamp(2.2rem, 8vw, 4.4rem);
  font-weight: 300;
  line-height: 1.05;
  background: linear-gradient(100deg, #fff 10%, var(--gold) 55%, var(--tint-soft) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.arrival__text {
  margin: 0;
  color: rgba(242,247,247,.8);
  font-size: clamp(.9rem, 2vw, 1.05rem);
}

/* ─── responsive ───────────────────────────────────────────── */

@media (max-width: 640px) {
  .countdown { grid-template-columns: repeat(2, 1fr); }
  .stats     { grid-template-columns: 1fr; }
  .stat      { grid-template-columns: auto 1fr; align-items: baseline; text-align: start; gap: .8rem; }
  .stat__label { text-align: start; }
  .journey__meta { font-size: .7rem; letter-spacing: .06em; }
  .journey__boat { width: 36px; height: 29px; }
}

@media (max-height: 620px) and (min-width: 641px) {
  .unit { padding-block: .7rem; }
  .stage { gap: 1.1rem; }
}

/* ─── motion preferences ───────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .hero__img,
  .unit::after,
  .journey__rig {
    animation: none;
  }

  .hero__img { opacity: 1; transform: none; }
  .unit::after { display: none; }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}