/* ─────────────────────────────────────────────────────────────────────
   Xcelerate Help Center — Apple aero-glass design system
   Tokens + glass primitives ported from xcelerate-kanban/styles/globals.css.
   This file is loaded BEFORE the inline <style> in index.html so any
   project-specific tweaks there still win.
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* Brand */
  --theme-accent: #f54900;
  --theme-accent-rgb: 245, 73, 0;
  --theme-accent-hover: #ff7a30;
  --theme-accent-dark: #d63e00;

  /* Dark-mode surfaces (default — body has `dark` class by default on this site) */
  --bg-base: #0a0b10;
  --bg-elevated: #11131a;
  --bg-overlay: rgba(20, 22, 32, 0.72);
  --bg-strong: rgba(18, 20, 28, 0.85);
  --bg-soft: rgba(20, 22, 32, 0.5);
  --bg-input: rgba(255, 255, 255, 0.04);

  --text-primary: #f5f5f7;
  --text-muted: rgba(245, 245, 247, 0.65);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-hover: rgba(245, 73, 0, 0.35);

  --highlight-top: rgba(255, 255, 255, 0.18);
  --inner-gradient-top: rgba(255, 255, 255, 0.04);
  --inner-ring: rgba(255, 255, 255, 0.04);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-glass: 0 20px 40px -16px rgba(0, 0, 0, 0.45);
  --shadow-lift: 0 12px 30px -12px rgba(0, 0, 0, 0.55);
  --shadow-brand-glow:
    0 0 0 1px rgba(245, 73, 0, 0.18),
    0 18px 42px -18px rgba(245, 73, 0, 0.35);
}

/* Light-mode overrides — applied when <html> does NOT have .dark.
   The helpcenter ships a real light theme via the existing toggle. */
html:not(.dark) {
  --bg-base: #f4f5f7;
  --bg-elevated: #ffffff;
  --bg-overlay: rgba(255, 255, 255, 0.78);
  --bg-strong: rgba(255, 255, 255, 0.92);
  --bg-soft: rgba(255, 255, 255, 0.6);
  --bg-input: rgba(15, 23, 42, 0.04);

  --text-primary: #111827;
  --text-muted: rgba(17, 24, 39, 0.6);

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);

  --highlight-top: rgba(255, 255, 255, 0.9);
  --inner-gradient-top: rgba(255, 255, 255, 0.6);
  --inner-ring: rgba(15, 23, 42, 0.04);

  --shadow-glass: 0 20px 40px -16px rgba(15, 23, 42, 0.18);
  --shadow-lift: 0 12px 30px -12px rgba(15, 23, 42, 0.22);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
}

::selection {
  background-color: rgba(var(--theme-accent-rgb), 0.3);
}

/* ── Ambient background sheen ────────────────────────────────────────
   Soft orange wash top-right + cool wash bottom-left so the page has
   warmth without lighting up. Fixed so it doesn't scroll with content. */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 600px at 100% -10%, rgba(245, 73, 0, 0.10), transparent 70%),
    radial-gradient(700px 500px at 0% 100%, rgba(80, 110, 200, 0.06), transparent 70%);
}
html:not(.dark) .ambient-bg {
  background:
    radial-gradient(900px 600px at 100% -10%, rgba(245, 73, 0, 0.10), transparent 70%),
    radial-gradient(700px 500px at 0% 100%, rgba(80, 110, 200, 0.05), transparent 70%);
}

/* ── Glass system ────────────────────────────────────────────────────
   Base layer: 72% opacity slate behind a 24px backdrop blur + 150% saturation
   (Apple's recipe). The ::before is the 1px top hairline, ::after is the inner
   downward gradient, and the inset ring is on box-shadow. */
.glass {
  position: relative;
  background: var(--bg-overlay);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow:
    var(--shadow-glass),
    inset 0 0 0 1px var(--inner-ring);
}
.glass::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--highlight-top), transparent);
  pointer-events: none;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}
.glass::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--inner-gradient-top), transparent 35%);
  pointer-events: none;
  border-radius: inherit;
}
.glass > * { position: relative; z-index: 1; }

.glass-strong {
  position: relative;
  background: var(--bg-strong);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow:
    var(--shadow-glass),
    inset 0 0 0 1px var(--inner-ring);
}
.glass-strong::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--highlight-top), transparent);
  pointer-events: none;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}
.glass-strong::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--inner-gradient-top), transparent 35%);
  pointer-events: none;
  border-radius: inherit;
}
.glass-strong > * { position: relative; z-index: 1; }

.glass-soft {
  position: relative;
  background: var(--bg-soft);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.glass-soft > * { position: relative; z-index: 1; }

/* Hover-interactive variant — lifts and tints the border with brand. */
.glass.interactive,
.glass-soft.interactive {
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
}
.glass.interactive:hover,
.glass-soft.interactive:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow:
    var(--shadow-brand-glow),
    inset 0 0 0 1px var(--inner-ring);
}

/* Solid (non-glass) elevated surface */
.surface {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

/* ── Form controls ──────────────────────────────────────────────────── */
.glass-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  outline: none;
}
.glass-input::placeholder { color: var(--text-muted); opacity: 0.7; }
.glass-input:hover { border-color: var(--border-strong); }
.glass-input:focus,
.glass-input:focus-within {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 2px rgba(var(--theme-accent-rgb), 0.22);
}

/* ── Brand glow + gradient text ─────────────────────────────────────── */
.brand-glow {
  box-shadow: var(--shadow-brand-glow);
}
.brand-glow-hover { transition: box-shadow 0.2s ease, transform 0.2s ease; }
.brand-glow-hover:hover {
  box-shadow: var(--shadow-brand-glow);
}

@keyframes aero-gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.gradient-text-aero {
  background: linear-gradient(90deg, #f54900, #ff7a30, #ffb37a, #ff7a30, #f54900);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: aero-gradient-shift 12s ease infinite;
}

/* ── Scrollbar ───────────────────────────────────────────────────────── */
.styled-scrollbar::-webkit-scrollbar { width: 8px; height: 8px; }
.styled-scrollbar::-webkit-scrollbar-track { background: transparent; }
.styled-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}
.styled-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--theme-accent-rgb), 0.45);
}
.styled-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}
html:not(.dark) .styled-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.12);
}

/* ── Brand-tinted folder icon container (reuses kanban AttachmentDropzone recipe) */
.brand-icon-tile {
  position: relative;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 178, 122, 0.55), transparent 60%),
    linear-gradient(135deg, var(--theme-accent), var(--theme-accent-dark));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 14px 28px -12px rgba(245, 73, 0, 0.5);
}

/* ── Cmd-K keyboard pill ─────────────────────────────────────────────── */
.kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: ui-monospace, "SF Mono", monospace;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-muted);
}

/* ── Doc layout helpers ──────────────────────────────────────────────── */
.doc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .doc-grid {
    grid-template-columns: 240px minmax(0, 1fr) 220px;
    gap: 1.75rem;
  }
}

.doc-sidebar,
.doc-toc {
  position: sticky;
  top: 5.5rem;
  align-self: start;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
}

/* TOC item active marker */
.toc-link {
  position: relative;
  display: block;
  padding: 4px 10px 4px 14px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
  line-height: 1.4;
}
.toc-link:hover { color: var(--text-primary); background: var(--bg-input); }
.toc-link.toc-h3 { padding-left: 26px; font-size: 12px; }
.toc-link.toc-active {
  color: var(--theme-accent);
  background: rgba(var(--theme-accent-rgb), 0.08);
}
.toc-link.toc-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--theme-accent);
}

/* Sidebar nav item */
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background 0.2s ease;
  cursor: pointer;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-input); }
.nav-link.nav-active {
  color: var(--theme-accent);
  background: rgba(var(--theme-accent-rgb), 0.10);
}
.nav-link.nav-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--theme-accent);
}
.nav-folder {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ── Prose tweaks so document body sits well on glass ──────────────── */
.prose-aero h1, .prose-aero h2, .prose-aero h3, .prose-aero h4 {
  scroll-margin-top: 5.5rem;
}

/* Cleanly hide the legacy glassmorphism rule's effect when used —
   the new .glass-soft class is the replacement. */
.glassmorphism { background: var(--bg-soft); backdrop-filter: blur(16px) saturate(140%); }
