/* ═══════════════════════════════════════════
   base.css — theme tokens, reset, typography,
   buttons, glass, loader, password gate
   ═══════════════════════════════════════════ */

:root {
  --bg: #0a0a14;
  --bg-deep: #06060d;
  --gold: #d4af6a;
  --gold-bright: #f0d9a8;
  --pink: #f3c6d3;
  --pink-deep: #e89bb5;
  --white: #f7f4ef;
  --muted: rgba(247, 244, 239, 0.62);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.12);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-script: "Great Vibes", cursive;
  --font-body: "Jost", "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --section-pad: clamp(4.5rem, 12vh, 8rem);
}

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

/* The `hidden` attribute must always win. Several components set
   display:flex/grid, which would otherwise override [hidden] and leave an
   invisible element (e.g. the closed lightbox) intercepting every tap. */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  background: radial-gradient(ellipse at 50% -20%, #14142a 0%, var(--bg) 45%, var(--bg-deep) 100%);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.7;
  letter-spacing: 0.02em;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.locked { overflow: hidden; }

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

::selection { background: var(--gold); color: var(--bg-deep); }

/* ── Glassmorphism ── */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.9em 2.4em;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out), background 0.4s;
  -webkit-tap-highlight-color: transparent;
}

.btn--gold {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold) 55%, #b08d4b);
  color: #241a08;
  box-shadow: 0 8px 30px rgba(212, 175, 106, 0.35);
}
.btn--gold:hover, .btn--gold:focus-visible {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 14px 44px rgba(212, 175, 106, 0.55);
}
.btn--gold:active { transform: translateY(0) scale(0.98); }

.btn--ghost {
  border: 1px solid var(--glass-border);
  color: var(--muted);
  padding: 0.55em 1.2em;
}
.btn--ghost:hover, .btn--ghost:focus-visible { color: var(--gold-bright); border-color: var(--gold); }

.btn--lg { font-size: 1.1rem; padding: 1.1em 3em; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ═══════════ Loading Screen ═══════════ */
.loader {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2rem;
  background: radial-gradient(ellipse at center, #12122400, var(--bg-deep) 80%), var(--bg);
  transition: opacity 0.9s ease, visibility 0.9s;
}
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }

.loader__heart {
  position: relative; width: 64px; height: 64px;
  animation: loaderPulse 1.4s ease-in-out infinite;
}
.loader__heart span {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--gold);
  animation: loaderRing 2.2s var(--ease-out) infinite;
}
.loader__heart span:nth-child(2) { animation-delay: 0.55s; }
.loader__heart span:nth-child(3) { animation-delay: 1.1s; }
.loader__heart::after {
  content: "♥";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 1.8rem; color: var(--pink-deep);
  text-shadow: 0 0 24px var(--pink-deep);
}

@keyframes loaderPulse { 50% { transform: scale(1.08); } }
@keyframes loaderRing {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.4); opacity: 0; }
}

.loader__text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.loader__bar {
  width: min(220px, 60vw); height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px; overflow: hidden;
}
.loader__bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold), var(--pink));
  border-radius: 2px;
  transition: width 0.35s ease;
}

/* ═══════════ Password Gate ═══════════ */
.gate {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(212, 175, 106, 0.07), transparent 50%),
    radial-gradient(ellipse at 80% 85%, rgba(243, 198, 211, 0.06), transparent 50%),
    var(--bg);
  transition: opacity 1s ease, visibility 1s;
}
.gate.is-open { opacity: 0; visibility: hidden; pointer-events: none; }

.gate__card {
  width: min(420px, 100%);
  padding: clamp(2rem, 6vw, 3rem);
  text-align: center;
  animation: gateIn 1.1s var(--ease-out) both;
}
@keyframes gateIn {
  from { opacity: 0; transform: translateY(34px) scale(0.96); }
}

.gate__card.is-shaking { animation: gateShake 0.55s var(--ease-out); }
@keyframes gateShake {
  15% { transform: translateX(-11px); }
  35% { transform: translateX(9px); }
  55% { transform: translateX(-6px); }
  75% { transform: translateX(4px); }
}

.gate__lock {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 18px rgba(212, 175, 106, 0.55));
  margin-bottom: 1rem;
}

.gate__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.7rem, 6vw, 2.2rem);
  letter-spacing: 0.04em;
  background: linear-gradient(120deg, var(--white), var(--gold-bright), var(--white));
  background-size: 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 5s linear infinite;
}
@keyframes shimmer { to { background-position: 200% center; } }

.gate__hint {
  color: var(--muted);
  font-style: italic;
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0.6rem 0 1.4rem;
}

.gate__countdown-label {
  text-transform: uppercase;
  letter-spacing: 0.34em;
  font-size: 0.6rem;
  color: var(--gold);
  margin-bottom: 0.6rem;
}

.gate__countdown {
  display: flex;
  justify-content: center;
  gap: clamp(0.6rem, 3vw, 1.1rem);
  margin-bottom: 1.8rem;
  font-variant-numeric: tabular-nums;
}
.gate__countdown .cd-unit { display: flex; flex-direction: column; align-items: center; min-width: 2.6ch; }
.gate__countdown .cd-num {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 6vw, 1.8rem);
  color: var(--gold-bright);
  line-height: 1.15;
  text-shadow: 0 0 18px rgba(212, 175, 106, 0.35);
}
.gate__countdown .cd-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
}
.gate__countdown.is-birthday {
  font-family: var(--font-script);
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  color: var(--gold-bright);
  text-shadow: 0 0 30px rgba(212, 175, 106, 0.5);
}

.gate__form { display: flex; flex-direction: column; gap: 1rem; }

.gate__input {
  width: 100%;
  padding: 0.95em 1.4em;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 1rem;
  letter-spacing: 0.24em;
  text-align: center;
  transition: border-color 0.35s, box-shadow 0.35s;
}
.gate__input::placeholder { letter-spacing: 0.05em; color: rgba(247, 244, 239, 0.35); }
.gate__input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(212, 175, 106, 0.15);
}

.gate__error {
  min-height: 1.4em;
  margin-top: 1rem;
  color: var(--pink-deep);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 0.4s;
}
.gate__error.is-visible { opacity: 1; }

.gate__spinner {
  display: none;
  width: 1em; height: 1em;
  border: 2px solid rgba(36, 26, 8, 0.3);
  border-top-color: #241a08;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.gate__submit.is-busy .gate__spinner { display: inline-block; }
.gate__submit.is-busy .gate__submit-text { opacity: 0.6; }
.gate__submit.is-busy { pointer-events: none; }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
