:root {
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-soft: #eff6ff;
  --ink: #0f172a;
  --muted: #64748b;
  --page: #f8fafc;
  --surface: #ffffff;
  --soft: #f1f5f9;
  --line: #e2e8f0;
  --shadow: 0 10px 30px -4px rgba(15, 23, 42, 0.06);
  --radius: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body {
  background: var(--page);
  color: var(--ink);
  font: 15px/1.65 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-align: left;
  transition: background 0.25s ease, color 0.25s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; transition: all 0.2s ease; }
a:hover { color: var(--blue-hover); }
button, input, textarea { font: inherit; }
img { max-width: 100%; height: auto; }

#content {
  width: min(1200px, calc(100% - 36px));
  margin: 0 auto;
  flex: 1;
}

/* Navbar */
#sg-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 0;
  margin-bottom: 28px;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background 0.25s, border-color 0.25s;
}
.nav-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  white-space: nowrap;
}
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}
.brand-title-wrap h1 {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand-title-wrap p {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--blue-soft);
  color: var(--blue);
}
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s;
}
.icon-button svg { width: 19px; height: 19px; }
.icon-button:hover {
  border-color: #93c5fd;
  color: var(--blue);
  transform: translateY(-1px);
}
.mobile-menu-button { display: none; }

/* Sections & Headings */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.section-eyebrow {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.section-title {
  color: var(--ink);
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: 850;
  letter-spacing: -0.025em;
  line-height: 1.25;
}
.section-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

/* Grids & Cards */
.top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 48px;
}
.latest-panel, .about-card, .project-card, .contact-panel, .card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.latest-panel {
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.latest-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.latest-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}
.latest-label span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.featured-post {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(180px, 0.8fr);
  gap: 22px;
  align-items: center;
}
.post-date { color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.featured-title {
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: 850;
  margin-bottom: 10px;
}
.featured-title a { color: var(--ink); }
.featured-title a:hover { color: var(--blue); }
.featured-excerpt {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
  margin-bottom: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.primary-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--blue);
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  border: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}
.primary-link:hover {
  background: var(--blue-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}
.featured-media {
  display: flex;
  overflow: hidden;
  border-radius: 14px;
  background: var(--soft);
  height: 100%;
  max-height: 220px;
}
.about-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.about-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.about-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--blue-soft);
  border: 2px solid #bfdbfe;
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 900;
}
.about-name { font-size: 17px; font-weight: 850; color: var(--ink); }
.about-role { font-size: 12px; font-weight: 600; color: var(--muted); }
.about-description { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }
.about-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.about-meta svg { width: 16px; height: 16px; color: var(--blue); }
.about-actions { display: flex; gap: 8px; }
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.secondary-link:hover { border-color: var(--blue); color: var(--blue); }

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
  margin-bottom: 48px;
}
.project-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s ease;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: #bfdbfe;
  box-shadow: 0 14px 30px -4px rgba(37, 99, 235, 0.12);
}
.project-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: 20px;
  margin-bottom: 16px;
}
.project-title { font-size: 18px; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.project-desc { font-size: 13.5px; color: var(--muted); line-height: 1.6; margin-bottom: 16px; }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.project-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 22px;
  margin-bottom: 48px;
}
.contact-panel { padding: 26px; }
.contact-list { display: grid; gap: 12px; margin-top: 16px; }
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.contact-item:hover { border-color: #bfdbfe; }
.contact-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
}
.contact-label { display: block; font-size: 11px; color: var(--muted); }
.contact-value { display: block; font-size: 13px; font-weight: 750; color: var(--ink); }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.form-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--blue); background: var(--surface); }

/* Resume Profile Specifics */
.resume-container {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  margin-bottom: 50px;
}
.card { padding: 28px; margin-bottom: 24px; }
.card-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.info-list { display: grid; gap: 12px; font-size: 13.5px; }
.info-item { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.info-label { color: var(--muted); }
.info-val { font-weight: 700; color: var(--ink); }
.timeline-item {
  position: relative;
  padding-left: 20px;
  border-left: 2px solid var(--blue);
  margin-bottom: 20px;
}
.timeline-year { font-size: 12px; font-weight: 700; color: var(--blue); }
.timeline-title { font-size: 16px; font-weight: 800; color: var(--ink); margin-top: 2px; }
.timeline-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.skills-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

/* Footer */
#sg-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 30px 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { font-size: 13px; font-weight: 600; color: var(--muted); }
.footer-links a:hover { color: var(--blue); }
.footer-copy { font-size: 12px; color: var(--muted); }

/* Dark Mode */
body.sg-dark {
  --ink: #f8fafc;
  --muted: #94a3b8;
  --page: #020617;
  --surface: #0f172a;
  --soft: #1e293b;
  --line: #1e293b;
  --blue-soft: rgba(37, 99, 235, 0.14);
  --shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.4);
}
body.sg-dark #sg-navbar { background: rgba(2, 6, 23, 0.85); }
body.sg-dark .nav-links a { color: #cbd5e1; }
body.sg-dark .nav-links a:hover, body.sg-dark .nav-links a.active { color: #60a5fa; background: var(--blue-soft); }
body.sg-dark .brand-title-wrap h1 { color: #f8fafc; }
body.sg-dark .featured-title a, body.sg-dark .project-title { color: #f8fafc; }

@media (max-width: 900px) {
  .top-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .resume-container { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .mobile-menu-button { display: grid; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .featured-post { grid-template-columns: 1fr; }
  .featured-media { order: -1; max-height: 200px; }
}
@media print {
  #sg-navbar, #sg-footer, .print-btn-wrap { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}