/* Tax Tools section styles — builds on the site design system in /styles.css */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Breadcrumb ── */
.breadcrumb {
  padding: 14px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb a {
  color: var(--teal-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.breadcrumb li + li::before {
  content: "›";
  margin-right: 6px;
  color: var(--muted);
}

/* ── Tools hub ── */
.tools-hero {
  padding: 46px 0 54px;
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(200, 145, 60, 0.18), transparent 60%),
    linear-gradient(160deg, #1F3A5F 0%, #23395D 60%, #16283f 100%);
  color: var(--white);
}

.tools-hero h1 {
  margin-bottom: 12px;
  color: var(--white);
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  line-height: 1.06;
}

.tools-hero p {
  max-width: 620px;
  margin: 0;
  color: #d7e0ec;
  font-size: 1.08rem;
}

.tools-hero .breadcrumb,
.tools-hero .breadcrumb a {
  color: #c6d2e2;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 26px;
}

.filter-tab {
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: #31433f;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-tab.active,
.filter-tab[aria-selected="true"] {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--white);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 10px 24px rgba(22, 34, 31, 0.06);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--sage);
  color: var(--teal-dark);
}

.tool-icon svg {
  width: 26px;
  height: 26px;
}

.tool-card h3 {
  margin: 0;
  font-size: 1.14rem;
}

.tool-card p {
  flex-grow: 1;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.tool-card .button {
  align-self: flex-start;
  min-height: 42px;
  padding: 0 16px;
  font-size: 0.92rem;
}

/* ── Tool pages ── */
.tool-header {
  padding: 34px 0 10px;
}

.tool-header h1 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  line-height: 1.1;
}

.tool-intro {
  max-width: 640px;
  margin: 0;
  color: #40524d;
  font-size: 1.04rem;
}

.calc-section {
  padding: 26px 0 60px;
}

.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.85fr);
  gap: 24px;
  align-items: start;
}

.calc-card,
.results-card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 10px 24px rgba(22, 34, 31, 0.06);
}

.results-card {
  position: sticky;
  top: 96px;
  background: var(--paper);
}

.form-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.auto-calc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.auto-calc input {
  width: 18px;
  height: 18px;
  min-height: 0;
}

.field {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: #30443f;
  font-weight: 700;
  font-size: 0.95rem;
}

.field-help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.inline-error {
  display: block;
  min-height: 18px;
  margin-top: 4px;
  color: #9b2c2c;
  font-size: 0.85rem;
  font-weight: 600;
}

.radio-set {
  margin: 0;
  padding: 0;
  border: 0;
}

.radio-set legend {
  margin-bottom: 8px;
  padding: 0;
  color: #30443f;
  font-weight: 700;
  font-size: 0.95rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 400;
}

.radio-option input {
  width: 20px;
  height: 20px;
  min-height: 0;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}

.checkbox-option input {
  width: 20px;
  height: 20px;
  min-height: 0;
}

/* ── Tooltip terms ── */
.term-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.term-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--sage);
  color: var(--teal-dark);
  cursor: help;
}

.term-def {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 30;
  display: none;
  width: min(260px, 70vw);
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: #f2f5f3;
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.45;
  transform: translateX(-50%);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.term-wrap:hover .term-def,
.term-tip:focus + .term-def,
.term-tip:focus-visible + .term-def {
  display: block;
}

/* ── Results ── */
.results-placeholder {
  color: var(--muted);
  font-size: 0.96rem;
}

.result-headline {
  padding: 18px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  text-align: center;
}

.result-headline.refund {
  border-color: rgba(46, 125, 91, 0.4);
  background: #f0f8f4;
}

.result-headline.owed {
  border-color: rgba(155, 44, 44, 0.35);
  background: #fdf3f2;
}

.result-headline.neutral {
  border-color: rgba(31, 58, 95, 0.3);
  background: #f2f6fb;
}

.result-headline-label {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.result-headline-value {
  display: block;
  margin: 6px 0 2px;
  font-size: clamp(2rem, 5vw, 2.7rem);
  line-height: 1.05;
  color: var(--teal-dark);
}

.result-headline.refund .result-headline-value {
  color: #1f7a52;
}

.result-headline.owed .result-headline-value {
  color: #b03a2e;
}

.result-headline-sub {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.result-message {
  margin: 12px 0 0;
  color: #40524d;
  font-size: 0.95rem;
}

.result-message.error {
  color: #9b2c2c;
  font-weight: 700;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  display: block;
  margin-top: 4px;
  font-size: 1.16rem;
  color: var(--ink);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.result-actions .button {
  min-height: 42px;
  font-size: 0.92rem;
}

.result-breakdown {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.result-breakdown summary {
  padding: 12px 14px;
  color: var(--teal-dark);
  font-weight: 700;
  cursor: pointer;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.breakdown-table th,
.breakdown-table td {
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.breakdown-table th {
  color: var(--muted);
  font-weight: 600;
  width: 58%;
}

.breakdown-table td {
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.result-notes {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.86rem;
}

/* ── Charts ── */
.chart-area {
  margin-top: 16px;
}

.chart-flex {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.donut {
  flex-shrink: 0;
}

.donut-label {
  font-size: 11px;
  fill: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.donut-value {
  font-size: 17px;
  font-weight: 700;
  fill: var(--ink);
}

.chart-legend {
  flex-grow: 1;
  min-width: 200px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
}

.chart-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: #40524d;
}

.legend-swatch {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.bar-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.stacked-bar {
  display: flex;
  width: 100%;
  height: 34px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.bar-segment {
  height: 100%;
}

/* ── Disclaimer / related / FAQ ── */
.disclaimer {
  margin-top: 26px;
  padding: 14px 16px;
  border-left: 4px solid var(--gold);
  border-radius: 0 8px 8px 0;
  background: #faf6ee;
  color: #5a4a2e;
  font-size: 0.88rem;
}

.related-tools {
  margin-top: 26px;
  padding: 18px 20px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.related-tools h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.related-tools ul {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-tools a {
  color: var(--teal-dark);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tool-faq {
  padding: 30px 0 60px;
}

.tool-faq h2 {
  font-size: 1.5rem;
}

@media (max-width: 1020px) {
  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }

  .results-card {
    position: static;
  }
}

@media (max-width: 560px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .calc-card,
  .results-card {
    padding: 18px;
  }
}

/* ── Print ── */
@media print {
  .topbar,
  nav.nav,
  .tools-hero,
  .filter-tabs,
  .calc-card,
  .form-toolbar,
  .result-actions,
  .related-tools,
  .tool-faq,
  .newsletter-band,
  .no-print,
  footer .footer-links {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .results-card {
    position: static;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

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

  .result-breakdown {
    border: 0;
  }

  .result-breakdown summary {
    display: none;
  }

  details.result-breakdown > .breakdown-table {
    display: table !important;
  }

  .print-header {
    display: block !important;
    margin-bottom: 12px;
  }

  .disclaimer {
    background: none;
    border-color: #999;
  }
}

.print-header {
  display: none;
}
