/* Custom dynamic and vibrant styles */
:root {
  --bg: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --card: #ffffff;
  --accent: #7c3aed; /* purple */
  --accent-2: #06b6d4; /* cyan */
  --ring: rgba(124, 58, 237, 0.35);
}

html[data-theme="dark"] {
  --bg: #0b1020;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --card: #0f172a;
  --accent: #a78bfa; /* lighter purple */
  --accent-2: #22d3ee; /* cyan */
  --ring: rgba(167, 139, 250, 0.35);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  transition: background 300ms ease, color 300ms ease;
}

/* Headings with vibrant gradient */
h1, h2, h3 {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Muted text utility */
.muted { color: var(--muted); }

/* Links with animated underline */
a {
  color: var(--accent);
  text-decoration: none;
  position: relative;
}
a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 250ms ease;
}
a:hover::after { transform: scaleX(1); }

/* Card look for tables/sections that behave as blocks */
.table-card, .card, .post, .page-content table {
  background: var(--card);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  box-shadow: 0 10px 30px -15px rgba(2, 6, 23, 0.25);
  padding: 14px;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms ease, transform 600ms ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Back to top button */
#backToTop {
  position: fixed;
  right: 20px; bottom: 24px;
  width: 42px; height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: var(--card);
  color: var(--text);
  display: grid; place-items: center;
  box-shadow: 0 10px 24px -12px rgba(2, 6, 23, 0.4);
  cursor: pointer;
  opacity: 0; pointer-events: none;
  transform: translateY(12px);
  transition: opacity 250ms ease, transform 250ms ease;
  z-index: 9999;
}
#backToTop.visible {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}

/* Theme toggle button */
#themeToggle {
  position: fixed;
  right: 20px; bottom: 80px;
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 10px 24px -12px rgba(2, 6, 23, 0.4);
  cursor: pointer;
  z-index: 9999;
}
#themeToggle:focus {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Subtle hover lift */
.hover-lift {
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px -20px rgba(2, 6, 23, 0.45);
}

/* Make avatar circular glow if present */
img[src*="JuoTung_photo"], img[alt*="Juo-Tung" i] {
  border-radius: 999px;
  box-shadow: 0 8px 40px -18px var(--ring);
}

/* Improve list spacing */
ul { padding-left: 1.2rem; }
li { margin: 6px 0; }

/* Respect existing minima wrapper, widen a bit on large screens */
.wrapper { max-width: 1100px; }
