/* =========================================================================
   Relivance — landing page styles
   Match the iOS login screen (AuthView.swift) exactly:
     - Same background (wvBackground), same primary/secondary text colors.
     - Same Roboto SemiBold 40pt wordmark + Roboto Regular 17pt slogan.
     - Same launch-screen SVG, same light/dark gradient treatment.
   No framework, no JS-driven layout. Pure CSS + system fonts fallback.
   ======================================================================== */

/* =========================================================================
   Roboto (self-hosted, Apache 2.0)
   Two .woff2 files in assets/fonts/ cover everything we need:
     - latin       — ASCII, Western European accents (English)
     - latin-ext   — extra Latin (German umlauts, ß, Czech, Polish, etc.)
   v51 ships as a variable font, so a single file per subset covers
   every weight (100–900). Browser picks the right interpolated weight
   from font-weight: 400 / 500 / 600 declarations elsewhere in the file.
   font-display: swap means the page renders immediately in the system
   fallback and re-flows to Roboto when the .woff2 finishes loading
   (typically within the first paint on a warm cache, ~50ms on a cold
   one over Pages' CDN).
   ======================================================================== */
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/roboto-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: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/roboto-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

:root {
  /* Light-mode palette (from Assets.xcassets/wv*.colorset) */
  --wv-background: #ffffff;
  --wv-primary: #1d1f27;     /*  rgb(29, 31, 39)   — body + headlines  */
  --wv-secondary: #6a6d75;   /*  rgb(106, 109, 117) — quiet text       */
  --wv-surface: #f1f2f3;     /*  rgb(241, 242, 243) — pill / capsules  */
  --wv-border: #e2e2e5;      /*  rgb(226, 226, 229) — hairline borders */
  --wv-accent: #0a84ff;      /*  rgb(10, 132, 255)  — Apple system blue */

  /* Primary-CTA blue. Light mode uses the darker stop of the brand
     logo's diagonal gradient (#3D89F7, from assets/logo-light.svg),
     so the button reads as a direct extension of the logo on white.
     Dark mode keeps the LinkedIn-import sheet's #0A66C2 (overridden
     below) — that deeper, cooler blue holds the surface weight on
     near-black better than the lighter logo blue. */
  --cta-blue: #3d89f7;

  /* Fluid type scale anchored on the iOS pt sizes. The wordmark is
     40pt on iOS; we let it scale a touch larger on big screens and
     not below 32px on phones. The slogan locks 16–19px range. */
  --t-wordmark: clamp(34px, 5vw, 48px);
  --t-slogan:   clamp(15px, 1.6vw, 19px);
  --t-status:   13px;
  /* Footer copy size matches apple.com's footer (12px SF Pro Regular,
     no letter-spacing). 11px reads stingy; 12px reads premium. */
  --t-footer:   12px;

  /* Vertical rhythm: match the AuthView VStack(spacing:) values
     for the in-brand-block spacing. The structural top/middle/bottom
     gaps no longer need a CSS variable — .stage now uses
     justify-content: space-evenly to distribute them automatically. */
  --gap-logo-title: 24px;     /* outer stack spacing (logo → wordmark) */
  --gap-title-slogan: 10px;   /* inner stack spacing (wordmark → slogan) */
}

@media (prefers-color-scheme: dark) {
  :root {
    --wv-background: #0c0c0e; /*  rgb(12, 12, 14)    */
    --wv-primary:    #dcdee3; /*  rgb(220, 222, 227) */
    --wv-secondary:  #676a6f; /*  rgb(103, 106, 111) */
    --wv-surface:    #222224; /*  rgb(34, 34, 36)    */
    --wv-border:     #2a2a2d; /*  rgb(42, 42, 45)    */
    /* Dark mode: switch the CTA to the deeper LinkedIn-import blue
       (#0A66C2). The lighter logo-derived blue used in light mode
       (#3D89F7) reads thin on a near-black surface; the deeper
       LinkedIn blue holds visual weight without competing with the
       wordmark or feeling like a stock OS button. */
    --cta-blue: #0a66c2;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  /* Use 100svh on iOS Safari to avoid the address-bar-jumping
     viewport-height bug; fall back to 100vh elsewhere. */
  min-height: 100vh;
  min-height: 100svh;
  background: var(--wv-background);
  color: var(--wv-primary);
}

body {
  /* Flex column so the .stage can flex-grow to absorb the available
     viewport height while the footer sits in-flow right beneath it
     at the bottom of the screen. This is the structural plumbing
     that lets `.stage` use `justify-content: space-evenly` to
     produce three EXACTLY equal gaps (top-of-viewport→logo,
     slogan→access-heading, button→footer). */
  display: flex;
  flex-direction: column;
  /* Inter is the font Linear & many modern app marketing sites
     reach for. We ship Roboto specifically because the iOS app
     uses Roboto SemiBold for the wordmark — keeping the web side
     pixel-faithful to the app's typography. System fonts cover the
     micro-second between page-paint and Roboto-load. */
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Outer layout: brand block + capture form with THREE EXACTLY EQUAL
   structural gaps:
     1. top-of-viewport → logo
     2. slogan        → "Private early access" heading
     3. submit button → footer (first line, the copyright)
   How this works:
   - body is a flex column with min-height 100svh.
   - .stage has `flex: 1 0 auto`, so it absorbs all viewport space
     above the footer (the footer sits in-flow at the bottom).
   - .stage uses `justify-content: space-evenly`, which distributes
     its two flex children (brand + access) with mathematically equal
     empty space around each: 1/3 above brand, 1/3 between them, 1/3
     below access. The bottom 1/3 sits between the access block and
     the footer's top edge, giving us the third equal gap "for free".
   - Padding-top picks up the safe-area inset on notched devices, so
     content never renders under a notch. This is added on top of the
     space-evenly gap; visually the top gap is `top-flex-space +
     safe-area-inset` on those devices, which is the right thing
     (the inset is consumed by the system, not by the user). */
.stage {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding-top: env(safe-area-inset-top);
  padding-left: 24px;
  padding-right: 24px;
  text-align: center;
}

/* The brand block (logo + wordmark + slogan) mirrors AuthView's
   VStack: outer 24pt between logo and title, inner 10pt between
   title and slogan. */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-logo-title);
}

.logo {
  display: block;
  width: clamp(120px, 22vw, 160px);
  height: clamp(120px, 22vw, 160px);
  /* The same small upward optical-centre nudge AuthView applies via
     .offset(y: -6). Subtle, but the brand block reads as "balanced"
     instead of "low" because of it. */
  margin-bottom: -6px;
}

.logo img {
  width: 100%;
  height: 100%;
  display: block;
}

/* Inner stack: 10pt between wordmark and slogan. */
.brand > h1,
.brand > p {
  margin: 0;
}

.brand > h1 + p {
  margin-top: calc(var(--gap-title-slogan) - var(--gap-logo-title));
}

.wordmark {
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 600;
  font-size: var(--t-wordmark);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--wv-primary);
}

.slogan {
  font-weight: 400;
  font-size: var(--t-slogan);
  line-height: 1.4;
  color: var(--wv-primary);
  /* No max-width: the slogan should land on a single line at every
     viewport width down to ~320px (iPhone SE). On the smallest
     phones the fluid `clamp()` font scale already drops the size
     to 15px, which keeps the sentence under the available width.
     The only case where this still wraps is when the user has
     bumped iOS / Safari text size well above 100% — graceful
     wrapping there is correct, not a bug. */
}

/* =========================================================================
   Early-access capture
   Mirrors the iOS AuthView credentials stage one-for-one:
     - 14px corner-radius input pill filled with wvSurface
     - Accent-blue capsule submit button
     - 12pt vertical gap between input and button (same as VStack(spacing:12))
     - Same disabled / loading semantics
   Layout is always stacked (input above button) — the AuthView form is
   stacked too, and on a single-field early-access form this keeps the
   visual weight of the CTA where it belongs.
   ======================================================================== */

.access {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Reduced from 12px → 8px to match the visual rhythm of the form
     itself. The form has its own `gap: 12px` between the input pill
     and the submit pill — those two pills have no line-height
     padding, so 12px IS the visual gap. The heading above does have
     line-height padding (~4px below the text), so a 12px CSS gap
     between heading and input would read as ~16px visually. Using
     8px here compensates: 8 + 4 ≈ 12px visual, matching the
     input → button gap exactly. */
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin: 0;
}

.access-heading {
  margin: 0;
  /* Same Roboto family (inherited from body), same weight (400,
     inherited), same fluid size and line-height as the slogan above
     the brand block. The two intro-style lines now read as visual
     peers in typography — only the colour stays subordinate
     (wvSecondary) so the slogan keeps the hero role. */
  font-size: var(--t-slogan);
  line-height: 1.4;
  color: var(--wv-secondary);
  text-align: center;
}

.access-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  /* No margin-top here: the .access container's own `gap: 12px`
     already sits between the heading and this form. Equal 12px
     stacks: heading → input → button, all the same rhythm. */
  margin: 0;
}

.access-input {
  width: 100%;
  /* Match the submit button's height + capsule shape so the two
     pills read as a paired stack. The button (54px / 999px radius)
     is the source of truth for this surface — the field follows. */
  height: 54px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--wv-surface);
  color: var(--wv-primary);
  font-family: inherit;
  font-size: 16px;        /* 16px prevents iOS Safari auto-zoom on focus */
  font-weight: 400;
  letter-spacing: 0;
  outline: none;
  transition: box-shadow 160ms ease, background-color 160ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.access-input::placeholder {
  color: var(--wv-secondary);
  opacity: 1;             /* Firefox defaults to 0.54; normalize */
}

.access-input:focus-visible {
  box-shadow: inset 0 0 0 1.5px var(--wv-accent);
}

.access-input[aria-invalid="true"] {
  /* Same Apple system red the app uses for inline error states. */
  box-shadow: inset 0 0 0 1.5px #ea524d;
}

.access-submit {
  position: relative;
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 999px;
  /* Sourced from the iOS LinkedIn-import capsule
     (LinkedInImportSheet.swift:356). In dark mode this resolves to
     wvAccent — see the @media block at the top of this file. */
  background: var(--cta-blue);
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: opacity 160ms ease, transform 80ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.access-submit:hover {
  opacity: 0.94;
}

.access-submit:active {
  transform: scale(0.985);
}

.access-submit:focus-visible {
  outline: 2px solid var(--cta-blue);
  outline-offset: 3px;
}

/* While the fetch is in flight: hide the label, show a soft spinner.
   The button stays the same size so the layout doesn't reflow. */
.access-form[data-state="submitting"] .access-submit {
  pointer-events: none;
  opacity: 0.85;
}
.access-form[data-state="submitting"] .access-submit-label {
  visibility: hidden;
}
.access-form[data-state="submitting"] .access-submit-spinner {
  display: inline-block;
}

.access-submit-spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  animation: access-spin 0.8s linear infinite;
}

@keyframes access-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .access-submit-spinner {
    animation: none;
  }
}

/* ── Success state ──────────────────────────────────────────────────
   After submit lands:
   • Input greys out (still readable, still showing the typed email,
     but visibly locked in)
   • Button label swaps to "Success" + checkmark.circle.fill icon
   • Both controls become non-interactive
   Same button size, same overall layout — only the content morphs.
*/
.access-submit-success {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.access-submit-success svg {
  display: block;
  flex-shrink: 0;
}

.access-form[data-state="success"] .access-input {
  /* "Greyed out" treatment: muted background, secondary text colour,
     no interaction. Keeps the email visible so the user remembers
     what they submitted. */
  background: var(--wv-surface);
  color: var(--wv-secondary);
  cursor: default;
  /* Soft fade gives a subtle "this is locked in" feel without
     fully hiding the value. */
  opacity: 0.7;
  pointer-events: none;
}

.access-form[data-state="success"] .access-input:focus-visible {
  /* No focus ring once disabled — there is no editing to do. */
  box-shadow: none;
}

.access-form[data-state="success"] .access-submit {
  pointer-events: none;
  cursor: default;
}

.access-form[data-state="success"] .access-submit-label {
  visibility: hidden;
}

.access-form[data-state="success"] .access-submit-spinner {
  display: none;
}

.access-form[data-state="success"] .access-submit-success {
  display: inline-flex;
}

.access-error {
  margin: -4px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: #ea524d;
  letter-spacing: 0.01em;
  text-align: left;
}

/* Visually-hidden but still announced by screen readers. Used for the
   <label> that pairs with the email input AND for the success live
   region that announces submission to assistive tech. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Single-row footer. Sits at the bottom of the viewport via the
   body's flex layout (see `body` rule above): the body is a flex
   column with min-height: 100svh and the .stage uses flex-grow to
   absorb all extra viewport height, which automatically pins the
   footer to the bottom without `position: fixed`.
   The footer is now ONE line — copyright dot Privacy dot Terms —
   rather than two stacked rows, which reads tighter and frees up
   vertical space for the brand block above. */
.footer {
  display: flex;
  flex-direction: row;
  /* nowrap is deliberate. The footer contents (copyright, separator,
     Privacy/Terms nav) total ~250–280px and fit on a single row at
     every viewport down to ~320px (iPhone SE portrait). Forcing
     nowrap stops any zoom / font-scaling / RTL edge case from
     producing the old two-row stack. */
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 16px 24px max(16px, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--wv-secondary);
  font-size: var(--t-footer);
  line-height: 1.35;
}

.footer-copy {
  font-size: inherit;
}

.footer-nav {
  display: inline-flex;
  align-items: center;
  /* Tight 5px on each side of the · separator. Adding horizontal
     padding to the links would compound with this gap and produce
     the previous too-wide "Privacy   ·   Terms" rendering. */
  gap: 5px;
  font-size: inherit;
}

.footer-nav a {
  color: var(--wv-secondary);
  text-decoration: none;
  /* Vertical-only padding keeps the focus ring tall enough without
     widening the spacing around the · separator. */
  padding: 2px 0;
  border-radius: 4px;
  transition: color 120ms ease;
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--wv-primary);
}

.footer-nav a:focus-visible {
  outline: 2px solid var(--wv-accent);
  outline-offset: 2px;
}

.footer-sep {
  opacity: 0.6;
}

/* Desktop wordmark steps up slightly so the "Relivance" headline holds
   the right visual weight on larger viewports. The structural gaps
   (top, slogan→heading, button→footer) auto-scale via .stage's
   justify-content: space-evenly, so no per-breakpoint gap override is
   needed any more. */
@media (min-width: 1280px) {
  :root {
    --t-wordmark: clamp(40px, 4vw, 56px);
  }
}

/* =========================================================================
   Document pages (/privacy/, /terms/)
   Same palette + typography as the home page, just a top-anchored
   left-aligned layout instead of the centered hero. The footer flows
   naturally with the document (no fixed positioning) so long copy can
   scroll the footer in at the bottom.
   ======================================================================== */

body.doc {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

.doc-stage {
  flex: 1;
  width: 100%;
  /* Editorial-document max-width. Modern legal / docs pages on
     premium apps land in the 720–800px range so a line of 15px
     body text holds 65–75 characters per line — the comfort-zone
     for long-form reading. 640px (the previous value) was sized
     for a phone reading view, not a desktop one. */
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  padding-top: max(48px, calc(env(safe-area-inset-top) + 32px));
  text-align: left;
}

/* Tablet up: more generous side gutters so the content column
   doesn't feel slammed against the viewport edge once the page
   has more horizontal room. */
@media (min-width: 768px) {
  .doc-stage {
    padding-left: 40px;
    padding-right: 40px;
    padding-top: max(64px, calc(env(safe-area-inset-top) + 48px));
    padding-bottom: 80px;
  }
}

/* Wide desktop: large top breathing room so a long legal page
   opens with a calm, premium feel rather than dropping the reader
   straight onto the title. */
@media (min-width: 1280px) {
  .doc-stage {
    padding-top: 96px;
    padding-bottom: 96px;
  }
}

.doc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 40px;
}

.doc-header a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
}

.doc-header a:focus-visible {
  outline: 2px solid var(--wv-accent);
  outline-offset: 4px;
}

.doc-logo {
  width: 32px;
  height: 32px;
  display: block;
}

.doc-logo img {
  width: 100%;
  height: 100%;
  display: block;
}

.doc-name {
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--wv-primary);
}

.doc-title {
  margin: 0 0 8px;
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 600;
  font-size: clamp(26px, 3.2vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--wv-primary);
}

.doc-meta {
  margin: 0 0 32px;
  font-size: 13px;
  color: var(--wv-secondary);
  letter-spacing: 0.01em;
}

.doc-section {
  margin: 0 0 28px;
}

.doc-section h2 {
  margin: 0 0 8px;
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--wv-primary);
}

.doc-section p,
.doc-section li {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--wv-primary);
}

.doc-section p:last-child,
.doc-section li:last-child {
  margin-bottom: 0;
}

.doc-section a {
  color: var(--wv-accent);
  text-decoration: none;
}

.doc-section a:hover,
.doc-section a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.doc-section ul {
  margin: 0 0 10px;
  padding: 0 0 0 18px;
}

.doc-section .doc-address {
  display: block;
  font-style: normal;
  color: var(--wv-primary);
  line-height: 1.55;
}

.doc-section .doc-address-label {
  display: block;
  color: var(--wv-secondary);
  /* Font-size and weight inherit from .doc-section p (15px / 400) so
     this label reads as a peer of the address lines beneath it — only
     the colour is dialled down to wvSecondary to keep the visual
     hierarchy. */
  margin-bottom: 4px;
}

/* On document pages the footer sits naturally below the doc-stage so
   long policy copy scrolls the footer in at the bottom. The home page
   already places the footer in-flow via body's flex column + .stage's
   flex-grow — nothing extra needed there. */
body.doc .footer {
  margin: 24px auto 0;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* Print: keep the footer immediately after content with a comfortable
   gap so a printed page doesn't end on the button. */
@media print {
  .footer {
    margin-top: 64px;
  }
}
