:root {
  color-scheme: light;
  --demo-content-max: 1180px;
  --demo-reading-max: 780px;
  --demo-gutter: clamp(1.25rem, 4vw, 3.5rem);
  --demo-page: #f5f3ee;
  --demo-surface: #ffffff;
  --demo-surface-subtle: #faf9f5;
  --demo-ink: #101725;
  --demo-text-secondary: #4f5b6c;
  --demo-text-muted: #5b6676;
  --demo-border: #777168;
  --demo-card-border: #d7d2c8;
  --demo-accent: #4338ca;
  --demo-accent-deep: #322aa6;
  --demo-accent-tint: #e8e6fb;
  --demo-navy: #0b0f17;
  --demo-footer: #080b11;
  --demo-focus-light: #5b4ee8;
  --demo-focus-dark: #afa9ff;
}

html { scroll-behavior: auto; }
body { margin: 0; background: var(--demo-page); color: var(--demo-ink); }
.container {
  width: 100%;
  max-width: calc(var(--demo-content-max) + (var(--demo-gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--demo-gutter);
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  min-height: 44px;
  padding: .75rem 1rem;
  border: 1px solid var(--demo-border);
  border-radius: var(--r-sm);
  color: var(--demo-accent-deep);
  background: var(--demo-surface);
}
.skip-link:focus { top: 1rem; }

.demo-nav { background: var(--demo-navy); color: #fff; border-bottom: 1px solid #596170; }
.demo-nav-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.demo-brand { display: inline-flex; align-items: center; gap: .65rem; min-height: 44px; color: #fff; font-weight: 700; font-size: 1.18rem; text-decoration: none; }
.demo-brand span span { color: #afa9ff; }
.demo-nav nav { display: flex; align-items: center; }
.demo-nav .btn-ghost { min-height: 44px; color: #fff; background: #171c25; border: 1px solid #737b89; }
.demo-nav .btn-ghost:hover { color: #fff; background: #242b37; border-color: #aab2c2; }

.demo-hero { color: #fff; background: var(--demo-navy); padding: clamp(4.75rem, 9vw, 7.5rem) 0 clamp(5.25rem, 9vw, 8rem); }
.demo-hero-inner { max-width: calc(var(--demo-reading-max) + (var(--demo-gutter) * 2)); margin-inline: auto; }
.demo-eyebrow { margin: 0 0 1rem; color: #594cc7; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .14em; font-weight: 600; }
.demo-hero .demo-eyebrow { color: #afa9ff; }
.demo-hero h1 { margin: 0; max-width: 18ch; color: #f7f8fa; font-family: var(--font-hero); font-size: clamp(2.6rem, 5.8vw, 4.8rem); line-height: 1.02; letter-spacing: -.04em; }
.demo-lead { max-width: 48ch; margin: 1.5rem 0 0; color: #c5cbd6; font-size: clamp(1.08rem, 2vw, 1.25rem); line-height: 1.65; }

.demo-catalogue {
  min-height: 50vh;
  padding: clamp(4.5rem, 7vw, 7rem) 0 clamp(5.5rem, 8vw, 8rem);
  color: var(--demo-ink);
  background: linear-gradient(180deg, var(--demo-surface-subtle) 0, var(--demo-page) 14rem);
}
.demo-section-head { max-width: var(--demo-reading-max); }
.demo-section-head h2, .demo-journey-head h2 { margin: 0; color: var(--demo-ink); font-family: var(--font-display); font-size: clamp(2rem, 4vw, 3rem); font-weight: 500; line-height: 1.1; }
.demo-notice {
  max-width: 72ch;
  margin: 1.5rem 0 2.5rem;
  padding: .85rem 1rem;
  border-left: 3px solid var(--demo-accent);
  color: var(--demo-text-secondary);
  background: var(--demo-surface);
  line-height: 1.55;
}

.demo-product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2.5vw, 1.5rem); }
.demo-product-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 238px;
  padding: clamp(1.5rem, 3vw, 2rem);
  border: 1px solid var(--demo-border);
  border-radius: var(--r-lg);
  color: var(--demo-ink);
  background: var(--demo-surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.demo-product-card:hover { border-color: var(--demo-accent); background: #fbfaff; box-shadow: 0 12px 34px rgba(16,23,37,.09); }
.demo-product-card[aria-pressed="true"] { border-color: var(--demo-accent); color: #241d87; background: var(--demo-accent-tint); }
.demo-product-card:disabled { opacity: 1; cursor: not-allowed; border-color: var(--demo-border); color: #4f5968; background: #e8e5de; }
.demo-product-name { color: var(--demo-ink); font-size: 1.3rem; font-weight: 700; line-height: 1.25; }
.demo-product-description { margin-top: 1rem; color: var(--demo-text-secondary); line-height: 1.55; }
.demo-product-count { margin-top: 1.25rem; color: var(--demo-text-muted); font-size: .9rem; }
.demo-product-action { margin-top: auto; padding-top: 1.5rem; color: var(--demo-accent-deep); font-weight: 600; text-decoration: underline; text-underline-offset: .18em; }

.demo-text-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 1.5rem;
  padding: .5rem 0;
  border: 0;
  color: var(--demo-accent-deep);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: .18em;
}
.demo-text-action:hover { color: #241d87; }

.demo-journey-head { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; }
.demo-journey-head .demo-text-action { flex: 0 0 auto; margin: 0; }
.demo-refine { margin-top: 2rem; border: 1px solid var(--demo-card-border); border-radius: var(--r-lg); background: var(--demo-surface); box-shadow: var(--shadow-sm); }
.demo-refine summary { display: flex; align-items: center; min-height: 48px; padding: .8rem 1rem; color: var(--demo-accent-deep); cursor: pointer; font-weight: 600; }
.demo-refine summary:hover { color: #241d87; background: var(--demo-surface-subtle); }
.demo-select-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1rem; }
.demo-select-grid label { display: grid; gap: .5rem; color: var(--demo-text-secondary); font-weight: 600; }
.demo-select-grid select { width: 100%; min-width: 0; min-height: 48px; padding: .7rem .85rem; border: 1px solid var(--demo-border); border-radius: var(--r-sm); color: var(--demo-ink); background: var(--demo-surface-subtle); font: inherit; }
.demo-select-grid select:hover { border-color: var(--demo-accent); }
.demo-select-grid select:disabled { opacity: 1; cursor: not-allowed; border-color: var(--demo-border); color: #4f5968; background: #e8e5de; }
.demo-select-grid select option { color: var(--demo-ink); background: var(--demo-surface); }

.demo-status { margin: 1.25rem 0; color: var(--demo-text-muted); font-size: .9rem; }
.demo-results, .demo-journey-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2vw, 1.5rem); }
.demo-results--grouped { display: grid; grid-template-columns: 1fr; gap: clamp(3rem, 6vw, 5rem); }
.demo-product-group > h3 { margin: 0 0 1.25rem; color: var(--demo-ink); font-family: var(--font-display); font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 500; }
.demo-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
  padding: clamp(1.4rem, 2.5vw, 1.8rem);
  border: 1px solid var(--demo-card-border);
  border-radius: var(--r-lg);
  color: var(--demo-ink);
  background: var(--demo-surface);
  box-shadow: var(--shadow-sm);
}
.demo-card h3 { margin: 0; color: var(--demo-ink); font-family: var(--font-body); font-size: 1.25rem; font-weight: 700; line-height: 1.3; }
.demo-card-outcome { margin: 1rem 0 0; color: var(--demo-text-secondary); line-height: 1.55; overflow-wrap: anywhere; }
.demo-card-meta { display: grid; gap: .5rem; margin: 1rem 0 1.5rem; font-size: .9rem; }
.demo-card-meta p { margin: 0; color: var(--demo-ink); overflow-wrap: anywhere; }
.demo-explore {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  min-height: 44px;
  margin-top: auto;
  padding: .65rem 1rem;
  border: 1px solid var(--demo-accent);
  border-radius: var(--r-btn);
  color: var(--demo-accent-deep);
  background: var(--demo-surface);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.demo-explore:hover { color: #fff; background: var(--demo-accent); }

.demo-empty { margin-top: 2rem; padding: clamp(2.5rem, 6vw, 4.5rem); border: 0; border-radius: var(--r-lg); color: var(--demo-ink); background: var(--demo-surface); box-shadow: var(--shadow-sm); text-align: center; }
.demo-empty h2 { color: var(--demo-ink); }
.demo-empty p { color: var(--demo-text-secondary); }
.demo-empty .btn-primary, #detail-content .btn-primary { color: #fff; background: var(--demo-accent); }
.demo-empty .btn-primary:hover, #detail-content .btn-primary:hover { color: #fff; background: var(--demo-accent-deep); }

.demo-dialog { width: min(680px, calc(100% - 2rem)); max-height: calc(100% - 2rem); padding: 0; border: 1px solid var(--demo-card-border); border-radius: var(--r-xl); color: var(--demo-ink); background: var(--demo-surface); box-shadow: var(--shadow-lg); }
.demo-dialog::backdrop { background: rgba(11,15,23,.72); }
.demo-dialog > form { display: flex; justify-content: flex-end; }
.demo-close { margin: .75rem .75rem 0; width: 44px; height: 44px; border: 1px solid var(--demo-border); border-radius: var(--r-pill); color: var(--demo-ink); background: var(--demo-surface-subtle); font-size: 1.7rem; cursor: pointer; }
.demo-close:hover { color: #241d87; border-color: var(--demo-accent); background: var(--demo-accent-tint); }
#detail-content { padding: 0 2rem 2rem; }
#detail-content h2, #detail-content h3 { color: var(--demo-ink); }
#detail-content h2 { margin-top: 0; font-family: var(--font-display); font-size: 2.25rem; line-height: 1.1; }
#detail-content p, #detail-content li { color: var(--demo-text-secondary); line-height: 1.55; }
#detail-content li { margin-bottom: .55rem; }
#detail-content .btn-primary { margin-top: .75rem; }

.demo-footer { padding: 2.5rem 0; color: #c0c7d3; background: var(--demo-footer); }
.demo-footer-inner { display: flex; justify-content: space-between; gap: 2rem; }
.demo-footer p { margin: 0; max-width: 62ch; }

:focus-visible { outline: 3px solid var(--demo-focus-light); outline-offset: 3px; }
.skip-link:focus-visible, .demo-catalogue :focus-visible, .demo-dialog :focus-visible { outline: 3px solid var(--demo-focus-light); outline-offset: 3px; }
.demo-nav :focus-visible, .demo-hero :focus-visible, .demo-footer :focus-visible { outline: 3px solid var(--demo-focus-dark); outline-offset: 3px; }
.demo-journey-head h2:focus-visible { outline: 0; box-shadow: inset 0 -3px var(--demo-focus-light); }
#product-selection:focus-visible { outline: 3px solid var(--demo-focus-light); outline-offset: -3px; }
[hidden] { display: none !important; }

@media (max-width: 960px) {
  .demo-product-grid, .demo-results, .demo-journey-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .demo-nav-inner, .demo-footer-inner { align-items: flex-start; flex-direction: column; padding-block: 1rem; }
  .demo-nav nav, .demo-nav .btn-ghost { width: 100%; justify-content: center; }
  .demo-product-grid, .demo-results, .demo-journey-grid, .demo-select-grid { grid-template-columns: 1fr; }
  .demo-product-card { min-height: 210px; }
  .demo-journey-head { align-items: flex-start; flex-direction: column; }
  .demo-journey-head .demo-text-action { margin-top: .5rem; }
}
@media (max-width: 420px) {
  .demo-hero h1 { font-size: 2.55rem; }
  #detail-content { padding-inline: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
