/* Vitals for AI (Health) Official Site
 * Design System: Off-white / Deep Charcoal monochrome + #E8435D Health Rose accent
 * Dual-mode Light/Dark via CSS custom properties + prefers-color-scheme
 */

:root {
  color-scheme: light dark;
  --bg: #f8f9fa;
  --bg-subtle: #f1f3f5;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-tint: #fdf2f4;
  --surface-dark: #141619;
  --text: #111317;
  --text-secondary: #525866;
  --text-muted: #767d8c;
  --border: rgba(17, 19, 23, 0.09);
  --border-strong: rgba(17, 19, 23, 0.16);
  --accent: #e8435d;
  --accent-hover: #d1344e;
  --accent-soft: rgba(232, 67, 93, 0.11);
  --shadow-sm: 0 2px 10px rgba(17, 19, 23, 0.04);
  --shadow-md: 0 12px 32px rgba(17, 19, 23, 0.07);
  --radius-card: 20px;
  --radius-control: 12px;
  --radius-pill: 999px;
  --nav-h: 64px;
  --max-w: 1180px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013;
    --bg-subtle: #15181d;
    --surface: #171a20;
    --surface-elevated: #1e222a;
    --surface-tint: rgba(232, 67, 93, 0.12);
    --surface-dark: #1e222a;
    --text: #f2f4f7;
    --text-secondary: #a1a8b5;
    --text-muted: #7d8594;
    --border: rgba(242, 244, 247, 0.09);
    --border-strong: rgba(242, 244, 247, 0.18);
    --accent: #f0526b;
    --accent-hover: #ff647d;
    --accent-soft: rgba(240, 82, 107, 0.16);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 16px 36px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #0e1013;
  --bg-subtle: #15181d;
  --surface: #171a20;
  --surface-elevated: #1e222a;
  --surface-tint: rgba(232, 67, 93, 0.12);
  --surface-dark: #1e222a;
  --text: #f2f4f7;
  --text-secondary: #a1a8b5;
  --text-muted: #7d8594;
  --border: rgba(242, 244, 247, 0.09);
  --border-strong: rgba(242, 244, 247, 0.18);
  --accent: #f0526b;
  --accent-hover: #ff647d;
  --accent-soft: rgba(240, 82, 107, 0.16);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 16px 36px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header / Single-line 64px Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

@media (prefers-reduced-transparency: reduce) {
  .site-header {
    background: var(--bg);
    backdrop-filter: none;
  }
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 14px;
  color: var(--text-secondary);
}

.nav-links a {
  transition: color 0.18s ease;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.14s ease;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.97);
}

.icon-btn.square {
  width: 36px;
  padding: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.14s ease, color 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--text-secondary);
}

/* Hero - Asymmetric Split, fits in initial viewport */
.hero {
  padding: clamp(2.5rem, 5vw, 4.5rem) 0 clamp(3rem, 6vw, 5rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
}

.hero-title {
  margin: 0 0 18px;
  font-size: clamp(2.25rem, 4.4vw, 3.6rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero-sub {
  margin: 0 0 28px;
  font-size: clamp(1rem, 1.35vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 46ch;
  line-height: 1.65;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.hero-media {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  aspect-ratio: 4 / 3;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Sections */
.section {
  padding: clamp(3.5rem, 7vw, 6rem) 0;
  border-top: 1px solid var(--border);
}

.section-header {
  max-width: 62ch;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.section-title {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.section-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* Asymmetric Bento Grid (6 real HealthKit categories, zero empty tiles) */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.bento-card {
  border-radius: var(--radius-card);
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-height: 190px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.bento-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.bento-span-7 { grid-column: span 7; }
.bento-span-5 { grid-column: span 5; }
.bento-span-4 { grid-column: span 4; }
.bento-span-8 { grid-column: span 8; }

.bento-card.tinted {
  background: var(--surface-tint);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}

.bento-card.contrast {
  background: var(--surface-dark);
  color: #f2f4f7;
  border-color: rgba(255, 255, 255, 0.08);
}

.bento-card.contrast .bento-desc,
.bento-card.contrast .bento-meta {
  color: #a6adb9;
}

.bento-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cat-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg-subtle);
  color: var(--accent);
}

.bento-card.tinted .cat-icon {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.bento-card.contrast .cat-icon {
  background: rgba(240, 82, 107, 0.18);
  color: #ff6b82;
}

.bento-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.bento-title {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.bento-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.bento-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Privacy Architecture Section (Visual + 4-stage flow) */
.privacy-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(28px, 5vw, 56px);
  align-items: start;
}

.privacy-visual {
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  aspect-ratio: 16 / 10;
  background: var(--bg-subtle);
}

.privacy-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.privacy-caption {
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.journey-list {
  display: grid;
  gap: 20px;
}

.journey-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.journey-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 18px;
}

.journey-item h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 600;
}

.journey-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Connect Guide (Interactive Tabs + Copyable MCP Endpoint) */
.connect-panel {
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: clamp(22px, 4vw, 36px);
  box-shadow: var(--shadow-sm);
}

.connect-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.seg-btn {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.18s ease, color 0.18s ease;
}

.seg-btn[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.endpoint-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 12px 18px;
  border-radius: var(--radius-control);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  margin-bottom: 28px;
}

.endpoint-code {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  overflow-x: auto;
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.14s ease;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-btn.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.connect-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.connect-step {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.connect-step h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 600;
}

.connect-step p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.94rem;
}

/* Transparency Split (Server sees vs Never leaves iPhone) */
.trust-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.trust-card {
  border-radius: var(--radius-card);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.trust-card h3 {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.trust-card h3 i {
  color: var(--accent);
  font-size: 20px;
}

.trust-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Legal / Support Document Layout */
.doc-wrap {
  padding: clamp(2.5rem, 5vw, 4.5rem) 0 5rem;
  max-width: 760px;
}

.doc-title {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.doc-meta {
  margin: 0 0 32px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.doc-body h2 {
  margin: 34px 0 10px;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.doc-body p,
.doc-body li {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.75;
}

.doc-body ul {
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.faq-list {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.faq-item {
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 18px 22px;
}

.faq-item summary {
  font-weight: 600;
  font-size: 1.02rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item p {
  margin: 12px 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0 48px;
  color: var(--text-muted);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links a:hover {
  color: var(--text);
}

.disclaimer {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Motion (IntersectionObserver driven, respects prefers-reduced-motion) */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1), transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile collapse (< 860px) */
@media (max-width: 860px) {
  .nav-links {
    display: none;
  }
  .hero-grid,
  .privacy-layout,
  .connect-steps,
  .trust-grid {
    grid-template-columns: 1fr;
  }
  .bento-span-7,
  .bento-span-5,
  .bento-span-4,
  .bento-span-8 {
    grid-column: span 12;
  }
  .hero {
    padding-top: 2rem;
  }
}
