/* ═══════════════════════════════════════════════════════════
   SWISS POSTER / BAUHAUS — Credit Card Rewards Brazil 2026
   Strict geometric grid · Primary color blocks · Oversized stats
   Helvetica-adjacent type · Clean ruled lines · Data as bold graphic
   ═══════════════════════════════════════════════════════════ */

:root {
  --white: #ffffff;
  --black: #0a0a0a;
  --red: #e63226;
  --blue: #1a4bbd;
  --yellow: #f5c518;
  --gray-100: #f5f5f5;
  --gray-200: #e8e8e8;
  --gray-400: #999999;
  --gray-600: #555555;
  --rule: var(--black);
  --rule-light: var(--gray-200);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--black);
  font-family: "Barlow", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

.page-shell {
  position: relative;
  width: min(1280px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

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

/* ── Typography ─────────────────────────────────────────── */

h1,
h2 {
  margin: 0;
  font-family: "Bebas Neue", "Barlow Condensed", "Helvetica Neue", sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 0.88;
}

p {
  margin: 0;
}

/* ── Geometric color blocks ─────────────────────────────── */

.color-block {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.color-block--red {
  top: 0;
  right: 0;
  width: 48px;
  height: 100%;
  background: var(--red);
}

.color-block--blue {
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: var(--blue);
}

.color-block--yellow {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: var(--yellow);
}

/* ── Ruled lines ────────────────────────────────────────── */

.hero-rule {
  height: 3px;
  background: var(--black);
  width: 100%;
}

/* ── Rise animation ─────────────────────────────────────── */

.hero,
.control-panel,
.ranking-panel,
.chart-panel,
.note-panel {
  animation: rise 500ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ════════════════════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════════════════════ */

.hero {
  margin-bottom: 2rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0;
}

.hero-title-block {
  grid-column: 1;
  grid-row: 1 / 3;
  padding: 2rem 2rem 2rem 0;
  border-right: 3px solid var(--black);
}

.eyebrow,
.section-label,
.winner-strip span,
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: "Barlow Condensed", "Helvetica Neue", sans-serif;
}

.eyebrow,
.section-label,
.winner-strip span {
  color: var(--gray-400);
}

h1 {
  margin-top: 1rem;
  font-size: clamp(5rem, 12vw, 10rem);
  line-height: 0.88;
  letter-spacing: 0.01em;
}

h1 .year {
  color: var(--red);
}

.hero-highlight {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  padding: 2rem 2rem 2rem calc(2rem + 48px);
  background: var(--black);
  color: var(--white);
  overflow: hidden;
}

.hero-highlight .color-block--red {
  left: 0;
  right: auto;
  width: 48px;
}

.hero-highlight .kicker {
  color: var(--gray-400);
}

.hero-highlight strong {
  display: block;
  margin-top: 0.6rem;
  font-family: "Bebas Neue", "Barlow Condensed", sans-serif;
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  text-transform: uppercase;
  line-height: 0.92;
  letter-spacing: 0.02em;
}

.hero-value {
  margin-top: 1.2rem;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  letter-spacing: 0.02em;
  line-height: 0.88;
  color: var(--yellow);
}

.hero-rationale {
  margin-top: 0.8rem;
  color: var(--gray-400);
  line-height: 1.6;
  font-size: 0.92rem;
}

.hero-lede {
  grid-column: 2;
  grid-row: 2;
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--gray-200);
}

.lede {
  color: var(--gray-600);
  font-size: 0.98rem;
  line-height: 1.7;
  max-width: 42rem;
}

/* ════════════════════════════════════════════════════════════
   LAYOUT GRID
   ════════════════════════════════════════════════════════════ */

.layout {
  display: grid;
  gap: 0;
  grid-template-columns: clamp(300px, 30vw, 380px) minmax(0, 1fr);
  grid-template-areas:
    "rail chart"
    "rail notes";
  align-items: start;
  border-top: 3px solid var(--black);
}

.layout > * {
  min-width: 0;
}

.control-rail {
  grid-area: rail;
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  gap: 0;
  width: 100%;
  min-width: 0;
  border-right: 3px solid var(--black);
}

/* ════════════════════════════════════════════════════════════
   PANELS — sharp, ruled, geometric
   ════════════════════════════════════════════════════════════ */

.panel {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  border: none;
  border-radius: 0;
  background: var(--white);
  box-shadow: none;
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--black);
}

.panel-head p,
.panel-head output {
  color: var(--gray-600);
}

.panel-head h2 {
  margin-top: 0.2rem;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.88;
}

/* ── Control Panel ──────────────────────────────────────── */

.control-panel {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

.control-panel output {
  font-family: "Bebas Neue", sans-serif;
  font-size: 2rem;
  letter-spacing: 0.02em;
  line-height: 1;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  margin: 1.5rem 0 0.5rem;
  background: var(--black);
  outline: none;
  border-radius: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--red);
  border: 3px solid var(--black);
  border-radius: 0;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--red);
  border: 3px solid var(--black);
  border-radius: 0;
  cursor: pointer;
}

.spend-scale {
  display: flex;
  justify-content: space-between;
  color: var(--gray-400);
  font-size: 0.78rem;
  font-family: "Barlow Condensed", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.winner-strip {
  margin-top: 1.4rem;
  padding: 1.2rem;
  background: var(--blue);
  color: var(--white);
}

.winner-strip span {
  color: rgba(255, 255, 255, 0.6);
}

.winner-strip strong {
  display: block;
  margin-top: 0.3rem;
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.winner-strip small {
  display: block;
  margin-top: 0.4rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  font-size: 0.88rem;
}

.fine-print,
.sources,
.note-panel p,
.note-panel li {
  color: var(--gray-600);
  line-height: 1.7;
}

.fine-print {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.88rem;
}

/* ── Ranking Panel ──────────────────────────────────────── */

.ranking-panel {
  background: var(--gray-100);
  padding-left: calc(1.5rem + 6px);
}

.quick-stats {
  display: grid;
  gap: 0;
}

.stat-card {
  display: grid;
  gap: 0.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--gray-200);
  background: transparent;
  transition: background-color 150ms ease;
}

.stat-card:last-child {
  border-bottom: none;
}

.stat-card:hover {
  background: var(--white);
}

.stat-card.is-leading {
  background: var(--white);
  border-left: 4px solid var(--red);
  padding-left: 1rem;
  margin-left: -1rem;
}

.stat-rank {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.stat-rank small {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--black);
}

.stat-rank .swatch {
  width: 14px;
  height: 14px;
  border-radius: 0;
}

.stat-card strong {
  font-family: "Bebas Neue", sans-serif;
  font-size: 2rem;
  letter-spacing: 0.02em;
  line-height: 1;
}

.stat-card > div > small {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: "Barlow Condensed", sans-serif;
  color: var(--gray-600);
}

.stat-meta {
  color: var(--gray-400);
  font-size: 0.88rem;
}

.stat-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--black);
  border-radius: 0;
  background: var(--white);
  color: var(--black);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
}

.badge.badge-fee {
  border-color: var(--red);
  color: var(--red);
}

.badge.badge-waiver {
  border-color: var(--blue);
  color: var(--blue);
}

.badge.badge-assumption {
  border-color: var(--yellow);
  color: #8a6d00;
  background: var(--yellow);
}

/* ════════════════════════════════════════════════════════════
   CHART PANEL
   ════════════════════════════════════════════════════════════ */

.chart-panel {
  grid-area: chart;
  min-height: 100%;
  padding: 1.5rem;
  padding-bottom: 1.2rem;
  width: 100%;
  min-width: 0;
  border-bottom: 1px solid var(--gray-200);
}

.chart-topline {
  display: grid;
  gap: 1rem;
}

.chart-insight {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border: 2px solid var(--black);
  background: var(--yellow);
}

.chart-insight strong {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-insight p {
  color: var(--black);
  line-height: 1.55;
  font-size: 0.92rem;
}

.chart-frame {
  margin-top: 1rem;
  min-height: 480px;
  width: 100%;
  background: var(--white);
  border: 2px solid var(--black);
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

/* ── Legend ──────────────────────────────────────────────── */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 1rem;
  border-top: 2px solid var(--black);
  padding-top: 0.8rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.82rem;
  font-family: "Barlow Condensed", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  transition: background-color 150ms ease;
}

.legend-item:hover {
  background: var(--gray-100);
}

.legend-item.active {
  border-color: var(--black);
  background: var(--black);
  color: var(--white);
}

.legend-item.active .swatch {
  outline: 2px solid var(--white);
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 0;
}

/* ════════════════════════════════════════════════════════════
   NOTES
   ════════════════════════════════════════════════════════════ */

.notes-stack {
  grid-area: notes;
  display: grid;
  gap: 0;
  width: 100%;
  min-width: 0;
}

.note-panel {
  padding: 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  width: 100%;
}

.note-panel:last-child {
  border-bottom: 3px solid var(--black);
}

.note-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  cursor: pointer;
  list-style: none;
}

.note-panel summary::-webkit-details-marker {
  display: none;
}

.note-panel summary::after {
  content: "+";
  font-family: "Bebas Neue", sans-serif;
  font-size: 2rem;
  line-height: 1;
  color: var(--red);
}

.note-panel[open] summary::after {
  content: "−";
}

.note-panel[open] summary {
  border-bottom: 1px solid var(--gray-200);
}

.note-panel strong {
  display: block;
  margin-top: 0.15rem;
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.6rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}

.note-panel p,
.note-panel ul {
  margin: 0;
  padding: 0 1.5rem 1.2rem;
}

.note-panel ul {
  padding-left: 2.8rem;
}

.note-panel li + li {
  margin-top: 0.8rem;
}

.note-panel li::marker {
  color: var(--red);
}

/* ════════════════════════════════════════════════════════════
   FOCUS STATES
   ════════════════════════════════════════════════════════════ */

input[type="range"]:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

details summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */

@media (max-width: 980px) {
  .page-shell {
    width: min(100% - 1.5rem, 1280px);
    padding-top: 1.5rem;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .hero-title-block {
    grid-column: 1;
    grid-row: 1;
    padding: 2rem 0;
    border-right: none;
    border-bottom: 3px solid var(--black);
  }

  .hero-highlight {
    grid-column: 1;
    grid-row: 2;
    padding: 2rem;
    padding-left: calc(2rem + 48px);
  }

  .hero-lede {
    grid-column: 1;
    grid-row: 3;
    padding: 1.5rem 0;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "rail"
      "chart"
      "notes";
  }

  .control-rail {
    position: static;
    border-right: none;
    border-bottom: 3px solid var(--black);
  }

  h1 {
    font-size: clamp(4rem, 16vw, 7rem);
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: calc(100% - 1rem);
    padding-bottom: 3rem;
  }

  h1 {
    font-size: clamp(3.2rem, 18vw, 5rem);
  }

  .hero-value {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .hero-highlight {
    padding: 1.5rem;
    padding-left: calc(1.5rem + 36px);
  }

  .hero-highlight .color-block--red {
    width: 36px;
  }

  .panel {
    padding: 1.2rem;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-frame {
    min-height: 340px;
  }

  .note-panel summary {
    padding: 1rem 1.2rem;
  }

  .note-panel strong {
    font-size: 1.35rem;
  }

  .note-panel p,
  .note-panel ul {
    padding-right: 1.2rem;
    padding-left: 1.2rem;
  }

  .note-panel ul {
    padding-left: 2.2rem;
  }

  .ranking-panel {
    padding-left: calc(1.2rem + 6px);
  }

  .stat-card strong {
    font-size: 1.6rem;
  }

  .control-panel output {
    font-size: 1.6rem;
  }
}
