/* Iridex design system — canonical source.
   Duplicated into homepage/, dashboard/, and wiki/'s assets/css/base.css
   (each Pages project deploys independently, so this can't be @imported
   across project roots). Edit here first, then re-copy into the three sites. */

:root {
  /* ---- Iris spectrum (same stops as shared/src/theme.ts IRIS_SPECTRUM) ---- */
  --iris-1: #8b5cf6;
  --iris-2: #6366f1;
  --iris-3: #3b82f6;
  --iris-4: #22d3ee;
  --iris-5: #34d399;
  --iris-6: #f472b6;
  --iris-gradient: linear-gradient(90deg, var(--iris-1), var(--iris-2), var(--iris-3), var(--iris-4), var(--iris-5), var(--iris-6), var(--iris-1));

  --primary: var(--iris-1);
  --primary-dark: #6d28d9;
  --primary-contrast: #f5f5f0;

  /* ---- Surfaces. Layered dark ramp: each step is a distinct elevation, so
     nested cards stay readable instead of all collapsing to the same grey. ---- */
  --bg: #08080a;
  --bg-subtle: #0c0c10;
  --surface: #121116;
  --surface-alt: #191820;
  --surface-hi: #201f29;
  --border: #26252f;
  --border-hi: #34323f;

  --text: #f7f7fa;
  --text-muted: #a2a0ae;
  --text-dim: #6f6d7b;

  --success: #2ecc71;
  --danger: #e5484d;
  --warning: #f8a710;
  --info: #5aa9ff;

  /* ---- Fluid type scale (1.25 ratio, clamped so it never gets silly on
     ultrawide or unreadable on mobile) ---- */
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-md: 0.9375rem;
  --text-base: 1rem;
  --text-lg: clamp(1.06rem, 0.3vw + 1rem, 1.19rem);
  --text-xl: clamp(1.25rem, 0.6vw + 1.1rem, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.1vw + 1.25rem, 2rem);
  --text-3xl: clamp(1.9rem, 2vw + 1.4rem, 2.75rem);
  --text-4xl: clamp(2.4rem, 3.4vw + 1.5rem, 3.75rem);
  --text-5xl: clamp(2.9rem, 5.2vw + 1.4rem, 5rem);

  /* ---- Spacing scale (4px base) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* ---- Radii ---- */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 40px;
  --radius-full: 999px;

  /* ---- Layered shadows. Two-to-three stacked shadows read as real depth;
     a single large blur just reads as a grey smudge. ---- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.3), 0 6px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.3), 0 24px 60px rgba(0, 0, 0, 0.55);
  --glow-iris: 0 8px 30px rgba(139, 92, 246, 0.35);

  /* ---- Easing ---- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Baloo 2", var(--font);
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  /* Fine grain overlay — self-contained SVG turbulence, no external asset.
     Breaks up flat gradient banding so large color fields look like a
     surface instead of a CSS gradient. */
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Light theme — dashboard web UI only (toggled by dashboard/assets/js/theme.js).
   Inert on the other sites since they never set data-theme. The bot's
   Discord-side embeds are unaffected by any of this. */
:root[data-theme="light"] {
  --bg: #fbfaf9;
  --bg-subtle: #f4f2f7;
  --surface: #ffffff;
  --surface-alt: #f6f4fa;
  --surface-hi: #efecf6;
  --border: #e5e2ec;
  --border-hi: #d5d1e0;
  --text: #16151a;
  --text-muted: #62606d;
  --text-dim: #8b8895;
  --primary-contrast: #ffffff;

  --shadow-sm: 0 1px 2px rgba(20, 15, 40, 0.06);
  --shadow-md: 0 2px 4px rgba(20, 15, 40, 0.05), 0 6px 16px rgba(20, 15, 40, 0.08);
  --shadow-lg: 0 4px 8px rgba(20, 15, 40, 0.06), 0 12px 32px rgba(20, 15, 40, 0.1);
  --shadow-xl: 0 8px 16px rgba(20, 15, 40, 0.07), 0 24px 60px rgba(20, 15, 40, 0.13);
  --glow-iris: 0 8px 30px rgba(139, 92, 246, 0.22);
}

/* ================= RESET / BASE ================= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh; /* sticky footer: full-height flex column to push it into */
  transition: background-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

code, pre, .mono { font-family: var(--font-mono); font-size: 0.92em; }

/* Visible keyboard focus everywhere, without the permanent mouse-click ring. */
:focus-visible {
  outline: 2px solid var(--iris-4);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Non-selectable text/images site-wide. user-select is inherited, so setting
   it on <html> covers everything; form fields need it restored to "text" or
   editing them (typing, select-to-replace, copy/paste) breaks — that
   exception is functional, not a style choice. */
html {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}
img, svg {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none; /* clicks fall through to the parent <a>/<button> */
}

/* ---- Themed scrollbar ---- */
html { scrollbar-width: thin; scrollbar-color: var(--border-hi) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border-radius: var(--radius-full);
  border: 3px solid var(--bg);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); background-clip: padding-box; }
::selection { background: rgba(139, 92, 246, 0.35); color: #fff; }

/* ================= ANIMATED GRADIENT HELPERS ================= */
.iris-gradient-bg {
  background: var(--iris-gradient);
  background-size: 300% 300%;
  animation: iris-shift 8s ease infinite;
}
.iris-gradient-text {
  background: var(--iris-gradient);
  background-size: 300% 300%;
  animation: iris-shift 8s ease infinite;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@keyframes iris-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ================= SCROLL REVEAL ================= */
/* Elements start hidden only when JS is available to reveal them — the
   .js-reveal class is added to <html> by reveal.js, so with JS disabled
   or broken, content stays visible instead of being permanently invisible. */
.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
}
.js-reveal [data-reveal].is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  .iris-gradient-bg, .iris-gradient-text { animation: none; }
  .js-reveal [data-reveal] { opacity: 1; transform: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* Keyboard skip link — visually hidden until focused, then it parks itself
   over the nav so a keyboard user can jump past it. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  background: var(--iris-1);
  color: #fff;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 0 0 var(--radius-sm) 0;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ================= LAYOUT ================= */
.container {
  /* width:100% is load-bearing: body is a flex column (sticky footer), and a
     margin:auto flex item with auto width shrinks to fit-content instead of
     stretching (auto margins beat align-items:stretch per spec). A definite
     width restores max-width + margin:auto centering at full size. */
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}
.container-narrow { max-width: 800px; }

.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }

.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.spread { display: flex; align-items: center; justify-content: space-between; }
.center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }

/* ================= NAV (legacy static bar — pill nav lives in site.css) ================= */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(8, 8, 10, 0.85);
  backdrop-filter: blur(10px);
  z-index: 20;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 800;
  font-size: var(--text-lg);
  text-decoration: none;
  color: var(--text);
}
.nav-links { display: flex; align-items: center; gap: var(--space-6); list-style: none; margin: 0; padding: 0; }
.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: var(--text-md);
  font-weight: 600;
  transition: color 0.15s var(--ease-out);
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }

/* ================= BUTTONS ================= */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-md);
  line-height: 1;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s var(--ease-spring), background 0.18s var(--ease-out),
              border-color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), color 0.18s var(--ease-out);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
  background: var(--iris-gradient);
  background-size: 250% 250%;
  animation: iris-shift 10s ease infinite;
  color: #fff;
  box-shadow: var(--glow-iris);
}
.btn-primary:hover { box-shadow: 0 12px 38px rgba(139, 92, 246, 0.5); }

.btn-outline { background: transparent; color: var(--text); border-color: var(--border-hi); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(139, 92, 246, 0.07); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: var(--text-sm); }
.btn-lg { padding: 15px 30px; font-size: var(--text-base); }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ================= CARDS ================= */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}
.card-alt { background: var(--surface-alt); }

/* Interactive card: lifts, brightens its border, and picks up a gradient
   hairline along the top edge on hover. */
.card-interactive { transition: transform 0.25s var(--ease-out), border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out); }
.card-interactive::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 2px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--iris-gradient);
  background-size: 250% 250%;
  opacity: 0;
  transition: opacity 0.25s var(--ease-out);
}
.card-interactive:hover { transform: translateY(-4px); border-color: var(--border-hi); box-shadow: var(--shadow-lg); }
.card-interactive:hover::before { opacity: 1; animation: iris-shift 6s ease infinite; }

/* ================= BADGES ================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-primary { background: rgba(139, 92, 246, 0.14); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.35); }
.badge-success { background: rgba(46, 204, 113, 0.13); color: #6ee7a8; border-color: rgba(46, 204, 113, 0.32); }
:root[data-theme="light"] .badge-primary { color: #6d28d9; }
:root[data-theme="light"] .badge-success { color: #17794a; }

/* ================= FORMS ================= */
input, textarea, select {
  width: 100%;
  padding: 11px 15px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-md);
  transition: border-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out), background 0.15s var(--ease-out);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}
label { font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 6px; }
.field { margin-bottom: var(--space-4); }
.hint { font-size: var(--text-xs); color: var(--text-dim); margin-top: 6px; }

/* ================= LEGACY FOOTER (plain bar) ================= */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-10) var(--space-6);
  color: var(--text-muted);
  font-size: var(--text-md);
}
.footer a { color: var(--text-muted); text-decoration: none; }
.footer a:hover { color: var(--primary); }
.footer-links { display: flex; gap: var(--space-5); flex-wrap: wrap; margin-top: var(--space-3); }

/* ================= LOADING OVERLAY ================= */
/* Shown by default; each page's script removes it once real content exists,
   so there's never a flash of a half-built page. See assets/loader.js. */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.35s var(--ease-out), visibility 0s linear 0s;
}
.page-loader.is-hidden { opacity: 0; visibility: hidden; transition: opacity 0.35s var(--ease-out), visibility 0s linear 0.35s; }
.page-loader-mark {
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  background: var(--iris-gradient);
  background-size: 300% 300%;
  animation: iris-shift 3s ease infinite, loader-pulse 1.5s var(--ease-in-out) infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-iris);
}
.page-loader-mark img { width: 28px; }
@keyframes loader-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.86); opacity: 0.75; }
}
@media (prefers-reduced-motion: reduce) {
  .page-loader-mark { animation: none; }
}

/* ================= 404 ================= */
.notfound {
  flex: 1;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-24) var(--space-6);
}
.notfound::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: var(--noise); opacity: 0.05;
}
.notfound-inner { position: relative; z-index: 2; max-width: 620px; }
/* Scoped with the parent class deliberately: the generic `.notfound p` rule
   below is (0,1,1) and would otherwise win on specificity *and* order,
   shrinking the big 404 numeral down to body-copy size. */
.notfound .notfound-code {
  font-family: var(--font-display);
  font-size: clamp(5rem, 18vw, 11rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.04em;
  background: linear-gradient(100deg, var(--iris-1), var(--iris-4) 50%, var(--iris-6));
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: iris-shift 9s ease infinite;
  margin: 0;
}
.notfound h1 { font-size: var(--text-3xl); margin: var(--space-4) 0 var(--space-3); }
.notfound p { color: var(--text-muted); font-size: var(--text-lg); margin: 0 auto var(--space-8); max-width: 46ch; }
.notfound-links { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }
.notfound-suggest {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  display: flex; gap: var(--space-5); justify-content: center; flex-wrap: wrap;
}
.notfound-suggest a {
  color: var(--text-muted); text-decoration: none;
  font-size: var(--text-md); font-weight: 600;
  transition: color 0.15s var(--ease-out);
}
.notfound-suggest a:hover { color: var(--iris-4); }

/* ================= SECTION HEADINGS ================= */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--iris-1);
  margin-bottom: var(--space-3);
}
.section-label::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--iris-gradient);
  background-size: 250% 250%;
}
.section-title { font-family: var(--font-display); font-size: var(--text-3xl); margin: 0 0 var(--space-3); }
.section-sub { color: var(--text-muted); font-size: var(--text-lg); max-width: 56ch; margin: 0; }
