/* ekstr.net landing page. Light = sunrise, dark = dusk (follows the system theme).
   No inline styles and no external origins: the CSP in _headers allows 'self' only. */

@font-face {
  font-family: "Fredoka";
  src: url("/fonts/fredoka-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}

:root {
  color-scheme: light dark;

  /* Light: sunrise */
  --sky-0: #ffd9b8;
  --sky-1: #ffe6c4;
  --sky-2: #fff3d6;
  --ink: #4a1f3d;
  --ink-soft: #5e2a4d;
  --panel: rgba(255, 243, 214, 0.9);
  --halo: #ffe6c4;
  --glow: #ffd27a;
  --sun-body: #ffc84d;
  --moon-body: #fff1c9;
  --crater: #f0dca6;
  --face: #7a3b2e;
  --blush: #ff8a7a;
  --cloud: #fffdf8;
  --hill-1: #f9b9a1;
  --hill-2: #f59a8a;
  --hill-3: #bcd6a6;
  --hill-4: #8fb98b;
  --trunk: #8a5a4a;
  --crown-a: #e98a7c;
  --crown-b: #a9c993;
  --crown-c: #6fa37a;
  --dot-a: #ff7a6b;
  --dot-b: #ffe08a;
  --bird: #7a3b2e;
  --star-display: none;
  --sun-display: inline;
  --moon-display: none;
  --bird-display: inline;
  --mx: 0;
  --my: 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark: dusk */
    --sky-0: #14103a;
    --sky-1: #2a1e5c;
    --sky-2: #5b3a8c;
    --ink: #fff3e0;
    --ink-soft: #efe4fb;
    --panel: rgba(20, 16, 58, 0.9);
    --halo: #2a1e5c;
    --glow: #b9a4ff;
    --cloud: #4a3f8f;
    --hill-1: #4b3b8f;
    --hill-2: #3a4a96;
    --hill-3: #1f6f78;
    --hill-4: #16525c;
    --trunk: #0e3340;
    --crown-a: #5a47a8;
    --crown-b: #2a8a8a;
    --crown-c: #1f6670;
    --dot-a: #ffe08a;
    --dot-b: #9be7e0;
    --face: #5a4a2e;
    --blush: #f4a9a0;
    --star-display: inline;
    --sun-display: none;
    --moon-display: inline;
    --bird-display: none;
  }
}

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

html { background: var(--sky-1); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Fredoka", ui-rounded, "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--sky-1);
}

/* Scene: gradient sky + SVG landscape, fixed behind the content */
.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(to bottom, var(--sky-0) 0%, var(--sky-1) 55%, var(--sky-2) 100%);
}
.scene-svg { display: block; width: 100%; height: 100%; }

.glow { opacity: 0.55; }
.glow-in { stop-color: var(--glow); stop-opacity: 0.75; }
.glow-out { stop-color: var(--glow); stop-opacity: 0; }

.stars, .star { display: var(--star-display); }
.star { fill: #fff8e7; opacity: 0.85; }

.sun { display: var(--sun-display); }
.moon { display: var(--moon-display); }
.sun-body { fill: var(--sun-body); }
.moon-body { fill: var(--moon-body); }
.crater { fill: var(--crater); }
.eye, .mouth { fill: none; stroke: var(--face); stroke-width: 5; stroke-linecap: round; }
.cloud .eye, .cloud .mouth { stroke-width: 3; }
.blush { fill: var(--blush); opacity: 0.65; }
.cloud { fill: var(--cloud); opacity: 0.94; }
.cloud .eye, .cloud .mouth { stroke: #7a5a8a; }

.birds { display: var(--bird-display); }
.bird { fill: none; stroke: var(--bird); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.h1 { fill: var(--hill-1); }
.h2 { fill: var(--hill-2); }
.h3 { fill: var(--hill-3); }
.h4 { fill: var(--hill-4); }
.trunk { fill: var(--trunk); }
.tr-a .crown { fill: var(--crown-a); }
.tr-b .crown { fill: var(--crown-b); }
.tr-c .crown { fill: var(--crown-c); }
.dot-a { fill: var(--dot-a); }
.dot-b { fill: var(--dot-b); }

/* Content */
.content {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12vh 1.25rem 2rem;
  padding-top: 12svh;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 2rem + 8vw, 8rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
  overflow-wrap: anywhere;
  text-shadow: 0 0 0.1em var(--halo), 0 0 0.3em var(--halo), 0 0 0.8em var(--halo);
}

p {
  margin: 0.75rem 0 0;
  font-size: clamp(1.25rem, 1rem + 1.6vw, 1.9rem);
  font-weight: 400;
  line-height: 1.35;
  color: var(--ink-soft);
  text-wrap: balance;
  overflow-wrap: anywhere;
  text-shadow: 0 0 0.12em var(--halo), 0 0 0.12em var(--halo), 0 0 0.4em var(--halo), 0 0 1em var(--halo);
}

a {
  color: var(--ink);
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.2em;
}
a.back {
  display: inline-block;
  min-height: 44px;
  padding: 0.35em 1.1em;
  border-radius: 999px;
  background: var(--panel);
  text-decoration: none;
  border: 2px solid var(--ink);
}
a.back:hover { text-decoration: underline; }
a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
  border-radius: 6px;
}

/* Short viewports: the landscape moves behind the text, so give it a calm backing */
@media (max-height: 520px) {
  .content { display: grid; justify-content: center; align-content: start; padding-top: 1rem; }
  h1, p { background: var(--panel); }
  h1 { padding: 0.15em 0.4em 0; border-radius: 24px 24px 0 0; }
  p { margin-top: 0; padding: 0.2em 0.8em 0.5em; border-radius: 0 0 24px 24px; }
}

/* Motion: only for visitors who have not asked for less of it */
@media (prefers-reduced-motion: no-preference) {
  .layer { transition: transform 0.7s ease-out; will-change: transform; }
  .l-sky   { transform: translate(calc(var(--mx) * -5px),  calc(var(--my) * -3px)); }
  .l-far   { transform: translate(calc(var(--mx) * -10px), calc(var(--my) * -4px)); }
  .l-mid   { transform: translate(calc(var(--mx) * -18px), calc(var(--my) * -6px)); }
  .l-near  { transform: translate(calc(var(--mx) * -28px), calc(var(--my) * -8px)); }
  .l-front { transform: translate(calc(var(--mx) * -40px), calc(var(--my) * -10px)); }

  .drift { animation: drift 60s ease-in-out infinite alternate; }
  .d2 { animation-duration: 80s; animation-delay: -20s; }
  .d3 { animation-duration: 100s; animation-delay: -45s; }
  @keyframes drift {
    from { transform: translateX(-45px); }
    to   { transform: translateX(45px); }
  }

  .sun-body, .moon-body { transform-box: fill-box; transform-origin: center; animation: breathe 9s ease-in-out infinite; }
  @keyframes breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.03); }
  }

  .star { animation: twinkle 6s ease-in-out infinite alternate; }
  .star:nth-child(3n)   { animation-duration: 8s; animation-delay: -2s; }
  .star:nth-child(3n+1) { animation-duration: 5s; animation-delay: -4s; }
  @keyframes twinkle {
    from { opacity: 0.4; }
    to   { opacity: 1; }
  }
}

/* Forced colors (Windows High Contrast): drop the artwork, keep the words */
@media (forced-colors: active) {
  .scene { display: none; }
  html, body { background: Canvas; color: CanvasText; }
  h1, p, a { color: CanvasText; background: none; text-shadow: none; }
}
