/*
  Global responsive baseline — load after site-nav.css (index) or after calculator-base.css (calculator pages).
  Fixes horizontal overflow, centers content, and tightens touch layouts on small screens.
*/

:root {
  --content-max: 1400px;
  --content-mid: 900px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  width: 100%;
  max-width: 100%;
}

body {
  overflow-x: clip;
}

img,
video,
canvas {
  max-width: 100%;
  height: auto;
}

svg {
  flex-shrink: 0;
}

/* Shared layout container used across index + calculator templates */
.container {
  width: 100%;
  max-width: min(var(--content-max, 1180px), 100%);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(16px, 3vw, 48px);
  padding-right: clamp(16px, 3vw, 48px);
  box-sizing: border-box;
}

/* Header row: prevent logo + actions from forcing page wider than viewport */
header nav.site-nav,
header nav.container.site-nav {
  max-width: 100%;
  min-width: 0;
}

.logo {
  min-width: 0;
}

.logo-text {
  min-width: 0;
}

@media (max-width: 520px) {
  .logo-text .brand-domain {
    display: none;
  }

  .nav-cta:not(.nav-cta--drawer) {
    padding: 8px 12px !important;
    font-size: 0.78rem !important;
  }
}

@media (max-width: 380px) {
  .logo-text span:first-child {
    font-size: 0.88rem;
  }
}

/* ─── Homepage (index.html) — hero ─── */
#hero {
  padding: 80px 0 64px;
}

h1.hero-title {
  font-size: 52px;
  line-height: 1.12;
}

@media (min-width: 1920px) {
  #hero {
    padding: 120px 0 80px;
  }

  h1.hero-title {
    font-size: 72px;
  }
}

@media (min-width: 1536px) and (max-width: 1919px) {
  #hero {
    padding: 100px 0 72px;
  }

  h1.hero-title {
    font-size: 60px;
  }
}

@media (min-width: 1280px) and (max-width: 1535px) {
  #hero {
    padding: 100px 0 64px;
  }

  h1.hero-title {
    font-size: 60px;
  }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  #hero {
    padding: 80px 0 56px;
  }

  h1.hero-title {
    font-size: 52px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  #hero {
    padding: 60px 0 48px;
    text-align: center;
  }

  #hero .hero-inner {
    margin-left: auto;
    margin-right: auto;
  }

  h1.hero-title {
    font-size: 42px;
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  #hero {
    padding: 40px 0 40px;
  }

  h1.hero-title {
    font-size: 32px;
  }
}

@media (max-width: 479px) {
  #hero {
    padding: 32px 0 32px;
  }

  h1.hero-title {
    font-size: 26px;
  }

  #hero .blob,
  .hero-blob,
  .decorative-dots {
    display: none !important;
  }
}

#hero .hero-inner {
  width: 100%;
  max-width: min(740px, 100%);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Homepage search bar */
#search-section .search-wrap,
.search-wrap {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 768px) and (max-width: 1023px) {
  #search-section .search-wrap,
  .search-wrap {
    max-width: 90%;
  }
}

@media (max-width: 767px) {
  #search-section .search-wrap,
  .search-wrap {
    width: calc(100% - 32px);
    max-width: none;
    margin-left: 16px;
    margin-right: 16px;
  }
}

/* Mega tabs (header): horizontal scroll on smaller lg breakpoints */
@media (min-width: 1024px) and (max-width: 1279px) {
  .nav-center {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
  }

  .nav-center::-webkit-scrollbar {
    display: none;
  }

  .mega-tabs {
    flex-wrap: nowrap;
    width: max-content;
    max-width: none;
  }

  .mega-tab {
    flex: 0 0 auto;
  }

  .mega-trigger {
    min-width: 100px;
    font-size: 13px;
  }
}

/* Homepage calculator grid — flex + centered rows (details on index.html) */
.all-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
}

/* Calculator cards (homepage) */
@media (min-width: 1024px) {
  #all-calcs .calc-card {
    padding: 24px;
    min-height: 80px;
  }

  #all-calcs .calc-card-icon {
    width: 48px;
    height: 48px;
    font-size: 1.35rem;
  }

  #all-calcs .calc-card h3 {
    font-size: 16px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  #all-calcs .calc-card {
    padding: 20px;
    min-height: 80px;
  }

  #all-calcs .calc-card-icon {
    width: 40px;
    height: 40px;
  }

  #all-calcs .calc-card h3 {
    font-size: 15px;
  }
}

@media (max-width: 767px) {
  #all-calcs .calc-card {
    padding: 16px;
    min-height: 80px;
  }

  #all-calcs .calc-card-icon {
    width: 36px;
    height: 36px;
  }

  #all-calcs .calc-card h3 {
    font-size: 14px;
  }
}

@media (max-width: 900px) {
  #featured .featured-left {
    padding: 36px 24px !important;
  }

  #featured .featured-right {
    padding: 32px 20px !important;
  }
}

@media (max-width: 768px) {
  .hero-sub {
    font-size: 1rem !important;
    padding-inline: 4px;
  }

  .trust-bar {
    flex-direction: column;
    gap: 12px;
    padding-top: 28px;
    margin-top: 36px;
  }

  .stats-strip {
    border-radius: 18px;
  }

  .stat-block {
    padding: 20px 14px !important;
  }

  .stat-num {
    font-size: 1.85rem !important;
  }

  .section-header {
    margin-bottom: 36px !important;
  }

  #featured .featured-left {
    padding: 28px 20px !important;
  }

  .search-big {
    flex-wrap: wrap;
    padding: 10px 12px !important;
    border-radius: 18px !important;
    gap: 10px !important;
  }

  .search-big input {
    min-width: 0;
    width: 100%;
    flex: 1 1 100%;
  }

  .search-go {
    width: 100%;
    margin-top: 4px;
  }
}

@media (max-width: 480px) {
  .stats-strip {
    grid-template-columns: 1fr !important;
  }

  .hero-cta-row {
    flex-direction: column;
    align-items: center;
  }

  .trust-bar {
    gap: 16px;
  }
}

/* Footer — index uses site-footer but does not load site-chrome.css; mirror key breakpoints */
footer.site-footer .foot-top {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(4, minmax(0, 1fr));
  gap: 48px;
  margin-bottom: 48px;
}

@media (min-width: 768px) and (max-width: 1023px) {
  footer.site-footer .foot-top {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  footer.site-footer .foot-brand {
    grid-column: 1;
    grid-row: 1 / span 4;
  }

  footer.site-footer .foot-col:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }

  footer.site-footer .foot-col:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
  }

  footer.site-footer .foot-col:nth-child(4) {
    grid-column: 2;
    grid-row: 3;
  }

  footer.site-footer .foot-col:nth-child(5) {
    grid-column: 2;
    grid-row: 4;
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  footer.site-footer .foot-top {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }

  footer.site-footer .foot-brand {
    grid-column: 1 / -1;
  }

  footer.site-footer .foot-col:nth-child(2) {
    grid-column: 1;
  }

  footer.site-footer .foot-col:nth-child(3) {
    grid-column: 2;
  }

  footer.site-footer .foot-col:nth-child(4) {
    grid-column: 1;
  }

  footer.site-footer .foot-col:nth-child(5) {
    grid-column: 2;
  }

  footer.site-footer .foot-bottom {
    justify-content: center;
    text-align: center;
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 479px) {
  footer.site-footer {
    padding: 24px 16px 28px;
  }

  footer.site-footer .foot-top {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }

  footer.site-footer .foot-brand,
  footer.site-footer .foot-col {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
  }

  footer.site-footer .foot-col ul li a {
    font-size: 14px;
  }

  footer.site-footer .foot-bottom {
    justify-content: center;
    text-align: center;
    flex-direction: column;
    align-items: center;
  }
}

/* Calculator templates (inner pages) */
@media (max-width: 640px) {
  .page-hero {
    padding-top: 36px;
    padding-bottom: 28px;
  }
}

@media (min-width: 1536px) {
  .container {
    max-width: min(1400px, 100%);
  }
}

@media (min-width: 1920px) {
  .container {
    max-width: min(1600px, 100%);
  }
}

@media (min-width: 2560px) {
  .container {
    max-width: min(1800px, 100%);
  }

  body {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
