/* ==========================================================================
   HeartbeatAI.vc — styles
   ========================================================================== */

:root {
  --bg: #050507;
  --bg-elev: #0b0b0f;
  --surface: #101015;
  --surface-2: #15151c;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f4f6;
  --text-2: #b4b4be;
  --muted: #7c7c88;
  --accent: #ff2d55;
  --accent-2: #ff6b81;
  --accent-deep: #d4145a;
  --accent-glow: rgba(255, 45, 85, 0.35);
  --ok: #34d399;
  --radius: 14px;
  --radius-lg: 22px;
  --max: 1180px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; overflow-x: hidden; overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-x: clip;
}

/* Scroll lock while the modal is open. iOS ignores overflow:hidden on body,
   so the body is pinned in place (main.js sets `top` to keep the position). */
body.modal-open { overflow: hidden; position: fixed; left: 0; right: 0; width: 100%; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: rgba(255, 45, 85, 0.35); color: #fff; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 6px; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   Ambient background
   -------------------------------------------------------------------------- */

.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}

.bg-glow {
  position: absolute; z-index: -1; pointer-events: none;
  left: 50%; top: -260px; width: min(1100px, 100%); height: 720px; transform: translateX(-50%);
  background:
    radial-gradient(closest-side, rgba(255, 45, 85, 0.22), transparent 70%),
    radial-gradient(closest-side at 70% 60%, rgba(140, 60, 255, 0.12), transparent 70%);
  filter: blur(20px);
}

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */

.nav {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.nav.scrolled {
  background: rgba(5, 5, 7, 0.72);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom-color: var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.02em; font-size: 17px; }
.brand img { width: 32px; height: 32px; }
.brand .tld { color: var(--muted); font-weight: 500; }

.nav-links { display: flex; align-items: center; gap: 32px; font-size: 14px; color: var(--text-2); }
.nav-links a { transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 15px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap;
  transition: transform 0.2s var(--ease), box-shadow 0.3s var(--ease), background 0.2s;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(180deg, #ff4a6c 0%, var(--accent) 55%, #e8204a 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 0 0 1px rgba(255, 45, 85, 0.5),
    0 8px 30px -6px var(--accent-glow);
}
.btn-primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 0 1px rgba(255, 90, 120, 0.7), 0 10px 40px -4px rgba(255, 45, 85, 0.55); }
.btn-primary svg { transition: transform 0.25s var(--ease); }
.btn-primary:hover svg { transform: translateX(3px); }

.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; }

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

.hero { position: relative; padding: 96px 0 40px; text-align: center; overflow-x: hidden; overflow-x: clip; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 10px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: rgba(255, 255, 255, 0.03);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2);
}
.eyebrow .dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.eyebrow .dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--accent);
  animation: ping 1.6s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(0.6); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }

.hero h1 {
  margin: 28px auto 0; max-width: 940px;
  font-size: clamp(44px, 7.4vw, 88px); line-height: 1.0; letter-spacing: -0.045em; font-weight: 600;
  background: linear-gradient(180deg, #fff 30%, #a9a9b4 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero h1 em, .section-title em {
  font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.02em;
  background: linear-gradient(100deg, #ff8fa0 0%, var(--accent) 50%, #ff7a59 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-right: 0.06em;
}

.hero .lede {
  margin: 26px auto 0; max-width: 640px;
  font-size: clamp(17px, 2vw, 19px); line-height: 1.6; color: var(--text-2);
}

.hero-cta { margin-top: 38px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hero-cta .note { font-size: 13px; color: var(--muted); }

/* ECG line */
.pulse-line { margin: 64px auto 0; width: 100%; max-width: 1180px; height: 80px; overflow: visible; }
.pulse-line path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pulse-line .track { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1.5; }
.pulse-line .beat {
  stroke: url(#pulse-grad); stroke-width: 2;
  stroke-dasharray: 260 1400; stroke-dashoffset: 1660;
  animation: beat 3.6s linear infinite;
  filter: drop-shadow(0 0 6px rgba(255, 45, 85, 0.8));
}
@keyframes beat { to { stroke-dashoffset: 0; } }

/* --------------------------------------------------------------------------
   Product preview
   -------------------------------------------------------------------------- */

.preview { position: relative; margin-top: -8px; padding-bottom: 40px; }

.window {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border-strong);
  box-shadow: 0 40px 120px -40px rgba(255, 45, 85, 0.25), 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}
.window::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 30%);
  mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor; mask-composite: exclude; padding: 1px;
}

.window-bar {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px;
  border-bottom: 1px solid var(--border); background: rgba(0, 0, 0, 0.25);
}
.window-bar i { width: 11px; height: 11px; border-radius: 50%; background: #2a2a31; }
.window-bar .url {
  margin: 0 auto; padding: 4px 14px; border-radius: 8px; background: rgba(255, 255, 255, 0.04);
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}

.app { display: grid; grid-template-columns: 220px 1fr 300px; min-height: 440px; text-align: left; }

.app-side { padding: 18px 14px; border-right: 1px solid var(--border); font-size: 13px; }
.app-side .label { padding: 0 10px; margin: 6px 0 8px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.app-side a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); }
.app-side a.active { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.app-side a svg { width: 15px; height: 15px; opacity: 0.8; }
.app-side .sep { height: 1px; background: var(--border); margin: 14px 4px; }

.app-main { padding: 22px 24px; border-right: 1px solid var(--border); }
.app-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.app-head h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.app-head .chip { font-size: 11.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.02em;
  border: 1px solid var(--border-strong); color: var(--text-2); background: rgba(255, 255, 255, 0.03);
}
.chip.live { color: #ffb3c0; border-color: rgba(255, 45, 85, 0.4); background: rgba(255, 45, 85, 0.08); }
.chip.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.chip.ok { color: #a7f3d0; border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.07); }

.docs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.doc {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: rgba(255, 255, 255, 0.02);
}
.doc-thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; margin-bottom: 12px;
  background: radial-gradient(120% 100% at 0% 0%, #2a0d16 0%, #110a0e 50%, #0b0b0f 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.doc-thumb .t1 { position: absolute; left: 12%; top: 22%; width: 46%; height: 9%; border-radius: 3px; background: rgba(255, 255, 255, 0.85); }
.doc-thumb .t2 { position: absolute; left: 12%; top: 38%; width: 34%; height: 5%; border-radius: 3px; background: rgba(255, 255, 255, 0.3); }
.doc-thumb .t3 { position: absolute; left: 12%; top: 48%; width: 28%; height: 5%; border-radius: 3px; background: rgba(255, 255, 255, 0.2); }
.doc-thumb .bars { position: absolute; right: 10%; bottom: 16%; display: flex; align-items: flex-end; gap: 5%; width: 32%; height: 52%; }
.doc-thumb .bars span { flex: 1; border-radius: 2px 2px 0 0; background: linear-gradient(180deg, var(--accent-2), var(--accent-deep)); }
.doc-thumb.memo { background: #0e0e12; }
.doc-thumb.memo .line { position: absolute; left: 10%; height: 4.5%; border-radius: 2px; background: rgba(255, 255, 255, 0.16); }
.doc-meta { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.doc-meta b { font-weight: 500; }
.doc-meta span { color: var(--muted); font-size: 12px; }

.queue { margin-top: 18px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.queue-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 11px 14px; font-size: 13px; }
.queue-row + .queue-row { border-top: 1px solid var(--border); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff; }
.queue-row .who b { display: block; font-weight: 500; line-height: 1.3; }
.queue-row .who span { color: var(--muted); font-size: 12px; }

.app-feed { padding: 22px 20px; }
.app-feed h4 { margin: 0 0 16px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.feed { position: relative; margin: 0; padding: 0; list-style: none; }
.feed::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--border-strong); }
.feed li { position: relative; padding: 0 0 18px 26px; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.feed li::before {
  content: ""; position: absolute; left: 2px; top: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--muted);
}
.feed li.hot::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.feed li.done::before { border-color: var(--ok); }
.feed li b { color: var(--text); font-weight: 500; }
.feed time { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; }

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

section { position: relative; }
.section { padding: 128px 0; }
.section-head { max-width: 720px; margin: 0 auto 64px; text-align: center; }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-2); }
.section-title {
  margin: 14px 0 0; font-size: clamp(34px, 4.6vw, 56px); line-height: 1.05; letter-spacing: -0.04em; font-weight: 600;
}
.section-sub { margin: 18px auto 0; max-width: 580px; color: var(--text-2); font-size: 17px; }

.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.step {
  position: relative; padding: 30px 28px 32px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.005));
}
.step-num { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.step-icon {
  width: 44px; height: 44px; margin: 22px 0 22px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255, 45, 85, 0.1); border: 1px solid rgba(255, 45, 85, 0.25); color: var(--accent-2);
}
.step-icon svg { width: 22px; height: 22px; }
.step h3 { margin: 0 0 8px; font-size: 20px; letter-spacing: -0.02em; font-weight: 600; }
.step p { margin: 0; color: var(--text-2); font-size: 15px; }

/* Bento */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; }
.card {
  position: relative; overflow: hidden; padding: 30px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-elev);
  transition: border-color 0.3s var(--ease);
}
.card:hover { border-color: var(--border-strong); }
.card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s var(--ease);
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 45, 85, 0.08), transparent 60%);
}
.card:hover::after { opacity: 1; }
.card h3 { margin: 0 0 8px; font-size: 20px; letter-spacing: -0.02em; font-weight: 600; }
.card p { margin: 0; color: var(--text-2); font-size: 15px; max-width: 460px; }
.card .tag { margin-bottom: 18px; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }
.span-2 { grid-column: span 2; }

.card-visual { margin-top: 28px; }

/* Slide strip visual */
.slides { display: flex; gap: 10px; }
.slide {
  flex: 1; aspect-ratio: 16 / 10; border-radius: 8px; position: relative; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07); background: #0f0f14;
}
.slide:nth-child(1) { background: radial-gradient(120% 100% at 0% 0%, #3a0f1d 0%, #120a0e 60%); }
.slide span { position: absolute; left: 12%; border-radius: 2px; background: rgba(255, 255, 255, 0.22); height: 7%; }
.slide span.h { background: rgba(255, 255, 255, 0.8); height: 10%; }
.slide .ring { position: absolute; right: 12%; top: 50%; width: 30%; aspect-ratio: 1; transform: translateY(-50%); border-radius: 50%; border: 3px solid var(--accent); border-right-color: rgba(255, 255, 255, 0.12); }
.slide .col { position: absolute; bottom: 14%; width: 9%; border-radius: 2px 2px 0 0; background: linear-gradient(180deg, var(--accent-2), var(--accent-deep)); }

/* Memo visual */
.memo-doc { border-radius: 10px; border: 1px solid var(--border); background: #0e0e12; padding: 16px 18px; font-size: 12.5px; color: var(--text-2); }
.memo-doc .mh { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 8px; }
.memo-doc .ml { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); margin: 7px 0; }

/* Cadence visual */
.cadence { position: relative; padding: 8px 0 0; }
.cadence-track { position: relative; height: 2px; margin: 34px 6px 0; background: var(--border-strong); border-radius: 2px; }
.cadence-track .fill { position: absolute; inset: 0 auto 0 0; width: 72%; border-radius: 2px; background: linear-gradient(90deg, var(--accent-deep), var(--accent-2)); box-shadow: 0 0 12px rgba(255, 45, 85, 0.6); }
.cadence-pts { display: flex; justify-content: space-between; margin-top: -9px; padding: 0; list-style: none; }
.cadence-pts li { display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 12px; color: var(--text-2); text-align: center; width: 0; white-space: nowrap; }
.cadence-pts li i { width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.cadence-pts li.future i { border-color: var(--muted); }
.cadence-pts li b { display: block; font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--muted); }

/* Reply visual */
.reply { border: 1px solid var(--border); border-radius: 12px; background: #0e0e12; font-size: 13px; }
.reply-in, .reply-out { padding: 12px 14px; }
.reply-out { border-top: 1px dashed var(--border-strong); }
.reply .from { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; font-family: var(--mono); }
.reply p { color: var(--text-2); font-size: 13px; }
.reply-out .from { color: var(--accent-2); }

/* Stat-ish list */
.mini-list { margin: 22px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.mini-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.mini-list svg { width: 16px; height: 16px; color: var(--accent-2); flex: none; }

/* Principles */
.principles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.principle { padding: 36px 28px; }
.principle + .principle { border-left: 1px solid var(--border); }
.principle h4 { margin: 0 0 8px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.principle p { margin: 0; font-size: 14px; color: var(--text-2); }
.principle .k { display: block; font-family: var(--mono); font-size: 11px; color: var(--accent-2); margin-bottom: 18px; letter-spacing: 0.08em; }

/* FAQ */
.faq { max-width: 820px; margin: 0 auto; }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:first-child { border-top: 1px solid var(--border); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 24px 4px; font-size: 18px; font-weight: 500; letter-spacing: -0.015em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .plus { position: relative; width: 14px; height: 14px; flex: none; }
.faq summary .plus::before, .faq summary .plus::after {
  content: ""; position: absolute; left: 0; top: 50%; width: 14px; height: 1.5px; background: var(--text-2); transition: transform 0.3s var(--ease);
}
.faq summary .plus::after { transform: rotate(90deg); }
.faq details[open] summary .plus::after { transform: rotate(0deg); }
.faq .answer { padding: 0 4px 26px; color: var(--text-2); font-size: 16px; max-width: 700px; }
.faq .answer p { margin: 0; }

/* Closing CTA */
.closing { padding: 40px 0 140px; }
.closing-card {
  position: relative; overflow: hidden; text-align: center; padding: 96px 32px;
  border-radius: 28px; border: 1px solid var(--border-strong);
  background:
    radial-gradient(60% 80% at 50% 120%, rgba(255, 45, 85, 0.28), transparent 70%),
    linear-gradient(180deg, #0d0d12, #08080b);
}
.closing-card .mark { width: 56px; height: 56px; margin: 0 auto 28px; filter: drop-shadow(0 10px 30px rgba(255, 45, 85, 0.5)); }
.closing-card h2 { margin: 0 auto; max-width: 720px; font-size: clamp(34px, 5vw, 60px); line-height: 1.04; letter-spacing: -0.045em; font-weight: 600; }
.closing-card p { margin: 20px auto 36px; max-width: 520px; color: var(--text-2); font-size: 17px; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 48px 0 56px; font-size: 14px; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 28px; }
.footer-links a:hover { color: var(--text); }
.footer .brand { color: var(--text); }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  visibility: hidden; opacity: 0; transition: opacity 0.3s var(--ease), visibility 0s linear 0.3s;
  overscroll-behavior: contain;
}
.modal.open { visibility: visible; opacity: 1; transition: opacity 0.3s var(--ease); }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2, 2, 4, 0.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

.modal-panel {
  position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  border-radius: 22px; border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #121218, #0b0b0f);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.02), 0 -20px 80px -40px rgba(255, 45, 85, 0.4);
  transform: translateY(16px) scale(0.98); transition: transform 0.4s var(--ease);
}
.modal.open .modal-panel { transform: none; }
.modal-panel:focus { outline: none; }

.modal-close {
  position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); color: var(--text-2);
  transition: background 0.2s, color 0.2s;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.modal-close svg { width: 14px; height: 14px; }

.modal-view { padding: 36px 32px 32px; }
.modal-view[hidden] { display: none; }
.modal-view.enter { animation: viewIn 0.5s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.modal-head img { width: 36px; height: 36px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 26px; letter-spacing: -0.03em; font-weight: 600; line-height: 1.15; }
.modal-head p { margin: 8px 0 0; color: var(--text-2); font-size: 15px; }

.form { margin-top: 26px; display: grid; gap: 18px; }
.field label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13.5px; font-weight: 500; color: var(--text); }
.field label .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; font: inherit; font-size: 15px; color: var(--text);
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-strong);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field textarea { min-height: 112px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: #5c5c68; }
.field input:focus, .field textarea:focus {
  outline: none; border-color: rgba(255, 45, 85, 0.6); background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 0 0 4px rgba(255, 45, 85, 0.12);
}
.field.invalid input, .field.invalid textarea { border-color: rgba(255, 99, 99, 0.7); }
.field .error { display: none; margin-top: 6px; font-size: 12.5px; color: #ff8a8a; }
.field.invalid .error { display: block; }
.counter { font-family: var(--mono); font-size: 11.5px; color: var(--muted); font-weight: 400; }
.counter.near { color: #ffb86b; }

.form .btn { width: 100%; margin-top: 4px; }
.form .fine { margin: 2px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.form .fine a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }

.btn .spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.7s linear infinite; }
.btn.loading .spinner { display: block; }
.btn.loading .label, .btn.loading svg { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Success */
.success { text-align: center; padding: 56px 32px 44px; }
.success-mark { position: relative; width: 84px; height: 84px; margin: 0 auto 28px; }
.success-mark .halo { position: absolute; inset: -18px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 45, 85, 0.35), transparent); animation: halo 2.4s ease-in-out infinite; }
.success-mark img { position: relative; width: 84px; height: 84px; animation: thump 1.2s var(--ease) 0.2s 2; }
@keyframes thump { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.12); } 30% { transform: scale(0.98); } 45% { transform: scale(1.06); } }
@keyframes halo { 0%, 100% { opacity: 0.6; transform: scale(0.95); } 50% { opacity: 1; transform: scale(1.05); } }
.success h2 { margin: 0; font-size: 28px; letter-spacing: -0.03em; font-weight: 600; }
.success p { margin: 12px auto 0; max-width: 380px; color: var(--text-2); font-size: 15.5px; }
.success .email-echo { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.success .btn { margin-top: 30px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border-strong); box-shadow: none; color: var(--text); }
.success .btn:hover { background: rgba(255, 255, 255, 0.1); }

/* --------------------------------------------------------------------------
   Legal pages
   -------------------------------------------------------------------------- */

.legal { padding: 72px 0 120px; }
.legal .container { max-width: 780px; }
.legal-head { padding-bottom: 36px; margin-bottom: 40px; border-bottom: 1px solid var(--border); }
.legal-head h1 { margin: 14px 0 10px; font-size: clamp(36px, 5vw, 52px); letter-spacing: -0.04em; line-height: 1.05; font-weight: 600; }
.legal-head p { margin: 0; color: var(--muted); font-size: 14px; }
.legal-body { color: var(--text-2); font-size: 16px; line-height: 1.75; }
.legal-body h2 { margin: 48px 0 12px; color: var(--text); font-size: 21px; letter-spacing: -0.02em; font-weight: 600; }
.legal-body h3 { margin: 28px 0 8px; color: var(--text); font-size: 16px; font-weight: 600; }
.legal-body p { margin: 0 0 16px; }
.legal-body ul { margin: 0 0 16px; padding-left: 22px; }
.legal-body li { margin-bottom: 8px; }
.legal-body a { color: var(--accent-2); text-decoration: underline; text-decoration-color: rgba(255, 107, 129, 0.35); text-underline-offset: 3px; }
.legal-body strong { color: var(--text); font-weight: 600; }
.legal-toc { margin: 0 0 8px; padding: 20px 24px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elev); }
.legal-toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 32px; font-size: 14px; }
.legal-toc li { margin: 4px 0; break-inside: avoid; }
.legal-toc a { color: var(--text-2); text-decoration: none; }
.legal-toc a:hover { color: var(--text); }

/* --------------------------------------------------------------------------
   Reveal on scroll
   -------------------------------------------------------------------------- */

.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr 280px; }
  .app-side { display: none; }
}

@media (max-width: 900px) {
  .nav-links a:not(.btn) { display: none; }
  .steps { grid-template-columns: 1fr; }
  .bento { grid-template-columns: 1fr; }
  .span-4, .span-3, .span-2 { grid-column: auto; }
  .principles { grid-template-columns: 1fr 1fr; }
  .principle:nth-child(3) { border-left: 0; }
  .principle:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .app { grid-template-columns: minmax(0, 1fr); }
  .app-main { border-right: 0; }
  .app-feed { border-top: 1px solid var(--border); }
  .section { padding: 96px 0; }
}

@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .hero { padding-top: 64px; }
  .docs { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; }
  .principle + .principle { border-left: 0; border-top: 1px solid var(--border); }
  .modal { padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); align-items: end; }
  .modal-panel { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  /* 16px stops iOS from zooming the page when a field is focused */
  .field input, .field textarea { font-size: 16px; }
  .modal-view { padding: 30px 22px 24px; }
  .legal-toc ol { columns: 1; }
  .closing-card { padding: 72px 22px; }
  .card { padding: 24px; }
  .cadence-pts li { font-size: 11px; }
  .window-bar .url { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
  .pulse-line .beat { stroke-dasharray: none; stroke-dashoffset: 0; }
}

.success h2:focus { outline: none; }
