/* GameSchedulr glass kit: one stylesheet, tokens first. Colours follow Strive (strivefa.org, #65). */

:root {
  color-scheme: dark;
  --ink: #f4f1ea;
  --muted: #b5ad9e;
  --accent: #e0b03a;
  --accent-2: #ffd100;
  --accent-ink: #141311;
  --focus: #ffd100;
  --gold-text: #e0b03a;
  --game: #4cc38a;
  --nogame: #ff6b6b;
  --open: #ff8f4a;
  --proposed: #7fb2ff;
  --locked: #c4a1ff;

  --bg: #0e0d0b;
  --blob-1: #6b4f0e;
  --blob-2: #3b3220;
  --blob-3: #2a2826;
  --blob-4: #8a6512;

  --solid: #1b1915;
  --solid-strong: #23201b;
  --glass: rgb(255 255 255 / 7%);
  --glass-strong: rgb(255 255 255 / 11%);
  --glass-edge: rgb(255 255 255 / 16%);
  --glass-shine: rgb(255 255 255 / 22%);
  --line: rgb(255 255 255 / 9%);
  --blur: 18px;
  --radius: 20px;
  --shadow: 0 10px 30px rgb(0 0 0 / 35%);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --ink: #141311;
    --muted: #6b675e;
    --accent: #d6a62b;
    --accent-2: #ffc300;
    --accent-ink: #141311;
    --focus: #141311;
    --gold-text: #8a6510;
    --game: #13612e;
    --nogame: #b82105;
    --open: #b34a00;
    --proposed: #1159af;
    --locked: #6a3fc4;

    --bg: #f5f3ee;
    --blob-1: #ffe08a;
    --blob-2: #f3d27a;
    --blob-3: #e6e0d3;
    --blob-4: #fff1c2;

    --solid: #ffffff;
    --solid-strong: #faf8f4;
    --glass: rgb(255 255 255 / 55%);
    --glass-strong: rgb(255 255 255 / 72%);
    --glass-edge: rgb(255 255 255 / 75%);
    --glass-shine: rgb(255 255 255 / 95%);
    --line: rgb(20 19 17 / 9%);
    --shadow: 0 10px 30px rgb(40 30 10 / 12%);
  }
}

/* Where blur is unavailable the panels go solid, so text never sits on raw color. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --glass: var(--solid);
    --glass-strong: var(--solid-strong);
  }
}

@media (prefers-reduced-transparency: reduce) {
  :root {
    --glass: var(--solid);
    --glass-strong: var(--solid-strong);
    --blur: 0px;
  }
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: transparent;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* --- backdrop: slow drifting color under the glass --- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--bg);
}

.backdrop::before,
.backdrop::after {
  content: "";
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: drift 26s ease-in-out infinite alternate;
}

.backdrop::before {
  top: -25vmax;
  left: -20vmax;
  background: radial-gradient(circle at 30% 30%, var(--blob-1), transparent 60%),
    radial-gradient(circle at 70% 70%, var(--blob-3), transparent 60%);
}

.backdrop::after {
  bottom: -30vmax;
  right: -25vmax;
  background: radial-gradient(circle at 40% 40%, var(--blob-2), transparent 60%),
    radial-gradient(circle at 70% 30%, var(--blob-4), transparent 55%);
  animation-duration: 32s;
  animation-direction: alternate-reverse;
}

@keyframes drift {
  from { transform: translate(0, 0) rotate(0deg) scale(1); }
  to { transform: translate(8vmax, 6vmax) rotate(25deg) scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  .backdrop::before,
  .backdrop::after,
  .htmx-request { animation: none; transition: none; }
}

/* --- the glass surface every panel shares --- */

.glass,
.top,
.card,
.stat,
.notice,
nav.tabs {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-shine);
}

/* --- top bar and tabs --- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: 0 6px 24px rgb(0 0 0 / 18%);
}

.top-inner,
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

.top-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
}

.brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  font-size: 18px;
}

.brand span {
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.season {
  color: var(--muted);
  font-size: 14px;
  margin-left: auto;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-inner .button,
.top-inner button {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
  flex: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-inner .me { display: inline-block; max-width: 9em; line-height: 22px; }

@media (max-width: 420px) {
  .season { display: none; }
  .top-inner .brand { margin-right: auto; }
}

nav.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  max-width: 728px;
  margin: 0 auto 10px;
  padding: 4px;
  border-radius: 999px;
  scrollbar-width: none;
  box-shadow: inset 0 1px 0 var(--glass-shine);
}

@media (min-width: 761px) { nav.tabs { margin-left: auto; margin-right: auto; } }
@media (max-width: 760px) { nav.tabs { margin: 0 12px 10px; } }

nav.tabs a {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 550;
  transition: background 160ms, color 160ms;
}

nav.tabs a:hover { color: var(--ink); }

nav.tabs a[aria-current="page"] {
  background: var(--glass-strong);
  color: var(--ink);
  box-shadow: inset 0 1px 0 var(--glass-shine), 0 2px 10px rgb(0 0 0 / 15%);
}

/* --- page text --- */

main { padding-top: 24px; padding-bottom: 72px; }

h1 {
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 4px 0 6px;
}

h2 { letter-spacing: -0.01em; }

.lede { color: var(--muted); margin: 0 0 20px; }

/* --- stat tiles --- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 24px;
}

.stat { border-radius: var(--radius); padding: 14px 16px; }

.stat b {
  display: block;
  font-size: 32px;
  line-height: 1.05;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat small { color: var(--muted); font-size: 13px; }
.stat.nogame b { color: var(--nogame); }
.stat.open b { color: var(--open); }

/* --- cards and rows --- */

.card {
  border-radius: var(--radius);
  margin: 0 0 16px;
  overflow: hidden;
}

.card > header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 15px 18px 11px;
  border-bottom: 1px solid var(--line);
}

.card h2 { font-size: 17px; margin: 0; }
.card .meta { color: var(--muted); font-size: 13px; margin-left: auto; white-space: nowrap; }

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

.row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
}

.row:first-child { border-top: 0; }

.when { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 15px; }
.when small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }

.who { min-width: 0; }
.who .team { font-weight: 600; overflow-wrap: anywhere; }
.who .vs { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }

/* --- chips: a colored dot on a glass pill --- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-edge);
  color: var(--ink);
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.chip.game::before { background: var(--game); color: var(--game); }
.chip.no_game::before { background: var(--nogame); color: var(--nogame); }
.chip.unassigned::before { background: var(--open); color: var(--open); }
.chip.proposed::before { background: var(--proposed); color: var(--proposed); }
.chip.locked::before { background: var(--locked); color: var(--locked); }

/* --- lists of links --- */

.list a.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  text-decoration: none;
  transition: background 140ms;
}

.list a.item:first-child,
.list header + a.item { border-top: 0; }
.list a.item:hover { background: var(--glass); }
.list .grow { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.list .counts { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* --- buttons --- */

.button,
button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  padding: 10px 18px;
  min-height: 44px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent),
    inset 0 1px 0 rgb(255 255 255 / 35%);
  transition: transform 120ms, box-shadow 160ms;
}

.button:active,
button:active { transform: translateY(1px) scale(0.99); }

.button.ghost,
button.ghost {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  color: var(--ink);
  border-color: var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-shine);
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 16px; }
details.actions summary { cursor: pointer; color: var(--muted); padding: 4px 0 10px; }

/* --- notices --- */

.notice {
  border-radius: 16px;
  padding: 12px 16px;
  margin: 0 0 16px;
  border-color: color-mix(in srgb, var(--open) 45%, var(--glass-edge));
}

.findings { margin: 0; padding: 6px 0 4px 20px; color: var(--nogame); font-size: 14px; }
.empty { color: var(--muted); padding: 16px 18px; }
form.inline { display: inline; }

/* --- form fields --- */

input,
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--glass-strong);
  border: 1px solid var(--glass-edge);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 12%);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.htmx-request { opacity: 0.6; transition: opacity 120ms; }

@media (max-width: 420px) {
  .row { grid-template-columns: 54px 1fr; }
  .row .chip { grid-column: 2; justify-self: start; }
  h1 { font-size: 25px; }
  .grid2 { grid-template-columns: 1fr; }
  .stat b { font-size: 27px; }
}
