/* BilanX Health: home page (index.html). Loads after base.css. */

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(16px, 2vw, 28px); }
.grid > * { min-width: 0; }
.band { padding-block: clamp(64px, 9vw, 112px); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.6em;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: .95rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .2s, border-color .2s, color .2s;
}
.btn-primary { background: #fff; color: var(--ink); }
.btn-primary:hover { background: var(--signal); }
.btn-ghost { border-color: var(--signal); color: #fff; }
.btn-ghost:hover { border-color: #fff; background: rgba(182, 154, 228, .16); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: max(92svh, 720px);
  overflow: hidden;
  isolation: isolate;
}
.hero > .wrap { width: 100%; }
.hero canvas { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(23, 21, 27, .88) 0, rgba(23, 21, 27, .6) 38%, rgba(23, 21, 27, 0) 70%);
}
.hero-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(56px, 10vh, 120px) clamp(48px, 8vh, 88px);
}
.hero h1 {
  grid-column: 1 / span 9;
  font-size: clamp(2.6rem, 5.3vw, 4.7rem);
  line-height: 1.06;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.hero-sub {
  grid-column: 1 / -1;
  margin: 16px 0 0;
  font-size: clamp(1rem, 1.7vw, 1.2rem);
  line-height: 1.55;
  color: rgba(255, 255, 255, .86);
}
.hero-actions { grid-column: 1 / span 8; display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(26px, 4vh, 38px); }
.hero-cap {
  position: absolute;
  right: var(--pad);
  bottom: 22px;
  max-width: 34ch;
  margin: 0;
  font-size: .88rem;
  line-height: 1.45;
  text-align: right;
  color: rgba(255, 255, 255, .78);
}
.hero-cap::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  margin-right: 10px;
  vertical-align: middle;
  background: var(--signal);
}

/* Facts strip: translucent so the hero lines show faintly behind it. */
.hero-foot {
  position: relative;
  padding-block: 24px 30px;
  background: rgba(23, 21, 27, .38);
  border-top: 1px solid rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.facts {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.05fr 1.2fr 1fr;
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.facts strong { display: block; font-family: var(--display); font-size: 1.08rem; font-weight: 500; letter-spacing: -.01em; }
.facts span { display: block; max-width: 30ch; margin-top: 4px; font-size: .9rem; line-height: 1.5; color: rgba(255, 255, 255, .72); }

@media (max-width: 900px) {
  .hero h1, .hero-actions { grid-column: 1 / -1; }
  .hero-cap { position: static; max-width: none; margin-top: 32px; text-align: left; }
  .facts { gap: 24px; }
}
@media (max-width: 720px) {
  .facts { grid-template-columns: 1fr; gap: 20px; }
  .facts span { max-width: none; }
  .facts li + li { padding-top: 18px; border-top: 1px solid #ffffff1f; }
}
@media (max-width: 640px) {
  .hero { min-height: 100svh; }
  .hero canvas { opacity: .6; }
  .hero::after { background: rgba(23, 21, 27, .5); }
  .hero-body { padding-block: 48px 40px; }
  .hero-actions .btn { flex: 1 1 100%; }
}
/* Short landscape phones: let the hero shrink to its content. */
@media (max-height: 550px) and (orientation: landscape) {
  .hero { min-height: auto; }
}

/* ---------- rhythm: one reading, two days ---------- */
.rhythm { background: var(--soft); }
.rhythm .intro { grid-column: 1 / span 4; }
.rhythm .intro p { margin: 1.2em 0 0; color: var(--muted); text-align: justify; -webkit-hyphens: auto; hyphens: auto; }

.chartbox { grid-column: 5 / -1; padding: clamp(18px, 2.4vw, 32px); background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.toggle { display: inline-flex; margin-bottom: 20px; padding: 3px; background: var(--soft); border: 1px solid var(--line); border-radius: 4px; }
.toggle button {
  min-height: 40px;
  padding: 0 1.15em;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.toggle button[aria-pressed="true"] { background: var(--violet); color: #fff; }
.chart-hint { display: none; margin: 0 0 12px; font-size: .82rem; color: var(--muted); }

#chart { width: 100%; height: auto; aspect-ratio: 920 / 450; overflow: visible; cursor: crosshair; touch-action: pan-y; }
#chart text { font-family: var(--sans); font-size: 13.5px; fill: var(--muted); }
#chart .lab { font-size: 15px; font-weight: 500; }
#chart .hand { font-size: 15px; font-weight: 500; fill: var(--ink); }

/* Repeated-samples mode (.is-repeated on the chart) draws the curves and dots. */
.curve {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.6s cubic-bezier(.5, .1, .2, 1);
}
.dot { opacity: 0; transition: opacity .35s; }
.hide-cont { transition: opacity .4s; }
.show-cont { opacity: 0; transition: opacity .5s .6s; }
.is-repeated .curve { stroke-dashoffset: 0; }
.is-repeated .dot,
.is-repeated .show-cont { opacity: 1; }
.is-repeated .hide-cont { opacity: 0; pointer-events: none; }

.readout {
  min-height: 3.2em;
  max-width: 44em;
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.5;
}
.fine { margin: 10px 0 0; font-size: .85rem; color: var(--muted); }

@media (max-width: 900px) {
  .rhythm .intro, .chartbox { grid-column: 1 / -1; }
  .chartbox { margin-top: 36px; }
  .chart-hint { display: block; }
}
@media (max-width: 720px) {
  .rhythm .intro p { text-align: left; -webkit-hyphens: manual; hyphens: manual; }
  .chartbox { padding: 12px; }
  /* The chart scales down with the screen, so its labels are drawn larger to stay readable. */
  #chart text { font-size: 22px; }
  #chart .lab, #chart .hand { font-size: 24px; }
  #unknown .hand { transform: translateY(110px); }
}
@media (max-width: 640px) {
  .toggle { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .toggle button { padding: 8px; font-size: .85rem; line-height: 1.35; }
  .readout { min-height: 0; }
}

/* ---------- how it works ---------- */
.how .head { grid-column: 1 / span 6; }
.steps-col { grid-column: 1 / span 6; margin-top: clamp(32px, 4vw, 56px); }
.steps { margin: 0; padding: 0; list-style: none; }
.step { display: grid; grid-template-columns: 56px minmax(0, 1fr); padding: 28px 0; border-top: 1px solid var(--line); }
.step:last-child { border-bottom: 1px solid var(--line); }
.step h3 { margin-bottom: .35em; }
.step p { max-width: 52ch; margin: 0; color: var(--muted); }
.step .later { margin-top: 1em; padding-left: 14px; border-left: 2px solid var(--signal); font-size: .98rem; color: var(--violet); }
.num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-top: 1px;
  border: 1px solid var(--violet);
  border-radius: 50%;
  font-family: var(--display);
  font-size: .9rem;
  font-weight: 500;
  color: var(--violet);
}
.proto {
  margin: 28px 0 0;
  padding: 16px 18px;
  background: var(--soft);
  border-left: 3px solid var(--violet);
  border-radius: 0 4px 4px 0;
  font-size: .95rem;
  line-height: 1.55;
  color: var(--muted);
}
.proto strong { font-weight: 600; color: var(--ink); }

.device-col { grid-column: 8 / -1; grid-row: 1 / span 2; }
.device {
  position: sticky;
  top: 24px;
  margin: 0;
  padding: clamp(16px, 2vw, 28px);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.device svg { width: 100%; height: auto; overflow: hidden; }
.device figcaption { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }

@media (max-width: 900px) {
  .how .head, .steps-col { grid-column: 1 / -1; }
  .device-col { grid-column: 1 / -1; grid-row: auto; max-width: 480px; margin-top: 40px; }
  .device { position: static; }
}
@media (max-width: 640px) {
  .step { grid-template-columns: 44px minmax(0, 1fr); }
}

/* ---------- who it's for ---------- */
.who { background: var(--deep); }
.who h2 { grid-column: 1 / span 8; }
.who .intro { grid-column: 1 / -1; max-width: 46ch; margin: 20px 0 0; font-size: 1.15rem; color: rgba(255, 255, 255, .82); }
.who .col { grid-column: span 4; margin-top: clamp(36px, 5vw, 60px); padding-top: 28px; border-top: 1px solid rgba(255, 255, 255, .28); }
.who h3 { margin-bottom: .7em; font-size: 1rem; color: var(--signal); }
.who .col p { max-width: 34ch; margin: 0; font-size: 1.15rem; color: rgba(255, 255, 255, .9); }
.who .note { grid-column: 1 / -1; margin: 36px 0 0; font-size: .9rem; color: rgba(255, 255, 255, .68); }

@media (max-width: 900px) {
  .who h2, .who .intro, .who .col { grid-column: 1 / -1; }
}

/* ---------- why now ---------- */
.why .big {
  grid-column: 1 / span 7;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.55rem, 2.7vw, 2.25rem);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -.02em;
  text-wrap: pretty;
}
.why .aside { grid-column: 9 / -1; margin: 0; padding-top: 20px; border-top: 2px solid var(--violet); }
.why dt { font-size: .85rem; font-weight: 500; color: var(--muted); }
.why dd { margin: .4em 0 1.7em; font-family: var(--display); font-size: 1.15rem; font-weight: 500; line-height: 1.4; letter-spacing: -.01em; }
.why dd:last-child { margin-bottom: 0; }

@media (max-width: 900px) {
  .why .big, .why .aside { grid-column: 1 / -1; }
  .why .aside { margin-top: 40px; }
}

/* ---------- close and contact ---------- */
.close { background: var(--tint); }
.close .vision { grid-column: 1 / span 10; font-size: clamp(1.8rem, 3.3vw, 2.7rem); line-height: 1.16; }
.close .ml { grid-column: 1 / span 8; max-width: 44ch; margin: clamp(32px, 4vw, 56px) 0 0; color: var(--muted); }
.contact-card {
  grid-column: 1 / span 7;
  margin-top: 24px;
  padding: clamp(20px, 2.4vw, 32px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.contact-card h3 { margin-bottom: .4em; font-size: 1.25rem; }
.contact-card p { margin: 0 0 .9em; color: var(--muted); }

@media (max-width: 900px) {
  .close .vision, .close .ml, .contact-card { grid-column: 1 / -1; }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .curve, .dot, .show-cont, .hide-cont { transition: none; }
}
