/* ============================================================
   NationalTaxTools.com — Global Layout Guardrails
   Sitewide protection layer. Do not remove.
   ============================================================ */

/* ============================================================
   HEADER / NAV NORMALIZATION — Canonical v1
   Applied after all per-page <style> blocks.
   Overrides font-size drift on wordmark and nav background.
   Do not remove. Do not add !important unless required.
   ============================================================ */

/* Canonical wordmark size: 0.95rem sitewide */
.wordmark {
  font-size: 0.95rem;
}

/* Prevent .wordmark-line1 / .wordmark-accent explicit
   font-size rules from overriding the inherited value */
.wordmark-line1,
.wordmark-accent {
  font-size: inherit;
}

/* Canonical nav surface background */
.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* Sticky header: per-page CSS sets sticky on .site-nav, but .site-nav's
   containing block is <header> (~56px tall) — sticky cannot persist past
   that height. Setting sticky on <header> instead targets body as the
   containing block (full page height), giving the full-page sticky range. */
header {
  position: sticky;
  top: 0;
  z-index: 200;
}

/* Scroll-state shadow: appears after page scrolls past 10px.
   Progressive enhancement — Chrome/Edge 115+. No effect in Safari/Firefox (graceful). */
@supports (animation-timeline: scroll()) {
  @keyframes nav-shadow {
    from { box-shadow: none; }
    to   { box-shadow: 0 2px 8px rgba(15,28,46,0.10); }
  }
  .site-nav {
    animation: nav-shadow linear both;
    animation-timeline: scroll(root block);
    animation-range: 0 10px;
  }
}

/* Anchor offset: prevents headings/sections from jumping under the sticky nav.
   64px = 56px nav height + 8px buffer. */
h2, h3, h4, [id] {
  scroll-margin-top: 64px;
}

/* Nav links: remove bullets when rendered as <ul> */
.nav-links {
  list-style: none;
}

/* 1. Prevent media from overflowing containers */
img, video, embed, iframe, object, svg {
  max-width: 100%;
  height: auto;
}

/* 2. Table scroll protection — prevents mobile breakout */
table {
  max-width: 100%;
}

/* 3. Box sizing baseline (reinforces per-page rule) */
*, *::before, *::after {
  box-sizing: border-box;
}

/* 4. Prevent horizontal scroll at the root level.
   html: overflow-x hidden clips viewport-level horizontal overflow (safe; html is the real scroll container).
   body: overflow-x clip prevents horizontal overflow without creating a scroll container.
   Using clip on body (not hidden) avoids the implicit overflow-y:auto that hidden triggers,
   which would make body the sticky container — body never scrolls, so position:sticky would break. */
html {
  overflow-x: hidden;
  max-width: 100%;
}
body {
  overflow-x: clip;
  max-width: 100%;
}

/* 5. Buttons and inputs cannot exceed their containers */
button, input, select, textarea {
  max-width: 100%;
}

/* 6. Prevent pre/code from overflowing */
pre, code {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 7. Wait-table horizontal scroll — prevents narrow viewport overflow on refund pages */
.wait-table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

/* ============================================================
   TABLE SYSTEM — Global table patterns
   Zebra striping + three semantic table types for forward use.
   Existing page-level <style> blocks take precedence where defined.
   ============================================================ */

/* --- Scroll wrapper (use around any table for mobile safety) --- */
.table-wrap {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  margin: 1rem 0;
}

/* --- Shared base: all global table classes --- */
.table-timeline,
.table-compare,
.table-action {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

/* --- Shared header row --- */
.table-timeline th,
.table-compare th,
.table-action th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  color: var(--text-label);
  background: var(--bg-panel);
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

/* --- Shared cell --- */
.table-timeline td,
.table-compare td,
.table-action td {
  padding: 0.6rem 0.85rem;
  color: var(--text-secondary);
  vertical-align: top;
  line-height: 1.5;
}

/* --- Zebra: even rows get panel background --- */
.rate-table tbody tr:nth-child(even) td,
.wait-table tbody tr:nth-child(even) td,
.table-timeline tbody tr:nth-child(even) td,
.table-compare tbody tr:nth-child(even) td,
.table-action tbody tr:nth-child(even) td {
  background: var(--bg-panel);
}

/* --- Dark mode header and zebra overrides --- */
[data-theme="dark"] .table-timeline th,
[data-theme="dark"] .table-compare th,
[data-theme="dark"] .table-action th {
  background: rgba(255,255,255,0.04);
}

[data-theme="dark"] .rate-table tbody tr:nth-child(even) td,
[data-theme="dark"] .wait-table tbody tr:nth-child(even) td,
[data-theme="dark"] .table-timeline tbody tr:nth-child(even) td,
[data-theme="dark"] .table-compare tbody tr:nth-child(even) td,
[data-theme="dark"] .table-action tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.03);
}

/* --- TABLE-TIMELINE: Simple, minimal — refund timing and processing pages --- */
.table-timeline td {
  border-bottom: 1px solid var(--border);
}
.table-timeline tr:last-child td {
  border-bottom: none;
}
.table-timeline .teal {
  color: var(--teal);
  font-weight: 600;
  font-family: var(--mono);
}

/* --- TABLE-COMPARE: Side-by-side — calculators and tax option pages --- */
.table-compare td,
.table-compare th {
  border: 1px solid var(--border);
}
.table-compare th:first-child,
.table-compare td:first-child {
  font-weight: 600;
  color: var(--text);
  min-width: 130px;
}
.table-compare .teal {
  color: var(--teal);
  font-weight: 500;
}

/* --- TABLE-ACTION: Action/status — refund problem and help pages --- */
.table-action td {
  border-bottom: 1px solid var(--border);
}
.table-action tr:last-child td {
  border-bottom: none;
}
.table-action td:first-child {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.table-action .teal {
  color: var(--teal);
  font-weight: 600;
  font-family: var(--mono);
}

/* --- Mobile: compact padding on narrow viewports --- */
@media (max-width: 640px) {
  .table-timeline,
  .table-compare,
  .table-action {
    font-size: 0.78rem;
  }
  .table-timeline th,
  .table-compare th,
  .table-action th,
  .table-timeline td,
  .table-compare td,
  .table-action td {
    padding: 0.5rem 0.6rem;
  }
  .table-compare td:first-child,
  .table-compare th:first-child {
    min-width: 100px;
  }
}

/* 8. Tracker CTA buttons — full-width stacked on mobile */
@media (max-width: 900px) {
  .tracker-cta .btn-primary,
  .tracker-cta .btn-ghost-sm {
    display: block;
    text-align: center;
    width: 100%;
    margin-top: 0.5rem;
    box-sizing: border-box;
  }
  .tracker-cta br {
    display: none;
  }
}

/* 9. Mobile nav — full-width menu items
   Fixes: .nav-links has align-items:center in base style which causes <li>
   elements to collapse to content-width when open in column flex layout.
   Adding width:100% on li elements forces edge-to-edge menu items.
   Applied here so all pages sharing style.css inherit the fix. */
@media (max-width: 900px) {
  .nav-links.open li {
    width: 100%;
  }
  .nav-links.open .nav-cta {
    border-bottom: none;
    margin-top: 0.25rem;
    justify-content: center;
  }
}

/* ============================================================
   HUB LIVE FILTER — shared search/filter for hub index pages
   Used on /calculators/, /guides/, /payroll/
   ============================================================ */

/* Hide filtered-out cards */
.hidden {
  display: none !important;
}

.hub-filter-wrap {
  max-width: 420px;
  margin: 1.5rem auto 0;
  position: relative;
}

.hub-filter-wrap label {
  position: absolute;
  left: -9999px;
}

.hub-filter-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.hub-filter-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  font-size: 0.9rem;
  font-family: var(--sans);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.hub-filter-input::placeholder {
  color: var(--text-muted);
}

.hub-filter-input:focus {
  border-color: var(--teal);
}

[data-theme="dark"] .hub-filter-input {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.15);
  color: var(--text);
}

[data-theme="dark"] .hub-filter-input:focus {
  border-color: var(--teal);
  background: rgba(255,255,255,0.10);
}

.hub-no-results {
  display: none;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  grid-column: 1 / -1;
}

/* ============================================================
   TOOL SEARCH — homepage "Find a Tool" section with JSON index
   ============================================================ */

.tool-search-section {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
}

.tool-search-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.tool-search-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.65rem;
}

.tool-search-wrap {
  position: relative;
}

.tool-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.tool-search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  font-size: 0.9rem;
  font-family: var(--sans);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.tool-search-input::placeholder {
  color: var(--text-muted);
}

.tool-search-input:focus {
  border-color: var(--teal);
}

[data-theme="dark"] .tool-search-input {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.12);
}

[data-theme="dark"] .tool-search-input:focus {
  border-color: var(--teal);
  background: rgba(255,255,255,0.08);
}

.tool-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 100;
  max-height: 320px;
  overflow-y: auto;
}

.tool-search-dropdown.open {
  display: block;
}

.tool-search-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
}

.tool-search-item:last-child {
  border-bottom: none;
}

.tool-search-item:hover,
.tool-search-item.highlighted {
  background: var(--bg-panel);
}

.tool-search-item:focus {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
}

.tool-search-type {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  flex-shrink: 0;
  min-width: 72px;
}

.tool-search-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-search-empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.tool-search-more {
  display: block;
  padding: 0.55rem 1rem;
  font-size: 0.78rem;
  color: var(--teal);
  font-weight: 500;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
}

.tool-search-more:hover {
  background: var(--bg-panel);
  text-decoration: underline;
}

/* ============================================================
   PRINT — hide chrome, show content only
   ============================================================ */

@media print {
  .site-nav,
  .hero-section,
  .page-hero,
  .engine-section,
  .tool-search-section,
  .hub-filter-wrap,
  .trust-bar,
  .cta-strip,
  .cta-card,
  footer,
  .breadcrumb,
  .dark-toggle,
  .nav-hbg {
    display: none !important;
  }

  body {
    background: white;
    color: black;
    font-size: 11pt;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  .page-body,
  .content-wrap {
    max-width: 100%;
    padding: 0;
  }

  .calc-shell {
    grid-template-columns: 1fr !important;
  }

  .results-panel {
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}

/* ── Refund Tracker Section Components ── */
.practitioner-insight{background:var(--bg-panel);border:1px solid var(--border);border-left:3px solid var(--teal);border-radius:var(--radius);padding:1.1rem 1.25rem;margin-bottom:1.5rem}
.practitioner-insight h3{font-size:.8rem;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--teal);margin-bottom:.5rem}
.practitioner-insight p{font-size:.875rem;color:var(--text-secondary);line-height:1.7;margin:0}
.real-world-scenario{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:1.1rem 1.25rem;margin-bottom:1.5rem}
.real-world-scenario h2{font-size:1rem;font-weight:600;color:var(--text);margin-bottom:.75rem}
.real-world-scenario p{font-size:.875rem;color:var(--text-secondary);line-height:1.7;margin-bottom:.6rem}
.when-this-breaks{margin-bottom:1.5rem}
.when-this-breaks h2{font-size:1rem;font-weight:600;color:var(--text);margin-bottom:.6rem}
.when-this-breaks ul{margin:0 0 0 1.2rem}
.when-this-breaks li{font-size:.875rem;color:var(--text-secondary);line-height:1.65;margin-bottom:.4rem}
.decision-step{background:linear-gradient(135deg,#0F1C2E 0%,#1A2E45 100%);border-radius:var(--radius);padding:1.25rem 1.5rem;margin-top:2rem;color:white}
.decision-step h3{font-size:.9rem;font-weight:600;color:white;margin-bottom:.5rem}
.decision-step p{font-size:.82rem;color:rgba(255,255,255,.7);line-height:1.7;margin-bottom:.75rem}
.decision-step a{color:var(--teal);font-weight:500}
.decision-step>.card{background:transparent;border:none;padding:0;margin-bottom:0}
/* OBBBA pattern: section.decision-step wraps .card (higher specificity overrides above) */
section.decision-step>.card{background:linear-gradient(135deg,rgba(0,168,150,0.10) 0%,rgba(0,168,150,0.05) 100%);border:1px solid rgba(0,168,150,0.22);padding:1.25rem 1.5rem}
section.decision-step>.card h2{color:rgba(255,255,255,0.95)}
section.decision-step h2{color:rgba(255,255,255,0.95)}
section.decision-step>.card p{color:rgba(255,255,255,0.82)}
section.decision-step>.card a{color:var(--teal)}
[data-theme="dark"] section.decision-step>.card{background:linear-gradient(135deg,rgba(0,168,150,0.14) 0%,rgba(0,168,150,0.07) 100%);border-color:rgba(0,168,150,0.28)}
/* Guide/calc pattern: decision-card inside section.decision-step */
/* Force transparent bg so dark section bg shows through — prevents white text on light card in light mode */
section.decision-step .decision-card{background:transparent;border-color:rgba(0,168,150,0.22)}
section.decision-step .decision-card p{color:rgba(255,255,255,0.82)}
section.decision-step .decision-label{color:var(--teal)}

/* ── Companion CTA: conversion-block + btn-teal ──
   Global definition. Mirrors per-page inline patterns already in use on
   401k-contribution-limits and roth-ira-contribution-calculator. Adding
   here removes the need to duplicate the rule on every new page that
   uses the top-of-page companion CTA. */
.conversion-block{background:var(--teal-muted);border:1px solid rgba(0,168,150,0.20);border-radius:var(--radius);padding:1.25rem 1.5rem;margin-bottom:1.5rem;display:flex;align-items:center;justify-content:space-between;gap:1.5rem;flex-wrap:wrap}
[data-theme="dark"] .conversion-block{background:rgba(0,168,150,0.08);border-color:rgba(0,168,150,0.18)}
.conversion-block p{font-size:0.85rem;color:var(--text-secondary);margin:0;line-height:1.6;flex:1}
[data-theme="dark"] .conversion-block p{color:rgba(255,255,255,0.6)}
.conversion-block a.btn-teal{display:inline-block;background:var(--teal);color:white;padding:0.55rem 1.25rem;border-radius:var(--radius-sm);font-size:0.82rem;font-weight:600;white-space:nowrap;transition:background 0.15s;text-decoration:none}
.conversion-block a.btn-teal:hover{background:var(--teal-lt)}
@media(max-width:600px){.conversion-block{flex-direction:column;align-items:stretch;gap:0.75rem}.conversion-block a.btn-teal{text-align:center}}
