/* Striped — site styles
   Palette is lifted verbatim from the app's Theme.swift so the site and the
   product read as one thing. Don't invent colors here; add them there first. */

:root {
  --field:      #0B140F;   /* page background            */
  --field-deep: #060A07;
  --card:       #101B15;   /* raised surfaces            */
  --card-2:     #16241C;
  --band:       #0E8F5E;
  --mint:       #17C97F;   /* primary accent             */
  --bright:     #4CFFB0;
  --ink:        #EFFFF8;   /* foreground                 */
  --muted:      #8FA89B;   /* muted foreground           */

  --border:      rgba(239, 255, 248, 0.09);
  --border-soft: rgba(239, 255, 248, 0.055);

  --radius: 10px;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --maxw: 66rem;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--field);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

/* ---------------------------------------------------------------- header */

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--field) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
.masthead.scrolled { border-bottom-color: var(--border-soft); }

.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 590;
  font-size: 0.9375rem;
  letter-spacing: -0.012em;
}
.brand img { width: 26px; height: 26px; display: block; border-radius: 6px; }

.masthead nav { display: flex; align-items: center; gap: 1.75rem; font-size: 0.875rem; }
.masthead nav a { color: var(--muted); transition: color 0.15s ease; }
.masthead nav a:hover { color: var(--ink); }

@media (max-width: 34rem) {
  .masthead nav { gap: 1.1rem; font-size: 0.8125rem; }
  .masthead nav a.hide-sm { display: none; }
}

/* ------------------------------------------------------------------ hero */

.hero { padding: clamp(4rem, 11vw, 7.5rem) 0 clamp(2rem, 5vw, 3rem); }

.kicker {
  margin: 0 0 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0 0 1.375rem;
  font-size: clamp(2.375rem, 6.4vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 620;
  max-width: 15ch;
}

.lede {
  margin: 0;
  max-width: 36rem;
  font-size: clamp(1.0625rem, 1.9vw, 1.1875rem);
  line-height: 1.6;
  color: var(--muted);
}
.lede strong { color: var(--ink); font-weight: 500; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.25rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 42px;
  padding: 0 1.25rem;
  border-radius: 8px;
  font-size: 0.9063rem;
  font-weight: 520;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--mint); color: #04160D; }
.btn-primary:hover { background: var(--bright); }
.btn-ghost { border-color: var(--border); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: rgba(239, 255, 248, 0.045); border-color: rgba(239, 255, 248, 0.16); }

/* Inert until the App Store listing is live. To activate: make it an <a>,
   set href to the listing, and swap this class for .btn-primary. */
.btn-pending { border: 1px solid var(--border); color: var(--muted); cursor: default; }

/* --------------------------------------------------------------- 3D swing */

.stage-section { padding: clamp(1rem, 3vw, 2rem) 0 clamp(1.5rem, 3vw, 2.25rem); }

.stage-card {
  position: relative;
  background: linear-gradient(180deg, var(--card) 0%, var(--field) 100%);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  overflow: hidden;
}

.stage {
  position: relative;
  width: 100%;
  height: clamp(420px, 62vh, 620px);
  cursor: grab;
  touch-action: pan-y;
}
.stage:active { cursor: grabbing; }
.stage canvas { display: block; width: 100%; height: 100%; }

.stage-legend {
  position: absolute;
  left: clamp(1rem, 3vw, 1.75rem);
  top: clamp(1rem, 3vw, 1.75rem);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  pointer-events: none;
}
.stage-legend .l-title {
  font-size: 0.8125rem;
  font-weight: 560;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.stage-legend .l-keys {
  list-style: none;
  margin: 0.15rem 0 0.35rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}
.stage-legend .l-keys li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.stage-legend .sw {
  width: 14px;
  height: 2px;
  border-radius: 1px;
  flex: none;
}
.sw-wrist { background: #4cffb0; }
.sw-hip   { background: #17c97f; }
.sw-head  { background: #8fb9a6; }

.stage-legend .l-sub {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* live phase readout, driven by swing.js */
.phase-rail {
  display: flex;
  border-top: 1px solid var(--border-soft);
}
.phase-rail .ph {
  flex: 1;
  padding: 0.875rem clamp(0.75rem, 2vw, 1.5rem);
  border-right: 1px solid var(--border-soft);
  transition: background-color 0.3s ease, color 0.3s ease;
}
.phase-rail .ph:last-child { border-right: 0; }
.phase-rail .ph .k {
  display: block;
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s ease;
}
.phase-rail .ph .v {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink);
}
.phase-rail .ph.active { background: rgba(23, 201, 127, 0.07); }
.phase-rail .ph.active .k { color: var(--mint); }

.stage-note {
  margin: 1.5rem 0 0;
  max-width: 54ch;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ------------------------------------------------------------- how it works */

.section { padding: clamp(3rem, 7vw, 5rem) 0; }

.section-label {
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.section h2 {
  margin: 0 0 3rem;
  font-size: clamp(1.625rem, 3.4vw, 2.125rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
  font-weight: 600;
  max-width: 21ch;
}

/* ---------------------------------------------------------- what it measures */

.measures {
  display: grid;
  gap: 0 2.5rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.measure {
  padding: 1.25rem 0 1.4rem;
  border-top: 1px solid var(--border-soft);
}
.m-name {
  margin: 0 0 0.45rem;
  font-size: 0.9375rem;
  font-weight: 590;
  letter-spacing: -0.012em;
  color: var(--ink);
}
.measure p:last-child { margin: 0; font-size: 0.9375rem; color: var(--muted); }

.channels { display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); }

.channel {
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.channel:hover { border-color: var(--border); background: var(--card-2); }

.channel .device {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
  font-size: 0.9375rem;
  font-weight: 590;
  letter-spacing: -0.012em;
}
.channel .rate {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--mint);
  white-space: nowrap;
}
.channel p { margin: 0; font-size: 0.9375rem; color: var(--muted); }
.channel p strong { color: var(--ink); font-weight: 500; }

.optional {
  margin-left: 0.4rem;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 52rem) { .channels { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------- contact */

.contact {
  padding: clamp(1.75rem, 4vw, 2.5rem);
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
}
.contact h2 {
  margin: 0 0 0.75rem;
  font-size: 1.375rem;
  letter-spacing: -0.025em;
  font-weight: 600;
}
.contact p { margin: 0 0 1.5rem; max-width: 48ch; color: var(--muted); }

.mail-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
}
.mail-chip {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--ink);
  transition: border-color 0.16s ease;
}
.mail-chip:hover { border-color: var(--mint); }
.copy-ok { font-size: 0.8125rem; color: var(--mint); opacity: 0; transition: opacity 0.2s ease; }
.copy-ok.on { opacity: 1; }

/* ---------------------------------------------------------------- footer */

.foot {
  margin-top: clamp(3rem, 7vw, 5rem);
  padding: 2rem 0 2.75rem;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--muted);
}
.foot p { margin: 0; }
.foot nav { display: flex; gap: 1.5rem; }
.foot a { color: var(--muted); transition: color 0.15s ease; }
.foot a:hover { color: var(--ink); }

/* -------------------------------------------------------- scroll reveals */

/* Only hide when scripting is available to un-hide it — otherwise a JS error
   would leave the page blank. The .js class is set by an inline head script. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
}
.js [data-reveal].shown {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--delay, 0ms);
}

/* ------------------------------------------------------------ prose page */

.prose { padding: clamp(2.5rem, 6vw, 4rem) 0 2rem; max-width: 46rem; }
.prose h1 { font-size: clamp(1.875rem, 4.5vw, 2.5rem); max-width: none; margin-bottom: 0.5rem; }
.prose .dateline {
  margin: 0 0 3rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
}

.toc {
  margin: 0 0 3.5rem;
  padding: 1.5rem 1.75rem;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  columns: 2;
  column-gap: 2rem;
  list-style: none;
  font-size: 0.875rem;
}
.toc li { margin-bottom: 0.45rem; break-inside: avoid; }
.toc a { color: var(--muted); }
.toc a:hover { color: var(--mint); }

.prose section { margin-bottom: 3rem; scroll-margin-top: 5rem; }
.prose h2 { margin: 0 0 1rem; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.prose h3 { margin: 2rem 0 0.75rem; font-size: 1rem; font-weight: 600; color: var(--ink); }
.prose p { margin: 0 0 1rem; color: var(--muted); }
.prose ul { margin: 0 0 1rem; padding-left: 1.25rem; color: var(--muted); }
.prose li { margin-bottom: 0.5rem; }
.prose li strong, .prose p strong { color: var(--ink); font-weight: 540; }
.prose a { color: var(--mint); }
.prose a:hover { text-decoration: underline; text-underline-offset: 3px; }
.prose code { font-family: var(--mono); font-size: 0.875em; color: var(--bright); }

.callout {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-left: 2px solid var(--mint);
  border-radius: 0 10px 10px 0;
}
.callout p { margin: 0; }
.callout p + p { margin-top: 0.75rem; }
.callout .label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mint);
}

.contact-block { margin: 1.5rem 0; padding-left: 1.25rem; border-left: 2px solid var(--border); }
.contact-block p { margin: 0 0 0.25rem; }
.contact-block .who { color: var(--ink); font-weight: 540; }

/* ------------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; }
  * { transition-duration: 0.01ms !important; }
}
