:root {
  color-scheme: light dark;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-muted: #eef2f7;
  --text: #0f172a;
  --text-muted: #475569;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --border: #dbe2ea;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1c;
    --surface: #121a2a;
    --surface-muted: #1a2438;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #60a5fa;
    --primary-strong: #3b82f6;
    --border: #23324f;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

html[data-theme="light"] {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-muted: #eef2f7;
  --text: #0f172a;
  --text-muted: #475569;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --border: #dbe2ea;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] {
  --bg: #0a0f1c;
  --surface: #121a2a;
  --surface-muted: #1a2438;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #60a5fa;
  --primary-strong: #3b82f6;
  --border: #23324f;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at top, var(--surface-muted), var(--bg) 45%);
  color: var(--text);
  line-height: 1.65;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20vmax;
  pointer-events: none;
  z-index: -1;
  opacity: 0.28;
}

body::before {
  background: radial-gradient(circle at 18% 22%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 36%),
    radial-gradient(circle at 82% 18%, color-mix(in srgb, #8b5cf6 20%, transparent), transparent 34%),
    radial-gradient(circle at 68% 78%, color-mix(in srgb, #14b8a6 16%, transparent), transparent 40%);
}

body::after {
  background: linear-gradient(120deg, transparent 20%, color-mix(in srgb, var(--primary) 10%, transparent) 50%, transparent 80%);
  mix-blend-mode: soft-light;
}

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

a:hover {
  color: var(--primary-strong);
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.nav-wrap {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 700;
  color: var(--text);
  font-size: 1.3rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 1rem;
}

.site-nav a {
  color: var(--text-muted);
  font-weight: 500;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.site-main {
  padding: 2rem 0 0;
  position: relative;
}

.section {
  padding: 2.5rem 0;
}

.section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.8rem;
}

.section-intro {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  max-width: 70ch;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.kicker {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 2.1vw, 2rem);
  line-height: 1.15;
}

.hero h1 {
  font-size: clamp(1.8rem, 2.8vw, 2.55rem);
}

#post-title {
  font-size: clamp(1.35rem, 1.9vw, 1.75rem);
}

.lead {
  margin: 0 0 1.4rem;
  color: var(--text-muted);
  max-width: 66ch;
}

.badge-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 0.6rem;
  margin: 0 0 1.1rem;
  align-items: center;
}

.cert-badge {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  min-height: 38px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.cert-badge:hover {
  transform: translateY(-2px);
}

.cta-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.btn {
  border-radius: 10px;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

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

.btn-primary:hover {
  color: #fff;
}

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

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.stat-row li {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 0.9rem;
}

.stat-row strong {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}

.stat-row span {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 16px;
  padding: 1.2rem;
}

.profile-card h2 {
  font-size: 1.15rem;
}

.profile-card ul {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
}

.avatar {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  border: 2px solid var(--border);
}

.social-row {
  display: flex;
  gap: 1rem;
}

.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
}

.card h3 {
  margin: 0 0 0.65rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.project-meta {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.project-tech {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.projects-grid .project-card {
  display: flex;
  flex-direction: column;
}

.app-highlight {
  position: relative;
  overflow: hidden;
}

.app-highlight::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    color-mix(in srgb, var(--primary) 12%, transparent),
    transparent 50%,
    color-mix(in srgb, #8b5cf6 10%, transparent)
  );
  pointer-events: none;
}

.app-highlight > * {
  position: relative;
}

.app-feature-list {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
}

.app-feature-list li {
  margin-bottom: 0.45rem;
}

.contact-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem;
  color: var(--text);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.contact-card:hover {
  transform: translateY(-3px);
}

.site-footer {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}

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

.error-text {
  color: #ef4444;
}

#post-content img {
  display: block;
  width: min(100%, 680px);
  height: auto;
  margin: 1rem auto;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: no-preference) {
  body::before {
    animation: gradientDriftA 22s ease-in-out infinite alternate;
  }

  body::after {
    animation: gradientDriftB 28s linear infinite;
  }

  .section-reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 480ms ease, transform 480ms ease;
    will-change: opacity, transform;
  }

  .section-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  .section-reveal.is-visible .card,
  .section-reveal.is-visible .profile-card {
    animation: glowIn 520ms ease both;
  }
}

@keyframes gradientDriftA {
  0% {
    transform: translate3d(-2%, -1%, 0) scale(1);
  }
  100% {
    transform: translate3d(2%, 1.5%, 0) scale(1.04);
  }
}

@keyframes gradientDriftB {
  0% {
    transform: rotate(0deg) scale(1);
    opacity: 0.18;
  }
  50% {
    opacity: 0.28;
  }
  100% {
    transform: rotate(360deg) scale(1.02);
    opacity: 0.18;
  }
}

@keyframes glowIn {
  0% {
    box-shadow: 0 0 0 rgba(37, 99, 235, 0);
  }
  100% {
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
  }
}

@media (max-width: 920px) {
  .hero-grid,
  .card-grid,
  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .site-nav {
    display: none;
  }

  .badge-row {
    grid-template-columns: 1fr;
  }

  .hero-grid,
  .card-grid,
  .contact-grid,
  .stat-row {
    grid-template-columns: 1fr;
  }

  .footer-wrap {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 1rem 0;
  }
}
