/* Hallmark · pre-emit critique: P4 H4 E4 S4 R4 V4 */

:root {
  --bg: #070708;
  --panel: #12110f;
  --fg: #e6e1d6;
  --muted: #c3bbb0;
  --line: #e6e1d6;
  --font: "Barlow", "Segoe UI", sans-serif;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
}

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

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 400;
  overflow-x: clip;
}

body {
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--fg);
}

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

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

html.walk #quiet {
  display: none;
}

html:not(.walk) #track {
  display: none;
}

#track {
  height: 1952vh;
}

#stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

.plate {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.grain {
  position: absolute;
  inset: -60px;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  animation: grain-shift 0.9s steps(3) infinite;
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-18px, 10px); }
  66% { transform: translate(12px, -14px); }
  100% { transform: translate(0, 0); }
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.25), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.35)),
    radial-gradient(ellipse 72% 62% at 50% 46%, transparent 54%, rgba(0, 0, 0, 0.32) 100%);
  animation: lamp-flicker 4.2s steps(1) infinite;
}

@keyframes lamp-flicker {
  0%, 100% { opacity: 1; }
  7% { opacity: 0.9; }
  8% { opacity: 1; }
  43% { opacity: 0.94; }
  44% { opacity: 1; }
  71% { opacity: 0.88; }
  73% { opacity: 1; }
}

.exit {
  position: absolute;
  z-index: 2;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  min-height: 48px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.card {
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 16px;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: 34rem;
  max-height: calc(100dvh - 96px);
  padding: 16px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid rgba(230, 225, 214, 0.18);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
}

.card.is-live {
  pointer-events: auto;
}

.kicker {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.kicker[hidden] {
  display: none;
}

.card h2 {
  margin: 0 0 8px;
  font-family: var(--font);
  font-style: normal;
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  min-width: 0;
}

.lead {
  margin: 0;
  max-width: 62ch;
  color: var(--fg);
}

.cheer {
  margin: 16px 0 0;
  max-width: 62ch;
  font-weight: 600;
}

.cheer[hidden],
.offer[hidden] {
  display: none;
}

.offer {
  margin-top: 16px;
}

.offer-note {
  margin: 0 0 8px;
  max-width: 62ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.offer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--fg);
  background: var(--fg);
  color: var(--bg);
  font: 600 16px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
}

.btn-quiet {
  background: transparent;
  color: var(--fg);
}

.btn:focus-visible,
.sound:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.read {
  display: none;
  margin-top: 8px;
}

.sound {
  position: absolute;
  z-index: 3;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  min-height: 48px;
  min-width: 48px;
  padding: 0 16px;
  border: 1px solid var(--fg);
  background: transparent;
  color: var(--fg);
  font: 600 16px/1 var(--font);
  cursor: pointer;
}

.sound[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

.sound[hidden] {
  display: none;
}

.more {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  margin-top: 8px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.more[hidden] {
  display: none;
}

.hint {
  position: absolute;
  z-index: 2;
  top: calc(max(16px, env(safe-area-inset-top)) + 48px);
  left: 16px;
  right: 7.5rem;
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

.hint-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hint svg {
  width: 24px;
  height: 24px;
  flex: none;
}

html.timeline .hint {
  animation: hint-fade linear both;
  animation-timeline: scroll(root);
  animation-range: 0% 1.2%;
}

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

.meter {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  background: var(--fg);
  opacity: 0.35;
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.marks {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  pointer-events: none;
}

.marks span {
  position: absolute;
  top: 0;
  width: 2px;
  height: 8px;
  background: var(--fg);
  opacity: 0.55;
}

html.timeline .meter {
  animation: grow-meter linear both;
  animation-timeline: scroll(root);
}

@keyframes grow-meter {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

html.timeline .card {
  animation: room-card linear both;
  animation-timeline: scroll(root);
}

#quiet {
  max-width: 40rem;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.quiet-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

#quiet h1,
#quiet h2 {
  font-family: var(--font);
  font-style: normal;
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  min-width: 0;
}

#quiet h1 {
  margin: 16px 0 8px;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.1;
}

.deck {
  margin: 0 0 32px;
  max-width: 62ch;
  color: var(--muted);
}

#quiet section {
  margin: 0 0 32px;
}

#quiet img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: cover;
  background: var(--bg);
}

#quiet h2 {
  margin: 16px 0 8px;
  font-size: 1.5rem;
  line-height: 1.2;
}

#quiet p {
  margin: 0;
  max-width: 62ch;
}

#quiet p + p {
  margin-top: 8px;
}

#quiet section a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  margin-top: 8px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.gap {
  min-height: 40vh;
  margin: 0 0 32px;
  display: flex;
  align-items: flex-end;
  color: var(--muted);
  background: var(--bg);
}

@media (min-width: 768px) {
  .card {
    left: 32px;
    right: auto;
  }

  .hint {
    left: 32px;
  }

  .card {
    bottom: 40px;
    padding: 24px;
  }

  #quiet {
    padding: 32px 24px 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.walk #quiet {
    display: block;
  }

  html.walk #track {
    display: none;
  }
}
