/* ============================================================
   theme.css - shared look for EVERY page on the site

   All colors live in the variables below. Dark mode just swaps
   the variables (the <html> element gets a "dark" class), so new
   components only need to use var(--something) and they will
   automatically work in both modes.

   To give a single page its own accent colors, override the
   variables in a small page stylesheet, e.g.:
       :root      { --heading: #aaddff; --border: #aaddff; --glow-rgb: 170,221,255; }
       html.dark  { --heading: #88bbff; ... }
   ============================================================ */

/* ---------- Light theme (default) ---------- */
:root {
  --font: 'Segoe UI', sans-serif;

  /* page */
  --bg-top: #f8ffff;
  --bg-bottom: #ffffff;
  --text: #444;
  --subtitle: #888;

  /* accents */
  --heading: #ffc4ff;          /* h1 / h2 */
  --border: #ffc4ff;           /* card + footer borders */
  --border-peak: #ffaaff;      /* border color at the peak of the glow pulse */
  --glow-rgb: 255, 196, 255;   /* r,g,b used for glows and shadows */
  --glow-max: 22px;            /* size of the glow at its peak */

  /* cards / footer */
  --card-bg: #fff8ff;
  --bio-text: #444;
  --footer-bg: #fff0ff;
  --footer-text: #888;

  /* pill buttons */
  --btn-bg: #ffc4ff;
  --btn-rgb: 255, 196, 255;
  --btn-hover: #0088cc;
  --btn-hover-rgb: 0, 136, 204;

  /* stacking order, lowest to highest */
  --z-snow: 5;
  --z-back-to-top: 997;
  --z-sparkle: 998;
  --z-controls: 999;
  --z-lightbox: 1000;
}

/* ---------- Dark theme ---------- */
html.dark {
  --bg-top: #0f1923;
  --bg-bottom: #1a1a2e;
  --text: #cce0ff;
  --subtitle: #6a88aa;

  --heading: #dd99ff;
  --border: #cc88ff;
  --border-peak: #bb66ff;
  --glow-rgb: 200, 100, 255;
  --glow-max: 30px;

  --card-bg: #1a1f35;
  --bio-text: #aac0dd;
  --footer-bg: #1a1f35;
  --footer-text: #7a99bb;

  --btn-bg: #5533aa;
  --btn-rgb: 85, 51, 170;
}

/* ============================================================
   Base
   ============================================================ */
body {
  margin: 0;
  font-family: var(--font);
  background: linear-gradient(to bottom, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  text-align: center;
}

/* ============================================================
   Top-left controls (dark mode + effects)
   ============================================================ */
.controls {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
  z-index: var(--z-controls);
}

.ctrl-btn {
  background: var(--btn-bg);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9em;
  box-shadow: 0 2px 8px rgba(var(--btn-rgb), 0.5);
  transition: background 0.3s, box-shadow 0.3s;
  border: none;
  cursor: pointer;
}

.ctrl-btn:hover {
  background: var(--btn-hover);
  box-shadow: 0 2px 12px rgba(var(--btn-hover-rgb), 0.5);
}

/* ============================================================
   Page header
   ============================================================ */
header {
  padding: 40px 20px 20px 20px;
}

/* Keep the header clear of the fixed buttons on small screens */
@media (max-width: 600px) {
  header { padding-top: 70px; }
}

h1 {
  margin: 0;
  font-size: 3em;
  color: var(--heading);
  text-shadow: 0 0 15px rgba(var(--glow-rgb), 0.7);
}

.subtitle {
  margin-top: 10px;
  font-size: 1.1em;
  color: var(--subtitle);
}

/* ============================================================
   Profile card (.bio) - reuse on any page that needs one
   ============================================================ */
@keyframes bioGlow {
  0%, 100% {
    box-shadow: 0 0 6px rgba(var(--glow-rgb), 0.3);
    border-color: var(--border);
  }
  50% {
    box-shadow: 0 0 var(--glow-max) rgba(var(--glow-rgb), 0.9);
    border-color: var(--border-peak);
  }
}

.bio {
  background-color: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 25px 30px;
  margin: 30px auto;
  max-width: 900px;
  color: var(--bio-text);
  text-align: left;
  animation: bioGlow 3s ease-in-out infinite;
}

.bio-content {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.profile-pic {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border);
  box-shadow: 0 0 15px rgba(var(--glow-rgb), 0.5);
  flex-shrink: 0;
  transition: box-shadow 0.3s, transform 0.3s;
  cursor: pointer;
}

.profile-pic:hover {
  transform: scale(1.08);
  box-shadow: 0 0 30px rgba(var(--glow-rgb), 0.9);
}

.bio-text h2 {
  color: var(--heading);
  text-shadow: 0 0 8px rgba(var(--glow-rgb), 0.5);
  margin-top: 0;
  font-size: 2em;
}

.bio-text p {
  font-size: 1.1em;
  line-height: 1.5em;
}

@media (max-width: 700px) {
  .bio-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .profile-pic { width: 100px; height: 100px; }
}

/* ============================================================
   Footer
   ============================================================ */
footer {
  margin-top: 60px;
  padding: 30px 20px;
  background: var(--footer-bg);
  border-top: 2px solid var(--border);
  color: var(--footer-text);
  font-size: 0.95em;
}

footer p {
  margin: 0 0 12px 0;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--btn-bg);
  color: white;
  padding: 8px 18px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.95em;
  transition: background 0.3s, box-shadow 0.3s;
  box-shadow: 0 2px 8px rgba(var(--btn-rgb), 0.4);
}

.social-link:hover {
  background: var(--btn-hover);
  box-shadow: 0 2px 12px rgba(var(--btn-hover-rgb), 0.4);
}

.bsky-icon {
  width: 18px;
  height: 18px;
  fill: white;
  flex-shrink: 0;
}

/* ============================================================
   Effects: falling snow + cursor sparkles
   ============================================================ */
#snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;      /* never blocks clicks */
  z-index: var(--z-snow);
}

.sparkle {
  position: fixed;
  pointer-events: none;
  z-index: var(--z-sparkle);
  line-height: 1;
  text-shadow: 0 0 6px currentColor;
  animation: sparkleFade 0.9s ease-out forwards;
}

@keyframes sparkleFade {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(0.4) rotate(0deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(120deg); }
}

/* ============================================================
   Back to top button
   ============================================================ */
#back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--btn-bg);
  color: white;
  font-size: 1.4em;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(var(--btn-rgb), 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s, background 0.3s;
  z-index: var(--z-back-to-top);
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover { background: var(--btn-hover); }

/* ============================================================
   Accessibility: respect "reduce motion"
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .bio { animation: none; }
  .sparkle { display: none; }
}
