/* ========================================
   Design Tokens
   ======================================== */
:root {
  --color-navy: #0a1628;
  --color-navy-light: #121f36;
  --color-navy-mid: #1a2d4a;
  --color-gold: #c9a84c;
  --color-gold-hover: #d4b85e;
  --color-slate: #8892a4;
  --color-white: #f0f2f5;

  --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --fs-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --fs-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --fs-base: clamp(1rem, 0.925rem + 0.4vw, 1.125rem);
  --fs-lg: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
  --fs-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --fs-2xl: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
  --fs-3xl: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);

  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 5rem;

  --radius: 8px;
  --header-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: var(--font-stack);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--color-white);
  background-color: var(--color-navy);
  background-image:
    linear-gradient(rgba(201, 168, 76, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 168, 76, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  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='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

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

ul {
  list-style: none;
}

a {
  color: var(--color-gold);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-gold-hover);
}

/* ========================================
   Accessibility
   ======================================== */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  background: var(--color-gold);
  color: var(--color-navy);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius);
  font-weight: 600;
  z-index: 1000;
}

.skip-link:focus {
  top: var(--space-md);
}

:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

/* ========================================
   Layout
   ======================================== */
.container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  position: relative;
}

.section {
  padding: var(--space-3xl) 0;
  position: relative;
  overflow: hidden;
}

.section-alt {
  background-color: var(--color-navy-light);
}

/* ---- Section separator line ---- */
.section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(80%, 600px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
  opacity: 0.3;
}

/* ---- Oversized Parallax Section Titles (Step 6) ---- */
.section-title-bg {
  font-size: clamp(4rem, 10vw, 8rem);
  font-weight: 700;
  opacity: 0.04;
  color: var(--color-gold);
  position: absolute;
  top: -1rem;
  left: 0;
  pointer-events: none;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  will-change: transform;
  z-index: 0;
}

.section-title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--color-white);
  margin-bottom: var(--space-lg);
  position: relative;
  padding-bottom: var(--space-sm);
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

.section-title.visible {
  clip-path: inset(0 0% 0 0);
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--color-gold);
  border-radius: 2px;
}

.section-subtitle {
  font-size: var(--fs-lg);
  color: var(--color-slate);
  max-width: 640px;
  margin-bottom: var(--space-2xl);
}

/* ========================================
   Header
   ======================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
  height: var(--header-height);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.nav-logo {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: 1px;
}

.nav-logo:hover {
  color: var(--color-white);
}

.nav-logo span {
  color: var(--color-gold);
}

.nav-links {
  display: flex;
  gap: var(--space-xl);
}

.nav-link {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-slate);
  position: relative;
  padding: var(--space-xs) 0;
  transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-gold);
}

.nav-link.active {
  text-shadow: 0 0 12px rgba(201, 168, 76, 0.4);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-gold);
  transition: width 0.2s ease;
}

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

.lang-switch {
  font-weight: 600 !important;
  color: var(--color-gold) !important;
  border: 1px solid rgba(201, 168, 76, 0.3);
  padding: 0.25rem 0.75rem !important;
  border-radius: var(--radius);
  font-size: var(--fs-xs) !important;
  transition: all 0.2s ease;
}
.lang-switch:hover { background: rgba(201, 168, 76, 0.1); }
.lang-switch::after { display: none; }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
  z-index: 110;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-white);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

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

.nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-block;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--color-gold);
  color: var(--color-navy);
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
}

.btn-primary:hover {
  background: var(--color-gold-hover);
  color: var(--color-navy);
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(201, 168, 76, 0.5);
}

.btn-outline {
  background: transparent;
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.btn-outline:hover {
  background: var(--color-gold);
  color: var(--color-navy);
  transform: translateY(-1px);
}

/* ========================================
   Hero
   ======================================== */
.hero {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  padding: var(--space-3xl) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  top: 50%;
  left: 50%;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.15) 0%, rgba(10, 22, 40, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  animation: hero-pulse 9s ease-in-out infinite;
}

.hero::after {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.1) 0%, rgba(10, 22, 40, 0) 70%);
  animation: hero-pulse 9s ease-in-out infinite 4.5s;
}

@keyframes hero-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.15; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.08; }
}

.hero .container {
  position: relative;
  z-index: 1;
  align-items: center;
}

.hero-tagline {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: var(--space-md);
  transition: font-family 0.3s ease;
}

/* Step 1: Scramble monospace font during decode */
.hero-tagline.scrambling {
  font-family: 'Courier New', monospace;
}

.hero-title {
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: var(--space-lg);
  background: linear-gradient(135deg, var(--color-white) 0%, var(--color-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: var(--fs-lg);
  color: var(--color-slate);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-2xl);
  line-height: 1.7;
}

.hero-subtitle strong {
  color: var(--color-gold);
  font-weight: 600;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  justify-content: center;
}

/* ========================================
   Hero Canvas
   ======================================== */
#hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* Hide CSS fallback orbs when WebGL is active */
.hero.webgl-active::before,
.hero.webgl-active::after {
  display: none;
}

/* ========================================
   About
   ======================================== */
.about-grid {
  display: grid;
  gap: var(--space-2xl);
}

.about-text p {
  color: var(--color-slate);
  margin-bottom: var(--space-lg);
  line-height: 1.8;
}

.about-text .btn {
  margin-top: var(--space-sm);
}

.about-image {
  position: relative;
}

.about-image::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 16px;
  width: 100%;
  height: 100%;
  border: 2px solid rgba(201, 168, 76, 0.3);
  border-radius: var(--radius);
  z-index: -1;
  pointer-events: none;
}

.about-image img {
  position: relative;
  z-index: 1;
  border-radius: var(--radius);
  width: 100%;
  max-width: 360px;
  object-fit: cover;
  aspect-ratio: 1;
}


/* ========================================
   Tech Stack
   ======================================== */
.tech-grid {
  display: grid;
  gap: var(--space-lg);
  perspective: 800px;
}

.tech-category {
  background: rgba(26, 45, 74, 0.4);
  border: 1px solid rgba(201, 168, 76, 0.1);
  border-top: 3px solid var(--color-gold);
  border-radius: var(--radius);
  padding: var(--space-xl);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease-out;
  transform-style: preserve-3d;
  position: relative;
  overflow: hidden;
}

.tech-category:hover {
  border-color: rgba(201, 168, 76, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(201, 168, 76, 0.1);
}

.tech-category h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--color-gold);
  margin-bottom: var(--space-md);
}

.tech-category ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tech-category li {
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 100px;
  padding: 0.3rem 0.9rem;
  font-size: var(--fs-xs);
  color: var(--color-slate);
  transition: all 0.2s ease;
}

.tech-category li:hover {
  background: rgba(201, 168, 76, 0.15);
  color: var(--color-gold);
}

/* 3D Tilt shine overlay (Step 4b) */
.tilt-shine {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}

/* ========================================
   Timeline — Vertical
   ======================================== */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin-top: var(--space-xl);
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, var(--color-gold), rgba(201, 168, 76, 0.1));
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-2xl);
}

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

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-2rem + -4px);
  top: 0.5rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-gold);
  border: 2px solid var(--color-navy);
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.4);
}

.timeline-date {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--color-gold);
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

.timeline-content {
  background: rgba(26, 45, 74, 0.4);
  border: 1px solid rgba(201, 168, 76, 0.1);
  border-radius: var(--radius);
  padding: var(--space-xl);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.timeline-content:hover {
  border-color: rgba(201, 168, 76, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(201, 168, 76, 0.1);
}

.timeline-content h3 {
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--color-white);
  margin-bottom: var(--space-xs);
}

.timeline-org {
  font-size: var(--fs-sm);
  color: var(--color-gold);
  font-weight: 500;
  margin-bottom: var(--space-sm);
}

.timeline-content p:last-child {
  color: var(--color-slate);
  line-height: 1.7;
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
  padding: var(--space-3xl) 0 var(--space-xl);
  background: var(--color-navy-light);
  border-top: 1px solid rgba(201, 168, 76, 0.1);
  position: relative;
  overflow: hidden;
}

.site-footer .container {
  text-align: center;
}

.site-footer .section-title::after {
  left: 50%;
  transform: translateX(-50%);
}

.footer-title {
  font-size: clamp(3rem, 8vw, 6rem) !important;
  background: linear-gradient(135deg, var(--color-white) 0%, var(--color-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-title::after {
  display: none;
}

.footer-subtitle {
  font-size: var(--fs-lg);
  color: var(--color-slate);
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-2xl);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.footer-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-slate);
  font-size: var(--fs-sm);
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--color-gold);
}

.footer-link-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 50%;
  transition: all 0.3s ease;
  color: var(--color-slate);
}

.footer-link-icon svg {
  width: 24px;
  height: 24px;
}

.footer-link:hover .footer-link-icon {
  background: var(--color-gold);
  border-color: var(--color-gold);
  color: var(--color-navy);
}

.footer-link-label {
  overflow: hidden;
  height: 1.5em;
}

.footer-link-label span {
  display: block;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.footer-link:hover .footer-link-label span {
  transform: translateY(0);
}

.copyright {
  font-size: var(--fs-xs);
  color: var(--color-slate);
  opacity: 0.6;
  padding-top: var(--space-xl);
  border-top: 1px solid rgba(136, 146, 164, 0.1);
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(26, 45, 74, 0.85);
  border: 1px solid rgba(201, 168, 76, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, background 0.2s ease;
  z-index: 50;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--color-gold);
  color: var(--color-navy);
}

/* ========================================
   Scroll Progress
   ======================================== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--color-gold);
  z-index: 9999;
  width: 0%;
}

/* ========================================
   Cursor Glow
   ======================================== */
.cursor-glow {
  position: fixed;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
  transform: translate(-50%, -50%);
  will-change: transform;
}

/* ========================================
   Animations
   ======================================== */
[data-hero] {
  opacity: 0;
  transform: translateY(20px);
}

.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: calc(var(--delay, 0) * 100ms);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .fade-up,
  [data-hero] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .section-title {
    clip-path: none;
    transition: none;
  }

  .hero::before,
  .hero::after {
    animation: none;
  }

  .cursor-glow,
  .scroll-progress {
    display: none;
  }

  #hero-canvas {
    display: none;
  }

  .section-title-bg {
    transform: none !important;
  }

  .hero-tagline.scrambling {
    font-family: var(--font-stack);
  }

  .back-to-top {
    transition: none;
  }

  .footer-link-label span {
    transform: none;
  }

  .tech-category {
    transform: none !important;
  }

  .tilt-shine {
    display: none;
  }
}

/* ========================================
   Responsive
   ======================================== */

/* 640px+ : 2-col tech grid */
@media (min-width: 640px) {
  .tech-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 768px+ : desktop nav, 2-col about */
@media (min-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
}

/* 1024px+ : 4-col tech grid */
@media (min-width: 1024px) {
  .tech-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Mobile nav (below 768px) */
@media (max-width: 767px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: min(300px, 80vw);
    height: 100vh;
    background: var(--color-navy-light);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-xl);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 105;
    border-left: 1px solid rgba(201, 168, 76, 0.1);
  }

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

  .nav-link {
    font-size: var(--fs-lg);
  }

  body.menu-open {
    overflow: hidden;
  }

  .footer-links {
    gap: var(--space-xl);
  }

  .footer-link-label span {
    transform: translateY(0);
  }
}
