/*
 * GovtSave mobile responsiveness layer.
 * Loaded after page-specific styles so the shared rules can correct narrow layouts
 * without changing desktop layouts or replacing country-specific design systems.
 */

html {
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

body {
  overflow-wrap: break-word;
}

img, svg, video, canvas, iframe {
  max-width: 100%;
}

p, li, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

pre, pre code, .code-block {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  max-width: 100%;
}

[class*="table-wrap"],
[class*="table-wrapper"],
[class*="table-scroll"],
.comparison-wrap,
.comparison-table-wrap,
.market-table-wrap,
.history-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}



button, input[type="button"], input[type="submit"], input[type="reset"] {
  touch-action: manipulation;
}

@media (max-width: 1024px) {
  .guide-grid, .footer-grid, .calculator-grid, .rate-grid,
  .result-grid, .planner-grid, .comparison-grid {
    min-width: 0;
  }

  .container {
    width: min(100% - 28px, 1160px);
  }
}

@media (max-width: 760px) {
  *, *::before, *::after {
    box-sizing: border-box;
  }

  html {
    scroll-padding-top: 78px;
  }

  body {
    min-width: 320px;
    overflow-x: clip;
    font-size: 15px;
    line-height: 1.6;
  }

  main, header, footer, section, article, aside, nav, form, fieldset {
    min-width: 0;
  }

  button, input, select, textarea {
    max-width: 100%;
    min-width: 0;
  }

  input, select, textarea {
    font-size: 16px;
  }

  a {
    overflow-wrap: anywhere;
  }

  .container {
    width: min(100% - 28px, 1160px);
  }

  .nav {
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    gap: 9px;
    padding-block: 10px;
  }

  .nav .brand {
    min-width: 0;
    margin-right: auto;
    gap: 8px;
    font-size: 1.16rem;
  }

  .nav .brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
  }

  .site-search {
    order: 10;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    margin: 0;
  }

  .site-search input {
    width: 100%;
    min-width: 0;
  }

  .mobile-links {
    width: 100%;
  }

  .mobile-links a {
    min-height: 42px;
    display: flex;
    align-items: center;
  }

  .hero {
    padding-block: 42px;
  }

  .hero-grid, .calculator-grid, .guide-grid, .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-grid {
    gap: 24px;
  }

  .hero h1, .page-hero h1 {
    font-size: clamp(1.9rem, 7.7vw, 3rem);
    line-height: 1.12;
    overflow-wrap: anywhere;
  }

  .hero p, .page-hero p {
    font-size: 1rem;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

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

  .section {
    padding-block: 44px;
  }

  .section-heading {
    margin-bottom: 26px;
  }

  .section-heading h2 {
    font-size: clamp(1.55rem, 6.2vw, 2.2rem);
  }

  .calculator-card {
    padding: 18px;
  }

  .calc-head {
    flex-wrap: wrap;
  }

  .calculator-grid > .calculator-card:last-child:nth-child(odd) {
    grid-column: auto;
    justify-self: stretch;
    width: 100%;
  }

  .rate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-card {
    min-width: 0;
  }

  .comparison-wrap, .comparison-table-wrap {
    max-width: 100%;
    overflow-x: auto;
  }

  .comparison-table {
    min-width: 580px;
  }

  .chart-wrap, .chart-wrapper, .chart-wrapper canvas {
    max-width: 100%;
  }

  .global-market-rail-list {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .global-market-rail-list > * {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .mobile-quick-nav {
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    padding: 6px;
  }

  .mobile-quick-nav a {
    min-width: 0;
    min-height: 48px;
    padding: 5px 1px;
    font-size: 9px;
    line-height: 1.15;
    overflow-wrap: normal;
    text-align: center;
  }

  .mobile-quick-nav a i {
    font-size: 15px;
  }

  body {
    padding-bottom: 0;
  }

  body:has(.mobile-quick-nav) {
    padding-bottom: max(82px, calc(78px + env(safe-area-inset-bottom)));
  }

  /* The international dashboards have their own visual styles; these shared
     constraints keep their headers, section menus and card grids from overflowing. */
  body[class*="market-page"] :is(.mp-shell, .nz-shell, .ie-shell, .sg-shell, .ca-shell, .au-shell, .de-shell, .ph-wrap),
  body[class*="market-page"] :is(.mp-header-inner, .nz-header-inner, .ie-header-inner, .sg-header-inner, .ca-header-inner, .au-header-inner, .de-header-inner, .ph-header-inner) {
    width: calc(100% - 28px);
    max-width: 100%;
    min-width: 0;
  }

  body[class*="market-page"] :is(.mp-section-nav, .nz-section-nav, .ie-section-nav, .sg-section-nav, .ca-section-nav, .au-section-nav, .de-section-nav, .ph-section-nav) {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  body[class*="market-page"] :is(.mp-section-nav-inner, .nz-section-nav-inner, .ie-section-nav-inner, .sg-section-nav-inner, .ca-section-nav-inner, .au-section-nav-inner, .de-section-nav-inner, .ph-section-nav-inner) {
    min-width: 0;
    max-width: 100%;
    gap: 8px;
  }

  body[class*="market-page"] :is(.mp-section-nav-inner, .nz-section-nav-inner, .ie-section-nav-inner, .sg-section-nav-inner, .ca-section-nav-inner, .au-section-nav-inner, .de-section-nav-inner, .ph-section-nav-inner) a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  body[class*="market-page"] :is(.mp-hero-grid, .nz-hero-grid, .ie-hero-grid, .sg-hero-grid, .ca-hero-grid, .au-hero-grid, .de-hero-grid, .ph-hero-grid) {
    grid-template-columns: minmax(0, 1fr);
  }

  body[class*="market-page"] :is(.mp-hero-actions, .nz-hero-actions, .ie-hero-actions, .sg-hero-actions, .ca-hero-actions, .au-hero-actions, .de-hero-actions, .ph-hero-actions) {
    flex-wrap: wrap;
  }

  body[class*="market-page"] :is(.mp-hero-actions, .nz-hero-actions, .ie-hero-actions, .sg-hero-actions, .ca-hero-actions, .au-hero-actions, .de-hero-actions, .ph-hero-actions) > * {
    min-width: 0;
    max-width: 100%;
  }

  body[class*="market-page"] :is(.mp-card, .uk-card, .ca-card, .de-card, .au-card, .nz-card, .ie-card, .sg-card, .ph-card) {
    min-width: 0;
    max-width: 100%;
  }

  body[class*="market-page"] canvas {
    max-width: 100%;
  }

  /* Account forms and admin-style cards must shrink to the viewport. */
  body > .card {
    width: calc(100% - 28px) !important;
    max-width: 480px;
    margin: 14px auto !important;
    padding: 22px 18px !important;
  }

  .auth-shell, .auth-card {
    width: min(100% - 24px, 480px);
    max-width: 100%;
  }

  .auth-card {
    padding: 24px 18px;
  }

  .auth-card input, .auth-card select, .auth-card textarea,
  .auth-card button, .auth-card .btn {
    width: 100%;
  }

  /* Dashboard tables remain readable through intentional inner scrolling. */
  .table-responsive, .responsive-table, .dashboard-table-wrap,
  .saved-calculations-table-wrap, .results-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 560px) {
  .container {
    width: calc(100% - 22px);
  }

  .section {
    padding-block: 36px;
  }

  .section-heading {
    text-align: left;
    margin-bottom: 22px;
  }

  .hero {
    padding-block: 34px;
  }

  .hero-panel, .calculator-card {
    padding: 16px;
    border-radius: 16px;
  }

  .rate-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .rate-card {
    padding: 17px;
  }

  .field-help {
    flex-wrap: wrap;
  }

  .result-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .chart-wrap {
    padding: 10px;
  }

  .mobile-quick-nav {
    left: 6px;
    right: 6px;
    padding: 5px 4px;
    gap: 1px;
  }

  .mobile-quick-nav a {
    font-size: 8.5px;
  }

  body[class*="market-page"] :is(.mp-shell, .nz-shell, .ie-shell, .sg-shell, .ca-shell, .au-shell, .de-shell, .ph-wrap),
  body[class*="market-page"] :is(.mp-header-inner, .nz-header-inner, .ie-header-inner, .sg-header-inner, .ca-header-inner, .au-header-inner, .de-header-inner, .ph-header-inner) {
    width: calc(100% - 22px);
  }

  body[class*="market-page"] :is(.mp-card, .uk-card, .ca-card, .de-card, .au-card, .nz-card, .ie-card, .sg-card, .ph-card) {
    padding-inline: 15px;
  }

  body > .card {
    width: calc(100% - 22px) !important;
    padding: 20px 15px !important;
  }
}

@media (max-width: 380px) {
  .container {
    width: calc(100% - 20px);
  }

  .mobile-quick-nav a {
    gap: 3px;
    font-size: 8px;
  }

  .mobile-quick-nav a i {
    font-size: 14px;
  }

  body[class*="market-page"] :is(.mp-shell, .nz-shell, .ie-shell, .sg-shell, .ca-shell, .au-shell, .de-shell, .ph-wrap),
  body[class*="market-page"] :is(.mp-header-inner, .nz-header-inner, .ie-header-inner, .sg-header-inner, .ca-header-inner, .au-header-inner, .de-header-inner, .ph-header-inner) {
    width: calc(100% - 20px);
  }

  .hero h1, .page-hero h1 {
    font-size: 1.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* =========================================================
   GOVTSAVE HEADER RESTRUCTURE
   Desktop: a dedicated brand/search row and a single-line navigation row.
   Tablet/mobile: search stays accessible and links move into the existing menu.
========================================================= */

.home-site-header {
  z-index: 100;
  background: #ffffff;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.035);
}

.home-site-header .nav {
  height: auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 18px;
  padding: 12px 0;
}

.home-site-header .brand {
  flex: 0 0 auto;
  min-width: max-content;
  margin-right: auto;
  gap: 10px;
  white-space: nowrap;
  font-size: 1.28rem;
  letter-spacing: -0.035em;
}

.home-site-header .brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.home-site-header .site-search {
  flex: 0 1 360px;
  width: clamp(240px, 30vw, 360px);
  min-width: 220px;
  margin: 0 2px;
}

.home-site-header .site-search input {
  height: 42px;
  border-radius: 12px;
  font-size: 13px;
}

.home-site-header .theme-toggle {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.home-site-header .menu-btn {
  display: none;
}

.home-site-header .nav-secondary {
  display: block;
  border-top: 1px solid #eef2f7;
}

.home-site-header .nav-secondary .nav-links {
  width: 100%;
  min-height: 46px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 1vw, 14px);
}

.home-site-header .nav-secondary .nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 0;
  white-space: nowrap;
  overflow-wrap: normal;
  font-size: 0.82rem;
  line-height: 1.25;
  font-weight: 750;
  color: #334155;
  text-decoration: none;
  transition: color 160ms ease;
}

.home-site-header .nav-secondary .nav-links a:hover,
.home-site-header .nav-secondary .nav-links a:focus-visible {
  color: #047857;
}

.home-site-header .nav-secondary .nav-links a:focus-visible {
  outline-offset: 3px;
  border-radius: 4px;
}

.home-site-header .mobile-links {
  display: none;
}

html.dark-mode .home-site-header {
  background: #0f172a;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
}

html.dark-mode .home-site-header .nav-secondary {
  border-top-color: #27364c;
}

html.dark-mode .home-site-header .nav-secondary .nav-links a {
  color: #dbe5f2;
}

html.dark-mode .home-site-header .nav-secondary .nav-links a:hover,
html.dark-mode .home-site-header .nav-secondary .nav-links a:focus-visible {
  color: #6ee7b7;
}

html.dark-mode .home-site-header .mobile-links {
  background: #0f172a;
  border-color: #27364c;
}

html.dark-mode .home-site-header .mobile-links a {
  color: #e2e8f0;
}

/* The full navigation moves into the existing accessible menu before links get squeezed. */
@media (max-width: 1100px) {
  .home-site-header .nav-secondary {
    display: none;
  }

  .home-site-header .nav {
    gap: 14px;
  }

  .home-site-header .site-search {
    flex: 0 1 340px;
    width: min(340px, 36vw);
    min-width: 190px;
  }

  .home-site-header .menu-btn {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    font-size: 1rem;
  }

  .home-site-header .mobile-links.open {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px 18px;
    padding: 12px 0 16px;
    border-top: 1px solid #e2e8f0;
  }

  .home-site-header .mobile-links a {
    min-width: 0;
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 9px 10px;
    border-radius: 9px;
    font-size: 0.9rem;
    font-weight: 700;
    overflow-wrap: normal;
  }

  .home-site-header .mobile-links a:hover {
    background: #ecfdf5;
    color: #047857;
  }

  html.dark-mode .home-site-header .menu-btn {
    background: #1e293b;
    border-color: #475569;
    color: #f8fafc;
  }

  html.dark-mode .home-site-header .mobile-links.open {
    border-top-color: #27364c;
  }

  html.dark-mode .home-site-header .mobile-links a:hover {
    background: #123426;
    color: #a7f3d0;
  }
}

@media (max-width: 760px) {
  .home-site-header .nav {
    min-height: 62px;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
  }

  .home-site-header .brand {
    min-width: 0;
    margin-right: auto;
    gap: 8px;
    font-size: 1.16rem;
  }

  .home-site-header .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .home-site-header .theme-toggle,
  .home-site-header .menu-btn {
    order: 2;
    flex-basis: 40px;
    width: 40px;
    height: 40px;
  }

  .home-site-header .site-search {
    order: 10;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    margin: 0;
  }

  .home-site-header .site-search input {
    width: 100%;
    min-width: 0;
  }

  .home-site-header .mobile-links.open {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px 8px;
  }

  .home-site-header .mobile-links a {
    padding-inline: 8px;
    font-size: 0.86rem;
  }
}

@media (max-width: 380px) {
  .home-site-header .brand {
    font-size: 1.04rem;
  }

  .home-site-header .nav {
    gap: 7px;
  }

  .home-site-header .site-search input {
    font-size: 16px;
  }
}

