@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ========================================
   CSS Custom Properties
   ======================================== */

:root {
  --bg-primary: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F1F5F9;
  --bg-hover: #E8F0FE;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --accent-primary: #1D4ED8;
  --accent-hover: #1E40AF;
  --accent-light: rgba(29, 78, 216, 0.08);
  --accent-green: #059669;
  --accent-green-light: rgba(5, 150, 105, 0.08);
  --accent-red: #DC2626;
  --accent-red-light: rgba(220, 38, 38, 0.08);
  --accent-orange: #EA580C;
  --accent-orange-light: rgba(234, 88, 12, 0.06);
  --border-light: #E2E8F0;
  --border-medium: #CBD5E1;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --max-width: 1200px;
  --transition: 200ms ease-out;
  --transition-slow: 350ms ease;
}

[data-theme="dark"] {
  --bg-primary: #0D1117;
  --bg-surface: #161B22;
  --bg-elevated: #21262D;
  --bg-hover: #1C2A3A;
  --text-primary: #E2E8F0;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent-primary: #60A5FA;
  --accent-hover: #93C5FD;
  --accent-light: rgba(96, 165, 250, 0.1);
  --accent-green: #34D399;
  --accent-green-light: rgba(52, 211, 153, 0.1);
  --accent-red: #F87171;
  --accent-red-light: rgba(248, 113, 113, 0.1);
  --border-light: #30363D;
  --border-medium: #444C56;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.5);
}

/* ========================================
   1. Reset & Base
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.15; margin-bottom: 0.75rem; letter-spacing: -0.025em; }
h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.25; margin-bottom: 0.75rem; letter-spacing: -0.02em; }
h3 { font-size: 1.35rem; font-weight: 600; line-height: 1.35; margin-bottom: 0.5rem; }
h4 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.5rem; }
h5 { font-size: 1rem; font-weight: 600; line-height: 1.5; margin-bottom: 0.5rem; }
h6 { font-size: 0.875rem; font-weight: 600; line-height: 1.5; color: var(--text-secondary); margin-bottom: 0.5rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-primary);
  line-height: 1.7;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

img { max-width: 100%; height: auto; }

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

li { margin-bottom: 0.3rem; }

small {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ========================================
   2. Container
   ======================================== */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  width: 100%;
}

/* ========================================
   3. Site Header
   ======================================== */

.site-header {
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  z-index: 1000;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.85);
}

[data-theme="dark"] .site-header {
  background: rgba(19,24,37,0.9);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.logo:hover { text-decoration: none; opacity: 0.9; }

.logo-img {
  height: 38px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
}

.logo-dark { display: none; }

[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark  { display: block; }

/* Desktop Nav */
.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.main-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  position: relative;
}

.main-nav a:hover {
  color: var(--accent-primary);
  background: var(--accent-light);
  text-decoration: none;
}

.main-nav a.active {
  color: var(--accent-primary);
  background: var(--accent-light);
  font-weight: 600;
}

/* ---- Pages Dropdown ---- */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  line-height: 1.5;
  white-space: nowrap;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle {
  color: var(--accent-primary);
  background: var(--accent-light);
}

.nav-dropdown-chevron {
  display: inline-block;
  font-size: 0.65rem;
  transition: transform var(--transition);
  margin-top: 1px;
}

.nav-dropdown.open .nav-dropdown-chevron {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.35rem;
  z-index: 1000;
  animation: dropIn 150ms ease-out;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.6rem 0.9rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.nav-dropdown-menu a:hover {
  background: var(--accent-light);
  color: var(--accent-primary);
}

.nav-dropdown-menu a + a {
  margin-top: 1px;
}

/* Header actions */
.dark-mode-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-light);
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.dark-mode-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), #7C3AED);
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

[data-theme="dark"] .dark-mode-toggle::after {
  transform: translateX(20px);
}

.dark-mode-toggle:hover {
  border-color: var(--accent-primary);
}

.toggle-icon { display: none; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  color: var(--text-primary);
  font-size: 1.25rem;
  line-height: 1;
  transition: all var(--transition);
  margin-left: 0.5rem;
}

.mobile-menu-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ========================================
   4. Mobile Nav
   ======================================== */

@media (max-width: 768px) {
  .logo-img {
    height: 32px;
    max-width: 160px;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    gap: 0;
    padding: 0.5rem;
    z-index: 999;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }

  .main-nav.open {
    display: flex;
  }

  .main-nav a {
    display: block;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    border-radius: var(--radius-sm);
    width: 100%;
  }

  /* Mobile dropdown */
  .nav-dropdown {
    width: 100%;
  }

  .nav-dropdown-toggle {
    width: 100%;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    border-radius: var(--radius-sm);
  }

  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--accent-light);
    border-radius: 0;
    margin: 0 0 0 1rem;
    padding: 0.25rem 0;
    animation: none;
  }

  .nav-dropdown-menu a {
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (min-width: 769px) {
  .mobile-menu-btn {
    display: none;
  }
}

/* ========================================
   5. Breadcrumb
   ======================================== */

.breadcrumb {
  padding: 0.65rem 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
}

.breadcrumb ol,
.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0;
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.breadcrumb li + li::before {
  content: "\203A";
  margin: 0 0.5rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.breadcrumb a:hover {
  color: var(--accent-primary);
  text-decoration: none;
}

.breadcrumb li:last-child {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ========================================
   6. Hero
   ======================================== */

.hero {
  padding: 2.75rem 0 1.5rem;
  text-align: center;
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--bg-primary) 100%);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary) 60%, var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 1.15rem;
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ========================================
   7. Calculator Card
   ======================================== */

.calculator-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  max-width: 780px;
  margin: 0 auto 2.5rem;
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.calculator-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-primary), #7C3AED, var(--accent-primary));
  background-size: 200% 100%;
}

/* ========================================
   8. Mode Toggle
   ======================================== */

.calc-mode-toggle {
  display: flex;
  gap: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1.5px solid var(--border-light);
  margin-bottom: 1.5rem;
  background: var(--bg-elevated);
  padding: 3px;
}

.mode-btn {
  flex: 1;
  padding: 0.7rem;
  border: none;
  cursor: pointer;
  background: transparent;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-family: var(--font-sans);
  border-radius: var(--radius-sm);
}

.mode-btn:hover {
  color: var(--text-primary);
}

.mode-btn.active {
  background: var(--accent-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ========================================
   9. Form Groups & Inputs
   ======================================== */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

input[type="number"],
input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-sans);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: all var(--transition);
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

textarea { min-height: 100px; resize: vertical; }

select {
  width: 100%;
  padding: 0.75rem 1rem;
  padding-right: 2.5rem;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-sans);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: all var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23475569' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-position: right 1rem center;
  background-repeat: no-repeat;
  cursor: pointer;
  line-height: 1.5;
}

select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
}

/* Radio Group */
.radio-group {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.radio-group label,
.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.93rem;
  color: var(--text-primary);
  font-weight: 400;
  margin-bottom: 0;
}

.radio-group input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-medium);
  border-radius: 50%;
  transition: all var(--transition);
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  margin: 0;
}

.radio-group input[type="radio"]:checked {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  box-shadow: inset 0 0 0 3px var(--bg-surface);
}

/* ========================================
   10. Buttons
   ======================================== */

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #4F46E5);
  color: #FFFFFF;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary.btn-full { width: 100%; }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border-light);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  line-height: 1.5;
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  border-color: var(--border-medium);
}

.btn-ghost.btn-full { width: 100%; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.form-actions .btn-primary,
.form-actions .btn-ghost {
  flex: 1;
}

/* ========================================
   11. Result Panel
   ======================================== */

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-panel {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.5rem;
  animation: slideIn 350ms ease-out;
}

.result-main {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  text-align: center;
}

.result-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.result-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
}

#pretaxAmount,
#statePretax {
  font-size: 1.8rem;
  color: var(--accent-primary);
}

.result-value--tax {
  color: var(--accent-red);
}

/* Result Bar */
.result-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  margin: 1.5rem 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
}

.result-bar-pretax {
  background: linear-gradient(90deg, var(--accent-primary), #4F46E5);
  transition: width 500ms ease-out;
  border-radius: 999px 0 0 999px;
}

.result-bar-tax {
  background: linear-gradient(90deg, var(--accent-red), #E11D48);
  transition: width 500ms ease-out;
  border-radius: 0 999px 999px 0;
}

/* Result Formula */
.result-formula {
  font-family: var(--font-mono);
  background: var(--bg-primary);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 1rem;
  border: 1px solid var(--border-light);
}

/* Result Actions */
.result-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.result-actions button {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.result-actions button:hover {
  background: var(--accent-light);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ========================================
   12. Ad Slots
   ======================================== */

.ad-slot {
  min-height: 90px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 1.5rem auto;
  max-width: var(--max-width);
  border: 1px dashed var(--border-light);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-slot:empty::before,
.ad-slot ins:empty::before {
  content: "Advertisement";
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.5;
}

/* ========================================
   13. Tables — Universal Styling
   ======================================== */

.table-responsive,
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.state-rates-table,
.data-table,
.rate-table {
  width: 100%;
  border-collapse: collapse;
}

.table-responsive .state-rates-table,
.table-wrap .data-table {
  margin: 0;
}

.state-rates-table th,
.data-table th,
.rate-table th {
  background: var(--bg-elevated);
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border-medium);
  color: var(--text-muted);
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.state-rates-table td,
.data-table td,
.rate-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 0.93rem;
}

.state-rates-table tr:nth-child(even) td,
.data-table tr:nth-child(even) td,
.rate-table tr:nth-child(even) td {
  background: var(--accent-light);
}

.state-rates-table tr:hover td,
.data-table tr:hover td,
.rate-table tr:hover td {
  background: var(--bg-hover);
}

/* Generic tables inside content sections */
.content-section table,
.content-page .container > table,
.content-page .table-responsive > table,
.comparison-table table,
.article-body table,
.article-body .table-responsive > table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.93rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.content-page .table-responsive > table,
.article-body .table-responsive > table,
.comparison-table table {
  margin: 0;
  border: none;
}

.content-section table th,
.content-page .container > table th,
.content-page .table-responsive > table th,
.comparison-table table th,
.article-body table th,
.article-body .table-responsive > table th {
  background: var(--bg-elevated);
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border-medium);
  color: var(--text-muted);
  white-space: nowrap;
}

.content-section table td,
.content-page .container > table td,
.content-page .table-responsive > table td,
.comparison-table table td,
.article-body table td,
.article-body .table-responsive > table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: top;
}

.content-section table tr:nth-child(even) td,
.content-page .container > table tr:nth-child(even) td,
.content-page .table-responsive > table tr:nth-child(even) td,
.comparison-table table tr:nth-child(even) td,
.article-body table tr:nth-child(even) td,
.article-body .table-responsive > table tr:nth-child(even) td {
  background: var(--accent-light);
}

.content-section table tr:hover td,
.content-page .container > table tr:hover td,
.content-page .table-responsive > table tr:hover td,
.comparison-table table tr:hover td,
.article-body table tr:hover td,
.article-body .table-responsive > table tr:hover td {
  background: var(--bg-hover);
}

.content-section table tr:last-child td,
.content-page .container > table tr:last-child td,
.content-page .table-responsive > table tr:last-child td,
.comparison-table table tr:last-child td,
.article-body table tr:last-child td,
.article-body .table-responsive > table tr:last-child td {
  border-bottom: none;
}

/* Comparison tables */
.comparison-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.comparison-table {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.comparison-table h3 {
  padding: 1rem;
  margin: 0;
  font-size: 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-light);
}

.comparison-table table {
  margin: 0;
  border: none;
}

/* ========================================
   14. FAQ Section
   ======================================== */

.faq-section {
  margin: 2.5rem 0;
}

.faq-item {
  border-bottom: 1px solid var(--border-light);
}

.faq-item:first-child {
  border-top: 1px solid var(--border-light);
}

.faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: color var(--transition);
  gap: 1rem;
}

.faq-question:hover {
  color: var(--accent-primary);
}

.faq-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition);
  line-height: 1;
}

.faq-question:hover .faq-icon {
  background: var(--accent-light);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.faq-answer {
  padding: 0 0 1.25rem 0;
  color: var(--text-secondary);
  line-height: 1.75;
  font-size: 0.95rem;
}

.faq-answer[hidden] {
  display: none;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

/* ========================================
   15. Hub Cards Grid
   ======================================== */

.hub-grid,
.hub-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2rem;
}

.hub-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition);
  display: block;
  position: relative;
  overflow: hidden;
}

.hub-card::after {
  content: '\2192';
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: all var(--transition);
}

.hub-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  text-decoration: none;
  border-color: var(--accent-primary);
}

.hub-card:hover::after {
  color: var(--accent-primary);
  transform: translateX(3px);
}

.hub-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
  padding-right: 2rem;
}

.hub-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0;
  line-height: 1.55;
}

/* ========================================
   16. Related Content
   ======================================== */

.related-section {
  margin: 2rem 0;
}

.related-content:has(> .related-link) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.65rem;
  margin: 1rem 0 1.5rem;
}

.related-links {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.65rem;
  margin: 1rem 0;
}

.related-links li {
  margin-bottom: 0;
}

.related-links a,
.related-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--accent-primary);
  font-weight: 500;
  transition: all var(--transition);
  font-size: 0.93rem;
}

.related-links a:hover,
.related-link:hover {
  background: var(--accent-light);
  text-decoration: none;
  border-color: var(--accent-primary);
  transform: translateX(3px);
}

/* ========================================
   17. Content Section
   ======================================== */

.content-section {
  padding: 1.5rem 0;
  margin: 1rem 0;
}

.content-section + .content-section {
  margin-top: 0;
}

.content-section h2 {
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--accent-light);
}

/* ========================================
   18. Example Calc Box
   ======================================== */

.example-calc {
  background: var(--bg-elevated);
  border-left: 4px solid var(--accent-primary);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.93rem;
}

.example-calc p { margin-bottom: 0.5rem; }
.example-calc p:last-child { margin-bottom: 0; }

/* ========================================
   19. State Grid (States Hub)
   ======================================== */

.state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.85rem;
  margin: 1.5rem 0;
}

.state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition);
  text-align: center;
}

.state-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  border-color: var(--accent-primary);
}

.state-card .state-name {
  display: block;
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--text-primary);
}

.state-card .state-rate {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.badge-no-tax {
  display: inline-block;
  background: var(--accent-green);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.2rem;
}

/* ========================================
   20. Article Layout
   ======================================== */

.article-body {
  max-width: 900px;
  margin: 0 auto;
  line-height: 1.75;
}

.article-body > p,
.article-body > ul,
.article-body > ol {
  max-width: 72ch;
}

.article-body p { margin-bottom: 1.25rem; }

.article-body ul,
.article-body ol {
  margin-bottom: 1.25rem;
  padding-left: 1.75rem;
}

.article-body li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.article-body a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-light);
}

.article-body a:hover {
  text-decoration-color: var(--accent-primary);
}

.article-body h2 {
  border-left: 4px solid var(--accent-primary);
  padding-left: 1rem;
  margin: 2.5rem 0 1rem;
  border-bottom: none;
}

.article-body h3 {
  margin: 1.5rem 0 0.75rem;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.93rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.article-body table th {
  background: var(--bg-elevated);
  padding: 0.8rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border-medium);
  color: var(--text-muted);
}

.article-body table td {
  padding: 0.75rem 0.8rem;
  border-bottom: 1px solid var(--border-light);
}

.article-body table tr:nth-child(even) td {
  background: var(--accent-light);
}

/* ========================================
   21. Callout Boxes
   ======================================== */

.callout {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  border-left: 4px solid var(--border-medium);
  background: var(--bg-elevated);
  line-height: 1.7;
}

.callout p:last-child { margin-bottom: 0; }

.callout--tip {
  border-left-color: var(--accent-green);
  background: var(--accent-green-light);
}

.callout--warning {
  border-left-color: var(--accent-orange);
  background: var(--accent-orange-light);
}

/* ========================================
   22. Multi-Item Section
   ======================================== */

.multi-item-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  color: var(--accent-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 0;
  font-family: var(--font-sans);
  transition: color var(--transition);
  margin-top: 0.5rem;
}

.multi-item-toggle:hover { color: var(--accent-hover); }

.multi-item-toggle::before {
  content: '+';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all var(--transition);
}

.multi-item-toggle:hover::before {
  background: var(--accent-hover);
}

#multiItemSection {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.multi-item-row {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.65rem;
}

.multi-item-row input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: var(--font-sans);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.multi-item-row .multi-desc { flex: 2; }
.multi-item-row .multi-amount,
.multi-item-row .multi-rate { flex: 1; }

.multi-item-row .btn-remove {
  background: transparent;
  border: 1.5px solid var(--border-light);
  color: var(--accent-red);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: all var(--transition);
  flex-shrink: 0;
}

.multi-item-row .btn-remove:hover {
  background: var(--accent-red-light);
  border-color: var(--accent-red);
}

.multi-summary {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 0.75rem;
  border: 1px solid var(--border-light);
}

.multi-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.multi-summary-row strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* ========================================
   23. Footer
   ======================================== */

.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  padding: 3.5rem 0 1.5rem;
  margin-top: 4rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 2.5rem;
}

.footer-col strong {
  display: block;
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 700;
}

.footer-col p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: 0.45rem;
}

.footer-col a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color var(--transition);
}

.footer-col a:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

/* LinkedIn Button */
.linkedin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #0a66c2;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  box-shadow: 0 1px 4px rgba(10,102,194,0.18);
  letter-spacing: 0.01em;
}
.linkedin-btn:hover {
  background: #004182;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(10,102,194,0.28);
  color: #fff;
}
.linkedin-icon {
  width: 16px;
  height: 16px;
  fill: #fff;
  flex-shrink: 0;
}

[data-theme="dark"] .linkedin-btn {
  background: #0a66c2;
  box-shadow: 0 1px 6px rgba(10,102,194,0.35);
}
[data-theme="dark"] .linkedin-btn:hover {
  background: #004182;
}

@media (max-width: 600px) {
  .linkedin-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.9rem;
  }
}

/* ========================================
   24. Utility Classes
   ======================================== */

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

.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.grid-note,
.table-note,
.source-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* Content page wrapper */
.content-page {
  padding-top: 0.5rem;
}

.content-page .container > h1 {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.content-page .container > h2 {
  margin-top: 2rem;
}

.main-content {
  padding-top: 0.5rem;
}

/* Intro section */
.intro-section {
  margin-bottom: 1.75rem;
}

.intro-section p {
  font-size: 1.05rem;
  line-height: 1.75;
}

/* Hub section on homepage */
.hub-section {
  margin: 2rem 0;
}

/* ========================================
   25. Home Page Article Content
   ======================================== */

/* HowTo numbered steps */
.howto-steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.howto-steps li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  counter-increment: step;
}

.howto-steps li::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), #4F46E5);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 2px 6px rgba(29,78,216,0.25);
}

.howto-steps li div { flex: 1; }
.howto-steps li strong { display: block; margin-bottom: 0.3rem; color: var(--text-primary); font-size: 0.97rem; }
.howto-steps li p { margin: 0; color: var(--text-secondary); font-size: 0.92rem; line-height: 1.6; }

/* Formula callout box */
.formula-callout {
  background: var(--accent-light);
  border-left: 4px solid var(--accent-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1.1rem 1.4rem;
  margin: 1.5rem 0;
}

.formula-callout p {
  margin: 0.3rem 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.formula-callout p:first-child { font-size: 1rem; }

/* Worked example blocks */
.example-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.1rem 0;
  transition: box-shadow var(--transition);
}

.example-block:hover { box-shadow: var(--shadow-md); }

.example-block h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin: 0 0 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.example-block > p { margin: 0 0 0.65rem; color: var(--text-secondary); font-size: 0.93rem; line-height: 1.6; }

.example-calc {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-primary);
  margin: 0.65rem 0;
}

.example-calc p { margin: 0.2rem 0; }
.example-calc p:last-child { margin-bottom: 0; }

.example-result {
  margin: 0.65rem 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Excel formula box */
.excel-callout {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}

.excel-formula-code {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-green);
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.excel-callout .table-responsive {
  margin-top: 0.75rem;
  border-radius: var(--radius-sm);
}

.excel-callout table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 0;
}

.excel-callout table th {
  background: var(--bg-surface);
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  text-align: left;
  border: 1px solid var(--border-light);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.excel-callout table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-light);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* Printable quick reference card */
.print-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 1.25rem 0;
}

.print-card-formula {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.1rem;
  text-align: center;
  letter-spacing: -0.01em;
}

.print-card .table-responsive {
  margin-bottom: 1.1rem;
  border-radius: var(--radius-sm);
}

.print-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 0;
}

.print-card table th {
  background: var(--bg-elevated);
  padding: 0.5rem 0.85rem;
  font-weight: 600;
  text-align: left;
  border: 1px solid var(--border-light);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.print-card table td {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border-light);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.print-card table tr:nth-child(even) td { background: var(--accent-light); }

.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.print-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* No-tax state highlight */
.no-tax-state td:first-child { color: var(--accent-green); font-weight: 600; }

/* Who-uses H3 subsections */
.who-uses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.who-uses-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
}

.who-uses-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem;
}

.who-uses-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Mistake items */
.mistake-item {
  border-left: 3px solid var(--accent-red);
  padding: 0.85rem 1.1rem;
  margin: 1rem 0;
  background: var(--bg-surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.mistake-item h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-red);
  margin: 0 0 0.4rem;
}

.mistake-item p { margin: 0; color: var(--text-secondary); font-size: 0.92rem; line-height: 1.65; }

/* Table source note */
.table-source {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
}

/* Opening paragraph emphasis */
.opening-para {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin: 0;
}

/* Closing paragraph */
.closing-para {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--accent-primary);
  margin: 0;
}

/* Print styles */
@media print {
  .print-card { border: 2px solid #000; page-break-inside: avoid; }
  header, .main-nav, footer, .ad-slot, .faq-section, .hub-section,
  .related-section, .mobile-menu-btn, .dark-mode-toggle, .hero { display: none !important; }
  .calculator-card, .howto-steps, .example-block { break-inside: avoid; }
}

/* ========================================
   26. Responsive
   ======================================== */

@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
  }

  .comparison-tables {
    grid-template-columns: 1fr;
  }

  .article-body {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.1rem; }

  .container { padding: 0 1rem; }

  .hero {
    padding: 2rem 0 1.25rem;
  }

  .hero h1 {
    font-size: clamp(1.75rem, 6vw, 2.25rem);
  }

  .hero-sub {
    font-size: 1rem;
  }

  .result-main {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .hub-grid,
  .hub-cards {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .related-links,
  .related-content {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .calculator-card {
    padding: 1.35rem;
    margin: 0 0 1.25rem;
    border-radius: var(--radius-lg);
  }

  .state-rates-table th,
  .state-rates-table td,
  .data-table th,
  .data-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.82rem;
  }

  .state-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .ad-slot {
    margin: 1.25rem auto;
  }

  .intro-section {
    margin-bottom: 1.25rem;
  }

  .article-body h2,
  .content-page .container > h2 {
    margin-top: 1.5rem;
  }

  /* ── Print card tablet ───────────────────────────────────────────── */
  .print-card-formula {
    font-size: 0.88rem;
    line-height: 1.5;
  }

  /* ── Excel callout tablet ────────────────────────────────────────── */
  .excel-formula-code {
    font-size: 1rem;
    word-break: break-all;
    overflow-wrap: break-word;
  }

  .excel-callout table th,
  .excel-callout table td {
    font-size: 0.8rem;
    padding: 0.45rem 0.6rem;
  }

  /* ── Who-uses grid tablet — 2 col ───────────────────────────────── */
  .who-uses-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  body { font-size: 15px; }

  .logo-img {
    height: 28px;
    max-width: 130px;
  }

  .container { padding: 0 0.85rem; }

  .site-header .container {
    height: 56px;
  }

  .hero h1 {
    font-size: 1.65rem;
  }

  .hero-sub { font-size: 0.95rem; }

  .btn-primary,
  .btn-ghost {
    width: 100%;
    justify-content: center;
  }

  .form-actions {
    flex-direction: column;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .calculator-card {
    padding: 1.15rem;
    border-radius: var(--radius-md);
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions button {
    width: 100%;
    justify-content: center;
  }

  .radio-group {
    flex-direction: column;
    gap: 0.65rem;
  }

  .calc-mode-toggle {
    flex-direction: column;
  }

  .multi-item-row {
    flex-wrap: wrap;
  }

  .multi-item-row .multi-desc {
    flex: 1 1 100%;
  }

  .state-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .comparison-tables {
    grid-template-columns: 1fr;
  }

  /* ── Print Card mobile ───────────────────────────────────────────── */
  .print-card {
    padding: 1rem 0.85rem;
  }

  .print-card-formula {
    font-size: 0.78rem;
    padding: 0.65rem 0.75rem;
    letter-spacing: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
  }

  .pcf-sep { display: none; }

  .pcf-line {
    display: block;
    white-space: normal;
    text-align: center;
    line-height: 1.45;
  }

  .print-card table th,
  .print-card table td {
    padding: 0.4rem 0.55rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .print-btn {
    width: 100%;
    justify-content: center;
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
  }

  /* ── Excel callout mobile ────────────────────────────────────────── */
  .excel-callout {
    padding: 1rem 0.85rem;
  }

  .excel-formula-code {
    font-size: 0.95rem;
    word-break: break-all;
    overflow-wrap: break-word;
  }

  .excel-callout table th,
  .excel-callout table td {
    padding: 0.4rem 0.55rem;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  /* ── Formula callout mobile ──────────────────────────────────────── */
  .formula-callout {
    font-size: 0.88rem;
    padding: 0.75rem 0.85rem;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* ── Who-uses grid — force single column ─────────────────────────── */
  .who-uses-grid {
    grid-template-columns: 1fr;
  }

  /* ── Example blocks ──────────────────────────────────────────────── */
  .example-block {
    padding: 1rem 0.85rem;
  }

  .example-calc {
    padding: 0.65rem 0.75rem;
    font-size: 0.88rem;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* ── State rates table — tighter columns ─────────────────────────── */
  .state-rates-table th,
  .state-rates-table td {
    font-size: 0.78rem;
    padding: 0.42rem 0.5rem;
    white-space: nowrap;
  }
}

/* ========================================
   26. Print
   ======================================== */

@media print {
  .site-header,
  .site-footer,
  .ad-slot,
  .dark-mode-toggle,
  .mobile-menu-btn,
  .result-actions,
  .breadcrumb {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  .calculator-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .calculator-card::before { display: none; }

  a { color: #000; text-decoration: underline; }

  .result-panel {
    border: 1px solid #ccc;
    animation: none;
  }
}

/* ========================================
   27. Focus Visible
   ======================================== */

*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ========================================
   28. Smooth Transitions
   ======================================== */

button, a, input, select, textarea {
  transition: all var(--transition);
}

/* ========================================
   29. Selection
   ======================================== */

::selection {
  background: var(--accent-primary);
  color: #fff;
}

/* ========================================
   30. Scrollbar
   ======================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   31. Cookie Consent Banner
   ======================================== */

#cookieBanner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #111827;
  border-top: 1px solid #1f2937;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.35);
  animation: slideUpBanner 250ms ease-out;
}

@keyframes slideUpBanner {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

#cookieBanner.hidden {
  display: none;
}

.cookie-text {
  flex: 1;
  min-width: 0;
}

.cookie-text strong {
  display: block;
  color: #f9fafb;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.cookie-text p {
  color: #9ca3af;
  font-size: 0.82rem;
  margin: 0;
  line-height: 1.5;
}

.cookie-text p a {
  color: #facc15;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-text p a:hover {
  color: #fde047;
}

.cookie-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.cookie-btn-accept {
  background: #facc15;
  color: #111827;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.cookie-btn-accept:hover {
  background: #fde047;
  transform: translateY(-1px);
}

.cookie-btn-decline {
  background: transparent;
  color: #d1d5db;
  border: 1.5px solid #4b5563;
  border-radius: 6px;
  padding: 0.5rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.1s;
  white-space: nowrap;
}

.cookie-btn-decline:hover {
  border-color: #9ca3af;
  color: #f9fafb;
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  #cookieBanner {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.2rem 1.2rem;
    gap: 0.85rem;
  }

  .cookie-actions {
    width: 100%;
  }

  .cookie-btn-accept,
  .cookie-btn-decline {
    flex: 1;
    text-align: center;
  }
}

/* ========================================
   32. Legal Disclaimer Bar
   ======================================== */

.legal-disclaimer-bar {
  background: #fefce8;
  border-top: 2px solid #fde68a;
  border-bottom: 2px solid #fde68a;
  padding: 1rem 0;
}

[data-theme="dark"] .legal-disclaimer-bar {
  background: #1c1a06;
  border-color: #78350f;
}

.disclaimer-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.disclaimer-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
  line-height: 1;
}

.disclaimer-text {
  font-size: 0.82rem;
  line-height: 1.6;
  color: #78350f;
}

[data-theme="dark"] .disclaimer-text {
  color: #fde68a;
}

.disclaimer-text strong {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.disclaimer-text a {
  color: #b45309;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.disclaimer-text a:hover {
  color: #92400e;
}

[data-theme="dark"] .disclaimer-text a {
  color: #fcd34d;
}

[data-theme="dark"] .disclaimer-text a:hover {
  color: #fef08a;
}

.disclaimer-official-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin-top: 0.45rem;
  font-size: 0.79rem;
}

.disclaimer-official-links a {
  white-space: nowrap;
}

@media (max-width: 600px) {
  .disclaimer-inner {
    flex-direction: column;
    gap: 0.5rem;
  }
  .disclaimer-icon {
    display: none;
  }
  .disclaimer-official-links {
    gap: 0.35rem 0.85rem;
  }
}

/* ========================================
   33. Back to Top Button
   ======================================== */

.back-to-top {
  /* Positioning */
  position: fixed;
  bottom: 1.75rem;
  right: 1.5rem;
  z-index: 900;

  /* Size & shape */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  padding: 0;

  /* Colour */
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);

  /* Icon */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;

  /* Hidden by default — shown via .visible */
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease,
              background 0.18s ease, box-shadow 0.18s ease;
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.26);
  transform: translateY(-2px);
}

.back-to-top:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

/* Dark mode — already inherits accent colours from CSS vars, but deepen shadow */
[data-theme="dark"] .back-to-top {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .back-to-top:hover {
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.55);
}

/* Mobile — slightly smaller, lower corner so it clears the cookie banner */
@media (max-width: 600px) {
  .back-to-top {
    width: 40px;
    height: 40px;
    bottom: 1.25rem;
    right: 1rem;
  }

  .back-to-top svg {
    width: 18px;
    height: 18px;
  }
}

/* Keep out of print output */
@media print {
  .back-to-top { display: none !important; }
}
