/* leaffan.net – shared stylesheet for all current pages.
   Archive pages keep their original styles (css/general.css and inline styles). */

/* ---------- tokens ---------- */

:root {
    color-scheme: light dark;

    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #eef1f6;
    --text: #1a1d24;
    --text-muted: #5b6372;
    --border: #dde2ea;
    --accent: #00205b;          /* Leafs blue */
    --accent-strong: #0a3a8c;
    --accent-soft: #e3eaf6;
    --on-accent: #ffffff;
    --brand: #00205b;           /* Leafs blue, header and footer in both colour schemes */
    --brand-text: #ffffff;
    --brand-muted: #b8c8e8;
    --brand-tint: #8fb0f0;
    --positive: #1f7a3d;
    --negative: #b42318;
    --shadow: 0 1px 2px rgb(16 24 40 / 0.06), 0 1px 3px rgb(16 24 40 / 0.08);
    --shadow-hover: 0 4px 12px rgb(16 24 40 / 0.10), 0 2px 4px rgb(16 24 40 / 0.06);

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
    --radius: 10px;
    --page-width: 62rem;
    --text-width: 42rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1218;
        --surface: #171b23;
        --surface-2: #1f2530;
        --text: #e7eaf0;
        --text-muted: #9aa3b2;
        --border: #2a313d;
        --accent: #8fb0f0;
        --accent-strong: #b5ccf7;
        --accent-soft: #1c2740;
        --on-accent: #0f1218;
        --positive: #5cc985;
        --negative: #f0837a;
        --shadow: none;
        --shadow-hover: 0 0 0 1px var(--accent);
    }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); margin: 0 0 0.5rem; color: var(--accent); }
h2 { font-size: 1.35rem; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.05rem; margin: 1.75rem 0 0.5rem; }

p, ul { margin: 0 0 1rem; }
small { color: var(--text-muted); }
abbr[title] { text-decoration: underline dotted; cursor: help; }

/* ---------- layout ---------- */

.wrap {
    width: 100%;
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.site-header {
    background: var(--brand);
    color: var(--brand-text);
    border-bottom: 3px solid var(--brand-tint);
}
.site-header .wrap {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    padding-bottom: 1rem;
}
.brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--brand-text);
    text-decoration: none;
    letter-spacing: -0.02em;
}
.brand span { color: var(--brand-tint); }
.brand:hover { color: var(--brand-text); }
.brand:focus-visible { outline-color: var(--brand-text); }
.tagline { color: var(--brand-muted); font-style: italic; font-size: 0.95rem; }

main.wrap { flex: 1; padding-top: 3rem; padding-bottom: 3.5rem; }

.prose { max-width: var(--text-width); }

.site-footer {
    background: var(--brand);
    color: var(--brand-muted);
    font-size: 0.9rem;
}
.site-footer .wrap {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    flex-wrap: wrap;
    padding-top: 1.25rem;
    padding-bottom: 1.5rem;
}
.site-footer nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-footer a { color: var(--brand-muted); }
.site-footer a:hover { color: var(--brand-text); }
.site-footer a:focus-visible { outline-color: var(--brand-text); }

/* ---------- home page ---------- */

.hero { padding-bottom: 0.5rem; }
.hero p { font-size: 1.1rem; color: var(--text-muted); max-width: var(--text-width); }

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-weight: 700;
}
.section-title::after {
    content: "";
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0.35;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    gap: 1rem;
    list-style: none;
    padding: 0;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.25rem 1.25rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: var(--accent); }
.card h3 { margin: 0; font-size: 1.1rem; color: var(--accent); }
.card h3 a { color: var(--accent); text-decoration: none; }
/* whole card clickable via the heading link */
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
.card .meta {
    align-self: flex-start;
    margin-top: auto;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
/* cards with several links (no whole-card click) */
.card.multi h3 a::after { content: none; }
.card .links { display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; margin-top: 0.25rem; font-size: 0.9rem; }
.card .links span { color: var(--text-muted); min-width: 2.75rem; font-variant-numeric: tabular-nums; }
.card .links a { position: relative; z-index: 1; }

.archive {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.archive a {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
    font-size: 0.95rem;
}
.archive a:hover { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.archive a:hover small { color: inherit; }
.archive small { margin-left: 0.35rem; }

/* ---------- data pages ---------- */

.lead { color: var(--text-muted); max-width: var(--text-width); }

.note {
    padding: 0.85rem 1rem;
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    max-width: var(--text-width);
}
.note p:last-child { margin-bottom: 0; }

.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1.25rem;
    margin: 1.5rem 0 1rem;
}
.controls label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--text-muted); }
.controls label.check { flex-direction: row; align-items: center; gap: 0.5rem; font-size: 0.95rem; color: var(--text); }
.controls input[type="search"], .controls input[type="number"] {
    font: inherit;
    font-size: 0.95rem;
    padding: 0.45rem 0.65rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.controls input[type="search"] { width: min(100%, 18rem); }
.controls input[type="number"] { width: 7rem; }
.controls input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }

.table-scroll {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
table.data th, table.data td { padding: 0.5rem 0.75rem; text-align: right; }
table.data th:nth-child(2), table.data td:nth-child(2) { text-align: left; }
table.data thead th {
    position: sticky;
    top: 0;
    background: var(--accent-soft);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
table.data tbody tr + tr td { border-top: 1px solid var(--border); }
table.data tbody tr:hover td { background: var(--accent-soft); }
table.data td.rank { color: var(--text-muted); }

.sort {
    font: inherit;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    white-space: nowrap;
}
.sort:hover { text-decoration: underline; }
th[aria-sort] .sort::after { margin-left: 0.25rem; font-size: 0.75em; }
th[aria-sort="descending"] .sort::after { content: "▼" / ""; }
th[aria-sort="ascending"] .sort::after { content: "▲" / ""; }

[ng-cloak], [data-ng-cloak] { display: none !important; }

.pos { color: var(--positive); }
.neg { color: var(--negative); }

.empty { padding: 1.5rem; text-align: center; color: var(--text-muted); }

/* ---------- chart ---------- */

.chart {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 1.5rem 0 0;
    padding: 0.75rem 0.5rem 0.75rem;
}
.chart { overflow: clip; }
.chart-scroll { overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 640px; height: auto; overflow: visible; }
.chart .axis { color: var(--text-muted); font-size: 11px; }
.chart .axis-label { fill: var(--text-muted); font-size: 12px; }
.chart .grid line { stroke: var(--border); }
.chart .grid .domain { display: none; }
.chart .bar-games { fill: #f08a5d; }
.chart .bar-goals { fill: #3b82c4; }
.chart .bar-hit { fill: transparent; cursor: crosshair; }
.chart .bar-hit:hover, .chart .bar-hit.active { fill: rgb(127 127 127 / 0.15); }
.chart .line-gpg { fill: none; stroke: var(--negative); stroke-width: 2.25; }
.chart .line-overall { stroke: var(--negative); stroke-width: 1.5; stroke-dasharray: 6 4; opacity: 0.7; }

.legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: 0.85rem; color: var(--text-muted); margin: 0.75rem 0 0; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 0.4rem; }
.legend i { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 3px; }
.legend i.line { height: 3px; border-radius: 0; }

.tooltip {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    min-width: 9rem;
    padding: 0.55rem 0.75rem;
    background: var(--text);
    color: var(--bg);
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.45;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 4px 14px rgb(0 0 0 / 0.25);
    opacity: 0;
    transition: opacity 0.1s ease;
}
.tooltip.visible { opacity: 1; }
.tooltip strong { display: block; margin-bottom: 0.15rem; }

/* ---------- gallery (The Streets) ---------- */

.gallery {
    display: grid;
    grid-template-columns: minmax(10rem, 15rem) 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-top: 1.5rem;
}
.shots {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.shot {
    display: block;
    width: 100%;
    padding: 0.35rem;
    font: inherit;
    text-align: left;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.shot img { display: block; width: 100%; height: auto; border-radius: 6px; }
.shot span { display: block; padding: 0.3rem 0.2rem 0; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.shot:hover { border-color: var(--accent); }
.shot[aria-current="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
    background: var(--accent-soft);
}
.shot[aria-current="true"] span { color: var(--accent); font-weight: 600; }

.preview {
    position: sticky;
    top: 1rem;
    margin: 0;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.preview img {
    display: block;
    width: 100%;
    max-height: calc(100vh - 7rem);
    object-fit: contain;
    border-radius: 6px;
    background: var(--surface-2);
}
.preview figcaption { padding: 0.5rem 0.25rem 0; font-size: 0.9rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* phones: preview stays on top while the list scrolls below it */
@media (max-width: 40rem) {
    .gallery { grid-template-columns: 1fr; }
    .preview { top: 0; z-index: 5; order: -1; padding: 0.5rem; border-radius: 0 0 var(--radius) var(--radius); }
    /* fixed height, so the preview does not change size between landscape and portrait photos */
    .preview img { height: 38vh; max-height: none; }
    .shot { display: flex; align-items: center; gap: 0.75rem; }
    /* keep a photo focused with the arrow keys clear of the sticky preview above it */
    .shot { scroll-margin-top: calc(38vh + 4rem); }
    .shot img { width: 45%; }
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
    .card:hover { transform: none; }
}
