/* Arlind & Era — envelope open → looping B&W couple + text overlay (no scroll) */
:root {
  --ink: #1a1814;
  --ink-soft: #2e2b26;
  --muted: #5c5954;
  --paper: #f4efe6;
  --paper-edge: #e8e0d2;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --crossfade: 0.85s;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overflow-x: clip;
  background: #0a0a0a;
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
.skip {
  position: absolute; left: -9999px; top: 0;
  background: #fff; color: #000; padding: 0.5rem 1rem; z-index: 100;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

.lang-link {
  position: fixed;
  top: max(0.75rem, var(--safe-t));
  left: 0.85rem;
  z-index: 50;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f5f2ea;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
  padding: 0.45rem 0.55rem;
  min-width: 44px;
  min-height: 44px;
}

.scene {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100vw;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  background: #0a0a0a;
}

.stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}
.layer img,
.open-vid,
.loop-vid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  user-select: none;
  pointer-events: none;
}

.poster { z-index: 1; }
.open-vid {
  z-index: 2;
  opacity: 0;
  background: transparent;
}
.loop-vid {
  z-index: 3;
  opacity: 0;
  background: transparent;
  transition: opacity var(--crossfade) var(--ease);
  will-change: opacity;
}
.still { z-index: 2; opacity: 0; transition: opacity 0.4s ease; }
.scene.is-looping .still:not([hidden]) { opacity: 1; }

.scene.is-opening .open-vid.is-playing { opacity: 1; }
.scene.is-opening .poster {
  opacity: 0;
  transition: opacity 180ms linear;
}
.scene.is-looping .loop-vid.is-playing { opacity: 1; }
.scene.is-looping .open-vid {
  opacity: 0;
  transition: opacity var(--crossfade) var(--ease);
}
.scene.is-looping .poster { opacity: 0; visibility: hidden; }
.scene.use-css-fallback .still { opacity: 1; }
.scene.use-css-fallback.is-opening .poster {
  opacity: 0;
  transition: opacity 900ms ease;
}

.seal-hit {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(58vw, 280px);
  height: min(42vw, 200px);
  z-index: 6;
  border-radius: 8px;
  background: transparent;
}
.scene.is-opening .seal-hit,
.scene.is-looping .seal-hit {
  pointer-events: none;
  opacity: 0;
}
.seal-pulse {
  position: absolute;
  inset: 18% 22%;
  border-radius: 4px;
  box-shadow: 0 0 0 0 rgba(243, 238, 228, 0.35);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(243, 238, 228, 0.4); }
  70% { box-shadow: 0 0 0 18px rgba(243, 238, 228, 0); }
  100% { box-shadow: 0 0 0 0 rgba(243, 238, 228, 0); }
}

.env-hint {
  position: absolute;
  bottom: max(1.6rem, calc(var(--safe-b) + 1rem));
  left: 0;
  right: 0;
  text-align: center;
  margin: 0;
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: rgba(245, 242, 234, 0.78);
  z-index: 7;
  pointer-events: none;
  transition: opacity 280ms ease;
}
.env-hint.is-out,
.scene.is-opening .env-hint,
.scene.is-looping .env-hint { opacity: 0; }

/* ——— Ivory card in middle of looping video (faces clear above) ——— */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  /* Centered vertically: cream frame covers couple faces in mid video */
  place-items: center;
  padding:
    max(1.2rem, calc(var(--safe-t) + 2.5rem))
    0.95rem
    max(1.2rem, calc(var(--safe-b) + 1rem));
  pointer-events: none;
  opacity: 0;
}
.overlay.is-in {
  opacity: 1;
  transition: opacity 0.95s var(--ease);
  pointer-events: none;
}
.overlay.is-in .text-link,
.overlay.is-in .maps-link { pointer-events: auto; }

.invite-card.overlay-inner {
  position: relative;
  z-index: 1;
  width: min(100%, 22.5rem);
  /* Tall frame covering faces in the middle of the video */
  max-height: min(62svh, 34rem);
  min-height: min(52svh, 28rem);
  overflow: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  margin: 0 auto;
  padding: 1.7rem 1.35rem 1.45rem;
  text-align: center;
  color: var(--ink);
  text-shadow: none;
  background:
    linear-gradient(180deg, #f7f3eb 0%, var(--paper) 55%, #efe8dc 100%);
  border: 1px solid rgba(26, 24, 20, 0.1);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.65) inset,
    0 18px 40px rgba(0,0,0,0.28),
    0 4px 12px rgba(0,0,0,0.16);
  border-radius: 2px;
}
.invite-card.overlay-inner::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(26, 24, 20, 0.08);
  pointer-events: none;
}
.invite-card.overlay-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.mono {
  margin: 0 0 0.35rem;
  font-style: italic;
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  opacity: 0.85;
}
.greeting {
  margin: 0;
  font-style: italic;
  font-size: 1.02rem;
  color: var(--ink-soft);
}
.invite-line {
  margin: 0.2rem 0 0;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
}
.names {
  margin: 0.7rem 0 0;
  font-weight: 500;
  font-style: italic;
  font-size: clamp(2.05rem, 9vw, 2.85rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
}
.names .amp {
  display: inline-block;
  margin: 0 0.12em;
  opacity: 0.75;
  font-size: 0.78em;
}
.date-line {
  margin: 0.75rem 0 0;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: var(--ink-soft);
}
.meta-line {
  margin: 0.4rem 0 0;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.meta-line strong {
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.1em;
}
.meta-line .dot { margin: 0 0.3em; opacity: 0.55; }
.maps-link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: rgba(26,24,20,0.35);
}
.countdown {
  margin: 0.7rem 0 0;
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem 1rem;
  margin-top: 0.85rem;
}
.text-link {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-decoration: underline;
  text-underline-offset: 0.28em;
  text-decoration-thickness: 1px;
  color: var(--ink);
  padding: 0.35rem 0.15rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.text-link:focus-visible,
.maps-link:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

@media (min-width: 900px) {
  .names { font-size: 2.95rem; }
  .seal-hit { width: 320px; height: 220px; }
  .invite-card.overlay-inner {
    width: min(100%, 25rem);
    max-height: min(58svh, 36rem);
    min-height: min(48svh, 30rem);
    padding: 1.9rem 1.8rem 1.65rem;
  }
  .overlay {
    padding-top: max(1.5rem, calc(var(--safe-t) + 3rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  .seal-pulse { animation: none; }
  .loop-vid, .overlay.is-in, .scene.is-looping .open-vid { transition: none; }
}
