/* ── LeatherOnWillow — Editorial Cricket Aesthetic ── */

:root {
  --cream:    #f5f0e8;
  --parchment:#ede6d6;
  --ink:      #1a1410;
  --ink-mid:  #3d3228;
  --ink-dim:  #7a6a58;
  --red:      #c0392b;
  --red-light:#e74c3c;
  --green:    #27573a;
  --green-light:#2ecc71;
  --gold:     #b8860b;
  --gold-light:#f0c040;
  --blue:     #1a3a5c;
  --white:    #ffffff;
  --radius:   4px;
  --shadow:   0 2px 12px rgba(26,20,16,0.12);
  --shadow-lg:0 8px 32px rgba(26,20,16,0.18);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(184,134,11,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(39,87,58,0.05) 0%, transparent 60%);
}

/* ── HEADER ── */
.site-header {
  background: var(--ink);
  color: var(--cream);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--gold);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 60px;
}
.logo {
  text-decoration: none;
  color: var(--cream);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.logo-icon { font-size: 20px; }
.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.logo-text em {
  font-style: normal;
  color: var(--gold-light);
}
.main-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.main-nav::-webkit-scrollbar { display: none; }
.nav-link {
  color: rgba(245,240,232,0.6);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.nav-link:hover { color: var(--cream); background: rgba(255,255,255,0.08); }
.nav-link.active {
  color: var(--ink);
  background: var(--gold-light);
  border-color: var(--gold-light);
}
.header-date {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--ink-dim);
  color: rgba(245,240,232,0.4);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── DATE STRIP ── */
.date-strip {
  background: var(--ink-mid);
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 24px;
  max-width: 100%;
}
.date-strip::-webkit-scrollbar { display: none; }
.date-btn {
  background: none;
  border: none;
  color: rgba(245,240,232,0.5);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.date-btn:hover { color: var(--cream); }
.date-btn.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold-light);
}

/* ── MAIN ── */
.site-main { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

.matches-outer { }
.matches-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 12px;
}
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -1px;
}
.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--red-light);
  letter-spacing: 1px;
}
.live-dot {
  width: 7px; height: 7px;
  background: var(--red-light);
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ── MATCHES GRID ── */
.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* ── MATCH CARD ── */
.match-card {
  background: var(--white);
  border: 1px solid rgba(26,20,16,0.1);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.match-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.match-card.is-live { border-color: var(--red); border-width: 2px; }
.match-card.is-live::before {
  content: 'LIVE';
  position: absolute;
  top: 10px; right: 10px;
  background: var(--red);
  color: white;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 2px;
}

.card-league {
  background: var(--ink);
  color: rgba(245,240,232,0.7);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-format {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 2px;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.fmt-T20   { background: rgba(240,192,64,0.2); color: var(--gold-light); }
.fmt-TEST  { background: rgba(39,87,58,0.3); color: #6dd9a0; }
.fmt-ODI   { background: rgba(26,58,92,0.3); color: #7ab8f5; }
.fmt-T10   { background: rgba(192,57,43,0.2); color: #e88; }

.card-body { padding: 14px 16px; }

.card-team {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.team-logo {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--parchment);
  flex-shrink: 0;
}
.team-logo-placeholder {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--parchment);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-dim);
  flex-shrink: 0;
}
.team-name {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-score {
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}
.team-score .overs {
  font-size: 10px;
  color: var(--ink-dim);
  display: block;
  text-align: right;
}
.score-dash { color: var(--ink-dim); }

.card-divider {
  border: none;
  border-top: 1px solid rgba(26,20,16,0.06);
  margin: 4px 0;
}

.card-result {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-dim);
  font-style: italic;
  min-height: 16px;
}
.card-result.win { color: var(--green); font-style: normal; font-weight: 500; }
.card-result.scheduled { color: var(--ink-dim); }

.card-footer {
  background: var(--parchment);
  padding: 6px 16px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--ink-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── LOADING STATE ── */
.loading-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 80px 0;
  color: var(--ink-dim);
  font-size: 14px;
}
.stumps-anim {
  position: relative;
  width: 48px;
  height: 50px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.stump {
  width: 6px;
  height: 40px;
  background: var(--ink);
  border-radius: 2px 2px 0 0;
  animation: stumpsWobble 1.2s ease-in-out infinite;
}
.stump:nth-child(2) { animation-delay: 0.1s; }
.stump:nth-child(3) { animation-delay: 0.2s; }
.bail {
  position: absolute;
  top: 6px;
  height: 4px;
  width: 16px;
  background: var(--gold);
  border-radius: 2px;
  animation: bailFly 1.2s ease-in-out infinite;
}
.bail:nth-child(4) { left: 0; animation-delay: 0s; }
.bail:nth-child(5) { right: 0; animation-delay: 0.05s; }
@keyframes stumpsWobble {
  0%, 80%, 100% { transform: scaleY(1); }
  40% { transform: scaleY(0.95) translateY(2px); }
}
@keyframes bailFly {
  0%, 60%, 100% { transform: translateY(0) rotate(0deg); opacity: 1; }
  30% { transform: translateY(-14px) rotate(15deg); opacity: 0.7; }
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--ink-dim);
  font-size: 14px;
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,20,16,0.7);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--cream);
  border-radius: 8px;
  width: 100%;
  max-width: 800px;
  position: relative;
  margin: auto;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: rgba(26,20,16,0.1);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: rgba(26,20,16,0.2); }

/* ── SCORECARD ── */
.sc-header {
  background: var(--ink);
  color: var(--cream);
  padding: 24px;
}
.sc-league {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: rgba(245,240,232,0.5);
  letter-spacing: 1px;
  margin-bottom: 16px;
  text-transform: uppercase;
}
.sc-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.sc-team { display: flex; flex-direction: column; gap: 6px; }
.sc-team.away { text-align: right; align-items: flex-end; }
.sc-team-name {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
}
.sc-team-score {
  font-family: 'DM Mono', monospace;
  font-size: 26px;
  font-weight: 500;
  color: var(--gold-light);
}
.sc-team-info {
  font-size: 11px;
  color: rgba(245,240,232,0.5);
}
.sc-vs {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  color: rgba(245,240,232,0.3);
  font-style: italic;
}
.sc-result {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(245,240,232,0.1);
  font-size: 14px;
  font-weight: 500;
  color: var(--gold-light);
  text-align: center;
}
.sc-meta {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 8px;
}
.sc-meta-item {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: rgba(245,240,232,0.4);
  display: flex;
  align-items: center;
  gap: 4px;
}

.sc-body { padding: 24px; }

.sc-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 2px solid rgba(26,20,16,0.1);
}
.sc-tab {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.sc-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.sc-tab:hover { color: var(--ink); }

.sc-panel { display: none; }
.sc-panel.active { display: block; }

/* Innings block */
.innings-block { margin-bottom: 28px; }
.innings-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.innings-logo {
  width: 20px; height: 20px;
  border-radius: 50%;
  object-fit: contain;
}

/* Tables */
.sc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}
.sc-table th {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-dim);
  text-align: right;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(26,20,16,0.1);
  white-space: nowrap;
}
.sc-table th:first-child { text-align: left; }
.sc-table td {
  padding: 7px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(26,20,16,0.05);
}
.sc-table td:first-child { text-align: left; }
.sc-table tr:last-child td { border-bottom: none; }
.sc-table tr:hover td { background: rgba(26,20,16,0.03); }
.sc-table .player-name { font-weight: 500; }
.sc-table .dismissal { font-size: 11px; color: var(--ink-dim); font-style: italic; }
.sc-table .top-score { color: var(--green); font-weight: 700; }
.sc-table .not-out { color: var(--green); }
.sc-table .extras-row td { color: var(--ink-dim); font-style: italic; border-top: 1px solid rgba(26,20,16,0.08); }
.sc-table .total-row td { font-weight: 700; border-top: 2px solid rgba(26,20,16,0.15); }

.sr-badge {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
}
.sr-high { color: var(--red-light); }
.sr-mid  { color: var(--gold); }

/* Fall of wickets */
.fow-strip {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--ink-dim);
  line-height: 1.8;
  background: var(--parchment);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 16px;
}
.fow-strip strong { color: var(--ink); font-weight: 500; }

/* Extras */
.extras-row-detail {
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 8px;
}

/* Best players */
.best-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.best-card {
  background: var(--white);
  border: 1px solid rgba(26,20,16,0.1);
  border-radius: var(--radius);
  overflow: hidden;
}
.best-card-header {
  background: var(--ink);
  color: var(--cream);
  padding: 8px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.best-card-header img {
  width: 16px; height: 16px;
  border-radius: 50%;
  object-fit: contain;
}
.best-player {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(26,20,16,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.best-player:last-child { border-bottom: none; }
.best-player-name { font-size: 13px; font-weight: 500; }
.best-player-stat {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--ink-dim);
  text-align: right;
}
.best-player-stat strong { color: var(--ink); }

/* Win probability chart */
.prob-chart {
  height: 80px;
  position: relative;
  margin: 16px 0;
  background: var(--parchment);
  border-radius: var(--radius);
  overflow: hidden;
}
.prob-chart canvas { width: 100% !important; height: 100% !important; }
.prob-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--ink-dim);
  text-align: center;
  margin-bottom: 12px;
}

/* Venue/forecast */
.match-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.info-item {
  background: var(--white);
  border: 1px solid rgba(26,20,16,0.1);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.info-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.info-value { font-size: 13px; font-weight: 500; }

/* ── FOOTER ── */
.site-footer {
  background: var(--ink);
  color: rgba(245,240,232,0.4);
  padding: 20px 24px;
  margin-top: 60px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.footer-logo { color: var(--cream); font-weight: 500; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .header-inner { gap: 16px; }
  .header-date { display: none; }
  .matches-grid { grid-template-columns: 1fr; }
  .sc-teams { grid-template-columns: 1fr; text-align: center; gap: 8px; }
  .sc-team.away { align-items: center; }
  .sc-vs { display: none; }
  .best-grid { grid-template-columns: 1fr; }
  .match-info-grid { grid-template-columns: 1fr 1fr; }
}

/* ── PROBABILITY BAR (match cards) ── */
.prob-bar-wrap {
  margin-top: 10px;
}
.prob-bar {
  height: 5px;
  background: rgba(184,134,11,0.15);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.prob-bar-home {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 3px;
  transition: width 0.4s ease;
}
.prob-labels {
  display: flex;
  justify-content: space-between;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  color: var(--ink-dim);
}
.prob-label-home { color: var(--gold); }
.prob-label-away { color: var(--green); }
