/**
 * Macro layout — grids, flows, and every @media breakpoint.
 * Mobile-first: rules with no media query below ARE the mobile layout.
 * Breakpoints mirror tokens.css comments: sm 640 / md 768 / lg 960.
 *
 * LOAD ORDER: this file MUST be linked AFTER components.css. Several
 * selectors here (e.g. .nav-toggle, .nav-list) have the same specificity
 * as their unconditional counterpart in components.css; the @media
 * overrides only win because they come later in source order.
 */

/* ---------- Header ---------- */
.site-header__inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
}

.site-nav { display: flex; align-items: center; }

/* Single <nav>/<ul> in the DOM — burger only toggles visibility of the one list */
.nav-list {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: var(--z-dropdown);
}
.nav-list.is-open { display: flex; }

.lang-switch { order: 2; }

@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .site-nav { order: 1; }
  .nav-list {
    display: flex !important;
    flex-direction: row;
    position: static;
    gap: var(--space-6);
    background: none;
    border: 0;
    padding: 0;
  }
  .nav-list a { padding: 0; }
  .lang-switch { order: 2; }
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-8);
  align-items: center;
}
.hero__cta {
  margin-top: var(--space-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.hero__banner-wrap {
  display: flex;
  justify-content: center;
}
@media (max-width: 639px) {
  .hero__banner { max-width: none; }
}
@media (min-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hero__banner-wrap { justify-content: flex-end; }
}

/* ---------- Stats ---------- */
/* minmax(0, 1fr), not plain 1fr: grid tracks default to min-width:auto,
   which floors at the longest unbreakable word (e.g. an uppercase label) —
   same class of bug as flex-child overflow, see css-layout skill. */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}
@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

/* ---------- State cards ---------- */
.state-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}
@media (min-width: 640px) {
  .state-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .state-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Comparison table ---------- */
/* Card mode is the mobile-first default; table mode kicks in from sm up */
@media (min-width: 640px) {
  .compare-table--cards thead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }
  .compare-table--cards tr {
    display: table-row;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
  }
  .compare-table--cards tbody tr:hover { background: var(--surface); }
  .compare-table--cards td {
    display: table-cell;
    border-bottom: 1px solid var(--border);
    padding: var(--space-3) var(--space-4);
    text-align: left;
  }
  .compare-table--cards tbody tr:last-child td { border-bottom: 0; }
  .compare-table--cards td::before { content: none; }
}

/* ---------- Calculator ---------- */
@media (min-width: 640px) {
  .calculator { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .calculator__result { grid-column: 1 / -1; }
}

/* ---------- FAQ ---------- */
.faq-list { max-width: 80ch; }

/* ---------- CTA ---------- */
.cta-block__actions {
  margin-top: var(--space-6);
  display: flex;
  justify-content: center;
}

/* ---------- Footer ---------- */
.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
  text-align: center;
}
@media (min-width: 640px) {
  .site-footer__inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}
