/* =====================================================
   STACKDEN — shared.css
   Light mode, theme toggle, Sage widget, animations
   ===================================================== */

/* ── LIGHT MODE THEME ─────────────────────────────── */
:root.light {
  --bg: #f0f7ea;
  --card: #ffffff;
  --card2: #e4f0d8;
  --green: #32620e;
  --accent: #3a8a1a;
  --text: #1a2e10;
  --muted: #4a6e38;
  --border: #b8d8a0;
  --gold: #a86e00;
}
.light .header { background: rgba(240,247,234,0.96) !important; }
.light body::after { display: none !important; }
.light .modal { box-shadow: 0 8px 48px rgba(0,0,0,0.12); }
.light .tool-card,
.light .arcade-card,
.light .blog-card { box-shadow: 0 2px 10px rgba(0,0,0,0.07); }

/* ── THEME TOGGLE BUTTON ──────────────────────────── */
#sd-theme-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  padding: 5px 9px;
  border-radius: 4px;
  transition: all 0.2s;
  line-height: 1;
  margin-left: 6px;
  vertical-align: middle;
}
#sd-theme-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.12);
}

/* ── PIXEL RAINBOW STRIP (top of body) ────────────── */
.sd-pixel-strip {
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg,
    #7ec850 0%, #f5c842 20%, #32c8a0 40%,
    #7ec850 60%, #f5c842 80%, #7ec850 100%);
  background-size: 300% 100%;
  animation: sdPixelRoll 5s linear infinite;
  position: relative;
  z-index: 99;
}
@keyframes sdPixelRoll {
  from { background-position: 0% center; }
  to   { background-position: 300% center; }
}

/* ── SAGE FLOATING WIDGET ─────────────────────────── */
#sd-sage-widget {
  position: fixed;
  bottom: 26px;
  right: 26px;
  z-index: 9980;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.sd-sage-bubble {
  background: var(--card);
  border: 1.5px solid var(--accent);
  border-radius: 10px 10px 0 10px;
  padding: 11px 15px;
  max-width: 215px;
  font-size: 12px;
  color: var(--text);
  line-height: 1.65;
  box-shadow: 0 6px 22px rgba(0,0,0,0.28);
  animation: sdFadeUp 0.2s ease both;
}
.sd-sage-bubble.sd-hidden { display: none; }
.sd-sage-bubble strong {
  color: var(--accent);
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  display: block;
  margin-bottom: 5px;
  line-height: 1.8;
}
.sd-sage-bubble a { color: var(--accent); text-decoration: none; }
.sd-sage-bubble a:hover { text-decoration: underline; }

.sd-sage-avatar {
  width: 54px;
  height: 54px;
  cursor: pointer;
  animation: sdBob 2.6s ease-in-out infinite;
  filter: drop-shadow(0 3px 12px rgba(232,120,32,0.55));
  transition: filter 0.2s;
}
.sd-sage-avatar:hover {
  filter: drop-shadow(0 4px 16px rgba(232,120,32,0.85));
}
.sd-sage-avatar:active { transform: scale(0.88) !important; }

@keyframes sdBob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
@keyframes sdFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SHIMMER ON CTAs ──────────────────────────────── */
.nav-cta, .play-btn, .cta-btn, .modal-btn {
  position: relative;
  overflow: hidden;
}
.nav-cta::after, .play-btn::after,
.cta-btn::after, .modal-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
  transform: skewX(-18deg);
  pointer-events: none;
}
.nav-cta:hover::after, .play-btn:hover::after,
.cta-btn:hover::after, .modal-btn:hover::after {
  animation: sdShimmer 0.55s ease forwards;
}
@keyframes sdShimmer {
  from { left: -80%; }
  to   { left: 140%; }
}

/* ── RICHER CARD HOVER ────────────────────────────── */
.tool-card:hover {
  box-shadow: 0 10px 36px rgba(126,200,80,0.2) !important;
}
.arcade-card:hover {
  box-shadow: 0 14px 42px rgba(126,200,80,0.18) !important;
}

/* ── SECTION ACCENT GRADIENT TOP BORDER ──────────────*/
.section[class~="section"]::before,
.section::before {
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent)) !important;
}

/* ── NAV ALIGNMENT (ensure toggle btn stays centered) */
nav.nav { align-items: center !important; }

/* ── LIGHT MODE: readable card text ──────────────── */
.light .tool-card:hover,
.light .arcade-card:hover {
  box-shadow: 0 10px 32px rgba(58,138,26,0.16) !important;
}
.light .section::before {
  background: linear-gradient(90deg, var(--accent), #a86e00, var(--accent)) !important;
}

/* ── GLOW PULSE UTILITY ───────────────────────────── */
@keyframes sdGlow {
  0%, 100% { box-shadow: 0 0 5px 1px rgba(126,200,80,0.4); }
  50%       { box-shadow: 0 0 18px 6px rgba(126,200,80,0.75); }
}
.sd-glow { animation: sdGlow 2.2s ease-in-out infinite; }

/* ── FOOTER LEGAL LINK LEGIBILITY ────────────────── */
.light .footer-legal { color: #6a8a5a; }
.light .footer-legal a { color: #3a7a1a; }

/* ── SAGE INTERACTIVE WIDGET ──────────────────────── */
.sd-sage-heading {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--accent);
  display: block;
  margin-bottom: 6px;
  line-height: 1.8;
}
.sd-sage-sub {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.sd-sage-menu-btn {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s;
  margin-bottom: 6px;
  display: block;
}
.sd-sage-menu-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(126,200,80,0.08);
}
.sd-sage-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 4px;
  outline: none;
  resize: none;
  margin-bottom: 8px;
  display: block;
  box-sizing: border-box;
}
.sd-sage-input:focus { border-color: var(--accent); }
.sd-sage-submit {
  width: 100%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 9px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: block;
}
.sd-sage-submit:hover { background: var(--green); color: var(--accent); }
.sd-sage-submit:disabled { opacity: 0.6; cursor: default; }
.sd-sage-back {
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 10px;
  display: inline-block;
  line-height: 1.8;
}
.sd-sage-back:hover { color: var(--accent); }
.sd-sage-tip {
  font-size: 12px;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 10px;
}
.sd-sage-next-tip {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  padding: 6px 10px;
  border-radius: 3px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
  display: block;
}
.sd-sage-next-tip:hover { background: var(--accent); color: var(--bg); }
.sd-sage-success {
  text-align: center;
  color: var(--accent);
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  line-height: 2.2;
  padding: 4px 0;
}
.sd-sage-error {
  color: #ff6b6b;
  font-size: 10px;
  margin-top: 6px;
  font-family: 'DM Sans', sans-serif;
  line-height: 1.5;
}

/* ── LIGHT MODE: fix hardcoded dark .card.featured ── */
.light .card.featured {
  background: linear-gradient(135deg, var(--card), var(--card2)) !important;
  border-color: rgba(58,138,26,0.35) !important;
}
.light .card.featured .card-name,
.light .card.featured .card-desc,
.light .card.featured .tag {
  color: var(--text) !important;
}
.light .card.featured .card-meta { color: var(--muted) !important; }

/* ── COOKIE CONSENT BANNER ────────────────────────── */
#sd-cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(10,15,10,0.97);
  border-top: 1px solid var(--border);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 9990;
  flex-wrap: wrap;
  backdrop-filter: blur(10px);
  animation: sdSlideUpBanner 0.35s ease;
}
@keyframes sdSlideUpBanner {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.sd-cookie-text { font-size: 12px; color: var(--muted); flex: 1; line-height: 1.6; min-width: 200px; }
.sd-cookie-text a { color: var(--accent); text-decoration: none; }
.sd-cookie-text a:hover { text-decoration: underline; }
.sd-cookie-btns { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.sd-cookie-accept {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 9px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.sd-cookie-accept:hover { background: var(--green); color: var(--accent); }
.sd-cookie-decline {
  font-size: 12px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.sd-cookie-decline:hover { border-color: var(--muted); color: var(--text); }
.light #sd-cookie-banner { background: rgba(240,247,234,0.97); }

/* ── ARTICLE TOOLBAR (TTS + SHARE) ───────────────── */
.article-toolbar {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.tts-player { display: flex; align-items: center; gap: 10px; }
.tts-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.tts-btn:hover { border-color: var(--accent); background: rgba(126,200,80,0.08); }
.tts-progress-wrap { display: none; align-items: center; gap: 8px; }
.tts-bar { width: 100px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.tts-fill { height: 100%; background: var(--accent); border-radius: 3px; width: 0%; transition: width 0.4s; }
.tts-stop {
  font-size: 11px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.18s;
}
.tts-stop:hover { border-color: #ff6b6b; color: #ff6b6b; }
.share-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-label { font-family: 'Press Start 2P', monospace; font-size: 6px; color: var(--muted); }
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(126,200,80,0.08); }
.copy-confirm { font-size: 11px; color: var(--accent); opacity: 0; transition: opacity 0.3s; white-space: nowrap; }
