/* RR District Archery 2026 — "The Score Sheet"
   Paper ground, one ink, ruled cells. Target-face colours are notation only:
   gold / red / blue mark medals, the State tick and the sheet's edge. */
:root {
  --paper: #f5f5f2;
  --paper-2: #ebebe6;
  --cell: #e2e2dc;
  --ink: #14161b;
  --ink-2: #3c3f47;
  --muted: #5d6068;
  --rule: #14161b;
  --rule-soft: #cfcfc8;
  --gold: #e2b72f;
  --red: #cf3a2f;
  --blue: #2d6cb5;
  --silver: #b9bec7;
  --bronze: #b57a48;
  --hit: #fbeeb8;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --topbar-h: 54px;
  --bar-h: 74px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + var(--bar-h) + 8px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; caret-color: var(--red);
  font-variant-numeric: tabular-nums;
}
::selection { background: var(--gold); color: var(--ink); }
img, video { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(14px, env(safe-area-inset-left));
  background: var(--paper); border-bottom: 2px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--cond); font-weight: 700; font-size: 19px; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.brand-mark, .footer-mark { width: 26px; height: 26px; stroke: none; }
.brand-mark .w, .footer-mark .w { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; }
.brand-mark .b, .footer-mark .b { fill: var(--blue); }
.brand-mark .r, .footer-mark .r { fill: var(--red); }
.brand-mark .g, .footer-mark .g { fill: var(--gold); }
.topnav { display: flex; }
.topnav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  text-decoration: none; font-family: var(--cond); font-weight: 600; font-size: 17px; letter-spacing: 0.04em; text-transform: uppercase;
}
.topnav a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.target-rule { position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 40; display: flex; height: 4px; }
.target-rule i { flex: 1; }
.target-rule i:nth-child(1) { background: var(--gold); }
.target-rule i:nth-child(2) { background: var(--red); }
.target-rule i:nth-child(3) { background: var(--blue); }
.target-rule i:nth-child(4) { background: var(--ink); }
.target-rule i:nth-child(5) { background: #fff; }
.topbar { gap: 8px; }
.brand { min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }
.topnav { flex: 0 0 auto; }
@media (max-width: 440px) {
  .b-long { display: none; }
  .topnav a { padding: 0 9px; }
}
@media (max-width: 400px) {
  .seg button { padding: 0 6px; }
  .seg[data-filter="bow"] { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .seg[data-filter="bow"] button:nth-child(odd) { border-left: 0; }
  .seg[data-filter="bow"] button:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 350px) {
  .brand { font-size: 17px; gap: 7px; }
  .brand-mark { width: 22px; height: 22px; }
  .topnav a { padding: 0 7px; font-size: 16px; }
}

/* ---------- hero: the photo, then the sheet's title block ---------- */
.hero { padding-top: calc(var(--topbar-h) + 4px); }
.hero-photo {
  height: min(46svh, 440px); min-height: 230px;
  background: #8a6a52 url("assets/hero.jpg") center 56% / cover no-repeat;
}
.sheet-head {
  position: relative; max-width: 1120px; margin: -42px 12px 0; padding: 18px 16px;
  background: var(--paper); border: 2px solid var(--rule);
  box-shadow: 0 14px 30px -18px rgba(20, 22, 27, 0.55);
}
@media (min-width: 1144px) { .sheet-head { margin: -72px auto 0; padding: 26px 28px; } }
.sheet-head h1 {
  margin: 0; font-family: var(--cond); font-weight: 700; text-transform: uppercase;
  font-size: clamp(40px, 11.5vw, 84px); line-height: 0.92; letter-spacing: -0.005em; text-wrap: balance;
}
.head-grid {
  display: grid; grid-template-columns: 1fr 1fr; margin: 16px 0 0;
  border-top: 2px solid var(--rule); border-left: 2px solid var(--rule);
}
.head-grid > div { padding: 8px 10px 9px; border-right: 2px solid var(--rule); border-bottom: 2px solid var(--rule); min-width: 0; }
.head-grid dt { font-family: var(--cond); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.head-grid dd { margin: 2px 0 0; font-weight: 600; font-size: 15px; line-height: 1.3; }
@media (min-width: 760px) { .head-grid { grid-template-columns: repeat(4, 1fr); } .head-grid dd { font-size: 16px; } }
.btn {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 16px;
  min-height: 48px; padding: 0 22px; background: var(--ink); color: var(--paper);
  text-decoration: none; font-family: var(--cond); font-weight: 600; font-size: 20px; letter-spacing: 0.04em; text-transform: uppercase;
  transition: background .15s ease;
}
.btn svg { width: 20px; height: 20px; stroke-width: 2.4; }
.btn:hover { background: var(--ink-2); }
.btn:active { transform: translateY(1px); }

/* ---------- section heads ---------- */
.section-head { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.section-head h2 {
  margin: 0; font-family: var(--cond); font-weight: 700; text-transform: uppercase;
  font-size: clamp(36px, 8vw, 56px); line-height: 1; letter-spacing: 0.005em;
}
.section-head p { margin: 6px 0 0; color: var(--ink-2); max-width: 60ch; text-wrap: pretty; }
@media (min-width: 760px) { .section-head { padding: 0 20px; } }

/* ---------- results ---------- */
.results { padding: 40px 0 24px; }
.searchbar {
  position: sticky; top: calc(var(--topbar-h) + 4px); z-index: 30;
  max-width: 1120px; margin: 16px auto 0; padding: 12px 16px;
  background: var(--paper); border-bottom: 2px solid var(--rule);
}
@media (min-width: 760px) { .searchbar { padding: 12px 20px; } }
.search { position: relative; display: flex; align-items: center; background: #fff; border: 2px solid var(--rule); }
.search:focus-within { box-shadow: 0 0 0 3px var(--gold); }
.search > svg { position: absolute; left: 14px; width: 20px; height: 20px; color: var(--ink-2); pointer-events: none; }
.search input {
  width: 100%; min-height: 46px; padding: 0 50px 0 46px; border: 0; background: transparent;
  color: var(--ink); font: inherit; font-size: 18px; font-weight: 500; outline: none; border-radius: 0;
}
.search input::placeholder { color: var(--muted); font-weight: 400; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute; right: 1px; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center;
}
.search-clear svg { width: 20px; height: 20px; }

.filters { max-width: 1120px; margin: 12px auto 0; padding: 0 16px; display: grid; gap: 8px; }
@media (min-width: 760px) { .filters { padding: 0 20px; grid-template-columns: auto auto; justify-content: start; gap: 12px; } }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 2px solid var(--rule); background: #fff; }
.seg button {
  min-height: 44px; padding: 0 10px; border: 0; border-left: 1px solid var(--rule); background: transparent; cursor: pointer;
  font-family: var(--cond); font-weight: 600; font-size: 17px; letter-spacing: 0.02em; white-space: nowrap;
}
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--paper-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.filters.dim .seg { opacity: 0.45; }

.legend {
  max-width: 1120px; margin: 14px auto 0; padding: 0 16px;
  display: grid; gap: 4px; font-size: 14px; color: var(--ink-2);
}
.legend > div { display: grid; grid-template-columns: 76px 1fr; gap: 8px; align-items: baseline; }
.legend dt { font-family: var(--cond); font-weight: 700; font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.legend dd { margin: 0; text-wrap: pretty; }
@media (min-width: 760px) { .legend { padding: 0 20px; } }

.tick {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold); border: 1.5px solid var(--ink); flex: 0 0 auto; vertical-align: middle;
}
.tick::after { content: ""; width: 9px; height: 5px; border-left: 2.4px solid var(--ink); border-bottom: 2.4px solid var(--ink); transform: translateY(-1px) rotate(-45deg); }

.result-count { max-width: 1120px; margin: 18px auto 0; padding: 0 16px; font-family: var(--cond); font-weight: 600; font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
@media (min-width: 760px) { .result-count { padding: 0 20px; } }
.cards {
  max-width: 1120px; margin: 8px auto 0; padding: 0 12px;
  display: grid; gap: 16px; align-items: start;
}
.cards.searching { min-height: 70svh; }
@media (min-width: 760px) { .cards { grid-template-columns: 1fr 1fr; padding: 0 20px; } }
@media (min-width: 1100px) { .cards { grid-template-columns: repeat(3, 1fr); } }

/* a category = one ruled scorecard */
.card { background: #fff; border: 2px solid var(--rule); animation: settle .35s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes settle { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card-head {
  display: grid; grid-template-columns: 1fr auto; gap: 0 10px; align-items: start;
  padding: 10px 10px 9px 12px; border-bottom: 2px solid var(--rule); background: var(--paper-2);
}
.card-age { font-family: var(--cond); font-weight: 700; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.card h3 { grid-column: 1; margin: 0; font-family: var(--cond); font-weight: 700; font-size: 26px; line-height: 1.05; text-transform: uppercase; }
.card-sub { grid-column: 1; margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.share {
  grid-column: 2; grid-row: 1 / span 3; align-self: center;
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border: 2px solid var(--rule); background: #fff; cursor: pointer;
  font-family: var(--cond); font-weight: 600; font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase;
}
.share svg { width: 18px; height: 18px; }
.share:hover { background: var(--paper); }

.sheet { width: 100%; border-collapse: collapse; }
.sheet th {
  padding: 6px 8px; text-align: left; background: var(--cell); border-bottom: 1px solid var(--rule);
  font-family: var(--cond); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
}
.sheet .c-rk { width: 50px; text-align: center; border-right: 1px solid var(--rule-soft); }
.sheet .c-st { width: 54px; text-align: center; border-left: 1px solid var(--rule-soft); }
.sheet .c-sc { width: 66px; text-align: right; border-left: 1px solid var(--rule-soft); }
.sheet td { padding: 9px 8px; border-top: 1px solid var(--rule-soft); vertical-align: middle; }
.sheet tbody tr:first-child td { border-top: 0; }
td.c-nm { font-weight: 600; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.c-nm small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
td.c-rk { font-family: var(--cond); font-weight: 700; font-size: 20px; }
td.c-sc { font-family: var(--cond); font-weight: 700; font-size: 24px; line-height: 1; }
.medal {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--ink); font-size: 18px;
}
.m1 .medal { background: var(--gold); }
.m2 .medal { background: var(--silver); }
.m3 .medal { background: var(--bronze); }
.m1 td.c-nm { font-size: 18px; } .m1 td.c-sc { font-size: 28px; }
tr.hit td { background: var(--hit); }
mark { background: var(--gold); color: var(--ink); padding: 0 1px; }
.row-share {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; padding: 0; border: 0; background: none; cursor: pointer;
  font-family: var(--cond); font-weight: 600; font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--blue);
  min-height: 36px;
}
.row-share svg { width: 16px; height: 16px; }
.card-foot { margin: 0; padding: 9px 12px 10px; border-top: 2px solid var(--rule); font-size: 14px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; }

.empty { max-width: 1120px; margin: 24px auto; padding: 28px 20px; text-align: center; color: var(--ink-2); }

/* ---------- gallery ---------- */
.gallery { padding: 48px 0 40px; border-top: 2px solid var(--rule); margin-top: 40px; }
.album-tabs { max-width: 1080px; margin: 16px 16px 0; grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.album-tabs button { border-left: 0; border-top: 1px solid var(--rule); white-space: normal; line-height: 1.15; padding: 8px 10px; }
.album-tabs button:nth-child(even) { border-left: 1px solid var(--rule); }
.album-tabs button:first-child { grid-column: 1 / -1; border-top: 0; }
@media (min-width: 900px) {
  .album-tabs { margin: 16px auto 0; grid-auto-flow: column; grid-template-columns: none; }
  .album-tabs button, .album-tabs button:nth-child(even) { border-top: 0; border-left: 1px solid var(--rule); }
  .album-tabs button:first-child { grid-column: auto; border-left: 0; }
}
.grid {
  max-width: 1120px; margin: 16px auto 0; padding: 0 12px;
  display: grid; gap: 4px; grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 20px; } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.tile { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--cell); border: 0; padding: 0; cursor: zoom-in; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.16, 1, .3, 1), opacity .4s ease; opacity: 0; }
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.03); }
.tile.video { cursor: default; grid-column: span 2; aspect-ratio: 16 / 9; background: #000; }
.tile.video video { width: 100%; height: 100%; object-fit: contain; }

.lightbox {
  width: 100vw; height: 100svh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #0d0e11; color: #f2efe8;
}
.lightbox::backdrop { background: #0d0e11; }
.lightbox[open] { display: grid; grid-template-rows: 1fr auto; }
.lightbox figure { margin: 0; display: grid; place-items: center; align-content: center; gap: 10px; padding: 64px 8px 8px; min-height: 0; }
.lightbox img { max-width: 100%; max-height: calc(100svh - 180px); object-fit: contain; }
.lightbox figcaption { font-family: var(--cond); font-size: 16px; letter-spacing: 0.04em; color: #b9b5ac; }
.lb-close, .lb-nav {
  display: grid; place-items: center; width: 52px; height: 52px; cursor: pointer;
  border: 2px solid #f2efe8; background: transparent; color: #f2efe8;
}
.lb-close svg, .lb-nav svg { width: 24px; height: 24px; }
.lb-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 2; }
.lb-bar { display: flex; justify-content: center; gap: 16px; padding: 10px 0 calc(16px + env(safe-area-inset-bottom)); }
.lb-close:hover, .lb-nav:hover { background: #f2efe8; color: #0d0e11; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 60; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 12px 18px; background: var(--ink); color: var(--paper);
  font-weight: 600; font-size: 15px; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.6);
}

/* ---------- footer ---------- */
.footer {
  margin-top: 24px; padding: 40px 24px calc(40px + env(safe-area-inset-bottom));
  text-align: center; border-top: 2px solid var(--rule); color: var(--ink-2); font-size: 15px; background: var(--paper-2);
}
.footer-mark { width: 34px; height: 34px; margin: 0 auto 10px; display: block; }
.footer-title { font-family: var(--cond); font-weight: 700; font-size: 22px; text-transform: uppercase; color: var(--ink); margin: 0 0 8px; }
.footer p { margin: 0 0 8px; }
.footer-note { max-width: 56ch; margin: 14px auto 0 !important; font-size: 14px; color: var(--muted); text-wrap: pretty; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
