/* =====================================
   Web Dev Journey — Style (cleaned)
   Notes:
   - Valid plain CSS (no nested selectors)
   - Theme tokens via html[data-theme="dark|light"]
   - Components use tokens consistently
   ===================================== */

/* =========================
   1) Base tokens (defaults)
   ========================= */
:root{
  /* Legacy / shared tokens (still used in a few places) */
  --bg: #0f1117;
  --text: #e6e6e6;
  --muted: #aab4bf;

  --surface: #161b22;
  --surface-2: #1f2933;

  --border: #2d333b;
  --border-strong: #58a6ff;

  --link: #58a6ff;

  --header: #161b22;
  --footer: #0d1117;

  --btn-bg: #161b22;
  --btn-border: #30363d;

  --primary: #238636;
  --primary-hover: #2ea043;

  /* New “HUD / app” tokens (preferred) */
  --bg-main: #0b0f16;
  --bg-panel: rgba(255,255,255,0.04);
  --text-primary: #e7edf7;
  --text-secondary: rgba(231,237,247,0.75);

  --hud-line: rgba(88,166,255,0.18);
  --hud-glow: rgba(88,166,255,0.22);
  --hud-grid: rgba(255,255,255,0.04);

   /* spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  /* radius scale */
  --r-1: 10px;
  --r-2: 14px;
  --r-3: 18px;

  /* shadow scale */
  --sh-1: 0 8px 18px rgba(0,0,0,0.18);
  --sh-2: 0 10px 30px rgba(0,0,0,0.28);
}

/* =========================
   2) Themes
   ========================= */
html[data-theme="dark"]{
  --bg-main: #0b0f16;
  --bg-panel: rgba(255,255,255,0.04);
  --text-primary: #e7edf7;
  --text-secondary: rgba(231,237,247,0.75);

  --hud-line: rgba(88,166,255,0.18);
  --hud-glow: rgba(88,166,255,0.22);
  --hud-grid: rgba(255,255,255,0.04);

  /* keep legacy tokens aligned */
  --bg: #0f1117;
  --text: #e6e6e6;
  --muted: #aab4bf;
  --surface: #161b22;
  --surface-2: #1f2933;
  --border: #2d333b;
  --border-strong: #58a6ff;
  --link: #58a6ff;
  --header: #161b22;
  --footer: #0d1117;
  --btn-bg: #161b22;
  --btn-border: #30363d;
  --primary: #238636;
  --primary-hover: #2ea043;
}

html[data-theme="light"]{
  --bg-main: #f6f8fb;
  --bg-panel: rgba(255,255,255,0.92);
  --text-primary: #141a24;
  --text-secondary: rgba(20,26,36,0.70);

  --hud-line: rgba(20,26,36,0.14);
  --hud-glow: rgba(88,166,255,0.12);
  --hud-grid: rgba(20,26,36,0.03);

  /* legacy tokens for light */
  --text: #111;
  --muted: #444;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --border: #e5e7eb;
  --border-strong: #2563eb;
  --link: #2563eb;
  --header: #ffffff;
  --footer: #ffffff;
  --btn-bg: #ffffff;
  --btn-border: #d1d5db;
  --primary: #16a34a;
  --primary-hover: #15803d;
}

/* Theme-specific overlays / header/button behavior */
html[data-theme="dark"] body::after{ opacity: 0.35; }
html[data-theme="light"] body::before{ opacity: 0.28; }
html[data-theme="light"] body::after{ opacity: 0.22; }

html[data-theme="dark"] .site-header{
  background: rgba(10,14,20,0.55);
  backdrop-filter: blur(8px);
}
html[data-theme="light"] .site-header{
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
}

html[data-theme="dark"] .btn{ background: rgba(255,255,255,0.05); }
html[data-theme="light"] .btn{ background: rgba(20,26,36,0.04); }

html[data-theme="light"] .card{
  background: var(--bg-panel);
  border: 1px solid rgba(30,41,59,0.08);
  box-shadow: 0 10px 24px rgba(0,0,0,0.05);
}

/* =========================
   3) Reset / base
   ========================= */
*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
html, body{ margin: 0; padding: 0; }

body{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.6;
  background: var(--bg-main);
  color: var(--text-primary);
}

p, li, .muted{ color: var(--text-secondary); }

a{ color: var(--link); }
a:hover{ opacity: 0.9; }

/* Background grid */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, var(--hud-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--hud-grid) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.45;
  z-index: 0;
}

/* Glow */
body::after{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 30% 10%, var(--hud-glow), transparent 55%);
  opacity: 0.6;
  z-index: 0;
}

.site-header, main, footer{ position: relative; z-index: 1; }

/* =========================
   4) Layout helpers
   ========================= */
.container{
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--s-5);
}

.grid{
  width: 100%;
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin-top: var(--s-5);
  align-items: start;
}

/* =========================
   5) Header / navigation
   ========================= */
.site-header{
  border-bottom: 1px solid var(--hud-line);
}

.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 12px 0;
}

.brand{
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  letter-spacing: 0.3px;
  font-size: 1.05rem;
  white-space: nowrap;
}

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

.nav{
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 14px;
  border: 1px solid var(--hud-line);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
}

.nav a{
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 650;
  opacity: 0.9;
  transition: color 140ms ease, opacity 140ms ease;
}

.nav a:hover{
  color: var(--link);
  opacity: 1;
}

.header-actions{
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Right-side buttons */
.theme-toggle,
.nav-toggle{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

.theme-toggle{
  border-radius: 50%;
  transition: all 0.25s ease;
  position: relative; /* needed for ::after */
}
.theme-toggle:hover{
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(88, 166, 255, 0.25);
}
.theme-toggle:active{ transform: scale(0.95); }

.theme-toggle::after{
  content:"";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

/* Mobile nav */
.nav-toggle{ display: none; }

@media (max-width: 980px){
  .featured-card{ grid-column: span 2; }
}

@media (max-width: 720px){
  .header-controls{
    gap: 10px;
  }

  .nav-toggle{
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .nav{ display: none; }

  .nav.is-open{
    display: flex;
    position: absolute;
    left: 4%;
    right: 4%;
    top: 64px;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(0,0,0,0.35);
    z-index: 50;
    padding: 14px;
  }

  .nav.is-open a{
    padding: 10px 10px;
    border-radius: 12px;
    background: var(--surface-2);
  }

  .header-actions{
    gap: 8px;
  }

  /* floating theme toggle */
  .theme-toggle{
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 60;
  }

    .header-inner{
    min-height: 64px;
    padding: 10px 0;
  }

  .brand{
    font-size: 0.98rem;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero{
    padding: 64px 0 40px;
  }

  .hero h1{
    max-width: none;
  }

  .hero-actions{
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn{
    width: 100%;
  }

 .card-actions{
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

  .back-to-top{
    right: 14px;
    bottom: 14px;
  }

  .project-head{
    align-items: flex-start;
  }

  .project-stats{
    flex-direction: column;
    align-items: stretch;
  }

  .project-stat{
    width: 100%;
  }
}


/* =========================
   6) Hero
   ========================= */
.hero{
  padding: 88px 0 56px;
  border-bottom: 1px solid var(--hud-line);
  position: relative;
}

.hero::after{
  content:"";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background: radial-gradient(circle at 20% 20%, var(--hud-glow), transparent 55%);
  opacity: 0.35;
}

.hero h1{
  margin: 0 0 14px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: 0.2px;
  max-width: 12ch;
}

.subtitle{
  margin: 0 0 20px;
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 62ch;
}

.hero-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
}

.hero-meta li{
  padding: 6px 12px;
  border: 1px solid var(--hud-line);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  font-size: 0.95rem;
}

/* =========================
   7) Buttons
   ========================= */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: var(--r-1);
  border: 1px solid var(--hud-line);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.btn:hover{
  background: var(--btn-bg);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.22);
  border-color: var(--hud-line);
}

.btn.primary{
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn.primary:hover{
  background: var(--primary-hover);
}

.btn.secondary{
  background: transparent;
  border: 1px solid var(--hud-line);
}

.btn.secondary:hover{
  background: var(--btn-bg);
}

.btn.small{
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.95rem;
}

.btn.icon{
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--hud-line);
  background: rgba(255,255,255,0.03);
}

/* =========================
   8) Sections / titles
   ========================= */
.section{
  margin-top: 60px;
  padding: var(--s-7) 0;
}
.section h2{ margin-top: 0; }

.section-title{
  position: relative;
  padding-left: 12px;
}
.section-title::before{
  content:"";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 14px;
  background: var(--hud-line);
  border-radius: 2px;
}
.section-title::after{
  content:"";
  display: block;
  margin-top: 10px;
  height: 1px;
  opacity: 0.9;
  background: linear-gradient(90deg, var(--hud-line), transparent 70%);
}
.badge.featured{
  border-color: var(--border-strong);
  color: var(--border-strong);
}
/* =========================
   9) Cards / tags
   ========================= */

.card{
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  background: var(--bg-panel);
  border: 1px solid var(--hud-line);
  border-radius: var(--r-2);
  align-self: start;
}


.card p{
  margin-top: 10px;
  margin-bottom: 0;
}

.card h3{
  margin-top: 0;
  margin-bottom: 8px;
  position: relative;
  padding-left: 12px;
  transition: color 160ms ease;
}
.card:hover h3{ color: var(--accent, #58a6ff); }

.card h3::before{
  content:"";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 14px;
  background: var(--hud-line);
  border-radius: 2px;
  opacity: 0.9;
}

.card::before{
  content:"";
  position: absolute;
  inset: 0;
  border: 1px solid var(--hud-line);
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 160ms ease, transform 260ms ease;
}

.card::after{
  content:"";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--hud-glow), transparent 60%);
  opacity: 0.35;
  pointer-events: none;
  transition: opacity 160ms ease, transform 260ms ease;
}

.card:hover{
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 18px 40px rgba(0,0,0,0.28);
}
.card:hover::before{ opacity: 0.9; }
.card:hover::after{ opacity: 0.65;
  transform: translate(-6px, 6px);
}

.card-actions{
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

.card .corner{
  display: none;
}

.tags{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag{
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.badge{
  display: inline-block;
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  vertical-align: middle;
}

/* =========================
   10) Footer + to-top
   ========================= */
.site-footer{
  border-top: 1px solid var(--border);
  padding: 24px 0;
  background: var(--footer);
}

.footer-inner{
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

.back-to-top{
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 900;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  z-index: 70;
}

.back-to-top:hover{
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
}

/* =========================
   11) Game Lab
   ========================= */

   .featured-card{
  border-color: var(--border-strong);
  box-shadow: 0 14px 34px rgba(88,166,255,0.14);
  background:
    linear-gradient(135deg, rgba(88,166,255,0.12), transparent 42%),
    var(--bg-panel);
}

.featured-card::before{
  opacity: 0.95;
}

.featured-card::after{
  opacity: 0.75;
}

.featured-card:hover{
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(88,166,255,0.18);
}

.project-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.project-spotlight{
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(88,166,255,0.28);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(88,166,255,0.16), rgba(88,166,255,0.04));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.spotlight-label{
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(11,15,22,0.45);
  border: 1px solid rgba(88,166,255,0.3);
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.spotlight-copy{
  margin: 10px 0 0;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.6;
}

.project-kicker{
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--border-strong);
}

.project-lead{
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 14px;
  max-width: 62ch;
}

.project-highlights{
  margin: 0 0 16px;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.project-highlights li{
  color: var(--text-secondary);
}

.project-stats{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.project-stat{
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--hud-line);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 650;
}

.project-stat.accent{
  border-color: rgba(88,166,255,0.34);
  background: rgba(88,166,255,0.14);
  color: var(--text-primary);
}

.badge.featured{
  border-color: var(--border-strong);
  color: var(--border-strong);
  background: rgba(88,166,255,0.08);
}

html[data-theme="light"] .project-spotlight{
  background: linear-gradient(135deg, rgba(37,99,235,0.14), rgba(37,99,235,0.05));
  border-color: rgba(37,99,235,0.18);
}

html[data-theme="light"] .spotlight-label{
  background: rgba(255,255,255,0.72);
}
