/*


 */

/* ---- Design tokens -----------------------------------------------------
   "Lumen" = a unit of light. The palette is dark (a server console at
   night) with a single warm glow as the accent -- literally the lumen
   cutting through the dark -- rather than Discord's own blurple or a
   generic acid-green/terracotta AI-default palette.
------------------------------------------------------------------------- */
:root {
  --bg:            #121319;
  --surface:       #1b1d26;
  --surface-raised: #22242f;
  --border:        #2c2f3d;
  --text:          #e7e8ec;
  --text-muted:    #9297a8;
  --text-faint:    #676c7d;

  --glow:          #f2c14e;   /* the "lumen" itself */
  --glow-dim:      #b9923a;
  --glow-bg:       rgba(242, 193, 78, 0.10);

  --danger:        #ff6b6b;
  --danger-bg:     rgba(255, 107, 107, 0.10);
  --success:       #6ee7b7;

  --discord-blurple: #5865f2;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 10px;
  --container-width: 760px;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

a { color: var(--glow); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.2rem; }

p { color: var(--text-muted); }

code {
  font-family: var(--font-display);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.9em;
  color: var(--text);
}

/* ---- Header ------------------------------------------------------------ */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.wordmark:hover { text-decoration: none; }
.wordmark-dot { color: var(--glow); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.nav-link {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-link:hover { color: var(--glow); text-decoration: none; }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
}

/* ---- Flash messages ------------------------------------------------------ */
.flash {
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  margin-top: 1.25rem;
  font-size: 0.9rem;
}
.flash.notice { background: var(--glow-bg); color: var(--glow); border: 1px solid var(--glow-dim); }
.flash.alert  { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }

main { padding: 2.5rem 0 4rem; }

/* ---- Hero (landing page) ------------------------------------------------ */
.hero {
  padding: 4.5rem 0 2rem;
  max-width: 520px;
}
.hero .eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-bottom: 1rem;
}
.hero h1 {
  font-size: 2.3rem;
  line-height: 1.15;
  color: var(--text);
}
.glow-text {
  color: var(--glow);
  text-shadow: 0 0 24px var(--glow-bg);
}
.hero-sub {
  margin: 1rem 0 2rem;
  font-size: 1.02rem;
}

/* ---- Buttons ------------------------------------------------------------ */
.btn-discord, .btn-primary, .btn-ghost, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-discord {
  background: var(--discord-blurple);
  color: white;
}
.btn-discord:hover { text-decoration: none; box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.25); }

.btn-primary, input[type="submit"] {
  background: var(--glow);
  color: #1a1305;
}
.btn-primary:hover, input[type="submit"]:hover {
  box-shadow: 0 0 0 4px var(--glow-bg);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}
.btn-ghost:hover { border-color: var(--text-faint); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .btn-discord, .btn-primary, .btn-ghost, input[type="submit"] { transition: none; }
}

/* ---- Guild list (/guilds) ------------------------------------------------ */
.guild-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.guild-list li {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
}
.guild-list img {
  border-radius: 8px;
  flex-shrink: 0;
}
.guild-list strong {
  flex: 1;
  font-weight: 600;
  color: var(--text);
}

/* ---- Dashboard cards (/guilds/:id) --------------------------------------- */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.dashboard-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dashboard-card:hover {
  text-decoration: none;
  border-color: var(--glow-dim);
  box-shadow: 0 0 0 1px var(--glow-dim);
}
.dashboard-card h2 { color: var(--text); margin-bottom: 0.25rem; }
.dashboard-card p { margin: 0; font-size: 0.9rem; }

/* ---- Command list (/guilds/:id/lum_scripts) ------------------------------ */
.script-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.script-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
}
.script-list li.disabled { opacity: 0.55; }
.script-list strong {
  font-family: var(--font-display);
  color: var(--glow);
  margin-right: 0.6rem;
}
.script-actions { display: flex; gap: 0.75rem; align-items: center; }
.script-actions form { display: inline; }
.script-actions button {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}
.script-actions button:hover { color: var(--danger); }

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  margin-top: 1.5rem;
}

/* ---- Forms (script editor) ----------------------------------------------- */
.script-form { margin-top: 1.5rem; }
.field { margin-bottom: 1.25rem; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.field input[type="text"]:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--glow-dim);
  box-shadow: 0 0 0 3px var(--glow-bg);
}

.code-editor {
  font-family: var(--font-display) !important;
  font-size: 0.9rem !important;
  line-height: 1.6;
  background: #0e0f14 !important;
  color: #d7dae0;
  white-space: pre;
  tab-size: 4;
}

.checkbox-field { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-field label { margin: 0; }

.hint { font-size: 0.82rem; color: var(--text-faint); margin-top: 0.4rem; }
.muted { color: var(--text-faint); }

.form-errors {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  color: var(--danger);
  font-size: 0.9rem;
}
.form-errors ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ---- Guide page (/guide) -------------------------------------------------- */
.guide { max-width: 720px; }
.guide h2 {
  color: var(--text);
  margin-top: 2.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.guide h2:first-of-type { border-top: none; margin-top: 1.5rem; }
.guide h3 { color: var(--text); margin-top: 1.5rem; }
.guide ul { color: var(--text-muted); padding-left: 1.3rem; }
.guide li { margin-bottom: 0.4rem; }
.guide p { color: var(--text-muted); }

.guide-toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0 2.5rem;
}
.guide-toc strong {
  display: block;
  font-family: var(--font-display);
  color: var(--glow);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}
.guide-toc ol {
  margin: 0;
  padding-left: 1.2rem;
  columns: 2;
  column-gap: 2rem;
}
.guide-toc li { margin-bottom: 0.3rem; }
.guide-toc a { color: var(--text-muted); font-size: 0.92rem; }
.guide-toc a:hover { color: var(--glow); text-decoration: none; }

.guide-code {
  font-family: var(--font-display);
  font-size: 0.85rem;
  line-height: 1.6;
  background: #0e0f14;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  color: #d7dae0;
  margin: 0.75rem 0 1.25rem;
  white-space: pre;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.5rem;
  font-size: 0.9rem;
}
.guide-table th, .guide-table td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.8rem;
  text-align: left;
  vertical-align: top;
}
.guide-table th {
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.guide-table td { color: var(--text-muted); }
.guide-table td code, .guide li code, .guide p code { color: var(--glow); background: var(--surface-raised); }

@media (max-width: 600px) {
  .guide-toc ol { columns: 1; }
}
