/* ============================================
   THE NETWORK STATE — Portfolio Styles
   ============================================ */

:root {
  --bg-dark: #0a0a1a;
  --bg-light: #e8e6e1;
  --text-dark: #e8e6e1;
  --text-light: #1a1a2e;
  --accent-blue: #4a7cff;
  --accent-teal: #2ab5a0;
  --accent-gold: #c9a84c;
  --accent: var(--accent-blue);
  --nav-shadow: rgba(0, 0, 0, 0.08);
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-light);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- Cursor Trail Canvas ---- */
#cursor-trail {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ---- Navigation ---- */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem 2rem;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

#main-nav.nav-scrolled {
  background: rgba(232, 230, 225, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 20px var(--nav-shadow);
}

#main-nav.nav-scrolled .nav-logo,
#main-nav.nav-scrolled .nav-links a {
  color: var(--text-light);
}

#main-nav.nav-dark {
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(10px);
}

#main-nav.nav-dark .nav-logo,
#main-nav.nav-dark .nav-links a {
  color: var(--text-dark);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  transition: color 0.4s ease;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
  transition: color 0.3s ease, opacity 0.3s ease;
  position: relative;
  letter-spacing: 0.02em;
}

.lang-toggle {
  background: none;
  border: 1px solid currentColor;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.lang-toggle:hover {
  opacity: 1;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
  position: relative;
  z-index: 1002;
}

/* Keep the X visible against the open menu background */
.nav-toggle.open span {
  background: var(--text-light) !important;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-dark);
  transition: transform 0.3s ease, opacity 0.3s ease, background 0.4s ease;
}

#main-nav.nav-scrolled .nav-toggle span {
  background: var(--text-light);
}

.nav-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ---- Sticky Name Bar ---- */
#sticky-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  padding: 0.6rem 2rem;
  background: rgba(232, 230, 225, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 20px var(--nav-shadow);
  transform: translate3d(0, -200%, 0);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  pointer-events: none;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
}

#sticky-bar.visible {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  pointer-events: auto;
}

#sticky-bar.bar-dark {
  background: rgba(10, 10, 26, 0.95);
}

#sticky-bar.bar-dark .sticky-name,
#sticky-bar.bar-dark .sticky-tagline {
  color: var(--text-dark);
}

.sticky-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-top: 0;
}

.sticky-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-light);
}

.sticky-tagline {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}

/* ---- Progress Spine ---- */
#progress-spine {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 998;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#progress-spine.visible {
  opacity: 1;
}

.spine-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(74, 124, 255, 0.15);
  border-radius: 1px;
}

.spine-line::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--spine-fill, 0%);
  background: var(--accent);
  border-radius: 1px;
  transition: height 0.3s ease;
}

.spine-node {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(74, 124, 255, 0.3);
  position: relative;
  z-index: 1;
  margin: 2rem 0;
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.spine-node.active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(74, 124, 255, 0.4);
}

.spine-node.passed {
  background: var(--accent);
  border-color: var(--accent);
}

/* ---- Hero Section ---- */
#hero {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  overflow: hidden;
}

#globe-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: var(--text-dark);
  opacity: 0;
  will-change: transform, opacity;
}

.hero-reveal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
  opacity: 0;
  padding: 0 2rem;
  will-change: transform, opacity;
  pointer-events: none;
}

.reveal-coords {
  font-family: var(--font-mono);
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  letter-spacing: 0.15em;
  opacity: 0.6;
  margin-bottom: 0.8rem;
}

.reveal-statement {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.01em;
}

.hero-name {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 1.5vw, 1.2rem);
  font-weight: 400;
  opacity: 0.7;
  letter-spacing: 0.05em;
}

.tagline-separator {
  opacity: 0.3;
  margin: 0 0.3em;
}

.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.5;
}

.scroll-arrow {
  width: 1px;
  height: 30px;
  background: linear-gradient(to bottom, var(--text-dark), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.7); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* ---- Transition Zone ---- */
#transition-zone {
  height: 20vh;
  position: relative;
  z-index: 3;
  background: linear-gradient(to bottom, var(--bg-dark) 0%, var(--bg-light) 100%);
}

/* ---- Content Sections ---- */
.content-section {
  position: relative;
  background: var(--bg-light);
  padding: 6rem 2rem;
  min-height: 80vh;
}

.section-inner {
  max-width: 900px;
  margin: 0 auto;
}

.section-heading {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 2rem;
  position: relative;
}

.section-heading.decode-text {
  opacity: 0;
}

.section-heading.decode-text.decoded {
  opacity: 1;
  transition: opacity 0.4s ease;
}

.section-heading::after {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background: var(--accent);
  margin-top: 0.8rem;
  border-radius: 2px;
  transition: background 0.5s ease;
}

/* ---- About ---- */
.about-text {
  font-size: 1.15rem;
  line-height: 1.8;
  color: #444;
  margin-bottom: 3rem;
  max-width: 700px;
}

/* Growth Timeline */
.growth-timeline {
  position: relative;
  padding-left: 2rem;
}

.growth-timeline .timeline-line {
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-blue), var(--accent-gold));
  opacity: 0.3;
}

.timeline-entry {
  position: relative;
  padding-left: 2rem;
  padding-bottom: 2rem;
  opacity: 0;
  transform: translateX(-20px);
}

.timeline-node {
  position: absolute;
  left: -2rem;
  top: 0.3rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-light);
  box-shadow: 0 0 0 3px var(--accent);
}

.timeline-year {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--accent);
  display: block;
  margin-bottom: 0.3rem;
}

.timeline-content p {
  font-size: 1rem;
  line-height: 1.6;
  color: #555;
}

/* ---- Skills ---- */
.skills-category {
  margin-bottom: 2.5rem;
}

.skills-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.skill-card {
  background: #f0eeea;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: default;
  will-change: transform;
}

.skill-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.skill-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-light);
}

.skill-years {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
}

/* ---- Experience ---- */
.experience-timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}

.exp-entry {
  display: flex;
  margin-bottom: 3rem;
  opacity: 0;
}

.exp-left {
  justify-content: flex-start;
  transform: translateX(-40px);
}

.exp-right {
  justify-content: flex-end;
  transform: translateX(40px);
}

.exp-card {
  background: #f0eeea;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 1.8rem;
  max-width: 500px;
  width: 100%;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: default;
}

.exp-card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.exp-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.exp-company {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.exp-date {
  font-size: 0.8rem;
  color: #999;
}

.exp-role {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--text-light);
}

.exp-card p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #555;
}

/* ---- Roles ---- */
.roles-period {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 2rem;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.role-card {
  background: #f0eeea;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: default;
  will-change: transform;
}

.role-card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.role-card h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--text-light);
}

.role-card p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #555;
}

/* ---- Certificates ---- */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.2rem;
}

.cert-card {
  background: #f0eeea;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: default;
}

.cert-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.cert-thumb {
  width: 100%;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.8rem;
  background: #e0deda;
}

.cert-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.cert-thumb-pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
}

.cert-thumb-pdf span {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.1em;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 26, 0.92);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-dark);
  font-size: 2rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  z-index: 10001;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 85vh;
  overflow: hidden;
  position: relative;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: zoom-in;
  transition: transform 0.3s ease;
}

.lightbox-content img.zoomed {
  cursor: grab;
}

.lightbox-content img.zoomed.panning {
  cursor: grabbing;
}

.cert-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.4rem;
}

.cert-type {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---- Footer ---- */
#footer {
  position: relative;
  background: var(--bg-dark);
  padding: 6rem 2rem 3rem;
  color: var(--text-dark);
  overflow: hidden;
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#footer-globe-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0.4;
}

.footer-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 600px;
}

.footer-name {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  margin-bottom: 0.5rem;
}

.footer-tagline {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  opacity: 0.6;
  margin-bottom: 2.5rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 3rem;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-dark);
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.footer-link:hover {
  opacity: 1;
}

.link-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transition: box-shadow 0.3s ease;
}

.footer-link:hover .link-dot {
  box-shadow: 0 0 16px var(--accent);
}

.footer-bottom {
  font-size: 0.75rem;
  opacity: 0.3;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
    order: 99;
    margin-left: 0.75rem;
  }

  .nav-logo {
    margin-right: auto;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 210px;
    background: rgba(232, 230, 225, 0.55);
    backdrop-filter: blur(28px) saturate(140%);
    -webkit-backdrop-filter: blur(28px) saturate(140%);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    flex-direction: column;
    padding: 5rem 1.75rem 2rem;
    gap: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1001;
  }

  .nav-links.open {
    transform: translateX(0);
  }

  /* Lock background scroll while the mobile menu is open */
  body.menu-open {
    overflow: hidden;
  }

  .nav-links a {
    color: var(--text-light) !important;
    font-size: 1.1rem;
  }

  #progress-spine {
    display: none;
  }

  .sticky-inner {
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-start;
    padding-top: 0;
  }

  .sticky-name {
    font-size: 0.95rem;
  }

  .sticky-tagline {
    font-size: 0.7rem;
  }

  /* Hero: prevent text wrapping issues */
  .hero-name {
    font-size: clamp(1.8rem, 8vw, 3rem);
    white-space: nowrap;
  }

  .hero-tagline {
    font-size: clamp(0.7rem, 2.5vw, 0.9rem);
  }

  /* Reveal text: prevent wrapping */
  .reveal-coords {
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    white-space: nowrap;
  }

  .reveal-statement {
    font-size: clamp(1.1rem, 4.5vw, 1.8rem);
    white-space: nowrap;
  }

  /* Section headings: allow wrapping so long titles aren't clipped on narrow screens */
  .section-heading {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    min-height: 1.3em;
    overflow-wrap: break-word;
  }

  /* Disable will-change on mobile to save GPU memory */
  .hero-content,
  .hero-reveal,
  .skill-card,
  .role-card {
    will-change: auto;
  }

  /* Simpler cards — no 3D tilt on mobile */
  .skill-card,
  .role-card,
  .exp-card,
  .cert-card {
    transform: none !important;
  }

  .exp-left,
  .exp-right {
    justify-content: center;
    transform: translateY(20px);
  }

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

  .footer-links {
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
  }

  .content-section {
    padding: 4rem 1.5rem;
  }

  /* Footer globe: hidden on mobile for performance */
  #footer-globe-canvas {
    display: none;
  }

  /* Transition zone: shorter on mobile */
  #transition-zone {
    height: 10vh;
  }

  /* Cursor trail: hidden (already disabled in JS, but belt-and-suspenders) */
  #cursor-trail {
    display: none;
  }

  /* Scroll indicator */
  .scroll-indicator {
    font-size: 0.65rem;
  }
}

@media (max-width: 480px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cert-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 1rem;
  }

  .cert-card {
    width: 100%;
    max-width: 280px;
  }
}
