/* ══════════════════════════════════════════════════════════
   WRISTLA · Landing hero — Wristla full width (ADR-0264)
   ──────────────────────────────────────────────────────────
   Loaded only from portal/login.html. Replaces the diagonal
   «Wristla and Voltside» split (ADR-0236): Voltside lives on /voltside.

   One screen under the portal topbar: the Wristla loop fills the
   background (poster first, video later), the text column sits in the
   middle, the download row at the bottom. Content and download row are in
   normal flow (flex column), so they never overlap whatever the locale.

   landing-hero.js writes ONLY:
     --lps-top  height of the sticky portal topbar (px) on .lp-hero
     --vid      0/1 on the <video>: crossfade over the poster
   Without JS the poster stays and everything is visible. */

.lp-hero {
  --lps-bg: #04060a;
  --lps-ink: #f4f7fb;
  --w-1: #34e6ff;           /* Wristla cyan */
  --w-2: #3a7bff;           /* Wristla blue */
  --lps-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --lps-font: var(--font-display, var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif));

  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: clamp(540px, calc(100vh - var(--lps-top, 64px)), 1200px);
  min-height: clamp(540px, calc(100svh - var(--lps-top, 64px)), 1200px);
  padding: 48px 20px 56px;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 45%, #071a24 0%, var(--lps-bg) 70%);
  color: var(--lps-ink);
  font-family: var(--lps-font);
  -webkit-font-smoothing: antialiased;
  isolation: isolate;
}

/* Soft hand-off into the page background below the hero. */
.lp-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40px;
  z-index: 1;
  background: linear-gradient(180deg, rgba(13, 17, 23, 0), var(--bg, #0d1117));
  pointer-events: none;
}

/* ── media: the Wristla loop, centred, edges dissolve into the ground ── */

.lp-hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  container-type: size;
  pointer-events: none;
}

/* Square source (720²): no wider than ~1.15× the hero height, so it is not
   blown up on wide screens; cover-cropped on narrow ones. */
.lp-hero__frame {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100cqw, 115cqh);
  margin-left: calc(min(100cqw, 115cqh) / -2);
  filter: saturate(1.05) brightness(0.92);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000 84%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000 84%, transparent 100%);
  animation: lph-drift 26s ease-in-out infinite alternate;
  transform-origin: 50% 50%;
}

.lp-hero__poster,
.lp-hero__poster img,
.lp-hero__video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
}
.lp-hero__video {
  opacity: var(--vid, 0);
  transition: opacity 0.5s ease-out;
}

@keyframes lph-drift {
  from { transform: scale(1) translate3d(-0.8%, 0.5%, 0); }
  to   { transform: scale(1.07) translate3d(0.8%, -0.6%, 0); }
}

/* Readability: a dark pool behind the text column, darker top and bottom. */
.lp-hero__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(52% 40% at 50% 48%, rgba(4, 6, 10, 0.68) 0%, rgba(4, 6, 10, 0) 100%),
    linear-gradient(180deg, rgba(4, 6, 10, 0.55) 0%, rgba(4, 6, 10, 0) 20%, rgba(4, 6, 10, 0) 58%, rgba(4, 6, 10, 0.88) 100%);
}

/* ── text column ──────────────────────────────────────────── */

.lp-hero__content {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 760px;
  padding: 8px 0 32px;
  text-align: center;
}

/* ANALYTICS + FREE TRIAL pill. No numbers (owner rule). */
.lp-hero__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.9em;
  margin: 0 0 18px;
  font-family: var(--lps-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.32em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--w-1);
  text-shadow: 0 0 14px rgba(52, 230, 255, 0.45);
}
.lp-hero__pill {
  display: inline-block;
  padding: 0.5em 0.9em 0.45em 1.06em;
  border-radius: 999px;
  font-size: 0.92em;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #021018;
  text-shadow: none;
  background: linear-gradient(100deg, #7ff1ff, var(--w-1) 45%, #4a92ff);
  box-shadow: 0 0 0 1px rgba(160, 240, 255, 0.55), 0 6px 22px rgba(52, 200, 255, 0.4);
}

.lp-hero__title {
  margin: 0;
  padding: 0 0.04em 0.06em;
  font-family: var(--lps-font);
  font-size: clamp(64px, 11vw, 148px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(100deg, #9ff6ff 0%, var(--w-1) 35%, var(--w-2) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(52, 230, 255, 0.28));
}

/* «Exclusively for Tesla»: our own font only (no Tesla logo/wordmark styling);
   cyan hairlines on both sides, chrome «Tesla». */
.lp-hero__tag {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  margin: 18px 0 0;
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
  color: rgba(240, 244, 250, 0.92);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.75);
}
.lp-hero__tag::before,
.lp-hero__tag::after {
  content: "";
  width: 1.6em;
  height: 2px;
  border-radius: 2px;
  flex: 0 0 auto;
  box-shadow: 0 0 10px rgba(52, 230, 255, 0.6);
}
.lp-hero__tag::before { margin-right: 0.35em; background: linear-gradient(90deg, rgba(52, 230, 255, 0), var(--w-1)); }
.lp-hero__tag::after  { margin-left: 0.35em;  background: linear-gradient(90deg, var(--w-1), rgba(52, 230, 255, 0)); }
.lp-hero__tesla {
  font-weight: 750;
  text-shadow: none;
  /* chrome: white → cool silver band → white, with a slow shimmer pass */
  background: linear-gradient(100deg,
      #ffffff 0%, #eef2f7 28%, #8d97a5 42%, #ffffff 50%, #9ea7b4 58%, #e9eef5 72%, #ffffff 100%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.35)) drop-shadow(0 2px 10px rgba(0, 0, 0, 0.7));
  animation: lph-shimmer 6s ease-in-out infinite;
}
@keyframes lph-shimmer {
  0%, 62% { background-position: 100% 0; }
  85%, 100% { background-position: 0% 0; }
}

.lp-hero__pitch {
  max-width: 620px;
  margin: 26px 0 0;
  font-family: var(--font-body, var(--lps-font));
  font-size: clamp(18px, 1.62vw, 24px);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.005em;
  color: rgba(250, 252, 255, 0.95);
  text-wrap: pretty;
  overflow-wrap: normal;
  -webkit-hyphens: manual;
          hyphens: manual;      /* display-size copy: whole words, no auto «эффектив-ность» */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 2px 18px rgba(0, 0, 0, 0.75);
}
.lp-hero__pitch strong {
  font-weight: 750;
  color: var(--w-1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 18px rgba(52, 230, 255, 0.4);
}

/* ── download row: bottom-centre ──────────────────────────── */

.lp-hero__dl {
  position: relative;
  z-index: 2;
  max-width: calc(100vw - 32px);
}
.lp-hero__dl::before {
  content: "";
  position: absolute;
  inset: -40px -90px -34px;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(4, 6, 10, 0.85), rgba(4, 6, 10, 0.55) 55%, rgba(4, 6, 10, 0) 100%);
  pointer-events: none;
}
.lp-hero__dl .appstore-badge:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* «App Store → Connect IQ → Web version → MCP» (ADR-0250, ADR-0253). Gap 12 px —
   at least a quarter of the App Store badge height (Apple's clear space). The row
   never wraps: below, the badges compact into icons instead. */
.lp-hero__stores,
.lp-hero__store-pair { gap: 12px; flex-wrap: nowrap; }

/* Touch: the compact phone badges/icons are 37–39 px tall — an invisible tap
   area of at least 44×44 px, centred on each, so the visual size stays. */
@media (pointer: coarse), (max-width: 700px) {
  .lp-hero__stores .appstore-badge { position: relative; }
  .lp-hero__stores .appstore-badge::after {
    content: "";
    position: absolute;
    top: min(0px, calc((100% - 44px) / 2));
    bottom: min(0px, calc((100% - 44px) / 2));
    left: min(0px, calc((100% - 44px) / 2));
    right: min(0px, calc((100% - 44px) / 2));
  }
}

/* Thresholds marked `.lp-hero__stores--mcp` apply ONLY with the MCP badge in the
   row: the template sets the modifier under `mcp_public_pages_enabled()`
   (ADR-0253). Without it the three-badge row shrinks as before.

   The full four-badge row is 650–705 px across locales. Up to 767 px «Web version»
   and MCP are full-height icons (the caption stays in aria-label/title). */
@media (max-width: 767px) {
  .lp-hero__stores--mcp .appstore-badge--web,
  .lp-hero__stores--mcp .appstore-badge--mcp { padding: 12px; gap: 0; }
  .lp-hero__stores--mcp .appstore-badge--web .appstore-badge__text,
  .lp-hero__stores--mcp .appstore-badge--mcp .appstore-badge__text { display: none; }
}

/* With MCP, up to 559 px outside phone portrait: Connect IQ becomes an icon too. */
@media (min-width: 480px) and (max-width: 559px), (min-aspect-ratio: 4/5) and (max-width: 559px) {
  .lp-hero__stores--mcp .appstore-badge--ciq { padding: 11px; gap: 0; }
  .lp-hero__stores--mcp .appstore-badge--ciq .appstore-badge__text { display: none; }
}

/* ── portrait / phones ──────────────────────────────────────
   The loop turns into a vertical band behind the column; all badges compact
   (.appstore-badge--sm proportions), «Web version» and MCP icon-only, like the
   topbar storefronts (the captions stay in aria-label; menu and footer carry them). */
@media (max-aspect-ratio: 4/5) {
  .lp-hero {
    min-height: clamp(560px, calc(100svh - var(--lps-top, 64px)), 1000px);
    padding: 32px 16px max(28px, env(safe-area-inset-bottom));
    background: radial-gradient(110% 80% at 50% 35%, #071a24 0%, var(--lps-bg) 70%);
  }
  .lp-hero__frame {
    left: 0;
    width: 100%;
    margin-left: 0;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 80%, transparent 100%);
            mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 80%, transparent 100%);
  }
  .lp-hero__scrim {
    background:
      radial-gradient(95% 34% at 50% 48%, rgba(4, 6, 10, 0.72) 0%, rgba(4, 6, 10, 0) 100%),
      linear-gradient(180deg, rgba(4, 6, 10, 0.6) 0%, rgba(4, 6, 10, 0) 16%, rgba(4, 6, 10, 0) 66%, rgba(4, 6, 10, 0.85) 100%);
  }
  .lp-hero__eyebrow { font-size: 11px; }
  .lp-hero__title { font-size: clamp(56px, 19vw, 104px); }
  .lp-hero__tag { font-size: clamp(18px, 5.6vw, 26px); }
  .lp-hero__pitch { margin-top: 20px; font-size: 17px; line-height: 1.38; }
  .lp-hero__dl::before { inset: -30px -30px -20px; }
}

@media (max-aspect-ratio: 4/5) and (max-width: 479px) {
  .lp-hero__stores,
  .lp-hero__store-pair { gap: 10px; }
  .lp-hero__stores .appstore-badge { padding: 7px 13px 7px 11px; border-radius: 9px; gap: 8px; }
  .lp-hero__stores .appstore-badge__logo { width: 18px; height: 21px; }
  .lp-hero__stores .appstore-badge--ciq .appstore-badge__logo { width: 21px; height: 21px; }
  .lp-hero__stores .appstore-badge--web .appstore-badge__logo,
  .lp-hero__stores .appstore-badge--mcp .appstore-badge__logo { width: 21px; height: 21px; }
  .lp-hero__stores .appstore-badge__pre { font-size: 8.5px; }
  .lp-hero__stores .appstore-badge__name { font-size: 14px; }
  .lp-hero__stores .appstore-badge--web,
  .lp-hero__stores .appstore-badge--mcp { padding: 8px; gap: 0; }
  .lp-hero__stores .appstore-badge--web .appstore-badge__text,
  .lp-hero__stores .appstore-badge--mcp .appstore-badge__text { display: none; }
}

/* Under ~360 px even that does not fit: Connect IQ icon-only too (as in the topbar). */
@media (max-aspect-ratio: 4/5) and (max-width: 359px) {
  .lp-hero__stores .appstore-badge--ciq { padding: 7px; gap: 0; }
  .lp-hero__stores .appstore-badge--ciq .appstore-badge__text { display: none; }
}

/* With the fourth (MCP) badge the row with the Connect IQ caption is 353–373 px
   (ru/el longest): up to 411 px Connect IQ is icon-only too; from 412 px the margin
   is at least 20 px in all 20 locales. Without MCP the 359 px threshold applies. */
@media (max-aspect-ratio: 4/5) and (max-width: 411px) {
  .lp-hero__stores--mcp .appstore-badge--ciq { padding: 7px; gap: 0; }
  .lp-hero__stores--mcp .appstore-badge--ciq .appstore-badge__text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lp-hero__frame { animation: none; transform: none; }
  .lp-hero__tesla { animation: none; background-position: 50% 0; }
  .lp-hero__video { transition: none; }
}
