/* ─── FONTS ─── */
@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/space-grotesk-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/space-grotesk-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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


:root {
  --bg:        #edf7f4;
  --bg2:       #ddf0ea;
  --surface:   #ffffff;
  --green-lt:  #a8ddd1;
  --green-md:  #6ec9b4;
  --green-dk:  #2e9e84;
  --text:      #1a2e2a;
  --text-muted:#4a6b62;
  --mono:      'JetBrains Mono', monospace;
  --sans:      'Space Grotesk', sans-serif;
  --radius:    16px;
  --card-shadow: 0 8px 32px rgba(46,158,132,0.1);
  --footer-bg: #1a2e2a;
  --nav-bg:    rgba(237, 247, 244, 0.85);
}

[data-theme="dark"] {
  --bg:        #0d1110;
  --bg2:       #1a1f1e;
  --surface:   #151918;
  --green-lt:  #2d4a44;
  --green-md:  #3db89d;
  --green-dk:  #6ec9b4;
  --text:      #e0f2f0;
  --text-muted:#a3c2ba;
  --card-shadow: 0 8px 32px rgba(0,0,0,0.3);
  --footer-bg: #050706;
  --nav-bg:    rgba(13, 17, 16, 0.85);
}

/* SEO: Specific icon fixes for dark mode */
[data-theme="dark"] .skill-card img[alt="Perl"],
[data-theme="dark"] .skill-card img[alt="Rust"],
[data-theme="dark"] .skill-card img[alt="HTML/CSS"],
[data-theme="dark"] .skill-card img[alt="ChatGPT"],
[data-theme="dark"] .skill-card img[alt="Wireless/IoT"],
[data-theme="dark"] .contact-link-item img[src*="github-icon"] {
  filter: invert(1) brightness(1.5);
}


html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ─── NAV ─── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 48px;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(110,201,180,0.2);
}

.theme-toggle {
  background: var(--bg2);
  border: 1px solid rgba(110,201,180,0.3);
  color: var(--green-dk);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
  margin-left: 20px;
}

.theme-toggle:hover {
  background: var(--green-lt);
  transform: translateY(-1px);
}

.nav-logo { font-family: var(--mono); font-size: 14px; color: var(--green-dk); font-weight: 500; }
.nav-links { display: flex; gap: 32px; list-style: none; }
.nav-links a { text-decoration: none; color: var(--text-muted); font-size: 14px; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--green-dk); }

/* ─── SECTION BASE ─── */
section { padding: 96px 48px; }
.section-inner { max-width: 960px; margin: 0 auto; }
.section-label {
  font-family: var(--mono); font-size: 13px; color: var(--green-dk);
  margin-bottom: 16px; opacity: 0.8; letter-spacing: 0.02em;
}
.section-title {
  font-size: clamp(28px, 4vw, 40px); font-weight: 700; line-height: 1.15;
  margin-bottom: 24px;
}

/* ─── HERO ─── */
#hero {
  min-height: 100vh; display: flex; align-items: center;
  padding-top: 96px;
  padding-left: 48px; padding-right: 48px;
  background: var(--bg);
  position: relative; overflow: hidden;
}
.hero-grid {
  position: absolute; inset: 0; opacity: 0.06;
  background-image: linear-gradient(var(--green-dk) 1px, transparent 1px),
                    linear-gradient(90deg, var(--green-dk) 1px, transparent 1px);
  background-size: 40px 40px;
}
.hero-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto; gap: 64px; align-items: center;
  position: relative; z-index: 1; width: 100%;
}
.hero-eyebrow { font-family: var(--mono); font-size: 13px; color: var(--green-dk); margin-bottom: 20px; }
.hero-name {
  font-size: clamp(48px, 7vw, 80px); font-weight: 700; line-height: 1.05;
  letter-spacing: -0.03em; margin-bottom: 16px;
}
.hero-name span { color: var(--green-dk); }
.hero-title {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 600;
  color: var(--green-dk);
  margin-bottom: 12px;
  font-family: var(--mono);
  letter-spacing: -0.01em;
}
.hero-tagline {
  font-size: clamp(17px, 2vw, 21px); color: var(--text-muted); max-width: 480px;
  margin-bottom: 40px; font-weight: 400;
  text-wrap: pretty;
}
.hero-cta-row { display: flex; gap: 16px; flex-wrap: wrap; }
.btn-primary {
  background: var(--green-dk); color: #fff;
  padding: 14px 28px; border-radius: 10px;
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  text-decoration: none; border: none; cursor: pointer;
  transition: background .2s, transform .15s;
  display: inline-block;
}
.btn-primary:hover { background: #1e7a63; transform: translateY(-1px); }
.btn-secondary {
  background: transparent; color: var(--green-dk);
  padding: 14px 28px; border-radius: 10px;
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  text-decoration: none; border: 2px solid var(--green-md);
  cursor: pointer; transition: background .2s, transform .15s;
  display: inline-block;
}
.btn-secondary:hover { background: var(--bg2); transform: translateY(-1px); }

/* Avatar */
.avatar-wrap { flex-shrink: 0; }
.avatar-placeholder {
  width: 240px; height: 280px;
  border-radius: 20px;
  border: 2px dashed rgba(46,158,132,0.35);
  background: var(--bg2);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; color: var(--text-muted);
  font-family: var(--mono); font-size: 12px;
  text-align: center; padding: 20px;
}
.avatar-placeholder-icon { font-size: 48px; opacity: 0.4; }
.avatar-svg { width: 240px; height: 280px; border-radius: 20px; display: block; }

/* ─── TIMELINE ─── */
.timeline { display: flex; flex-direction: column; gap: 0; margin-top: 8px; }
.tl-item { display: grid; grid-template-columns: 14px 1fr; gap: 16px; padding-bottom: 24px; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-line { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--green-dk); flex-shrink: 0; margin-top: 4px; }
.tl-connector { flex: 1; width: 2px; background: linear-gradient(to bottom, var(--green-md), transparent); margin-top: 4px; min-height: 20px; }
.tl-item:last-child .tl-connector { display: none; }
.tl-year { font-family: var(--mono); font-size: 11px; color: var(--green-dk); margin-bottom: 2px; }
.tl-title { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.tl-sub { font-size: 13px; color: var(--text-muted); }

/* ─── ABOUT ─── */
#about { background: var(--bg2); }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.about-text p { color: var(--text-muted); margin-bottom: 16px; text-wrap: pretty; }
.about-text p:last-child { margin-bottom: 0; }
.about-highlight {
  background: var(--surface); border-radius: var(--radius);
  padding: 28px; border: 1px solid rgba(110,201,180,0.3);
}
.about-highlight .code-comment { font-family: var(--mono); font-size: 13px; color: var(--green-dk); margin-bottom: 12px; }
.about-stat { display: flex; flex-direction: column; margin-bottom: 20px; }
.about-stat:last-child { margin-bottom: 0; }
.about-stat-label { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.about-stat-value { font-size: 18px; font-weight: 600; }

/* ─── SKILLS ─── */
#skills { background: var(--bg); }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-top: 40px; }
.skill-card {
  background: var(--surface); border-radius: 12px;
  padding: 20px 22px; border: 1px solid rgba(110,201,180,0.25);
  transition: transform .2s, box-shadow .2s, border-color .2s;
  cursor: default;
}
.skill-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(46,158,132,0.12);
  border-color: var(--green-md);
}
.skill-icon { font-size: 32px; margin-bottom: 10px; display: block; line-height: 1; }
.skill-icon.colored { /* devicon colored */ }
.skill-lang { font-family: var(--mono); font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.skill-level { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.skill-dot-row { display: flex; gap: 4px; margin-top: 10px; }
.skill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bg2); }
.skill-dot.filled { background: var(--green-dk); }
.skills-category { font-family: var(--mono); font-size: 12px; color: var(--green-dk); margin-top: 36px; margin-bottom: 12px; opacity: 0.8; }
.skills-category:first-child { margin-top: 0; }

/* ─── TEACHING ─── */
#teaching { background: var(--bg2); }
.teaching-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 40px; }
.teaching-card {
  background: var(--surface); border-radius: var(--radius); padding: 28px;
  border: 1px solid rgba(110,201,180,0.25);
  transition: box-shadow .2s;
}
.teaching-card:hover { box-shadow: 0 8px 32px rgba(46,158,132,0.1); }
.teaching-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.teaching-card p { color: var(--text-muted); font-size: 15px; text-wrap: pretty; }
.teaching-tag {
  display: inline-block; background: var(--bg2);
  font-family: var(--mono); font-size: 12px; color: var(--green-dk);
  padding: 4px 10px; border-radius: 6px; margin-top: 14px;
}

/* ─── FUN FACTS ─── */
#facts { background: var(--bg); }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 40px; }
.fact-card {
  background: var(--surface); border-radius: 14px; padding: 22px;
  border: 1px solid rgba(110,201,180,0.2);
  transition: transform .2s, border-color .2s;
}
.fact-card:hover { transform: translateY(-2px); border-color: var(--green-md); }
.fact-icon { font-size: 28px; margin-bottom: 10px; display: block; }
.fact-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.fact-desc { font-size: 13px; color: var(--text-muted); }

/* ─── TESTIMONIALS ─── */
#testimonials { background: var(--bg2); }
.testi-carousel { margin-top: 40px; position: relative; }
.testi-track-wrap { overflow: hidden; }
.testi-track {
  display: flex; gap: 20px;
  transition: transform .4s cubic-bezier(.4,0,.2,1);
}
.testi-card {
  background: var(--surface); border-radius: var(--radius); padding: 28px;
  border: 1px solid rgba(110,201,180,0.2);
  position: relative; flex: 0 0 calc(33.333% - 14px);
  min-width: 0;
}
@media (max-width: 900px) { .testi-card { flex: 0 0 calc(50% - 10px); } }
@media (max-width: 600px) { .testi-card { flex: 0 0 100%; } }
.testi-quote { font-size: 40px; font-family: Georgia, serif; color: var(--green-lt); position: absolute; top: 16px; right: 20px; line-height: 1; }
.testi-text { font-size: 15px; color: var(--text-muted); margin-bottom: 18px; font-style: italic; text-wrap: pretty; }
.testi-name { font-weight: 600; font-size: 14px; }
.testi-role { font-family: var(--mono); font-size: 12px; color: var(--green-dk); }
.testi-nav { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.testi-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid rgba(110,201,180,0.4); background: var(--surface);
  cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: background .2s, border-color .2s;
  color: var(--green-dk);
}
.testi-btn:hover { background: var(--green-dk); color: #fff; border-color: var(--green-dk); }
.testi-btn:disabled { opacity: 0.3; cursor: default; }
.testi-dots { display: flex; gap: 6px; }
.testi-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-lt); cursor: pointer; transition: background .2s, transform .2s; border: none; padding: 0; }
.testi-dot.active { background: var(--green-dk); transform: scale(1.3); }
.testi-count { font-family: var(--mono); font-size: 12px; color: var(--text-muted); margin-left: 4px; }

/* ─── CONTACT ─── */
#contact { background: var(--bg); }
.contact-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
.contact-form { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group textarea {
  font-family: var(--sans); font-size: 15px;
  background: var(--surface); border: 1.5px solid rgba(110,201,180,0.35);
  border-radius: 10px; padding: 12px 16px; color: var(--text);
  transition: border-color .2s, box-shadow .2s; outline: none;
  resize: vertical;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--green-md);
  box-shadow: 0 0 0 3px rgba(110,201,180,0.2);
}
.form-group textarea { min-height: 120px; }
.contact-links { display: flex; flex-direction: column; gap: 16px; margin-top: 40px; }
.contact-link-item {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--text);
  padding: 16px 20px; background: var(--surface);
  border-radius: 12px; border: 1px solid rgba(110,201,180,0.25);
  transition: border-color .2s, transform .2s;
}
.contact-link-item:hover { border-color: var(--green-md); transform: translateX(4px); }
.contact-link-icon { font-size: 20px; width: 32px; text-align: center; }
.contact-link-label { font-size: 14px; font-weight: 600; }
.contact-link-value { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }

/* ─── FOOTER ─── */
footer {
  background: var(--footer-bg); color: rgba(255,255,255,0.5);
  padding: 32px 48px; text-align: center;
  font-family: var(--mono); font-size: 13px;
}
footer span { color: var(--green-lt); }

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-inner > * { animation: fadeUp .6s ease both; }
.hero-inner > *:nth-child(2) { animation-delay: .1s; }

/* ─── RESPONSIVE ─── */
@media (max-width: 800px) {
  nav { 
    padding: 12px 20px; 
    justify-content: space-between;
    flex-wrap: nowrap;
  }
  .nav-links { display: none; }
  .nav-logo { font-size: 13px; }
  .theme-toggle { 
    margin-left: auto; 
    width: 32px; 
    height: 32px; 
    font-size: 14px;
    border-radius: 8px;
  }
  section, #hero { padding-left: 20px; padding-right: 20px; }
  #hero { padding-top: 60px; padding-bottom: 40px; min-height: auto; }
  .hero-inner { grid-template-columns: 1fr; gap: 24px; }
  .hero-name { margin-bottom: 12px; }
  .hero-title { margin-bottom: 8px; }
  .hero-tagline { margin-bottom: 24px; }
  .avatar-wrap { order: -1; display: flex; justify-content: center; transform: scale(0.9); }
  .about-grid, .contact-layout, .teaching-grid { grid-template-columns: 1fr; }
  .testi-grid { grid-template-columns: 1fr; }
}
