/* Turneringslista – Alfa Discs-profil: navy, Alfa-rødt, offwhite. Goldplay til display,
   DM Sans til resten (begge selvhostet – ingen kall til Google). Mobil først. */
@font-face {
  font-family: "Goldplay";
  src: url("/fonts/goldplay-bold.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  --hvit: #ffffff;
  --offwhite: #f7f6f2;
  --papir: #efeee8;
  --navy: #171e2a;
  --navy-dyp: #10151f;
  --navy-lys: #222b3a;
  --tekst: #2c3340;
  --dempet: #6b7280;
  --dempet-mork: #a9b0bd;
  --linje: #e2e1da;
  --linje-mork: rgba(247, 246, 242, 0.14);
  --roed: #e41d3c;
  --roed-hover: #c4142f;
  --ok: #1e8a5a;
  --feil-mork: #ffb4a8;
  --feil: #b0122a;
  --radius: 8px;
  --display: "Goldplay", "DM Sans", system-ui, sans-serif;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img, svg { display: block; }
[hidden] { display: none !important; }
::selection { background: var(--roed); color: var(--offwhite); }

.theme-dark { background: var(--navy); color: var(--offwhite); --focus: var(--offwhite); }
.theme-light { background: var(--offwhite); color: var(--tekst); --focus: var(--roed); }

a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 560px; }
.container.prose { max-width: 680px; }
.container.wide { max-width: 1200px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Header / footer ---- */
.site-header { background: var(--navy); color: var(--offwhite); border-bottom: 1px solid var(--linje-mork); --focus: var(--offwhite); }
.header-inner { display: flex; align-items: center; min-height: 68px; }
.wordmark { display: inline-flex; align-items: center; gap: 14px; text-decoration: none; }
.wordmark-logo { height: 30px; width: auto; }
.wordmark-label {
  padding-left: 14px; border-left: 1px solid var(--linje-mork);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  line-height: 30px; opacity: 0.85;
}

.site-footer { font-size: 0.9375rem; }
.theme-dark .site-footer { color: var(--dempet-mork); border-top: 1px solid var(--linje-mork); }
.theme-light .site-footer { color: var(--dempet); border-top: 1px solid var(--linje); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding-top: 20px; padding-bottom: 28px; }

mark.placeholder {
  background: #fff3b0; color: #3d3200; padding: 0 4px; border-radius: 3px;
  outline: 1px dashed #8a7400; font-weight: 600;
}

/* ---- Forside ---- */
.hero-inner { padding-top: 28px; padding-bottom: 56px; display: grid; gap: 36px; }
.flight { width: 100%; max-width: 440px; height: auto; margin: 0 0 20px -6px; }
h1, h2 { font-family: var(--display); font-weight: 700; }
h1 {
  margin: 0;
  font-size: clamp(2.3rem, 9vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-wrap: balance;
}
.lead { margin: 22px 0 0; font-size: clamp(1.125rem, 4.4vw, 1.25rem); line-height: 1.55; color: var(--dempet-mork); max-width: 34ch; }

.signup { display: grid; gap: 22px; }
.field { display: grid; gap: 8px; }
.field > label {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}

input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1.0625rem; /* ≥16px hindrer zoom på iOS */
  color: var(--navy);
  background: var(--offwhite);
  border: 2px solid var(--offwhite);
  border-radius: var(--radius);
  appearance: none;
}
.theme-light input[type="text"], .theme-light input[type="email"], .theme-light input[type="password"] {
  background: var(--hvit); border-color: var(--linje);
}
input:focus-visible { outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--feil-mork); }
.theme-light input[aria-invalid="true"] { border-color: var(--feil); }

.consent { display: flex; gap: 14px; align-items: flex-start; }
.consent input {
  flex: none; width: 24px; height: 24px; margin: 1px 0 0;
  accent-color: var(--roed); cursor: pointer;
}
.consent label { font-size: 1rem; line-height: 1.5; cursor: pointer; }
.consent input[aria-invalid="true"] { outline: 2px solid var(--feil-mork); outline-offset: 2px; }

.field-error { margin: 0; font-size: 0.9375rem; font-weight: 600; color: var(--feil-mork); }
.theme-light .field-error { color: var(--feil); }

.form-alert {
  padding: 12px 14px; border-radius: var(--radius); font-weight: 600;
  background: var(--navy-lys); color: #ffd9d3; border-left: 3px solid var(--feil-mork);
}
.form-alert-light { background: #fbe9e9; color: #6b0f1d; border-left-color: var(--feil); }

.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---- Knapper ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 26px;
  font: inherit; font-weight: 700; font-size: 1.0625rem; letter-spacing: 0.01em;
  border: 2px solid transparent; border-radius: var(--radius);
  cursor: pointer; text-decoration: none;
  transition: background-color 0.15s ease;
}
.btn-accent { width: 100%; background: var(--roed); color: var(--hvit); }
.btn-accent:hover { background: var(--roed-hover); }
.btn-dark { background: var(--navy); color: var(--offwhite); min-height: 50px; }
.btn-dark:hover { background: var(--navy-lys); }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--linje); min-height: 50px; }
.btn-ghost:hover { background: var(--papir); }
.btn[aria-busy="true"] { cursor: progress; opacity: 0.9; }

.spinner {
  display: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn[aria-busy="true"] .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  .btn { transition: none; }
}

.form-note { margin: -8px 0 0; font-size: 0.9375rem; color: var(--dempet-mork); text-align: center; }

.success { padding: 28px 0 8px; border-top: 3px solid var(--roed); }
.success:focus { outline: none; }
.success h2 { margin: 0 0 12px; font-size: clamp(1.8rem, 7vw, 2.4rem); line-height: 1.08; text-transform: uppercase; }
.success p { margin: 0; font-size: 1.125rem; color: var(--dempet-mork); max-width: 34ch; }

@media (min-width: 900px) {
  .hero-inner {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    gap: 72px;
    min-height: calc(100dvh - 68px - 80px);
    padding-top: 40px;
    padding-bottom: 72px;
  }
  .hero-form { padding-top: 24px; }
}

/* ---- Lyse undersider ---- */
.page { padding: 44px 0 64px; }
.page h1 { font-size: clamp(1.9rem, 7vw, 2.6rem); margin-bottom: 18px; color: var(--navy); }
.page p { margin: 0 0 16px; }
.prose h2 { margin: 34px 0 8px; font-size: 1.15rem; color: var(--navy); letter-spacing: 0.01em; }
.prose ul { margin: 0 0 16px; padding-left: 1.2em; }
.prose li { margin-bottom: 6px; }
.prose a, .narrow a { color: var(--navy); }
.lead-dark { font-size: 1.15rem; color: var(--dempet); }
.back { font-weight: 700; }
.stack { display: grid; gap: 18px; margin: 24px 0; }
.theme-light .field > label { color: var(--navy); }

/* ---- Admin ---- */
.admin-head { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; }
.admin-head h1 { margin: 0 0 6px; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; color: var(--dempet); }
.stats strong { color: var(--navy); font-variant-numeric: tabular-nums; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-actions form { margin: 0; }
.notice { padding: 10px 14px; background: #e4f1ea; border-left: 3px solid var(--ok); border-radius: var(--radius); }

.filters { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--linje); margin-bottom: 4px; }
.filters a {
  padding: 10px 14px; text-decoration: none; color: var(--dempet); border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
.filters a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--roed); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 0.9688rem; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--linje); vertical-align: middle; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--dempet); font-weight: 700; }
td form { margin: 0; }
.mono { font-family: var(--mono); font-size: 0.875rem; }
.status { font-weight: 700; }
.status-active { color: var(--ok); }
.status-off { color: var(--dempet); font-weight: 500; }
.link-danger { background: none; border: 0; padding: 6px 4px; font: inherit; font-weight: 700; color: var(--feil); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.empty { color: var(--dempet); padding: 16px 0; }
.admin-help { margin-top: 28px; font-size: 0.9375rem; color: var(--dempet); max-width: 70ch; }
