:root {
    color-scheme: light;
    --paper: #F7F4EE;
    --surface: #EFEAE0;
    --ink: #1C1B19;
    --muted: #6B665E;
    --rule: #D9D3C7;
    --accent: #7A1F2B;
    --serif: "Newsreader", Georgia, "Times New Roman", serif;
    --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --gutter: 1rem;
    --measure: 40rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 0.5em;
    text-wrap: balance;
}

h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

a:hover { text-decoration-thickness: 2px; }

a:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

img { max-width: 100%; height: auto; }

abbr[title] { text-decoration: none; cursor: help; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.wrap {
    max-width: 72rem;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

@media (min-width: 40rem) {
    :root { --gutter: 1.5rem; }
}

/* Masthead */

.masthead {
    position: relative;
}

.masthead::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 6px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='6'%3E%3Crect width='6' height='6' fill='%231C1B19'/%3E%3C/svg%3E");
    background-size: 12px 6px;
}

.masthead-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 2rem;
    padding-block: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    width: 3rem;
    height: 3rem;
    flex: none;
}

.brand-name {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.site-nav a {
    color: var(--ink);
    text-decoration: none;
    padding-block: 0.25rem;
    border-bottom: 2px solid transparent;
}

.site-nav a:hover { border-bottom-color: var(--rule); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--accent); }

.notice {
    margin-top: 6px;
    background: var(--accent);
    color: var(--paper);
}

.notice p {
    margin: 0;
    padding-block: 0.75rem;
}

.notice a { color: var(--paper); }

main.wrap {
    padding-block: 2.5rem 4rem;
}

/* Home */

.home {
    display: grid;
    gap: 3rem;
}

@media (min-width: 60rem) {
    .home {
        grid-template-columns: minmax(0, 1fr) 20rem;
        gap: 4rem;
    }
}

.intro {
    padding-bottom: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--rule);
    max-width: var(--measure);
}

.intro-lead {
    font-family: var(--serif);
    font-size: 1.5rem;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

.post-summary {
    padding-block: 1.75rem;
    border-bottom: 1px solid var(--rule);
    max-width: var(--measure);
}

.post-summary-title {
    font-size: 1.75rem;
    margin-bottom: 0.2em;
}

.post-summary-title a {
    color: var(--ink);
    text-decoration: none;
}

.post-summary-title a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.post-date {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.read-more { margin: 0; font-weight: 500; }

.pager {
    display: flex;
    justify-content: space-between;
    padding-top: 1.5rem;
    font-weight: 500;
    max-width: var(--measure);
}

.pager-next { margin-left: auto; }

.home-side {
    font-size: 0.95rem;
}

.side-block {
    border-top: 2px solid var(--ink);
    padding-top: 0.75rem;
    margin-bottom: 2rem;
}

.side-heading {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.side-more { font-weight: 500; }

.lichess-embed {
    display: block;
    width: 100%;
    aspect-ratio: 5 / 6;
    border: 0;
}

/* Fixtures */

.fixture-summary p { margin: 0; }

.fixture-summary-teams {
    font-family: var(--serif);
    font-size: 1.2rem;
    line-height: 1.3;
}

.versus {
    color: var(--muted);
    font-family: var(--serif);
    font-style: italic;
    margin-inline: 0.1em;
}

.fixture-summary-score {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-top: 0.25rem !important;
}

.score {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.outcome,
.fixture-outcome {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.outcome-won .outcome,
.outcome-won .fixture-outcome { color: var(--accent); }

.fixture-summary-meta {
    display: flex;
    gap: 0.75rem;
    color: var(--muted);
    font-size: 0.875rem;
    margin-top: 0.25rem !important;
}

.fixture-summary-home::before {
    content: "·";
    margin-right: 0.75rem;
}

/* Tables */

.league-table,
.card-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
}

.league-table th,
.card-table th {
    text-align: left;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--ink);
    padding: 0.35rem 0.4rem;
}

.league-table td,
.card-table td {
    padding: 0.4rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: baseline;
}

.league-table .num,
.card-table .num { text-align: right; }

.league-table .strong { font-weight: 600; }

.league-table tr.is-us td {
    background: var(--surface);
    font-weight: 600;
}

.league-table tr.is-us td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.league-table tr:has(+ tr.relegation-zone-start) td { border-bottom-color: transparent; }

.league-table tr.relegation-zone-start { position: relative; }

.league-table tr.relegation-zone-start td:first-child::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -1px;
    border-top: 1px dashed var(--muted);
}

.muted { color: var(--muted); }

/* Articles */

.article { max-width: var(--measure); }

.article-header {
    margin-bottom: 2rem;
}

.article-back {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
    font-weight: 500;
}

.prose { overflow-wrap: break-word; }

.prose h2 { margin-top: 2rem; }
.prose h3 { margin-top: 1.5rem; }

.prose ul,
.prose ol { padding-left: 1.25rem; margin: 0 0 1em; }

.prose li { margin-bottom: 0.35em; }

.prose img {
    display: block;
    margin-block: 1.5rem;
}

.prose address {
    font-style: normal;
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin-bottom: 1em;
}

.prose iframe {
    display: block;
    width: 100%;
    min-height: 20rem;
    border: 1px solid var(--rule);
    margin-bottom: 1em;
}

.prose table {
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
    margin-bottom: 1.5em;
    width: 100%;
}

.prose th,
.prose td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--rule);
    text-align: left;
}

.prose th {
    border-bottom-color: var(--ink);
    font-weight: 500;
}

/* Table of contents */

.toc { display: none; }

@media (min-width: 60rem) {
    .with-toc {
        display: grid;
        grid-template-columns: minmax(0, var(--measure)) 14rem;
        justify-content: space-between;
        gap: 4rem;
    }

    .toc {
        display: block;
        position: sticky;
        top: 1.5rem;
        align-self: start;
        margin-top: 5.5rem;
        border-top: 2px solid var(--ink);
        padding-top: 0.75rem;
        font-size: 0.95rem;
    }

    .toc-heading {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .toc ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .toc li { margin-bottom: 0.35rem; }

    .toc a {
        color: var(--ink);
        text-decoration: none;
    }

    .toc a:hover { color: var(--accent); text-decoration: underline; }
}

.prose h2 { scroll-margin-top: 1.5rem; }

/* League page */

.competition {
    border-top: 2px solid var(--ink);
    padding-top: 1rem;
    margin-bottom: 3.5rem;
}

.competition-body {
    display: grid;
    gap: 2.5rem;
}

@media (min-width: 60rem) {
    .competition-body {
        grid-template-columns: 26rem minmax(0, 1fr);
        gap: 3rem;
        align-items: start;
    }

    .competition-body > :only-child { grid-column: 1 / -1; max-width: 44rem; }
}

.minor-heading {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.fixture-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--ink);
}

.fixture {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr) auto;
    column-gap: 1rem;
    align-items: baseline;
    padding-block: 0.6rem;
    border-bottom: 1px solid var(--rule);
    font-size: 0.95rem;
}

.fixture p { margin: 0; }

.fixture-date {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.875rem;
}

.fixture-teams .is-us,
.fixture-summary-teams .is-us { font-weight: 600; }

.fixture-score {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    padding-inline: 0.4rem;
    white-space: nowrap;
}

.match-card {
    grid-column: 2 / -1;
    margin-top: 0.5rem;
}

.match-card summary {
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent);
    width: fit-content;
}

.match-card[open] summary { margin-bottom: 0.5rem; }


.match-card { overflow-x: auto; }

.card-table .result {
    text-align: center;
    white-space: nowrap;
}

.piece {
    display: inline-block;
    width: 0.6em;
    height: 0.6em;
    margin-right: 0.45em;
    border: 1px solid var(--ink);
    vertical-align: 0.05em;
}

.piece-black { background: var(--ink); }
.piece-white { background: var(--paper); }

.data-note {
    color: var(--muted);
    font-size: 0.875rem;
}

@media (max-width: 36rem) {
    .fixture { grid-template-columns: minmax(0, 1fr) auto; }
    .fixture-date { grid-column: 1 / -1; }
    .match-card { grid-column: 1 / -1; }
}

/* Footer */

.site-footer {
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.9rem;
}

.footer-inner {
    display: grid;
    gap: 1.5rem;
    padding-block: 2rem 3rem;
}

@media (min-width: 48rem) {
    .footer-inner { grid-template-columns: 1fr 1fr; }
}

.footer-title {
    font-family: var(--serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.25rem;
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-links li { margin-bottom: 0.35rem; }
