/* =============================================
   BRACKETS PAGE STYLES
   ============================================= */

/* Hero */
.hero-section {
  padding: 3rem 0 2rem;
  text-align: center;
}

.hero-section h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin: 0 0 1rem;
  line-height: 1.2;
}

.hero-section .amp {
  color: var(--accent);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Explorer Controls */
.explorer-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.control-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.control-group .optional {
  font-weight: 400;
  text-transform: none;
  opacity: 0.6;
}

.control-group select,
.control-group input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.control-group select:focus,
.control-group input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Bracket Table */
.bracket-table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.bracket-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.bracket-table th {
  background: var(--card-bg);
  padding: 0.8rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
}

.bracket-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.bracket-table tbody tr:last-child td {
  border-bottom: none;
}

.bracket-table tbody tr.active-bracket {
  background: rgba(37, 99, 235, 0.08);
}

[data-theme="dark"] .bracket-table tbody tr.active-bracket {
  background: rgba(96, 165, 250, 0.1);
}

.bracket-table tbody tr.active-bracket td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.bracket-table tbody tr.partial-bracket {
  background: rgba(37, 99, 235, 0.04);
}

.bracket-table .rate-cell {
  font-weight: 700;
  white-space: nowrap;
}

.bracket-table .col-tax,
.bracket-table .col-cumulative {
  text-align: right;
}

.bracket-table td.col-tax,
.bracket-table td.col-cumulative {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.9rem;
}

.bracket-table td.col-tax.zero,
.bracket-table td.col-cumulative.zero {
  color: var(--text-muted);
  opacity: 0.5;
}

.bracket-table tfoot td {
  padding: 0.8rem 1rem;
  font-weight: 700;
  background: var(--card-bg);
  border-top: 2px solid var(--border);
}

/* Rate badges */
.rate-badge,
.rate-dot {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.b10 {
  background: #22c55e;
}
.b12 {
  background: #84cc16;
}
.b22 {
  background: #eab308;
}
.b24 {
  background: #f97316;
}
.b32 {
  background: #ef4444;
}
.b35 {
  background: #dc2626;
}
.b37 {
  background: #991b1b;
}

/* Bracket Visual Bar */
.bracket-visual {
  display: flex;
  height: 48px;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.5rem 0;
  position: relative;
}

.bracket-bar-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  transition: flex-basis 0.4s ease;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.bracket-bar-segment span {
  white-space: nowrap;
  padding: 0 0.3rem;
}

.bracket-bar-segment.seg-10 {
  background: #22c55e;
}
.bracket-bar-segment.seg-12 {
  background: #84cc16;
}
.bracket-bar-segment.seg-22 {
  background: #eab308;
}
.bracket-bar-segment.seg-24 {
  background: #f97316;
}
.bracket-bar-segment.seg-32 {
  background: #ef4444;
}
.bracket-bar-segment.seg-35 {
  background: #dc2626;
}
.bracket-bar-segment.seg-37 {
  background: #991b1b;
}

.bracket-bar-segment.inactive {
  opacity: 0.25;
}

.bracket-bar-marker {
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 3px;
  background: var(--text);
  border-radius: 2px;
  z-index: 2;
  transition: left 0.4s ease;
}

/* Summary Cards */
.bracket-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}

.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.summary-card.highlight {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.04);
}

[data-theme="dark"] .summary-card.highlight {
  background: rgba(96, 165, 250, 0.08);
}

.summary-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.summary-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
}

.summary-card.highlight .summary-value {
  color: var(--accent);
}

.summary-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Content Columns */
.content-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-top: 1.5rem;
}

.content-col h3 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.6rem;
  color: var(--text);
}

.content-col h3:first-child {
  margin-top: 0;
}

.content-col p {
  color: var(--text-muted);
  line-height: 1.75;
  margin: 0 0 1rem;
}

/* Example Breakdown */
.example-breakdown {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
}

.example-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.example-row:last-of-type {
  border-bottom: none;
}

.ex-bracket {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  min-width: 42px;
  text-align: center;
}

.ex-range {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.ex-tax {
  font-weight: 700;
  font-size: 0.9rem;
  font-family: "SF Mono", "Fira Code", monospace;
}

.example-total {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 2px solid var(--border);
  font-size: 0.95rem;
}

.ex-effective {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

/* Static Tables (crawlable) */
.static-table-wrap {
  overflow-x: auto;
  margin: 1rem 0 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.static-table {
  width: 100%;
  border-collapse: collapse;
}

.static-table th {
  background: var(--card-bg);
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.static-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.static-table tbody tr:last-child td {
  border-bottom: none;
}

.static-table td:first-child {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

/* Comparison Table */
.comparison-table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
}

.comparison-table th {
  background: var(--card-bg);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.comparison-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.93rem;
}

.comparison-table tbody tr:last-child td {
  border-bottom: none;
}

.change-positive {
  color: #22c55e;
  font-weight: 600;
}

/* Deduction Cards */
.deduction-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.deduction-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.ded-status {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.ded-values {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.ded-old {
  color: var(--text-muted);
}

.ded-arrow {
  color: var(--text-muted);
}

.ded-new {
  font-weight: 700;
  color: var(--text);
}

.ded-change {
  color: #22c55e;
  font-weight: 700;
  font-size: 1.1rem;
}

/* FAQ */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  transition: background 0.2s;
}

.faq-item summary:hover {
  background: var(--border);
}

.faq-item summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
}

.faq-answer p {
  margin: 0.75rem 0 0;
  line-height: 1.75;
  color: var(--text-muted);
}

/* CTA */
.cta-block {
  text-align: center;
  padding: 2rem 0;
}

.cta-block h2 {
  margin-bottom: 0.75rem;
}

.cta-block p {
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 1.5rem;
  line-height: 1.7;
}

.btn {
  display: inline-block;
  padding: 0.85rem 2rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

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

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

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: 1.05rem;
}

/* Ad Slots */
.ad-slot {
  max-width: 728px;
  margin: 1.5rem auto;
  text-align: center;
}

.ad-placeholder {
  background: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
  .explorer-controls {
    grid-template-columns: 1fr;
  }

  .bracket-summary {
    grid-template-columns: 1fr 1fr;
  }

  .content-columns {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .deduction-cards {
    grid-template-columns: 1fr;
  }

  .bracket-table .col-cumulative {
    display: none;
  }

  .comparison-table td,
  .comparison-table th {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .bracket-summary {
    grid-template-columns: 1fr;
  }

  .bracket-visual {
    height: 36px;
  }

  .ded-values {
    flex-direction: column;
    gap: 0.2rem;
  }

  .ded-arrow {
    transform: rotate(90deg);
  }
}
