/* HustleNumbers Base Styles */
@import url('./fonts.css');
@import url('./tokens.css');

/* Modern Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-gray-800);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
input, button, select, textarea { font: inherit; }
h1, h2, h3, h4 {
  line-height: var(--leading-tight);
  font-family: var(--font-display);
  letter-spacing: -0.015em;
}

/* Focus */
:focus-visible {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
}

/* Container — single unified max-width for ALL page types */
.container {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  padding-inline: var(--space-4);
}

/* === COMPONENTS === */

/* Calculator Card */
.calc-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-gray-200);
  border-top: 3px solid var(--silo, var(--color-primary));
  padding: var(--space-6);
}
.calc-card__title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-gray-900);
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}

/* Labeled Input */
.field { margin-bottom: var(--space-4); }
.field__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-gray-700);
  margin-bottom: var(--space-1);
}
.field__input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  /* Editable fields stay white; gray fills read as locked/disabled. */
  background: var(--color-surface);
  transition: border-color 0.15s;
}
.field__input:hover:not(:focus):not(:disabled) {
  border-color: var(--color-gray-400);
}
.field__input:focus {
  border-color: var(--silo, var(--color-primary));
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--silo, var(--color-primary)) 15%, transparent);
}
.field__input:disabled {
  background: var(--color-gray-50);
  color: var(--color-gray-600);
  cursor: not-allowed;
}
.field__input::placeholder {
  /* Browser default / gray-300 fails WCAG (~1.5:1). */
  color: var(--color-gray-500);
  opacity: 1; /* Firefox defaults placeholder to lowered opacity */
}
/* Autofill can paint yellow/blue; keep editable fields on surface white. */
.field__input:-webkit-autofill,
.field__input:-webkit-autofill:hover,
.field__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--color-gray-800);
  caret-color: var(--color-gray-800);
  box-shadow: 0 0 0 1000px var(--color-surface) inset;
}

/* Selects: custom chevron, room for arrow, no horizontal overflow on narrow screens */
select.field__input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.75rem;
  cursor: pointer;
  /* Keep long labels inside the field; native picker on mobile stays on-screen */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background-color: var(--color-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%230F766E' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1rem;
}
select.field__input:hover {
  border-color: var(--color-primary-light);
}
select.field__input:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%230D5F59' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
select.field__input:disabled {
  background-color: var(--color-gray-50);
  color: var(--color-gray-600);
  cursor: not-allowed;
}
/* IE/old Edge hide native arrow */
select.field__input::-ms-expand { display: none; }
.field__note {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-gray-500);
}

/* Chip / preset row under numeric fields (APY, SWR, demo prices, etc.) */
.chip-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.chip-presets__btn {
  min-height: 36px;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-gray-700);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}
.chip-presets__btn:hover { background: var(--color-gray-50); }
.chip-presets__btn[aria-pressed="true"] {
  border-color: var(--color-primary);
  background: var(--color-success-bg);
  color: var(--color-primary-dark);
}

/* Extra result blocks under the hero (summary, breakdown, recommendations) */
.result-section {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-gray-200);
}
.result-section__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-gray-700);
  margin-bottom: var(--space-2);
}
.result-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-sm);
  padding: var(--space-1) 0;
  color: var(--color-gray-700);
}
.result-row strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-gray-900);
}
.hero-caption {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-gray-600);
  margin-top: calc(-1 * var(--space-3));
  margin-bottom: var(--space-4);
}
.status-banner {
  text-align: center;
  font-weight: 600;
  font-size: var(--text-sm);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}
.status-banner--ok {
  background: var(--color-success-bg);
  color: var(--color-success);
}
.status-banner--short {
  background: #FEF2F2;
  color: var(--color-danger);
}
.breakdown-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--color-gray-200);
  margin: var(--space-2) 0;
}
.breakdown-bar__a { background: var(--color-primary); }
.breakdown-bar__b { background: var(--color-accent); }
.breakdown-bar__c { background: var(--color-gray-500); }
.comparison-table__row--winner td {
  background: var(--color-success-bg);
  font-weight: 600;
}

/* Result Panel */
.result-panel {
  background: linear-gradient(135deg, var(--color-gray-50), var(--color-surface));
  border: 1px solid var(--color-gray-200);
  border-top: 2px solid var(--silo, var(--color-primary));
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-top: var(--space-4);
}
.result-hint {
  /* Was gray-300 (~1.5:1) — unreadable empty-state copy. */
  color: var(--color-gray-600);
  font-size: var(--text-sm);
  font-weight: 400;
}
.result-panel__hero {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--color-primary);
  text-align: center;
  margin-bottom: var(--space-4);
}
.result-panel__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.result-panel__metric {
  text-align: center;
}
.result-panel__metric-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--color-gray-900);
}
.result-panel__metric-label {
  font-size: var(--text-sm);
  color: var(--color-gray-600);
  margin-top: var(--space-1);
}

/* Comparison Table */
.comparison-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-3) 0;
}
.comparison-table {
  width: 100%;
  min-width: 24rem;
  border-collapse: collapse;
  margin-top: var(--space-4);
  font-size: var(--text-sm);
}
.comparison-table th,
.comparison-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-gray-200);
}
.comparison-table th {
  font-weight: 600;
  color: var(--color-gray-600);
  background: var(--color-gray-50);
}
.comparison-table td {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
/* Highlight the "best"/cheapest row in a comparison table */
.comparison-table__row--highlight {
  font-weight: 700;
  background: var(--color-success-bg);
}
.comparison-table__row--highlight td {
  color: var(--color-success);
}

/* Segmented Toggle — a connected two-or-more-option switch (Online | In-person, etc.) */
.segmented-toggle {
  display: flex;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.segmented-toggle__btn {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  min-height: 44px;
  color: var(--color-gray-700);
  transition: background 0.15s, color 0.15s;
}
.segmented-toggle__btn:hover:not(.segmented-toggle__btn--active) {
  background: var(--color-gray-50);
}
.segmented-toggle__btn--active,
.segmented-toggle__btn[aria-pressed="true"] {
  background: var(--color-primary);
  color: #fff;
}

/* FAQ Accordion */
.faq { margin-top: var(--space-8); }
.faq__item {
  border-bottom: 1px solid var(--color-gray-200);
}
.faq__item summary {
  padding: var(--space-4) 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: color var(--dur-fast) ease;
}
.faq__item summary:hover { color: var(--color-primary); }
.faq__item summary::before {
  content: "+";
  display: inline-block;
  width: 1.5em;
  font-weight: 700;
  color: var(--color-primary);
}
.faq__item[open] summary::before { content: "−"; }
.faq__item p {
  padding: 0 0 var(--space-4) 1.5em;
  color: var(--color-gray-600);
  line-height: var(--leading-normal);
}

/* =====================================================================
   TOOL ARTICLE — long SEO guide under the calculator
   Full copy lives in the HTML (<details>); collapsed by default for UX.
   Crawlers still see the complete text in the initial document.
   ===================================================================== */
.tool-article {
  margin-top: var(--space-8);
  margin-bottom: var(--space-6);
  max-width: 720px;
}
.tool-article__details {
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}
.tool-article__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--color-gray-900);
}
.tool-article__summary::-webkit-details-marker { display: none; }
.tool-article__summary::marker { content: ""; }
.tool-article__summary-title {
  font-size: var(--text-base);
  line-height: 1.35;
}
.tool-article__summary-hint {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-primary);
}
.tool-article__summary-hint::after { content: "Read guide"; }
.tool-article__details[open] .tool-article__summary-hint::after { content: "Hide"; }
.tool-article__body {
  padding: 0 var(--space-5) var(--space-6);
  border-top: 1px solid var(--color-gray-200);
  color: var(--color-gray-700);
  font-size: var(--text-sm);
  line-height: 1.65;
}
.tool-article__body > :first-child { margin-top: var(--space-4); }
.tool-article__body h2 {
  margin: var(--space-6) 0 var(--space-3);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-gray-900);
  line-height: 1.3;
}
.tool-article__body h3 {
  margin: var(--space-5) 0 var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-gray-900);
}
.tool-article__body p { margin: 0 0 var(--space-3); }
.tool-article__body ul,
.tool-article__body ol {
  margin: 0 0 var(--space-3);
  padding-left: 1.25em;
}
.tool-article__body li { margin-bottom: var(--space-2); }
.tool-article__body a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tool-article__body .tool-article__note {
  margin-top: var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--color-gray-50);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--color-gray-600);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-gray-600);
  padding: var(--space-4) 0;
}
.breadcrumb a {
  color: var(--color-primary);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb__sep { margin-inline: var(--space-1); }
.breadcrumb [aria-current="page"] {
  font-weight: 600;
  color: var(--silo, var(--color-gray-700));
}

/* Related Tools Grid */
.related-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-top: var(--space-6);
}
@media (min-width: 520px) {
  .related-tools { grid-template-columns: 1fr 1fr; }
}
.related-tools__card {
  display: block;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-gray-800);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.related-tools__card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}
.related-tools__card-title {
  font-weight: 600;
  color: var(--color-primary);
}
.related-tools__card-desc {
  font-size: var(--text-sm);
  color: var(--color-gray-600);
  margin-top: var(--space-1);
}
.related-tools__heading {
  font-size: var(--text-base);
  font-weight: 600;
  margin: var(--space-8) 0 var(--space-3);
  color: var(--color-gray-800);
}

/* Guide cross-link under calculators (replaces inline styles) */
.tool-guide-link {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  background: #F0FDFA;
  border: 1px solid #99F6E4;
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--color-gray-700);
}
.tool-guide-link a {
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}
.tool-guide-link a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* Button system — unified across all tools */
.btn-row {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
  flex-wrap: wrap;
}
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border: 1px solid var(--color-primary);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #fff;
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary:active, .btn-embed:active { transform: scale(0.97); }
/* Anchor CTAs: beat link-color rules (e.g. .article a) so text never goes teal-on-teal. */
a.btn-primary,
a.btn-primary:link,
a.btn-primary:visited,
a.btn-primary:hover,
a.btn-primary:active {
  color: #fff;
}
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.btn-secondary:hover {
  background: var(--color-gray-50);
}
/* Backward compat: .btn-embed maps to .btn-secondary */
.btn-embed {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-embed:hover {
  background: var(--color-gray-50);
}
/* Add/Remove buttons for dynamic-row tools (debt-payoff, sinking-funds, generators) */
.btn-add {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #fff;
  margin-bottom: var(--space-4);
}
.btn-add:hover { background: var(--color-primary-dark); }
.btn-remove {
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  background: transparent;
  color: var(--color-danger);
  min-height: 44px;
  min-width: 44px;
}
.btn-remove:hover { background: #FEE2E2; }

/* =====================================================================
   AD SLOTS — exact creative frames + persistent “Advertisement” label
   Units: mrec 300×250 · leaderboard 728×90 / mobile 320×50 · sky 160×600 (viewport-scaled) · native fluid
   ===================================================================== */
.ad-slot,
.ad-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-block: var(--space-6);
  background: transparent;
  border: none;
  overflow: visible;
  min-height: 0;
}
.ad-slot__label {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  /* Solid muted gray — rgba(…,0.55) was ~2.1:1 and unreadable. */
  color: var(--color-gray-600);
  user-select: none;
  pointer-events: none;
}
.ad-slot__frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 6px,
      rgba(148, 163, 184, 0.06) 6px,
      rgba(148, 163, 184, 0.06) 7px
    ),
    var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-sizing: border-box;
}
.ad-slot__frame--filled {
  background: transparent;
  border-color: transparent;
}
/* Exact creative boxes — prevent 728 into a 300 box (and vice versa) */
.ad-slot[data-ad="mrec"] .ad-slot__frame {
  width: 300px;
  height: 250px;
  max-width: 100%;
}
.ad-slot[data-ad="leaderboard"] .ad-slot__frame,
.ad-slot--in-card .ad-slot__frame {
  width: 728px;
  height: 90px;
  max-width: 100%;
}
.ad-slot[data-ad="native"] .ad-slot__frame {
  width: 100%;
  max-width: 820px;
  min-height: 0;
  aspect-ratio: 4 / 1;
  padding: 0;
}
.ad-slot--in-card {
  margin-block: var(--space-4);
}
.ad-slot--sticky {
  /* Mobile sticky footer only — desktop uses in-card / page leaderboards. */
  display: none;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  margin-block: var(--space-4);
}
/* Compact above-fold unit — mobile only (injected by build after tool title). */
.ad-slot--mobile-top {
  display: none;
}
/* Sticky footer ad disabled — removed per UX decision */
.ad-slot--sticky {
  display: none !important;
}
@media (max-width: 768px) {
  .ad-slot[data-ad="leaderboard"] .ad-slot__frame,
  .ad-slot--in-card .ad-slot__frame,
  .ad-slot--sticky .ad-slot__frame,
  .ad-slot--mobile-top .ad-slot__frame {
    width: 320px;
    height: 50px;
  }
  /* Native 4:1 is too thin on mobile — let the ad creative size itself */
  .ad-slot[data-ad="native"] .ad-slot__frame {
    aspect-ratio: auto;
    min-height: 120px;
    height: auto;
    overflow: visible;
  }
  .ad-slot--mobile-top {
    display: flex;
    margin-block: var(--space-3) var(--space-4);
  }
  /*
   * Mobile sticky footer banner: always in the viewport while scrolling the calculator
   * (in-card + page-bottom slots sit below long forms and got ~0 viewability).
   * Dismissible via consent.js; hidden while the cookie banner is open.
   */
  .ad-slot--sticky {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
    background: rgba(248, 250, 252, 0.97);
    border-top: 1px solid var(--color-gray-200);
    box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06);
  }
  .ad-slot--sticky[hidden],
  .ad-slot--sticky[data-dismissed="1"] {
    display: none !important;
  }
  /* Cookie settings pill — normal bottom position (sticky ad removed) */
  body.gn-mobile-sticky-ad #gn-cookie-settings {
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
  /* Prefer cookie dialog over the sticky ad */
  body:has(#gn-consent) .ad-slot--sticky {
    visibility: hidden;
    pointer-events: none;
  }
  body:has(#gn-consent) {
    padding-bottom: 0;
  }
}

/* Dual floating skyscrapers — wide desktop only (min-width 1200px).
   Creative is 160×600; consent.js scales the frame to fit viewport height. */
.ad-rail {
  display: none;
  position: fixed;
  /* Sit just under the fixed header; scale leaves bottom gap via JS */
  top: var(--gn-header-height);
  z-index: 30;
  width: 160px;
  margin: 0;
  gap: 0.3rem;
  overflow: hidden;
  align-items: center;
}
.ad-rail .ad-slot__frame {
  width: 160px;
  height: 600px;
  flex: 0 0 auto;
  transform-origin: top center;
}
.ad-rail--left {
  left: max(8px, calc((100vw - 820px) / 2 - 160px - 20px));
}
.ad-rail--right {
  right: max(8px, calc((100vw - 820px) / 2 - 160px - 20px));
}
@media (min-width: 1200px) {
  .ad-rail { display: flex; }
  /* Keep cookie pill inside the content column (consent.js also sets left:12px; win with !important). */
  #gn-cookie-settings {
    left: max(12px, calc(50% - 410px)) !important;
  }
}

/* =====================================================================
   ACCESSIBILITY, RESPONSIVE & SHARED CHROME  (added 2026-07-05)
   All additive. No calculator markup or JS depends on these rules.
   ===================================================================== */

/* Screen-reader-only utility */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Skip link — hidden until keyboard focus, then visible top-left */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -3rem;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus-visible { top: var(--space-2); }

/* Slim, consistent site header on tool pages (brand + orientation) */
.tool-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--gn-header-height);
  border-bottom: 1px solid var(--color-gray-200);
  background: var(--color-surface);
  width: 100%;
  box-sizing: border-box;
}
.tool-header__inner {
  width: 100%;
  max-width: 820px;
  height: 100%;
  margin-inline: auto;
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  box-sizing: border-box;
}
/* Reserve space so content is not hidden under the fixed header */
body:has(.tool-header) {
  padding-top: var(--gn-header-height);
}
.tool-brand {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--color-gray-900);
  text-decoration: none;
}
.tool-brand:hover { color: var(--color-gray-900); }
.tool-brand .brand-accent { color: var(--color-primary); transition: color var(--dur-fast) ease; }
.tool-brand:hover .brand-accent { color: var(--color-primary-dark); }
.tool-header__nav {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tool-header__nav a {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  color: var(--color-gray-600);
  text-decoration: none;
}
.tool-header__nav a:hover { color: var(--color-primary); text-decoration: underline; }

/* =====================================================================
   UNIFIED FOOTER — shared by .site-footer (home/directory/legal) and
   .tool-footer (tool pages). Multi-column on desktop, stacks on mobile.
   ===================================================================== */
.site-footer, .tool-footer {
  margin-top: var(--space-12);
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-gray-50);
}

/* Top section: brand + two link columns */
.footer-top {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  padding: var(--space-8) var(--space-4) var(--space-4);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}
@media (min-width: 480px) {
  .footer-top { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (min-width: 768px) {
  .footer-top { grid-template-columns: 2fr 1fr 1fr; }
  .footer-brand { grid-column: auto; }
}

/* Brand block */
.footer-brand__name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-gray-900);
  text-decoration: none;
}
.footer-brand__name:hover { color: var(--color-gray-900); }
.footer-brand__name .brand-accent { color: var(--color-primary); transition: color var(--dur-fast) ease; }
.footer-brand__name:hover .brand-accent { color: var(--color-primary-dark); }
.footer-brand__tagline {
  margin-top: var(--space-2);
  color: var(--color-gray-600);
  font-size: var(--text-sm);
  max-width: 40ch;
}

/* Link columns */
.footer-col__heading {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-gray-600);
  margin-bottom: var(--space-3);
}
.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.footer-col a {
  color: var(--color-gray-700);
  text-decoration: none;
  font-size: var(--text-sm);
}
.footer-col a:hover { color: var(--color-primary); text-decoration: underline; }

/* Bottom bar: short disclaimer + copyright */
.footer-bottom {
  border-top: 1px solid var(--color-gray-200);
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  padding: var(--space-4);
}
.footer-disclaimer {
  font-size: var(--text-xs);
  color: var(--color-gray-600);
  margin-bottom: var(--space-2);
}
.footer-disclaimer strong { color: var(--color-gray-800); }
.footer-disclaimer a { color: var(--color-primary); }
.footer-copy {
  font-size: var(--text-xs);
  color: var(--color-gray-600);
}

/* Stack the two result metrics on very narrow phones */
@media (max-width: 360px) {
  .result-panel__grid { grid-template-columns: 1fr; }
}

/* Respect users who prefer reduced motion */
@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;
  }
}

/* Print: drop site chrome/ads, keep the calculator + results legible.
   (Generators define their own stronger print rules later in-page; those still win.) */
@media print {
  .tool-header, .tool-footer, .site-footer, .skip-link, .breadcrumb,
  .ad-slot, .ad-slot--in-card, .ad-slot--sticky, .ad-rail,
  .btn-embed, .btn-primary, .btn-secondary, .btn-row, #gn-consent, #gn-cookie-settings {
    display: none !important;
  }
  body { background: #fff; color: #000; }
  .calc-card, .result-panel {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* =====================================================================
   SILO ACCENT SYSTEM — tool pages declare their category via
   body[data-silo] (injected at build time). --silo cascades into
   calc-card top border, breadcrumb current-page, and focus accents.
   ===================================================================== */
body[data-silo="tax"] { --silo: var(--silo-tax); }
body[data-silo="pricing"] { --silo: var(--silo-pricing); }
body[data-silo="finance"] { --silo: var(--silo-finance); }
body[data-silo="seller"] { --silo: var(--silo-seller); }
body[data-silo="shipping"] { --silo: var(--silo-shipping); }
body[data-silo="generators"] { --silo: var(--silo-generators); }

/* =====================================================================
   MOTION SYSTEM — result pulse + scroll reveals (ui-motion.js toggles
   these classes; fully disabled under prefers-reduced-motion above).
   ===================================================================== */
@keyframes gn-pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.035); color: var(--silo, var(--color-primary-light)); }
  100% { transform: scale(1); }
}
.gn-pulse {
  animation: gn-pulse 0.45s var(--ease-out);
  transform-origin: center;
}

.gn-reveal {
  opacity: 0;
  transform: translateY(0.6rem);
  transition:
    opacity var(--dur-med) var(--ease-out),
    transform var(--dur-med) var(--ease-out);
}
.gn-reveal.gn-in {
  opacity: 1;
  transform: translateY(0);
}
/* Stagger cards within a grid via nth-child delays (caps at 6) */
.tool-grid .gn-reveal:nth-child(2) { transition-delay: 0.04s; }
.tool-grid .gn-reveal:nth-child(3) { transition-delay: 0.08s; }
.tool-grid .gn-reveal:nth-child(4) { transition-delay: 0.12s; }
.tool-grid .gn-reveal:nth-child(5) { transition-delay: 0.16s; }
.tool-grid .gn-reveal:nth-child(n+6) { transition-delay: 0.2s; }

/* =====================================================================
   TOOL ENHANCEMENTS — reset, copy-result buttons (tool-enhance.js)
   ===================================================================== */
.btn-reset {
  color: var(--color-gray-600);
  border-color: var(--color-gray-300);
}
.btn-reset:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: #FEF2F2;
}
.btn-copy-result {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-copy-result:hover {
  background: var(--color-success-bg);
}

/* =====================================================================
   PROPORTION BAR — visual fee/cost breakdown (competitor-grade output)
   Usage: .proportion-bar with child spans sized by inline width:%.
   ===================================================================== */
.proportion-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--color-gray-100);
  margin: var(--space-3) 0 var(--space-2);
}
.proportion-bar__seg {
  transition: width 0.3s var(--ease-out);
}
.proportion-bar__seg--you { background: var(--color-success); }
.proportion-bar__seg--fees { background: var(--color-accent); }
.proportion-bar__seg--cost { background: var(--color-gray-400); }
.proportion-bar__seg--tax { background: var(--silo-tax, #B45309); }
.proportion-bar__seg--a { background: var(--color-primary); }
.proportion-bar__seg--b { background: var(--color-accent); }
.proportion-bar__seg--c { background: var(--color-gray-400); }

.proportion-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-gray-600);
}
.proportion-legend__item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.proportion-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.proportion-legend__dot--you { background: var(--color-success); }
.proportion-legend__dot--fees { background: var(--color-accent); }
.proportion-legend__dot--cost { background: var(--color-gray-400); }
.proportion-legend__dot--tax { background: var(--silo-tax, #B45309); }
.proportion-legend__dot--a { background: var(--color-primary); }
.proportion-legend__dot--b { background: var(--color-accent); }
.proportion-legend__dot--c { background: var(--color-gray-400); }

/* =====================================================================
   INTERPRETATION TEXT — contextualizes results (NN/g recommendation #9)
   ===================================================================== */
.result-interpret {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-gray-50);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--silo, var(--color-primary));
  font-size: var(--text-sm);
  color: var(--color-gray-700);
  line-height: var(--leading-normal);
}
.result-interpret strong {
  color: var(--color-gray-900);
}

/* =====================================================================
   SLIDER + NUMBER HYBRID — range input paired with text field
   ===================================================================== */
.field-slider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.field-slider input[type="range"] {
  flex: 1;
  height: 6px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-gray-200);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
.field-slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--silo, var(--color-primary));
  border: 3px solid var(--color-surface);
  box-shadow: var(--shadow-sm);
  cursor: grab;
}
.field-slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--silo, var(--color-primary));
  border: 3px solid var(--color-surface);
  box-shadow: var(--shadow-sm);
  cursor: grab;
}
.field-slider input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }
.field-slider .field__input {
  max-width: 6rem;
  min-height: 38px;
  text-align: center;
}
