/* Teamfinder — visual language borrowed from the Norwegian idrettshall:
   a blue hall floor crossed by court lines in yellow, white, red and green. */
@font-face {
  font-family: "Familjen Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/familjen-grotesk-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "Familjen Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/familjen-grotesk-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+1E00-1E9F;
}

:root {
  --floor: #17497e;
  --floor-deep: #113a66;
  --ink: #10233b;
  --ink-soft: #4a5b70;
  --paper: #ffffff;
  --mist: #eef3f7;
  --rule: #d5dee7;
  --line-yellow: #ffd23f;
  --line-red: #d8452b;
  --line-green: #1f8a5b;
  --measure: 62ch;
  --pad: clamp(1rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Familjen Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
a { color: var(--floor); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--line-yellow); outline-offset: 2px; box-shadow: 0 0 0 5px var(--ink); }
h1, h2, h3 { line-height: 1.1; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 3.25rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0; max-width: var(--measure); }
ul { margin: 0; padding: 0; list-style: none; }

.wrap { max-width: 72rem; margin: 0 auto; padding-inline: var(--pad); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 1rem; z-index: 10; }

/* Header */
.top { background: var(--floor); color: #fff; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.75rem; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; display: flex; align-items: center; gap: 0.5rem; }
.brand svg { width: 1.6rem; height: 1.6rem; }
.top nav ul { display: flex; flex-wrap: wrap; gap: 0 clamp(0.75rem, 3vw, 1.75rem); }
@media (max-width: 44rem) {
  .top .wrap { flex-wrap: wrap; gap: 0 1rem; padding-top: 0.6rem; min-height: 0; }
  .top nav { width: 100%; overflow-x: auto; }
  .top nav ul { flex-wrap: nowrap; white-space: nowrap; }
}
.top nav a { color: #fff; text-decoration: none; font-weight: 500; padding: 0.6rem 0; display: block; border-bottom: 3px solid transparent; }
.top nav a:hover, .top nav a[aria-current] { border-bottom-color: var(--line-yellow); }

/* Hero: the hall floor */
.hero { background: var(--floor); color: #fff; position: relative; overflow: hidden; }
.hero .court { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.2; pointer-events: none; }
@media (min-width: 60rem) { .hero .court { left: auto; right: 0; width: 46%; opacity: 0.6; } .hero .search { max-width: 50rem; } }
.hero .wrap { position: relative; padding-block: clamp(2.5rem, 8vw, 5.5rem) clamp(2rem, 6vw, 4rem); }
.hero h1, .hero .hero-title { font-size: clamp(2.5rem, 9.5vw, 5.25rem); line-height: 0.98; letter-spacing: -0.03em; font-weight: 700; color: #fff; }
.hero h1 span, .hero .hero-title span { display: block; }
.hero .lede { margin-top: 1.25rem; font-size: 1.15rem; max-width: 34rem; color: #e3ecf5; }

.search { margin-top: 2rem; display: grid; gap: 0.75rem; grid-template-columns: 1fr; max-width: 56rem; }
.search label { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 0.25rem; }
.search input, .search select {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 2px solid transparent;
  border-radius: 4px; padding: 0 0.85rem; height: 3rem;
}
.btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 4px; min-height: 3rem;
  padding: 0.75rem 1.5rem; background: var(--line-yellow); color: var(--ink); text-decoration: none; display: inline-block;
}
.btn:hover { background: #ffdc66; }
.btn.quiet { background: var(--paper); border: 2px solid var(--ink); }
@media (min-width: 48rem) {
  .search { grid-template-columns: 2fr 1.2fr 1.2fr auto; align-items: end; }
}
.search.on-paper input, .search.on-paper select { border-color: var(--rule); background: var(--paper); }
.search.on-paper .btn { background: var(--floor); color: #fff; }

/* Sections */
main section { padding-block: clamp(2rem, 6vw, 3.5rem); }
main section + section { border-top: 1px solid var(--rule); }
section.tint { background: var(--mist); border-top: 0; }
section.tint + section { border-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; margin-bottom: 1.25rem; }
.section-head p { color: var(--ink-soft); }
.page-head { padding-block: clamp(1.5rem, 5vw, 2.75rem) 0; }
.page-head p { margin-top: 0.75rem; font-size: 1.1rem; color: var(--ink-soft); }

.crumbs { font-size: 0.9rem; padding-top: 1rem; color: var(--ink-soft); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin: 0; padding: 0; list-style: none; }
.crumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--rule); }

/* Link grids: sports, counties, municipalities. Each cell is a court-line marker. */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 0; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.grid li { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--paper); }
.grid a { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; padding: 0.85rem 1rem; text-decoration: none; color: var(--ink); font-weight: 600; min-height: 3rem; }
.grid a:hover { background: var(--line-yellow); }
.grid li { min-width: 0; }
.grid a > span:first-child { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.grid .n { font-weight: 400; font-size: 0.9rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.grid a:hover .n { color: var(--ink); }

/* Club and team rows */
.rows { border-top: 2px solid var(--ink); }
.rows > li { border-bottom: 1px solid var(--rule); padding: 0.95rem 0; display: grid; gap: 0.2rem 1.5rem; grid-template-columns: 1fr; }
.rows h3 a { color: var(--ink); text-decoration: none; }
.rows h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--line-yellow); }
.rows .where { color: var(--ink-soft); font-size: 0.95rem; }
.rows .what { font-size: 0.95rem; }
@media (min-width: 48rem) {
  .rows > li { grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, 1.7fr); align-items: baseline; }
  .rows .what { text-align: right; }
}
.badge { display: inline-block; font-size: 0.82rem; font-weight: 600; padding: 0.1rem 0.55rem; border-radius: 999px; border: 1.5px solid currentColor; white-space: nowrap; }
.badge.verified_active { color: var(--line-green); }
.badge.likely_active { color: var(--floor); }
.badge.unverified { color: var(--ink-soft); }
.badge.inactive { color: var(--line-red); }
.badge.open { color: var(--ink); background: var(--line-yellow); border-color: var(--line-yellow); }

.pager { display: flex; gap: 1rem; justify-content: space-between; margin-top: 1.5rem; }
.empty { padding: 1.5rem; background: var(--mist); border-left: 4px solid var(--line-yellow); max-width: var(--measure); }
.empty p + p { margin-top: 0.5rem; }
.note { border-left: 4px solid var(--line-yellow); padding: 0.75rem 1rem; background: var(--mist); max-width: var(--measure); }

/* Profile pages */
.profile { display: grid; gap: 2rem; padding-block: 2rem 3rem; }
@media (min-width: 56rem) { .profile { grid-template-columns: minmax(0, 1.7fr) minmax(16rem, 1fr); gap: 3.5rem; } }
.profile h2 { font-size: 1.35rem; margin: 2rem 0 0.75rem; }
.profile h2:first-child { margin-top: 0; }
.profile p + p { margin-top: 0.75rem; }
.facts { border-top: 2px solid var(--ink); margin: 0; }
.facts div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--ink-soft); font-size: 0.95rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.claim { margin-top: 1.5rem; padding: 1.25rem; background: var(--floor); color: #fff; border-radius: 4px; }
.claim h2 { font-size: 1.2rem; margin: 0 0 0.4rem; }
.claim a { color: var(--line-yellow); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags a, .tags span { border: 1.5px solid var(--ink); border-radius: 999px; padding: 0.15rem 0.7rem; text-decoration: none; color: var(--ink); font-size: 0.95rem; font-weight: 500; }
.tags a:hover { background: var(--line-yellow); border-color: var(--line-yellow); }
.small { font-size: 0.9rem; color: var(--ink-soft); }

/* How it works: a real sequence, so it is numbered */
.steps { display: grid; gap: 1.5rem; counter-reset: step; list-style: none; margin: 0; padding: 0; }
@media (min-width: 48rem) { .steps { grid-template-columns: repeat(3, 1fr); gap: 2.5rem; } }
.steps li { counter-increment: step; border-top: 4px solid var(--floor); padding-top: 0.9rem; }
.steps li:nth-child(2) { border-top-color: var(--line-yellow); }
.steps li:nth-child(3) { border-top-color: var(--line-red); }
.steps h3::before { content: counter(step) ". "; }
.steps p { margin-top: 0.4rem; color: var(--ink-soft); }

.split { display: grid; gap: 2rem; }
@media (min-width: 48rem) { .split { grid-template-columns: 1fr 1fr; gap: 3.5rem; } }
.split p { margin-top: 0.6rem; }
.split .btn { margin-top: 1rem; }

.prose { padding-block: 1.5rem 3rem; }
.prose h2 { margin: 2rem 0 0.6rem; font-size: 1.4rem; }
.prose p + p, .prose ul + p, .prose p + ul { margin-top: 0.75rem; }
.prose ul { list-style: disc; padding-left: 1.25rem; max-width: var(--measure); }
.prose li + li { margin-top: 0.3rem; }

.gap-top { margin-top: 1rem; }
.gap-bottom { margin-bottom: 1.5rem; }
@media (min-width: 48rem) { .search.wide { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Footer */
footer { background: var(--ink); color: #c9d4e0; padding-block: 2.5rem; font-size: 0.95rem; }
footer h2 { font-size: 1rem; color: #fff; margin-bottom: 0.6rem; }
footer a { color: #fff; }
footer .cols { display: grid; gap: 2rem; }
@media (min-width: 48rem) { footer .cols { grid-template-columns: 2fr 1.2fr 1fr; } }
footer .flow { columns: 2; column-gap: 1.5rem; }
@media (min-width: 30rem) { footer .flow { columns: 3; } }
footer li { padding: 0.15rem 0; break-inside: avoid; }
footer .fine { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid #2b3d54; max-width: none; }

/* Admin */
.admin table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.admin th, .admin td { text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.admin .stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1rem; margin: 0; }
.admin .stats div { border-top: 3px solid var(--floor); padding-top: 0.5rem; }
.admin .stats dt { color: var(--ink-soft); font-size: 0.9rem; }
.admin .stats dd { margin: 0; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.admin .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; }
.admin select, .admin input { font: inherit; padding: 0.6rem; min-height: 3rem; border: 2px solid var(--rule); border-radius: 4px; }
.admin pre { background: var(--mist); padding: 1rem; overflow: auto; max-height: 18rem; font-size: 0.85rem; white-space: pre-wrap; }

@media (prefers-reduced-motion: no-preference) {
  .grid a, .btn { transition: background-color 0.12s ease; }
}

/* Admin: which municipalities have been fetched, county by county. */
.admin details.cov { border-bottom: 1px solid var(--rule); }
.admin details.cov summary { display: flex; justify-content: space-between; gap: 1rem; padding: 0.75rem 0; cursor: pointer; font-weight: 600; }
.admin details.cov summary span + span { font-weight: 400; text-align: right; }
.admin .cov-table { font-size: 0.9rem; margin-bottom: 1rem; }
.admin .cov-table td, .admin .cov-table th { padding-right: 0.5rem; }
.admin .cov-when { color: var(--ink-soft); font-size: 0.85em; }
.admin .cov-miss { color: var(--line-red); font-weight: 600; }
