/* =========================================================================
   Espial product page — page-scoped design layer (loads after styles.css)
   The page is designed dark and always renders dark (data-theme="dark" is
   hardcoded in the HTML): the app lives on a dark canvas, so the site does
   too. Deep "stages" (hero, pulse, energy, closer) sit a step below the
   regular sections for rhythm. One accent (blue) — the amber that appears
   in the pulse chapter is the app's own semantic load color, shown in
   screenshots and the state toggle only. One glow per stage, max.
   ========================================================================= */

body.espial {
  /* Dark-stage palette — fixed hex, NOT theme tokens: stages stay dark in
     both site themes, matching the app's own canvas. */
  --stage:      #0b0d13;
  --stage-2:    #12151d;
  --stage-3:    #181c26;
  --stage-text: #f2f5f9;
  --stage-mut:  rgba(226, 232, 242, 0.64);
  --stage-line: rgba(255, 255, 255, 0.08);
  --stage-eyebrow: #6fb1f7;
  --maxw-wide: 1320px;
}

/* Page-local type ------------------------------------------------------- */
body.espial .display-xl {
  font-size: clamp(2.75rem, 1.6rem + 4.8vw, 5rem);
  font-weight: 680; letter-spacing: -0.028em; line-height: 1.03;
  max-width: 17ch; margin-inline: auto; text-wrap: balance;
}
body.espial h2 { letter-spacing: -0.024em; }
body.espial .big-stat {
  font-size: clamp(3.4rem, 2.4rem + 4vw, 5.75rem);
  font-weight: 680; letter-spacing: -0.03em; line-height: 1;
  font-feature-settings: "tnum";
}
body.espial .stat-label {
  font-size: 0.78rem; font-weight: 650; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
}
body.espial .btn:active { transform: scale(0.97); }
/* The 72%-opaque glass nav turns muddy over the dark stages; keep the blur but
   composite from the theme background so it reads as a clean strip. */
body.espial .site-header { background: color-mix(in srgb, var(--bg) 92%, transparent); }

/* Dark stage shell ------------------------------------------------------- */
.e-stage {
  position: relative; background: var(--stage); color: var(--stage-text);
  padding-block: clamp(88px, 10vw, 150px);
  border-block: 1px solid var(--stage-line);
  overflow: hidden;
}
.e-stage .eyebrow { color: var(--stage-eyebrow); }
.e-stage .lead { color: var(--stage-mut); }
/* One low-opacity glow per stage — positioned per stage below. */
.e-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 45% at 50% 38%, rgba(28, 127, 242, 0.11), transparent 70%);
}

/* Screenshot treatment: purposeful, two tiers (white canvas vs dark stage) */
body.espial .shot { aspect-ratio: auto; }
.e-window { border-radius: 16px; overflow: hidden; border: 1px solid var(--hairline); box-shadow: var(--shadow-3); background: var(--surface); }
.e-window img { display: block; width: 100%; height: auto; }
.e-stage .e-window { border-color: var(--stage-line); box-shadow: none; background: var(--stage-2); }

/* ---- S1 · Hero --------------------------------------------------------- */
.e-hero { padding-top: clamp(64px, 8vw, 120px); padding-bottom: clamp(48px, 6vw, 76px); }
.e-hero::after { /* gradient floor */
  content: ""; position: absolute; inset: 55% 0 0 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(28, 127, 242, 0.05));
}
.e-hero-copy { position: relative; z-index: 1; text-align: center; display: grid; justify-items: center; }
.e-hero-eyebrow { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.e-hero-eyebrow img { width: 30px; height: 30px; border-radius: 7px; }
.e-hero-eyebrow span { font-size: 0.78rem; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; color: var(--stage-eyebrow); }
.e-hero h1 { color: var(--stage-text); }
.e-hero h1 .grad {
  background: linear-gradient(92deg, #6fb1f7, #1c7ff2);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.e-hero .lead { margin-top: 22px; max-width: 52ch; }
.e-hero .cta-row { justify-content: center; margin-top: 30px; }
.e-hero .btn-primary { box-shadow: 0 8px 28px -6px rgba(28, 127, 242, 0.33); }
.e-hero .btn-text { color: var(--stage-mut); }
.e-hero .btn-text:hover { color: var(--stage-text); }
.e-proof { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 26px; }
.e-proof span {
  display: inline-flex; align-items: center; min-height: 30px; padding: 0 13px;
  border-radius: 999px; background: var(--stage-2); border: 1px solid var(--stage-line);
  font-size: 0.8rem; font-weight: 600; color: var(--stage-mut); letter-spacing: 0.01em;
}
.e-hero-stagearea { position: relative; z-index: 1; margin-top: clamp(40px, 5vw, 64px); }
.e-hero-stagearea .wrap { position: relative; width: min(1100px, 100%); margin-inline: auto; }
.e-hero-phone {
  position: absolute; right: clamp(-14px, -1vw, 0px); bottom: -26px; width: 210px; z-index: 2;
}
@media (max-width: 834px) {
  .e-hero-phone { position: relative; right: auto; bottom: auto; width: 180px; margin: -26px auto 0; }
}
@media (max-width: 560px) {
  .e-hero-phone { display: none; }
  .e-hero .e-window img { aspect-ratio: 5 / 4; object-fit: cover; object-position: 42% top; }
  .e-energy .e-window img { aspect-ratio: 5 / 4; object-fit: cover; object-position: 100% top; }
}

/* ---- S2 · Router ("Get to know Espial.") ------------------------------- */
.e-router-track {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 6px 2px 18px; scrollbar-width: thin; scrollbar-color: var(--hairline) transparent;
  mask-image: linear-gradient(90deg, black 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, black 92%, transparent);
}
.e-router-card {
  scroll-snap-align: start; flex: 0 0 300px; border-radius: 16px; overflow: hidden;
  background: var(--stage-2); border: 1px solid var(--stage-line); color: var(--stage-text);
  display: flex; flex-direction: column; text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease;
}
.e-router-card:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, 0.18); }
.e-router-card .pic { aspect-ratio: 5 / 2.6; overflow: hidden; border-bottom: 1px solid var(--stage-line); background: #0d1016; }
.e-router-card .pic img { width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.e-router-card b { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 17px; font-size: 0.98rem; font-weight: 650; letter-spacing: -0.01em; }
.e-router-card b::after { content: "→"; color: var(--stage-eyebrow); font-weight: 600; }
@media (min-width: 1280px) {
  .e-router-track { mask-image: none; -webkit-mask-image: none; overflow: visible; flex-wrap: nowrap; }
  .e-router-card { flex: 1 1 0; }
}

/* ---- S3 · The pulse (adaptive-load crossfade) --------------------------- */
.e-pulse { text-align: center; }
.e-pulse .e-glow { background: radial-gradient(ellipse 55% 40% at 50% 26%, rgba(28, 127, 242, 0.10), transparent 70%); }
.e-pulse h2 { color: var(--stage-text); }
/* The toggle belongs to the headline group — pull it close, keep the room
   between the toggle and the window it drives. */
.e-pulse .section-head { margin-inline: auto; margin-bottom: 0; }
.e-pulse .lead { max-width: 58ch; margin-inline: auto; }
.e-pulse-toggle {
  display: inline-flex; gap: 4px; padding: 4px; margin-top: clamp(24px, 3vw, 34px);
  border-radius: 999px; background: var(--stage-2); border: 1px solid var(--stage-line);
}
.e-pulse-toggle button {
  appearance: none; display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: transparent; color: var(--stage-mut);
  font: inherit; font-size: 0.9rem; font-weight: 650; padding: 8px 18px;
  border-radius: 999px; cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}
.e-pulse-toggle button.on { background: rgba(255, 255, 255, 0.1); color: var(--stage-text); }
.e-pulse-toggle button:focus-visible { outline: 2px solid var(--stage-eyebrow); outline-offset: 2px; }
.e-pulse-toggle .dot { width: 8px; height: 8px; border-radius: 50%; }
/* Blue = steady, amber = load — the app's own semantic pair, echoed here. */
.e-pulse-toggle .dot-calm { background: #4f9df5; box-shadow: 0 0 8px rgba(79, 157, 245, 0.7); }
.e-pulse-toggle .dot-load { background: #e8a13c; box-shadow: 0 0 8px rgba(232, 161, 60, 0.7); }
.e-pulse-stack { position: relative; width: min(1100px, 100%); margin: clamp(28px, 4vw, 44px) auto 0; }
.e-pulse-stack img.top {
  position: absolute; inset: 0; height: 100%;
  opacity: 0; transition: opacity 900ms ease;
}
.e-pulse-stack.show-load img.top { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .e-pulse-stack img.top { transition: none; } }
.e-pulse-points {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  width: min(1100px, 100%); margin: clamp(20px, 2.6vw, 30px) auto 0; text-align: left;
}
.e-pulse-points .pt { border-radius: 16px; background: var(--stage-2); border: 1px solid var(--stage-line); padding: 18px 20px 19px; }
.e-pulse-points .imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.e-pulse-points .imgs img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--stage-line); background: #15151a; }
.e-pulse-points b { display: block; font-size: 1.02rem; font-weight: 660; letter-spacing: -0.012em; color: var(--stage-text); }
.e-pulse-points p { margin-top: 5px; font-size: 0.88rem; line-height: 1.55; color: var(--stage-mut); }
.e-pulse-points .pt.text { display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 834px) {
  .e-pulse-points { grid-template-columns: 1fr 1fr; }
  .e-pulse-points .pt.text { grid-column: span 2; }
}
@media (max-width: 560px) {
  .e-pulse-points { grid-template-columns: 1fr; }
  .e-pulse-points .pt.text { grid-column: auto; }
}

/* ---- S4 · Wellness hero card --------------------------------------------- */
.e-wellcard { margin: 0 auto; width: min(1100px, 100%); }
.section-head + .e-wellcard { margin-top: 8px; }
.e-wellcard + .e-wellcard { margin-top: clamp(20px, 3vw, 30px); }
.e-wellcard .strip img {
  display: block; width: 100%; height: auto;
  border-radius: 18px; border: 1px solid var(--hairline); box-shadow: var(--shadow-2);
  background: #15151a;
}
.e-wellcard figcaption { margin-top: 10px; padding-left: 4px; font-size: 0.9rem; color: var(--text-3); }
/* Small screens: keep the card's text readable by letting it pan instead of
   shrinking a 7.8:1 strip into illegibility. */
@media (max-width: 700px) {
  .e-wellcard .strip { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; border-radius: 14px; }
  .e-wellcard .strip::-webkit-scrollbar { display: none; }
  .e-wellcard .strip img { height: 112px; width: auto; max-width: none; border-radius: 14px; }
}

/* ---- S5 · Health chapter ----------------------------------------------- */
.e-ring-wrap { display: grid; justify-items: center; gap: 6px; width: max-content; }
.e-ring {
  --score: 97; position: relative; width: 190px; height: 190px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--score) * 1%), var(--surface-2) 0);
}
.e-ring::before { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--bg); }
.e-ring .center { position: absolute; inset: 0; display: grid; place-items: center; }
.e-ring .center > div { text-align: center; }
.e-ring .num { font-size: 3.4rem; font-weight: 680; letter-spacing: -0.03em; line-height: 1; font-feature-settings: "tnum"; }
.e-ring .of { display: block; margin-top: 4px; font-size: 0.72rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.e-grade { display: inline-flex; align-items: baseline; gap: 8px; margin-top: 12px; font-weight: 700; }
.e-grade .a { font-size: 1.5rem; color: var(--mint); }
.e-grade .word { color: var(--text-2); font-weight: 600; font-size: 0.95rem; }
@property --score { syntax: "<number>"; inherits: false; initial-value: 0; }
@media (prefers-reduced-motion: no-preference) {
  .reveal:not(.in) .e-ring { --score: 0; }
  .reveal.in .e-ring { --score: 97; transition: --score 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) 150ms; }
}
.e-insight-cards { display: grid; gap: 10px; margin-top: 26px; max-width: 430px; }
.e-insight-cards .c {
  display: grid; grid-template-columns: 18px 1fr; gap: 12px; align-items: start;
  padding: 14px 16px; border: 1px solid var(--hairline-2); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow-1);
  font-size: 0.93rem; color: var(--text-2); text-wrap: pretty;
}
.e-insight-cards .c svg { width: 18px; height: 18px; color: var(--accent-ink); margin-top: 2px; }
.e-overflow-right { margin: 0; }
@media (min-width: 1280px) { .e-overflow-right { margin-right: -60px; } }

/* ---- S6 · Energy stage -------------------------------------------------- */
.e-energy { text-align: center; }
.e-energy .e-glow { background: radial-gradient(ellipse 52% 38% at 50% 30%, rgba(28, 127, 242, 0.10), transparent 70%); }
.e-energy h2 { color: var(--stage-text); font-size: clamp(2.2rem, 1.4rem + 3.2vw, 3.6rem); max-width: 22ch; margin-inline: auto; }
.e-money { margin-top: clamp(28px, 4vw, 44px); color: var(--stage-text); }
.e-money .big-stat { font-size: clamp(4rem, 2.6rem + 6vw, 7rem); color: #7db8f8; text-shadow: 0 0 44px rgba(28, 127, 242, 0.35); }
.e-money .cap { margin-top: 12px; font-size: 0.98rem; color: var(--stage-mut); }
.e-chiprow { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.e-chiprow span {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px; border-radius: 999px;
  background: var(--stage-2); border: 1px solid var(--stage-line); color: var(--stage-mut);
  font-size: 0.84rem; font-weight: 600; font-feature-settings: "tnum";
}
.e-chiprow b { color: var(--stage-text); font-weight: 650; margin-right: 5px; }
.e-energy .lead { max-width: 56ch; margin: 22px auto 0; }
.e-energy .e-window { width: min(1100px, 100%); margin: clamp(36px, 5vw, 56px) auto 0; }

/* ---- S7 · Bento coverage ------------------------------------------------- */
/* Cells hold real, uncropped dashboard tiles from the brand-kit captures —
   pics render at natural ratio (.nat) and center in any leftover space. */
.e-bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-top: 8px; }
.e-cell {
  position: relative; border-radius: 16px; overflow: hidden;
  background: var(--stage-2); border: 1px solid var(--stage-line); color: var(--stage-text);
  display: flex; flex-direction: column;
}
.e-cell .pic { overflow: hidden; border-bottom: 1px solid var(--stage-line); background: #0d1016; flex: 1 1 auto; min-height: 0; }
.e-cell .pic img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.e-cell .pic.nat { display: flex; align-items: center; background: #0f0f11; padding: 10px; }
.e-cell .pic.nat img { height: auto; object-fit: unset; border-radius: 10px; }
.e-cell .txt { padding: 18px 20px 19px; }
.e-cell .txt b { display: block; font-size: 1.02rem; font-weight: 660; letter-spacing: -0.012em; }
.e-cell .txt p { margin-top: 5px; font-size: 0.86rem; line-height: 1.5; color: var(--stage-mut); }
.e-cell-w3 { grid-column: span 3; }
.e-cell-w4 { grid-column: span 4; }
.e-cell-sm { grid-column: span 2; }
.e-cell-stat { grid-column: span 2; justify-content: center; padding: 24px 20px; }
.e-cell-stat .big-stat { color: var(--accent); font-size: clamp(2.8rem, 2.2rem + 2vw, 4rem); }
.e-cell-stat .stat-label { color: var(--stage-mut); margin-top: 8px; }
@media (max-width: 960px) {
  .e-bento { grid-template-columns: repeat(2, 1fr); }
  .e-cell-w3, .e-cell-w4, .e-cell-stat { grid-column: span 2; }
  .e-cell-sm { grid-column: span 1; }
}
@media (max-width: 560px) {
  .e-cell-sm { grid-column: span 2; }
}

/* ---- S8 · vs Activity Monitor ledger ------------------------------------ */
.e-ledger { max-width: 880px; margin-top: 8px; border-top: 1px solid var(--hairline-2); }
.e-ledger .lrow {
  display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(16px, 4vw, 48px);
  padding: 18px 2px; border: 0; border-bottom: 1px solid var(--hairline-2);
  border-radius: 0; background: transparent; box-shadow: none; align-items: baseline;
}
.e-ledger .them { color: var(--text-3); font-size: 0.97rem; }
.e-ledger .us { color: var(--text); font-weight: 650; font-size: 1.02rem; letter-spacing: -0.008em; }
@media (max-width: 640px) {
  .e-ledger .lrow { grid-template-columns: 1fr; gap: 4px; padding: 15px 2px; }
}

/* ---- S9 · Honesty + FAQ -------------------------------------------------- */
body.espial .matrix .yn.dash { color: var(--text-3); font-weight: 600; }

/* ---- S10 · Closer stage --------------------------------------------------- */
.e-closer { text-align: center; padding-bottom: 0; }
.e-closer .e-glow { background: radial-gradient(ellipse 55% 42% at 50% 78%, rgba(28, 127, 242, 0.13), transparent 70%); }
.e-closer h2 { color: var(--stage-text); font-size: clamp(2.3rem, 1.5rem + 3.4vw, 3.9rem); margin-inline: auto; }
.e-closer .lead { margin: 18px auto 0; max-width: 44ch; }
.e-closer .cta-row { justify-content: center; margin-top: 28px; }
.e-closer .form-note { margin-top: 18px; color: var(--stage-mut); font-size: 0.85rem; }
.e-closer .risingwrap { position: relative; z-index: 1; width: min(1000px, calc(100% - 40px)); margin: clamp(48px, 6vw, 72px) auto 0; }
.e-closer .rising {
  display: block; width: 100%; border-radius: 16px 16px 0 0; border: 1px solid var(--stage-line); border-bottom: 0;
  overflow: hidden; max-height: clamp(140px, 22vw, 300px);
}
.e-closer .rising img { width: 100%; height: auto; display: block; }

/* Reveal stagger for the hero pair (piggybacks on .reveal → .in) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .e-hero .e-hero-phone { transition-delay: 120ms; }
}
