@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/caveat.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/cormorant-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/cormorant-italic.woff2') format('woff2');
}

:root {
  --ink: #e9e4da;
  --ink-dim: rgba(233, 228, 218, 0.62);
  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
}

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

html, body {
  height: 100%;
  background: #06080f;
  color: var(--ink);
  font-family: var(--serif);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}

/* window frame: a soft dark bevel around the glass */
#frame {
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 0 60px rgba(0, 0, 0, 0.55),
    inset 0 0 160px rgba(0, 0, 0, 0.45);
  border-radius: 10px;
}

/* ---- cards ---- */
.card {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 14px;
  background: radial-gradient(ellipse at center, rgba(6, 8, 15, 0.25), rgba(6, 8, 15, 0.7));
  opacity: 1;
  transition: opacity 1.4s ease;
}
.card.hide { opacity: 0; pointer-events: none; }
.card[hidden] { display: none; }
.card.show { animation: cardIn 2.2s ease both; }
@keyframes cardIn { from { opacity: 0; } to { opacity: 1; } }

.card h1, .card h2 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 6.2rem);
  letter-spacing: 0.02em;
  line-height: 1.05;
  color: var(--ink);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.6);
}
.card .sub {
  font-size: clamp(0.72rem, 2.4vw, 0.95rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.card .kicker {
  font-size: clamp(0.72rem, 2.4vw, 0.95rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.card .when {
  margin-top: 6px;
  font-style: italic;
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: var(--ink-dim);
}
.card .cta {
  margin-top: 22px;
  font-size: clamp(0.8rem, 2.6vw, 1rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

#again {
  margin-top: 18px;
  font: inherit;
  font-size: clamp(0.78rem, 2.4vw, 0.95rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(233, 228, 218, 0.35);
  border-radius: 999px;
  padding: 12px 26px;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease;
}
#again:hover, #again:focus-visible { background: rgba(233, 228, 218, 0.08); border-color: rgba(233, 228, 218, 0.7); outline: none; }

/* ---- hint ---- */
#hint {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(26px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.74rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-dim);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
#hint.show { opacity: 1; }

/* ---- sound toggle ---- */
#sound {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(18px + env(safe-area-inset-right));
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  padding: 10px 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 1s ease, color 0.3s ease;
}
#sound.show { opacity: 1; }
#sound:hover, #sound:focus-visible { color: var(--ink); outline: none; }
#sound[hidden] { display: none; }

/* ---- signature ---- */
#sig {
  position: fixed;
  left: calc(18px + env(safe-area-inset-left));
  bottom: calc(14px + env(safe-area-inset-bottom));
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: rgba(233, 228, 218, 0.28);
  text-decoration: none;
  transition: color 0.3s ease;
}
#sig:hover { color: rgba(233, 228, 218, 0.6); }

.noscript {
  position: fixed;
  inset: auto 0 40% 0;
  text-align: center;
  padding: 0 24px;
  color: var(--ink);
}

body.shake #view { animation: rattle 0.12s linear infinite; }
@keyframes rattle {
  0% { transform: translate(0, 0); }
  25% { transform: translate(1.5px, -1px); }
  50% { transform: translate(-1px, 1.5px); }
  75% { transform: translate(1px, 1px); }
  100% { transform: translate(-1.5px, -0.5px); }
}

@media (prefers-reduced-motion: reduce) {
  .card .cta { animation: none; opacity: 0.85; }
  body.shake #view { animation: none; }
}
