:root {
  --bg-black: #050a14;
  --bg-navy: #0b1728;
  --bg-navy-light: #16294a;
  --bg-navy-lighter: #1f3357;
  --accent: #4a7fb5;
  --accent-light: #8fb4dd;
  --silver: #c9ced6;
  --white: #f5f7fa;
  --text-muted: #9aa5b8;
  --border: rgba(201, 206, 214, 0.12);
  --radius: 14px;
  --max-width: 1100px;
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: linear-gradient(160deg, var(--bg-navy) 0%, var(--bg-black) 55%, var(--bg-black) 100%);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

#network {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.55;
  pointer-events: none;
}

.nav, main, .footer { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }

img, svg { display: block; max-width: 100%; }

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 6vw;
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  background: rgba(5, 10, 20, 0.55);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-square {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: inline-block;
}
.logo-square--back {
  background: var(--silver);
  margin-right: -10px;
  transform: translateY(3px);
  opacity: 0.85;
}
.logo-square--front {
  background: var(--white);
}

.logo-text {
  font-weight: 600;
  font-size: 1.15rem;
  margin-left: 6px;
}
.logo-text span { color: var(--accent-light); }

.nav-links {
  display: flex;
  gap: 32px;
}
.nav-links a {
  font-size: 0.92rem;
  color: var(--text-muted);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--white); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--white);
}

/* Hero */
.hero {
  min-height: 88vh;
  display: flex;
  align-items: center;
  padding: 0 6vw;
}
.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  width: 100%;
}
.hero-content { max-width: 640px; flex: 1 1 480px; }

/* Hero code card */
.code-card {
  flex: 0 0 380px;
  max-width: 380px;
  width: 100%;
  background: var(--bg-navy);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  transform: rotate(1.5deg);
  transition: transform 0.3s ease;
}
.code-card:hover {
  transform: rotate(0deg) translateY(-4px);
}
.code-card-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 16px;
  background: var(--bg-navy-light);
  border-bottom: 1px solid var(--border);
}
.code-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.code-dot--red { background: #ff5f56; }
.code-dot--yellow { background: #ffbd2e; }
.code-dot--green { background: #27c93f; }
.code-card-title {
  margin-left: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.code-card-body {
  padding: 18px 20px 20px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.85;
}
.code-line { display: flex; }
.code-line .ln {
  width: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.45;
  user-select: none;
}
.code-line .lc { white-space: pre-wrap; word-break: break-word; color: var(--silver); }
.tok-kw { color: #c9a0f5; }
.tok-var { color: var(--white); }
.tok-key { color: var(--accent-light); }
.tok-str { color: #f0b464; }
.code-cursor {
  display: inline-block;
  width: 6px;
  height: 1em;
  background: var(--accent-light);
  margin-left: 3px;
  vertical-align: text-bottom;
  animation: code-blink 1s step-end infinite;
}
@keyframes code-blink { 50% { opacity: 0; } }

.hero-eyebrow {
  color: var(--accent-light);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 18px;
  font-weight: 500;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}

.hero-role {
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  color: var(--silver);
  font-weight: 400;
  margin-bottom: 20px;
}

.hero-desc {
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 34px;
  font-size: 1rem;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.btn {
  padding: 13px 28px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-block;
}
.btn-primary {
  background: var(--accent);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
}
.btn-outline {
  border: 1px solid var(--border);
  color: var(--white);
}
.btn-outline:hover {
  border-color: var(--accent-light);
  background: rgba(143, 180, 221, 0.08);
  transform: translateY(-2px);
}

.hero-socials {
  display: flex;
  gap: 20px;
}
.hero-socials a {
  color: var(--text-muted);
  transition: color 0.2s, transform 0.2s;
}
.hero-socials a:hover {
  color: var(--accent-light);
  transform: translateY(-2px);
}

/* Sections */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 90px 6vw;
}

.section-title {
  font-size: 1.7rem;
  font-weight: 600;
  margin-bottom: 44px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.section-title span {
  color: var(--accent-light);
  font-size: 1.1rem;
  font-weight: 400;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 50px;
}
.about-text {
  color: var(--text-muted);
  font-size: 1.02rem;
}
.about-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.info-item {
  background: var(--bg-navy-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--silver);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.skill-card {
  background: var(--bg-navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.2s, border-color 0.2s;
}
.skill-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}
.skill-card h3 {
  font-size: 0.95rem;
  color: var(--accent-light);
  margin-bottom: 14px;
  font-weight: 500;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tags span {
  background: rgba(143, 180, 221, 0.1);
  border: 1px solid var(--border);
  color: var(--silver);
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 999px;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 28px;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.timeline-item {
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -34px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(74, 127, 181, 0.2);
}
.timeline-date {
  color: var(--accent-light);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.timeline-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.timeline-org {
  color: var(--silver);
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.timeline-content p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 10px;
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 26px;
}
.project-card {
  background: var(--bg-navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s;
  cursor: pointer;
}
.project-card:hover,
.project-card:focus-visible {
  transform: translateY(-6px);
  border-color: var(--accent);
  outline: none;
}
.project-visual { line-height: 0; }
.project-svg { width: 100%; height: auto; }
.project-visual--img { overflow: hidden; height: 190px; }
.project-visual--img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.4s ease;
}
.project-card:hover .project-visual--img img {
  transform: scale(1.04);
}
.project-body { padding: 22px; }
.project-body h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
  font-weight: 600;
}
.project-body p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.project-note {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--accent-light);
}
.project-cta {
  display: block;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--silver);
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}
.project-card:hover .project-cta,
.project-card:focus-visible .project-cta {
  opacity: 1;
  transform: translateX(4px);
}
.projects-footer {
  margin-top: 36px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.projects-footer a { color: var(--accent-light); }

/* Contact */
.contact-intro {
  color: var(--text-muted);
  margin-bottom: 34px;
  max-width: 600px;
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.contact-card {
  background: var(--bg-navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.2s, border-color 0.2s;
}
.contact-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}
.contact-label {
  font-size: 0.78rem;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.contact-value {
  font-size: 0.95rem;
  color: var(--white);
  word-break: break-word;
}

.footer {
  text-align: center;
  padding: 30px 6vw 50px;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

/* Modal */
body.modal-open { overflow: hidden; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 7, 15, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  position: relative;
  background: var(--bg-navy);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 760px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s ease;
}
.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(5, 10, 20, 0.7);
  color: var(--white);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.modal-close:hover { background: var(--accent); border-color: var(--accent); }

.modal-gallery {
  position: relative;
  background: var(--bg-black);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 360px;
  overflow: hidden;
}
.modal-slide { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.modal-slide img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.modal-slide svg { width: 70%; height: 70%; }

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(5, 10, 20, 0.55);
  color: var(--white);
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s;
}
.modal-nav:hover { background: var(--accent); }
.modal-nav--prev { left: 14px; }
.modal-nav--next { right: 14px; }

.modal-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 14px 0 0;
}
.modal-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background 0.2s;
}
.modal-dots span.active { background: var(--accent-light); }

.modal-body { padding: 26px 28px 30px; }
.modal-body h3 { font-size: 1.3rem; font-weight: 600; margin-bottom: 14px; }
.modal-body p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 18px; }
.modal-body .tags { margin-bottom: 14px; }

@media (max-width: 980px) {
  .hero-inner { flex-direction: column; align-items: stretch; }
  .code-card { align-self: center; transform: none; max-width: 420px; }
  .code-card:hover { transform: translateY(-4px); }
}

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .about-grid { grid-template-columns: 1fr; }
  .section { padding: 60px 6vw; }
}
