/* nec-seats — the whole stylesheet. Server-rendered HTML, no framework. */

:root {
  --red: #d0021b;         /* N.E.C. red: filled surfaces (buttons) with white text */
  --accent: #d0021b;      /* red as text/border; lifted in dark mode for contrast */
  --green: #008d5a;       /* green from the official N.E.C. crest */
  --green-accent: #007a4e;
  --green-soft: #e8f5f0;
  --ink: #16181d;
  --muted: #5f6672;
  --line: #dfe3ea;
  --bg: #fbfbfc;
  --card: #fff;
  --ok: var(--green-accent);
  --warn: #8a5a00;
  --warn-bg: #fff5e0;
  --radius: 8px;
  --measure: 62rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Brand red is ~2.4:1 against this background -- unreadable as text.
       Links, badges and accents use this lifted red (~6:1) instead; filled
       buttons keep true N.E.C. red, where the white label carries contrast. */
    --accent: #ff6b63;
    --green-accent: #5fd39b;
    --green-soft: #16352c;
    --ink: #e9ecf1;
    --muted: #98a0ad;
    --line: #2b3038;
    --bg: #14161a;
    --card: #1c1f25;
    --ok: var(--green-accent);
    --warn: #ffd487;
    --warn-bg: #3a2f14;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 1.5rem 1rem 4rem;
  border-top: 5px solid transparent;
  border-image: linear-gradient(90deg, var(--red) 0 33.333%, var(--green) 33.333% 66.666%, #111 66.666%) 1;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main, header.site { max-width: var(--measure); margin: 0 auto; }

header.site {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: .8rem;
  margin-bottom: 1.5rem;
}

header.site a.brand {
  display: inline-flex;
  gap: .7rem;
  align-items: center;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
}

nav a { color: var(--muted); text-decoration: none; margin-left: 1rem; }
nav a:hover, nav a[aria-current="page"] { color: var(--green-accent); }
nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .35rem; }
nav .badge { margin-left: 1rem; }

.view-as-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--measure);
  margin: -0.5rem auto 1.25rem;
  padding: .7rem .85rem;
  color: var(--ink);
  background: var(--green-soft);
  border: 1px solid var(--green-accent);
  border-radius: var(--radius);
}
.view-as-banner form { margin: 0; }
.view-as-banner button { white-space: nowrap; }
.view-as-mode main form :disabled { cursor: not-allowed; opacity: .55; }

h1 { font-size: 1.5rem; margin: 0 0 .3rem; border-left: 4px solid var(--green); padding-left: .65rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .6rem; }
p.lede { color: var(--muted); margin-top: 0; }

a { color: var(--accent); }

/* Cards and lists ------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top-color: color-mix(in srgb, var(--green) 35%, var(--line));
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: .75rem;
}

.match-list { list-style: none; padding: 0; margin: 0; }

.match {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1rem;
  align-items: baseline;
  justify-content: space-between;
}

.match .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.match .who { font-weight: 600; }

/* A provisional date is the normal case early in the season, so it is marked
   clearly but not alarmingly. */
.provisional .when::before { content: "? "; font-weight: 700; color: var(--warn); }

.badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  padding: .12rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.home { border-color: var(--green-accent); color: var(--green-accent); }
.badge.watching { border-color: var(--green-accent); color: var(--green-accent); }
.badge.free { border-color: var(--ok); color: var(--ok); }

/* Seats ----------------------------------------------------------------- */

.seats { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .35rem; }

.seat {
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  padding: .4rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.seat .no { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.2rem; }
.seat.empty { border-style: dashed; }
.seat.mine { border-color: var(--green-accent); background: var(--green-soft); }

.seat-actions { display: flex; gap: .4rem; align-items: center; }
.seat-actions select { width: auto; padding: .3rem .4rem; }
.seat-actions button, .seat form button { padding: .3rem .7rem; }

/* Forms and buttons ----------------------------------------------------- */

label { display: block; font-weight: 600; margin: .8rem 0 .2rem; }

input[type="text"], input[type="email"], input[type="date"],
input[type="time"], input[type="number"], select, textarea {
  width: 100%;
  max-width: 26rem;
  padding: .5rem .6rem;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

button, .button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: .5rem .9rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--red);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
button.secondary, .button.secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
button.danger { background: #8a1020; }
button:disabled { opacity: .5; cursor: not-allowed; }

button:focus-visible, .button:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--green-accent) 55%, transparent);
  outline-offset: 2px;
}

form.inline { display: inline; margin: 0; }

/* Messages -------------------------------------------------------------- */

.notice, .error, .confirm {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .7rem .9rem;
  margin: 0 0 1rem;
}
.notice { border-color: var(--ok); }
.error { border-color: var(--accent); }
.confirm { border-color: var(--warn); background: var(--warn-bg); }

code, .token {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .875em;
  word-break: break-all;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

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

.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--green);
  border-radius: var(--radius);
}
.table-wrap table { min-width: 44rem; }
.table-wrap tr:last-child td { border-bottom: 0; }
.people-table td:first-child { font-weight: 600; }
.people-table tr.inactive { opacity: .62; }
.table-actions { width: 1%; white-space: nowrap; text-align: right; }
.table-actions button { padding: .3rem .7rem; }

@media (max-width: 36rem) {
  .view-as-banner { align-items: flex-start; flex-direction: column; }
}

.edit-popover {
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 1.2rem 4rem rgb(0 0 0 / .28);
}
.edit-popover::backdrop { background: rgb(0 0 0 / .55); backdrop-filter: blur(2px); }
.popover-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.popover-header h2 { margin: 0; }
button.popover-close {
  padding: .1rem .55rem;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  font-size: 1.35rem;
  line-height: 1.2;
}
button.popover-close:hover { color: var(--ink); border-color: var(--line); }
.popover-body { padding: .2rem 1rem 1rem; }
.editor-form p:last-child { margin-bottom: .4rem; }
.danger-zone { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.danger-zone h3 { margin: 0 0 .25rem; font-size: 1rem; }

footer.site { max-width: var(--measure); margin: 3rem auto 0; color: var(--muted); font-size: .875rem; }
