:root {
  --navy: #10275b;
  --navy-2: #1d3d82;
  --ink: #1b2333;
  --muted: #566074;
  --fairway: #2f7a3b;
  --turf: #eef4ec;
  --gold: #b48a3c;
  --flag: #c4122f;
  --line: #d5dccf;
  --paper: #fff;
  --display: "Cinzel", Georgia, serif;
  --body: "Barlow", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.125rem/1.6 var(--body); }
img { max-width: 100%; display: block; }
a { color: var(--navy); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--fairway); outline-offset: 2px; }
[hidden] { display: none !important; }

h1, h2 { font-family: var(--display); font-weight: 700; color: var(--navy); line-height: 1.2; margin: 0 0 .6em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.15rem; font-weight: 600; margin: 1.6em 0 .5em; }
p { margin: 0 0 1em; }

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 20px; }
.section { padding: clamp(48px, 8vw, 88px) 0; }
.section-turf { background: var(--turf); }

/* Hero */
.hero img { width: 100%; height: auto; }
.band { background: var(--navy); color: #fff; border-top: 4px solid var(--gold); }
.band-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 22px; padding-bottom: 22px; }
.band h1 { color: #fff; font-size: clamp(1.35rem, 3.2vw, 2.2rem); margin: 0 0 4px; }
.band p { margin: 0; color: #d9e0ee; }
.band :focus-visible, .footer :focus-visible { outline-color: #f1c45b; }

/* Buttons */
.btn { display: inline-block; border: 0; border-radius: 4px; padding: 13px 26px; background: var(--navy); color: #fff; font: 600 1.05rem/1.2 var(--body); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--navy-2); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-light { background: #fff; color: var(--navy); }
.btn-light:hover { background: var(--turf); }
.link { background: none; border: 0; padding: 0; color: var(--navy); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* About + scorecard */
.about { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(32px, 6vw, 72px); align-items: start; }
.prose { max-width: 62ch; }
.teams { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 24px; }
.teams li { position: relative; padding-left: 22px; font-weight: 500; }
.teams li::before { /* the pin flag from the event mark */
  content: ""; position: absolute; left: 2px; top: .42em; border-left: 12px solid var(--flag); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}

.scorecard { margin: 0; border: 1px solid var(--gold); background: #fff; }
.scorecard figcaption { padding: 18px 20px; background: var(--turf); border-bottom: 1px solid var(--gold); }
.scorecard figcaption strong { display: block; font: 700 1.25rem/1.3 var(--display); color: var(--navy); }
.scorecard figcaption span { display: block; margin-top: 4px; color: var(--muted); font-size: 1rem; line-height: 1.45; }
.scorecard table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.scorecard th, .scorecard td { padding: 10px 14px; text-align: center; border-bottom: 1px solid var(--line); }
.scorecard td + td, .scorecard th + td, .scorecard thead th + th { border-left: 1px solid var(--line); }
.scorecard th[scope=row] { text-align: left; font-weight: 600; }
.scorecard thead th { font-size: .85rem; font-weight: 600; color: var(--muted); }
.scorecard tfoot th, .scorecard tfoot td { font-weight: 600; color: var(--navy); border-top: 3px double var(--gold); border-bottom: 0; }
.scorecard > a { display: block; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 1rem; }

/* Sponsors: logo cards keep their own brand backgrounds */
.sponsors { padding: 40px 0 48px; border-top: 1px solid var(--line); }
.sponsors h2 { font-size: clamp(1.3rem, 2.4vw, 1.6rem); margin-bottom: 0; }
.sponsor-tier { margin: 22px 0 10px; text-align: center; font-size: 1rem; font-weight: 600; color: var(--muted); }
/* One centred row per tier; logo size shows the tier: presenting > associates > partners */
.sponsor-grid { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.tier-presenting li { width: 360px; }
.tier-associates li { width: 260px; }
.tier-partners li { width: calc((100% - 4 * 14px) / 5); max-width: 200px; }
.sponsor-grid img { display: block; width: 100%; height: auto; aspect-ratio: 8 / 3; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 1px var(--line); }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; border-radius: 3px; } /* tall images keep their title/heads */
.gallery a { display: block; cursor: zoom-in; }
.gallery.collapsed a:nth-child(n+9) { display: none; }
.gallery-more { margin-top: 24px; }

/* Lightbox: the dialog itself is the full-screen dark layer, so a click on it (not the photo) closes */
body:has(.lightbox[open]) { overflow: hidden; }
.lightbox { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 84px 92px; border: 0; background: #09142e; color: #fff; }
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: transparent; }
.lightbox figure { margin: 0; display: grid; justify-items: center; gap: 12px; }
.lightbox img { /* padding above keeps the controls off the photo */
  max-width: min(calc(100vw - 184px), 1400px); max-height: calc(100vh - 210px); max-height: calc(100dvh - 210px); object-fit: contain; border-radius: 3px;
}
.lightbox figcaption { color: #d9e0ee; font-size: 1rem; }
.lb-btn { position: fixed; display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; background: rgb(255 255 255 / .14); color: #fff; cursor: pointer; }
.lb-btn:hover { background: rgb(255 255 255 / .26); }
.lb-btn svg { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.lb-prev { left: 20px; top: 50%; translate: 0 -50%; }
.lb-next { right: 20px; top: 50%; translate: 0 -50%; }
.lb-close { right: 20px; top: 20px; }
.lightbox :focus-visible { outline-color: #f1c45b; }

/* Registration */
.lead { color: var(--muted); max-width: 60ch; }
.steps { display: flex; gap: 8px; padding: 0; margin: 28px 0 20px; list-style: none; counter-reset: s; }
.steps li { flex: 1; counter-increment: s; padding: 8px 0; border-bottom: 3px solid var(--line); color: var(--muted); font-weight: 500; }
.steps li::before { content: counter(s) ". "; }
.steps li[aria-current] { color: var(--navy); font-weight: 600; border-color: var(--fairway); }

.panel { border: 1px solid var(--line); border-radius: 6px; padding: clamp(20px, 4vw, 32px); background: #fff; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 24px; }
.full { grid-column: 1 / -1; }
.f { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.f small { font-weight: 400; font-size: .92rem; }
.hint { color: var(--muted); }
.req { color: var(--flag); }
.as { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 22px; padding: 0; border: 0; }
.as legend { padding: 0; margin-bottom: 8px; font-weight: 500; }
.as label { flex: 1 1 220px; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid #aab4a5; border-radius: 4px; font-weight: 500; cursor: pointer; }
.as label:has(:checked) { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: var(--turf); }
.as input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--navy); }
.req-note { margin: 0 0 20px; color: var(--muted); font-size: 1rem; }
.err { color: var(--flag); }
.err:empty { display: none; }

input, select {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #aab4a5; border-radius: 4px;
  background-color: #fff; color: var(--ink); font: 400 1.05rem var(--body);
}
/* Own chevron instead of the browser arrow, which sits flush against the border */
select {
  appearance: none; padding-right: 42px; text-overflow: ellipsis; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2310275b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 16px center / 12px 8px;
}
input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--fairway) 45%, transparent); outline-offset: 0; border-color: var(--fairway); }
input[readonly] { background-color: var(--turf); }
select:disabled { background-color: #f4f5f3; color: var(--muted); cursor: not-allowed; }
input:user-invalid, select:user-invalid { border-color: var(--flag); }
.tel { display: grid; grid-template-columns: minmax(0, 10rem) 1fr; gap: 8px; }

.sizes summary { cursor: pointer; color: var(--navy); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; width: fit-content; }
.table-scroll { overflow-x: auto; margin-top: 14px; }
.sizes table { border-collapse: collapse; width: 100%; font-size: .95rem; font-variant-numeric: tabular-nums; }
.sizes caption { text-align: left; font-weight: 600; padding-bottom: 8px; }
.sizes th, .sizes td { border: 1px solid var(--line); padding: 6px 10px; text-align: center; white-space: nowrap; }
.sizes th[scope=row] { text-align: left; background: var(--turf); }
.sizes thead th { background: var(--navy); color: #fff; font-weight: 600; }

.fees { width: 100%; margin: 32px 0 20px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.fees th { text-align: left; font-weight: 400; padding: 8px 0; }
.fees td { text-align: right; padding: 8px 0; }
.fees .total th, .fees .total td { border-top: 3px double var(--gold); font-weight: 600; font-size: 1.3rem; color: var(--navy); padding-top: 12px; }
.fees small { font-size: .9rem; font-weight: 400; color: var(--muted); margin-left: 6px; }
.btn-pay { width: 100%; padding: 17px; font-size: 1.15rem; }
.msg { margin: 12px 0 0; font-weight: 500; color: var(--flag); }
.msg:empty { display: none; }
.fine { margin: 12px 0 0; font-size: .95rem; color: var(--muted); }
.done { border-left: 5px solid var(--fairway); }
.done h3 { margin-top: 0; font: 700 1.5rem var(--display); color: var(--navy); }

/* Footer */
.footer { background: var(--navy); color: #d9e0ee; padding: 40px 0; font-size: 1rem; }
.footer a { color: #fff; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-title { font: 700 1.1rem var(--display); color: #fff; }
.social { list-style: none; padding: 0; margin: 0; display: flex; gap: 20px; flex-wrap: wrap; }

/* Admin */
.admin { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 24px 16px; background: var(--navy); color: #d9e0ee; border-right: 4px solid var(--gold); }
.sidebar-title { margin: 0 8px 12px; font: 700 1.2rem/1.3 var(--display); color: #fff; }
.sidebar-title span { display: block; font: 500 .95rem var(--body); color: #d9e0ee; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin: 18px 8px 6px; font-size: .9rem; color: #9fb0d0; }
.sidebar nav a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 4px; color: #fff; text-decoration: none; }
.sidebar nav a:hover { background: rgb(255 255 255 / .08); }
.sidebar nav a[aria-current] { background: rgb(255 255 255 / .14); box-shadow: inset 3px 0 0 var(--gold); font-weight: 600; }
.count { min-width: 2.2em; padding: 1px 8px; border-radius: 99px; background: rgb(255 255 255 / .14); font-size: .88rem; text-align: center; font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 8px; font-size: 1rem; }
.sidebar-foot a, .sidebar-foot .link { color: #fff; text-align: left; }
.sidebar :focus-visible { outline-color: #f1c45b; }

.admin-main { padding: 28px clamp(16px, 3vw, 40px) 48px; min-width: 0; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-head h1 { margin: 0; font-size: 1.6rem; }
.stats { display: flex; gap: 36px; flex-wrap: wrap; margin: 0 0 24px; }
.stats b { display: block; font-size: 1.6rem; color: var(--navy); font-variant-numeric: tabular-nums; }
.data { overflow: auto; max-height: calc(100vh - 220px); border: 1px solid var(--line); border-radius: 4px; }
.data table { border-collapse: collapse; font-size: .92rem; min-width: 100%; }
.data th, .data td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.data th { position: sticky; top: 0; background: var(--turf); }
.data tbody tr:hover { background: #f7f9f5; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .85rem; font-weight: 600; }
.badge-paid { background: #e3f1e4; color: #1f5a29; }
.badge-pending { background: #faf0d9; color: #7a5410; }
.badge-sponsor { background: #e2e8f5; color: var(--navy); }
.places { margin: 0 0 24px; }
.places h2 { margin: 0 0 10px; font: 600 1.05rem var(--body); color: var(--ink); }
.places ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.places li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; font-size: .95rem; }
.places li b { font-variant-numeric: tabular-nums; color: var(--navy); }
.places li em { font-style: normal; font-size: .8rem; font-weight: 600; color: var(--flag); }
.places li.is-full { border-color: var(--flag); background: #fbeaec; }
.modal { width: min(480px, calc(100vw - 32px)); padding: 28px; border: 0; border-radius: 8px; color: var(--ink); box-shadow: 0 24px 60px rgb(9 20 46 / .35); }
.modal::backdrop { background: rgb(9 20 46 / .55); }
.modal h2 { margin: 0 0 12px; font: 600 1.35rem var(--body); color: var(--navy); }
.modal-contact { font-weight: 600; line-height: 1.8; }
.modal-actions { display: flex; justify-content: flex-end; margin: 20px 0 0; }
.empty { color: var(--muted); }
.btn-quiet { background: #fff; color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.btn-quiet:hover { background: var(--turf); }
.flash { padding: 12px 16px; background: var(--turf); border-left: 4px solid var(--fairway); margin-bottom: 16px; }
.login { max-width: 400px; margin: 10vh auto; }
.login .f + .f { margin-top: 16px; }
.login .btn { margin-top: 20px; width: 100%; }
textarea { width: 100%; min-height: 140px; padding: 10px 12px; border: 1px solid #aab4a5; border-radius: 4px; font: 1rem var(--body); }

@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 16px; border-right: 0; border-bottom: 4px solid var(--gold); }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .nav-group { display: none; }
  .sidebar-foot { flex-direction: row; justify-content: space-between; margin-top: 8px; }
}
@media (max-width: 640px) {
  body { font-size: 1.0625rem; }
  .wrap { padding-inline: 16px; }
  .band-inner { flex-direction: column; align-items: flex-start; }
  .grid { grid-template-columns: 1fr; }
  .tel { grid-template-columns: 8.5rem 1fr; }
  .steps li { font-size: .95rem; }
  .gallery { grid-template-columns: 1fr 1fr; gap: 8px; } /* two per row on phones */
  .sponsor-grid { gap: 8px; }
  .sponsor-tier { margin: 18px 0 8px; }
  .sponsor-grid li { width: calc(50% - 4px); max-width: none; }
  .tier-presenting li { width: 75%; }
  .lb-prev, .lb-next { top: auto; bottom: 24px; translate: none; } /* below the photo, not over it */
  .lb-prev { left: calc(50% - 64px); }
  .lb-next { right: calc(50% - 64px); }
  .lightbox { padding: 84px 0 100px; }
  .lightbox img { max-width: 100vw; max-height: calc(100dvh - 230px); border-radius: 0; }
}
