/* ============================================================
   My Asthma Life — "Day 29" interactive demo (additive, scoped)
   Loaded AFTER site.css / site-enhance.css. Every rule here is
   scoped under .day29-demo so it cannot leak into other sections.
   Palette below intentionally mirrors the in-app Material-3-flat
   look (seed teal #0F766E, 16px card radius, 12px button radius)
   rather than the marketing site's --accent, since this section
   is a mockup of the app UI itself.
   ============================================================ */

/* Anchor-link smooth scroll for the How-it-works "Try it above/below"
   links. Instant-jumps for reduced-motion, per the site's existing
   reduced-motion convention (see the prefers-reduced-motion block below). */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* How-it-works step anchor links (new; the .step/.steps shell itself
   lives in site-enhance.css and is untouched). */
.step__link {
  display: inline-block;
  margin-top: 0.6rem;
  color: var(--accent-dark, #0f5744);
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
}
.step__link:hover { text-decoration: underline; }

.day29-demo,
.forecast-demo {
  --demo-seed: #0f766e;
  --demo-seed-dark: #0b5c56;
  --demo-seed-soft: #e3f3f0;
  --demo-surface: #ffffff;
  --demo-bg: #f4f8f7;
  --demo-text: #16211f;
  --demo-muted: #5b6b66;
  --demo-line: #dbe7e3;
  --demo-rough: #c9702e;
  --demo-rough-soft: #fbe9db;
  --demo-quiet: #cfd9d6;
}

.day29-demo__intro,
.forecast-demo__intro {
  max-width: 74ch;
  margin: 0 auto 2rem;
  text-align: center;
}
.day29-demo__eyebrow,
.forecast-demo__eyebrow {
  color: var(--demo-seed-dark);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}
.day29-demo__intro h2,
.forecast-demo__intro h2 { margin: 0 0 0.6rem; }
.day29-demo__intro p,
.forecast-demo__intro p { color: var(--demo-muted); margin: 0 0 0.5rem; }
.day29-demo__intro .day29-demo__fiction-note {
  font-size: 0.92rem;
  font-style: italic;
}

.day29-demo__stage,
.forecast-demo__stage {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 460px);
  gap: 2rem;
  align-items: start;
  justify-content: center;
}

/* Forecast demo: two-column desktop layout, sides flipped relative to
   Day 29 (which is phone-left / notes-right) so the two demo sections
   alternate down the page. City picker + notes both live in the left
   ("explainer") column; the phone spans both rows on the right. */
.forecast-demo__stage {
  grid-template-columns: minmax(0, 460px) minmax(0, 300px);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "picker phone"
    "notes  phone";
}
.forecast-demo__stage > .forecast-demo__city-picker { grid-area: picker; margin-bottom: 0; }
.forecast-demo__stage > .forecast-demo__phone { grid-area: phone; }
.forecast-demo__stage > .forecast-demo__notes { grid-area: notes; }

/* ---- Phone frame (reuses the site's dark phone shell, teal screen chrome) ---- */
.day29-demo__phone,
.forecast-demo__phone {
  position: relative;
  width: 300px;
  max-width: 100%;
  background: #0f1714;
  border-radius: 42px;
  padding: 12px;
  box-shadow: 0 30px 60px rgba(24, 37, 31, 0.22), 0 8px 18px rgba(24, 37, 31, 0.12);
  margin: 0 auto;
}
.day29-demo__phone::before,
.forecast-demo__phone::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 116px;
  height: 7px;
  border-radius: 99px;
  background: #2a352f;
  z-index: 3;
}
.day29-demo__screen,
.forecast-demo__screen {
  background: var(--demo-bg);
  border-radius: 32px;
  overflow: hidden;
  min-height: 560px;
  display: flex;
  flex-direction: column;
}
.day29-demo__screen-top,
.forecast-demo__screen-top {
  background: var(--demo-seed);
  color: #fff;
  padding: 2.1rem 1.1rem 0.9rem;
  font-weight: 800;
  font-size: 0.98rem;
}
.day29-demo__screen-top small,
.forecast-demo__screen-top small {
  display: block;
  font-weight: 650;
  font-size: 0.74rem;
  opacity: 0.88;
  margin-top: 0.2rem;
}
.day29-demo__navbar,
.forecast-demo__navbar {
  display: flex;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--demo-surface);
}
.day29-demo__navbar span,
.forecast-demo__navbar span {
  flex: 1;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--demo-muted);
  padding: 0.55rem 0.2rem;
}
.day29-demo__navbar span.is-active,
.forecast-demo__navbar span.is-active { color: var(--demo-seed-dark); }

/* ---- Panels ---- */
.day29-demo__panel,
.forecast-demo__panel { flex: 1; overflow-y: auto; padding: 0.9rem 0.9rem 1.1rem; }
.day29-demo__panel[hidden] { display: none; }

.day29-demo__card,
.forecast-demo__card {
  background: var(--demo-surface);
  border: 1px solid var(--demo-line);
  border-radius: 16px;
  padding: 0.9rem 0.95rem;
  margin-bottom: 0.75rem;
}
.day29-demo__card h4,
.forecast-demo__card h4 { margin: 0 0 0.35rem; font-size: 0.92rem; }
.day29-demo__card p.day29-demo__hint,
.forecast-demo__card p.forecast-demo__hint {
  margin: 0.2rem 0 0;
  font-size: 0.76rem;
  color: var(--demo-muted);
}
.day29-demo__scale-instruction {
  font-size: 0.76rem;
  color: var(--demo-muted);
  margin: 0 0 0.7rem;
}

.day29-demo__field { margin-bottom: 0.85rem; }
.day29-demo__field:last-child { margin-bottom: 0; }
.day29-demo__field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.day29-demo__chip {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--demo-seed-soft);
  color: var(--demo-seed-dark);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.day29-demo__segmented {
  display: flex;
  border: 1px solid var(--demo-line);
  border-radius: 10px;
  overflow: hidden;
}
.day29-demo__segmented button {
  flex: 1;
  border: none;
  background: var(--demo-surface);
  color: var(--demo-text);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.45rem 0.2rem;
  cursor: pointer;
  border-left: 1px solid var(--demo-line);
}
.day29-demo__segmented button:first-child { border-left: none; }
.day29-demo__segmented button[aria-pressed="true"] {
  background: var(--demo-seed);
  color: #fff;
}

/* ---- Unanswered-row flag (set on blocked Save, cleared as items are answered) ---- */
.day29-demo__field--unanswered .day29-demo__field-label {
  color: var(--demo-rough);
}
.day29-demo__field--unanswered .day29-demo__segmented {
  border-color: var(--demo-rough);
  box-shadow: 0 0 0 1px var(--demo-rough-soft) inset;
}

.day29-demo__progress {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--demo-muted);
  margin: 0 0 0.5rem;
}

.day29-demo__stepper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.day29-demo__stepper button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--demo-line);
  background: var(--demo-surface);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--demo-seed-dark);
  cursor: pointer;
}
.day29-demo__stepper output {
  min-width: 2.4rem;
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
}

.day29-demo__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.day29-demo__filter-chip {
  border: 1px solid var(--demo-line);
  background: var(--demo-surface);
  color: var(--demo-text);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 650;
  padding: 0.32rem 0.65rem;
  cursor: pointer;
}
.day29-demo__filter-chip[aria-pressed="true"] {
  background: var(--demo-seed);
  border-color: var(--demo-seed);
  color: #fff;
}

.day29-demo__mal-note {
  font-size: 0.78rem;
  color: var(--demo-muted);
  background: var(--demo-seed-soft);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.85rem;
}

.day29-demo__save {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--demo-seed);
  color: #fff;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
}
.day29-demo__save:hover { background: var(--demo-seed-dark); }

.day29-demo__back {
  display: block;
  border: none;
  background: transparent;
  color: var(--demo-seed-dark);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.4rem 0;
  margin-top: 0.5rem;
  cursor: pointer;
}

.day29-demo__notes {
  align-self: center;
  background: var(--demo-surface);
  border: 1px solid var(--demo-line);
  border-radius: 16px;
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow, 0 14px 38px rgba(24, 37, 31, 0.08));
}
.day29-demo__notes h3 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.day29-demo__notes p { color: var(--demo-muted); margin: 0 0 0.7rem; font-size: 0.92rem; }
.day29-demo__notes p:last-child { margin-bottom: 0; }

.forecast-demo__notes {
  background: var(--demo-surface);
  border: 1px solid var(--demo-line);
  border-radius: 16px;
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow, 0 14px 38px rgba(24, 37, 31, 0.08));
}
.forecast-demo__notes h3 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.forecast-demo__notes p { color: var(--demo-muted); margin: 0 0 0.7rem; font-size: 0.92rem; }
.forecast-demo__notes p:last-child { margin-bottom: 0; }

/* ---- Month grid ---- */
.day29-demo__grid-title { font-size: 0.85rem; font-weight: 800; margin: 0 0 0.5rem; }
.day29-demo__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 0.8rem;
}
.day29-demo__grid-day {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--demo-quiet);
  position: relative;
}
.day29-demo__grid-day.is-rough { background: var(--demo-rough); }
.day29-demo__grid-day.is-dust::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--demo-seed-dark);
}
.day29-demo__grid-day.is-day29 {
  outline: 2px solid var(--demo-seed-dark);
  outline-offset: 1px;
}
.day29-demo__grid-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  font-size: 0.68rem;
  color: var(--demo-muted);
  margin-bottom: 0.85rem;
}
.day29-demo__grid-legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.day29-demo__legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

/* ---- Standard-view results: four-card stack (mirrors
   insights_screen.dart's _StandardHeroCard / _StandardSupportCard /
   _StandardMarkersCard / _StandardHelpfulLoggingCard) ---- */
.day29-demo__hero-card {
  background: var(--demo-seed-soft);
  border-color: var(--demo-seed-soft);
}
.day29-demo__hero-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.day29-demo__hero-header h4 { margin: 0; }
.day29-demo__pill {
  display: inline-block;
  flex: none;
  background: var(--demo-quiet);
  color: var(--demo-text);
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  white-space: nowrap;
}
.day29-demo__hero-title {
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.18;
  margin: 0 0 0.6rem;
}
.day29-demo__hero-body { font-size: 0.9rem; margin: 0 0 0.6rem; }
.day29-demo__hero-safety {
  font-size: 0.76rem;
  color: var(--demo-muted);
  margin: 0;
}

.day29-demo__marker-rows {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.day29-demo__marker-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.day29-demo__marker-row::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 0.4rem;
  border-radius: 50%;
  background: var(--demo-seed);
}
.day29-demo__marker-row span { font-size: 0.86rem; }

.day29-demo__helpful-lines p {
  font-size: 0.86rem;
  margin: 0 0 0.5rem;
}
.day29-demo__helpful-lines p:last-child { margin-bottom: 0; }

.day29-demo__panel .day29-demo__footer-safety {
  text-align: left;
  max-width: none;
  margin: 0 0 1rem;
}

.day29-demo__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.day29-demo__action {
  display: inline-block;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.84rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.day29-demo__action--filled {
  border: none;
  background: var(--demo-seed);
  color: #fff;
}
.day29-demo__action--filled:hover { background: var(--demo-seed-dark); }
.day29-demo__action--outlined {
  border: 1px solid var(--demo-seed);
  background: transparent;
  color: var(--demo-seed-dark);
}
.day29-demo__detail-note {
  font-size: 0.78rem;
  color: var(--demo-muted);
  font-style: italic;
  margin: 0 0 1rem;
}

.day29-demo__footer-safety,
.forecast-demo__footer-safety {
  font-size: 0.74rem;
  color: var(--demo-muted);
  text-align: center;
  max-width: 60ch;
  margin: 1.4rem auto 0.3rem;
}
.day29-demo__footer-sample,
.forecast-demo__footer-sample {
  font-size: 0.72rem;
  color: var(--demo-muted);
  text-align: center;
  font-style: italic;
  margin: 0;
}

/* ============================================================
   Forecast demo (additive, scoped under .forecast-demo)
   ============================================================ */

.forecast-demo__city-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.forecast-demo__picker-cta {
  flex: 1 1 100%;
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--demo-muted);
}
.forecast-demo__city-picker button {
  flex: 1;
  min-width: 8.5rem;
  border: 1px solid var(--demo-line);
  background: var(--demo-surface);
  color: var(--demo-text);
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.55rem 0.5rem;
  cursor: pointer;
  text-align: center;
}
.forecast-demo__city-picker button[aria-pressed="true"] {
  background: var(--demo-seed);
  border-color: var(--demo-seed);
  color: #fff;
}

.forecast-demo__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.forecast-demo__status-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--demo-seed-soft);
  color: var(--demo-seed-dark);
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
}

.forecast-demo__outlook-title { font-size: 0.96rem; font-weight: 800; margin: 0 0 0.35rem; }
.forecast-demo__outlook-body { font-size: 0.84rem; color: var(--demo-text); margin: 0; }

.forecast-demo__window-row {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--demo-line);
}
.forecast-demo__window-row:last-child { border-bottom: none; }
.forecast-demo__window-label {
  flex: none;
  background: var(--demo-seed-soft);
  color: var(--demo-seed-dark);
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
}
.forecast-demo__window-body { font-size: 0.82rem; }
.forecast-demo__window-headline { font-weight: 700; margin: 0 0 0.15rem; }
.forecast-demo__window-detail { margin: 0; color: var(--demo-muted); font-size: 0.76rem; }

.forecast-demo__signal-row {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--demo-line);
}
.forecast-demo__signal-row:last-child { border-bottom: none; }
.forecast-demo__signal-title {
  font-size: 0.82rem;
  font-weight: 800;
  margin: 0 0 0.2rem;
}
.forecast-demo__signal-primary { font-size: 0.84rem; margin: 0 0 0.15rem; }
.forecast-demo__signal-secondary { font-size: 0.76rem; color: var(--demo-muted); margin: 0; }

/* ---- Desktop-only: internal phone scroll + sticky explainer column ----
   The phone frame is capped in height so the screen scrolls like a real
   phone, while the explainer column stays in view alongside it. Reset
   inside the max-width: 860px block below so mobile keeps natural
   document flow with no internal scroll (matches Day 29's behavior). */
.forecast-demo__screen {
  max-height: min(78vh, 760px);
}
.forecast-demo__panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 20, 0.22) transparent;
}
.forecast-demo__panel::-webkit-scrollbar { width: 6px; }
.forecast-demo__panel::-webkit-scrollbar-track { background: transparent; }
.forecast-demo__panel::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 20, 0.22);
  border-radius: 999px;
}
/* Bottom fade affordance hinting the panel scrolls; sticks to the
   visible bottom edge of the scroll area via position: sticky on the
   generated content itself. */
.forecast-demo__panel::after {
  content: "";
  display: block;
  position: sticky;
  bottom: 0;
  height: 28px;
  margin: -28px -0.95rem 0;
  background: linear-gradient(to bottom, transparent, var(--demo-bg));
  pointer-events: none;
}
.forecast-demo__notes {
  position: sticky;
  top: 2rem;
}

/* Desktop-only "scroll to explore" hint, pinned near the bottom fade
   inside the scrolling panel. Decorative (aria-hidden); demo.js hides
   it after the panel's first scroll event. */
.forecast-demo__scroll-hint {
  display: none;
  position: sticky;
  bottom: 6px;
  z-index: 2;
  width: max-content;
  margin: 0.4rem auto 0;
  background: rgba(15, 23, 20, 0.72);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  pointer-events: none;
}
@media (min-width: 861px) {
  .forecast-demo__scroll-hint { display: block; }
}
.forecast-demo__scroll-hint[hidden] { display: none; }

/* ---- Day 29: same desktop-only internal phone scroll treatment as the
   Forecast demo above (860px breakpoint, min(78vh, 760px) cap, thin
   scrollbar, bottom fade, sticky notes column). Scoped entirely under
   .day29-demo__* so it cannot affect the Forecast section. Day 29's
   existing grid (phone-left / notes-right) and stage rules are
   untouched. */
.day29-demo__screen {
  max-height: min(78vh, 760px);
}
.day29-demo__panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 20, 0.22) transparent;
}
.day29-demo__panel::-webkit-scrollbar { width: 6px; }
.day29-demo__panel::-webkit-scrollbar-track { background: transparent; }
.day29-demo__panel::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 20, 0.22);
  border-radius: 999px;
}
.day29-demo__panel::after {
  content: "";
  display: block;
  position: sticky;
  bottom: 0;
  height: 28px;
  margin: -28px -0.9rem 0;
  background: linear-gradient(to bottom, transparent, var(--demo-bg));
  pointer-events: none;
}
.day29-demo__notes {
  position: sticky;
  top: 2rem;
}

@media (prefers-reduced-motion: reduce) {
  .day29-demo *,
  .forecast-demo * { transition: none !important; }
}

@media (max-width: 860px) {
  .day29-demo__stage {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }
  .forecast-demo__stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "picker"
      "phone"
      "notes";
    justify-items: center;
  }
  .forecast-demo__screen { max-height: none; }
  .forecast-demo__panel::after { content: none; }
  .forecast-demo__notes { position: static; top: auto; }
  .day29-demo__screen { max-height: none; }
  .day29-demo__panel::after { content: none; }
  .day29-demo__notes { position: static; top: auto; }
}
