/* ─── Design Tokens ──────────────────────────────── */
:root {
  --bg: #151e30;
  --bg-soft: #1a2640;
  --surface: #1f2f4d;
  --surface-hover: #283a5c;
  --text: #f2f5fa;
  --text-secondary: #c8d5e8;
  --text-muted: #8ba0c0;
  --cyan: #00d4f5;
  --cyan-dim: rgba(0, 212, 245, 0.12);
  --cyan-glow: rgba(0, 212, 245, 0.4);
  --orange: #ff8a50;
  --orange-dim: rgba(255, 138, 80, 0.12);
  --orange-glow: rgba(255, 138, 80, 0.4);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --radius: 14px;
  --font-heading: "Syne", sans-serif;
  --font-body: "DM Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  background: linear-gradient(160deg, #151e30 0%, #12213d 40%, #1a2545 70%, #182040 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-decoration: none; transition: color 200ms, opacity 200ms; }
a:hover { color: #fff; }

::selection { background: var(--cyan); color: var(--bg); }

/* ─── Custom Cursor ──────────────────────────────── */
.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 6px; height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 80ms ease, opacity 300ms;
}

.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 36px; height: 36px;
  border: 1.5px solid var(--cyan);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 200ms, height 200ms, border-color 200ms, opacity 300ms;
  opacity: 0.4;
}

.cursor-hover .cursor-ring {
  width: 56px; height: 56px;
  border-color: var(--orange);
  opacity: 0.7;
}

/* ─── Grain Overlay ──────────────────────────────── */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px;
}

/* ─── Grid Background ────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at 50% 20%, rgba(0,0,0,0.7) 0%, transparent 65%);
}

/* ─── Ambient Glows ──────────────────────────────── */
.glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
}

.glow-1 {
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(0, 212, 245, 0.18) 0%, rgba(0, 150, 255, 0.06) 40%, transparent 70%);
  top: -12%;
  left: -10%;
  animation: float 18s ease-in-out infinite;
}

.glow-2 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255, 138, 80, 0.15) 0%, rgba(255, 80, 120, 0.05) 40%, transparent 70%);
  bottom: -8%;
  right: -10%;
  animation: float 22s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(30px, -20px); }
  66% { transform: translate(-20px, 15px); }
}

/* ─── Container ──────────────────────────────────── */
.container {
  width: min(1100px, calc(100% - 3rem));
  margin: 0 auto;
}

/* ─── Navigation ─────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(1.6);
  background: rgba(21, 30, 48, 0.9);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  width: min(1100px, calc(100% - 3rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text) !important;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan-glow);
  display: inline-block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  transition: color 200ms, background 200ms;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

.nav-cta {
  color: var(--cyan) !important;
  border: 1px solid rgba(0, 229, 255, 0.25) !important;
  margin-left: 0.4rem;
}

.nav-cta:hover {
  background: var(--cyan-dim) !important;
  color: #fff !important;
  border-color: rgba(0, 229, 255, 0.5) !important;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 200ms, opacity 200ms;
}

.nav-toggle.active span:first-child { transform: rotate(45deg) translate(2.5px, 2.5px); }
.nav-toggle.active span:last-child { transform: rotate(-45deg) translate(2.5px, -2.5px); }

/* ─── Mobile Menu ────────────────────────────────── */
.mobile-menu {
  position: fixed;
  top: 64px;
  left: 0; right: 0;
  z-index: 99;
  background: rgba(21, 30, 48, 0.97);
  backdrop-filter: blur(24px);
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  transform: translateY(-110%);
  opacity: 0;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), opacity 250ms ease;
  pointer-events: none;
  border-bottom: 1px solid var(--line);
}

.mobile-menu.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

.mobile-menu a {
  color: var(--text-secondary);
  font-size: 1.05rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
  transition: color 150ms, padding-left 200ms;
}

.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover { color: var(--cyan); padding-left: 0.5rem; }

/* ─── Hero ───────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 8rem 0 6rem;
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 3rem;
  align-items: center;
}

.hero-portrait {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.portrait-frame {
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid rgba(0, 212, 245, 0.15);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.35),
    0 0 80px rgba(0, 212, 245, 0.08),
    inset 0 1px 0 rgba(255,255,255,0.08);
  position: relative;
}

.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(21, 30, 48, 0.5) 100%);
  pointer-events: none;
}

.portrait-frame img {
  width: 100%;
  height: 480px;
  object-fit: cover;
  object-position: center top;
  display: block;
  filter: contrast(1.04) brightness(0.97) saturate(1.1);
  transition: filter 500ms ease, transform 600ms ease;
}

.portrait-frame:hover img {
  filter: contrast(1.08) brightness(1.02) saturate(1.15);
  transform: scale(1.03);
}

.hero-badges {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid;
  backdrop-filter: blur(8px);
}

.badge-cyan {
  color: var(--cyan);
  border-color: rgba(0, 229, 255, 0.2);
  background: rgba(0, 229, 255, 0.05);
}

.badge-orange {
  color: var(--orange);
  border-color: rgba(255, 107, 53, 0.2);
  background: rgba(255, 107, 53, 0.05);
}

.hero-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(3.5rem, 10vw, 7rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: var(--text);
}

.hero-name-accent {
  background: linear-gradient(135deg, var(--cyan) 0%, #00b8d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-title {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--orange);
  margin-top: 1.25rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

.hero-tagline {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
  max-width: 38ch;
  line-height: 1.7;
}

.hero-meta {
  margin-top: 2rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.hero-location {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.hero-location svg { color: var(--cyan); opacity: 0.6; }

/* ─── Sections ───────────────────────────────────── */
.section {
  position: relative;
  z-index: 1;
  padding: 5rem 0;
  border-top: 1px solid var(--line);
}

.section-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cyan);
  margin-bottom: 0.5rem;
}

.section-heading {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 2.5rem;
}

/* ─── Project Cards ──────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 300ms, transform 300ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 300ms;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  opacity: 0;
  transform: translateY(24px);
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--orange));
  opacity: 0;
  transition: opacity 300ms;
}

.project-card.in-view {
  opacity: 1;
  transform: translateY(0);
  transition: border-color 300ms, transform 500ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 300ms, opacity 500ms ease;
}

.project-card:hover {
  border-color: rgba(0, 212, 245, 0.2);
  transform: translateY(-4px);
  background: var(--surface-hover);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25), 0 0 30px rgba(0, 212, 245, 0.06);
}

.project-card:hover::before { opacity: 1; }

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.project-card h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.7;
  flex: 1;
}

.project-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.project-stack span {
  font-size: 0.66rem;
  padding: 0.22rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.project-links {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.project-link {
  font-size: 0.76rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--cyan);
  transition: color 200ms;
}

.project-link:hover { color: #fff; }

.project-link--orange { color: var(--orange); }
.project-link--orange:hover { color: #fff; }

.project-tag {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Skills Grid ────────────────────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.skill-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 500ms ease, transform 500ms ease, border-color 300ms;
}

.skill-group.in-view {
  opacity: 1;
  transform: translateY(0);
}

.skill-group:hover {
  border-color: rgba(0, 229, 255, 0.12);
}

.skill-group h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.85rem;
  color: var(--cyan);
}

.skill-group ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.skill-group li {
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding-left: 0.9rem;
  position: relative;
  line-height: 1.5;
}

.skill-group li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line-strong);
}

/* ─── Timeline ───────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 2.25rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(180deg, var(--cyan), rgba(0, 229, 255, 0.1));
  border-radius: 2px;
}

.timeline--edu::before {
  background: linear-gradient(180deg, var(--orange), rgba(255, 107, 53, 0.1));
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-item.in-view {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -2.25rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan-glow);
  transform: translateX(-4px);
}

.timeline--edu .timeline-item::before {
  background: var(--orange);
  box-shadow: 0 0 14px var(--orange-glow);
}

.timeline-date {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cyan);
  margin-bottom: 0.3rem;
}

.timeline--edu .timeline-date {
  color: var(--orange);
}

.timeline-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.timeline-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  max-width: 56ch;
  line-height: 1.7;
}

.timeline-highlights {
  margin-top: 0.6rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.timeline-highlights li {
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding-left: 1rem;
  position: relative;
  line-height: 1.6;
}

.timeline-highlights li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 1px;
  background: var(--cyan);
  opacity: 0.5;
}

.timeline--edu .timeline-highlights li::before {
  background: var(--orange);
}

/* ─── Contact ────────────────────────────────────── */
.section-contact {
  text-align: center;
}

.contact-text {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
}

.roles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-bottom: 3rem;
}

.role-tag {
  font-size: 0.72rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text-muted);
  background: var(--surface);
  transition: border-color 250ms, color 250ms, background 250ms;
}

.role-tag:hover {
  border-color: rgba(0, 229, 255, 0.3);
  color: var(--text);
  background: var(--cyan-dim);
}

.contact-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted) !important;
  font-size: 0.88rem;
  transition: color 200ms !important;
}

.contact-link:hover {
  color: var(--cyan) !important;
}

.contact-link svg {
  opacity: 0.5;
  flex-shrink: 0;
  transition: opacity 200ms;
}

.contact-link:hover svg { opacity: 1; }

/* ─── Footer ─────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0;
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

/* ─── Scroll Reveal ──────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 1024px) {
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero-portrait { order: -1; max-width: 340px; }
  .portrait-frame img { height: 380px; }
  .projects-grid { grid-template-columns: 1fr; }
  .nav-links a { font-size: 0.72rem; padding: 0.35rem 0.5rem; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .container { width: calc(100% - 2rem); }

  .hero { padding: 6.5rem 0 3.5rem; min-height: auto; }
  .hero-name { font-size: clamp(2.6rem, 13vw, 4rem); }
  .hero-portrait { max-width: 280px; }
  .portrait-frame img { height: 320px; }

  .section { padding: 3.5rem 0; }
  .section-heading { margin-bottom: 2rem; }

  .skills-grid { grid-template-columns: 1fr; }

  .timeline { padding-left: 1.75rem; }
  .timeline-item::before { left: -1.75rem; width: 8px; height: 8px; }

  .contact-links {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .roles-grid { gap: 0.35rem; }
  .role-tag { font-size: 0.68rem; padding: 0.35rem 0.7rem; }
}

@media (max-width: 480px) {
  .hero-badges { flex-direction: column; align-items: flex-start; }
  .hero-name { font-size: clamp(2.2rem, 14vw, 3.2rem); }
  .hero-tagline { font-size: 0.92rem; }
  .projects-grid { gap: 0.75rem; }
  .project-card { padding: 1.25rem; }
}

/* Hide custom cursor on touch devices */
@media (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none !important; }
}

/* ─── Reduced Motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .project-card, .skill-group, .timeline-item {
    opacity: 1;
    transform: none;
  }
}
