@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ── Variables ───────────────────────────────────────── */
:root {
  --bg:      #ffffff;
  --ink:     #0d1b2a;
  --muted:   #5a6a7a;
  --line:    #e2e8f0;
  --card:    #f8fafc;
  --accent:  #1a3a6b;
  --accent2: #2a5298;
  --accent-light: #e8edf5;
}

html.dark {
  --bg:      #0b1220;
  --ink:     #e8edf5;
  --muted:   #7a8fa8;
  --line:    #1e2d42;
  --card:    #111e30;
  --accent:  #3b7dd8;
  --accent2: #5594e8;
  --accent-light: #0f1e32;
}

/* ── Reset & Base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  transition: background .3s, color .3s;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  line-height: 1.1;
}

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

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

/* ── Rail Nav ────────────────────────────────────────── */
.rail {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 72px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 0;
  background: var(--bg);
  z-index: 100;
  transition: background .3s, border-color .3s;
}

.rail-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: -.02em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.rail-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

.rail-link {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .2s;
  cursor: pointer;
  padding: 1rem 0;
}
.rail-link:hover, .rail-link.active { color: var(--accent); }

.rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 1rem; }

.theme-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: border-color .2s, color .2s, transform .2s;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); transform: rotate(20deg); }
.theme-btn svg { width: 15px; height: 15px; }

/* ── Mobile Nav ──────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
  transition: background .3s;
}

.mobile-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: .9rem;
  color: var(--accent);
}

.hamburger {
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center;
}

.mobile-drawer {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 99;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
}
.mobile-drawer.open { display: flex; }
.mobile-drawer a {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
  transition: color .2s;
}
.mobile-drawer a:hover { color: var(--accent); }
.drawer-close {
  position: absolute;
  top: 1.5rem; right: 1.5rem;
  background: none; border: none;
  color: var(--ink); cursor: pointer;
}

/* ── Page Wrapper ────────────────────────────────────── */
.page {
  margin-left: 72px;
  min-height: 100vh;
}

/* ── Sections ────────────────────────────────────────── */
section {
  padding: 6rem 5rem;
  max-width: 1400px;
}

/* ── Hero ─────────────────────────────────────────────── */
#hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 4rem;
  align-items: center;
  padding-top: 3rem;
}

.hero-left { display: flex; flex-direction: column; gap: 2.5rem; }

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: .4rem 1rem;
  border-radius: 100px;
  width: fit-content;
}

.hero-tag .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.8); }
}

.hero-title {
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--ink);
  line-height: 1;
}

.hero-title span { color: var(--accent); }

.typewriter {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 500;
  color: var(--muted);
  min-height: 1.6em;
}

.typewriter .cursor {
  display: inline-block;
  width: 2px; height: 1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: middle;
  animation: blink .8s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.hero-desc {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--muted);
  max-width: 480px;
}

.hero-ctas { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn-primary {
  padding: .85rem 2rem;
  background: var(--accent);
  color: #fff;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  transition: transform .2s, box-shadow .2s, background .2s;
  box-shadow: 0 4px 20px rgba(26,58,107,.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(26,58,107,.4); background: var(--accent2); }

.btn-outline {
  padding: .85rem 2rem;
  border: 1.5px solid var(--line);
  color: var(--ink);
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  transition: border-color .2s, color .2s, transform .2s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.hero-socials { display: flex; gap: 1.2rem; }

.social-link {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: border-color .2s, color .2s, transform .2s;
}
.social-link:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.social-link svg { width: 16px; height: 16px; }

.hero-right { position: relative; display: flex; justify-content: center; align-items: center; }

.hero-img-wrap {
  position: relative;
  width: 100%;
  max-width: 460px;
}

.hero-img-bg {
  position: absolute;
  inset: 0;
  background: var(--accent-light);
  border-radius: 2rem;
  transform: rotate(3deg) scale(1.02);
  transition: background .3s;
}

.hero-img {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: 2rem;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(13,27,42,.15);
}

.hero-img img { width: 100%; height: 100%; object-fit: cover; }

.hero-badge {
  position: absolute;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: .6rem 1rem;
  display: flex; align-items: center; gap: .5rem;
  font-size: .7rem;
  font-weight: 600;
  color: var(--ink);
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  white-space: nowrap;
  transition: background .3s, border-color .3s;
}
.hero-badge svg { color: var(--accent); width: 14px; height: 14px; }
.hero-badge-1 { top: 1.5rem; left: -2rem; }
.hero-badge-2 { bottom: 4rem; left: -2.5rem; }
.hero-badge-3 { top: 40%; right: -2rem; }

.hero-stats {
  display: flex; gap: 2.5rem;
  border-top: 1px solid var(--line);
  padding-top: 2rem;
}
.stat-item .stat-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
}
.stat-item .stat-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: .25rem;
}

/* ── About ───────────────────────────────────────────── */
#about {
  border-top: 1px solid var(--line);
}

.section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.section-title {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
  margin-bottom: 1rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 5rem;
  align-items: start;
  margin-top: 4rem;
}

.about-photo-wrap { position: relative; }

.about-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 1.5rem;
  overflow: hidden;
  border: 3px solid var(--accent);
  box-shadow: 8px 8px 0 var(--accent-light);
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; }

.about-accent-box {
  position: absolute;
  bottom: -1.5rem; right: -1.5rem;
  background: var(--accent);
  color: #fff;
  padding: 1.25rem 1.5rem;
  border-radius: 1rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  line-height: 1.6;
}

.about-bio {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--muted);
  margin-bottom: 2rem;
}

.about-bio strong { color: var(--ink); }

.timeline { border-left: 2px solid var(--line); padding-left: 1.5rem; margin: 2rem 0; }

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.85rem; top: .35rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.timeline-year {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .25rem;
}
.timeline-text { font-size: .9rem; color: var(--ink); font-weight: 500; }

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
}

.skill-tag {
  display: flex; align-items: center; gap: .6rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .6rem;
  padding: .65rem 1rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink);
  transition: border-color .2s, background .2s;
}
.skill-tag:hover { border-color: var(--accent); background: var(--accent-light); }
.skill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.cert-list { margin-top: 1.5rem; display: flex; flex-direction: column; gap: .75rem; }
.cert-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .6rem;
  font-size: .82rem;
  color: var(--muted);
  font-weight: 500;
  transition: border-color .2s;
}
.cert-item:hover { border-color: var(--accent); }
.cert-item svg { color: var(--accent); flex-shrink: 0; width: 14px; height: 14px; }

/* ── Resume ──────────────────────────────────────────── */
#resume { border-top: 1px solid var(--line); }

.resume-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 5rem;
  margin-top: 4rem;
}

.resume-category {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 2rem;
  font-family: 'Space Grotesk', sans-serif;
}

.resume-item {
  margin-bottom: 3rem;
}
.resume-item:last-child { margin-bottom: 0; }

.resume-role {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .25rem;
}

.resume-company {
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.resume-date {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  display: inline-block;
  background: var(--card);
  padding: .2rem .6rem;
  border-radius: 100px;
  border: 1px solid var(--line);
  margin-bottom: 1rem;
}

.resume-desc {
  font-size: .95rem;
  line-height: 1.7;
  color: var(--muted);
}
.resume-desc ul { margin-left: 1.2rem; margin-top: .5rem; }
.resume-desc li { margin-bottom: .5rem; }

.resume-divider {
  height: 1px;
  background: var(--line);
  margin: 4rem 0;
}

/* ── Portfolio ───────────────────────────────────────── */
#portfolio { border-top: 1px solid var(--line); }

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 3rem;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  overflow: hidden;
  transition: transform .3s, box-shadow .3s, border-color .3s;
  cursor: pointer;
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(13,27,42,.1);
  border-color: var(--accent);
}

.project-img {
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--accent-light);
  position: relative;
}
.project-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.project-card:hover .project-img img { transform: scale(1.05); }

.project-img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent-light), var(--line));
}
.project-img-placeholder svg { width: 40px; height: 40px; color: var(--accent); opacity: .4; }

.project-body { padding: 1.25rem; }

.project-cat {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .5rem;
}

.project-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .5rem;
  line-height: 1.3;
}

.project-desc {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.6;
}

.project-tags {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin-top: 1rem;
}
.project-tags span {
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--accent-light);
  color: var(--accent);
  padding: .25rem .65rem;
  border-radius: 100px;
}

.project-link {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: 1.25rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  transition: gap .2s;
}
.project-link:hover { gap: .7rem; }
.project-link svg { width: 12px; height: 12px; }

/* ── Contact ─────────────────────────────────────────── */
#contact { border-top: 1px solid var(--line); }

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 5rem;
  margin-top: 3rem;
}

.contact-big-text {
  font-size: clamp(3rem, 5vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.05;
  color: var(--accent);
  margin-bottom: 2.5rem;
}

.contact-info { display: flex; flex-direction: column; gap: 2rem; }

.contact-row .contact-label {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .4rem;
}
.contact-row a, .contact-row span {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  transition: color .2s;
}
.contact-row a:hover { color: var(--accent); }

.contact-form { display: flex; flex-direction: column; gap: 1.25rem; }

.form-field {
  position: relative;
}
.form-field input, .form-field textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--line);
  padding: .9rem 0;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: var(--ink);
  outline: none;
  transition: border-color .2s;
}
.form-field input:focus, .form-field textarea:focus { border-color: var(--accent); }
.form-field textarea { resize: none; height: 120px; }
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--muted); font-size: .9rem; }

/* ── Footer ──────────────────────────────────────────── */
footer {
  margin-left: 72px;
  border-top: 1px solid var(--line);
  padding: 2rem 5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Animations ──────────────────────────────────────── */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .7s ease, transform .7s ease;
}
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .portfolio-grid { grid-template-columns: 1fr 1fr; }
  #hero { grid-template-columns: 1fr; }
  .hero-right { display: none; }
  section { padding: 4rem 3rem; }
}

@media (max-width: 768px) {
  .rail { display: none; }
  .mobile-nav { display: flex; }
  .page { margin-left: 0; padding-top: 60px; }
  section { padding: 3.5rem 1.5rem; }
  .portfolio-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  footer { margin-left: 0; padding: 1.5rem; flex-direction: column; gap: .75rem; text-align: center; }
  .hero-stats { gap: 1.5rem; }
}

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 42, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-overlay.open {
  display: flex;
  animation: overlayIn 0.25s ease forwards;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-container {
  background: var(--bg);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  border-radius: 2rem;
  overflow-y: auto;
  position: relative;
  border: 1px solid var(--line);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  animation: containerIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes containerIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  color: var(--ink);
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--accent);
  color: #fff;
  transform: rotate(90deg);
}

.modal-hero {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--accent-light);
  overflow: hidden;
}

.modal-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-body {
  padding: 3rem;
}

.modal-header {
  margin-bottom: 2rem;
}

.modal-cat {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.modal-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.modal-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 4rem;
}

.modal-desc {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--muted);
}

.modal-desc p {
  margin-bottom: 1.5rem;
}

.modal-meta {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.meta-group label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-tags span {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
}

.modal-cta {
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .modal-body { padding: 2rem; }
  .modal-content { grid-template-columns: 1fr; gap: 2rem; }
  .modal-title { font-size: 1.75rem; }
}
