/*
 * hydrology — coming-soon page. Nocturne tokens (dark only), Montserrat 400/500/600
 * self-hosted. Nothing inline in the HTML: the CSP only allows this file and no scripts.
 * Motion: transform/opacity only, entrance once, two slow ambient loops; all of it
 * lives under prefers-reduced-motion: no-preference.
 */

/* ---------- Fonts (latin subset, OFL-1.1, see /static/fonts/LICENSE.txt) ---------- */

@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/montserrat-latin-400-normal-BLhwKU8k.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;
}

/* 500 is used once (the "hydrology" voice name, spec §2.2.5); not preloaded. */
@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/montserrat-latin-500-normal-DRFEGfly.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: Montserrat;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/montserrat-latin-600-normal-UVxSCcoG.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;
}

/* Metric-matched fallbacks so the swap does not move a line: design/font-metrics.mjs
   gives the base ratios (114.5 % / 116.3 % / 109.2 %); they are trimmed by the ~2.4 %
   drift design/qa-screens.mjs measures on this page's own es-MX copy. */
@font-face {
  font-family: "Montserrat Fallback";
  font-weight: 400;
  src: local("Arial"), local("Liberation Sans"), local("Helvetica Neue");
  size-adjust: 111.82%;
  ascent-override: 86.57%;
  descent-override: 22.45%;
  line-gap-override: 0%;
}

/* 500 is set on one word ("hydrology"), so its face is tuned to that word. */
@font-face {
  font-family: "Montserrat Fallback";
  font-weight: 500;
  src: local("Arial"), local("Liberation Sans"), local("Helvetica Neue");
  size-adjust: 117.43%;
  ascent-override: 82.43%;
  descent-override: 21.37%;
  line-gap-override: 0%;
}

/* Uppercase kicker: Arial capitals run ~6.6 % wider than Montserrat's at the body
   size-adjust, so the kicker uses this face and keeps its line count before the swap. */
@font-face {
  font-family: "Montserrat Fallback Caps";
  font-weight: 400;
  src: local("Arial"), local("Liberation Sans"), local("Helvetica Neue");
  size-adjust: 104.93%;
  ascent-override: 92.25%;
  descent-override: 23.92%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  font-weight: 600;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("Helvetica Neue Bold");
  size-adjust: 106.53%;
  ascent-override: 90.87%;
  descent-override: 23.56%;
  line-gap-override: 0%;
}

/* ---------- Tokens (spec §2.1) ---------- */

:root {
  color-scheme: dark;

  --bg: #000;
  --tile: #0b0b0b;
  --line-nav: #141414;
  --line-card: #1c1c1c;
  --line-em: #202020;
  --line-strong: #333;
  --text: #fff;
  --text-4: #cfcfcf;
  --text-5: #b0b0b0;
  --muted: #9a9a9a;
  --faint: #767676;

  --font: Montserrat, "Montserrat Fallback", system-ui, sans-serif;
  --gutter: 16px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Page gutter per breakpoint (spec §2.1.6): phone 16 · tablet 24 (< 900) / 32 · desktop 56. */
@media (min-width: 48rem) {
  :root { --gutter: 24px; }
}

@media (min-width: 56.25rem) {
  :root { --gutter: 32px; }
}

@media (min-width: 64rem) {
  :root { --gutter: 56px; }
}

/* ---------- Base ---------- */

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

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  font: 400 0.9375rem/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

h1,
p {
  margin: 0;
}

a {
  color: var(--text);
  text-underline-offset: 0.2em;
}

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

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

::selection {
  background: rgba(255, 255, 255, 0.3);
}

.wrap {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The mark: circle stroke 7/100 + lower half-disc r33 (spec §2.2.1), currentColor. */
.mark {
  display: block;
  flex: none;
  color: var(--text);
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--line-nav);
}

.site-header .wrap {
  display: flex;
  /* Large text (a phone at 4x, Safari's text-only zoom): the brand and the language links wrap onto
     two rows instead of running 300 px past the screen. `row-gap` only: a single row is unchanged. */
  flex-wrap: wrap;
  row-gap: 8px;
  align-items: center;
  min-height: 72px;
  padding-block: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 1.3125rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.brand .mark {
  width: 26px;
  height: 26px;
}

/* At 4x text the wordmark alone is wider than a phone: it may break inside the word rather than
   widen the page (a no-op at any size where it fits). */
.brand {
  min-width: 0;
}

.brand span {
  overflow-wrap: anywhere;
}

/* ---------- Language switch (ES | EN, links to the twin address) ----------
   The look of the app's LangSwitch (src/components/segmented/Segmented.module.css, `sm`), which the
   coming-soon page uses: 1px #202020 box, r8, no gap or padding around the options, 13px/500 at
   6x10 (34 tall), the selected one white with a 1px white inset ring and no fill. */

.lang {
  display: inline-flex;
  margin-left: auto;
  overflow: hidden;
  border: 1px solid var(--line-em);
  border-radius: 8px;
  font-weight: 500;
}

.lang a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
}

.lang a[aria-current] {
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--text);
}

@media (hover: hover) and (pointer: fine) {
  .lang a:hover {
    color: var(--text);
  }

  .lang a:not([aria-current]):hover {
    background: rgba(255, 255, 255, 0.07);
  }
}

/* ---------- Hero ---------- */

main {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  flex: 1 0 auto;
  overflow: hidden;
}

.hero {
  position: relative;
  z-index: 1;
  /* A flex item of `main` (overflow hidden): at 4x text its longest word would set its width and
     the headline would be cut at the screen edge. It shrinks to the page; long words break. */
  min-width: 0;
  padding-block: clamp(3rem, 9vh, 5.5rem) clamp(3rem, 9vh, 5rem);
}

.hero :is(.kicker, h1, .lead) {
  overflow-wrap: break-word;
}

.kicker {
  margin-bottom: 24px;
  font-family: Montserrat, "Montserrat Fallback Caps", system-ui, sans-serif;
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-wrap: balance;
}

h1 {
  margin-bottom: 22px;
  font-size: clamp(2rem, 1.25rem + 3.6vw, 3.375rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.lead {
  max-width: 520px;
  margin-bottom: 40px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-5);
  text-wrap: pretty;
}

.status {
  max-width: 560px;
  padding-top: 24px;
  border-top: 1px solid var(--line-em);
}

/* AI-voice pattern: mark + "hydrology" (500) + badge, 12.5 px (spec §2.2.3, §2.2.5). */
.voice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.78125rem;
  color: var(--muted);
}

.voice .mark {
  width: 16px;
  height: 16px;
}

.voice-name {
  font-weight: 500;
  color: var(--text);
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

/* AI-voice note: 14.5/1.6 #cfcfcf (spec §2.2.5). */
.note {
  font-size: 0.90625rem;
  line-height: 1.6;
  color: var(--text-4);
  text-wrap: pretty;
}

/* Ambient mark: a hairline version of the brand mark, behind the hero. Decorative. */
.ambient {
  position: absolute;
  z-index: 0;
  top: 50%;
  right: calc(-0.25 * var(--w));
  width: var(--w);
  height: var(--w);
  --w: clamp(320px, 56vmin, 680px);
  translate: 0 -50%;
  perspective: 1400px;
  pointer-events: none;
  color: var(--line-card);
}

.ambient svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ambient-disc {
  fill: var(--tile);
}

/* ---------- Installers page: three blocks ---------- */

.blocks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 980px;
  margin: 0 0 40px;
  padding: 0;
  list-style: none;
}

.block {
  padding: 20px 22px;
  border: 1px solid var(--line-card);
  border-radius: 14px;
}

.block h2 {
  margin: 0 0 8px;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.block p {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text-5);
}

/* ---------- 404 ---------- */

.hero-error .lead {
  margin-bottom: 32px;
}

/* Nocturne .btn-primary: 1px white outline, hover fills white/black (spec D9). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: 1px solid #fff;
  border-radius: 8px;
}

.btn:hover {
  color: #000;
  background: #fff;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line-nav);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap; /* as the header: large text wraps the row instead of widening the page */
  align-items: center;
  gap: 16px;
  padding-block: 24px calc(28px + env(safe-area-inset-bottom));
  font-size: 0.78125rem;
  color: var(--faint);
}

.site-footer .mark {
  width: 18px;
  height: 18px;
}

/* ---------- Tablet (< 1024): keep the ring clear of the headline ---------- */

@media (max-width: 63.9375rem) {
  .ambient {
    right: calc(-0.45 * var(--w));
  }

  .blocks {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Phones (< 768) ---------- */

@media (max-width: 47.9375rem) {
  .site-header .wrap {
    min-height: 60px;
    padding-block: 12px;
  }

  .brand {
    font-size: 1.25rem;
  }

  .brand .mark {
    width: 24px;
    height: 24px;
  }

  .kicker {
    margin-bottom: 18px;
  }

  /* two real 44 x 44 targets, like the app's switch on a phone (SoonPage.module.css) */
  .lang a {
    min-width: 44px;
    min-height: 44px;
    padding: 0 14px;
  }

  .ambient {
    top: auto;
    bottom: -12%;
    right: -38%;
    translate: none;
    --w: min(88vw, 360px);
  }
}

/* ---------- Motion (only when the visitor allows it) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .in {
    animation: hy-in 0.6s var(--ease) both;
  }

  .in-3d {
    animation-name: hy-in-3d;
  }

  .d1 { animation-delay: 0.06s; }
  .d2 { animation-delay: 0.14s; }
  .d3 { animation-delay: 0.24s; }
  .d4 { animation-delay: 0.34s; }

  /* The header mark fills from the bottom once, like a level rising. */
  .mark-fill {
    animation: hy-rise 1.3s var(--ease) 0.15s both;
  }

  .pulse {
    animation: hy-pulse 1.8s ease-in-out infinite;
  }

  .ambient {
    animation: hy-fade 1.8s ease 0.4s both;
  }

  .ambient svg {
    animation: hy-tilt 38s ease-in-out infinite alternate;
    will-change: transform;
  }

  a,
  .btn {
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
  }
}

@keyframes hy-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes hy-in-3d {
  from { opacity: 0; transform: perspective(900px) translateY(14px) rotateX(7deg); }
  to { opacity: 1; transform: none; }
}

@keyframes hy-rise {
  from { transform: translateY(44px); }
  to { transform: none; }
}

@keyframes hy-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

@keyframes hy-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes hy-tilt {
  from { transform: rotateX(16deg) rotateY(-24deg); }
  to { transform: rotateX(-12deg) rotateY(18deg); }
}

/* ---------- Windows High Contrast / forced colors ---------- */

@media (forced-colors: active) {
  /* Decorative: the ambient ring, and the footer's white .svg file (an <img>, so it
     cannot take the forced text colour and would vanish on a light Canvas). */
  .ambient,
  .site-footer img {
    display: none;
  }

  /* Chromium does not force `color` on SVG roots, so currentColor would stay #fff. */
  .mark {
    color: CanvasText;
  }

  /* box-shadow is dropped: fill the selected option like the app's switch (Highlight) */
  .lang a[aria-current] {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }

  a .mark {
    color: LinkText;
  }
}
