/* ==========================================================================
   Glitch — design system

   The legacy variable names (--bg, --surface, --surface2, --border, --purple,
   --pink, --text, --muted, --danger) are KEPT and re-pointed at the refined
   palette. The staff control-panel templates reference them ~180 times in
   their own inline <style> blocks, so renaming would break every one of them.
   New work should prefer the fuller token set below.
   ========================================================================== */

/* ── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ── Tokens ──────────────────────────────────────────────────────────── */
:root {
  /* Legacy names — kept for the control-panel templates. */
  --bg:       #08080f;
  --surface:  #11111d;
  --surface2: #18182a;
  --border:   #27273f;
  --purple:   #a78bfa;   /* text-legible violet; also a gradient stop */
  --pink:     #f472b6;
  --text:     #eceaf5;
  --muted:    #9a97b0;
  --danger:   #fb7185;

  /* Extended palette */
  --bg-sunken:  #050509;
  --elev-1:     #11111d;
  --elev-2:     #18182a;
  --elev-3:     #202036;

  --line:        rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);

  --fg:        #eceaf5;
  --fg-muted:  #9a97b0;
  --fg-subtle: #64627a;

  --violet:      #a78bfa;
  --violet-deep: #7c3aed;
  --violet-soft: rgba(139, 92, 246, 0.14);
  --violet-line: rgba(139, 92, 246, 0.38);
  --rose:        #f472b6;
  --rose-soft:   rgba(244, 114, 182, 0.13);

  --success:      #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --warn:         #fbbf24;
  --warn-soft:    rgba(251, 191, 36, 0.12);
  --danger-soft:  rgba(251, 113, 133, 0.12);

  /* Spacing — 4px base */
  --s1: 0.25rem;  --s2: 0.5rem;  --s3: 0.75rem;  --s4: 1rem;
  --s5: 1.25rem;  --s6: 1.5rem;  --s8: 2rem;     --s10: 2.5rem;
  --s12: 3rem;    --s16: 4rem;   --s20: 5rem;    --s24: 6rem;

  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-xl: 22px; --r-full: 999px;

  --sh-1: 0 1px 2px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.03);
  --sh-2: 0 4px 16px -4px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.04);
  --sh-3: 0 18px 50px -12px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.05);
  --sh-glow: 0 10px 40px -10px rgba(124, 58, 237, .55);

  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur: 150ms;

  --nav-h: 60px;
  --content: 1120px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Base ────────────────────────────────────────────────────────────── */
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--violet); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--rose); }

::selection { background: var(--violet-deep); color: #fff; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: var(--r-sm); }

* { scrollbar-width: thin; scrollbar-color: var(--elev-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--elev-3); border-radius: var(--r-full);
  border: 3px solid transparent; background-clip: content-box;
}

main { flex: 1; }

/* ── Typography ──────────────────────────────────────────────────────── */
.t-display {
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.02;
}
.t-h1 { font-size: clamp(1.6rem, 4vw, 2.25rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
.t-h2 { font-size: 1.125rem; font-weight: 650; letter-spacing: -0.012em; }
.t-lead { font-size: 1.0625rem; line-height: 1.7; color: var(--fg-muted); }
.t-sm { font-size: 0.875rem; }
.t-xs { font-size: 0.8125rem; }
.t-muted { color: var(--fg-muted); }
.t-subtle { color: var(--fg-subtle); }
.t-label {
  font-size: 0.6875rem; font-weight: 650; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--fg-subtle);
}

/* The brand gradient. Used for the wordmark and hero accent only — if every
   heading gets it, none of them read as special. */
.t-grad {
  background: linear-gradient(115deg, var(--violet) 10%, var(--rose) 90%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

code, .code {
  font-family: var(--mono); font-size: 0.875em;
  background: var(--elev-2); border: 1px solid var(--line);
  padding: 0.12em 0.42em; border-radius: var(--r-sm); color: var(--violet);
}

/* ── Icons ───────────────────────────────────────────────────────────── */
.i {
  width: 1.125em; height: 1.125em; flex-shrink: 0;
  stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.i-lg { width: 1.4rem; height: 1.4rem; }
.i-xl { width: 2rem; height: 2rem; stroke-width: 1.5; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s2);
  height: 40px; padding: 0 var(--s5);
  border: none; border-radius: var(--r-sm);
  font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.005em;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:active { transform: translateY(.5px) scale(.99); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--violet-deep), var(--rose));
  color: #fff;
  box-shadow: var(--sh-1), 0 4px 18px -6px rgba(124,58,237,.6);
}
.btn-primary:hover {
  color: #fff;
  box-shadow: var(--sh-2), var(--sh-glow);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--elev-2); color: var(--fg);
  border: 1px solid var(--line-strong); box-shadow: var(--sh-1);
}
.btn-outline:hover { background: var(--elev-3); border-color: var(--violet-line); color: var(--fg); }

.btn-ghost { background: none; color: var(--fg-muted); }
.btn-ghost:hover { background: var(--elev-2); color: var(--fg); }

.btn-sm { height: 32px; padding: 0 var(--s3); font-size: 0.85rem; }
.btn-lg { height: 48px; padding: 0 var(--s8); font-size: 1rem; }
.btn-block { width: 100%; }

/* Discord blurple, kept literal — it is Discord's colour, not ours. */
.btn-discord { background: #5865f2; color: #fff; box-shadow: var(--sh-1), 0 4px 20px -6px rgba(88,101,242,.65); }
.btn-discord:hover { background: #4752c4; color: #fff; transform: translateY(-1px); box-shadow: var(--sh-2), 0 8px 28px -8px rgba(88,101,242,.7); }
.btn-discord .i { fill: currentColor; stroke: none; width: 1.25rem; height: 1.25rem; }

/* ── Nav ─────────────────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 60;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4);
  padding: 0 var(--s6);
  background: rgba(8, 8, 15, 0.72);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  border-bottom: 1px solid var(--line);
}
.nav-logo {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--fg); text-decoration: none;
}
.nav-logo:hover { color: var(--fg); }
.nav-mark {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, var(--violet), var(--violet-deep) 55%, var(--rose));
  box-shadow: 0 3px 12px -3px rgba(124,58,237,.75), inset 0 1px 0 rgba(255,255,255,.3);
}
.nav-mark .i { width: 16px; height: 16px; stroke-width: 2; }
.nav-links { display: flex; align-items: center; gap: var(--s2); }
.nav-link {
  padding: var(--s2) var(--s3); border-radius: var(--r-sm);
  font-size: 0.875rem; font-weight: 500; color: var(--fg-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-link:hover { background: var(--elev-2); color: var(--fg); }
.nav-link.active { color: var(--violet); background: var(--violet-soft); }

/* ── Footer ──────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--line);
  padding: var(--s10) var(--s6);
  margin-top: var(--s16);
  background: var(--bg-sunken);
}
.footer-inner {
  max-width: var(--content); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s5); flex-wrap: wrap;
}
.footer-links { display: flex; gap: var(--s5); flex-wrap: wrap; }
.footer-links a { font-size: 0.875rem; color: var(--fg-muted); }
.footer-links a:hover { color: var(--fg); }
.footer-note { font-size: 0.8125rem; color: var(--fg-subtle); }

/* ── Layout ──────────────────────────────────────────────────────────── */
.wrap { max-width: var(--content); margin: 0 auto; padding: 0 var(--s6); }
.wrap-narrow { max-width: 680px; margin: 0 auto; padding: 0 var(--s6); }
.section { padding: var(--s16) 0; }
.section-head { text-align: center; max-width: 620px; margin: 0 auto var(--s10); }
.section-head h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); font-weight: 700; letter-spacing: -0.028em; }
.section-head p { color: var(--fg-muted); margin-top: var(--s3); line-height: 1.7; }

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: var(--s24) var(--s6) var(--s16);
  text-align: center;
  overflow: hidden;
}
/* Ambient bloom behind the headline — replaces the flat background. */
.hero::before {
  content: "";
  position: absolute; top: -40%; left: 50%;
  width: min(1200px, 140vw); aspect-ratio: 1;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 50% 50%, rgba(124,58,237,.32), transparent 60%),
    radial-gradient(circle at 65% 42%, rgba(244,114,182,.18), transparent 52%);
  filter: blur(24px);
  pointer-events: none; z-index: 0;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(ellipse 75% 55% at 50% 0%, #000 25%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 75% 55% at 50% 0%, #000 25%, transparent 72%);
  pointer-events: none; z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero-inner { max-width: 720px; margin: 0 auto; }
.hero .t-lead { max-width: 52ch; margin: var(--s5) auto var(--s8); }
.hero-cta { display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: var(--s4); font-size: 0.8125rem; color: var(--fg-subtle); }

.pill {
  display: inline-flex; align-items: center; gap: var(--s2);
  height: 30px; padding: 0 var(--s4);
  border-radius: var(--r-full);
  background: var(--violet-soft);
  border: 1px solid var(--violet-line);
  color: var(--violet);
  font-size: 0.8125rem; font-weight: 550;
  letter-spacing: 0.02em;
  margin-bottom: var(--s6);
}
.pill .i { width: 14px; height: 14px; }

/* ── Card showcase ───────────────────────────────────────────────────── */
.showcase { padding: var(--s8) 0 var(--s16); }
.card-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s5);
  max-width: 960px;
  margin: 0 auto;
}
.card-mock {
  position: relative;
  border-radius: var(--r-lg);
  transition: transform 320ms var(--ease-out), filter 320ms var(--ease);
  will-change: transform;
}
.card-mock img {
  width: 100%; height: auto;
  border-radius: var(--r-lg);
  display: block;
}
/* Glow sits behind the art so transparent card edges stay clean. */
.card-mock::before {
  content: "";
  position: absolute; inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,.5), transparent 70%);
  filter: blur(28px);
  opacity: 0; z-index: -1;
  transition: opacity 320ms var(--ease);
}
.card-mock:hover { transform: translateY(-10px) scale(1.03); }
.card-mock:hover::before { opacity: 1; }
/* Gentle alternating tilt so the row doesn't read as a rigid grid. */
.card-mock:nth-child(odd)  { transform: rotate(-1.2deg); }
.card-mock:nth-child(even) { transform: rotate(1.2deg); }
.card-mock:nth-child(odd):hover  { transform: translateY(-10px) scale(1.03) rotate(-2deg); }
.card-mock:nth-child(even):hover { transform: translateY(-10px) scale(1.03) rotate(2deg); }

@media (max-width: 900px) { .card-rail { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 620px) { .card-rail { grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--s4); } }

/* ── Cards / panels ──────────────────────────────────────────────────── */
.card {
  background: var(--elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line);
}
.card-head .i { color: var(--violet); }
.card-head h2 { font-size: 0.9375rem; font-weight: 650; }
.card-body { padding: var(--s5); }
.card-foot { padding: var(--s4) var(--s5); border-top: 1px solid var(--line); background: var(--bg-sunken); }

/* Feature / action tile */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); }
.tile {
  display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s5);
  background: var(--elev-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  color: var(--fg); text-decoration: none;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
a.tile:hover {
  border-color: var(--violet-line); background: var(--elev-2);
  transform: translateY(-3px); box-shadow: var(--sh-2); color: var(--fg);
}
.tile-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--violet-soft); color: var(--violet);
  border: 1px solid var(--violet-line);
  margin-bottom: var(--s2);
}
.tile h3 { font-size: 0.9375rem; font-weight: 650; }
.tile p { font-size: 0.875rem; color: var(--fg-muted); line-height: 1.6; }
.tile-accent { border-color: var(--violet-line); background: linear-gradient(150deg, var(--violet-soft), transparent 60%); }
.tile-rose .tile-icon { background: var(--rose-soft); color: var(--rose); border-color: rgba(244,114,182,.35); }
.tile-rose { border-color: rgba(244,114,182,.3); background: linear-gradient(150deg, var(--rose-soft), transparent 60%); }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: var(--s2);
  height: 26px; padding: 0 var(--s3);
  border-radius: var(--r-full);
  font-size: 0.8125rem; font-weight: 600;
  border: 1px solid transparent;
}
.badge .i { width: 14px; height: 14px; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: rgba(74,222,128,.3); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(251,191,36,.3); }
.badge-violet { background: var(--violet-soft); color: var(--violet); border-color: var(--violet-line); }

/* ── Forms ───────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s5); }
.field > label { font-size: 0.875rem; font-weight: 600; color: var(--fg); }
.field .hint { font-size: 0.8125rem; color: var(--fg-subtle); line-height: 1.55; }
.field small { color: var(--fg-subtle); font-weight: 400; }

.input, .select, .textarea {
  width: 100%;
  background: var(--elev-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--fg);
  padding: 0 var(--s3); height: 40px;
  font-size: 0.9375rem; outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { height: auto; min-height: 96px; padding: var(--s3); resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--fg-subtle); }
.input:hover, .select:hover, .textarea:hover { border-color: rgba(255,255,255,.2); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft);
}
.select {
  appearance: none; cursor: pointer; padding-right: var(--s8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a97b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--s3) center; background-size: 16px;
}
.select option { background: var(--elev-2); color: var(--fg); }

/* ── Notices ─────────────────────────────────────────────────────────── */
.notice {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s4);
  border-radius: var(--r);
  font-size: 0.9rem; line-height: 1.6;
  border: 1px solid;
}
.notice .i { margin-top: 2px; flex-shrink: 0; }
.notice-success { background: var(--success-soft); border-color: rgba(74,222,128,.35); color: #86efac; }
.notice-error, .error-banner { background: var(--danger-soft); border-color: rgba(251,113,133,.4); color: #fda4af; }
.notice-info { background: var(--violet-soft); border-color: var(--violet-line); color: var(--violet); }

/* Legacy: .error-banner was a bare div in the old templates. */
.error-banner {
  padding: var(--s4); border-radius: var(--r); border: 1px solid rgba(251,113,133,.4);
  font-size: 0.9rem; margin-bottom: var(--s4);
}

/* ── Utilities ───────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: var(--s3); }
.col { display: flex; flex-direction: column; gap: var(--s3); }
.center { text-align: center; }
.mt-2 { margin-top: var(--s2); } .mt-4 { margin-top: var(--s4); } .mt-6 { margin-top: var(--s6); }
.mb-2 { margin-bottom: var(--s2); } .mb-4 { margin-bottom: var(--s4); } .mb-6 { margin-bottom: var(--s6); }
.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;
}
.divider { border: none; border-top: 1px solid var(--line); margin: var(--s8) 0; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  nav { padding: 0 var(--s4); gap: var(--s3); }
  .nav-link { padding: var(--s2); }
  /* Staff pages add extra links; let the row scroll instead of widening the page. */
  .nav-logo { flex-shrink: 0; }
  .nav-links {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin-right: calc(var(--s4) * -1);
    padding-right: var(--s4);
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links > * { flex-shrink: 0; }
  .wrap, .wrap-narrow { padding: 0 var(--s4); }
  .hero { padding: var(--s16) var(--s4) var(--s10); }
  .section { padding: var(--s10) 0; }
  footer { padding: var(--s8) var(--s4); }
  .footer-inner { justify-content: center; text-align: center; }
}
