/* ============================================================================
   11 · DASHBOARD & LANDING VISUAL UPGRADE

   Depth and graphics layered onto the shared SPA classes so every dashboard
   page lifts at once, then the `lp-*` landing / public visual upgrade.
   Deliberately late in the order — it wins on source order.

   Part of the dashboard stylesheet, split out of the former single style.css.
   LOAD ORDER IS LOAD-BEARING (later parts intentionally override earlier
   ones) — the canonical order is dashboard/views/partials/_app_styles.ejs.
   ========================================================================== */

/* ============================================================================
   DASHBOARD VISUAL UPGRADE
   Tasteful depth + graphics layered onto the shared SPA classes so every
   dashboard page lifts at once. Appended last → wins on source order.
   ========================================================================== */

/* ---- Page header: gradient underline + soft accent glow ------------------ */
.page-header {
  position: relative;
  border-bottom: none;
}
.page-header::after {
  content: '';
  position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: linear-gradient(90deg, rgba(var(--blue-rgb),0.55), rgba(var(--blue-rgb),0.10) 45%, transparent 80%);
}
.page-title { letter-spacing: -0.01em; }

/* ---- Settings sections: gradient surface, top hairline, header accent ---- */
.settings-section {
  background: linear-gradient(168deg, var(--surface) 0%, rgba(22, 27, 34,0.55) 100%);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
/* Top hairline, inset so it doesn't poke past the rounded corners (the section
   keeps overflow:visible so in-body dropdowns/menus are never clipped). */
.settings-section::before {
  content: '';
  position: absolute; top: 0; left: 12px; right: 12px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12) 30%, rgba(255,255,255,0.12) 70%, transparent);
  pointer-events: none;
}
.settings-section:hover {
  border-color: rgba(var(--blue-rgb),0.28);
  box-shadow: 0 10px 30px -16px rgba(0,0,0,0.55);
}
.settings-section-header {
  position: relative;
  background: linear-gradient(180deg, rgba(var(--blue-rgb),0.06) 0%, rgba(0,0,0,0.12) 100%);
}
.settings-section-header::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 1.15rem; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--blurple), #B91C1C);
}

/* The section icon chip gets a soft ring so the colour reads as intentional. */
.settings-section-icon,
.section-icon {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

/* ---- Security page: protection sections as standalone cards ---------------
   Every `.settings-section` on the security page holds ONLY its header (icon,
   title/subtitle, configure button + toggle), so the wrapper is just a second
   border wrapped around the header. Neutralize the wrapper and dress the
   header up as the card itself: gradient surface, accent stripe, hover lift.
   Scoped to `.page-security` (set on this page's `page-content` root) so no
   other settings page changes appearance. */
.page-security > .settings-section {
  background: transparent;
  border: none;
  transition: none;
}
.page-security > .settings-section::before { content: none; } /* drop the top hairline */
.page-security > .settings-section:hover {
  border-color: transparent;
  box-shadow: none;
  transform: none;
}
.page-security .settings-section-header {
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.15rem 1.35rem;
  background: linear-gradient(165deg, var(--surface) 0%, rgba(22, 27, 34,0.85) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 28px -20px rgba(0,0,0,0.75);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
/* Full-height accent stripe down the card's left edge (was a short dash). */
.page-security .settings-section-header::before {
  top: 0; bottom: 0; transform: none;
  width: 4px; height: auto;
  border-radius: 0;
  opacity: 0.9;
}
.page-security .settings-section-header:hover {
  border-color: rgba(var(--blue-rgb),0.32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 16px 36px -20px rgba(0,0,0,0.85);
  transform: translateY(-2px);
}
.page-security .settings-section-header:hover::before { opacity: 1; }
/* Icon chip: a touch larger so it anchors the card. */
.page-security .section-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.65rem;
  font-size: 1.125rem;
}
.page-security .settings-section-title { font-size: 1rem; }
/* Subtle enabled-state tint on the card whose toggle is switched on
   (`:has` — sections without a toggle, e.g. Server Recovery, are untouched). */
.page-security .settings-section:has(.toggle-btn.on) .settings-section-header {
  border-color: rgba(var(--green-rgb), 0.35);
}
.page-security .settings-section:has(.toggle-btn.on) .settings-section-header::before {
  background: linear-gradient(180deg, var(--green), var(--blurple));
}

/* ---- Tables: gradient header (consistent with docs). Keep `th` opaque —
   it is position:sticky, so a see-through background would let rows show
   through while scrolling. ---- */
th { background: linear-gradient(180deg, var(--surface) 0%, var(--bg-secondary) 100%); }
tbody tr { transition: background 0.12s; }

/* ---- KPI cards: faint corner sheen that brightens on hover --------------- */
.kpi-card { transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.kpi-card::after {
  background: linear-gradient(135deg, rgba(var(--blue-rgb),0.06) 0%, transparent 60%);
  transition: opacity 0.2s ease;
  opacity: 1;
}
.kpi-card:hover::after { opacity: 0; }
.kpi-card:hover { transform: translateY(-3px); }

/* ---- Guild cards: corner glow on hover (dashboard landing) --------------- */
.guild-card--managed::after {
  content: '';
  position: absolute; width: 220px; height: 220px; top: -120px; right: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--blue-rgb),0.16) 0%, transparent 70%);
  opacity: 0; transition: opacity 0.25s ease; pointer-events: none;
}
.guild-card--managed:hover::after { opacity: 1; }

/* ---- Empty state: glowing halo behind the icon --------------------------- */
.empty-state-icon {
  position: relative;
  isolation: isolate;
  color: var(--blurple);
  opacity: 0.85;
}
.empty-state-icon::after {
  content: '';
  position: absolute; inset: -40%;
  background: radial-gradient(circle, rgba(var(--blue-rgb),0.18) 0%, transparent 65%);
  z-index: -1;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .settings-section, .kpi-card, .guild-card--managed,
  .page-security .settings-section-header { transition: none !important; }
}

/* ============================================================================
   LANDING / PUBLIC VISUAL UPGRADE  (prefix: lp-)
   Rich-but-tasteful depth, graphics and motion layered on the existing
   Deep-Space palette. Reused across landing, pricing and docs.
   ========================================================================== */

/* ---- Ambient background field: drifting orbs + faint dot grid ------------ */
.lp-ambient {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.lp-ambient .lp-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform;
}
.lp-ambient .lp-orb--a {
  width: 640px; height: 640px; top: -240px; right: -160px;
  background: radial-gradient(circle, rgba(var(--blue-rgb),0.20) 0%, transparent 65%);
  animation: orb-drift-a 24s ease-in-out infinite alternate;
}
.lp-ambient .lp-orb--b {
  width: 520px; height: 520px; bottom: -200px; left: -120px;
  background: radial-gradient(circle, rgba(147, 197, 114,0.10) 0%, transparent 65%);
  animation: orb-drift-b 30s ease-in-out infinite alternate;
}
.lp-ambient .lp-orb--c {
  width: 420px; height: 420px; top: 35%; left: 42%;
  background: radial-gradient(circle, rgba(var(--green-rgb),0.06) 0%, transparent 65%);
  animation: orb-drift-a 38s ease-in-out infinite alternate-reverse;
}

/* Faint dot grid that fades out toward the edges — gives the canvas texture. */
.lp-dotgrid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(148,163,184,0.10) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 0%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 0%, transparent 75%);
}

/* Keep landing content above the decorative layers. */
.lp-above { position: relative; z-index: 1; }

/* ---- Eyebrow pill with a slow shimmer sweep ------------------------------ */
.lp-eyebrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  color: var(--blurple);
  background: rgba(var(--blue-rgb),0.12);
  border: 1px solid rgba(var(--blue-rgb),0.32);
  overflow: hidden;
}
.lp-eyebrow::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.18) 50%, transparent 60%);
  background-size: 220% 100%;
  animation: shimmer-sweep 4s ease-in-out infinite;
}

/* ---- Animated gradient heading accent ------------------------------------ */
.lp-grad-text {
  background: linear-gradient(100deg, #EF4444 0%, #DC2626 35%, #93C572 70%, #EF4444 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: lp-grad-pan 8s linear infinite;
}
@keyframes lp-grad-pan {
  to { background-position: 220% center; }
}

/* ---- Hero mock: float + glow ring ---------------------------------------- */
.lp-hero-mock {
  position: relative;
  box-shadow: 0 30px 70px -25px rgba(0,0,0,0.7), 0 0 0 1px var(--border);
  animation: lp-float 7s ease-in-out infinite;
}
.lp-hero-mock::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(var(--blue-rgb),0.6), transparent 40%, rgba(147, 197, 114,0.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
@keyframes lp-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* ---- Stat row: 2-up base, 4-up on wide screens --------------------------- */
@media (min-width: 880px) {
  .lp-stat-row { grid-template-columns: repeat(4, 1fr) !important; }
}

/* ---- Stat card ----------------------------------------------------------- */
.lp-stat-card {
  position: relative;
  background: linear-gradient(160deg, var(--surface) 0%, rgba(22, 27, 34,0.4) 100%);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.5rem 1rem;
  text-align: center;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.lp-stat-card::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--blurple), transparent);
  opacity: 0.5;
}
.lp-stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(var(--blue-rgb),0.4);
  box-shadow: 0 12px 30px -12px rgba(var(--blue-rgb),0.35);
}
.lp-stat-num {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #93C5FD, var(--blurple));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lp-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border-radius: 0.625rem;
  margin-bottom: 0.75rem;
  background: rgba(var(--blue-rgb),0.14);
  color: var(--blurple);
  font-size: 18px;
}

/* ---- Feature card (replaces inline hover handlers) ----------------------- */
.lp-feature-card {
  position: relative;
  background: linear-gradient(165deg, var(--surface) 0%, rgba(22, 27, 34,0.55) 100%);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.5rem;
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  --lp-accent: var(--blurple);
  --lp-accent-rgb: var(--blue-rgb);
}
.lp-feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2.5px;
  background: linear-gradient(90deg, transparent, rgb(var(--lp-accent-rgb)), transparent);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.lp-feature-card::after {
  content: '';
  position: absolute;
  width: 220px; height: 220px;
  top: -110px; right: -110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--lp-accent-rgb),0.16) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.lp-feature-card:hover {
  transform: translateY(-5px);
  border-color: rgba(var(--lp-accent-rgb),0.55);
  box-shadow: 0 16px 36px -18px rgba(var(--lp-accent-rgb),0.5);
}
.lp-feature-card:hover::before { transform: scaleX(1); }
.lp-feature-card:hover::after  { opacity: 1; }
.lp-feature-card .lp-fc-icon {
  position: relative;
  width: 2.75rem; height: 2.75rem;
  border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
  background: rgba(var(--lp-accent-rgb),0.14);
  color: rgb(var(--lp-accent-rgb));
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.lp-feature-card:hover .lp-fc-icon {
  transform: scale(1.08);
  box-shadow: 0 0 0 6px rgba(var(--lp-accent-rgb),0.10);
}
.lp-feature-card .lp-fc-title { font-weight: 700; font-size: 0.9375rem; margin-bottom: 0.4rem; }
.lp-feature-card .lp-fc-desc  { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.55; }

/* Accent variants */
.lp-feature-card.lp-accent-red   { --lp-accent-rgb: var(--red-rgb); }
.lp-feature-card.lp-accent-green { --lp-accent-rgb: var(--green-rgb); }
.lp-feature-card.lp-accent-yellow { --lp-accent-rgb: 245,158,11; }

/* ---- "How it works" steps with connector line ---------------------------- */
.lp-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  max-width: 56rem;
  margin: 0 auto;
}
.lp-step { position: relative; text-align: center; padding: 1.5rem; }
.lp-step-num {
  position: relative;
  width: 3.5rem; height: 3.5rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; font-weight: 800;
  margin: 0 auto 1.125rem;
  color: #fff;
  background: linear-gradient(145deg, var(--blurple), #B91C1C);
  box-shadow: 0 8px 22px -8px rgba(var(--blue-rgb),0.7), inset 0 1px 0 rgba(255,255,255,0.25);
}
.lp-step-num::after {
  content: '';
  position: absolute; inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(var(--blue-rgb),0.35);
  animation: pulse-badge 2.6s ease-in-out infinite;
}
/* Dotted connector behind the steps (desktop only) */
@media (min-width: 720px) {
  .lp-steps::before {
    content: '';
    position: absolute;
    top: 3.25rem; left: 16%; right: 16%;
    border-top: 2px dashed rgba(var(--blue-rgb),0.3);
    z-index: 0;
  }
  .lp-step { z-index: 1; }
}

/* ---- Section heading helper ---------------------------------------------- */
.lp-section-head { text-align: center; margin-bottom: 3rem; }
.lp-section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  margin: 1rem 0 0.75rem;
}
.lp-section-head p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 36rem;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---- CTA band: gradient + grid texture ----------------------------------- */
.lp-cta-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 90% at 50% 50%, rgba(var(--blue-rgb),0.18) 0%, transparent 70%);
}
.lp-cta-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(var(--blue-rgb),0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--blue-rgb),0.07) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 60% 80% at 50% 50%, #000, transparent 75%);
          mask-image: radial-gradient(ellipse 60% 80% at 50% 50%, #000, transparent 75%);
}

/* ---- Scroll reveal (progressive enhancement; JS adds .lp-reveal-on) ------- */
/* No-JS / pre-init: everything is fully visible (no FOUC). The hidden initial
   state is only applied once landing-fx.js flags <body> as reveal-ready. */
.lp-reveal-ready .lp-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.lp-reveal-ready .lp-reveal.lp-reveal-on {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .lp-ambient .lp-orb,
  .lp-hero-mock,
  .lp-grad-text,
  .lp-eyebrow::after,
  .lp-step-num::after { animation: none !important; }
  .lp-reveal-ready .lp-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .lp-hero-mock { transform: none !important; }
}
