/* The Side Quest Club: "Detour" — black controller plastic, lavender face buttons. */
:root {
  --bg: #1F1F23;
  --panel: #2A2A2E;
  --raised: #34343A;
  --line: #3E3E44;
  --deep: #141417;
  --ink: #ECEBE8;
  --bright: #FFFFFF;
  --muted: #B5B3AD;
  --lav: #A79BD8;
  --lav-l: #C8BFF0;
  --lav-d: #7D70B5;
  --purple: #4A3B8F;
  --purple-d: #2A2060;
  --warn-bg: #4A2620;
  --warn-ink: #FFD9C7;
  --display: 'Russo One', system-ui, sans-serif;
  --body: 'Chakra Petch', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--body); }
a { color: var(--lav-l); }
a:hover { color: var(--bright); }
:focus-visible { outline: 3px solid var(--lav-l); outline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1, h2 { font-family: var(--display); font-weight: 400; }
p { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.spacer { flex: 1; }
main { padding-bottom: 80px; }

/* ---------- Header ---------- */
.topbar { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center; padding: 22px 0; }
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; font: 22px var(--display); }
.brand:hover { color: var(--bright); }
.nav { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  background: var(--raised); color: var(--ink); text-decoration: none;
  padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: inset 0 -3px 0 var(--deep);
}
.pill:hover { color: var(--bright); background: #3E3E45; }
.pill[aria-current="page"] { background: var(--lav); color: var(--bg); font-weight: 700; box-shadow: inset 0 -3px 0 var(--lav-d); }
.badge {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--lav); color: var(--purple-d); font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.pill[aria-current="page"] .badge { background: var(--purple-d); color: var(--bright); }
.who { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.who-name { font-weight: 600; }

/* ---------- Buttons ---------- */
button { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border: 0; border-radius: 999px; cursor: pointer;
  font-weight: 700; text-decoration: none; transition: transform 80ms ease;
}
.btn:active { transform: translateY(2px); }
.btn-primary { background: var(--lav); color: var(--bg); box-shadow: inset 0 -3px 0 var(--lav-d); }
.btn-primary:hover { background: var(--lav-l); color: var(--bg); }
.btn-purple { background: var(--purple); color: var(--bright); box-shadow: inset 0 -3px 0 var(--purple-d); }
.btn-purple:hover { background: #57479F; color: var(--bright); }
.btn-ghost { background: var(--raised); color: var(--ink); box-shadow: inset 0 -3px 0 var(--deep); }
.btn-ghost:hover { background: #3E3E45; color: var(--bright); }
.btn[disabled] { opacity: .6; cursor: wait; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--raised); color: var(--bright); }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; background: var(--panel); border-radius: 44px; padding: 52px 48px 44px;
  box-shadow: inset 0 2px 0 #3E3E44, inset 0 -4px 0 var(--deep);
  display: flex; flex-wrap: wrap; gap: 36px 48px; align-items: center;
}
.hero-copy { flex: 1 1 420px; min-width: 0; position: relative; }
.wordmark { font-size: clamp(50px, 8.4vw, 112px); line-height: .95; color: var(--ink); }
.wordmark span { display: block; }
.wordmark .side { display: inline-block; color: var(--lav); transform: rotate(-7deg) translate(14px, -4px); transform-origin: left bottom; }
.detour-arrow { position: absolute; right: -10px; top: 6px; width: 38%; max-width: 220px; height: auto; pointer-events: none; }
.hero .lede { margin-top: 24px; font-size: 20px; max-width: 34ch; color: #C9C6BF; }
.hero-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }

.now {
  flex: 0 1 470px; min-width: 0; background: var(--raised); border-radius: 26px; padding: 20px;
  display: flex; gap: 20px; align-items: flex-start; box-shadow: 0 4px 0 var(--deep);
}
.now-cover { flex: 0 0 150px; }
.now-body { flex: 1 1 auto; min-width: 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--lav-l); font-weight: 700; }
.eyebrow .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lav); }
@media (prefers-reduced-motion: no-preference) {
  .eyebrow .dot.live { animation: blink 2.4s ease-in-out infinite; }
  @keyframes blink { 50% { opacity: .25; } }
}
.now h2 { font-size: 30px; line-height: 1.1; margin-top: 8px; color: var(--bright); }
.now .facts { color: var(--muted); margin-top: 4px; }
.when {
  margin-top: 14px; display: flex; gap: 14px; align-items: center;
}
.datebox {
  flex: 0 0 68px; height: 68px; border-radius: 16px; background: var(--lav); color: var(--purple-d);
  display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset 0 -3px 0 var(--lav-d);
}
.datebox .d { font: 26px/1 var(--display); }
.datebox .m { font-size: 12px; font-weight: 700; margin-top: 2px; }
.when strong { display: block; color: var(--bright); }
.countdown { color: var(--lav-l); font-weight: 600; }
.now .blurb { margin-top: 12px; color: #D6D4CE; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Covers ---------- */
.cover {
  display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: var(--deep);
  box-shadow: 0 3px 0 var(--deep);
}
.cover-blank {
  width: 100%; aspect-ratio: 3 / 4; border-radius: 12px; background: var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 8px;
  color: var(--lav-l); box-shadow: 0 3px 0 var(--deep);
}
.cover-blank .ini { font: 34px/1 var(--display); }
.cover-blank .sys { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Reel ---------- */
.reel-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 44px 0 16px; }
.reel-head h2 { font-size: 28px; }
.reel { overflow: hidden; border-radius: 22px; background: var(--panel); padding: 18px 0 18px 18px; }
.reel-track { display: flex; width: max-content; }
/* Each copy carries its own trailing gap, so sliding by exactly half the track loops seamlessly. */
.reel-row { display: flex; gap: 16px; padding-right: 16px; }
.reel.moving .reel-track { animation: reel var(--reel-dur, 40s) linear infinite; }
.reel.moving:hover .reel-track, .reel.moving:focus-within .reel-track, .reel.paused .reel-track { animation-play-state: paused; }
@keyframes reel { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .reel { overflow-x: auto; }
  .reel.moving .reel-track { animation: none; }
  .reel .copy { display: none; }
  .reel-toggle { display: none; }
}
.reel:not(.moving) { overflow-x: auto; }
.tile { flex: 0 0 132px; display: block; color: var(--ink); text-decoration: none; }
.tile:hover { color: var(--bright); }
.tile .t { display: block; font-weight: 700; margin-top: 10px; line-height: 1.25; }
.tile .s { display: block; font-size: 14px; color: var(--muted); }
.tile .s.next { color: var(--lav-l); font-weight: 600; }

/* ---------- Page heads ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; justify-content: space-between; margin: 12px 0 28px; }
.page-head h1 { font-size: clamp(36px, 5vw, 56px); }
.page-head .lede { margin-top: 8px; max-width: 54ch; color: var(--muted); font-size: 18px; }
.section-title { font-size: 28px; margin-bottom: 16px; }

/* ---------- Cards / panels ---------- */
.card { background: var(--panel); border-radius: 20px; padding: 20px 22px; box-shadow: 0 3px 0 var(--deep); }
.card h3 { font-size: 21px; margin: 4px 0 6px; color: var(--bright); }
.card-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 15px; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.empty { border: 3px dashed var(--line); border-radius: 22px; padding: 30px; text-align: center; color: var(--muted); }
.empty strong { color: var(--ink); }
.empty p + p { margin-top: 6px; }
.grid > .empty { grid-column: 1 / -1; }

.plus {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px 6px 10px;
  border-radius: 999px; border: 0; cursor: pointer; font-weight: 700; background: var(--raised); color: var(--ink);
  box-shadow: inset 0 -3px 0 var(--deep);
}
.plus[aria-pressed="true"] { background: var(--purple); color: var(--bright); box-shadow: inset 0 -3px 0 var(--purple-d); }

/* ---------- Systems page ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 6px 15px; border-radius: 999px;
  border: 2px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; font-weight: 600; text-decoration: none;
}
.chip:hover { border-color: var(--lav-d); color: var(--bright); }
.chip .count { color: var(--muted); font-weight: 500; }
.chip[aria-current="true"] { background: var(--lav); border-color: var(--lav); color: var(--bg); }
.chip[aria-current="true"] .count { color: var(--purple-d); }
.split { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.split-main { flex: 999 1 560px; min-width: 0; }
.split-side { flex: 1 1 300px; min-width: 0; }
.system-block + .system-block { margin-top: 36px; }
.system-block h2 { font-size: 24px; margin-bottom: 14px; display: flex; gap: 10px; align-items: baseline; }
.system-block h2 .family { font: 600 15px var(--body); color: var(--muted); }
.links-panel { background: var(--panel); border-radius: 24px; padding: 22px 22px 14px; box-shadow: 0 3px 0 var(--deep); }
.links-panel h2 { font-size: 24px; }
.links-panel .sub { color: var(--muted); margin: 4px 0 14px; }
.link-group + .link-group { margin-top: 12px; }
.link-group h3 { font: 700 15px var(--body); color: var(--lav-l); margin: 0 0 4px; }
.link-row { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.link-row a.name { font-weight: 700; color: var(--ink); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.link-row a.name:hover { color: var(--bright); text-decoration: underline; }
.link-row .host { font-size: 14px; color: var(--muted); }
.link-row .note { font-size: 15px; color: #D6D4CE; margin-top: 2px; }
.tag { display: inline-block; font-size: 13px; font-weight: 700; padding: 1px 9px; border-radius: 999px; background: var(--raised); color: var(--lav-l); }

/* ---------- Meetings ---------- */
.meet {
  display: flex; flex-wrap: wrap; gap: 22px; background: var(--panel); border-radius: 26px; padding: 22px;
  box-shadow: 0 3px 0 var(--deep);
}
.meet + .meet { margin-top: 18px; }
.meet-cover { flex: 0 0 170px; }
.meet-body { flex: 1 1 340px; min-width: 0; }
.meet-body h3 { font: 30px/1.1 var(--display); color: var(--bright); margin-top: 6px; }
.meet-facts { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; }
.meet-blurb { margin-top: 12px; white-space: pre-line; color: #D6D4CE; max-width: 62ch; }
.meet-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.log { background: var(--panel); border-radius: 26px; padding: 6px 22px; }
.log-item { display: flex; flex-wrap: wrap; gap: 14px 18px; padding: 18px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.log-item:last-child { border-bottom: 0; }
.log-cover { flex: 0 0 64px; }
.log-body { flex: 1 1 300px; min-width: 0; }
.log-body h3 { font-size: 20px; color: var(--bright); }
.log-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; color: var(--muted); }
.winner { display: inline-flex; gap: 6px; align-items: center; color: var(--lav-l); font-weight: 700; }
.log-notes { margin-top: 6px; white-space: pre-line; }

/* ---------- Forms / dialogs ---------- */
dialog {
  border: 0; border-radius: 28px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  background: var(--panel); color: var(--ink); box-shadow: 0 6px 0 var(--deep), 0 30px 60px rgba(0, 0, 0, .5);
}
dialog::backdrop { background: rgba(10, 10, 12, .7); }
.dialog-inner { padding: 26px; }
.dialog-inner h2 { font-size: 28px; margin-bottom: 18px; }
.form-section { font: 700 16px var(--body); color: var(--lav-l); margin: 22px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-section:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section small { display: block; font-weight: 500; color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label, .field .label { font-weight: 700; }
.field .hint { color: var(--muted); font-size: 14px; }
.field input, .field textarea, .field select {
  font: inherit; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 14px;
  padding: 10px 14px; min-height: 46px; width: 100%;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--lav); outline: none; box-shadow: 0 0 0 3px rgba(167, 155, 216, .35); }
.form-error { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-weight: 600; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 10px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 560px) { .two, .three { grid-template-columns: minmax(0, 1fr); } }

.cover-field { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.cover-field .preview { flex: 0 0 120px; }
.cover-field .controls { flex: 1 1 260px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.file-btn { position: relative; overflow: hidden; align-self: flex-start; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--lav-l); outline-offset: 3px; }
.cover-status { font-size: 14px; color: var(--muted); min-height: 20px; }

/* ---------- Login ---------- */
.auth { flex: 1 1 380px; min-width: 0; background: var(--raised); border-radius: 26px; padding: 26px; box-shadow: 0 4px 0 var(--deep); }
.tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 999px; margin-bottom: 22px; }
.tabs button { flex: 1; border: 0; background: transparent; min-height: 44px; border-radius: 999px; font-weight: 700; cursor: pointer; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--lav); color: var(--bg); }
.notice { background: #2E2850; color: var(--lav-l); border-radius: 14px; padding: 14px 16px; font-weight: 600; }

/* ---------- Members (admin) ---------- */
.person { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--purple); color: var(--bright);
  display: flex; align-items: center; justify-content: center; font: 20px var(--display); flex: 0 0 auto;
}
.person-main { flex: 1 1 260px; min-width: 0; }
.person-note { margin-top: 4px; font-style: italic; color: #D6D4CE; }
.status { font-size: 14px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--raised); }
.status.admin { background: var(--lav); color: var(--bg); }
.status.rejected { background: var(--warn-bg); color: var(--warn-ink); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.section-gap { margin-top: 44px; }

/* ---------- Home: member shortcuts / visitor pitch ---------- */
.shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 44px; }
.shortcut { display: flex; gap: 16px; align-items: center; background: var(--panel); border-radius: 22px; padding: 20px 22px; color: var(--ink); text-decoration: none; box-shadow: 0 3px 0 var(--deep); }
.shortcut:hover { background: var(--raised); color: var(--bright); }
.shortcut strong { display: block; font: 21px var(--display); font-weight: 400; color: var(--bright); }
.shortcut div > span { color: var(--muted); }
.face {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font: 20px var(--display);
}
.face-a { background: var(--lav); color: var(--purple-d); box-shadow: inset 0 -3px 0 var(--lav-d); }
.face-b { background: var(--purple); color: var(--bright); box-shadow: inset 0 -3px 0 var(--purple-d); }
.face-x { background: var(--raised); color: var(--lav-l); box-shadow: inset 0 -3px 0 var(--deep); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--lav); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4); max-width: calc(100vw - 32px);
}
.toast:empty { display: none; }

@media (max-width: 680px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 34px 24px 26px; border-radius: 30px; }
  .detour-arrow { display: none; }
  .now { flex-wrap: wrap; }
  .now-cover { flex-basis: 120px; }
  .who { margin-left: 0; width: 100%; }
  .nav .pill { min-height: 40px; padding: 8px 14px; font-size: 15px; }
  .meet-cover { flex-basis: 120px; }
}
