:root {
  --blue: #0081c8;
  --yellow: #f4c300;
  --black-ring: #1a1a2e;
  --green: #009f3d;
  --red: #df0024;

  --gold: #c9a24d;
  --gold-light: #e8d9b0;
  --silver: #9ba8b5;
  --silver-light: #d0d7de;
  --bronze: #b07d56;
  --bronze-light: #d9c1ab;

  --bg: #faf9f7;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #555770;
  --text-muted: #8b8da3;
  --border: #e8e6e1;
  --accent: #0b3d6b;
}

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

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Hero ---- */
.hero {
  max-width: 820px;
  margin: 0 auto;
  padding: 72px 24px 0;
}

.hero-rings {
  display: block;
  width: 80px;
  margin-bottom: 20px;
  opacity: 0.8;
}

.hero-edition {
  font-family: "Inter", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin: 0 0 8px;
}

/* ---- Olympic stripe ---- */
.olympic-stripe {
  display: flex;
  height: 5px;
  width: 120px;
  margin: 10px 0 16px;
  border-radius: 2px;
  overflow: hidden;
  opacity: 0.8;
}

.olympic-stripe span {
  flex: 1;
}

.olympic-stripe span:nth-child(1) { background: var(--blue); }
.olympic-stripe span:nth-child(2) { background: var(--yellow); }
.olympic-stripe span:nth-child(3) { background: var(--black-ring); }
.olympic-stripe span:nth-child(4) { background: var(--green); }
.olympic-stripe span:nth-child(5) { background: var(--red); }

h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.6rem, 5.5vw, 4rem);
  font-weight: 900;
  line-height: 1.08;
  margin: 0 0 20px;
  color: var(--text);
}

h1 em {
  font-style: italic;
  color: var(--accent);
}

.standfirst {
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0;
  font-weight: 300;
}

/* ---- Content ---- */
.content {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

/* ---- Article blocks ---- */
.article-block {
  margin-top: 56px;
}

.article-header {
  margin-bottom: 32px;
}

.section-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--accent);
  padding: 4px 10px;
  border-radius: 3px;
  margin-bottom: 14px;
}

.article-header h2 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 12px;
}

.article-intro {
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0;
  max-width: 560px;
}

/* ---- Charts ---- */
.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  position: relative;
}

.chart-container--large {
  height: 360px;
}

.chart-container--small {
  height: 200px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ---- Export button ---- */
.chart-export-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 7px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s ease, background 0.2s ease;
  z-index: 2;
  line-height: 1;
  color: var(--text-muted);
  font-size: 14px;
}

.chart-container:hover .chart-export-btn {
  opacity: 0.55;
}

.chart-export-btn:hover {
  opacity: 1 !important;
  background: var(--bg);
  color: var(--text-secondary);
}

.chart-caption {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 400;
  padding-left: 2px;
}

/* ---- Separator ---- */
.separator {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 48px 0 0;
}

.separator-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.4;
}

/* ---- Comparison list ---- */
.comparison-list {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.comparison-cell {
  display: flex;
  flex-direction: column;
}

.comparison-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.comparison-title {
  font-family: "Inter", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
  color: var(--text);
  padding-left: 2px;
  flex-shrink: 0;
}

.comparison-title--gold   { color: var(--gold); }
.comparison-title--silver { color: var(--silver); }
.comparison-title--bronze { color: var(--bronze); }

/* ---- Comparison stats ---- */
.stat-paragraph {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0;
}

.stat-badge {
  display: inline-block;
  font-weight: 600;
  color: var(--surface);
  padding: 2px 10px;
  border-radius: 5px;
  font-size: 0.88rem;
}

.stat-badge--total  { background: var(--text); }
.stat-badge--gold   { background: var(--gold); }
.stat-badge--silver { background: var(--silver); }
.stat-badge--bronze { background: var(--bronze); }

.stat-past {
  display: block;
  margin-top: 2px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- Medal showcase ---- */
.medal-showcase {
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
}

.medal-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease;
}

.medal-icon:hover {
  transform: translateY(-3px);
}

.medal-icon svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
}

.chart-container--medium {
  height: 320px;
  max-width: 640px;
}

/* ---- Sport medals list ---- */
.sport-medals-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sport-row {
  border-bottom: 1px solid var(--border);
}

.sport-row:last-child {
  border-bottom: none;
}

.sport-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  cursor: pointer;
  user-select: none;
}

.sport-header:hover .sport-name {
  color: var(--accent);
}

.sport-toggle {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.25s ease;
  flex-shrink: 0;
  width: 12px;
  text-align: center;
}

.sport-row.open .sport-toggle {
  transform: rotate(90deg);
}


.sport-name {
  font-family: "Inter", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  min-width: 140px;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.sport-medals {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  flex: 1;
}

.sport-medal-icon svg {
  width: 22px;
  height: 31px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.08));
  transition: transform 0.2s ease;
}

.sport-medal-icon:hover svg {
  transform: translateY(-2px);
}

.sport-total {
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  min-width: 20px;
  text-align: right;
  flex-shrink: 0;
}

/* Event details (accordion body) */
.sport-events {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.sport-row.open .sport-events {
  max-height: 800px;
}

.event-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 8px 28px;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.event-row:last-child {
  padding-bottom: 14px;
}

.event-name {
  min-width: 140px;
  flex-shrink: 0;
  font-weight: 400;
}

.event-medals {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  flex: 1;
}

.event-medal-icon svg {
  width: 16px;
  height: 22px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.06));
}

.event-total {
  font-size: 0.72rem;
  color: var(--text-muted);
  min-width: 16px;
  text-align: right;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .sport-name {
    min-width: 100px;
    font-size: 0.82rem;
  }

  .sport-medal-icon svg {
    width: 18px;
    height: 25px;
  }

  .event-row {
    padding-left: 20px;
  }

  .event-name {
    min-width: 90px;
    font-size: 0.78rem;
  }

  .event-medal-icon svg {
    width: 14px;
    height: 19px;
  }
}

/* ---- Top athletes ---- */
.top-athletes-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.athlete-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.athlete-row:last-child {
  border-bottom: none;
}

.athlete-rank {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.athlete-rank--1 { color: var(--gold); }
.athlete-rank--2 { color: var(--silver); }
.athlete-rank--3 { color: var(--bronze); }

.athlete-info {
  flex: 1;
  min-width: 0;
}

.athlete-name {
  font-family: "Inter", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.athlete-detail {
  font-family: "Inter", sans-serif;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 400;
  display: block;
  margin-top: 1px;
}

.athlete-medals {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.athlete-medal-icon svg {
  width: 20px;
  height: 28px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.08));
}

@media (max-width: 640px) {
  .athlete-name {
    font-size: 0.84rem;
  }

  .athlete-detail {
    font-size: 0.7rem;
  }

  .athlete-medal-icon svg {
    width: 16px;
    height: 22px;
  }
}

/* ---- Allez les bleus ---- */
.allez-les-bleus {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 24px 32px;
}

.allez-les-bleus p {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--text);
}

.allez-les-bleus p em {
  font-style: italic;
  color: var(--accent);
}

.flag-fr {
  display: inline-flex;
  width: 22px;
  height: 15px;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  background: linear-gradient(to right, #002395 33.33%, #ffffff 33.33%, #ffffff 66.66%, #ed2939 66.66%);
}

/* ---- Footer ---- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-rings {
  display: block;
  width: 48px;
  opacity: 0.65;
  margin-bottom: 10px;
}

.footer-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 20px 24px;
}

.footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-contribute {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-contribute:hover {
  color: var(--accent);
}

.footer-contribute svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.footer code {
  font-size: 0.8rem;
  background: #f0eeeb;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ---- Animations ---- */
.article-block {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.7s ease forwards;
}

.article-block:nth-child(1) { animation-delay: 0.1s; }
.article-block:nth-child(3) { animation-delay: 0.25s; }

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .hero {
    padding-top: 48px;
  }

  h1 {
    font-size: 2.2rem;
  }

  .standfirst {
    font-size: 1rem;
  }

  .chart-container--large {
    height: 280px;
  }

  .chart-container--small {
    height: 180px;
  }

  .chart-container {
    padding: 14px;
  }
}
