/* ============================================================
   Sidequest Journey — Design tokens, reset, and shared utilities
   Load before any page-specific stylesheet.
   ============================================================ */

/* ── Theme variables ── */
:root {
  --bg:         #f0f2f8;
  --bg2:        #ffffff;
  --bg3:        #f6f8fd;
  --acc:        #5b4ed1;
  --acc-dim:    rgba(91,78,209,.09);
  --acc-border: rgba(91,78,209,.22);
  --acc-glow:   0 0 30px rgba(91,78,209,.14);
  --green:      #16a34a;
  --green-dim:  rgba(22,163,74,.1);
  --amber:      #c2760f;
  --amber-dim:  rgba(194,118,15,.1);
  --text:       #0f1117;
  --muted:      #6b7280;
  --dim:        #374151;
  --border:     rgba(0,0,0,.09);
  --grid-line:  rgba(0,0,0,.04);
  --shadow:     0 2px 16px rgba(0,0,0,.08);
  --r: 12px; --rs: 7px;
}
html.theme-dark {
  color-scheme: dark;
  --bg:         #09090e;
  --bg2:        #0f101a;
  --bg3:        #13141f;
  --acc:        #7b6ef6;
  --acc-dim:    rgba(123,110,246,.16);
  --acc-border: rgba(123,110,246,.32);
  --acc-glow:   0 0 40px rgba(123,110,246,.22);
  --green:      #3dd68c;
  --green-dim:  rgba(61,214,140,.13);
  --amber:      #f6a623;
  --amber-dim:  rgba(246,166,35,.12);
  --text:       #dde1f0;
  --muted:      #5c6480;
  --dim:        #8891b0;
  --border:     rgba(255,255,255,.07);
  --grid-line:  rgba(255,255,255,.014);
  --shadow:     0 2px 20px rgba(0,0,0,.4);
}

/* ── Reset + base ── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
input, select, textarea { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ── Subtle grid overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
}

/* ── Logo icon (used on landing, hub, dashboard topbars) ── */
.logo-icon {
  width: 32px; height: 32px;
  background: var(--acc-dim);
  border: 1px solid var(--acc-border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}

/* ── Theme toggle button (shared across all pages) ── */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  min-height: 32px;
}
.theme-toggle-btn:hover { color: var(--text); border-color: var(--acc-border); }

/* ── Hub page shared utilities ── */
.hub-body { min-height: 100dvh; background: var(--bg); color: var(--text); }
.hub-loading {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: var(--dim); gap: 12px;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:.5} 50%{opacity:1} }

/* ── Safe area support (iPhone notch / Android cutout) ── */
@supports (padding: env(safe-area-inset-bottom)) {
  .lp-footer { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
  .hub-topbar { padding-left: calc(clamp(1rem,4vw,3rem) + env(safe-area-inset-left)); padding-right: calc(clamp(1rem,4vw,3rem) + env(safe-area-inset-right)); }
}

/* ── Reduce motion ── */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
