/* Notts County — the Magpies. Black and white, worn like the kit: stripes in
   the masthead and filling each review slot as it's taken. Two working
   colours only: amber means "provisional" (your in-person slot could still
   move), red means "destructive". Nothing else gets colour. */

@font-face {
  font-family: "Barlow Condensed";
  src: url("/fonts/barlow-condensed-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("/fonts/barlow-condensed-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  /* colour */
  --ink: #0b0b0b;
  --ink-2: #1a1a1a;
  --ink-3: #2c2c2c;
  --paper: #ffffff;
  --ground: #f4f4f1;
  --line: #dcdcd6;
  --muted: #5c5c57;
  --on-ink-muted: #b9b9b3;
  --amber: #e0a33a;
  --amber-ink: #8a5a12;
  --amber-wash: #fbf1df;
  --danger: #a3261d;
  --danger-wash: #fbeceb;

  /* type */
  --display: "Barlow Condensed", "Avenir Next Condensed", "Arial Narrow", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --t-xs: 0.75rem;
  --t-sm: 0.875rem;
  --t-md: 1rem;
  --t-lg: 1.375rem;
  --t-xl: 1.875rem;
  --t-2xl: 2.75rem;

  /* space */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;

  /* shape */
  --r-sm: 6px;
  --r: 10px;
  --r-pill: 999px;
  --target: 40px;

  --kit: repeating-linear-gradient(90deg, var(--paper) 0 18px, var(--ink) 18px 36px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (pointer: coarse) {
  :root { --target: 44px; }
}

* { box-sizing: border-box; }

html { scrollbar-color: var(--ink-3) var(--ground); }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: var(--t-md)/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  caret-color: var(--ink);
  accent-color: var(--ink);
}

::selection { background: var(--ink); color: var(--paper); }

[hidden] { display: none !important; }

a { color: inherit; text-underline-offset: 3px; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.masthead :focus-visible,
.panel-dark :focus-visible { outline-color: var(--paper); }

.skip {
  position: absolute;
  left: var(--s4);
  top: -100px;
  z-index: 10;
  background: var(--paper);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
}
.skip:focus { top: var(--s2); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- masthead ---------- */

.masthead {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
}

/* The kit: real stripe widths, fading in from the right so the badge and
   name sit on solid black. */
.masthead::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: min(46%, 420px);
  background: var(--kit);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 85%);
  mask-image: linear-gradient(90deg, transparent, #000 85%);
  opacity: 0.9;
  pointer-events: none;
}

.masthead-inner {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--s4) max(var(--s4), env(safe-area-inset-right)) var(--s4) max(var(--s4), env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
  margin-right: auto;
  min-width: 0;
}

.crest {
  width: 44px;
  height: 50px;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 2px 6px rgb(0 0 0 / 0.5));
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }

.club {
  font: 700 var(--t-xl)/0.95 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.product {
  font: 600 var(--t-sm)/1.3 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--on-ink-muted);
}

.masthead-btn {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid #6d6d68;
  font-size: var(--t-sm);
}
.masthead-btn:hover { background: var(--ink-3); }

.saying {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: var(--s2) var(--s4);
  background: var(--ink-2);
  border-top: 1px solid var(--ink-3);
  text-align: center;
  font: italic 600 var(--t-md)/1.3 var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- section nav ---------- */

.tabs {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.tabs-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 var(--s4);
  display: flex;
  gap: var(--s1);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs a {
  font: 700 var(--t-md)/1 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--muted);
  padding: var(--s4) var(--s3) calc(var(--s4) - 3px);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .count {
  font: 700 var(--t-xs)/1 var(--body);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-pill);
  padding: 3px 7px;
}

/* ---------- layout ---------- */

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--s5) var(--s4) calc(var(--s7) + env(safe-area-inset-bottom));
}
main:focus { outline: none; }
.narrow { max-width: 560px; margin-inline: auto; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
h1:focus, h2:focus { outline: none; }

p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }

.section + .section,
.panel-dark + .section { margin-top: var(--s7); }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s4);
}
.section-head p { margin-top: var(--s2); }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s5);
}

.panel-dark {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r);
  padding: var(--s5);
  box-shadow: 0 10px 30px -12px rgb(0 0 0 / 0.45);
}
.panel-dark .muted { color: var(--on-ink-muted); }

.stack > * + * { margin-top: var(--s4); }

/* ---------- controls ---------- */

button, .button {
  font: 600 var(--t-sm)/1 var(--body);
  min-height: var(--target);
  padding: 0 var(--s4);
  border-radius: var(--r-sm);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
button:hover, .button:hover { background: var(--ink-3); border-color: var(--ink-3); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.big, .button.big { min-height: 52px; font-size: var(--t-md); padding: 0 var(--s5); }
button.block, .button.block { width: 100%; }

.secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.secondary:hover { background: var(--ground); border-color: var(--ink); }
.quiet { background: transparent; color: var(--ink); border-color: transparent; }
.quiet:hover { background: var(--ground); border-color: transparent; }
.danger { background: var(--paper); color: var(--danger); border-color: var(--danger); }
.danger:hover { background: var(--danger-wash); border-color: var(--danger); }

.panel-dark button, .panel-dark .button { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.panel-dark button:hover, .panel-dark .button:hover { background: #e6e6e1; border-color: #e6e6e1; }
.panel-dark button.secondary { background: transparent; color: var(--paper); border-color: #6d6d68; }
.panel-dark button.secondary:hover { background: var(--ink-3); border-color: var(--paper); }

.choice { display: grid; gap: var(--s2); margin-top: var(--s5); }
.status .choice button { margin-top: 0; }

.icon { width: 18px; height: 18px; flex: none; }

label, .label { display: block; font-weight: 600; font-size: var(--t-sm); margin-bottom: var(--s2); }
.hint { font-size: var(--t-sm); color: var(--muted); margin-top: var(--s2); }

textarea { resize: vertical; line-height: 1.5; }
input[type="text"], input:not([type]), input[type="file"], textarea {
  font: var(--t-md) var(--body);
  width: 100%;
  min-height: var(--target);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink);
}
input:hover { border-color: #b5b5ae; }
input:focus { border-color: var(--ink); }
input::placeholder { color: #8a8a84; }

.field + .field { margin-top: var(--s4); }
.form-row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; }
.form-row .field { flex: 1 1 200px; margin: 0; }

/* segmented control for attendance */
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.segmented button {
  border: 0;
  border-radius: 0;
  background: var(--paper);
  color: var(--muted);
  min-height: var(--target);
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button:hover { background: var(--ground); color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* "More" menu */
.menu { position: relative; }
.menu > summary {
  list-style: none;
  min-height: var(--target);
  min-width: var(--target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--muted);
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: var(--ground); color: var(--ink); }
.menu[open] > summary { background: var(--ground); color: var(--ink); }
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s1));
  z-index: 4;
  min-width: 200px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 12px 32px -8px rgb(0 0 0 / 0.25);
  padding: var(--s1);
  display: grid;
}
.menu-list button { justify-content: flex-start; background: transparent; color: var(--ink); border: 0; }
.menu-list button:hover { background: var(--ground); }
.menu-list button.danger-text { color: var(--danger); }
.menu-list button.danger-text:hover { background: var(--danger-wash); }

/* ---------- status tags ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 700 var(--t-xs)/1 var(--body);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink);
  white-space: nowrap;
}
.tag .icon { width: 12px; height: 12px; }
.tag.done { background: var(--ink); color: var(--paper); }
.tag.owed { border-style: dashed; color: var(--ink); }
.tag.provisional { border-color: var(--amber-ink); color: var(--amber-ink); background: var(--amber-wash); }
.tag.off { border-color: var(--line); color: var(--muted); }
.panel-dark .tag.provisional { border-color: var(--amber); color: var(--amber); background: transparent; }
.panel-dark .tag.done { background: var(--paper); color: var(--ink); border-color: var(--paper); }

/* ---------- player: this week's card ---------- */

.fixture { display: flex; align-items: baseline; gap: var(--s2); }
.fixture .v { font: 600 0.7em/1 var(--display); color: var(--muted); text-transform: lowercase; }
.panel-dark .fixture .v { color: var(--on-ink-muted); }

.slots {
  list-style: none;
  padding: 0;
  margin: var(--s5) 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s2);
}
.slot {
  position: relative;
  min-height: 84px;
  border-radius: var(--r-sm);
  border: 1px dashed #5d5d58;
  padding: var(--s3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.slot-kind { font: 700 var(--t-sm)/1 var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--on-ink-muted); }
.slot-state { font: 700 var(--t-lg)/1 var(--display); text-transform: uppercase; color: #8c8c86; }

/* Taken by someone else: the stripes fill the slot. */
.slot.taken { border: 1px solid var(--paper); background: var(--kit); background-size: 36px 100%; }
.slot.taken .slot-kind,
.slot.taken .slot-state {
  align-self: flex-start;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 6px;
  border-radius: 3px;
}

/* Yours. */
.slot.mine { border: 2px solid var(--paper); background: var(--paper); }
.slot.mine .slot-kind { color: var(--muted); }
.slot.mine .slot-state { color: var(--ink); }
.slot.mine.provisional { border-color: var(--amber); box-shadow: inset 0 0 0 2px var(--amber); }

.slot.fill-in { animation: fill-in 0.6s var(--ease-out) both; }
@keyframes fill-in {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

.status-title { font: 700 var(--t-lg)/1.1 var(--display); text-transform: uppercase; }
.status-title + p { margin-top: var(--s2); }
.lc { text-transform: none; }
.status .tag { margin-bottom: var(--s3); }
.status .button, .status button { margin-top: var(--s5); }

/* ---------- lists of rows ---------- */

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s3) var(--s4);
  align-items: center;
  padding: var(--s4) 0;
  border-top: 1px solid var(--line);
}
.rows > li:first-child { border-top: 0; padding-top: 0; }
.rows > li:last-child { padding-bottom: 0; }
.row-main { min-width: 0; }
.row-title { font-weight: 700; }
.row-title a { text-decoration: none; }
.row-title a:hover { text-decoration: underline; }
.row-meta { font-size: var(--t-sm); color: var(--muted); margin-top: 2px; }
.row-tags { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s2); }

.file-type {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 52px;
  border: 1px solid var(--ink);
  border-radius: 4px 12px 4px 4px;
  font: 700 var(--t-xs)/1 var(--display);
  letter-spacing: 0.06em;
  flex: none;
}
.pack-row { display: flex; align-items: center; gap: var(--s3); min-width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); list-style: none; margin: 0; padding: 0; }
.chips li { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-pill); padding: var(--s1) var(--s3); font-size: var(--t-sm); }
.chips .pos { color: var(--muted); margin-left: var(--s1); }

.empty { color: var(--muted); }

.divider { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }

/* ---------- squad table ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
caption { text-align: left; }
th {
  text-align: left;
  font: 700 var(--t-xs)/1.2 var(--body);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 var(--s3) var(--s3);
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
td { padding: var(--s3); border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; }
td.num, th.num { text-align: right; }
tr.inactive td { color: var(--muted); }
.link {
  background: none;
  border: 0;
  color: var(--ink);
  padding: 0;
  min-height: 0;
  font: 700 var(--t-md) var(--body);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
.link:hover { background: none; text-decoration-color: var(--ink); }

/* ---------- login ---------- */

.login { max-width: 400px; margin: var(--s6) auto 0; text-align: center; }
.login-crest { width: 84px; height: 96px; object-fit: contain; margin: 0 auto var(--s4); display: block; }
.login p { margin: var(--s3) 0 var(--s5); }
.pin {
  font: 700 2.25rem/1 var(--display) !important;
  letter-spacing: 0.35em;
  text-align: center;
  padding: var(--s3) 0 var(--s3) 0.35em !important;
  min-height: 64px !important;
}
.error { color: var(--danger); font-weight: 600; min-height: 1.5em; margin-top: var(--s3); }

/* ---------- dialogs ---------- */

dialog {
  border: 0;
  border-radius: var(--r);
  padding: var(--s5);
  width: min(460px, calc(100% - var(--s6)));
  box-shadow: 0 24px 64px -16px rgb(0 0 0 / 0.5);
  color: var(--ink);
}
dialog::backdrop { background: rgb(11 11 11 / 0.65); }
dialog[open] { animation: rise 0.25s var(--ease-out); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
dialog h2 { margin-bottom: var(--s3); }
dialog ul { margin: var(--s3) 0 0; padding-left: var(--s5); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); }

.pin-reveal {
  font: 700 3rem/1 var(--display);
  letter-spacing: 0.25em;
  text-align: center;
  padding: var(--s5) 0 var(--s5) 0.25em;
  border: 1px dashed var(--ink);
  border-radius: var(--r);
  margin: var(--s4) 0;
  user-select: all;
}

.progress { height: 6px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; margin-top: var(--s4); }
.progress > div { height: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 0.2s linear; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s5) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  background: var(--ink);
  color: var(--paper);
  padding: var(--s3) var(--s5);
  border-radius: var(--r-sm);
  font-weight: 600;
  max-width: calc(100% - var(--s6));
  box-shadow: 0 10px 30px -10px rgb(0 0 0 / 0.5);
}
.toast.bad { background: var(--danger); }

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  :root { --t-2xl: 2.25rem; --t-xl: 1.625rem; }
  .club { font-size: var(--t-lg); }
  .masthead::after { width: 38%; }
  main { padding-top: var(--s4); }
  .panel, .panel-dark { padding: var(--s4); }
  .rows > li { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-start; }
  .slot { min-height: 76px; padding: var(--s2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- spacing utilities (inline styles are blocked by the CSP) ---------- */

.mt-2 { margin-top: var(--s2); }
.mt-3 { margin-top: var(--s3); }
.mt-4 { margin-top: var(--s4); }
.mt-5 { margin-top: var(--s5); }
.mb-3 { margin-bottom: var(--s3); }
.mb-4 { margin-bottom: var(--s4); }
.back-link { margin-left: calc(-1 * var(--s4)); }
.section.tight { margin-top: var(--s3); }
