/*
 * CADBA — sitewide stylesheet.
 * Inspired by ESPN's data-forward, dark-header aesthetic.
 * Palette: deep navy primary, off-white background, minimal accent.
 */

/* ---------- Reset / base ---------- */

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

html {
    font-size: 16px;
}

body {
    margin: 0;
    padding: 0;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

:root {
    /* Palette */
    --navy: #0a2540;
    --navy-dark: #061529;
    --navy-hover: #14385f;
    --accent: #d8a83b;          /* Warm gold — used sparingly for highlights */
    --bg: #f5f5f7;
    --card: #ffffff;
    --border: #e4e4e7;
    --border-strong: #c8ccd1;
    --text: #1a1a1a;
    --text-muted: #6b7280;
    --text-inverse: #ffffff;
    --row-alt: #fafafb;
    --row-hover: rgba(10, 37, 64, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
    --radius: 6px;
}

/* ---------- Layout ---------- */

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1rem;
}

main.site-main {
    flex: 1;
    padding: 2rem 0;
}

/* ---------- Header / nav ---------- */

.site-header {
    background: var(--navy);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-inverse);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
}
.brand-logo {
    height: 36px;
    width: auto;
    display: block;
}
.brand-text { line-height: 1; }

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.main-nav a {
    display: block;
    padding: 0.4rem 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.main-nav a:hover {
    color: var(--text-inverse);
    background: rgba(255, 255, 255, 0.1);
}

/* ---------- Footer ---------- */

.site-footer {
    background: var(--navy-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 1.5rem 0;
    margin-top: 3rem;
    font-size: 0.85rem;
}
.site-footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; }

/* ---------- Typography ---------- */

h1, h2, h3, h4, h5, h6 {
    color: var(--navy);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0 0 0.75rem;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

hgroup h1 { margin-bottom: 0.25rem; }
hgroup p { color: var(--text-muted); margin: 0 0 1rem; }

p { margin: 0 0 1rem; }

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--navy-hover); text-decoration: underline; }

.muted { color: var(--text-muted); }
.text-small { font-size: 0.85rem; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------- Section header (navy underline, ESPN style) ---------- */

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 3px solid var(--navy);
    padding-bottom: 0.4rem;
    margin: 2rem 0 1rem;
}
.section-header:first-child { margin-top: 0; }
.section-header h2 {
    margin: 0;
    font-size: 1.35rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.section-header .section-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---------- Cards ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}
.card-header {
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}
.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}
.card-grid .card { margin: 0; }

/* ---------- Buttons ---------- */

button, .btn, [role="button"] {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-inverse);
    background: var(--navy);
    border: 1px solid var(--navy);
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
button:hover, .btn:hover, [role="button"]:hover {
    background: var(--navy-hover);
    border-color: var(--navy-hover);
    color: var(--text-inverse);
    text-decoration: none;
}
button.secondary, .btn.secondary, [role="button"].secondary {
    color: var(--navy);
    background: transparent;
    border-color: var(--border-strong);
}
button.secondary:hover, .btn.secondary:hover, [role="button"].secondary:hover {
    background: var(--row-hover);
    border-color: var(--navy);
    color: var(--navy);
}
button:disabled, [aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---------- Forms ---------- */

label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    color: var(--navy);
}
label small { font-weight: 400; color: var(--text-muted); display: block; margin-top: 0.15rem; }

input[type="text"], input[type="email"], input[type="date"], input[type="time"],
input[type="number"], input[type="url"], select, textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.65rem;
    margin-top: 0.25rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 2px rgba(10, 37, 64, 0.15);
}
input[type="checkbox"] {
    margin-right: 0.35rem;
    vertical-align: middle;
    transform: translateY(-1px);
}

/* ---------- Data tables (ESPN-style) ---------- */

.table-wrap {
    overflow-x: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}
table.data {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9rem;
}
table.data thead {
    background: var(--navy);
    color: var(--text-inverse);
}
table.data thead th {
    padding: 0.55rem 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-align: left;
    border-bottom: none;
    white-space: nowrap;
}
table.data tbody td {
    padding: 0.6rem 0.7rem;
    border-top: 1px solid var(--border);
    vertical-align: top;
}
table.data tbody tr:nth-child(even) { background: var(--row-alt); }
table.data tbody tr:hover { background: var(--row-hover); }
table.data td.numeric, table.data th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.center, table.data th.center { text-align: center; }
table.data .team-cell strong { color: var(--navy); }
table.data .team-cell small { color: var(--text-muted); }

/* League standings — pole position emphasis */
table.standings tbody tr:first-child td.rank,
table.standings tbody tr:first-child td.team-cell { font-weight: 700; }
table.standings td.rank {
    width: 2.5rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
table.standings td.points { font-weight: 700; color: var(--navy); }

/* ---------- Fixture list ---------- */

table.fixtures td.date {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
table.fixtures td.result { font-weight: 700; font-variant-numeric: tabular-nums; }
table.fixtures td.result .games-note { display: block; font-weight: 400; font-size: 0.8rem; color: var(--text-muted); }

/* ---------- Home page hero ---------- */

.hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
    color: var(--text-inverse);
    padding: 3rem 0;
    margin: -2rem 0 2rem;
}
.hero .container {}
.hero h1 {
    color: var(--text-inverse);
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin: 0 0 0.5rem;
    line-height: 1.05;
}
.hero .kicker {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--accent);
    color: var(--navy-dark);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 3px;
    margin-bottom: 1rem;
}
.hero .lede {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    max-width: 640px;
}

/* Home two-column layout */
.home-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
@media (min-width: 800px) {
    .home-columns { grid-template-columns: 1fr 1fr; }
}

/* Diary entries on home page */
.diary { margin: 0; padding: 0; list-style: none; }
.diary li {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.diary li:last-child { border-bottom: none; }
.diary .diary-date {
    color: var(--navy);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.diary .diary-body strong { color: var(--text); }
.diary .diary-body small { color: var(--text-muted); }

/* ---------- Messages / flash ---------- */

.messages { margin-bottom: 1rem; }
.messages .msg {
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    border-left: 3px solid;
}
.messages .success { background: #e8f5eb; border-left-color: #2b8a3e; color: #1e4d2a; }
.messages .warning { background: #fff4e6; border-left-color: #d9822b; color: #7a4a12; }
.messages .info    { background: #eef2f7; border-left-color: var(--navy); color: var(--navy-dark); }
.messages .error   { background: #fdecec; border-left-color: #c22c2c; color: #791818; }

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: 0.15em 0.55em;
    border-radius: 999px;
    background: var(--navy);
    color: var(--text-inverse);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 0.3em;
}
.badge.subtle {
    background: transparent;
    color: var(--navy);
    border: 1px solid var(--border-strong);
}

/* ---------- Utility ---------- */

.center { text-align: center; }
.right  { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 2rem; }

/* Fill a whole row inside display: grid */
.full-row { grid-column: 1 / -1; }

/* Small screens — nav wraps neatly */
@media (max-width: 600px) {
    .site-header .container { flex-direction: column; align-items: flex-start; }
    .main-nav ul { flex-wrap: wrap; }
    .hero h1 { font-size: 2rem; }
    h1 { font-size: 1.6rem; }
}
