*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fdfaf8;
  --bg-glow: rgba(255, 100, 0, 0.02); 
  --surface: #ffffff;
  --surface-2: #fff5f0;
  --border: #f0e1d8;
  --border-strong: #e0c5b4;
  --text: #1a1512;
  --text-2: #5c4d45;
  --text-3: #998073;
  --accent: #ff5100;
  --accent-soft: rgba(255, 81, 0, 0.08);
  --accent-2: #ff8400;
  --gold: #f59e0b;
  --silver: #94a3b8;
  --bronze: #cd7f32;
  --green: #10b981;
  --green-soft: #ecfdf5;
  --red: #ef4444;
  --red-soft: #fff5f5;
  --shadow: 0 2px 8px rgba(255, 81, 0, 0.05), 0 8px 24px rgba(0,0,0,0.03);
  --radius: 12px;
  --input-bg: #ffffff;
  --glass-edge: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] {
  --bg: #0a0504; 
  --bg-glow: rgba(255, 60, 0, 0.04); 
  --surface: rgba(26, 19, 16, 0.55); 
  --surface-2: rgba(38, 28, 24, 0.4);
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 98, 26, 0.15); 
  --text: #fdfaf8;
  --text-2: #c4b5ae;
  --text-3: #8a786f;
  --accent: #ff621a;
  --accent-soft: rgba(255, 98, 26, 0.15);
  --accent-2: #ff9d00;
  --green: #3fb950;
  --green-soft: rgba(46, 160, 67, 0.15);
  --red: #f85149;
  --red-soft: rgba(248, 81, 73, 0.1);
  --input-bg: rgba(15, 10, 8, 0.6);
  --shadow: 0 16px 40px rgba(0,0,0,0.8);
  --glass-edge: rgba(255, 255, 255, 0.08); 
}

/* Base Body (No backgrounds here to prevent scroll lag) */
body {
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* Light Mode Background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 15% 50%, var(--bg-glow), transparent 40%),
    radial-gradient(circle at 85% 30%, var(--bg-glow), transparent 40%);
  background-size: 200% 200%;
  animation: subtleFire 12s ease-in-out infinite alternate;
  pointer-events: none;
}

/* Dark Mode Background Image (Toned Down) */
body[data-theme="dark"]::before {
  background-color: #040201; /* Even darker base */
  background-image: url('../../img/bg-embers.jpg'); 
  background-size: cover;
  background-position: center;
  
  /* The Fix: Dim the image and blur it heavily */
  opacity: 0.15; 
  filter: blur(12px) grayscale(20%); 
  
  /* Scale slightly to hide the messy edges caused by the blur */
  transform: scale(1.05); 
  
  animation: none;
  pointer-events: none;
}

/* Dark Mode Glowing Embers (The Glassmorphism Engine) */
body[data-theme="dark"]::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: 
    radial-gradient(circle at 20% 10%, rgba(255, 81, 0, 0.08), transparent 40vw),
    radial-gradient(circle at 80% 80%, rgba(255, 157, 0, 0.05), transparent 40vw),
    radial-gradient(circle at 50% 50%, rgba(255, 60, 0, 0.04), transparent 60vw);
  animation: emberPulseBg 6s infinite alternate ease-in-out;
  pointer-events: none;
}

@keyframes subtleFire {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

@keyframes emberPulseBg {
  0% { opacity: 0.5; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.05); }
}

@keyframes emberPulse {
  0% { box-shadow: 0 0 8px rgba(255, 81, 0, 0.1); }
  50% { box-shadow: 0 0 18px rgba(255, 81, 0, 0.5); }
  100% { box-shadow: 0 0 8px rgba(255, 81, 0, 0.1); }
}

/* Header */
header {
  background: rgba(15, 10, 8, 0.85); /* Darker to hide scrolling text */
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.2s, border-color 0.2s;
}

body:not([data-theme="dark"]) header {
  background: rgba(255, 255, 255, 0.85);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-text { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.logo-sub { font-size: 12px; color: var(--text-3); font-weight: 400; }

.header-controls { display: flex; align-items: center; gap: 16px; }

.nav-link {
  font-size: 13px; font-weight: 600; color: var(--text-2); text-decoration: none; 
  padding: 6px 12px; border-radius: 6px; transition: all 0.2s;
}

.nav-link:hover, .nav-link.active { background: var(--surface-2); color: var(--accent); }

.theme-toggle {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle:hover { background: var(--surface-2); border-color: var(--accent); transform: scale(1.1) rotate(15deg); }

main { max-width: 1100px; margin: 0 auto; padding: 32px 24px 100px; flex: 1; display: flex; flex-direction: column; width: 100%; }

.bottom-fade {
  position: fixed; bottom: 0; left: 0; width: 100%; height: 80px;
  background: linear-gradient(to top, var(--bg) 10%, transparent); pointer-events: none; z-index: 90;
}

.made-by-tag {
  position: fixed; bottom: 12px; left: 16px; font-size: 11px; color: var(--text-3); z-index: 100;
}

.made-by-tag a { color: var(--accent); text-decoration: none; font-weight: 600; }
.made-by-tag a:hover { text-decoration: underline; }
