:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --primary: #f59e0b;
  --primary-dark: #d97706;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --card-bg: #fff;
  --nav-bg: #253a55;
  --nav-text: #fff;
  --hero-bg: linear-gradient(135deg, #1a2d48 0%, #253a55 60%, #3a5270 100%);
  --footer-bg: #1a2d48;
  --footer-text: #94a3b8;
  --tag-bg: #fff8e1;
  --tag-text: #b45309;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg: #0b0f1a;
  --surface: #131929;
  --primary: #fbbf24;
  --primary-dark: #f59e0b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #1e2d4a;
  --card-bg: #131929;
  --nav-bg: #0d1828;
  --nav-text: #f1f5f9;
  --hero-bg: linear-gradient(135deg, #0d1828 0%, #1a2d48 60%, #243545 100%);
  --footer-bg: #0d1828;
  --footer-text: #64748b;
  --tag-bg: #2d1f00;
  --tag-text: #fbbf24;
  --shadow: 0 2px 12px rgba(0,0,0,0.5);
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
  line-height: 1.7;
}

/* NAV */
nav {
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--nav-text);
  text-decoration: none;
}

.nav-brand svg { width: 36px; height: 36px; }

.nav-links {
  display: flex;
  gap: 1.8rem;
  align-items: center;
  list-style: none;
}

.nav-links a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
  position: relative;
  padding-bottom: 4px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.nav-links a:hover { color: #fff; }
.nav-links a.active { color: #fff; }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }

.theme-toggle {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 50px;
  padding: 0.35rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s;
}

.theme-toggle:hover { background: rgba(255,255,255,0.25); }

/* HERO */
.hero {
  background: var(--hero-bg);
  color: #fff;
  padding: 4rem 2rem;
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 3rem;
}

.hero-text { flex: 1; }

.hero-terminal {
  flex: 1;
  min-width: 0;
}

.hero-terminal .terminal-window {
  box-shadow: 0 0 40px rgba(245,158,11,0.12), 0 24px 60px rgba(0,0,0,0.55);
}

.hero h1 { font-size: 2.8rem; font-weight: 800; margin-bottom: 1rem; }
.hero p  { font-size: 1.15rem; margin: 0 0 2rem; opacity: 0.9; }

.btn {
  display: inline-block;
  background: #fff;
  color: var(--primary-dark);
  padding: 0.75rem 2rem;
  border-radius: 50px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }

/* SECTIONS */
.section { padding: 4rem 2rem; max-width: 1100px; margin: 0 auto; }
.section-title {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.section-subtitle { color: var(--text-muted); margin-bottom: 2.5rem; font-size: 1rem; }

/* CARDS */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 1.5rem; }

a.card { text-decoration: none; color: inherit; display: block; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover { transform: translateY(-4px); box-shadow: 0 8px 28px rgba(245,158,11,0.18); }
.card-icon { margin-bottom: 1rem; }
.card-icon svg { width: 48px; height: 48px; }
.card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text); }
.card p { color: var(--text-muted); font-size: 0.92rem; }

.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.7rem;
  border-radius: 50px;
  margin-top: 0.8rem;
}

/* PROJECTS PAGE */
.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  transition: transform 0.2s;
}

.project-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(245,158,11,0.15); }
.project-card svg { flex-shrink: 0; width: 72px; height: 72px; }
.project-card h3 { font-size: 1.25rem; margin-bottom: 0.4rem; }
.project-card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 0.6rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ABOUT */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

.about-text p { color: var(--text-muted); margin-bottom: 1rem; }
.about-img { display: flex; justify-content: center; }
.about-img svg { width: 260px; height: 260px; }

.values { list-style: none; margin-top: 1rem; }
.values li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.values li::before { content: "✦"; color: var(--primary); font-size: 0.8rem; }

/* OSS BANNER */
.oss-banner {
  background: var(--hero-bg);
  color: #fff;
  text-align: center;
  padding: 3.5rem 2rem;
}
.oss-banner h2 { font-size: 1.8rem; margin-bottom: 0.8rem; }
.oss-banner p { opacity: 0.9; max-width: 560px; margin: 0 auto 1.5rem; }

/* FOOTER */
footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  padding: 2rem;
  font-size: 0.88rem;
}
footer a { color: var(--primary); text-decoration: none; }

/* BLOG LISTING */
.blog-posts { display: flex; flex-direction: column; gap: 1.5rem; }

.blog-post-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.blog-post-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }

.blog-post-meta { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.blog-date { color: var(--text-muted); font-size: 0.85rem; }

.blog-post-card h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.blog-post-card h3 a { color: var(--text); text-decoration: none; }
.blog-post-card h3 a:hover { color: var(--primary); }
.blog-post-card > p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1rem; }

.read-more { color: var(--primary); font-weight: 600; text-decoration: none; font-size: 0.9rem; }
.read-more:hover { text-decoration: underline; }

/* BLOG POST PAGE */
.post-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.post-back:hover { text-decoration: underline; }

.post-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.post-header h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.75rem; line-height: 1.3; }
.post-meta { display: flex; align-items: center; gap: 1rem; color: var(--text-muted); font-size: 0.9rem; }

.post-content h2 { font-size: 1.4rem; font-weight: 700; margin: 2rem 0 0.75rem; color: var(--text); }
.post-content h3 { font-size: 1.15rem; font-weight: 700; margin: 1.5rem 0 0.5rem; color: var(--text); }
.post-content p { color: var(--text-muted); margin-bottom: 1rem; line-height: 1.8; }
.post-content ul, .post-content ol { color: var(--text-muted); padding-left: 1.5rem; margin-bottom: 1rem; }
.post-content li { margin-bottom: 0.4rem; line-height: 1.7; }

.post-content pre {
  background: #0d1117;
  color: #c9d1d9;
  padding: 1.25rem 1.5rem;
  border-radius: 10px;
  overflow-x: auto;
  margin: 1.25rem 0;
  font-size: 0.88rem;
  line-height: 1.6;
  border: 1px solid #30363d;
}
.post-content code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.88em;
  color: var(--primary);
}
.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: #c9d1d9;
  font-size: inherit;
}

/* PAGE VISIBILITY */
.page { display: none; }
.page.active {
  display: block;
  animation: pageFadeIn 0.4s ease both;
}

/* HAMBURGER */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  z-index: 200;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* RESPONSIVE */
@media (max-width: 768px) {
  .hamburger { display: flex; }

  .nav-links {
    display: none;
    flex-direction: column;
    gap: 0;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    padding: 0.5rem 0 1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .theme-toggle { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

  .hero { padding: 2.5rem 1.25rem; }
  .hero-inner { flex-direction: column; gap: 2rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 1rem; }

  .section { padding: 2.5rem 1.25rem; }
  .section-title { font-size: 1.5rem; }

  .cards { grid-template-columns: 1fr; }

  .project-card { flex-direction: column; padding: 1.25rem; gap: 1rem; }
  .project-card svg { width: 52px; height: 52px; }

  .about-grid { grid-template-columns: 1fr; }
  .about-img { order: -1; }
  .about-img img { width: 180px; height: 180px; }

  .oss-banner { padding: 2.5rem 1.25rem; }
  .oss-banner h2 { font-size: 1.4rem; }
  .oss-banner img { width: 100%; max-width: 220px; }

  footer { padding: 1.5rem 1rem; font-size: 0.82rem; }

  .blog-post-card { padding: 1.25rem; }
  .post-header h1 { font-size: 1.5rem; }
}

@media (max-width: 400px) {
  .hero h1 { font-size: 1.5rem; }
  .nav-brand { font-size: 1.1rem; }
}

/* ANIMATIONS */
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes revealUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* TERMINAL ANIMATION */

.terminal-window {
  background: #0d1117;
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  overflow: hidden;
  border: 1px solid #30363d;
}

.terminal-titlebar {
  background: #161b22;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid #30363d;
}

.term-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.term-dot-red    { background: #ff5f57; }
.term-dot-yellow { background: #febc2e; }
.term-dot-green  { background: #28c840; }

.terminal-titlebar-text {
  color: #8b949e;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.78rem;
  margin-left: 0.4rem;
}

.terminal-body {
  padding: 1.25rem 1.5rem;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.8;
  color: #c9d1d9;
  height: 220px;
  overflow: hidden;
}

.term-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0; }
.term-user   { color: #58a6ff; }
.term-at     { color: #8b949e; }
.term-host   { color: #f59e0b; }
.term-path   { color: #c9d1d9; }
.term-dollar { color: #8b949e; margin-right: 0.5rem; }
.term-cmd    { color: #e2e8f0; }
.term-out    { color: #8b949e; }
.term-out-green { color: #4ade80; }

.term-cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: #c9d1d9;
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: termBlink 1s step-end infinite;
}

@keyframes termBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@media (max-width: 768px) {
  .terminal-body { font-size: 0.75rem; height: 180px; overflow: hidden; padding: 1rem; }
}

/* SCROLL REVEAL */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}
