/*
 * endowline.com: one screen. A navy night, a cyan glow along a wandering horizon (horizon.js),
 * the logo, one line of display type and a footer on dark ground.
 * Layout and motion follow the Emerald Horizon background (AnimatedWebs), recoloured to the logo kit.
 *
 * Sections: fonts, tokens, base, sky, page, hero, footer, motion, narrow screens, reduced motion.
 */

/* Fonts: self-hosted so the CSP stays 'self' only (SIL OFL 1.1, fonts/OFL.txt). */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("/fonts/fraunces-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;
}

@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url("/fonts/fraunces-latin-italic.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;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/manrope-latin-wght.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;
}

/* Tokens. The logo kit's navy and cyan; the stage is a deeper navy so the glow has somewhere to go. */
:root {
  --bg: #020b13;
  --navy: #062032;
  --text: #eaf4fa;
  --muted: #a3b9c8;
  --accent: #22a3df;
  --accent-soft: #a8def7;
  --line: rgba(234, 244, 250, 0.14);

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: dark;
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: rgba(34, 163, 223, 0.38);
}

a {
  color: var(--accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--text);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Sky: the WebGL canvas over a CSS gradient in the same palette. The gradient is what shows
   while the canvas fades in, and the whole of the sky when WebGL is unavailable. */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(130% 58% at 50% 96%, #46bdf0 0%, #1680bd 22%, rgba(10, 92, 143, 0.5) 42%, rgba(2, 11, 19, 0) 68%),
    var(--bg);
}

.sky canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.6s ease;
}

.sky canvas.is-ready {
  opacity: 1;
}

.no-webgl .sky canvas {
  display: none;
}

/* The scrim: a soft darkening behind the headline, so the glow never competes with the type
   (it climbs higher on narrow screens, where the footer sits higher). */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(70% 42% at 50% 44%, rgba(2, 11, 19, 0.5) 0%, rgba(2, 11, 19, 0) 100%);
}

/* Page: the logo, the hero centred in the space left, the footer on the ground. */
.page {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "brand"
    "hero"
    "foot";
  padding: max(var(--gutter), env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right))
    max(var(--gutter), env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}

.brand {
  grid-area: brand;
  align-self: center;
}

.brand img {
  display: block;
  height: 26px;
  width: auto;
}

.brand a {
  display: inline-block;
}

/* Hero */
.hero {
  grid-area: hero;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 7vh 0 16vh;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 26px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.8s ease-out infinite;
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(46px, 10vw, 112px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-optical-sizing: auto;
  text-wrap: balance;
}

h1 em {
  display: block;
  font-style: italic;
  color: var(--accent-soft);
}

.lede {
  max-width: 34ch;
  margin: 28px auto 0;
  color: var(--muted);
  text-wrap: balance;
}

.lede a {
  white-space: nowrap;
}

/* Footer. Its top rule is the horizon: horizon.js lifts the glow to rise from this line,
   like the logo's rings from its base line, and the ground below it is dark so the line reads. */
.ground {
  grid-area: foot;
  position: relative;
  isolation: isolate;
  padding-top: 18px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

/* The ground and the rule run edge to edge, past the gutters, like a horizon. */
.ground::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  border-top: 1px solid rgba(34, 163, 223, 0.6);
  left: calc(-1 * max(var(--gutter), env(safe-area-inset-left)));
  right: calc(-1 * max(var(--gutter), env(safe-area-inset-right)));
  bottom: calc(-1 * max(var(--gutter), env(safe-area-inset-bottom)));
  background: linear-gradient(to bottom, rgba(2, 11, 19, 0.72) 0%, rgba(2, 11, 19, 0.9) 100%);
}

.copy {
  margin: 0;
  color: var(--muted);
}

/* Motion: the copy rises in once, in order; the status dot breathes. */
.rise {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 1s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.rise-0 { animation-delay: 0.1s; }
.rise-1 { animation-delay: 0.25s; }
.rise-2 { animation-delay: 0.35s; }
.rise-3 { animation-delay: 0.5s; }
.rise-4 { animation-delay: 0.65s; }

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 163, 223, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(34, 163, 223, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 163, 223, 0); }
}

/* Narrow screens: a smaller logo, eyebrow and lede. */
@media (max-width: 720px) {
  .brand img {
    height: 22px;
  }

  .hero {
    padding: 6vh 0 12vh;
  }

  .eyebrow {
    font-size: 11px;
    letter-spacing: 0.16em;
    margin-bottom: 20px;
  }

  .lede {
    font-size: 16px;
    margin-top: 22px;
  }
}

/* Reduced motion: no rise, no pulse, no fade; horizon.js draws one still frame. */
@media (prefers-reduced-motion: reduce) {
  .rise {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .eyebrow .dot {
    animation: none;
  }

  .sky canvas {
    transition: none;
  }
}
