/* ============================================================
   Golf Majors Statistics — Stylesheet
   Structure: Variables → Reset → Base → Layout →
              Components → Utilities → Responsive
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --colour-green-900: #0f2419;
  --colour-green-800: #1a3a2a;
  --colour-green-700: #2d5e3e;
  --colour-green-600: #4a8c5c;
  --colour-gold-500:  #c9a84c;
  --colour-gold-300:  #e8c96a;
  --colour-cream:     #f8f5ee;
  --colour-white:     #ffffff;
  --colour-text:      #1a1a1a;
  --colour-muted:     #666666;
  --colour-border:    #ddd6c8;
  --colour-under:     #1a6e2a;
  --colour-over:      #c0392b;

  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.07);
  --shadow-md: 0 3px 12px rgba(0, 0, 0, 0.09);
  --shadow-lg: 0 6px 24px rgba(0, 0, 0, 0.12);

  --max-width: 1200px;
  --page-gutter: 2rem;
}

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

html { scroll-behavior: smooth; }

img, svg { display: block; max-width: 100%; }

button { cursor: pointer; font-family: inherit; }

/* ── Base ───────────────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--colour-text);
  background-color: var(--colour-cream);
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  line-height: 1.2;
}

a {
  color: var(--colour-green-700);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(
    140deg,
    var(--colour-green-900) 0%,
    var(--colour-green-800) 55%,
    var(--colour-green-700) 100%
  );
  color: var(--colour-white);
  padding: 3.5rem var(--page-gutter) 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.hero__icon {
  font-size: 3rem;
  margin-bottom: 0.6rem;
  display: block;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: 0.03em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero__title em {
  color: var(--colour-gold-300);
  font-style: normal;
}

.hero__subtitle {
  margin-top: 0.5rem;
  font-size: 1rem;
  opacity: 0.8;
  font-style: italic;
  font-family: var(--font-serif);
}

/* ── Summary stats ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  padding-block: 2rem;
}

.stat-card {
  background: var(--colour-white);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-card__number {
  font-size: 2.4rem;
  font-weight: 700;
  font-family: var(--font-serif);
  color: var(--colour-green-700);
  line-height: 1;
}

.stat-card__label {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--colour-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs__nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--colour-border);
  padding-bottom: 0;
}

.tabs__btn {
  padding: 0.7rem 1.3rem;
  border: none;
  background: none;
  font-size: 0.9rem;
  color: var(--colour-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color 0.15s, border-color 0.15s;
  font-family: var(--font-sans);
}

.tabs__btn:hover { color: var(--colour-green-700); }

.tabs__btn[aria-selected="true"] {
  color: var(--colour-green-900);
  border-bottom-color: var(--colour-gold-500);
  font-weight: 600;
}

.tabs__panel { display: none; padding-block: 1.5rem; }
.tabs__panel[aria-hidden="false"] { display: block; }

/* ── Data table ─────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--colour-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
}

.data-table thead tr {
  background: var(--colour-green-800);
  color: var(--colour-white);
}

.data-table thead th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 500;
  font-family: var(--font-sans);
}

.data-table thead th.center { text-align: center; }

.data-table tbody tr {
  border-bottom: 1px solid var(--colour-border);
  transition: background 0.1s;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f3ede0; }

.data-table td {
  padding: 0.8rem 1rem;
  vertical-align: middle;
}

.data-table td.center { text-align: center; }

/* ── Table cell components ──────────────────────────────────── */
.year-badge {
  display: inline-block;
  background: var(--colour-green-800);
  color: var(--colour-white);
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.tournament-logo {
  height: 28px;
  width: auto;
  border-radius: var(--radius-sm);
}

.winner__name { font-weight: 600; }
.winner__country { font-size: 0.75rem; color: var(--colour-muted); }

.score {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.92rem;
  font-weight: 700;
}
.score--under { color: var(--colour-under); }
.score--even  { color: var(--colour-muted); }
.score--over  { color: var(--colour-over); }

.row--cancelled td { color: var(--colour-muted); font-style: italic; background: #f9f9f6; }
.row--cancelled td:first-child { font-style: normal; }

/* ── By-major section ───────────────────────────────────────── */
.tournament-block { margin-bottom: 2.5rem; }

.tournament-block__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  color: var(--colour-white);
}

.tournament-block__header--masters { background: linear-gradient(90deg, #1a5c2a, #3a8c46); }
.tournament-block__header--pga     { background: linear-gradient(90deg, #1a2f6e, #2e50b8); }
.tournament-block__header--usopen  { background: linear-gradient(90deg, #002d6e, #1556b8); }
.tournament-block__header--theopen { background: linear-gradient(90deg, #0a3d1f, #1a6e35); }

.tournament-block__logo { height: 36px; width: auto; }

.tournament-block__info {}

.tournament-block__name {
  font-size: 1.1rem;
  font-family: var(--font-serif);
}

.tournament-block__meta {
  font-size: 0.78rem;
  opacity: 0.82;
  margin-top: 0.1rem;
}

/* ── Leaderboard cards ──────────────────────────────────────── */
.leaders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.25rem;
}

.leader-card {
  background: var(--colour-white);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.leader-card__header {
  background: var(--colour-green-800);
  color: var(--colour-white);
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
}

.leader-card__body { padding: 0.5rem 1rem 0.75rem; }

.leader-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--colour-border);
}

.leader-entry:last-child { border-bottom: none; }

.leader-entry__text {}
.leader-entry__name { font-weight: 600; font-size: 0.9rem; }
.leader-entry__detail { font-size: 0.73rem; color: var(--colour-muted); margin-top: 0.1rem; }

.leader-entry__badge {
  flex-shrink: 0;
  background: var(--colour-gold-500);
  color: var(--colour-green-900);
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem var(--page-gutter);
  font-size: 0.78rem;
  color: var(--colour-muted);
  border-top: 1px solid var(--colour-border);
  margin-top: 2rem;
}

.footer__links { margin-top: 0.5rem; }
.footer__links a { margin-inline: 0.4rem; }

/* ── Loading & error states ─────────────────────────────────── */
.state-loading,
.state-error {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--colour-muted);
  font-style: italic;
}

.state-error { color: var(--colour-over); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --page-gutter: 1rem; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  .data-table thead th,
  .data-table td { padding: 0.6rem 0.6rem; font-size: 0.8rem; }

  .tournament-block__logo { height: 28px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
  .tabs__btn { padding: 0.6rem 0.85rem; font-size: 0.82rem; }
}
