/* Zateemee Bride — the journey in
   paper: the logo sketched in pencil, then inked black
   night: it rolls and glides down into moonlit clouds; we follow it through and out underneath
   arrival: the castle at night, and a round "Enter Your Dream" */

@font-face {
  font-family: "Pinyon Script";
  src: url("../assets/fonts/pinyon-script-latin.woff2") format("woff2");
  font-display: block;
}
@font-face {
  font-family: "Italiana";
  src: url("../assets/fonts/italiana-latin.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("../assets/fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --paper: #fdfbf9;
  --ink: #141316;
  --whisper: #aaa39a;      /* "loading": light grey, visible but quiet */
  --night: #0b1222;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.is-loading { overflow: hidden; }
/* nothing behind the intro may show through it while it plays */
body.is-loading > :not(.preloader):not(script):not(.enter-wash):not(.music):not(.turn) { visibility: hidden; }

/* ---------- shell ---------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--paper);
  overflow: hidden;
  perspective: 1100px;
}
.preloader.is-gone { display: none; }

.night, .castle, .sky-gl, .motes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}
.night  { z-index: 0; background: linear-gradient(180deg, #3b3d68 0%, #8e6c8f 42%, #e7a387 70%, #f6cf98 100%); }
.ground {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  bottom: -2px;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(150, 112, 118, 0) 0, rgba(146, 110, 116, 0.7) 50px, rgba(126, 96, 104, 0.95) 130px, #765a64 240px, #6a505a 100%);
}

.stars {
  position: absolute;
  left: 0;
  right: 0;
  top: -12%;
  height: 155%;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  background: url("../assets/loader/sky/sunset-sky.webp?v=23") 50% 0 / cover no-repeat;
  will-change: transform, opacity;
}
.castle { z-index: 1; }
.castle img { display: none; }               /* sources only: the canvas below paints them */
.castle .pavilion-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sky-gl { z-index: 2; display: block; }
.motes  { z-index: 4; }

.veil {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(140vw, 1900px);
  aspect-ratio: 1.6;
  opacity: 0;
  z-index: 3;
  pointer-events: none;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}
.wisp {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(110vw, 1400px);
  aspect-ratio: 3 / 2;
  opacity: 0;
  z-index: 3;
  pointer-events: none;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

/* ---------- the logo ---------- */
.mark {
  position: relative;
  z-index: 5;
  display: grid;
  justify-items: center;
  gap: clamp(10px, 2.4vh, 22px);
  transform-style: preserve-3d;
  will-change: transform, filter, opacity;
}
.logo-wrap {
  position: relative;
  width: min(84vw, 590px);
  aspect-ratio: 2544 / 1040;     /* set exactly by the script */
}
.scratch, .ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.loading {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.55em;
  font-family: "Pinyon Script", "Snell Roundhand", "Apple Chancery", cursive;
  font-size: clamp(15px, 3.9vw, 19px);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--whisper);
  user-select: none;
  transition: opacity 0.6s ease;
}
.loading .pct { min-width: 2.6em; font-variant-numeric: tabular-nums; }
.loading .dots span { display: inline-block; animation: breathe 1.6s ease-in-out infinite; opacity: 0.25; }
.loading .dots span:nth-child(2) { animation-delay: 0.2s; }
.loading .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes breathe { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
.preloader.is-loaded .loading { opacity: 0; }

/* ---------- Enter Your Dream ---------- */
.enter {
  position: absolute;
  left: 50%;
  top: 70%;
  z-index: 8;
  width: clamp(112px, 24vw, 140px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: #fff;
  color: #111;
  font-family: "Italiana", "Didot", Georgia, serif;
  font-size: clamp(15px, 3.6vw, 17px);
  letter-spacing: 0.06em;
  line-height: 1.25;
  padding: 0 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.86);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35), 0 10px 40px rgba(170, 190, 255, 0.25);
  transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease,
              opacity 1.2s ease, transform 1.2s cubic-bezier(.2, .8, .2, 1);
}
.enter::after {                  /* a slow, soft halo */
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  animation: halo 3.2s ease-out infinite;
  pointer-events: none;
}
@keyframes halo { 0% { transform: scale(0.92); opacity: 0.8; } 100% { transform: scale(1.35); opacity: 0; } }
.enter:hover, .enter:focus-visible, .enter.is-holding { background: #111; color: #fff; border-color: #111; outline: none; }
.preloader.is-arrived .enter { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.enter {                                     /* press and hold: no text selection, no long-press menu */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.enter-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 18px;
  text-align: center;
  transition: opacity 0.35s ease;
}
.enter-label--hint {
  opacity: 0;
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
@media (hover: hover) {
  .enter:hover .enter-label--main { opacity: 0; }
  .enter:hover .enter-label--hint { opacity: 1; }
}
.enter.is-holding .enter-label--main { opacity: 0; }
.enter.is-holding .enter-label--hint { opacity: 1; }
/* the ring that draws itself while you hold */
.enter-ring {
  position: absolute;
  inset: -11px;
  width: calc(100% + 22px);
  height: calc(100% + 22px);
  transform: rotate(-90deg);
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(60, 40, 30, 0.35));
}
.enter-ring circle { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.enter-track { stroke: rgba(255, 255, 255, 0.32); }
.enter-progress { stroke: #fff; stroke-dasharray: 1; stroke-dashoffset: 1; stroke-linecap: round; }
.enter.is-holding::after { animation: none; opacity: 0; }
.preloader.is-entering .enter { opacity: 0; pointer-events: none; transition: opacity 0.45s ease; }

/* the warm sunset light we walk into, and the gentle arrival on the other side */
.enter-wash {
  position: fixed;
  inset: 0;
  z-index: 150;
  opacity: 0;
  pointer-events: none;
}
.enter-wash.is-clearing { transition: opacity 1.5s ease 0.15s; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- a phone held upright: a gentle note to turn it sideways ---------- */
.turn { display: none; }
@media (orientation: portrait) and (max-width: 600px) and (hover: none) {
  html:not(.turn-skipped) .turn { animation: turnIn 0.6s ease both; }
  html:not(.turn-skipped) .turn {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(251, 246, 240, 0.97);
    text-align: center;
    font-family: "DM Sans", Arial, sans-serif;
    color: #2a2522;
  }
}
.turn-card { max-width: 300px; }
.turn-phone { width: 76px; height: 76px; fill: none; stroke: #b88a49; stroke-width: 1.6; stroke-linecap: round; animation: turnPhone 2.6s ease-in-out infinite; }
@keyframes turnPhone { 0%, 20% { transform: rotate(0deg); } 50%, 75% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }
.turn-title { margin: 18px 0 0; font-family: "Italiana", "Didot", Georgia, serif; font-size: 26px; letter-spacing: 0.06em; text-transform: uppercase; }
.turn-text { margin: 10px 0 0; font-size: 14px; line-height: 1.6; color: #6b6058; }
.turn-skip {
  margin-top: 26px;
  padding: 12px 22px;
  border: 1px solid rgba(195, 154, 85, 0.6);
  border-radius: 999px;
  background: transparent;
  font: 11px/1 "DM Sans", Arial, sans-serif;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #2a2522;
}
@media (prefers-reduced-motion: reduce) { .turn-phone { animation: none; transform: rotate(-90deg); } }

/* "Skip intro": small and quiet, bottom right */
.skip-intro {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  padding: 9px 16px;
  border: 1px solid rgba(184, 138, 73, 0.55);
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.72);
  font: 500 10px/1 "DM Sans", Arial, sans-serif;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #2a2522;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.skip-intro:hover, .skip-intro:focus-visible { background: #b88a49; color: #fff; outline: none; }
.skip-intro[hidden] { display: none; }
@keyframes turnIn { from { opacity: 0; } to { opacity: 1; } }
