:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --header-bg: rgba(248, 250, 252, 0.86);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 16px;
  --header-height: 68px;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-alt: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #1e293b;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --header-bg: rgba(11, 17, 32, 0.86);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.15em 0.4em;
  border-radius: 6px;
}

.container {
  width: min(1080px, 100% - 2rem);
  margin-inline: auto;
}

/* Sticky Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  transition: color 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Theme icons */
.theme-icon-sun {
  display: none;
}
[data-theme="dark"] .theme-icon-sun {
  display: inline;
}
[data-theme="dark"] .theme-icon-moon {
  display: none;
}

/* Hamburger button (hidden on desktop) */
.menu-toggle {
  display: none;
}

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 18px;
  height: 13px;
}

.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle[aria-expanded="true"] .hamburger span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .hamburger span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .hamburger span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* Sections */
.section {
  padding: 3.25rem 0;
  scroll-margin-top: calc(var(--header-height) + 12px);
}

.hero-section {
  padding-top: 2.5rem;
}

.section-header {
  margin-bottom: 1.75rem;
}

.section-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.section-header p {
  margin: 0;
  color: var(--text-muted);
}

.section-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Hero Card */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.25rem;
  box-shadow: var(--shadow);
}

.hero-identity {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.avatar {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.65rem;
}

.hero-heading h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.75rem, 3.2vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.subtitle {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-muted);
}

.about-body {
  padding-top: 1.5rem;
}

.about-body h2 {
  margin: 0 0 0.6rem;
  font-size: 1.25rem;
}

.about-body p {
  margin: 0 0 1.35rem;
  color: var(--text-muted);
  max-width: 68ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.15rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

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

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Grid & Cards */
.grid {
  display: grid;
  gap: 1.15rem;
}

.cards-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.card-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}

.card h3 {
  margin: 0.15rem 0 0;
  font-size: 1.1rem;
  line-height: 1.3;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

/* Project Cards */
.project-meta {
  margin-top: auto;
  padding-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.project-lang {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--text);
}

.lang-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

/* Network Detective Cards */
.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.25rem;
  color: var(--accent);
  line-height: 1.25;
}

.metric-note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Contact Cards */
.contact-card {
  color: inherit;
  text-decoration: none;
}

.contact-card:hover {
  text-decoration: none;
}

.contact-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.contact-value {
  font-size: 1.05rem;
  color: var(--text);
  word-break: break-word;
}

.contact-action {
  margin-top: auto;
  padding-top: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-inner p {
  margin: 0;
}

/* Tablet */
@media (max-width: 960px) {
  .cards-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phone */
@media (max-width: 768px) {
  .menu-toggle {
    display: inline-flex;
  }

  .brand {
    font-size: 0.98rem;
    max-width: calc(100vw - 128px);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Dropdown sits cleanly below the sticky header so it never covers the title */
  .site-nav {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem 1rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 999;
  }

  .site-nav.is-open {
    display: flex;
  }

  .nav-link {
    padding: 0.65rem 0.85rem;
    font-size: 1rem;
  }

  .hero-card {
    padding: 1.4rem;
  }

  .hero-identity {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .avatar {
    width: 104px;
    height: 104px;
  }

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