/* ==========================================================================
   LAPERTOSA — style.css
   One dark scene: a deep field, one word at its centre, and whatever the
   pointer's light reveals. Tokens live in :root; main.js only writes transforms.
   ========================================================================== */

@font-face {
  font-family: "Megrim";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/megrim-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --abyss: #02040c;
  --deep: #050b22;
  --trench: #061a2a;
  --aqua: #5eead4;
  --pearl: #f3ecdd;
  --sand: #d8b98a;
  --word-size: clamp(2rem, min(11.5vw, 20vh), 14rem);          /* "lapertosa" in Megrim runs ~6.6em wide */
  --tracking: 0.19em;
}

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

html, body { height: 100%; margin: 0; }

html {
  background: var(--abyss);
  overscroll-behavior: none;
}

body {
  background: var(--abyss);
  color: var(--pearl);
  font-family: "Megrim", "Poiret One", "Josefin Sans", "Futura", "Century Gothic", sans-serif;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* main.js draws its own light where the pointer is */
html.has-cursor, html.has-cursor body { cursor: none; }

.scene {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

/* ---- parallax layers: main.js moves each one by its data-depth ---- */
.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform;
}

.sky {
  inset: -8%;
  z-index: 0;
  background:
    radial-gradient(60% 50% at 18% 22%, rgba(96, 60, 170, 0.16), transparent 70%),
    radial-gradient(55% 45% at 82% 34%, rgba(11, 92, 107, 0.28), transparent 70%),
    linear-gradient(180deg, var(--abyss) 0%, var(--deep) 42%, var(--trench) 100%);
}
.sky::before,
.sky::after {
  content: "";
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  will-change: transform;
}
.sky::before {
  left: -10%;
  top: 5%;
  background: radial-gradient(closest-side, rgba(94, 234, 212, 0.09), rgba(94, 234, 212, 0));
  animation: drift-a 28s ease-in-out infinite alternate;
}
.sky::after {
  right: -18%;
  top: 30%;
  background: radial-gradient(closest-side, rgba(150, 90, 200, 0.08), rgba(150, 90, 200, 0));
  animation: drift-b 34s ease-in-out infinite alternate;
}
@keyframes drift-a { from { transform: translate(0, 0) scale(1); }    to { transform: translate(14%, 10%) scale(1.25); } }
@keyframes drift-b { from { transform: translate(0, 0) scale(1.15); } to { transform: translate(-12%, -14%) scale(0.9); } }

/* ---- the word ---- */
.word-wrap {
  position: absolute;
  left: 0;
  right: 0;
  top: 47%;
  z-index: 2;
  margin-top: -0.5em;
  padding-inline: 16px;
  font-size: var(--word-size);
  line-height: 1;
  text-align: center;
  perspective: 900px;
  pointer-events: none;
  filter: drop-shadow(0 0 24px rgba(94, 234, 212, 0.16)) drop-shadow(0 3px 10px rgba(1, 3, 10, 0.7));
}
.word {
  display: inline-block;
  position: relative;
  margin: 0;
  font-size: inherit;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;                                       /* spacing is a margin on each letter: nested inline-blocks would apply letter-spacing three times */
  padding-inline-start: var(--tracking);                   /* balances the gap after the last letter */
  white-space: nowrap;
  will-change: transform;
}
.l {
  display: inline-block;
  margin-inline-end: var(--tracking);
  animation: letter-in 1.8s cubic-bezier(0.2, 0.75, 0.2, 1) both;
  animation-delay: calc(0.4s + var(--i) * 100ms);
}
.g {
  display: inline-block;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0) 44%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0) 56%) no-repeat,
    linear-gradient(180deg, #f6efe0 0%, var(--pearl) 34%, #e0c79c 62%, var(--sand) 76%, #7fd9c9 100%);
  background-size: 300% 100%, 100% 100%;
  background-position: 100% 0, 0 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  will-change: transform;
  animation: shimmer 9s ease-in-out infinite;
  animation-delay: calc(2.8s + var(--i) * 110ms);
}
@keyframes letter-in {
  from { opacity: 0; transform: translateY(0.5em); filter: blur(14px); }
  55%  { filter: blur(0); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes shimmer {
  0%, 66% { background-position: 100% 0, 0 0; }
  100%    { background-position: 0% 0, 0 0; }
}

/* ---- canvas: geometry, bubbles, light shafts, the pointer light ---- */
.sea {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  width: 100%;
  height: 100%;
}

/* ---- vignette and film grain ---- */
.veil {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(120% 95% at 50% 46%, rgba(1, 3, 10, 0) 40%, rgba(1, 3, 10, 0.82) 100%);
}
.grain {
  position: absolute;
  inset: -30%;
  z-index: 5;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0.33 0.33 0.33 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.4s steps(7) infinite;
}
@keyframes grain { to { transform: translate(-9%, 7%); } }

/* ---- small screens ---- */
@media (max-width: 640px) {
  :root { --tracking: 0.15em; --word-size: clamp(1.8rem, min(14.5vw, 20vh), 14rem); }
  .word-wrap { padding-inline: 12px; }
}

/* ---- quieter for people who asked for less motion ---- */
@media (prefers-reduced-motion: reduce) {
  .l, .g, .sky::before, .sky::after, .grain { animation: none; }
}
