/* FitZones website — palette matches the app: dark navy, iOS system zone colors. */

:root {
  --bg: #0a0d15;
  --bg-raised: #12172480;
  --card: #131a2a;
  --border: rgba(255, 255, 255, 0.09);
  --text: #e9edf5;
  --muted: #98a2b8;
  --faint: #6b7488;
  --z1: #0a84ff;
  --z2: #30d158;
  --z3: #ffd60a;
  --z4: #ff9f0a;
  --z5: #ff453a;
  --max-width: 1020px;
  /* Bezel screen window, measured from the iPhone 17 Pro Max frame PNG. */
  --screen-left: 5.102%;
  --screen-top: 2.2%;
  --screen-width: 89.796%;
  --screen-height: 95.6%;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--z1); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 { font-size: clamp(2.1rem, 5.5vw, 3.3rem); margin: 0 0 0.5em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin: 0 0 0.6em; }
h3 { font-size: 1.1rem; margin: 0 0 0.4em; }

p { margin: 0 0 1em; }
.muted { color: var(--muted); }

/* ---- Header ---- */

header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 13, 21, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }

.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 0.95rem;
}
.nav-links a { color: var(--muted); transition: color 0.25s ease; white-space: nowrap; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

.download-link {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--z2);
  color: #0b0e17 !important;
  font-weight: 600;
  transition: transform 0.25s ease, filter 0.25s ease;
}
.download-link:hover { filter: brightness(1.08); transform: translateY(-1px); text-decoration: none; }

/* Drop the in-page section links first, then everything but Download. */
@media (max-width: 800px) {
  .nav-links .nav-sec { display: none; }
}
@media (max-width: 640px) {
  .nav-links a:not(.download-link) { display: none; }
}

/* ---- Device frame (iPhone 17 Pro Max bezel over a screenshot or video) ---- */

.device {
  position: relative;
  aspect-ratio: 1470 / 3000;
  width: 100%;
}
.device .frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.device .screen {
  position: absolute;
  left: var(--screen-left);
  top: var(--screen-top);
  width: var(--screen-width);
  height: var(--screen-height);
  object-fit: cover;
  z-index: 1;
  background: #000;
  /* iPhone 17 Pro Max display corner (~165px on a 1320×2868 screen), so square
     screenshot corners stay tucked behind the bezel's rounded frame. */
  border-radius: 12.5% / 5.75%;
}

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

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
  padding: 72px 0 88px;
}
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; padding: 48px 0 56px; }
}

.hero .kicker {
  color: var(--z2);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.hero .lede {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 34em;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.appstore-badge { height: 52px; width: auto; display: block; transition: transform 0.25s ease; }
a:hover .appstore-badge { transform: scale(1.04); }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.25s ease, filter 0.25s ease, border-color 0.25s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-ghost { border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--faint); }
.btn-coffee { background: #ffdd00; color: #111; }
.btn-coffee:hover { filter: brightness(1.08); }

.requirements {
  margin-top: 18px;
  font-size: 0.88rem;
  color: var(--faint);
}

/* Hero phone: ambient glow sweeping through the five zone colors + gentle float. */

.hero-stage {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}
.hero-stage .glow {
  position: absolute;
  inset: -12% -22%;
  background: conic-gradient(from 40deg,
    var(--z1), var(--z2), var(--z3), var(--z4), var(--z5), var(--z1));
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.32;
  animation: glow-spin 18s linear infinite;
  z-index: 0;
}
.hero-stage .device {
  filter: drop-shadow(0 34px 60px rgba(0, 0, 0, 0.55));
}

/* Earbud tucked into the end of the hero title, crossfading between the
   sensor-off and sensor-lit frames to spotlight the heart rate sensor. */
.hero-copy { position: relative; }
.hero-bud {
  position: absolute;
  top: -52px;
  left: 3%;
  width: 118px;
  aspect-ratio: 1930 / 2366;
  z-index: 5;
  rotate: -12deg;
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.55));
  animation: float 7.5s ease-in-out 1.2s infinite;
  pointer-events: none;
}
.hero-bud img {
  position: absolute;
  inset: 0;
  width: 100%;
}
.hero-bud .lit {
  opacity: 0;
  animation: sensor-reveal 6s ease-in-out infinite;
}
@media (max-width: 800px) {
  .hero-bud { top: -30px; right: auto; left: 55%; width: 100px; }
}
@keyframes sensor-reveal {
  0%, 22% { opacity: 0; }
  40%, 72% { opacity: 1; }
  90%, 100% { opacity: 0; }
}

@keyframes glow-spin { to { transform: rotate(1turn); } }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* Hero copy entrance. */
.rise {
  opacity: 0;
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

/* ---- Scroll reveal ---- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.3, 1);
  transition-delay: var(--d, 0s);
}
.reveal.in { opacity: 1; transform: none; }

/* ---- Sections ---- */

section { padding: 72px 0; }
section.alt { background: var(--bg-raised); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-intro { max-width: 42em; color: var(--muted); font-size: 1.08rem; }

/* ---- Live zone switcher ---- */

.live-section {
  position: relative;
  overflow: hidden;
}
.live-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 55% at 28% 50%, var(--stage-glow, var(--z1)) 0%, transparent 70%);
  opacity: 0.16;
  transition: background 0.9s ease;
  pointer-events: none;
}

.live-grid {
  position: relative;
  display: grid;
  grid-template-columns: 0.8fr 1fr;
  gap: 56px;
  align-items: center;
}
/* Device on the left for variety; copy reads first in the source and on mobile. */
.live-grid .live-copy { order: 2; }
@media (max-width: 800px) {
  .live-grid { grid-template-columns: 1fr; gap: 40px; }
  .live-grid .live-copy { order: 0; }
}

.live-stage {
  position: relative;
  max-width: 300px;
  margin: 0 auto;
  width: 100%;
}
.live-stage .device { filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.5)); }
.live-stage .screen {
  opacity: 0;
  transition: opacity 0.65s ease;
}
.live-stage .screen.active { opacity: 1; }

/* Zone picker styled like the app's own live zone bar: a row of dimmed color
   segments where the active one grows and reveals its label. Always one line. */
.zone-pills {
  display: flex;
  gap: 6px;
  margin: 26px 0 18px;
  max-width: 460px;
}
.zone-pill {
  --zc: var(--z1);
  appearance: none;
  border: none;
  flex: 1 1 0;
  min-width: 0;
  height: 44px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--zc) 30%, var(--card));
  color: #0b0e17;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: flex-grow 0.45s cubic-bezier(0.2, 0.7, 0.3, 1), background 0.35s ease;
}
.zone-pill .label {
  white-space: nowrap;
  max-width: 0;
  opacity: 0;
  transition: max-width 0.45s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.3s ease;
}
.zone-pill:hover { background: color-mix(in srgb, var(--zc) 55%, var(--card)); }
.zone-pill:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.zone-pill[aria-pressed="true"] {
  flex-grow: 2.6;
  background: var(--zc);
}
.zone-pill[aria-pressed="true"] .label { max-width: 90px; opacity: 1; }
.zone-pill.pill-z1[aria-pressed="true"],
.zone-pill.pill-z5[aria-pressed="true"] { color: #fff; }

.live-caption h3 {
  font-size: 1.5rem;
  margin: 0 0 0.35em;
  transition: color 0.5s ease;
}
.live-caption p {
  color: var(--muted);
  max-width: 30em;
  min-height: 5.2em;
  margin: 0;
}
@media (max-width: 800px) { .live-caption p { min-height: 0; } }

/* ---- AirPods section ---- */

.airpods-section {
  position: relative;
  overflow: hidden;
}
.airpods-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(55% 60% at 74% 45%, rgba(255, 69, 58, 0.1), transparent 70%);
  pointer-events: none;
}

.airpods-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}
@media (max-width: 800px) { .airpods-grid { grid-template-columns: 1fr; gap: 44px; } }

.airpods-points {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
}
.airpods-points li { margin-bottom: 1em; max-width: 34em; }
.airpods-points strong { color: var(--text); }

.airpods-stage {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}
.airpods-stage .pods {
  position: relative;
  width: 100%;
  z-index: 2;
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.55));
  animation: float 9s ease-in-out infinite;
}

/* Heartbeat ripples radiating from the earbuds. */
.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46%;
  aspect-ratio: 1;
  margin: -23% 0 0 -23%;
  border: 2px solid var(--z5);
  border-radius: 50%;
  opacity: 0;
  animation: pulse-ring 2.4s ease-out infinite;
  z-index: 1;
}
.pulse-ring.ring-2 { animation-delay: 1.2s; }
@keyframes pulse-ring {
  0% { transform: scale(0.55); opacity: 0.5; }
  70% { opacity: 0.12; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ECG trace drifting behind the earbuds. */
.airpods-stage .ecg {
  position: absolute;
  left: -4%;
  right: -4%;
  width: 108%;
  bottom: 6%;
  height: 72px;
  color: var(--z2);
  opacity: 0.5;
  z-index: 0;
  stroke-dasharray: 130 950;
  animation: ecg-run 4.5s linear infinite;
}
@keyframes ecg-run {
  from { stroke-dashoffset: 1080; }
  to { stroke-dashoffset: 0; }
}

.bpm-chip {
  position: absolute;
  top: 8%;
  right: 2%;
  z-index: 3;
  display: flex;
  align-items: baseline;
  gap: 7px;
  background: rgba(19, 26, 42, 0.9);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.bpm-chip small { color: var(--muted); font-weight: 500; }
.bpm-chip .heart {
  color: var(--z5);
  animation: heartbeat 1s ease-in-out infinite;
  display: inline-block;
  transform-origin: center;
}
@keyframes heartbeat {
  0%, 30%, 100% { transform: scale(1); }
  12% { transform: scale(1.3); }
}

/* ---- Zone strip ---- */

.zone-strip {
  display: flex;
  gap: 6px;
  margin: 28px 0 8px;
}
.zone-strip div {
  flex: 1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #0b0e17;
  transition: transform 0.25s ease;
}
.zone-strip div:hover { transform: translateY(-3px); }
.zone-strip small { display: block; font-weight: 500; opacity: 0.75; }
.zs1 { background: var(--z1); color: #fff !important; }
.zs2 { background: var(--z2); }
.zs3 { background: var(--z3); }
.zs4 { background: var(--z4); }
.zs5 { background: var(--z5); color: #fff !important; }
@media (max-width: 720px) {
  .zone-strip { flex-direction: column; }
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 36px;
}
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }

/* ---- Showcase rows (text + framed screenshot) ---- */

.showcase {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
  padding: 44px 0;
}
.showcase.flip { grid-template-columns: 0.9fr 1.1fr; }
.showcase.flip .showcase-copy { order: 2; }
@media (max-width: 800px) {
  .showcase, .showcase.flip { grid-template-columns: 1fr; gap: 32px; }
  .showcase.flip .showcase-copy { order: 0; }
}

.showcase .device {
  max-width: 270px;
  margin: 0 auto;
  filter: drop-shadow(0 26px 44px rgba(0, 0, 0, 0.5));
}
.showcase-copy h3 { font-size: 1.5rem; }
.showcase-copy p { color: var(--muted); max-width: 32em; }
.showcase-copy ul { color: var(--muted); padding-left: 1.2em; margin: 0; }
.showcase-copy li { margin-bottom: 0.5em; }

/* ---- How it works ---- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 36px;
  counter-reset: step;
}
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }

.step {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.step:hover { transform: translateY(-4px); border-color: rgba(255, 255, 255, 0.18); }
.step::before {
  counter-increment: step;
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--z2);
  color: #0b0e17;
  font-weight: 700;
  margin-bottom: 14px;
}
.step p { color: var(--muted); font-size: 0.97rem; margin: 0; }

/* ---- Feature grid ---- */

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 36px;
}
@media (max-width: 900px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .features { grid-template-columns: 1fr; } }

.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.feature:hover { transform: translateY(-4px); border-color: rgba(255, 255, 255, 0.18); }
.feature p { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* ---- Gallery ---- */

.gallery {
  display: flex;
  gap: 32px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 12px 4px 20px;
  justify-content: safe center;
}
.gallery figure {
  flex: 0 0 auto;
  width: 220px;
  margin: 0;
  scroll-snap-align: center;
}
.gallery .device { filter: drop-shadow(0 20px 34px rgba(0, 0, 0, 0.45)); transition: transform 0.3s ease; }
.gallery figure:hover .device { transform: translateY(-6px); }
.gallery figcaption {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 14px;
}

/* ---- Tip jar / closing CTA ---- */

.tip-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 48px 36px;
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}
.tip-card::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 80%;
  background: radial-gradient(50% 60% at 50% 0%, rgba(48, 209, 88, 0.14), transparent 70%);
  pointer-events: none;
}
.tip-card > * { position: relative; }
.tip-card p { color: var(--muted); }
.cta-actions {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ---- Footer ---- */

footer {
  border-top: 1px solid var(--border);
  padding: 36px 0 48px;
  color: var(--faint);
  font-size: 0.9rem;
}
footer .wrap {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
}
footer a { color: var(--muted); }
footer .spacer { margin-left: auto; }

/* ---- Subpages (support / privacy) ---- */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}
.page h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); }
.page .updated { color: var(--faint); font-size: 0.9rem; margin-bottom: 40px; }
.page h2 { font-size: 1.35rem; margin-top: 2.2em; }
.page ul { padding-left: 1.2em; }
.page li { margin-bottom: 0.5em; }

details {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 20px;
  margin-bottom: 12px;
  background: var(--card);
  transition: border-color 0.3s ease;
}
details[open] { border-color: rgba(255, 255, 255, 0.18); }
details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 14px 0;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
details summary::after { content: "+"; color: var(--faint); font-size: 1.3rem; font-weight: 400; }
details[open] summary::after { content: "–"; }
details summary::-webkit-details-marker { display: none; }
details .answer { padding-bottom: 18px; color: var(--muted); }
details .answer p { margin-bottom: 0.7em; }
details .answer p:last-child { margin-bottom: 0; }

.contact-card {
  margin-top: 48px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
}
.contact-card p:last-child { margin: 0; }

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise { animation: none; opacity: 1; }
  .reveal { transition: none; opacity: 1; transform: none; }
  .hero-stage .glow { animation: none; }
  .zone-strip div:hover,
  .step:hover,
  .feature:hover,
  .gallery figure:hover .device,
  .btn:hover { transform: none; }
  .zone-pill, .zone-pill .label { transition: none; }
  .airpods-stage .pods, .bpm-chip .heart { animation: none; }
  .hero-bud { animation: none; }
  .hero-bud .lit { animation: none; opacity: 1; }
  .pulse-ring, .airpods-stage .ecg { animation: none; opacity: 0.25; }
}
