/*
Theme Name: IPL Schedule Theme
Description: Lightweight, mobile-first dark theme for the IPL schedule site. Design system shared with the FCS theme.
Version: 1.0.0
Requires PHP: 8.0
Text Domain: ipl
*/

/* Dark is the default look; light is opt-in via the header toggle (html[data-theme="light"]). */
:root {
	--bg: #090807;
	--header: #0c0a09;
	--surface: #0f0d0c;
	--surface-2: #1c1917;
	--text: #fafaf9;
	--muted: #a8a29e;
	--line: #211e1d;
	--brand: #16a34a;
	--brand-hover: #15803d;
	--brand-ink: #ffffff;
	--brand-text: #4ade80;
	--brand-soft: rgba(22, 163, 74, .14);
	--accent: #ef4444;
	--accent-soft: rgba(239, 68, 68, .08);
	--gold: #eab308;
	--gold-soft: rgba(234, 179, 8, .12);
	--radius: 10px;
	--shadow: none;
	--font: Inter, "Inter Fallback", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	color-scheme: dark;
}

html[data-theme="light"] {
	--bg: #f0f0f0;
	--header: #ffffff;
	--surface: #ffffff;
	--surface-2: #f5f5f4;
	--text: #0c0a09;
	--muted: #57534e;
	--line: #e7e5e4;
	--brand-text: #15803d;
	--brand-soft: rgba(22, 163, 74, .1);
	--accent: #dc2626;
	--accent-soft: rgba(220, 38, 38, .05);
	--gold: #a16207;
	--gold-soft: rgba(202, 138, 4, .1);
	--shadow: 0 1px 2px rgba(12, 10, 9, .05);
	color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 2px; text-underline-offset: 3px; transition: text-decoration-color .15s, color .15s; }
a:hover { text-decoration-color: var(--accent); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 3.5vw, 1.9rem); font-weight: 700; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }
h2 { font-size: 1.2rem; margin-top: 1.5em; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .6rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.site-header { background: var(--header); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); white-space: nowrap; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); position: relative; flex: none; box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .18); }
.brand-mark::after { content: ""; position: absolute; top: 3px; bottom: 3px; left: 11px; border-left: 2px dotted rgba(255, 255, 255, .8); transform: rotate(35deg); }
.brand b { display: block; font-size: 1.02rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.brand small { display: block; font-size: .64rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
/* Centred links; auto margins (not justify-content) keep the start reachable when the row scrolls. */
.nav a:first-child { margin-left: auto; }
.nav a:last-child { margin-right: auto; }
.nav a { color: var(--muted); padding: 6px 8px; white-space: nowrap; font-size: .9rem; font-weight: 500; }
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--text); text-decoration-color: var(--accent); }
.theme-toggle { flex: none; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle .moon, html[data-theme="light"] .theme-toggle .sun { display: none; }
html[data-theme="light"] .theme-toggle .moon { display: block; }

main { padding: 24px 0 48px; }
body.home main { padding-bottom: 0; }
.lede { color: var(--muted); max-width: 70ch; }
.updated { font-size: .8rem; color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--brand); color: var(--brand-ink); padding: 11px 22px; border-radius: 8px; font-weight: 600; font-size: .92rem; text-decoration: none; border: 0; cursor: pointer; transition: background .15s; }
.btn:hover { background: var(--brand-hover); text-decoration: none; }
.btn::after { content: "→"; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.ghost::after { content: none; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.hero { text-align: center; padding: 28px 0 8px; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); }
.hero .lede { margin: 16px auto 22px; font-size: 1.02rem; }
.eyebrow { display: inline-block; color: var(--accent); font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 12px; }
.hero-stats { margin: 28px auto 0; max-width: 820px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.narrow { max-width: 780px; margin-left: auto; margin-right: auto; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .wgrid > .card + .card { margin-top: 0; }
.prose p { color: color-mix(in srgb, var(--text) 82%, var(--muted)); }
.prose p:last-child { margin-bottom: 0; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 40px 0 12px; }
.section-title h2 { margin: 0; }
.section-title a { font-size: .88rem; color: var(--brand-text); white-space: nowrap; }
section[id] > .lede, .section-lede { margin-bottom: 16px; }

/* Highlight box: red-tinted panel with eyebrow, headline and a green action. */
.insight { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: var(--radius); padding: 16px 18px; margin: 24px 0; }
.insight.narrow { margin: 28px auto; }
.insight .eyebrow { margin-bottom: 6px; }
.insight p { color: var(--muted); font-size: .9rem; margin: 0; }
.insight b { color: var(--text); }

.band { background: color-mix(in srgb, var(--text) 4%, transparent); border-top: 1px solid var(--line); margin-top: 48px; padding: 40px 16px; text-align: center; }
.band h2 { margin-top: 0; font-size: 1.4rem; }
.band p { color: var(--muted); max-width: 62ch; margin: 0 auto 18px; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.home { background: var(--brand-soft); color: var(--brand-text); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; text-align: left; }
.stat b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat span { font-size: .78rem; color: var(--muted); }
.card .stats { margin-top: 14px; }

.note { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; font-size: .88rem; color: var(--muted); }

.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; color: var(--muted); }

.hubs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.hubs a { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; color: var(--text); font-weight: 600; font-size: .9rem; text-decoration: none; transition: border-color .15s; }
.hubs a small { display: block; color: var(--muted); font-weight: 400; font-size: .78rem; margin-top: 2px; }
.hubs a:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }

.table-wrap { overflow-x: auto; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 16px; }
.card.flush table th:last-child, .card.flush table td:last-child { padding-right: 16px; }
.card.flush tbody tr:last-child td { border-bottom: 0; }

/* Team logos: square round badges in assets/teams/{code}.png. */
.logo { border-radius: 50%; object-fit: contain; flex: none; vertical-align: middle; aspect-ratio: 1; }
.logo--empty { display: inline-block; background: color-mix(in srgb, var(--c, var(--muted)) 35%, var(--surface-2)); }
.tb, .tn { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; vertical-align: middle; }
.tm { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.tm b { width: 44px; flex: none; }
.tm span { color: var(--muted); }
.tm:hover span { color: var(--text); }
.tb { font-weight: 700; }
.team-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 14px; margin: 26px auto 0; max-width: 760px; }
.team-strip a { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; color: var(--muted); text-decoration: none; width: 58px; }
.team-strip a:hover { color: var(--text); }
.team-strip a:hover .logo { transform: translateY(-2px); }
.team-strip .logo { transition: transform .15s; }
.fx { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.fx .vs { color: var(--muted); font-size: .78rem; }

/* Schedule table */
.sched td { white-space: nowrap; }
.sched .mn { width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sched .vn { color: var(--muted); }
.sched tr.stage td { background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding-top: .5rem; padding-bottom: .5rem; }
.sched tr.ko .fx b { font-weight: 700; }
.sched tr.ko .fx small { color: var(--muted); }
.sched tr.final td { background: var(--gold-soft); }
.sched tr.final .fx b { color: var(--gold); }
.sched tbody tr:not(.stage):hover td { background: color-mix(in srgb, var(--text) 3%, transparent); }
.sched tr[hidden] { display: none; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.filters label { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); }
.filters select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; }
.filters .count { font-size: .8rem; color: var(--muted); }
.predicted { margin: 0; padding: 10px 16px; border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); font-size: .86rem; color: var(--muted); }
.predicted b { color: var(--text); }
.legend { font-size: .8rem; color: var(--muted); margin: 10px 0 0; }

/* Team tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 16px 0; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { padding: 9px 12px; color: var(--muted); white-space: nowrap; font: inherit; font-size: .9rem; font-weight: 600; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.team-panel + .team-panel { margin-top: 16px; }
.team-panel h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.team-panel .sub { font-size: .84rem; color: var(--muted); margin: -4px 0 12px; }
.team-panel .stats { margin: 0 0 14px; }

/* Venues */
.venue { display: flex; flex-direction: column; }
.venue h3 { margin-bottom: 2px; }
.venue .city { font-size: .82rem; color: var(--muted); margin-bottom: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.venue p { font-size: .9rem; color: var(--muted); margin: 0 0 12px; }
.venue .cap { margin-top: auto; display: flex; align-items: baseline; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.venue .cap b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.venue .cap span { font-size: .78rem; color: var(--muted); }

/* Winners */
.wgrid { display: grid; gap: 14px; align-items: start; }
@media (min-width: 860px) { .wgrid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.winners td:first-child { font-variant-numeric: tabular-nums; color: var(--muted); width: 72px; }
.winners .champ { font-weight: 600; }
.winners td { white-space: nowrap; }
.winners tr.latest td { background: var(--gold-soft); }
.winners tr.latest .champ { color: var(--gold); }
.titles { display: grid; gap: 8px; }
.titles .row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.titles .row .tn { white-space: normal; }
.titles .bar { grid-column: 1 / -1; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: -4px; }
.titles .bar i { display: block; height: 100%; background: var(--c, var(--brand)); border-radius: 999px; }
.titles b { font-variant-numeric: tabular-nums; }

/* Key dates */
.kd { display: flex; flex-direction: column; }
.kd .big { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 10px; }
.kd .big small { display: block; font-size: .85rem; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-top: 2px; }
.kd p { font-size: .92rem; color: var(--muted); }
.kd p:last-child { margin-bottom: 0; }

.site-footer { border-top: 1px solid var(--line); background: var(--header); padding: 32px 0 24px; font-size: .85rem; color: var(--muted); }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 20px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.disclaimer { border-top: 1px solid var(--line); padding-top: 16px; font-size: .78rem; }
.entry-content { max-width: 75ch; }
.entry-content a { color: var(--brand-text); text-decoration-color: currentColor; text-decoration-thickness: 1px; }
.entry-content p, .entry-content li { color: color-mix(in srgb, var(--text) 82%, var(--muted)); }
.entry-content ul { padding-left: 1.2em; }
.entry-content li { margin: 6px 0; }
.entry-content strong { color: var(--text); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } html { scroll-behavior: auto; } }
@media (max-width: 720px) {
	.site-header .wrap { flex-wrap: wrap; gap: 4px 12px; padding-top: 8px; }
	.theme-toggle { margin-left: auto; }
	.nav { order: 3; flex-basis: 100%; margin: 0 -8px; padding-bottom: 4px; }
	html { scroll-padding-top: 104px; }
}
@media (max-width: 560px) {
	.hide-sm { display: none; }
	.sched td, .sched th { padding: .55rem .4rem; }
	.filters label { flex: 1 1 100%; min-width: 0; }
	.filters select { flex: 1; min-width: 0; }
	.hero-stats .stat b { font-size: 1.15rem; }
}

/* Home page built from blocks (Pages > Home). Classic themes wrap group contents in an
   inner container; display: contents lets grids and cards lay out as if it were not there. */
.home-content .wp-block-group__inner-container { display: contents; }
.home-content section[id] > div > h2:first-child { margin: 40px 0 12px; }
.home-content .hero .eyebrow { margin: 0 0 12px; }
.home-content .hero .lede { margin-left: auto; margin-right: auto; }
.home-content .insight p.eyebrow { display: block; color: var(--accent); font-size: .74rem; margin: 0 0 6px; }
.insight strong { color: var(--text); }
.home-content .kd h2 { margin-top: 0; }
.home-content .kd .big small { display: block; }
.home-content #key-dates .grid { margin-top: 40px; }
.home-content .grid > div > .card + .card { margin-top: 0; }
.home-content section[id] > div > .lede { margin-bottom: 16px; }
.home-content .insight .updated { margin: 8px 0 0; font-size: .8rem; }
