/* UnDiscord — shared site styles (landing, auth, app, admin, legal). */

:root {
  color-scheme: dark;

  /* Palette */
  --bg: #0e1015;
  --bg-2: #13161d;
  --surface: #181c25;
  --surface-2: #1f242f;
  --surface-3: #262c39;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --ink: #eef0f6;
  --ink-2: #c7cdd9;
  --mut: #8f98ab;
  --brand: #5865f2;
  --brand-hover: #6a76f5;
  --brand-active: #4752c4;
  --brand-soft: rgba(88, 101, 242, 0.14);
  --brand-ink: #aeb6ff;
  --ok: #3ddc97;
  --ok-soft: rgba(61, 220, 151, 0.14);
  --warn: #f0b35a;
  --warn-soft: rgba(240, 179, 90, 0.12);
  --err: #f26d6d;
  --err-soft: rgba(242, 109, 109, 0.12);

  /* Shape & type */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --container: 1080px;
  --narrow: 720px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { max-width: 100%; display: inline-block; vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(88, 101, 242, 0.4); }

h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: clamp(32px, 5vw, 56px); letter-spacing: -0.03em; font-weight: 800; }
h2 { font-size: clamp(26px, 3.4vw, 36px); }
h3 { font-size: 18px; }
p { margin: 0; }
.muted { color: var(--mut); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: var(--narrow); }
.page { min-height: 100vh; display: flex; flex-direction: column; }
.page > main { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

/* Brand mark */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(145deg, #6a76f5, #4752c4);
  display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800;
  letter-spacing: 0.02em; box-shadow: 0 4px 12px rgba(88, 101, 242, 0.35);
}
.brand .suffix { color: var(--mut); font-weight: 500; }

/* Top nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 16, 21, 0.78);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a { color: var(--ink-2); font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.nav-links a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav-links .btn { margin-left: 8px; }
@media (max-width: 720px) { .nav-links a:not(.btn) { display: none; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; line-height: 1.2; cursor: pointer;
  color: #fff; background: var(--brand); white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .08s ease, box-shadow .15s ease;
  text-decoration: none;
}
.btn:hover { background: var(--brand-hover); text-decoration: none; box-shadow: 0 6px 20px rgba(88, 101, 242, 0.3); }
.btn:active { transform: translateY(1px); background: var(--brand-active); box-shadow: none; }
.btn.lg { padding: 14px 24px; font-size: 16px; border-radius: 12px; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.btn.ghost:hover { background: var(--surface-3); box-shadow: none; }
.btn.ghost:active { background: var(--surface-2); }
.btn.outline { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn.outline:hover { background: var(--surface-2); box-shadow: none; }
.btn.danger { background: transparent; border-color: rgba(242, 109, 109, 0.45); color: var(--err); }
.btn.danger:hover { background: var(--err-soft); box-shadow: none; }
.btn.danger.solid { background: var(--err); color: #fff; border-color: transparent; }
.btn.danger.solid:hover { background: #ff7b7b; }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 24px; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 17px; margin-bottom: 6px; }
.card > .muted { font-size: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }

/* Badges & pills */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em; line-height: 1.4;
}
.badge.paid { background: var(--ok-soft); color: var(--ok); }
.badge.free { background: var(--surface-3); color: var(--ink-2); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-ink); font-size: 13px; font-weight: 600;
  border: 1px solid rgba(88, 101, 242, 0.25);
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input, input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 10px; font-size: 15px;
  background: var(--bg-2); color: var(--ink); border: 1px solid var(--line-strong);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: #5f6778; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 > .field + .field { margin-top: 0; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* Status messages */
.msg { font-size: 14px; min-height: 20px; margin-top: 12px; color: var(--mut); }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }
.alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r);
  font-size: 14px; line-height: 1.55; border: 1px solid;
}
.alert.warn { background: var(--warn-soft); border-color: rgba(240, 179, 90, 0.3); color: #f6d6a3; }
.alert.info { background: var(--brand-soft); border-color: rgba(88, 101, 242, 0.3); color: var(--brand-ink); }
.alert .ico { flex: none; width: 20px; height: 20px; margin-top: 1px; }

/* Lists */
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.list li:first-child { border-top: 0; padding-top: 0; }
.list li:last-child { padding-bottom: 0; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { position: relative; padding-left: 40px; color: var(--ink-2); font-size: 14.5px; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
  background: var(--brand-soft); color: var(--brand-ink);
}

/* Dialog */
dialog {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); padding: 24px; max-width: 420px; width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(4, 6, 10, 0.7); backdrop-filter: blur(4px); }
dialog h2 { font-size: 19px; margin-bottom: 8px; }

/* Code block */
pre {
  margin: 12px 0 0; padding: 14px; border-radius: var(--r); overflow-x: auto;
  background: var(--bg-2); border: 1px solid var(--line); font-family: var(--mono); font-size: 13px; color: var(--ink-2); line-height: 1.5;
}

/* Page header (dashboard/admin/legal) */
.page-head { padding: 40px 0 24px; }
.page-head h1 { font-size: clamp(26px, 4vw, 34px); }
.page-head .muted { margin-top: 6px; font-size: 15px; }

/* Legal / prose */
.prose { padding-bottom: 72px; }
.prose h1 { font-size: clamp(28px, 4vw, 38px); }
.prose h2 { font-size: 20px; margin: 36px 0 10px; }
.prose p, .prose li { color: var(--ink-2); font-size: 15.5px; }
.prose p + p { margin-top: 12px; }
.prose ul { padding-left: 22px; margin: 10px 0; }
.prose li { margin: 6px 0; }
.prose table { border-collapse: collapse; width: 100%; margin-top: 12px; font-size: 14.5px; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { color: var(--mut); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.prose .updated { color: var(--mut); font-size: 13.5px; margin: 8px 0 24px; }
.prose .lead { font-size: 17px; color: var(--ink); }
.legal-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 28px; }
.legal-nav a { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.legal-nav a[aria-current] { background: var(--brand-soft); color: var(--brand-ink); border-color: rgba(88, 101, 242, 0.3); }
.legal-nav a:hover { text-decoration: none; color: var(--ink); }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 32px 0 44px; margin-top: 48px; color: var(--mut); font-size: 13.5px; }
.footer .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer nav { display: flex; gap: 4px; flex-wrap: wrap; }
.footer nav a { color: var(--mut); padding: 6px 10px; border-radius: 6px; }
.footer nav a:hover { color: var(--ink); text-decoration: none; background: var(--surface); }
.footer .disclaimer { width: 100%; font-size: 12.5px; color: #6a7386; margin-top: 4px; }

/* Auth / centered shell */
.center-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; position: relative; }
.center-shell .card { width: 100%; max-width: 400px; padding: 32px 28px; box-shadow: var(--shadow-lg); }
.center-shell .brand { margin-bottom: 28px; }
.center-shell .foot { margin-top: 20px; font-size: 13px; color: var(--mut); text-align: center; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--mut); font-size: 12.5px; margin: 18px 0; text-transform: uppercase; letter-spacing: 0.06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }

/* Ambient glow */
.glow { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.glow::before {
  content: ""; position: absolute; left: 50%; top: -220px; width: 900px; height: 600px;
  transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(88, 101, 242, 0.28), rgba(88, 101, 242, 0.06) 60%, transparent 75%);
  filter: blur(20px);
}
.glow + * { position: relative; z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
