/* Homepage Styles */

/* Hero Section */
.hero {
  padding-block: var(--size-2xl) var(--size-3xl);
  text-align: center;
}

.hero h1 {
  font-size: clamp(var(--font-size-2xl), 5vw, var(--font-size-4xl));
  margin-block-end: var(--size-s);
}

.hero .tagline {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
  max-inline-size: 50ch;
  margin-inline: auto;
  margin-block-end: var(--size-xl);
}

.hero-demo {
  margin-block: var(--size-xl);
  max-inline-size: var(--content-wide);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--size-l);
  align-items: stretch;
}

.hero-demo code-block {
  margin: 0;
  text-align: start;
  block-size: 100%;
}

.hero-demo browser-window {
  margin: 0;
  resize: none;
  text-align: start;
  block-size: 100%;
}

.demo-result {
  padding: var(--size-l);
}

@media (max-width: 900px) {
  .hero-demo {
    grid-template-columns: 1fr;
  }

  .hero-demo code-block,
  .hero-demo browser-window {
    max-block-size: 20rem;
    block-size: auto;
  }
}

.catchphrase {
  font-size: clamp(var(--font-size-lg), 3vw, var(--font-size-2xl));
  font-weight: 600;
  margin-block: var(--size-xl);
  color: var(--color-text);
}

.catchphrase .highlight {
  color: var(--color-interactive);
}

.catchphrase .muted {
  color: var(--color-text-muted);
}

/* Reset docs.css footer overrides for homepage sections */
.hero footer,
.pe-section footer {
  padding: 0;
  border-block-start: none;
  text-align: start;
  font-size: inherit;
}

/* Features Grid */
.features-section {
  padding-block: var(--size-2xl);
  background: var(--color-surface-raised);
  margin-inline: calc(-1 * var(--size-l));
  padding-inline: var(--size-l);
}

.features-section h2 {
  text-align: center;
  margin-block-end: var(--size-xl);
}

.features-section ul,
.quicknav-section ul {
  max-inline-size: var(--content-wide);
  margin-inline: auto;
  list-style: none;
  padding: 0;
}

.features-section layout-card {
  height: 100%;
}

.features-section layout-card p {
  color: var(--color-text-muted);
  margin: 0;
}

.features-section layout-card h3[data-layout] {
  flex-wrap: nowrap;
}

@container (max-width: 320px) {
  .features-section layout-card h3 {
    font-size: var(--font-size-lg, 1.125rem);
  }
}

/* Progressive Enhancement Demo */
.pe-section {
  padding-block: var(--size-2xl);
  border-block-start: var(--border-width-thin) solid var(--color-border);
}

.pe-section h2 {
  text-align: center;
  margin-block-end: var(--size-s);
}

.pe-lead {
  text-align: center;
  color: var(--color-text-muted);
  max-inline-size: 55ch;
  margin-inline: auto;
  margin-block-end: var(--size-xl);
}

.pe-section .pe-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--size-l);
  align-items: stretch;
}

.pe-panel code-block {
  margin: 0;
  max-block-size: 24rem;
  overflow: auto;
}

.pe-panel browser-window {
  margin: 0;
  resize: none;
  block-size: 100%;
}

.pe-caption {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin-block-start: var(--size-s);
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .pe-section .pe-panel {
    grid-template-columns: 1fr;
  }

  .pe-panel code-block {
    max-block-size: 16rem;
  }

  .pe-panel browser-window {
    block-size: auto;
    max-block-size: 20rem;
  }
}

.pe-meta {
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-block-start: var(--size-m);
}

.pe-unstyled,
.pe-unstyled *,
.pe-unstyled *::before,
.pe-unstyled *::after {
  all: revert !important;
}

.pe-unstyled {
  padding: var(--size-l) !important;
}

/*
 * Isolate PE demo content from active theme effects.
 * Unlayered CSS here beats all layered theme styles.
 */
.pe-panel output:not(.pe-unstyled) {
  /* Reset theme heading decorations (kawaii, brutalist bg/underline) */
  & :is(h1, h2, h3) {
    color: var(--color-text);
    background: none;
    padding: 0;
    width: auto;
    text-transform: none;
    text-decoration: none;
    border: none;
  }

  & :is(h1, h2, h3)::before,
  & :is(h1, h2, h3)::after {
    content: none;
  }

  /* Reset theme button overrides (kawaii gradient, brutalist shadows) */
  & button,
  & .button {
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-m);
    box-shadow: none;
    color: white;
    font-family: inherit;
    text-transform: none;
    transform: none;
  }

  & button.secondary,
  & .button.secondary {
    background: transparent;
    color: var(--color-text);
    border: var(--border-width-thin) solid var(--color-border);
  }

  & button.ghost,
  & .button.ghost {
    background: transparent;
    color: var(--color-text);
    border: none;
  }

  /* Reset details/form border decorations */
  & details {
    border-radius: var(--radius-m);
    border-image: none;
    box-shadow: none;
    filter: none;
    overflow: visible;
  }

  & details :is(form, fieldset, table) {
    border: none;
    box-shadow: none;
  }

  /* Reset section borders (kawaii adds border-radius to sections) */
  & section {
    border-radius: 0;
    border: none;
  }

  /* Reset link decorations */
  & a:not([class])::after {
    content: none;
  }
}

/* Force neutral component theming inside PE demos */
.pe-panel code-block {
  --cb-bg: initial;
  --cb-code-bg: initial;
  --cb-header-bg: initial;
  --cb-text-color: initial;
  --cb-border-color: initial;
  --cb-label-color: initial;
  --cb-comment: initial;
  --cb-keyword: initial;
  --cb-string: initial;
  --cb-function: initial;
  --cb-number: initial;
  --cb-tag: initial;
  --cb-attribute: initial;
  --cb-button-bg: initial;
  --cb-button-color: initial;
  --cb-button-border: initial;
  --cb-scrollbar-track: initial;
  --cb-scrollbar-thumb: initial;
}

.pe-panel browser-window {
  --browser-window-bg: initial;
  --browser-window-header-bg: initial;
  --browser-window-content-bg: initial;
  --browser-window-border-color: initial;
  --browser-window-text-color: initial;
  --browser-window-text-muted: initial;
  --browser-window-url-bg: initial;
}

/* Theme Showcase */
.theme-section {
  padding-block: var(--size-2xl);
  border-block-start: var(--border-width-thin) solid var(--color-border);
}

.theme-section h2 {
  text-align: center;
  margin-block-end: var(--size-s);
}

.theme-lead {
  text-align: center;
  color: var(--color-text-muted);
  max-inline-size: 50ch;
  margin-inline: auto;
  margin-block-end: var(--size-xl);
}

.theme-lab {
  max-inline-size: 56rem;
  margin-inline: auto;
}

.theme-lab figcaption {
  margin-block-end: var(--size-m);
}

.theme-lab iframe {
  border: var(--border-width-thin) solid var(--color-border);
  border-radius: var(--radius-m);
  inline-size: 100%;
  min-block-size: 300px;
  transition: height var(--duration-normal) var(--ease-default);
}

/* Demo result content styling */
.demo-result h1 {
  margin: 0;
}

.demo-result p {
  margin: 0;
  color: var(--color-text-muted);
}

/* Stats Bar — CSS grid pairs dt/dd without wrapper divs.
 * DOM order: dt1 dd1 dt2 dd2 … (spec-required).
 * Visual order: numbers (dd) on row 1, labels (dt) on row 2.
 * nth-of-type targets dt and dd independently to assign columns. */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, auto);
  grid-template-rows: auto auto;
  justify-content: center;
  gap: 0 var(--size-2xl);
  padding: var(--size-l);
  margin-block: var(--size-xl);
  text-align: center;
}

.stats-bar dt {
  grid-row: 2;
  align-self: start;
  margin-block-start: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.stats-bar dd {
  grid-row: 1;
  display: block;
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-interactive);
  line-height: 1;
  margin: 0;
}

.stats-bar dt:nth-of-type(1),
.stats-bar dd:nth-of-type(1) { grid-column: 1; }
.stats-bar dt:nth-of-type(2),
.stats-bar dd:nth-of-type(2) { grid-column: 2; }
.stats-bar dt:nth-of-type(3),
.stats-bar dd:nth-of-type(3) { grid-column: 3; }
.stats-bar dt:nth-of-type(4),
.stats-bar dd:nth-of-type(4) { grid-column: 4; }

@media (max-width: 600px) {
  .stats-bar {
    grid-template-columns: repeat(2, auto);
    grid-template-rows: repeat(4, auto);
    gap: var(--size-l) var(--size-2xl);
  }

  .stats-bar dt:nth-of-type(1),
  .stats-bar dd:nth-of-type(1) { grid-column: 1; }
  .stats-bar dt:nth-of-type(2),
  .stats-bar dd:nth-of-type(2) { grid-column: 2; }
  .stats-bar dt:nth-of-type(3),
  .stats-bar dd:nth-of-type(3) { grid-column: 1; }
  .stats-bar dt:nth-of-type(4),
  .stats-bar dd:nth-of-type(4) { grid-column: 2; }

  .stats-bar dd:nth-of-type(3) { grid-row: 3; }
  .stats-bar dt:nth-of-type(3) { grid-row: 4; }
  .stats-bar dd:nth-of-type(4) { grid-row: 3; }
  .stats-bar dt:nth-of-type(4) { grid-row: 4; }
}

/* Quick Navigation */
.quicknav-section {
  padding-block: var(--size-2xl);
  border-block-start: var(--border-width-thin) solid var(--color-border);
}

.quicknav-section h2 {
  text-align: center;
  margin-block-end: var(--size-xl);
}

.quicknav-section .section-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--size-xs);
}

.quicknav-section .section-card small {
  color: var(--color-text-muted);
}
