/* Trafalgar Dart League - lightweight, responsive stylesheet */
:root {
    --green: #27814a;
    --border: #b9cdbf;
    --pale: #cbded1;
    --ink: #24352b;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: auto;
}

body {
    margin: 0;
    background: #fff url("bg.jpg") repeat;
    color: var(--ink);
    font: 15px/1.35 Arial, Helvetica, sans-serif;
}

.page {
    width: calc(100% - 48px);
    max-width: 970px;
    margin: 0 auto;
}

.site-header {
    text-align: center;
    padding-top: 2px;
}

.site-title,
.page-title {
    margin: 0.12em 0;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: bold;
    line-height: 1.15;
    text-align: center;
}

.site-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: #006699;
    text-shadow: 2px 2px 1px #999;
}

.page-title {
    font-size: clamp(1.3rem, 3.4vw, 1.7rem);
    color: #167b2c;
    text-shadow: 2px 2px 1px #999;
}

@supports (-webkit-text-stroke: 1px green) {
    .site-title {
        color: #d5faff;
        -webkit-text-stroke: 1px #0077bb;
        text-shadow: 2px 2px 1px #444;
    }

    .page-title {
        color: #e2f8dc;
        -webkit-text-stroke: 1px #178a21;
        text-shadow: 2px 2px 1px #444;
    }
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1px 10px;
    padding: 2px 0 3px;
}

.main-nav a:link,
.week-nav a:link {
    color: #0000ee;
    text-decoration: underline;
}

.main-nav a:visited,
.week-nav a:visited {
    color: #551a8b;
    text-decoration: underline;
}

.main-nav a[aria-current="page"] {
    color: var(--green);
    font-weight: bold;
    text-decoration: none;
}

.main-nav a {
    padding: 2px 1px;
}

.week-nav a {
    padding: 1px 0;
}

.main-nav a:focus-visible,
.week-nav a:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 2px;
}

.week-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0 3px;
    margin: 1px 0 5px;
    font-size: 0.85rem;
}

.week-nav .week-nav-label {
    flex: 0 0 100%;
    text-align: center;
    line-height: 1.15;
}

.week-nav .separator {
    color: var(--ink);
    user-select: none;
}

.week {
    margin: 0 0 14px;
    scroll-margin-top: 8px;
}

.week > h2,
.dates h2 {
    margin: 0 0 6px;
    padding: 5px 8px;
    /* Match the original bar.gif: white at left, teal at right. */
    background: #d3ebeb;
    background: linear-gradient(to right, #ffffff 0%, #008484 100%);
    color: #173e3e;
    font-size: 0.94rem;
    line-height: 1.2;
    font-weight: bold;
}

.divisions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.division {
    min-width: 0;
    border: 1px solid var(--border);
    background: #fff;
}

.division > h3 {
    margin: 0;
    padding: 4px 8px;
    background: var(--pale);
    text-align: center;
    font-size: 0.88rem;
}

.fixture {
    display: grid;
    grid-template-columns: minmax(0, 44%) minmax(0, 56%);
    align-items: center;
    min-height: 46px;
    padding: 3px 6px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.fixture:nth-of-type(odd) {
    background: #eaf1ed;
}

.teams {
    min-width: 0;
    padding-right: 6px;
    font-weight: bold;
    font-size: 0.82rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.teams > div + div {
    margin-top: 1px;
}

.match-result {
    min-width: 0;
    text-align: center;
    font-size: 0.82rem;
}

.score {
    display: block;
    font-size: 0.94rem;
    line-height: 1.2;
}

.breakdown,
.detail {
    display: block;
    font-size: 0.76rem;
    overflow-wrap: anywhere;
}

.bye {
    color: #247843;
    font-weight: bold;
}

/* Status colours indicate whether follow-up is needed. */
.status {
    font-weight: bold;
}

.status.postponed {
    color: #926000;
}

.status.missing-result {
    color: #b42318;
}

.pending {
    color: #777;
    font-weight: normal;
}

.knockout {
    border: 1px solid var(--border);
    padding: 5px 10px;
    background: #fff;
}

.knockout h3 {
    font-size: 0.95rem;
    margin: 2px 0 5px;
}

.knockout p,
.dates p {
    margin: 3px 0;
}

.dates {
    margin-top: 18px;
}

footer {
    margin: 24px 0 14px;
    padding-top: 7px;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: #555;
    text-align: left;
}

footer p {
    margin: 3px 0;
}

/* Stack the divisions if there is insufficient width for two columns. */
@media (max-width: 720px) {
    .divisions {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }
}

/* Preserve margins without wasting too much room on phones. */
@media (max-width: 600px) {
    .page {
        width: calc(100% - 24px);
    }
}

/* Keep the fixture information compact on small phones. */
@media (max-width: 370px) {
    body {
        font-size: 14px;
    }

    .fixture {
        grid-template-columns: minmax(0, 43%) minmax(0, 57%);
        padding-inline: 4px;
    }

    .breakdown {
        font-size: 0.74rem;
    }
}

/* League table page: equal columns across both divisions. */
.league-section {
    margin: 7px 0 12px;
}

.league-section > h2,
.awards > h2 {
    margin: 0 0 5px;
    padding: 5px 8px;
    background: #d3ebeb;
    background: linear-gradient(to right, #ffffff 0%, #008484 100%);
    color: #173e3e;
    font-size: 0.94rem;
    line-height: 1.2;
}

/* Both independent tables use the same width and colgroup definitions. */
.league-scroll {
    width: 100%;
    margin-inline: auto;
    overflow-x: auto;
    border: 1px solid var(--border);
    background: #fff;
}

.league-table {
    width: 100%;
    min-width: 670px;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.82rem;
    line-height: 1.25;
}

.league-table .col-team { width: 32%; }
.league-table .col-played { width: 7%; }
.league-table .col-leg { width: 6%; }
.league-table .col-foragainst { width: 7%; }
.league-table .col-points { width: 17%; }

.league-table th,
.league-table td {
    padding: 4px 5px;
    border: 1px solid #9eb9a6;
    text-align: center;
    background: #fff;
    font-variant-numeric: tabular-nums;
}

.league-table thead th {
    background: var(--pale);
    font-weight: bold;
}

.league-table tbody tr:nth-child(even) > * {
    background: #eaf1ed;
}

.league-table th:first-child,
.league-table td:first-child {
    text-align: left;
    overflow-wrap: break-word;
}

.league-table tbody th {
    font-weight: bold;
}

.awards {
    margin-top: 16px;
}

.award-section {
    margin: 0 0 12px;
    border: 1px solid var(--border);
    background: #fff;
}

.award-section h3 {
    margin: 0;
    padding: 4px 8px;
    background: var(--pale);
    font-size: 0.88rem;
}

.award-section ul {
    list-style: none;
    margin: 0;
    padding: 5px 9px;
}

.award-section li {
    margin: 2px 0;
}

.award-section details {
    padding: 0 9px 6px;
}

.award-section summary {
    width: fit-content;
    padding: 2px 0;
    color: #0056a6;
    cursor: pointer;
    text-decoration: underline;
}

.award-section details ul {
    padding: 3px 0 0 20px;
}

.award-note {
    margin: 2px 9px 8px;
    font-size: 0.78rem;
}

/* Homepage and historical league table archive. */
.home-section {
    margin: 12px 0 16px;
}

.home-section > h2 {
    margin: 0 0 6px;
    padding: 5px 8px;
    background: #d3ebeb;
    background: linear-gradient(to right, #ffffff 0%, #008484 100%);
    color: #173e3e;
    font-size: 0.94rem;
    line-height: 1.2;
}

.home-section p {
    margin: 6px 0;
}

/* Compact homepage links. */
.home-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
}

.home-links li {
    min-width: 0;
    margin: 0;
    padding: 0;
}

.home-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: #f9fbf9;
    border-left: 3px solid #78a68b;
    border-radius: 2px;
    text-decoration: none;
}

.home-links a:hover,
.home-links a:focus-visible {
    background: #eaf3ed;
    border-color: #8eae98;
}

.home-links a:focus-visible {
    outline: 2px solid #176a47;
    outline-offset: 2px;
}

.link-copy {
    display: block;
    min-width: 0;
}

.link-title {
    display: block;
    color: #0056a6;
    text-decoration: underline;
    font-weight: bold;
    line-height: 1.2;
}

.home-links a:visited .link-title {
    color: #551a8b;
}

.link-note {
    display: block;
    margin-top: 2px;
    color: #48584d;
    font-size: 0.82rem;
    line-height: 1.25;
}

.archive-links {
    margin: 6px 0;
    padding-left: 26px;
    columns: 2 220px;
    column-gap: 24px;
}

.archive-links li {
    padding: 2px 0;
    break-inside: avoid;
}
