/**
 * Government-trust UI layer — high-contrast, structured, banking-grade.
 * Loaded after main.css; preserves all functionality, overrides presentation only.
 */

:root {
  --gov-primary: #0B3D91;
  --gov-secondary: #1F4E79;
  --gov-bg: #FFFFFF;
  --gov-section: #F5F7FA;
  --gov-border: #D9E2EC;
  --font-sans: 'Inter', 'Roboto', system-ui, -apple-system, sans-serif;
  --font-display: 'Inter', 'Roboto', system-ui, sans-serif;
  --navy-950: var(--gov-bg);
  --navy-900: var(--gov-bg);
  --navy-800: var(--gov-section);
  --navy-700: #E8EDF3;
  --blue-600: var(--gov-primary);
  --blue-500: var(--gov-secondary);
  --blue-400: var(--gov-secondary);
  --electric: var(--gov-primary);
  --accent-glow: rgba(11, 61, 145, 0.12);
  --text-primary: #1B2838;
  --text-secondary: #3E4C59;
  --text-muted: #334E68;
  --border: var(--gov-border);
  --glass: var(--gov-bg);
  --glass-border: var(--gov-border);
  --shadow-lg: 0 2px 8px rgba(11, 61, 145, 0.08);
  --shadow-glow: none;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 10px;
}

/* Reduce decorative noise */
.noise-overlay { opacity: 0; }
.blob { display: none !important; }
.calc-card__glow,
.footer-glow,
.author-card__glow { display: none !important; }

body {
  background: var(--gov-bg);
  font-family: var(--font-sans);
}

a { color: var(--gov-primary); }
a:hover { color: var(--gov-secondary); }
a.btn-primary,
a.btn-primary:hover,
a.btn-primary:focus-visible,
a.btn-primary:active {
  color: #fff;
}
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gov-primary);
  outline-offset: 2px;
}

/* Header — official strip */
.site-header {
  background: var(--gov-bg);
  backdrop-filter: none;
  border-bottom: 2px solid var(--gov-primary);
  box-shadow: 0 1px 0 var(--gov-border);
}
.site-header.is-scrolled {
  box-shadow: 0 2px 8px rgba(11, 61, 145, 0.1);
}
.header-inner {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem 1rem;
  height: var(--header-h);
}
.logo {
  flex-shrink: 0;
  min-width: 0;
  max-width: min(15rem, 46vw);
}
.logo__img {
  height: 67px;
  max-width: 100%;
}
.logo-text {
  font-size: 0.85rem;
  line-height: 1.25;
  font-weight: 700;
}
.nav-desktop {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0 0.65rem;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  padding: 0 0.25rem;
}
.nav-desktop::-webkit-scrollbar {
  display: none;
}
.nav-desktop a {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.4rem 0.35rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-desktop a:hover {
  color: var(--gov-primary);
  border-bottom-color: var(--gov-primary);
}
.header-actions {
  flex-shrink: 0;
  gap: 0.5rem;
}
.nav-cta {
  white-space: nowrap;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
  background: var(--gov-primary);
  border-color: var(--gov-primary);
  color: #fff;
}
.nav-cta:hover,
.nav-cta:focus-visible {
  background: #082e6f;
  border-color: #082e6f;
  color: #fff;
  box-shadow: 0 2px 8px rgba(11, 61, 145, 0.28);
}
.search-toggle,
.nav-toggle {
  background: var(--gov-section);
  border: 1px solid var(--gov-border);
  min-width: 44px;
  min-height: 44px;
}
.search-toggle:hover {
  border-color: var(--gov-primary);
  box-shadow: none;
}
.mobile-nav {
  background: var(--gov-bg);
  border-bottom: 2px solid var(--gov-border);
  max-height: calc(100dvh - var(--header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.mobile-nav a {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--gov-border);
  min-height: 44px;
  display: flex;
  align-items: center;
}
.scroll-progress {
  background: var(--gov-primary);
  height: 2px;
}

/* Cards — bordered, not glass */
.glass-card {
  background: var(--gov-bg);
  backdrop-filter: none;
  border: 1px solid var(--gov-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

/* Buttons */
.btn-primary {
  background: var(--gov-primary);
  color: #fff;
  box-shadow: none;
  border: 1px solid var(--gov-primary);
  min-height: 44px;
}
.btn-primary:hover,
.btn-primary:focus-visible,
.btn-primary:active {
  color: #fff;
  background: var(--gov-secondary);
  border-color: var(--gov-secondary);
  transform: none;
  box-shadow: 0 2px 6px rgba(11, 61, 145, 0.2);
}

/* Prevent hover flicker on calculator primary action */
.tax-calculator-page .btn-calc-submit {
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease !important;
  transform: none !important;
  will-change: auto;
}
.tax-calculator-page .btn-calc-submit:hover,
.tax-calculator-page .btn-calc-submit:focus-visible,
.tax-calculator-page .btn-calc-submit:active {
  transform: none !important;
  background: #082e6f !important;
  border-color: #082e6f !important;
  box-shadow: 0 2px 6px rgba(11, 61, 145, 0.24) !important;
}
.btn-secondary,
.btn-ghost {
  border: 1px solid var(--gov-border);
  min-height: 44px;
}
.btn-secondary:hover,
.btn-ghost:hover {
  border-color: var(--gov-primary);
  color: var(--gov-primary);
}

/* Readability pass */
.section-header p,
.hero__lead,
.calc-card__subtitle,
.field-hint,
.calc-empty,
.prose p,
.prose li,
.faq-answer p {
  color: var(--text-secondary);
}

.section-header p,
.hero__lead,
.prose p,
.prose li {
  font-size: 1rem;
  line-height: 1.7;
}

.form-group label,
.result-label,
.field-hint {
  font-size: 0.9rem;
}

.page-home .home-coverage__link span,
.state-card__rate,
.blog-card p,
.footer-copyright,
.footer-note p {
  color: var(--text-muted);
}

/* Hero — balanced two-column + full-width trust & coverage */
.home-hero,
.hero.home-hero {
  min-height: auto;
  padding: calc(var(--header-h) + 2rem) 0 2.5rem;
  background: var(--gov-section);
  border-bottom: 1px solid var(--gov-border);
}
.hero__bg { display: none !important; }
.hero__shell {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 420px);
  gap: 2rem 2.5rem;
  align-items: start;
}
.hero__grid > *,
.hero__content,
.hero__calc {
  min-width: 0;
  max-width: 100%;
}
.hero__content {
  padding-top: 0.25rem;
}
.hero__calc {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}
.hero h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.65rem);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.gradient-text {
  background: none;
  -webkit-text-fill-color: var(--gov-primary);
  color: var(--gov-primary);
}
.hero__badge {
  background: rgba(11, 61, 145, 0.08);
  border: 1px solid var(--gov-border);
  color: var(--gov-primary);
  font-weight: 600;
  margin-bottom: 1rem;
}
.hero__lead {
  font-size: 1.05rem;
  max-width: 34rem;
  margin-bottom: 1.5rem;
}
.hero__cta {
  margin-bottom: 2rem;
}
.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--gov-border);
}
.hero__stats .stat {
  min-width: 0;
}
.stat__value {
  color: var(--gov-primary);
  font-size: 1.5rem;
}
.stat__label {
  font-size: 0.72rem;
  line-height: 1.35;
}

/* Trust bar — full width below hero grid */
.hero-trust {
  width: 100%;
}
.calc-trust-panel--hero-bar {
  margin-top: 0;
  padding: 1.25rem 1.5rem;
  background: var(--gov-bg);
  border: 1px solid var(--gov-border);
  border-radius: var(--radius);
}
.calc-trust-panel--hero-bar .calc-trust-panel__badges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.calc-trust-panel--hero-bar .trust-badge {
  justify-content: center;
  text-align: center;
  font-size: 0.68rem;
  padding: 0.5rem 0.4rem;
  line-height: 1.3;
}
.calc-trust-panel--hero-bar .calc-trust-panel__grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}
.calc-trust-panel--hero-bar .calc-trust-panel__item {
  padding: 0.75rem 0;
  border-right: 1px solid var(--gov-border);
}
.calc-trust-panel--hero-bar .calc-trust-panel__item:last-child {
  border-right: none;
}
.calc-trust-panel--hero-bar .calc-trust-panel__meta {
  margin-top: 1rem;
  text-align: center;
}

/* Coverage cards inside hero */
.hero-coverage {
  width: 100%;
}
.hero-coverage__heading {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gov-primary);
  margin-bottom: 0.75rem;
}
.home-hero .home-coverage__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.home-hero .home-coverage__link {
  padding: 1rem 1.1rem;
  min-height: 4.5rem;
  background: var(--gov-bg);
}
.home-hero .home-coverage__link strong {
  font-size: 0.92rem;
  display: block;
  margin-bottom: 0.25rem;
}
.home-hero .home-coverage__link span {
  font-size: 0.8rem;
  line-height: 1.45;
}

@media (max-width: 1024px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .hero__calc {
    position: static;
    max-width: 520px;
  }
  .calc-trust-panel--hero-bar .calc-trust-panel__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .calc-trust-panel--hero-bar .calc-trust-panel__item {
    border-right: none;
    border-bottom: 1px solid var(--gov-border);
    padding-bottom: 1rem;
  }
  .calc-trust-panel--hero-bar .calc-trust-panel__item:nth-child(2n) {
    border-bottom: none;
  }
  .home-hero .home-coverage__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .hero__stats {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .calc-trust-panel--hero-bar .calc-trust-panel__badges {
    grid-template-columns: 1fr;
  }
  .calc-trust-panel--hero-bar .calc-trust-panel__grid {
    grid-template-columns: 1fr;
  }
  .calc-trust-panel--hero-bar .calc-trust-panel__item {
    border-bottom: 1px solid var(--gov-border);
  }
  .calc-trust-panel--hero-bar .calc-trust-panel__item:last-child {
    border-bottom: none;
  }
  .home-hero .home-coverage__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  .hero h1 {
    font-size: 1.5rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .hero__lead {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
  }
  .hero__badge {
    font-size: 0.72rem;
    line-height: 1.35;
    max-width: 100%;
  }
  .hero__cta {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .hero__cta .btn {
    width: 100%;
    justify-content: center;
  }
  .hero__calc {
    width: 100%;
    max-width: 100%;
  }
  .calc-card {
    padding: 1.1rem 0.9rem 1.25rem;
  }
  .calc-card__title {
    font-size: 1.15rem;
    overflow-wrap: anywhere;
  }
  .calc-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .calc-actions .btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }
  .input-wrap input {
    min-width: 0;
    font-size: 1rem;
    padding: 0.75rem 0.65rem;
  }
  .input-prefix,
  .input-suffix {
    padding-inline: 0.55rem;
    flex-shrink: 0;
  }
  .home-hero .home-coverage__link {
    min-height: 0;
    padding: 0.9rem 1rem;
  }
}

/* Calculator */
.calc-card {
  padding: 1.5rem;
  border: 1px solid var(--gov-border);
  border-top: 3px solid var(--gov-primary);
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: clip;
}
.calc-card__badge {
  color: var(--gov-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
}
.pulse-dot { background: #2E7D32; animation: none; opacity: 1; }
.calc-card__title { font-size: 1.25rem; color: var(--text-primary); }
.calc-form__group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gov-primary);
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--gov-border);
}
.form-group label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.input-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: var(--gov-bg);
  border: 1px solid var(--gov-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.input-wrap:focus-within {
  border-color: var(--gov-primary);
  box-shadow: 0 0 0 2px rgba(11, 61, 145, 0.15);
}
.input-wrap input {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 1.05rem;
}
.input-prefix,
.input-suffix {
  flex: 0 0 auto;
}
.calc-actions {
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  margin-bottom: 1.5rem;
}
.calc-results {
  border-top: 2px solid var(--gov-border);
  margin-top: 1.25rem;
  padding-top: 1.25rem;
}
.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
.result-item {
  background: var(--gov-section);
  border: 1px solid var(--gov-border);
  padding: 0.75rem 1rem;
  min-width: 0;
}
.result-item--highlight {
  border-color: var(--gov-primary);
  background: rgba(11, 61, 145, 0.06);
  border-width: 2px;
}
.result-label {
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.result-value {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.05rem;
  color: var(--gov-primary);
  font-family: var(--font-sans);
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.calc-results__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.calc-formula {
  background: var(--gov-section);
  border: 1px solid var(--gov-border);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  font-size: 0.85rem;
}
.calc-explain {
  margin-top: 1rem;
  border: 1px solid var(--gov-border);
  border-radius: var(--radius-sm);
  background: var(--gov-section);
}
.calc-explain summary {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--gov-primary);
  list-style: none;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.calc-explain summary::-webkit-details-marker { display: none; }
.calc-explain summary::before {
  content: '+';
  margin-right: 0.5rem;
  font-weight: 700;
}
.calc-explain[open] summary::before { content: '−'; }
.calc-explain__body {
  padding: 0 1rem 1rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.65;
}
.calc-explain__body ol {
  margin: 0.5rem 0 0 1.25rem;
}
.calc-empty {
  margin-top: 0.25rem;
  padding: 1.5rem 1.25rem;
  background: var(--gov-section);
  border: 1px dashed var(--gov-border);
  border-radius: var(--radius-sm);
}
.calc-empty.is-error {
  border-color: #C62828;
  background: rgba(198, 40, 40, 0.06);
}
.calc-empty.is-error p { color: #B71C1C; font-weight: 500; }
.field-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}
.calc-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 0.5rem;
}
@media (min-width: 1201px) {
  .nav-toggle { display: none !important; }
}
@media (max-width: 1200px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .nav-desktop,
  .nav-cta { display: none !important; }
  .nav-toggle { display: flex !important; }
}
@media (max-width: 480px) {
  .logo {
    max-width: min(11.5rem, 52vw);
  }
  .logo-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .header-actions {
    gap: 0.35rem;
  }
  .search-toggle,
  .nav-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }
}

/* Trust panel (inline below calculator on inner pages) */
.calc-trust-panel:not(.calc-trust-panel--hero-bar) {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: var(--gov-section);
  border: 1px solid var(--gov-border);
  border-radius: var(--radius);
}
.calc-trust-panel__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  border: 1px solid var(--gov-border);
  background: var(--gov-bg);
  color: var(--gov-primary);
}
.trust-badge svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.calc-trust-panel__grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 640px) {
  .calc-trust-panel__grid { grid-template-columns: repeat(2, 1fr); }
}
.calc-trust-panel__item h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gov-primary);
  margin-bottom: 0.35rem;
}
.calc-trust-panel__item p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}
.calc-trust-panel__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gov-border);
}

/* Sections */
.section {
  padding: 3rem 0;
}
.section:nth-child(even) {
  background: var(--gov-section);
}
.section-header h2 {
  color: var(--text-primary);
  font-size: clamp(1.5rem, 3vw, 2rem);
}
.state-card,
.home-coverage__link,
.tax-region-card {
  border: 1px solid var(--gov-border);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.state-card:hover,
.home-coverage__link:hover {
  border-color: var(--gov-primary);
  box-shadow: var(--shadow-lg);
  transform: none;
}

/* Legal disclaimer — official notice bar */
.legal-disclaimer-section {
  background: #FFF8E6;
  border-top: none;
  border-bottom: none;
  margin-bottom: 0;
}
.legal-disclaimer-section .legal-disclaimer {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  border: none;
  border-block: 1px solid #E8D4A8;
}
.legal-disclaimer__row,
.legal-disclaimer__label {
  color: #7A5C00;
}

/* Footer — separated from disclaimer (no merged borders) */
.site-footer {
  background: var(--gov-section);
  border-top: 3px solid var(--gov-primary);
  margin-top: 1.25rem;
}
.footer-copyright strong,
.footer-note a,
.footer-nav a:hover,
.footer-social a:hover {
  color: var(--gov-primary);
}
.scroll-top-btn.site-scroll-top {
  background: var(--gov-primary);
  color: #fff;
}
@media (max-width: 640px) {
  .site-footer {
    padding: 2rem 0 1.75rem;
  }
  .footer-nav a {
    font-size: 0.82rem;
  }
  .footer-nav__sep {
    display: none;
  }
  .footer-nav {
    flex-direction: column;
    gap: 0.55rem;
  }
}

/* Page hero */
.page-hero {
  background: var(--gov-section);
  border-bottom: 1px solid var(--gov-border);
}
.page-hero--hub {
  background: var(--gov-section);
}
.page-region-hub .states-grid--hub {
  gap: 1rem;
}
.breadcrumb {
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.breadcrumb a { font-weight: 500; }

/* Editorial / author — tone down gradients */
.author-profile-name,
.author-profile-stat__value {
  background: none;
  -webkit-text-fill-color: var(--gov-primary);
  color: var(--gov-primary);
}
.editorial-meta {
  border: 1px solid var(--gov-border);
  border-radius: var(--radius);
}

/* FAQ */
.faq-item {
  border: 1px solid var(--gov-border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}
.faq-question {
  min-height: 48px;
  font-weight: 600;
}

/* Tables */
.tax-table {
  border: 1px solid var(--gov-border);
}
.tax-table th {
  background: var(--gov-section);
  color: var(--gov-primary);
}

/* Commercial page contrast fixes */
.tax-example-card__steps {
  background: #F5F7FA !important;
  border-color: #D9E2EC !important;
  color: #102A43 !important;
}
.tax-example-step {
  color: #334E68 !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none !important; opacity: 1 !important; transform: none !important; }
  .legal-disclaimer__track { animation: none !important; }
}

/* Print */
@media print {
  .site-header,
  .site-footer,
  .mobile-calc-cta,
  .legal-disclaimer-section,
  .scroll-progress,
  .noise-overlay,
  .page-loader,
  .calc-actions,
  .calc-trust-panel { display: none !important; }
  body.print-calc-mode .calc-results,
  body.print-calc-mode .calc-results[hidden] { display: block !important; }
  body { background: #fff; color: #000; }
}
