/* Belfast Queens match photos — one stylesheet, no build step, no external fonts.
   Colours come from the club badge: deep green, basketball orange, warm cream. */

:root {
  color-scheme: light dark;
  --bg: #f7f3ea;
  --panel: #ffffff;
  --ink: #18231c;
  --muted: #5f6b63;
  --line: #e2ddd0;
  --green: #1f5c3a;
  --green-deep: #14432c;
  --green-soft: #e4eee6;
  --orange: #e2742b;
  --orange-ink: #b4541a;
  --on-green: #f7f3ea;
  --ok-bg: #e4f1e7;  --ok-ink: #1f5c3a;
  --err-bg: #fbe9e4; --err-ink: #a3321c;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(20 40 28 / 6%), 0 8px 24px rgb(20 40 28 / 6%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111814;
    --panel: #18211b;
    --ink: #e9eee9;
    --muted: #9aa79f;
    --line: #2a362e;
    --green: #3f9a66;
    --green-deep: #0f2a1c;
    --green-soft: #1b2e22;
    --orange: #f08c46;
    --orange-ink: #f5a36b;
    --ok-bg: #173023;  --ok-ink: #9fd8b2;
    --err-bg: #3a1c16; --err-ink: #f3a593;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px rgb(0 0 0 / 35%);
  }
}

* { box-sizing: border-box; }
/* No image may exceed its container, whatever else is or isn't loaded. */
img { max-width: 100%; height: auto; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--green); }
a:hover { text-decoration: none; }
.wrap { width: min(1180px, 100% - 2rem); margin-inline: auto; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .82rem; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--green); color: var(--on-green); padding: .5rem 1rem; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ---------- Header / footer ---------- */

.site-head, .gal-head { background: var(--green-deep); color: var(--on-green); }
.head-inner, .gal-head-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; flex-wrap: wrap; }
.brand, .gal-brand { display: flex; align-items: center; gap: .7rem; color: var(--on-green); text-decoration: none; font-weight: 650; }
.brand-mark { height: 36px; width: auto; display: block; flex: none; }
.gal-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.gal-club { font-size: .82rem; opacity: .8; font-weight: 500; }
.gal-team { font-size: 1.15rem; }
.head-nav { display: flex; gap: 1.1rem; align-items: center; font-size: .9rem; }
.head-nav a { color: var(--on-green); }
.who { opacity: .75; }
.preview-bar { background: var(--orange); color: #241205; text-align: center; font-size: .88rem; padding: .45rem 1rem; }
.preview-bar a { color: inherit; font-weight: 650; margin-left: .5rem; }

main { padding-block: 1.6rem 1rem; }
.site-foot { margin-top: 3.5rem; border-top: 1px solid var(--line); padding: 1.3rem 0 2rem; color: var(--muted); font-size: .84rem; }

/* ---------- Type ---------- */

.page-title, .gal-title { font-size: clamp(1.55rem, 1.15rem + 1.6vw, 2.25rem); line-height: 1.15; margin: 0 0 .35rem; letter-spacing: -.02em; }
.gal-title-sub { display: block; font-size: .5em; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: .25rem; }
.lede, .gal-lede { color: var(--muted); margin: 0 0 1.4rem; max-width: 68ch; }
h2 { font-size: 1.2rem; margin: 2.2rem 0 .8rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
.sec-head { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; font-weight: 650; }
.crumbs { font-size: .86rem; margin: 0 0 .5rem; }
.empty { color: var(--muted); padding: 1.5rem 0; }
.prose { max-width: 70ch; }

/* ---------- Controls ---------- */

button, .btn {
  font: inherit; font-size: .92rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .35rem;
  padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
}
button:hover, .btn:hover { border-color: var(--muted); }
.btn-primary, button[type=submit].btn-primary { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-quiet { background: none; border-color: transparent; color: var(--green); }
.btn-danger { background: none; color: var(--err-ink); border: 1px solid currentColor; }
.btn-small { padding: .3rem .65rem; font-size: .82rem; }
button:disabled { opacity: .45; cursor: not-allowed; }
.linkish { color: var(--green); text-decoration: underline; cursor: pointer; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg); color: var(--ink); width: 100%; min-width: 0;
}
textarea { resize: vertical; }
label { display: block; font-size: .82rem; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: .25rem; }
.check { display: flex; align-items: center; gap: .45rem; color: var(--ink); font-size: .9rem; }
.check input { width: auto; margin: 0; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem; }
.span-2 { grid-column: 1 / -1; }
.score-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
fieldset.team-ticks { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
fieldset.team-ticks legend { font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }
.form-narrow { max-width: 26rem; margin-inline: auto; text-align: left; }
.form-narrow label { margin-bottom: .9rem; }
.inline-form { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.inline-form input[type=text], .inline-form input[type=date] { width: auto; flex: 1 1 9rem; }
.filters { display: flex; gap: .9rem; align-items: end; flex-wrap: wrap; margin-bottom: 1.4rem; }
.filters label { min-width: 12rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 2rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.5rem; }
.panel > h2:first-child { margin-top: 0; }

.flash { padding: .65rem .9rem; border-radius: 8px; margin: 0 0 1.1rem; font-size: .92rem; }
.flash-ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash-err { background: var(--err-bg); color: var(--err-ink); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wide { white-space: normal; min-width: 14rem; }
tr.dead, .dead { opacity: .5; }

/* ---------- Front door ---------- */

.door { max-width: 34rem; margin: 1.5rem auto 0; text-align: center; }
.door-mark { display: block; margin: 0 auto 1.6rem; }
.door-mark img { display: block; width: min(300px, 75vw); height: auto; margin: 0 auto; }
.door-mark-sm img { width: 190px; }
.door h1 { font-size: 1.6rem; margin: 0 0 .7rem; }
.door-staff { margin-top: 2.2rem; font-size: .88rem; }

.note-page { max-width: 30rem; margin: 12vh auto 0; padding: 0 1.25rem; text-align: center; }
.note-mark { display: block; margin: 0 auto 1.4rem; }
.note-mark img { display: block; width: 200px; height: auto; margin: 0 auto; }
.note-page h1 { font-size: 1.35rem; margin: 0 0 .5rem; }
.note-page p { color: var(--muted); }

/* ---------- Season listing ---------- */

.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.1rem; }
.mcard { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: transform .12s; }
.mcard:hover { transform: translateY(-2px); }
.mcard-thumb { position: relative; display: block; aspect-ratio: 3 / 2; background: var(--green-soft); }
.mcard-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mcard-empty { position: absolute; inset: 0; background: radial-gradient(circle at 50% 55%, var(--orange) 0 18%, transparent 19%), var(--green-soft); opacity: .5; }
.mcard-score { position: absolute; left: .55rem; bottom: .55rem; font-size: .78rem; font-weight: 700; padding: .2rem .5rem; border-radius: 6px; background: rgb(0 0 0 / 70%); color: #fff; }
.mcard-won { background: var(--green); }
.mcard-body { display: block; padding: .7rem .85rem .85rem; }
.mcard-date { display: block; font-size: .78rem; color: var(--muted); }
.mcard-title { display: block; font-weight: 650; font-size: 1.05rem; margin: .1rem 0; }
.mcard-meta { display: block; font-size: .82rem; color: var(--muted); }

/* ---------- Match page ---------- */

.gal-back { display: inline-block; font-size: .88rem; margin-bottom: .8rem; }
.match-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.match-score { text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem .9rem; flex: none; }
.match-score span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.match-score strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.match-won { border-color: var(--green); }
.match-won span { color: var(--green); }
.match-notes { background: var(--panel); border-left: 3px solid var(--orange); padding: .6rem .9rem; border-radius: 0 8px 8px 0; max-width: 70ch; }

.videos { margin: 1.5rem 0 2rem; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin-top: .7rem; }
.vcard { margin: 0; background: #000; border-radius: var(--radius); overflow: hidden; }
.vcard video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.vcard figcaption { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .8rem; background: var(--panel); font-size: .88rem; flex-wrap: wrap; }

.ptools { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.5rem 0 .8rem; flex-wrap: wrap; }
.ptools-actions { display: flex; gap: .5rem; }
.selbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  background: var(--green-deep); color: var(--on-green); padding: .55rem .8rem; border-radius: var(--radius); margin-bottom: .8rem;
}
.selbar[hidden] { display: none; }
.selbar .btn-quiet { color: var(--on-green); }
.selbar-count { font-weight: 650; margin-right: .5rem; }
.selbar-gap { flex: 1; }
.selbar .btn-primary { background: var(--orange); border-color: var(--orange); color: #241205; }

.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.pcell { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 6px; background: var(--green-soft); }
.pcell img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s, opacity .15s; }
.pcell:hover img { transform: scale(1.03); }
.pcheck { display: none; }
.selecting .pcheck {
  display: block; position: absolute; top: .45rem; right: .45rem; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  border: 2px solid #fff; background: rgb(0 0 0 / 30%); box-shadow: 0 1px 4px rgb(0 0 0 / 40%);
}
.selecting .pcell.selected .pcheck { background: var(--orange); border-color: var(--orange); }
.selecting .pcell.selected .pcheck::after { content: ""; position: absolute; left: .45rem; top: .2rem; width: .4rem; height: .75rem; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.selecting .pcell.selected img { opacity: .75; }

/* ---------- Lightbox & slideshow (built by gallery.js) ---------- */

.lb { position: fixed; inset: 0; z-index: 100; background: #0b0d0c; color: #eee; display: flex; flex-direction: column; touch-action: none; }
.lb[hidden] { display: none; }
.lb-top { display: flex; align-items: center; gap: .4rem; padding: .5rem .6rem; padding-top: max(.5rem, env(safe-area-inset-top)); }
.lb-count { flex: 1; font-size: .9rem; opacity: .8; padding-left: .4rem; font-variant-numeric: tabular-nums; }
.lb-btn {
  background: rgb(255 255 255 / 8%); border: 0; color: #fff; border-radius: 8px; padding: .5rem .75rem; font-size: .9rem; cursor: pointer;
}
.lb-btn:hover { background: rgb(255 255 255 / 18%); }
.lb-btn[aria-pressed="true"] { background: var(--orange); color: #241205; }
.lb-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; transition: opacity .25s; }
.lb-img.loading { opacity: .25; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 3rem; height: 4.5rem; border: 0; border-radius: 8px;
  background: rgb(255 255 255 / 6%); color: #fff; font-size: 1.8rem; cursor: pointer;
}
.lb-nav:hover { background: rgb(255 255 255 / 16%); }
.lb-prev { left: .6rem; }
.lb-next { right: .6rem; }
.lb-progress { height: 3px; background: rgb(255 255 255 / 10%); }
.lb-progress span { display: block; height: 100%; width: 0; background: var(--orange); }
.lb.playing .lb-nav, .lb.playing .lb-top { opacity: 0; transition: opacity .4s; }
.lb.playing:hover .lb-nav, .lb.playing:hover .lb-top { opacity: 1; }
@media (hover: none) { .lb-nav { display: none; } }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 200;
  background: #1d2620; color: #fff; padding: .7rem 1.1rem; border-radius: 10px; font-size: .9rem; box-shadow: 0 6px 24px rgb(0 0 0 / 35%);
  max-width: calc(100% - 2rem);
}
.toast button { margin-left: .6rem; background: var(--orange); color: #241205; border: 0; }

/* ---------- Admin ---------- */

.admin-nav { display: flex; gap: .2rem; flex-wrap: wrap; margin-bottom: 1.6rem; border-bottom: 1px solid var(--line); }
.admin-nav a { padding: .55rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: .92rem; }
.admin-nav a.on { color: var(--ink); border-color: var(--orange); font-weight: 650; }

.team-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.team-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.team-card header { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.team-card h2 { margin: 0; }
.team-card-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0 0; }
.linkline { margin: .3rem 0 .6rem; }
.linkline .hint { display: block; margin-top: .2rem; }
.linkbox { display: flex; gap: .35rem; align-items: center; }
.share-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem !important; }

.match-admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 2rem 1rem; text-align: center; background: var(--bg);
  transition: background .15s, border-color .15s;
}
.dropzone.over { border-color: var(--orange); background: var(--green-soft); }
.dropzone p { margin: .2rem 0; }
.upq { margin-top: 1rem; }
.upq-bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.upq-bar span { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }
.upq-status { font-size: .9rem; margin: .5rem 0; }
.upq-errors { color: var(--err-ink); font-size: .85rem; margin: 0; padding-left: 1.1rem; }
.ftp-import { margin-top: 1rem; }
.ftp-import summary { cursor: pointer; color: var(--green); font-size: .92rem; }
.folder-list { list-style: none; padding: 0; margin: .6rem 0 0; }
.folder-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }

.photo-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.photo-actions select { width: auto; }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.acell { position: relative; display: block; aspect-ratio: 3 / 2; border-radius: 6px; overflow: hidden; cursor: pointer; background: var(--green-soft); }
.acell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acell input { position: absolute; top: .35rem; left: .35rem; width: 1.15rem; height: 1.15rem; z-index: 1; margin: 0; }
.acell:has(input:checked) { outline: 3px solid var(--orange); outline-offset: -3px; }
.acell-hidden img { opacity: .35; filter: grayscale(1); }
.abadge { position: absolute; right: .3rem; bottom: .3rem; font-size: .68rem; font-weight: 700; padding: .1rem .35rem; border-radius: 4px; background: rgb(0 0 0 / 70%); color: #fff; }
.abadge-cover { background: var(--orange); color: #241205; bottom: auto; top: .3rem; }

.video-row { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; margin-bottom: 1rem; }
.video-row .form-grid { border: 0; padding: 0; background: none; }
.person { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.person header { margin-bottom: .6rem; }
.person header .hint { display: block; }
.person .form-grid { border: 0; padding: 0; background: none; }
.person-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.danger-zone { margin-top: 3rem; padding: 1rem 1.1rem; border: 1px solid var(--err-ink); border-radius: var(--radius); }
.danger-zone h2 { margin-top: 0; color: var(--err-ink); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.8rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stat b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: .8rem; }
.top-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.top-photo { text-decoration: none; color: var(--muted); font-size: .8rem; }
.top-photo img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; display: block; margin-bottom: .25rem; }

.chart { margin: 0 0 1.8rem; }
.chart figcaption { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .45rem; }
.chart-bars { display: flex; align-items: flex-end; gap: 1px; height: 110px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; }
.chart-bar { position: relative; display: flex; align-items: flex-end; height: 100%; }
.chart-bar > span:first-child { width: 100%; background: var(--green); border-radius: 2px 2px 0 0; }
.chart-tip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: .72rem; padding: .15rem .4rem; border-radius: 4px; white-space: nowrap; opacity: 0; pointer-events: none; }
.chart-bar:hover .chart-tip { opacity: 1; }
.chart-scale { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); margin: .3rem 0 0; }

@media (max-width: 640px) {
  .wrap { width: calc(100% - 1.5rem); }
  .pgrid { grid-template-columns: repeat(3, 1fr); gap: 3px; }
  .pcell { border-radius: 3px; aspect-ratio: 1; }
  .mgrid { grid-template-columns: 1fr; }
  .gal-team { font-size: 1rem; }
  .brand-mark { height: 28px; }
  .gal-club { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ptools-actions .btn { padding: .45rem .75rem; }
  th, td { padding: .45rem .5rem; }
  .match-head { flex-direction: column; }
}
