/* martEV invitation, first test mockup: all styles for index.html.
   Mobile-first (min-width only: 481 / 769 / 1025). Brand: Helvetica Neue, martEV palette, no uppercase, no italics.
   script.js drives the loader progress (--p), the battery -> logo morph and the cable geometry. */

/* Heros = TeX Gyre Heros (GUST Font License), subset to Latin. Only used where Helvetica Neue is not installed. */
@font-face {
  font-family: "Heros";
  src: url("heros-regular.woff2") format("woff2");
  font-weight: 300 400;
  font-display: block;
}
@font-face {
  font-family: "Heros";
  src: url("heros-bold.woff2") format("woff2");
  font-weight: 500 700;
  font-display: block;
}

:root {
  --vh: 1vh;

  --ink: #0E1420;
  --ink-soft: #5A6577;
  --base: #F3F5F8;
  --loader-bg: #F6F7F9;

  --blue: #0057FF;
  --sky: #00BEEA;
  --cyan: #00D4D9;
  --plum: #AA4D7F;
  --orange: #FF7101;

  /* Bottom-to-top brand gradient: orange only shows at the very top, so it appears exactly when the battery is full. */
  --charge: linear-gradient(to top, var(--cyan) 0%, var(--sky) 18%, var(--blue) 50%, var(--plum) 78%, var(--orange) 100%);

  --font: "Helvetica Neue", "Heros", Helvetica, Arial, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --gutter: 26px;
  --copy-top: 12;          /* hero copy offset in vh units (pinned via --vh below); short in-browser phones */
}

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

html, body {
  margin: 0;
  background-color: var(--base);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 87, 255, 0.35) var(--base);
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--base); }
::-webkit-scrollbar-thumb { background: rgba(0, 87, 255, 0.35); border-radius: 8px; }

/* Intro lock: trap the gesture in JS, never position:fixed / overflow:hidden (Chrome iOS viewport freeze). */
html.is-locked, body.is-locked { overscroll-behavior: none; touch-action: none; }

h1, p { margin: 0; }
.nowrap { white-space: nowrap; }

/* ---------- Loader: vertical battery ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background-color: var(--loader-bg);
  transition: opacity 0.9s ease;
}
.loader.is-out { opacity: 0; pointer-events: none; }
.loader.is-gone { display: none; }

.battery {
  position: relative;
  width: 96px;
  height: 180px;
  transition: opacity 0.3s ease;
}
.battery__nub {
  position: absolute;
  top: 0;
  left: 50%;
  width: 34px;
  height: 11px;
  margin-left: -17px;
  border-radius: 6px 6px 0 0;
  background-color: var(--ink);
}
.battery__shell {
  position: absolute;
  top: 10px;
  right: 0;
  bottom: 0;
  left: 0;
  border: 3px solid var(--ink);
  border-radius: 26px;
}
/* The fill is a full-height gradient revealed from the bottom by clip-path, so colours stay anchored while it rises. */
.battery__fill {
  position: absolute;
  inset: 6px;
  overflow: hidden;
  border-radius: 17px;
  background-image: var(--charge);
  clip-path: inset(calc((1 - var(--p, 0)) * 100%) 0 0 0 round 17px);
}
/* Charging sweep: a soft band of light travelling up through the charged part, like a car's charging indicator. */
.battery__fill::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -40%;
  height: 40%;
  background-image: linear-gradient(to top, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
  animation: charge-sweep 1.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
@keyframes charge-sweep {
  from { transform: translateY(0); }
  to   { transform: translateY(-350%); }
}
.battery.is-full .battery__fill::after { animation: none; opacity: 0; }
.battery.is-full { animation: full-pop 0.55s var(--ease-out); }
@keyframes full-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.045); }
  100% { transform: scale(1); }
}
.loader.is-handoff .battery__nub,
.loader.is-handoff .battery__shell { opacity: 0; transition: opacity 0.25s ease; }

.loader__label {
  position: relative;
  width: 260px;
  height: 28px;
  text-align: center;
  transition: opacity 0.3s ease;
}
.loader__pct {
  display: block;
  font-size: 20px;
  font-weight: 500;
  line-height: 28px;
  color: #3D4656;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.loader__done {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 28px;
  letter-spacing: -0.02em;
  color: var(--ink);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}
.loader.is-full .loader__pct { opacity: 0; transform: translateY(-10px); }
.loader.is-full .loader__done { opacity: 1; transform: translateY(0); }
.loader.is-handoff .loader__label { opacity: 0; }

/* ---------- Morph (battery fill -> logo circle) ---------- */

.morph {
  position: fixed;
  z-index: 10002;
  display: none;
  overflow: hidden;
  background-image: var(--charge);
  pointer-events: none;
}
.morph.is-on { display: block; }
.morph__mark {
  position: absolute;
  inset: 0;
  background: url("mark-gradient.png") center / cover no-repeat;
  opacity: 0;
}

/* ---------- Test badge ---------- */

.test-badge {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 14px;
  z-index: 20;
  padding: 6px 12px;
  border: 1px solid rgba(14, 20, 32, 0.08);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
}

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

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}
.vh-lock .hero { min-height: calc(var(--vh) * 100); }

.hero__map {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("map-portrait.jpg") center / cover no-repeat;
  opacity: 0.62;
}
/* Soft paper wash behind the copy so the headline never fights the street lines. */
.hero__wash {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(ellipse 90% 55% at 18% 34%, rgba(243, 245, 248, 0.92) 0%, rgba(243, 245, 248, 0.6) 45%, rgba(243, 245, 248, 0) 75%);
}

.cable {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: visible;
}
.cable__line {
  fill: none;
  stroke: url(#cableGrad);
  stroke-width: 13px;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cable__pulse {
  fill: none;
  stroke: #ffffff;
  stroke-width: 5px;
  stroke-linecap: round;
  stroke-opacity: 0.7;
}
html.js .cable__pulse { opacity: 0; }
.hero.is-pulsing .cable__pulse { opacity: 1; }

.hero__brand {
  position: relative;
  z-index: 2;
  padding: calc(env(safe-area-inset-top, 0px) + 58px) var(--gutter) 0;
}
.logo {
  display: block;
  width: 156px;
  height: auto;
  overflow: visible;
}
.logo g { transform-box: fill-box; }

.hero__copy {
  position: relative;
  z-index: 2;
  padding: 12vh var(--gutter) 0;
}
.vh-lock .hero__copy { padding-top: calc(var(--vh) * var(--copy-top)); }
@media (min-height: 740px) { :root { --copy-top: 21; } .hero__copy { padding-top: 21vh; } }

.hero__title {
  font-size: 64px;
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: -0.045em;
  color: var(--ink);
}
.line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
}
.line > span { display: block; }

.hero__sub {
  margin-top: 16px;
  max-width: 270px;
  font-size: 28px;
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.credit {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  left: var(--gutter);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 300;
  color: var(--ink);
  text-decoration: none;
  opacity: 0.3;
  transition: opacity 0.3s ease;
}
.credit:hover, .credit:focus-visible { opacity: 0.75; }
.credit__logo {
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask: url("logo-vector.svg") center / contain no-repeat;
  mask: url("logo-vector.svg") center / contain no-repeat;
}

/* ---------- Reveal choreography (only when JS runs; no-JS shows the final state) ---------- */

html.js .hero__map { opacity: 0; transform: scale(1.08); transition: opacity 1.8s var(--ease-out), transform 2.4s var(--ease-out); }
html.js .hero.map-on .hero__map { opacity: 0.62; transform: scale(1); }

html.js .logo__mark { opacity: 0; }
html.js .hero.mark-on .logo__mark { opacity: 1; }

html.js .logo__mart { opacity: 0; transform: translateX(140px); transition: opacity 0.7s ease, transform 0.9s var(--ease-out); }
html.js .logo__ev   { opacity: 0; transform: translateX(-140px); transition: opacity 0.7s ease, transform 0.9s var(--ease-out); }
html.js .hero.is-revealed .logo__mart,
html.js .hero.is-revealed .logo__ev { opacity: 1; transform: translateX(0); }

html.js .line > span { transform: translateY(112%); transition: transform 1.1s var(--ease-out); }
html.js .line:nth-child(1) > span { transition-delay: 0.45s; }
html.js .line:nth-child(2) > span { transition-delay: 0.58s; }
html.js .hero.is-revealed .line > span { transform: translateY(0); }

html.js .hero__sub { opacity: 0; transform: translateY(14px); transition: opacity 0.9s ease 0.9s, transform 1s var(--ease-out) 0.9s; }
html.js .hero.is-revealed .hero__sub { opacity: 1; transform: translateY(0); }

html.js .credit { opacity: 0; transition: opacity 0.9s ease 1.6s; }
html.js .hero.is-revealed .credit { opacity: 0.3; }
html.js .hero.is-revealed .credit:hover { opacity: 0.75; transition-delay: 0s; }

html.js .test-badge { opacity: 0; transition: opacity 0.9s ease 1.8s; }
html.js.is-ready .test-badge { opacity: 1; }

/* ---------- Breakpoints ---------- */

@media (min-width: 481px) {
  :root { --gutter: 40px; }
  .logo { width: 170px; }
  .hero__title { font-size: 80px; }
  .hero__sub { max-width: none; font-size: 32px; }
}

@media (min-width: 769px) {
  :root { --gutter: 56px; --copy-top: 24; }
  .hero__map { background-image: url("map-landscape.jpg"); }
  .hero__brand { padding-top: 52px; }
  .logo { width: 190px; }
  .cable__line { stroke-width: 16px; }
  .cable__pulse { stroke-width: 6px; }
  .hero__copy { padding-top: 24vh; }
  .hero__title { font-size: 104px; }
  .hero__sub { margin-top: 20px; font-size: 38px; }
  .test-badge { top: 20px; right: 20px; font-size: 12px; }
  .credit { font-size: 12px; bottom: 24px; }
}

@media (min-width: 1025px) {
  :root { --gutter: 72px; --copy-top: 25; }
  .hero__wash { background-image: radial-gradient(ellipse 60% 60% at 26% 42%, rgba(243, 245, 248, 0.92) 0%, rgba(243, 245, 248, 0.55) 50%, rgba(243, 245, 248, 0) 78%); }
  .logo { width: 210px; }
  .cable__line { stroke-width: 20px; }
  .cable__pulse { stroke-width: 7px; }
  .hero__copy { padding-top: 25vh; }
  .hero__title { font-size: 132px; }
  .line { display: inline-block; vertical-align: top; }
  .line + .line { margin-left: 0.04em; }
  .hero__sub { margin-top: 22px; font-size: 44px; }
}

/* ---------- Reduced motion: everything lands in its final state ---------- */

@media (prefers-reduced-motion: reduce) {
  .battery__fill::after { animation: none; }
  html.js .hero__map, html.js .logo__mart, html.js .logo__ev,
  html.js .line > span, html.js .hero__sub, html.js .credit, html.js .test-badge { transition: none; }
}
