/* events.1stroyalmarines.com - the regiment's navy, gold and cream (as the dashboard and
   1stroyalmarines.com), with France blue and Royal Marines red for the two sides.
   Layout: a masthead, then one event's "order of battle": the two sides facing each other
   across a balance bar, the rules, and past results below. One dark look by design. */

@font-face {
    font-family: "Inter";
    src: url("/static/fonts/inter.woff2") format("woff2");
    font-weight: 400 700;
    font-display: swap;
}
@font-face {
    font-family: "Libre Caslon Display";
    src: url("/static/fonts/libre-caslon-display.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

:root {
    --ground: #0b1629;
    --ground-deep: #081122;
    --panel: #10203a;
    --panel-raised: #162a4a;
    --gold: #c9a84c;
    --gold-bright: #e0c36a;
    --cream: #ece4d3;
    --muted: rgba(236, 228, 211, 0.72);
    --faint: rgba(236, 228, 211, 0.5);
    --rule: rgba(201, 168, 76, 0.2);
    --rule-strong: rgba(201, 168, 76, 0.45);
    --france: #5d86e8;
    --france-wash: rgba(93, 134, 232, 0.14);
    --britain: #e2483e;
    --britain-wash: rgba(226, 72, 62, 0.14);
    --ok: #7fbf7a;
    --warn: #e7b54f;
    --serif: "Libre Caslon Display", "Big Caslon", Baskerville, Georgia, serif;
    --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --radius: 10px;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: radial-gradient(1100px 480px at 50% -180px, rgba(201, 168, 76, 0.09), transparent 70%), var(--ground);
    color: var(--cream);
    font: 400 16px/1.55 var(--sans);
    font-synthesis: none;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--gold-bright); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible {
    outline: 2px solid var(--gold-bright); outline-offset: 2px; border-radius: 4px;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

.wrap {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* masthead */
.masthead { border-bottom: 1px solid var(--rule); background: rgba(8, 17, 34, 0.6); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--cream); text-decoration: none; }
.brand img { width: 36px; height: 36px; }
.brand > span { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--serif); font-size: 19px; }
.brand-sub { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: 6px; }
.nav a:hover { color: var(--cream); background: var(--panel); }
.nav a[aria-current="page"] { color: var(--gold-bright); background: var(--panel); }

main { flex: 1; padding-block: 28px 56px; display: flex; flex-direction: column; gap: 40px; }
.loading, .error { color: var(--muted); }
.error { border: 1px solid var(--britain); border-radius: var(--radius); padding: 14px 16px; }

/* headings and labels */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(34px, 6vw, 54px); line-height: 1.05; }
h2 { font-size: clamp(24px, 3.4vw, 30px); line-height: 1.15; }
h3 { font-size: 20px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
.section-head p { margin: 0; color: var(--muted); font-size: 14px; }

/* phase pill */
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--rule-strong); color: var(--gold-bright); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.open, .pill.live { color: var(--ok); border-color: rgba(127, 191, 122, 0.5); }
.pill.final { color: var(--warn); border-color: rgba(231, 181, 79, 0.55); }
.pill.over, .pill.soon, .pill.idle { color: var(--muted); border-color: var(--rule); }
.pill.live::before { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .pill.live::before { animation: none; } }

/* event hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 32px; align-items: end; }
.hero-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hero-when { font-size: 18px; color: var(--cream); margin: 0; }
.hero-when small { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
.countdown { text-align: right; }
.countdown .label { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.countdown .clock { font-family: var(--serif); font-size: clamp(36px, 5vw, 48px); line-height: 1; color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--rule); }
.facts div { display: flex; flex-direction: column; min-width: 0; }
.facts dt { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.facts dd { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.copy { font: 600 12px var(--sans); color: var(--gold-bright); background: none; border: 1px solid var(--rule-strong); border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.copy:hover { background: var(--panel); }

/* the two sides */
.battle { display: flex; flex-direction: column; gap: 16px; }
.balance { display: grid; gap: 8px; }
.balance-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--panel); }
.balance-bar .l { background: var(--france); }
.balance-bar .r { background: var(--britain); }
.balance-legend { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.balance-legend strong { color: var(--cream); font-weight: 600; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.side { background: var(--panel); border-radius: var(--radius); border-top: 3px solid var(--side); min-width: 0; display: flex; flex-direction: column; }
.side.left { --side: var(--france); --wash: var(--france-wash); }
.side.right { --side: var(--britain); --wash: var(--britain-wash); }
.side-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 14px 16px 10px; border-bottom: 1px solid var(--rule); }
.side-head h3 { font-size: 24px; }
.side-head .total { font-size: 14px; color: var(--muted); white-space: nowrap; }
.side-head .total strong { color: var(--cream); font-size: 18px; font-weight: 600; }
.regs { list-style: none; margin: 0; padding: 6px 0; }
.reg { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 8px 16px; }
.reg + .reg { border-top: 1px solid rgba(201, 168, 76, 0.08); }
.reg-name { min-width: 0; display: flex; flex-direction: column; }
.reg-name .abbr { font-weight: 600; }
.reg-name .full { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.reg-range { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--cream); text-align: right; }
.reg-range small { display: block; font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: 0.04em; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.tag { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--rule-strong); color: var(--gold-bright); }
.tag.rifles { color: var(--cream); border-color: var(--side); background: var(--wash); }
.reg.mark { background: var(--wash); box-shadow: inset 3px 0 0 var(--side); }
.reg.dim { opacity: 0.45; }
.empty { color: var(--muted); padding: 18px 16px; margin: 0; }
.highlight { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.highlight select { font: 15px var(--sans); color: var(--cream); background: var(--panel); border: 1px solid var(--rule-strong); border-radius: 6px; padding: 7px 10px; max-width: 100%; }
.note { font-size: 14px; color: var(--muted); margin: 0; }

/* rules */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; align-items: start; }
.rule { background: var(--panel); border-radius: var(--radius); padding: 0; }
.rule summary { cursor: pointer; list-style: none; padding: 14px 16px; font-family: var(--serif); font-size: 19px; display: flex; justify-content: space-between; gap: 8px; }
.rule summary::-webkit-details-marker { display: none; }
.rule summary::after { content: "+"; font-family: var(--sans); color: var(--gold); }
.rule[open] summary::after { content: "–"; }
.rule-body { padding: 0 16px 14px; display: grid; gap: 8px; font-size: 15px; color: var(--muted); max-width: 65ch; }
.rule-body p { margin: 0; }
.rule-body strong { color: var(--cream); font-weight: 600; }
.small-print { font-size: 14px; color: var(--faint); margin: 0; }

/* results */
.results { display: grid; gap: 14px; }
.night { background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.night-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 14px 16px; }
.night-date { font-family: var(--serif); font-size: 20px; }
.night-meta { font-size: 13px; color: var(--muted); }
.score { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score .f { color: var(--france); font-weight: 600; font-size: 14px; }
.score .b { color: var(--britain); font-weight: 600; font-size: 14px; }
.score .n { font-family: var(--serif); font-size: 28px; line-height: 1; }
.score .won { color: var(--gold-bright); }
.night-body { border-top: 1px solid var(--rule); padding: 14px 16px 16px; display: grid; gap: 14px; }
.highs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px 16px; margin: 0; }
.highs div { min-width: 0; }
.highs dt { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.highs dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.highs dd span { display: block; font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th { text-align: right; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); padding: 6px 10px; border-bottom: 1px solid var(--rule); }
td { text-align: right; padding: 6px 10px; border-bottom: 1px solid rgba(201, 168, 76, 0.07); }
th:first-child, td:first-child { text-align: left; }
td:first-child { font-weight: 600; white-space: nowrap; }
td.side-cell { text-align: left; color: var(--muted); }
.night details summary { cursor: pointer; color: var(--gold-bright); font-size: 14px; font-weight: 500; }
.night-link { font-size: 14px; }

/* front page */
.intro { display: flex; flex-direction: column; gap: 10px; max-width: 65ch; }
.intro p { margin: 0; color: var(--muted); font-size: 17px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.card { background: var(--panel); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; color: var(--cream); text-decoration: none; border: 1px solid transparent; }
a.card:hover { border-color: var(--rule-strong); background: var(--panel-raised); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h2 { font-size: 26px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card .when { color: var(--cream); }
.card .go { color: var(--gold-bright); font-weight: 600; font-size: 14px; margin-top: auto; }
.card.off { opacity: 0.7; }

.footer { border-top: 1px solid var(--rule); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 22px; padding-block: 18px calc(18px + env(safe-area-inset-bottom, 0px)); font-size: 14px; color: var(--faint); }
.footer a { color: var(--muted); }

@media (max-width: 720px) {
    .hero { grid-template-columns: 1fr; }
    .countdown { text-align: left; }
    .sides { grid-template-columns: 1fr; }
}
