/* Digital Altar — page 1 (home)
   Layout is built from the Canva design (1440 x 810). Positions are percentages of the
   stage, so everything scales together. Mobile (<= 760px) uses its own arrangement. */

@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/eb-garamond-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #ffffff;
  --accent: #6fd0da;
  --night: #0b0618;
  --font-body: "EB Garamond", Garamond, "Times New Roman", serif;
}

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

html { background: var(--night); }

body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-text-size-adjust: 100%;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: #fff;
  color: #1a1030;
  font: 600 1rem/1.2 system-ui, sans-serif;
  border-radius: 0.4rem;
  text-decoration: none;
}
.skip-link:focus { top: 0.75rem; outline: 3px solid var(--accent); outline-offset: 2px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- Stage ---------- */
.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  container-type: size;
  background: var(--night) url("../assets/nebula.webp") center / cover no-repeat;
}

.title {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 0;
  translate: -50% -8%;
  width: min(78.05cqw, 138.7cqh);
  margin: 0;
  line-height: 0;
}
.title img { display: block; width: 100%; height: auto; }

/* ---------- Clouds ---------- */
.cloud { position: absolute; display: block; height: auto; pointer-events: none; user-select: none; }
.cloud-top {
  z-index: 3;
  left: 46.43%;
  top: -5.88cqw;
  width: 56.1%;
  opacity: 0.8;
  --from: -182.8%; --to: 95.5%;
  animation: drift 260s linear -155.8s infinite;
}
.cloud-bottom {
  z-index: 5;
  left: -6.43%;
  bottom: -21.98cqw;
  width: 65.4%;
  --from: -90.2%; --to: 162.7%;
  animation: drift 320s linear -72.1s infinite;
}

/* ---------- Butterflies and sparkles ---------- */
.deco {
  position: absolute;
  display: block;
  height: auto;
  left: var(--x);
  top: var(--y);
  width: min(calc(var(--wn) * 1cqw), calc(var(--wn) * 1.7778cqh));
  translate: -50% -50%;
  pointer-events: none;
  user-select: none;
}
.butterfly { z-index: 4; pointer-events: auto; }
.butterfly .still { display: block; width: 100%; height: auto; }
.sparkle {
  z-index: 6;
  opacity: 0.4;
  animation: twinkle 11s ease-in-out calc(var(--d, 0s) * -2.6) infinite;
}
.sparkle.soft { opacity: 0.6; animation-name: twinkle-soft; animation-duration: 15s; }

/* ---------- Quote ---------- */
.quote {
  position: absolute;
  z-index: 7;
  left: 63.75%;
  top: 55.25%;
  width: max-content;
  max-width: 34%;
  margin: 0;
  font-family: var(--font-body);
  font-size: min(1.44cqw, 2.56cqh);
  line-height: 1.22;
  letter-spacing: 0.03em;
  color: var(--ink);
}
.quote blockquote { margin: 0; }
.quote p { margin: 0; }
.quote .line { display: block; }
.quote .gap { margin-top: 1.2em; }
.quote .accent { color: var(--accent); }
.quote figcaption {
  margin-top: 1.4em;
  text-align: right;
  font-size: 0.72em;
  letter-spacing: 0.02em;
}
.quote cite { font-style: normal; }

/* ---------- Motion (subtle; switched off for reduced motion) ---------- */
@keyframes twinkle {
  0%, 62%, 100% { opacity: 0.4; }
  74%           { opacity: 1; }
  88%           { opacity: 0.5; }
}
@keyframes twinkle-soft {
  0%, 62%, 100% { opacity: 0.6; }
  74%           { opacity: 1; }
  88%           { opacity: 0.65; }
}
@keyframes drift {
  from { transform: translateX(var(--from)); }
  to   { transform: translateX(var(--to)); }
}
@media (prefers-reduced-motion: reduce) {
  .butterfly, .sparkle, .cloud { animation: none !important; }
  .sparkle { opacity: 0.85; }
}

/* ---------- Portrait screens (phones, iPad upright, narrow windows) ---------- */
@media (max-aspect-ratio: 6/5), (max-width: 760px) {
  .title { width: 90cqw; translate: -50% -8%; }
  .cloud-top {
    left: 28%; top: -4cqw; width: 90%;
    --from: -131.1%; --to: 80%;
    animation-duration: 220s; animation-delay: -144.7s;     /* starts at the same spot relative to the logo as on desktop */
  }
  .cloud-bottom {
    left: -18%; top: auto; bottom: -30cqw; width: 105%;
    --from: -82.9%; --to: 112.4%;
    animation-duration: 280s; animation-delay: -71.7s;     /* starts half off the left edge */
  }

  .deco { left: var(--mx, var(--x)); top: var(--my, var(--y)); width: calc(var(--mwn, var(--wn)) * 1cqw); }

  .quote {
    left: 40%;
    top: 64%;
    max-width: 56%;
    font-size: clamp(13px, 3.8cqw, 18px);
    line-height: 1.25;
    letter-spacing: 0.02em;
  }
}

/* iPad and other large upright screens: roomier proportions, bigger poem */
@media (min-width: 600px) and (max-aspect-ratio: 6/5) {
  .quote { top: 62%; font-size: 3cqw; }
}

/* Phones: one screen tall (no extra scrolling); bigger butterflies that may run off the edges;
   poem sits in the bottom-right corner. */
@media (max-width: 599px) {

  .cloud-top {
    left: 28%; top: -4cqw; width: 108%;
    --from: -125.9%; --to: 66.7%;
    animation-delay: -144.7s;
  }
  .cloud-bottom {
    left: -18%; top: auto; bottom: -34cqw; width: 126%;
    --from: -85.7%; --to: 93.7%;
    animation-delay: -78s;
  }

  .b1 { --mx: 22% !important; --my: 29% !important; --mwn: 30 !important; }
  .b2 { --mx: 58% !important; --my: 25% !important; --mwn: 29 !important; }
  .b3 { --mx: 92% !important; --my: 38% !important; --mwn: 21 !important; }
  .b4 { --mx:  6% !important; --my: 46% !important; --mwn: 20 !important; }
  .b5 { --mx: 32% !important; --my: 50% !important; --mwn: 25 !important; }
  .b6 { --mx: 82% !important; --my: 51% !important; --mwn: 20 !important; }

  .quote {
    top: auto;
    left: auto;
    right: 6%;
    bottom: 11%;
    max-width: 88%;
    font-size: clamp(15px, 4.5cqw, 20px);
  }
}
