/*
  Site-level polish pass.
  Keeps the current ChatEB1 design system, but hardens the shared UI primitives
  against cramped navs, broken form labels, and low-grade card spacing.
*/

body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

.wrap {
  min-width: 0;
}

.nav {
  background: rgba(251, 252, 255, 0.93) !important;
  box-shadow: 0 1px 0 rgba(20, 25, 37, 0.04);
}

.navin {
  min-width: 0;
}

.brand {
  min-width: 0;
  flex: 0 1 auto;
}

.brand > div:last-child {
  min-width: 0;
}

.brand-sub {
  max-width: 230px;
  line-height: 1.25;
}

.navlinks {
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 8px;
}

.navlinks > a:not(.btn) {
  white-space: nowrap;
  line-height: 1.2;
}

.btn {
  max-width: 100%;
  text-align: center;
  line-height: 1.15;
  white-space: normal;
}

.navlinks .btn {
  white-space: nowrap;
}

.hero,
.section {
  overflow-x: clip;
}

.hero-grid,
.hero-split,
.tool-grid,
.cards,
.decision-grid,
.resource-grid,
.fit-grid,
.proof-grid,
.trust-grid,
.search-router-grid,
.choice-grid,
.spotlight-grid,
.link-columns,
.article-grid {
  min-width: 0;
}

.hero-card,
.panel,
.card,
.search-router-card,
.decision-card,
.resource-card,
.quote-card,
.fit-panel,
.hero-panel,
.spotlight-card {
  border-color: rgba(20, 25, 37, 0.10) !important;
  box-shadow: 0 14px 34px rgba(20, 25, 37, 0.055) !important;
}

.hero-card,
.panel,
.card,
.search-router-card,
.decision-card,
.resource-card,
.quote-card,
.fit-panel,
.hero-panel,
.spotlight-card,
.mini-list li,
.result-list li {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 253, 0.82));
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li,
blockquote,
.sub,
.lede,
.support-text,
.fine,
.result-copy {
  text-wrap: pretty;
}

.hero-actions {
  align-items: center;
}

.option {
  grid-template-columns: 22px minmax(0, 1fr) !important;
  align-items: start;
}

.option input {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin-top: 3px;
}

.option span,
.option small {
  grid-column: 2;
  min-width: 0;
}

.option span {
  line-height: 1.3 !important;
}

.option small {
  max-width: 62ch;
}

table {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.table-wrap,
.table-scroll {
  max-width: 100%;
  min-width: 0;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1180px) {
  .navlinks {
    gap: 10px !important;
    font-size: 13px !important;
  }

  .navlinks .hide-md {
    display: none !important;
  }

  .navlinks .hide-md:nth-of-type(3),
  .navlinks .hide-md:nth-of-type(5),
  .navlinks .hide-md:nth-of-type(6),
  .navlinks .hide-md:nth-of-type(10) {
    display: inline-flex !important;
  }

  .navlinks .btn {
    min-height: 42px !important;
    padding-inline: 14px !important;
  }
}

@media (max-width: 920px) {
  .navin {
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .navlinks {
    justify-content: flex-start;
  }

  .navlinks .hide-md {
    display: none !important;
  }

  .navlinks .btn {
    white-space: normal;
  }

  .hero {
    padding-top: 38px !important;
  }
}

@media (max-width: 680px) {
  .wrap {
    width: min(var(--wrap, 1120px), calc(100% - 32px)) !important;
  }

  .navin {
    padding-block: 12px !important;
  }

  .brand-mark {
    width: 38px !important;
    height: 38px !important;
  }

  .brand-sub {
    max-width: 190px;
    font-size: 11px !important;
  }

  .navlinks {
    width: 100%;
  }

  .navlinks > a:not(.btn) {
    font-size: 12px;
  }

  .hero-actions {
    width: 100%;
    align-items: stretch;
  }

  .hero-actions .btn,
  .next-actions .btn {
    width: 100%;
  }

  .toc {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .hero-card,
  .panel,
  .card,
  .search-router-card,
  .decision-card,
  .resource-card,
  .quote-card,
  .fit-panel,
  .hero-panel,
  .spotlight-card {
    padding: 18px !important;
  }
}
