/* ============================================================
   VITAMED · BASE + COMPONENTS + LANDING PAGE
   Requires tokens.css. 
   ============================================================ */

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: var(--accent-100); color: var(--w-950); }

/* ---------- TYPOGRAPHY ---------- */
h1, .h1 { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--text-5xl); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
h2, .h2 { font-family: var(--font-display); font-weight: var(--fw-medium);   font-size: var(--text-3xl); line-height: var(--leading-snug);  letter-spacing: var(--tracking-tight); }
h3, .h3 { font-family: var(--font-sans);    font-weight: var(--fw-semibold); font-size: var(--text-xl);  line-height: var(--leading-snug); }
h4, .h4 { font-family: var(--font-sans);    font-weight: var(--fw-semibold); font-size: var(--text-lg);  line-height: var(--leading-snug); }

p { font-size: var(--text-base); line-height: var(--leading-relaxed); max-width: 64ch; }
.lead { font-size: var(--text-lg); line-height: var(--leading-relaxed); color: var(--text-muted); max-width: 60ch; }
.small { font-size: var(--text-sm); }
.muted { color: var(--text-muted); }
.acc   { color: var(--brand); }
.mono  { font-family: var(--font-mono); }

/* eyebrow — mono label with the brand dot */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.eyebrow::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand);
  flex: 0 0 auto;
}

.code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-sunken);
  border: var(--border-1);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
}

/* ---------- BRAND MARK ---------- */
.mark {
  width: 30px; height: 30px; flex: 0 0 auto;
  border-radius: 8px;
  background: var(--w-950);
  color: var(--w-25);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: 14px;
  letter-spacing: -0.06em;
}
.mark .z { color: var(--brand); }
.wordmark {
  font-family: var(--font-mono);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}
.wordmark .z { color: var(--brand); }

/* ---------- BUTTONS ---------- */
.btn {
  --btn-bg: var(--text);
  --btn-fg: var(--text-invert);
  --btn-bd: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 0.85em 1.4em;
  border-radius: var(--radius-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1.5px solid var(--btn-bd);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-base) var(--ease),
              color var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.btn--primary:hover { --btn-bg: var(--w-850); --btn-bd: var(--w-850); }
.btn--accent  { --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: var(--brand); }
.btn--accent:hover { --btn-bg: var(--brand-hover); --btn-bd: var(--brand-hover); }
.btn--outline { --btn-bg: transparent; --btn-fg: var(--text); --btn-bd: var(--border-strong); }
.btn--outline:hover { --btn-bd: var(--text); }
.invert .btn--outline { --btn-fg: var(--text-invert); --btn-bd: var(--border-invert); }
.invert .btn--outline:hover { --btn-bd: var(--text-invert); }
.btn--sm { font-size: var(--text-xs); padding: 0.7em 1.1em; }
.btn--lg { font-size: var(--text-base); padding: 0.95em 1.7em; }
.btn .arr { transition: transform var(--dur-base) var(--ease); }
.btn:hover .arr { transform: translateX(3px); }

/* ---------- TAG ---------- */
.tag {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface);
  border: var(--border-1);
  border-radius: var(--radius-pill);
  padding: 0.4em 0.85em;
}
.tag--ok { background: var(--ok-tint); border-color: #C6DCC8; color: var(--ok); }
.tag--accent { background: var(--accent-50); color: var(--brand-ink); border-color: var(--accent-100); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.dot--live { animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- CARD ---------- */
.card {
  background: var(--surface);
  border: var(--border-1);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.card--hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card--invert { background: var(--surface-invert); color: var(--text-invert); border-color: var(--border-invert); }

/* ---------- INPUT ---------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}
.input, .textarea {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.7em 0.9em;
  width: 100%;
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.textarea { font-family: var(--font-sans); resize: vertical; min-height: 76px; }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgba(225,74,40,.16); }
.invert .field__label { color: var(--text-invert-muted); }
.invert .input, .invert .textarea { background: var(--surface-invert); border-color: var(--border-invert); color: var(--text-invert); }
.invert .input::placeholder, .invert .textarea::placeholder { color: var(--w-400); }
.invert .input:focus, .invert .textarea:focus { border-color: var(--text-invert); }

/* ---------- LAYOUT HELPERS ---------- */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.rule { height: 1px; background: var(--border); border: 0; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--text); color: var(--text-invert);
  padding: var(--space-3) var(--space-4); border-radius: 0 0 var(--radius-md) 0;
  font-family: var(--font-mono); font-size: var(--text-sm);
}
.skip-link:focus { left: 0; }

/* ---------- SECTIONS ---------- */
section { position: relative; }
.sect { padding-block: clamp(4rem, 9vw, 7rem); }
.sect > .container { position: relative; z-index: 1; }
.sect--tight { padding-block: clamp(3rem, 6vw, 5rem); }
.invert { background: var(--bg-invert); color: var(--text-invert); }
.invert p, .invert h1, .invert h2, .invert h3, .invert h4, .invert h5, .invert li { color: var(--text-invert); }
.invert .lead, .invert .muted { color: var(--text-invert-muted); }
.invert .eyebrow { color: var(--text-invert-muted); }
.invert .rule { background: var(--border-invert); }
.invert .code { background: rgba(255,255,255,.06); border-color: var(--border-invert); }

.sec-head { display: flex; align-items: flex-start; gap: var(--space-4); margin-bottom: var(--space-6); }
.sec-num {
  font-family: var(--font-mono); font-size: var(--text-sm); font-weight: var(--fw-medium);
  color: var(--brand); letter-spacing: var(--tracking-wide);
  padding-top: 0.7em; flex: 0 0 auto;
}
.sec-head h2 { max-width: 24ch; }
.sec-intro { max-width: 58ch; margin-top: var(--space-4); }

/* ---------- NAV ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: var(--border-1);
}
.nav__inner { display: flex; align-items: center; gap: var(--space-5); height: 68px; transition: height var(--dur-slow) var(--ease); }
.nav__brand { display: inline-flex; align-items: center; gap: 0.65em; text-decoration: none; }
.nav__brand .wordmark { font-size: 1.15rem; }
.nav__links { display: flex; gap: var(--space-5); margin-left: var(--space-5); }
.nav__links a {
  font-family: var(--font-mono); font-size: var(--text-sm);
  color: var(--w-700); text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__cta { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }
.nav__menu { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav__menu span { display: block; width: 22px; height: 1.5px; background: var(--text); margin: 4px 0; }
.nav.is-scrolled { box-shadow: var(--shadow-sm); }
.nav.is-scrolled .nav__inner { height: 56px; }

/* ---------- HERO ---------- */
.hero { padding-top: clamp(2rem, 4vw, 3.5rem); padding-bottom: clamp(2rem, 4vw, 3.5rem); overflow: hidden; }
.hero__grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.02fr 0.98fr; gap: clamp(2rem, 4vw, 4rem); align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 4.3vw, 3.6rem); margin: var(--space-3) 0; text-wrap: balance; }
.hero .lead { font-size: clamp(1rem, 1.3vw, 1.125rem); margin-bottom: var(--space-5); max-width: 48ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.hero__note {
  margin-top: var(--space-4);
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5);
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--w-700);
}
.hero__note span { display: inline-flex; align-items: center; gap: 0.5em; }
.hero__note span::before { content: "✓"; color: var(--brand); font-weight: 700; }

/* ---------- PHONE MOCK (hero visual) ---------- */
.phone-wrap { position: relative; display: flex; justify-content: center; }
.phone-wrap::before {
  content: ""; position: absolute; inset: -8% -12%;
  background: radial-gradient(60% 55% at 50% 42%, var(--w-100), transparent 70%);
  z-index: 0;
}
.phone { position: relative; z-index: 1; width: 284px; }
.phone__face {
  background: linear-gradient(160deg, #2d2521 0%, var(--w-950) 60%);
  border-radius: 50px;
  padding: 11px;
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255,255,255,.09), inset 0 1px 0 rgba(255,255,255,.05);
}
.phone__screen {
  background: var(--w-25);
  border-radius: 40px;
  overflow: hidden;
  width: 262px;   /* 284 – 2×11px face padding */
  height: 568px;  /* 262 × 852/393 — locked, never shrinks */
  display: flex; flex-direction: column;
}

/* Status bar with Dynamic Island */
.phone__status {
  height: 50px; flex: 0 0 auto;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; padding: 0 18px;
}
.phone__time { font-family: var(--font-mono); font-size: 11px; font-weight: var(--fw-semibold); letter-spacing: -0.02em; color: var(--text); }
.phone__island {
  width: 80px; height: 24px; background: #000; border-radius: 99px; position: relative;
  box-shadow: 0 1px 5px rgba(0,0,0,.8), 0 0 0 0.5px rgba(0,0,0,1);
}
.phone__island::after {
  content: ""; position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%; background: #0c0c1a;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.03), inset 0 0 4px rgba(90,110,255,.22);
}
.phone__icons { display: flex; align-items: center; justify-content: flex-end; gap: 5px; color: var(--text); }

/* Home indicator */
.phone__home { height: 28px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.phone__home::before { content: ""; width: 36%; height: 5px; border-radius: 99px; background: var(--text); opacity: .18; }

/* Hardware side buttons */
.phone__btn {
  position: absolute;
  background: linear-gradient(to right, #252120, #1e1b18);
  box-shadow: inset 0 0 0 0.5px rgba(255,255,255,.06);
}
.phone__btn--silent { left: -3.5px;  top: 17%; width: 3.5px; height: 3.5%; border-radius: 2px 0 0 2px; }
.phone__btn--vol-up { left: -3.5px;  top: 26%; width: 3.5px; height: 9%;   border-radius: 2px 0 0 2px; }
.phone__btn--vol-dn { left: -3.5px;  top: 38%; width: 3.5px; height: 9%;   border-radius: 2px 0 0 2px; }
.phone__btn--power  { right: -3.5px; top: 30%; width: 3.5px; height: 13%;  border-radius: 0 2px 2px 0; }

/* ---------- APP SCREEN ---------- */
.app { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; font-size: 13px; }
.app__top {
  padding: 4px 16px 13px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--w-100);
}
.app__logo {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px; background: var(--w-950);
  display: flex; align-items: center; justify-content: center; color: var(--w-25);
  font-family: var(--font-mono); font-weight: var(--fw-bold); font-size: 13px; letter-spacing: -0.06em;
}
.app__logo .z { color: var(--brand); }
.app__name { font-family: var(--font-mono); font-weight: var(--fw-semibold); letter-spacing: .04em; font-size: 12px; }
.app__sub  { font-family: var(--font-mono); font-size: 10px; color: var(--w-500); letter-spacing: .08em; margin-top: 1px; }
.app__live { margin-left: auto; color: var(--ok); display: flex; }

.app__body { padding: 13px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.app__h { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--w-500); }

.app__hives { display: flex; flex-direction: column; gap: 7px; }
.app__hive {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 9px 11px; border: 1px solid var(--w-100); border-radius: 9px;
  background: var(--w-25); cursor: pointer; font: inherit;
  transition: border-color var(--dur-base) var(--ease), background var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.app__hive.is-on { border-color: var(--brand); background: #fff; box-shadow: 0 1px 6px rgba(26,23,20,.06); }
.app__dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--w-300); transition: background var(--dur-base) var(--ease); }
.app__hive.is-on .app__dot { background: var(--brand); }
.app__id b { display: block; font-weight: var(--fw-semibold); font-size: 12px; }
.app__id small { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--w-500); margin-top: 1px; }
.app__kg { margin-left: auto; text-align: right; font-family: var(--font-mono); }
.app__kg span { display: block; font-size: 12px; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.app__kg em { font-style: normal; font-size: 10px; color: var(--ok); }
.app__kg em.dn { color: var(--brand-ink); }

.app__chart { height: 88px; width: 100%; flex: 0 0 auto; }
.app .spark__grid { stroke: var(--w-100); }
.app .spark__area { fill: rgba(225,74,40,.10); }

.app__foot { padding: 0 16px 14px; }
.app__cta {
  padding: 12px; background: var(--brand); color: #fff; border-radius: 11px;
  text-align: center; font-family: var(--font-mono); font-weight: var(--fw-semibold);
  font-size: 11px; letter-spacing: .03em;
}

/* ---------- TEASER: the hero phone opens the demo ---------- */
.phone-wrap { flex-direction: column; align-items: center; }
#phone-teaser { cursor: pointer; }
#phone-teaser:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 8px; border-radius: 56px; }
#phone-teaser:hover .phone__face {
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255,255,255,.09), inset 0 1px 0 rgba(255,255,255,.05), 0 0 0 2px var(--brand);
}
@keyframes phoneGlow {
  0%, 100% { box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255,255,255,.09), inset 0 1px 0 rgba(255,255,255,.05); }
  50%      { box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255,255,255,.09), inset 0 1px 0 rgba(255,255,255,.05), 0 0 0 3px rgba(225,74,40,.5), 0 0 28px rgba(225,74,40,.18); }
}
#phone-teaser .phone__face { animation: phoneGlow 2.6s var(--ease) infinite; }
#phone-teaser:hover .phone__face { animation-play-state: paused; }

@keyframes phoneShake {
  0%, 100% { transform: rotate(0) translateX(0); }
  20% { transform: rotate(-4deg) translateX(-3px); }
  40% { transform: rotate(4deg)  translateX(3px); }
  60% { transform: rotate(-2.5deg) translateX(-2px); }
  80% { transform: rotate(2deg)  translateX(1px); }
}
.phone.is-shaking { animation: phoneShake .55s cubic-bezier(.22,1,.36,1); }

.phone__hint {
  display: flex; align-items: center; gap: 7px;
  margin-top: 14px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em;
  color: var(--text-muted); white-space: nowrap;
  opacity: 0; transition: opacity .6s var(--ease);
  pointer-events: none; user-select: none;
}
.phone__hint.is-visible { opacity: 1; }
.phone__hint-dot {
  width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%;
  background: var(--brand); animation: dotPulse 1.6s var(--ease) infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .35; transform: scale(.6); }
}

/* ---------- DEMO DIALOG ---------- */
dialog.app-dialog {
  position: fixed; inset: 0; z-index: 300;
  width: 100%;
  max-width: none; max-height: none;
  /* Centre against what the viewer can actually SEE. dvh tracks the visible
     viewport as the mobile toolbar shows/retracts; centring in the large
     viewport instead leaves the phone sitting low behind the chrome.
     Coverage is not this box's job — ::backdrop is always viewport-sized. */
  height: 100%;
  height: 100dvh;
  border: 0; padding: 0; margin: 0;
  background: transparent;
  /* on a very short viewport (a landscape phone) the screen's own minimum
     height beats the aspect ratio, so let the dialog scroll rather than clip;
     "safe" centring keeps the top reachable when it overflows */
  overflow: auto;
  overscroll-behavior: contain;
  display: none;
  align-items: center;
  align-items: safe center;
  justify-content: center;
  justify-content: safe center;
}
dialog.app-dialog[open] { display: flex; }
dialog.app-dialog::backdrop {
  background: rgba(26,23,20,.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.app-dialog__close {
  position: absolute; z-index: 1;
  top: max(20px, env(safe-area-inset-top, 0px));
  right: max(20px, env(safe-area-inset-right, 0px));
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.2);
  color: #fff; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-base) var(--ease);
}
.app-dialog__close:hover { background: rgba(255,255,255,.24); }
.app-dialog__close:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Size the phone from whichever constraint binds — viewport width or the
   height budget — and let aspect-ratio derive the height from that width.
   Clamping the height instead makes aspect-ratio shrink the *width*, which
   detaches the face from the frame and skews the whole mock. */
.phone--demo {
  width: min(82vw, 292px, calc((88vh - 40px) * 393 / 852));
  width: min(82vw, 292px, calc((88svh - 40px) * 393 / 852));
  min-width: min(244px, 88vw);   /* never let it collapse to a sliver */
  flex: 0 0 auto;
  animation: phonePop .38s cubic-bezier(.22,1,.36,1);
}
.phone--demo .phone__face { display: flex; flex-direction: column; aspect-ratio: 393 / 852; }
.phone--demo .phone__screen { width: auto; height: auto; flex: 1 1 auto; min-height: 0; overflow: hidden; touch-action: pan-y; }
@keyframes phonePop {
  from { transform: scale(.8) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* ---------- MULTI-SCREEN SYSTEM ---------- */
.app-s { display: none; }
.app-s.is-active { display: flex; animation: screenIn .28s cubic-bezier(.22,1,.36,1); }
.app-s.is-back.is-active { animation-name: screenInBack; }
@keyframes screenIn     { from { opacity: 0; transform: translateX(16px); }  to { opacity: 1; transform: translateX(0); } }
@keyframes screenInBack { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: translateX(0); } }

.app-s .app__body { overflow-y: auto; flex: 1 1 auto; min-height: 0; }
/* let the chart take the slack on a tall screen instead of leaving a gap,
   and drop the day's total to the foot of the list */
/* the viewBox is stretched to fit (preserveAspectRatio="none"), so cap the
   height — past this the end-point dot distorts into an oval */
.app-s .app__chart { flex: 1 1 88px; min-height: 88px; max-height: 150px; }
.app-s .app__sum { margin-top: auto; }
.app-s .app__cta { cursor: pointer; user-select: none; }
.app-s .app__cta:focus-visible,
.app-s .app__hive:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.app-s .app__hive { cursor: pointer; }
.app-s .app__hive:hover { border-color: var(--w-300); }
.app__cta--ghost { background: transparent; color: var(--w-500); border: 1px solid var(--w-200); }

.app__back {
  background: none; border: 0; cursor: pointer;
  padding: 0 10px 0 0; color: var(--brand);
  font-size: 19px; line-height: 1; flex: 0 0 auto;
}
.app__back:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.app__chev { margin-left: 8px; color: var(--w-300); font-size: 17px; line-height: 1; flex: 0 0 auto; }
.app__hive.is-on .app__chev { color: var(--brand); }

.app__sum {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 12px; border-radius: 9px;
  background: var(--w-100); font-size: 12px;
}
.app__sum b { font-family: var(--font-mono); font-size: 13px; }

.app__big { display: flex; align-items: baseline; gap: .3em; }
.app__big b {
  font-family: var(--font-mono); font-size: 30px; font-weight: var(--fw-semibold);
  letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums;
}
.app__big .u { font-size: 13px; color: var(--w-500); }
.app__big em { margin-left: auto; font-style: normal; font-family: var(--font-mono); font-size: 12px; color: var(--ok); }
.app__big em.dn { color: var(--brand-ink); }

.app__tabs { display: flex; gap: 5px; }
.app__tab {
  flex: 1; padding: 7px 0; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px;
  border: 1px solid var(--w-200); border-radius: 8px;
  background: var(--w-25); color: var(--w-500);
  transition: border-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}
.app__tab.is-on { border-color: var(--brand); color: var(--brand); background: #fff; font-weight: var(--fw-semibold); }
.app__tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.app__stats { display: flex; gap: 7px; }
.app__stats div {
  flex: 1; padding: 9px 10px; border: 1px solid var(--w-100);
  border-radius: 9px; background: var(--w-25);
}
.app__stats span {
  display: block; font-family: var(--font-mono); font-size: 9px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--w-500);
}
.app__stats b {
  display: block; margin-top: 3px; font-family: var(--font-mono);
  font-size: 12px; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums;
}

.app__ev { display: flex; flex-direction: column; gap: 8px; }
.app__ev-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 11px; border: 1px solid var(--w-100);
  border-radius: 9px; background: var(--w-25);
}
.app__ev-dot { width: 8px; height: 8px; margin-top: 4px; flex: 0 0 auto; border-radius: 50%; background: var(--w-300); }
.app__ev-dot--up   { background: var(--ok); }
.app__ev-dot--down { background: var(--brand); }
.app__ev-item b { display: block; font-size: 12px; font-weight: var(--fw-semibold); }
.app__ev-item small { display: block; margin-top: 2px; font-family: var(--font-mono); font-size: 10px; color: var(--w-500); }

/* shared sparkline geometry */
.spark__line { fill: none; stroke: var(--brand); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark__area { fill: rgba(225,74,40,.14); stroke: none; }
.spark__grid { stroke: rgba(242,236,225,.10); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark__tip  { fill: var(--brand); }

/* ---------- HONEYCOMB BACKDROP ---------- */
.comb {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cg fill='none' stroke='%23D8CFBE' stroke-width='1.1'%3E%3Cpath d='M28 1 L54 16 L54 46 L28 61 L2 46 L2 16 Z'/%3E%3Cpath d='M28 49.5 L54 64.5 L54 94.5 L28 109.5 L2 94.5 L2 64.5 Z'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(70% 60% at 72% 45%, #000 0%, transparent 72%);
          mask-image: radial-gradient(70% 60% at 72% 45%, #000 0%, transparent 72%);
}
.invert .comb { opacity: .16; }

/* ---------- BEES ---------- */
.bees { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bee {
  position: absolute; top: 0; left: 0;
  width: 30px; height: 21px;
  --bee-body: var(--w-950);
  --bee-stripe: var(--brand);
  --bee-wing: rgba(26,23,20,.20);
  --bee-wing-line: rgba(26,23,20,.32);
  will-change: transform;
}
.invert .bee { --bee-body: var(--w-50); --bee-wing: rgba(251,248,242,.22); --bee-wing-line: rgba(251,248,242,.36); }

.bee__body, .bee__head, .bee__sting { fill: var(--bee-body); }
.bee__stripe { fill: var(--bee-stripe); }
.bee__ant { fill: none; stroke: var(--bee-body); stroke-width: 1.3; stroke-linecap: round; }
.bee__wing { fill: var(--bee-wing); stroke: var(--bee-wing-line); stroke-width: .8; transform-box: fill-box; transform-origin: 50% 92%; }
.bee__wing--far  { animation: bee-wing .16s linear infinite alternate; }
.bee__wing--near { animation: bee-wing .16s linear infinite alternate-reverse; }

@keyframes bee-wing { from { transform: scaleY(1) rotate(0deg); } to { transform: scaleY(.35) rotate(-9deg); } }

/* Flight paths. Percentages in translate() resolve against the bee's own
   box, not the track, so the horizontal sweep is in vw — every .bees
   layer sits in a full-bleed section — and the bobbing is in px. */
@keyframes bee-drift-a {
  0%   { transform: translate(-8vw, 340px) rotate(7deg)  scale(.92); opacity: 0; }
  7%   { opacity: 1; }
  27%  { transform: translate(24vw, 120px) rotate(-5deg) scale(1); }
  48%  { transform: translate(48vw, 300px) rotate(6deg)  scale(.95); }
  71%  { transform: translate(72vw, 90px)  rotate(-4deg) scale(1.04); }
  93%  { opacity: 1; }
  100% { transform: translate(106vw, 230px) rotate(5deg) scale(.9);  opacity: 0; }
}
@keyframes bee-drift-b {
  0%   { transform: translate(104vw, 90px)  rotate(-172deg) scale(.86); opacity: 0; }
  9%   { opacity: 1; }
  30%  { transform: translate(70vw, 270px)  rotate(-186deg) scale(.94); }
  55%  { transform: translate(42vw, 110px)  rotate(-174deg) scale(.88); }
  78%  { transform: translate(14vw, 250px)  rotate(-188deg) scale(.95); }
  91%  { opacity: 1; }
  100% { transform: translate(-10vw, 160px) rotate(-176deg) scale(.86); opacity: 0; }
}
@keyframes bee-hover {
  0%, 100% { transform: translate(0, 0) rotate(-4deg); }
  25%      { transform: translate(10px, -12px) rotate(3deg); }
  50%      { transform: translate(-6px, -4px) rotate(-6deg); }
  75%      { transform: translate(8px, 7px)  rotate(4deg); }
}

.bee--a { width: 30px; height: 21px; animation: bee-drift-a 26s linear infinite; }
.bee--b { width: 22px; height: 15px; animation: bee-drift-b 34s linear 6s infinite; }
.bee--hover {
  width: 26px; height: 18px;
  top: auto; right: auto; left: 5%; bottom: 12%;
  animation: bee-hover 9s var(--ease) infinite;
}

/* ---------- STRIP ---------- */
.strip { border-block: var(--border-1); background: var(--bg-paper); }
.strip__inner { padding-block: var(--space-6); }
/* one centred statement rather than a label plus a list */
.strip__line {
  max-width: none;
  margin-inline: auto;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.0625rem, 2.1vw, 1.5rem);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
  color: var(--text);
  text-wrap: balance;
}
.strip__line::before {
  content: "";
  display: inline-block;
  vertical-align: middle;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
  margin-right: .7em;
  position: relative; top: -0.08em;
}

/* ---------- STEPS ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); counter-reset: step; }
.step { position: relative; padding-top: var(--space-4); }
.step::before {
  content: counter(step, decimal-leading-zero); counter-increment: step;
  font-family: var(--font-mono); font-size: var(--text-sm); color: var(--brand);
  letter-spacing: var(--tracking-wide);
}
.step__bar { height: 2px; background: var(--border-strong); margin: var(--space-3) 0 var(--space-4); position: relative; }
.step:first-child .step__bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--brand); }
.step h4 { margin-bottom: var(--space-2); }
.step p { font-size: var(--text-sm); color: var(--w-700); line-height: 1.45; }
.step .when { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--brand-ink); display: block; margin-top: var(--space-2); }

/* ---------- ACCESS (secret gate) ---------- */
.access-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.access-form { display: flex; flex-direction: column; gap: var(--space-4); max-width: 420px; }
.access-form .row { gap: var(--space-3); }
.access-msg {
  font-family: var(--font-mono); font-size: var(--text-sm);
  display: none; align-items: center; gap: .55em;
  color: var(--brand-ink);
}
.access-msg.is-on { display: inline-flex; }
.access-note { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-faint); }

/* ---------- CONTACT ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
/* Phone and address are the primary way in — set solid and large enough to
   read at a glance, never as a thin footnote. */
.contact-direct { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-6); }
.contact-direct__item {
  display: flex; flex-direction: column; gap: var(--space-2);
  text-decoration: none;
  padding: var(--space-4) var(--space-5);
  border: 1.5px solid var(--border-invert);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.05);
  transition: border-color var(--dur-base) var(--ease), background var(--dur-base) var(--ease), transform var(--dur-fast) var(--ease);
}
.contact-direct__item:hover { border-color: var(--brand); background: rgba(225,74,40,.12); transform: translateY(-1px); }
.contact-direct__item:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.contact-direct__label {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--text-invert-muted);
}
.contact-direct__value {
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 2.4vw, 1.625rem);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--text-invert);
  white-space: nowrap;
}

/* The form is the point of the section, so it sits on a light card raised off
   the inverted band rather than as dark inputs on a dark ground. */
.contact-card {
  background: var(--bg-paper);
  border-radius: var(--radius-xl);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  box-shadow: var(--shadow-lg);
}
.contact-card__title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  line-height: var(--leading-snug);
  color: var(--text);
  max-width: none;
  margin-bottom: var(--space-5);
}
.contact-form { display: flex; flex-direction: column; gap: var(--space-4); }
.contact-submit { width: 100%; margin-top: var(--space-2); }

/* the card is a light island, so its fields keep the light treatment even
   though the section around it is inverted */
.invert .contact-card__title { color: var(--text); }
.invert .contact-card .field__label { color: var(--text-muted); }
.invert .contact-card .input,
.invert .contact-card .textarea { background: #fff; border-color: var(--border-strong); color: var(--text); }
.invert .contact-card .input::placeholder,
.invert .contact-card .textarea::placeholder { color: var(--text-faint); }
.invert .contact-card .input:focus,
.invert .contact-card .textarea:focus { border-color: var(--text); }
.invert .contact-card .muted { color: var(--text-faint); }
.contact-card .input, .contact-card .textarea { font-size: 1.0625rem; padding: 0.8em 0.95em; }

.contact-msg {
  font-family: var(--font-mono); font-size: var(--text-sm); color: var(--brand-ink);
  display: none;
}
.contact-msg.is-on { display: inline; }
.contact-note { font-size: var(--text-sm); color: var(--text-muted); max-width: 44ch; }
.invert .contact-card .contact-note { color: var(--text-muted); }
.link {
  color: var(--text); text-decoration: none;
  background-image: linear-gradient(var(--brand), var(--brand));
  background-size: 100% 1.5px; background-position: 0 100%; background-repeat: no-repeat;
  padding-bottom: 1px;
  transition: background-size var(--dur-base) var(--ease), color var(--dur-fast) var(--ease);
}
.link:hover { color: var(--brand-ink); background-size: 100% calc(100% - 2px); }
.invert .link { color: var(--text-invert); }
.invert .link:hover { color: var(--accent-100); }

/* ---------- FOOTER ---------- */
.footer { padding-block: var(--space-8) var(--space-6); }
.footer__top { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--space-6); padding-bottom: var(--space-7); }
.footer__brand .wordmark { font-size: 1.4rem; }
.footer__brand p { font-size: var(--text-sm); color: var(--text-invert-muted); margin-top: var(--space-4); max-width: 34ch; }
.footer__col h5 { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-invert-muted); margin-bottom: var(--space-4); }
.footer__col a { display: block; color: var(--text-invert); text-decoration: none; font-size: var(--text-sm); padding: 4px 0; opacity: .85; }
.footer__col a:hover { opacity: 1; color: var(--brand); }
.footer__col a.footer__strong {
  font-family: var(--font-mono); font-size: var(--text-base);
  font-weight: var(--fw-semibold); opacity: 1; padding: 5px 0;
}
.footer__bot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; padding-top: var(--space-5); border-top: 1px solid var(--border-invert); }
.footer__bot, .footer__bot a { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-invert-muted); }
.footer__bot a { text-decoration: none; }
.footer__bot a:hover { color: var(--brand); }

/* ---------- MOTION (scroll reveals) ----------
   Hidden at rest only when JS is present (.js gate on <html>). An
   IntersectionObserver adds .in; the transition lives in CSS so the end
   state always applies — content is never stuck invisible. */
.js .hero__copy > *,
.js .hero .phone,
.js .strip__inner,
.js .sec-head,
.js .steps > *,
.js .access-copy > *,
.js .access-form,
.js .contact-copy > *,
.js .contact-card,
.js .footer__top > * {
  opacity: 0; transform: translateY(22px);
  transition: opacity .7s cubic-bezier(.22,1,.36,1), transform .7s cubic-bezier(.22,1,.36,1);
}
.js .in { opacity: 1 !important; transform: none !important; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 940px) {
  .hero__grid, .access-grid, .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .phone-wrap { order: -1; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .footer__top { grid-template-columns: 1fr 1fr; }
  .nav__links { display: none; }
  .nav__links.open {
    display: flex; flex-direction: column; gap: var(--space-3);
    position: absolute; top: 100%; left: 0; right: 0; margin-left: 0;
    background: var(--bg); border-bottom: var(--border-1);
    padding: var(--space-4) var(--gutter); box-shadow: var(--shadow-md);
  }
  .nav__links.open a { padding: var(--space-2) 0; font-size: var(--text-base); }
  .nav__menu { display: block; }
}
@media (max-width: 620px) {
  .steps { grid-template-columns: 1fr; }
  /* stack the contact cards and ease the type down so the address, which
     must not break mid-word, still fits a 320px screen */
  .contact-direct { flex-direction: column; }
  .contact-direct__item { width: 100%; }
  .contact-direct__value { font-size: 1.25rem; }
  .footer__top { grid-template-columns: 1fr; gap: var(--space-5); }
  .sec-head { flex-direction: column; gap: var(--space-2); }
  .sec-num { padding-top: 0; }
}

@media (max-width: 620px) {
  .phone--demo {
    width: min(92vw, 330px, calc((90vh - 24px) * 393 / 852));
    width: min(92vw, 330px, calc((90svh - 24px) * 393 / 852));
  }
  .app-dialog__close { top: max(12px, env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); }
  /* compact the teaser's chrome on a handset so the app screen gets the room */
  #phone-teaser .phone__status { height: 40px; padding: 0 14px; }
  #phone-teaser .phone__home { height: 22px; }
  #phone-teaser .phone__btn { display: none; }
}

/* The phone frame is a fixed 284px (plus its side buttons); scale it rather
   than let it push the page wide on the narrowest handsets. */
@media (max-width: 360px) {
  .phone { transform: scale(.86); transform-origin: top center; }
  .phone-wrap { margin-bottom: -80px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: .01ms !important; }
  /* bees settle rather than vanish: no flight, no wingbeat */
  .phone.is-shaking, .phone__hint-dot, #phone-teaser .phone__face,
  .phone--demo, .app-s.is-active { animation: none !important; }
  .bee { animation: none !important; }
  .bee__wing { animation: none !important; }
  .bee--a { transform: translate(16vw, 150px); }
  .bee--b { transform: translate(68vw, 110px) rotate(-176deg); }
  .js .hero__copy > *, .js .hero .phone, .js .strip__inner, .js .sec-head, .js .steps > *,
  .js .access-copy > *, .js .access-form,
  .js .contact-copy > *, .js .contact-card,
  .js .footer__top > * { opacity: 1 !important; transform: none !important; }
}
