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

/* ─── Tokens ─── */
:root {
  --void:        #0A0A0B;
  --graphite:    #111113;
  --surface:     #18181A;
  --ivory:       #E8E0D0;
  --champagne:   #C8C0B0;
  --stone:       #6A6460;
  --mist:        #3A3835;
  --accent-dim:  rgba(232, 224, 208, 0.06);

  --font-display: 'Cormorant Garant', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;

  --ease-silk:  cubic-bezier(0.25, 0.1, 0.1, 1);
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
}

/* ─── Base ─── */
html {
  background: var(--void);
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: clamp(14px, 1.6vw, 16px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  height: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  cursor: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ─── Starfield Canvas ─── */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ─── Cursor ─── */
#cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
}

#cursor-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--ivory);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.08s var(--ease-silk), opacity 0.2s;
  opacity: 0.9;
}

#cursor-ring {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(232, 224, 208, 0.35);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.18s var(--ease-out), width 0.25s var(--ease-out),
              height 0.25s var(--ease-out), opacity 0.25s, border-color 0.25s;
}

#cursor.hovering #cursor-ring {
  width: 44px;
  height: 44px;
  border-color: rgba(232, 224, 208, 0.5);
}

#cursor.pressing #cursor-dot {
  transform: translate(-50%, -50%) scale(2);
}

@media (hover: none) {
  #cursor { display: none; }
  body { cursor: auto; }
}

/* ─── Main Layout ─── */
#main {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(52px, 9vh, 88px);
  padding: clamp(48px, 10vh, 120px) clamp(32px, 6vw, 80px);
  width: 100%;
  max-width: 860px;
  text-align: center;
}

/* ─── Narrative Lines ─── */
#narrative {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2.2vh, 18px);
}

.line {
  font-family: var(--font-display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(22px, 5.5vw, 44px);
  line-height: 1.3;
  color: var(--ivory);
  letter-spacing: -0.01em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 1.4s var(--ease-out), transform 1.4s var(--ease-out);
  will-change: opacity, transform;
}

.line.visible {
  opacity: 1;
  transform: translateY(0);
}

.line em {
  font-style: normal;
  color: var(--champagne);
}

.line .ellipsis {
  color: var(--stone);
  font-style: normal;
}

/* First line: name — slightly larger, more presence */
#line-1 {
  font-size: clamp(26px, 6.5vw, 54px);
  font-weight: 400;
  letter-spacing: 0.015em;
  color: var(--champagne);
}

/* Last line: quieter, resigned */
#line-5 {
  font-size: clamp(16px, 3.8vw, 30px);
  color: var(--stone);
  letter-spacing: 0.02em;
}

/* ─── Countdown ─── */
#countdown-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 3.5vh, 32px);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1.6s var(--ease-out), transform 1.6s var(--ease-out);
  will-change: opacity, transform;
}

#countdown-section.visible {
  opacity: 1;
  transform: translateY(0);
}

#countdown {
  display: flex;
  align-items: flex-start;
  gap: clamp(12px, 3vw, 28px);
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: opacity 0.3s var(--ease-silk);
}

.unit:hover .digit {
  color: var(--ivory);
}

.digit {
  font-family: var(--font-display);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  font-size: clamp(42px, 11vw, 96px);
  line-height: 1;
  color: var(--champagne);
  letter-spacing: -0.03em;
  transition: color 0.4s var(--ease-silk);
  /* Prevent layout shift on digit change */
  min-width: 2ch;
  display: inline-block;
  text-align: center;
}

.label {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(9px, 1.6vw, 11px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--stone);
}

/* Separator — a vertical hairline, not a colon */
.sep {
  width: 1px;
  height: clamp(32px, 7vw, 64px);
  background: linear-gradient(to bottom, transparent, var(--mist) 40%, var(--mist) 60%, transparent);
  margin-top: clamp(8px, 2vw, 18px);
  flex-shrink: 0;
}

#target-date {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(10px, 1.8vw, 12px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mist);
  margin-top: 4px;
}

/* ─── Button ─── */
#action-section {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 1.4s var(--ease-out), transform 1.4s var(--ease-out);
  will-change: opacity, transform;
}

#action-section.visible {
  opacity: 1;
  transform: translateY(0);
}

#try-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: none;
  position: relative;
  display: inline-block;
}

#btn-text {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(12px, 2vw, 14px);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--stone);
  transition: color 0.5s var(--ease-silk), letter-spacing 0.5s var(--ease-silk);
  display: inline-block;
  position: relative;
}

/* Underline that draws itself */
#btn-text::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--stone);
  transition: width 0.5s var(--ease-out);
}

#try-btn:hover #btn-text {
  color: var(--champagne);
  letter-spacing: 0.28em;
}

#try-btn:hover #btn-text::after {
  width: 100%;
  background: var(--champagne);
}

#try-btn:focus-visible #btn-text {
  color: var(--champagne);
  outline: 1px solid var(--mist);
  outline-offset: 8px;
}

/* ─── Ripple ─── */
#ripple-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(232, 224, 208, 0.07);
  transform: translate(-50%, -50%) scale(0);
  animation: ripple-expand 2.4s var(--ease-out) forwards;
  pointer-events: none;
}

@keyframes ripple-expand {
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

/* ─── Digit change animation ─── */
@keyframes digit-tick {
  0%   { opacity: 0.3; transform: translateY(-4px); }
  100% { opacity: 1;   transform: translateY(0); }
}

.digit.ticking {
  animation: digit-tick 0.2s var(--ease-out) forwards;
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  .line,
  #countdown-section,
  #action-section {
    transition: opacity 0.4s linear;
    transform: none !important;
  }
  .digit.ticking { animation: none; }
  #cursor-ring { transition: none; }
}

/* ─── Mobile refinements ─── */
@media (max-width: 480px) {
  #main {
    gap: clamp(40px, 8vh, 64px);
    justify-content: center;
  }

  #countdown {
    gap: clamp(8px, 4vw, 16px);
  }

  .sep {
    height: 28px;
    margin-top: 12px;
  }
}

/* ─── Very small screens ─── */
@media (max-width: 340px) {
  .digit {
    font-size: 36px;
  }
  .line {
    font-size: 20px;
  }
}
