:root {
  --bg: #0B1220;
  --surface: #121B2E;
  --surface-2: #17233A;
  --text: #F5F7FA;
  --muted: #8B96AC;
  --border: #1E2A42;
  --accent: #2DD4BF;
  --accent-text: #06231D;
}

[data-theme="light"] {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --surface-2: #F1F1EE;
  --text: #15181F;
  --muted: #5B6472;
  --border: #E4E4E0;
  --accent: #0F9C8C;
  --accent-text: #FFFFFF;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Josefin Sans', sans-serif;
  color: var(--text);
  transition: background-color 0.2s ease, color 0.2s ease;
  position: relative;

  /* Creative background: a slowly drifting mesh of soft color blobs over
     the base color, plus a faint grain texture for depth \u2014 rather than
     a single flat fill. color-mix() keeps the blobs theme-aware, since
     --accent already changes between dark and light mode. */
  background-color: var(--bg);
  background-image:
    radial-gradient(640px circle, color-mix(in srgb, var(--accent) 26%, transparent), transparent 65%),
    radial-gradient(540px circle, color-mix(in srgb, #7C5CFF 22%, transparent), transparent 65%),
    radial-gradient(580px circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 65%),
    radial-gradient(460px circle, color-mix(in srgb, #FF5C8A 16%, transparent), transparent 65%);
  background-repeat: no-repeat;
  background-position: 8% 12%, 92% 8%, 85% 92%, 12% 95%;
  background-attachment: fixed;
  animation: bg-drift 30s ease-in-out infinite alternate;
}

@keyframes bg-drift {
  from { background-position: 8% 12%, 92% 8%, 85% 92%, 12% 95%; }
  to   { background-position: 16% 22%, 84% 18%, 76% 82%, 22% 86%; }
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
}

/* Faint grain layer on top of the gradient mesh, for texture rather than
   a flat wash of color. Sits behind the sidebar and content via z-index. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.display { font-family: 'Josefin Sans', sans-serif; font-weight: 600; margin: 0; }

a { color: inherit; }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 28px;
  z-index: 20;
}
.sidebar-top { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 700;
  font-size: 22px;
}
.name { font-size: 20px; font-weight: 700; line-height: 1.3; }
.name-sub { color: var(--muted); font-size: 16px; font-weight: 500; }
.tagline { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0; }

.side-nav { display: flex; flex-direction: column; gap: 4px; margin: 40px 0; }
.nav-link {
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--accent-text); background: var(--accent); }

.sidebar-bottom { display: flex; flex-direction: column; gap: 20px; }
.socials { display: flex; gap: 14px; }
.socials a {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
}
.socials a:hover { color: var(--accent); }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* Mobile nav toggle (hidden on desktop) */
.nav-toggle {
  display: none;
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 30;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}
.nav-toggle span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; }

/* Main content */
.content { margin-left: 280px; padding: 0 64px; max-width: 880px; }
.section { padding: 96px 0; border-bottom: 1px solid var(--border); }
.section:last-of-type { border-bottom: none; }

.hero { padding-top: 120px; }
.eyebrow { color: var(--accent); font-size: 14px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.big { font-size: 48px; font-weight: 700; letter-spacing: -1px; margin: 14px 0 20px; }
.lead { color: var(--muted); font-size: 17px; line-height: 1.7; max-width: 620px; margin: 0 0 32px; }

.cta-row, .contact-row { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 12px;
  transition: opacity 0.15s ease;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-small { padding: 9px 16px; font-size: 13px; }

.section-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.section-sub { color: var(--muted); font-size: 15px; margin: 0 0 36px; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 40px; }
.skill-name { font-size: 14px; font-weight: 500; display: block; margin-bottom: 8px; }
.bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }

/* Projects */
.projects-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.project-card-placeholder { opacity: 0.6; border-style: dashed; }
.project-tag { font-size: 12px; color: var(--accent); font-weight: 600; }
.project-title { font-size: 18px; font-weight: 700; }
.project-desc { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; flex: 1; }
.project-links { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }

/* Articles */
.articles-list { display: flex; flex-direction: column; gap: 16px; }
.article-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  text-decoration: none;
  transition: border-color 0.15s ease;
}
.article-card:hover { border-color: var(--accent); }
.article-date { font-size: 12px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.article-title { font-size: 17px; font-weight: 700; margin: 8px 0 8px; }
.article-desc { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 10px; }
.article-readmore { font-size: 13px; font-weight: 600; color: var(--accent); }

/* Certifications */
.certs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cert-card-placeholder { opacity: 0.6; border-style: dashed; }
.cert-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cert-info { display: flex; flex-direction: column; gap: 4px; }
.cert-title { font-size: 16px; font-weight: 700; }
.cert-issuer { font-size: 13px; color: var(--muted); }
.cert-link { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; margin-top: auto; }
.cert-link:hover { text-decoration: underline; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}
.timeline-item { position: relative; padding-left: 32px; margin-bottom: 36px; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: 0;
  top: 5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline-date { font-size: 12px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.timeline-title { font-size: 17px; font-weight: 700; margin: 6px 0 6px; }
.timeline-text { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; }

.footer { padding: 32px 0 64px; color: var(--muted); font-size: 13px; }

/* 404 page */
.not-found-page {
  width: min(100% - 48px, 1080px);
  min-height: 100svh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.not-found-header, .not-found-footer {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.not-found-brand { font-size: 22px; text-decoration: none; }
.not-found-brand span { color: var(--accent); }
.not-found-label, .not-found-footer { color: var(--muted); font-size: 13px; }
.not-found-label span { color: var(--accent); padding: 0 5px; }
.not-found-main {
  flex: 1;
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 72px 0 88px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.not-found-code {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 120px;
  line-height: 0.9;
  margin: 0 0 34px -7px;
}
.not-found-zero {
  color: var(--accent);
  position: relative;
}
.not-found-zero::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  top: 50%;
  left: 50%;
  border: 2px solid var(--bg);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.not-found-eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}
.not-found-title { max-width: 540px; font-size: 34px; line-height: 1.2; }
.not-found-copy { max-width: 460px; color: var(--muted); font-size: 16px; line-height: 1.7; margin: 16px 0 28px; }
.not-found-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.not-found-footer { min-height: 68px; border-top: 1px solid var(--border); border-bottom: 0; }
.not-found-footer a { color: var(--text); text-decoration: none; }
.not-found-footer a:hover { color: var(--accent); }

@media (max-width: 600px) {
  .not-found-page { width: min(100% - 40px, 1080px); }
  .not-found-header { min-height: 72px; }
  .not-found-label { font-size: 12px; }
  .not-found-main { padding: 56px 0; }
  .not-found-code { font-size: 88px; margin-bottom: 28px; }
  .not-found-title { font-size: 28px; }
  .not-found-copy { font-size: 15px; }
}

/* Reveal-on-scroll (purely additive; content is in the DOM either way) */
.section { opacity: 0; transform: translateY(16px); transition: opacity 0.5s ease, transform 0.5s ease; }
.section.in-view { opacity: 1; transform: none; }

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .nav-toggle { display: flex; }
  .content { margin-left: 0; padding: 0 24px; }
  .big { font-size: 34px; }
  .skills-grid, .projects-grid, .certs-grid { grid-template-columns: 1fr; }
}
