/* ===================================================================
   Save the Date - "The Nosy Giraffe"
   ===================================================================
   One full-screen stage: the film (or its last frame, as a still), the
   giraffe's whispers over it (the sign's words are painted in the film)
   and, at the end, what to do next. Ochre, cream and thornwood brown from the veld.

   States (on .ng-stage): .ng-loading, data-clip=arrive|idle|boop|leave|
   done, .ng-done (the end).
   Root: .ng-js (the script runs), .ng-motion (the film may play).
   =================================================================== */
:root {
  --ng-ink: #24170c;
  --ng-cream: #f6ecd8;
  --ng-paint: #f4e8cf;
  --ng-ochre: #d39b4a;
  --ng-ochre-deep: #8a5a22;
  --ng-shadow: rgba(18, 10, 3, 0.62);
  --ng-glass: rgba(28, 18, 9, 0.52);
  --ng-safe-t: env(safe-area-inset-top, 0px);
  --ng-safe-b: env(safe-area-inset-bottom, 0px);
  --ng-safe-l: env(safe-area-inset-left, 0px);
  --ng-safe-r: env(safe-area-inset-right, 0px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; }
body.ng {
  background: #1d140b;
  color: var(--ng-cream);
  font-family: "Rokkitt", Georgia, serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.ng-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---- The stage ------------------------------------------------------------ */
.ng-stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 320px;
  overflow: hidden;
  background: #2a1e12;
  isolation: isolate;
}
@supports (height: 100dvh) { .ng-stage { height: 100dvh; } }

.ng-frame { position: absolute; inset: 0; }
.ng-still, .ng-still img,
.ng-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 50%;
}
.ng-video { opacity: 0; pointer-events: none; background: transparent; }
.ng-video.on { opacity: 1; }
/* a whisper of vignette, as a lens has */
.ng-frame::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(20, 10, 2, 0.32) 100%);
}

/* the still is the last frame: only shown once the film is over (or never runs) */
.ng-js.ng-motion .ng-stage:not(.ng-done) .ng-still { visibility: hidden; }

/* ---- Whispers ------------------------------------------------------------- */
.ng-whisper {
  position: absolute;
  margin: 0;
  z-index: 4;
  font-family: "Yesteryear", "Brush Script MT", cursive;
  color: #fff8ea;
  text-align: center;
  line-height: 1.05;
  text-shadow: 0 2px 3px rgba(20, 10, 2, 0.55), 0 0 24px rgba(20, 10, 2, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.ng-whisper.on { opacity: 1; }
.ng-psst {
  left: 50%;
  top: calc(var(--ng-safe-t) + 15%);
  width: min(88vw, 34rem);
  font-size: clamp(2rem, 7.2vw, 3.6rem);
  transform: translate(-50%, 0.6rem);
}
.ng-psst.on { transform: translate(-50%, 0); }
.ng-hear {
  left: 30%; top: 30%;
  font-size: clamp(2.6rem, 10vw, 5rem);
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(-5deg) scale(0.86);
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.ng-hear.on { transform: translate(-50%, -50%) rotate(-5deg) scale(1); }
@media (min-aspect-ratio: 1/1) {
  .ng-psst { top: calc(var(--ng-safe-t) + 12%); font-size: clamp(2.2rem, 4.4vw, 3.8rem); }
  .ng-hear { font-size: clamp(2.8rem, 6vw, 5.4rem); }
}

.ng-hint {
  position: absolute; left: 0; top: 0; margin: 0;
  z-index: 5;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  background: var(--ng-glass);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: 0.95rem; font-weight: 600; letter-spacing: 0.04em;
  color: var(--ng-cream);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.ng-hint.on { opacity: 1; animation: ng-bob 2.2s ease-in-out infinite; }
@keyframes ng-bob { 50% { margin-top: 4px; } }

/* the nose: an invisible, generous target that follows it */
.ng-nose {
  position: absolute; left: 0; top: 0;
  z-index: 3;
  width: 120px; height: 120px;
  padding: 0; margin: 0;
  border: 0; border-radius: 50%;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}
.ng-nose:focus-visible { outline: 3px solid var(--ng-cream); outline-offset: -6px; }
.ng-nose::after {
  content: "";
  position: absolute; inset: 22%;
  border-radius: 50%;
  border: 2px solid rgba(255, 248, 234, 0.0);
}
.ng-stage:has(.ng-hint.on) .ng-nose::after { animation: ng-pulse 2.2s ease-out infinite; }
.ng-nose.ripple::after { animation: ng-ripple 0.6s ease-out 1; }
@keyframes ng-pulse {
  0% { border-color: rgba(255, 248, 234, 0.55); transform: scale(0.7); }
  70%, 100% { border-color: rgba(255, 248, 234, 0); transform: scale(1.25); }
}
@keyframes ng-ripple {
  0% { border-color: rgba(255, 248, 234, 0.8); transform: scale(0.5); }
  100% { border-color: rgba(255, 248, 234, 0); transform: scale(1.4); }
}

/* ---- The signboard's words ------------------------------------------------ */
/* The invitation is painted on the board in the film itself (and in its
   last frame, the still), so the words here are for screen readers only. */
.ng-sign {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

/* boop cuts in the moment the nose is tapped: a quick cross-fade over
   the idle clip, which stays up underneath until it is done */
.ng-video.ng-fade { transition: opacity 0.14s linear; }

/* ---- After: the line under the sign and what to do next --------------- */
.ng-after {
  position: absolute;
  z-index: 6;
  left: 0; right: 0;
  bottom: 0;
  padding: 2.6rem calc(1rem + var(--ng-safe-r)) calc(1.1rem + var(--ng-safe-b)) calc(1rem + var(--ng-safe-l));
  background: linear-gradient(180deg, transparent, rgba(22, 13, 5, 0.62) 55%);
  text-align: center;
}
.ng-follow {
  margin: 0 0 0.8rem;
  font-size: 1.08rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--ng-cream);
  text-shadow: 0 1px 6px var(--ng-shadow);
}
.ng-follow-line { white-space: nowrap; }
.ng-actions {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.6rem;
}
.ng-js .ng-after { opacity: 0; visibility: hidden; transform: translateY(0.6rem); transition: opacity 0.7s ease 0.9s, transform 0.7s ease 0.9s, visibility 0s linear 1.6s; }
.ng-js .ng-stage.ng-done .ng-after { opacity: 1; visibility: visible; transform: none; transition-delay: 1.2s, 1.2s, 0s; }
.ng-js .ng-stage.ng-done.ng-instant .ng-after { transition-delay: 0s; }

.ng-btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(246, 236, 216, 0.55);
  background: var(--ng-glass);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--ng-cream);
  font: 600 1.02rem/1 "Rokkitt", Georgia, serif;
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.ng-btn:hover { background: rgba(40, 26, 12, 0.72); }
.ng-btn:active { transform: translateY(1px); }
.ng-btn-solid {
  background: var(--ng-cream);
  border-color: var(--ng-cream);
  color: var(--ng-ink);
}
.ng-btn-solid:hover { background: #fff6e4; }
.ng-btn:focus-visible, .ng-back:focus-visible, .ng-sound:focus-visible, .ng-skip:focus-visible {
  outline: 3px solid var(--ng-ochre);
  outline-offset: 3px;
}
.ng-btn[hidden] { display: none; }

/* ---- Top bar, skip -------------------------------------------------------- */
.ng-top {
  position: absolute; z-index: 7;
  top: calc(0.75rem + var(--ng-safe-t));
  left: calc(0.75rem + var(--ng-safe-l));
  right: calc(0.75rem + var(--ng-safe-r));
  display: flex; justify-content: space-between; align-items: center;
  pointer-events: none;
}
.ng-back, .ng-sound {
  pointer-events: auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(246, 236, 216, 0.35);
  background: var(--ng-glass);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--ng-cream);
  padding: 0;
  cursor: pointer;
}
.ng-back svg, .ng-sound svg { width: 22px; height: 22px; }
.ng-sound { margin-left: auto; }   /* stays on the right on a page without the back link */
.ng-sound[hidden] { display: none; }
.ng-sound .ng-sound-on { display: none; }
.ng-sound[aria-pressed="true"] .ng-sound-on { display: inline; }
.ng-sound[aria-pressed="true"] .ng-sound-off { display: none; }

.ng-skip {
  position: absolute; z-index: 7;
  right: calc(0.9rem + var(--ng-safe-r));
  bottom: calc(1rem + var(--ng-safe-b));
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(246, 236, 216, 0.4);
  background: var(--ng-glass);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--ng-cream);
  font: 600 0.95rem/1 "Rokkitt", Georgia, serif;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.ng-skip[hidden] { display: none; }

/* ---- Loader --------------------------------------------------------------- */
.ng-loader {
  position: absolute; inset: 0; z-index: 9;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem;
  background: radial-gradient(90% 70% at 50% 62%, #6b4421 0%, #3a2513 48%, #1d140b 100%);
  transition: opacity 0.7s ease, visibility 0s linear 0.7s;
}
.ng-js.ng-motion .ng-loader { display: flex; }
.ng-loader.gone { opacity: 0; visibility: hidden; }
.ng-loader[hidden] { display: none !important; }
.ng-loader-art { width: min(64vw, 300px); height: auto; overflow: visible; }
.ng-loader-land { stroke: #e9c585; stroke-width: 1.4; }
.ng-loader-tree { fill: none; stroke: #1b1209; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ng-loader-crown { fill: #1b1209; stroke-width: 1; }
.ng-loader-giraffe { stroke-width: 2; }
.ng-loader-sun { fill: #f0b75a; animation: ng-rise 3.2s ease-in-out infinite alternate; }
@keyframes ng-rise { from { transform: translateY(8px); fill: #e08a3a; } to { transform: translateY(-26px); fill: #f6cf7a; } }
.ng-loader-text {
  margin: 0;
  font-family: "Yesteryear", "Brush Script MT", cursive;
  font-size: clamp(1.4rem, 5vw, 2rem);
  color: #f1dfbb;
}

/* ---- Footer (below the stage) -------------------------------------------- */
.ng-foot {
  padding: 1.4rem calc(1.2rem + var(--ng-safe-r)) calc(1.6rem + var(--ng-safe-b)) calc(1.2rem + var(--ng-safe-l));
  text-align: center;
  font-size: 0.92rem;
  color: #d8c6a4;
  background: #1d140b;
}
.ng-foot p { margin: 0.35rem auto; max-width: 44rem; line-height: 1.45; }
.ng-foot a { color: #f0d6a2; }
.ng-foot a:focus-visible { outline: 2px solid var(--ng-ochre); outline-offset: 2px; }
.ng-foot-back { font-weight: 600; letter-spacing: 0.04em; }
.ng-credits { font-size: 0.82rem; opacity: 0.85; }

/* Without the film there is nothing to wait for. */
html:not(.ng-motion) .ng-skip,
html:not(.ng-motion) .ng-whisper,
html:not(.ng-motion) .ng-hint { display: none; }

@media (prefers-reduced-motion: reduce) {
  .ng-whisper, .ng-after, .ng-hint, .ng-loader { transition: none !important; animation: none !important; }
}

/* A phone on its side: no room under the sign, so what to do next sits
   beside it, on the right. */
@media (max-height: 520px) and (min-aspect-ratio: 3/2) {
  .ng-after {
    left: auto; right: 0; top: 0; bottom: 0;
    width: min(29vw, 250px);
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 1rem calc(0.9rem + var(--ng-safe-r)) calc(0.9rem + var(--ng-safe-b)) 0.9rem;
    background: linear-gradient(90deg, transparent, rgba(22, 13, 5, 0.6) 35%);
    text-align: left;
  }
  .ng-follow { font-size: 0.95rem; margin-bottom: 0.6rem; }
  .ng-follow-line { white-space: normal; }
  .ng-actions { flex-direction: column; align-items: stretch; gap: 0.45rem; }
  .ng-btn { min-height: 42px; font-size: 0.95rem; padding: 0.45rem 0.9rem; }
  .ng-skip { bottom: calc(0.7rem + var(--ng-safe-b)); }
}
