/* ==========================================================================
   Vilumi · Coming soon

   1. Brand tokens   copied unchanged from the brand kit (tokens/vilumi-tokens.css)
   2. Fonts          self-hosted, only the three weights this page uses
   3. Page settings  sizes, spacing and timing, all built on the tokens
   4. Base
   5. Layout         the sky, the horizon line, the footer below it
   6. Logo
   7. Copy
   8. Signup form
   9. Motion         the sunrise, the water, the slow dawn
   ========================================================================== */


/* 1. Brand tokens --------------------------------------------------------- */

/* Vilumi brand tokens, v1 (2026-11-28) */
:root {
  /* Palette: Deep Water Light, signature */
  --vilumi-mist: #E8E7E1;      /* Morning Mist: main light ground, ~52% */
  --vilumi-fog: #C3D0D6;       /* Fog: brand light blue, color blocks, ~18% */
  --vilumi-tide: #1F3242;      /* Deep Tide: text, headlines, dark moments, ~15% */
  --vilumi-harbor: #5D7A8C;    /* Harbor: labels, lines, secondary data, ~6% */
  --vilumi-sand: #C9B08A;      /* Sand: accent, buttons, the sun, ~9%. Never text on light grounds */
  --vilumi-ink: #121C26;       /* Text on Sand buttons */

  /* Signature Dawn gradient: use once per piece */
  --vilumi-dawn: linear-gradient(180deg, #B9C9D1 0%, #D6DCDD 38%, #E8E4DA 62%, #E3CFAE 100%);

  /* Type */
  --vilumi-font-logo: "Jost", "Futura", "Century Gothic", sans-serif;           /* logo only */
  --vilumi-font-head: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;   /* headlines */
  --vilumi-font-body: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;      /* body, UI */

  /* Type scale (major third, 1.25). Desktop / phone in px */
  --vilumi-size-display: 76px;  /* phone 49 · Schibsted Medium 500 · -1.5% · lh 1.0 */
  --vilumi-size-h1: 61px;       /* phone 39 · Medium 500 · -1.5% · lh 1.05 */
  --vilumi-size-h2: 49px;       /* phone 31 · Medium 500 · -1% · lh 1.1 */
  --vilumi-size-h3: 39px;       /* phone 25 · Regular 400 · -1% · lh 1.15 */
  --vilumi-size-h4: 31px;       /* phone 20 · Regular 400 · -0.5% · lh 1.2 */
  --vilumi-size-lead: 20px;     /* phone 18 · Hanken 400 · lh 1.5 */
  --vilumi-size-body: 16px;     /* Hanken 400 · lh 1.6 · max ~65 characters per line */
  --vilumi-size-small: 14px;    /* Hanken 400 · lh 1.5 */
  --vilumi-size-label: 12px;    /* phone 11 · Hanken SemiBold 600 · +14% · uppercase */
  --vilumi-size-data: 72px;     /* phone 56 · Schibsted Medium · tabular numbers */
  --vilumi-logo-tracking: 0.32em; /* wordmark letter spacing (Jost Regular, capitals) */
}


/* 2. Fonts ----------------------------------------------------------------
   The logo is outlined in the SVG, so Jost is not loaded. */

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("assets/fonts/SchibstedGrotesk-Medium.woff2") format("woff2"),
       url("assets/fonts/SchibstedGrotesk-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Hanken Grotesk";
  src: url("assets/fonts/HankenGrotesk-Regular.woff2") format("woff2"),
       url("assets/fonts/HankenGrotesk-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Hanken Grotesk";
  src: url("assets/fonts/HankenGrotesk-Medium.woff2") format("woff2"),
       url("assets/fonts/HankenGrotesk-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}


/* 3. Page settings -------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Type: desktop sizes from the scale (phone sizes are set in the media query below) */
  --headline-size: var(--vilumi-size-h2);   /* 49 */
  --lead-size: var(--vilumi-size-lead);     /* 20 */

  /* Logo: the stacked lockup. At 354 px wide the wordmark is 320 px and the symbol 143 px */
  --logo-width: 354px;

  /* The page horizon: where it sits and how strong it is */
  --below-horizon: 20vh;                    /* the line sits about 80% down */
  --horizon-opacity: 0.3;

  /* Spacing */
  --gutter: 32px;
  --space-top: clamp(40px, 7vh, 96px);
  --space-bottom: clamp(24px, 4vh, 56px);
  --gap-logo: 44px;                         /* always more than the sun's height (logo clear space) */
  --gap-lead: 16px;
  --gap-form: 32px;

  /* Form */
  --control-height: 52px;
  --form-height: var(--control-height);     /* taller on phones, where the form stacks */

  /* Timing of the sunrise, in order */
  --t-horizon: 0.1s;                        /* the symbol's horizon draws in (0.8 s) */
  --t-sun: 0.5s;                            /* the sun starts to rise (1.8 s) */
  --t-water: 1.5s;                          /* first water line; the second follows */
  --t-content: 1.3s;                        /* wordmark, then headline, text, form: they begin
                                               as the sun nears the top, so nobody waits for the words */
  --stagger: 120ms;
  --ease-rise: cubic-bezier(0.22, 0.61, 0.36, 1);   /* gentle ease-out */
}

@supports (height: 1svh) {
  :root {
    --below-horizon: 20svh;
    --space-top: clamp(40px, 7svh, 96px);
    --space-bottom: clamp(24px, 4svh, 56px);
  }
}

/* Phones: phone sizes from the scale, a smaller logo, a stacked form */
@media (max-width: 600px) {
  :root {
    --headline-size: 31px;                  /* H2, phone */
    --lead-size: 18px;                      /* Lead, phone */
    --logo-width: 273px;                    /* symbol 110 px wide */
    --gutter: 24px;
    --gap-logo: 36px;
    --gap-lead: 14px;
    --gap-form: 28px;
    --form-height: calc(var(--control-height) * 2 + 12px);
  }
}

/* Short desktop windows: tighten the spacing so it still fits on one screen */
@media (min-width: 601px) and (max-height: 700px) {
  :root {
    --space-top: 36px;                      /* never less than the sun's height above the logo */
    --space-bottom: 8px;
    --gap-logo: 38px;
    --gap-form: 24px;
    --below-horizon: 16vh;
  }
}


/* 4. Base ----------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--vilumi-fog);      /* shows only if the page is pulled past its edge */
}

body {
  margin: 0;
  font-family: var(--vilumi-font-body);
  font-size: var(--vilumi-size-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--vilumi-tide);
}

h1,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--vilumi-tide);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}


/* 5. Layout ---------------------------------------------------------------
   One Dawn gradient, edge to edge. Two rows: everything above the horizon,
   and the footer below it. The horizon is the line between the two, so it
   can never cross any text. */

.page {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--vilumi-dawn);
  overflow: hidden;
}

/* The morning getting a little brighter: a faint sand glow low in the sky.
   Invisible until section 9 animates it. */
.page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, transparent 30%, var(--vilumi-sand) 135%);
  opacity: 0;
  pointer-events: none;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: var(--space-top);
  padding-bottom: var(--space-bottom);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  text-align: center;
}

.footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: max(var(--below-horizon), 88px);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* The horizon line, full width */
.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--vilumi-tide);
  opacity: var(--horizon-opacity);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 32px;
  font-size: var(--vilumi-size-small);
  line-height: 1.5;
  color: var(--vilumi-harbor);
}

.footer__link {
  padding: 12px 0;                          /* a comfortable target for thumbs */
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.footer__link:hover {
  color: var(--vilumi-tide);
}


/* 6. Logo -----------------------------------------------------------------
   On the Dawn gradient: Deep Tide, and the sun stays Sand. */

.logo {
  display: block;
  width: var(--logo-width);
  max-width: 100%;
  height: auto;
  flex: none;
  color: var(--vilumi-tide);
  overflow: visible;
}

.sun {
  fill: var(--vilumi-sand);
}


/* 7. Copy ----------------------------------------------------------------- */

.headline {
  max-width: 16em;
  margin-top: var(--gap-logo);
  font-family: var(--vilumi-font-head);
  font-size: var(--headline-size);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--vilumi-tide);
  text-wrap: balance;
}

.lead {
  max-width: 490px;                         /* breaks after the first sentence on desktop */
  margin-top: var(--gap-lead);
  font-size: var(--lead-size);
  line-height: 1.5;
  color: var(--vilumi-tide);
  color: color-mix(in srgb, var(--vilumi-tide) 80%, transparent);
  text-wrap: pretty;
}

@media (max-width: 600px) {
  .lead {
    max-width: 21em;                        /* keeps the same three calm lines on wider phones */
  }
}


/* 8. Signup form ---------------------------------------------------------- */

.signup {
  width: 100%;
  max-width: 440px;
  margin-top: var(--gap-form);
}

.signup__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.signup__input,
.signup__button {
  height: var(--control-height);
  margin: 0;
  border-radius: 999px;
  font-family: var(--vilumi-font-body);
  font-size: var(--vilumi-size-body);       /* 16 px also stops phones zooming in on focus */
  line-height: 1.2;
  -webkit-appearance: none;
  appearance: none;
}

.signup__input {
  width: 100%;
  min-width: 0;
  padding: 0 22px;
  border: 1px solid var(--vilumi-harbor);
  border-color: color-mix(in srgb, var(--vilumi-harbor) 40%, transparent);
  background-color: var(--vilumi-mist);
  background-clip: padding-box;
  color: var(--vilumi-tide);
  font-weight: 400;
  transition: border-color 0.2s ease;
}

.signup__input::placeholder {
  color: var(--vilumi-tide);
  color: color-mix(in srgb, var(--vilumi-tide) 70%, transparent);
  opacity: 1;
}

.signup__input:hover {
  border-color: color-mix(in srgb, var(--vilumi-harbor) 70%, transparent);
}

.signup__input:focus-visible {
  border-color: var(--vilumi-tide);
  outline-offset: 2px;
}

.signup__input[aria-invalid="true"] {
  border-color: var(--vilumi-tide);
}

.signup__button {
  padding: 0 28px;
  border: 0;
  background-color: var(--vilumi-sand);
  color: var(--vilumi-ink);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.signup__button:hover {
  background-color: color-mix(in srgb, var(--vilumi-sand) 90%, var(--vilumi-ink));
}

.signup__button:disabled {
  cursor: default;
  opacity: 0.7;
}

/* One line is always kept free for messages, so nothing jumps when one appears */
.signup__message {
  min-height: 1.5em;
  margin-top: 10px;
  font-size: var(--vilumi-size-small);
  line-height: 1.5;
  color: var(--vilumi-tide);
}

/* Takes exactly the room the form had */
.signup__thanks {
  display: grid;
  place-items: center;
  min-height: var(--form-height);
  font-size: var(--lead-size);
  line-height: 1.5;
  color: var(--vilumi-tide);
  text-wrap: balance;
}

.signup__thanks:focus {
  outline: none;                            /* focus is moved here only so it gets read out */
}

@media (max-width: 600px) {
  .signup {
    max-width: 360px;
  }

  .signup__form {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .signup__input {
    text-align: center;
  }
}


/* 9. Motion ---------------------------------------------------------------
   Everything above is the finished page. Motion only describes where things
   come FROM, so if an animation never runs, nothing is left hidden.
   Only transform and opacity are animated. */

@media (prefers-reduced-motion: no-preference) {

  /* The symbol's horizon draws in from the center outward */
  .horizon-line {
    animation: draw-from-center 0.8s cubic-bezier(0.4, 0, 0.2, 1) var(--t-horizon) backwards;
  }

  /* The sun rises from behind the horizon (it is clipped at the line in the SVG) */
  .sun {
    animation: sun-rise 1.8s var(--ease-rise) var(--t-sun) backwards;
  }

  /* The water lines fade in after the sun, one after the other */
  .water-in--1 {
    animation: fade-in 1.1s ease-out var(--t-water) backwards;
  }

  .water-in--2 {
    animation: fade-in 1.1s ease-out calc(var(--t-water) + 0.4s) backwards;
  }

  /* ...and then breathe, gently and forever, on two cycles that never line up */
  .water--1 {
    animation: breathe-wide 6s ease-in-out infinite;
  }

  .water--2 {
    animation: breathe-narrow 8s ease-in-out -3s infinite;
  }

  /* Wordmark, headline, text and form fade up in sequence */
  .wordmark {
    animation: fade-up-wordmark 0.9s var(--ease-rise) var(--t-content) backwards;
  }

  .headline {
    animation: fade-up 0.9s var(--ease-rise) calc(var(--t-content) + var(--stagger)) backwards;
  }

  .lead {
    animation: fade-up 0.9s var(--ease-rise) calc(var(--t-content) + var(--stagger) * 2) backwards;
  }

  .signup {
    animation: fade-up 0.9s var(--ease-rise) calc(var(--t-content) + var(--stagger) * 3) backwards;
  }

  .footer__inner {
    animation: fade-in 1.2s ease-out calc(var(--t-content) + var(--stagger) * 6) backwards;
  }

  /* The dawn slowly brightens and settles again. Very faint */
  .page::before {
    animation: dawn-brighten 36s ease-in-out 4s infinite alternate;
  }

  /* Hovering the symbol lifts the sun a touch (about 2 px on screen) */
  .sun-lift {
    transition: transform 0.9s var(--ease-rise);
  }

  @media (hover: hover) {
    .symbol:hover .sun-lift {
      transform: translateY(-1.2px);
    }
  }
}

/* Reduced motion: the finished page, with one simple fade and no movement */
@media (prefers-reduced-motion: reduce) {
  .hero,
  .footer__inner {
    animation: fade-in 0.6s ease-out backwards;
  }
}

/* Set by script.js when the page loads in a background tab:
   the sunrise waits until someone is looking */
.is-waiting *,
.is-waiting *::before,
.is-waiting *::after {
  animation-play-state: paused !important;
}

@keyframes draw-from-center {
  from { transform: scaleX(0); }
}

@keyframes sun-rise {
  from { transform: translateY(21px); }     /* SVG units: just over the sun's full height */
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
}

@keyframes fade-up-wordmark {
  from { opacity: 0; transform: translateY(15px); }   /* SVG units: about 10 px on screen */
}

@keyframes breathe-wide {
  0%, 100% { transform: scaleX(1); opacity: 0.7; }
  50%      { transform: scaleX(0.92); opacity: 0.6; }
}

@keyframes breathe-narrow {
  0%, 100% { transform: scaleX(1); opacity: 0.45; }
  50%      { transform: scaleX(0.92); opacity: 0.38; }
}

@keyframes dawn-brighten {
  to { opacity: 0.25; }                     /* kept low: the footer text sits on this part of the sky */
}
