/* ==========================================================================
   MAIN LAYOUT & BASE STYLES
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  min-height: 100vh;
  background:
    radial-gradient(
      circle at 15% 25%,
      #d9e7f0 0%,
      transparent 35%
    ),
    radial-gradient(
      circle at 80% 65%,
      #b9cce0 0%,
      transparent 40%
    ),
    linear-gradient(
      135deg,
      #eef3f6,
      #c2d1df
    );
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  transition: background 0.5s ease, color 0.4s ease;
}

[data-theme="dark"] body {
  background:
    radial-gradient(
      circle at 15% 25%,
      rgba(15, 23, 42, 0.85) 0%,
      transparent 42%
    ),
    radial-gradient(
      circle at 80% 65%,
      rgba(24, 18, 48, 0.75) 0%,
      transparent 45%
    ),
    linear-gradient(
      135deg,
      #070a11,
      #0c101a
    );
  background-attachment: fixed;
}

/* Fast-Scroll Optimization */
body.is-scrolling * {
  pointer-events: none !important;
}

/* Background Depth Orbs (True Glass Layer Behind Content) */
.background-orb {
  position: fixed;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.orb1 {
  top: 15%;
  left: 12%;
  background: rgba(120, 180, 255, 0.48);
  animation: orbFloat1 18s ease-in-out infinite alternate;
}

.orb2 {
  right: 8%;
  bottom: 20%;
  background: rgba(180, 130, 255, 0.38);
  animation: orbFloat2 22s ease-in-out infinite alternate;
}

.orb3 {
  top: 50%;
  left: 45%;
  width: 320px;
  height: 320px;
  background: rgba(56, 189, 248, 0.28);
  animation: orbFloat3 16s ease-in-out infinite alternate;
}

@keyframes orbFloat1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(35px, 40px) scale(1.12); }
}

@keyframes orbFloat2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-40px, -30px) scale(1.08); }
}

@keyframes orbFloat3 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-25px, 35px) scale(0.92); }
}

[data-theme="dark"] .orb1 {
  background: rgba(56, 189, 248, 0.22);
}

[data-theme="dark"] .orb2 {
  background: rgba(139, 92, 246, 0.18);
}

[data-theme="dark"] .orb3 {
  background: rgba(6, 182, 212, 0.16);
}

/* Background Canvas Layer */
#neural-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.65;
}

/* Ambient Background Grid Overlay */
.bg-grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--grid-pattern);
  background-size: 36px 36px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

/* Base Layout Containers */
.container {
  width: min(1200px, 90%);
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

.section-wrapper {
  padding: 6.5rem 0;
  position: relative;
  z-index: 10;
}

/* Section Header Shared Styles */
.section-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 3.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.95rem;
  border-radius: var(--radius-full);
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-title {
  font-size: clamp(2.1rem, 3.8vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.15;
}

.section-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* Footer */
.footer {
  padding: 4.5rem 0 2rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
  position: relative;
  z-index: 10;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-brand h4 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.footer-brand p {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.social-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.social-pill:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}

.footer-bottom {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 1rem;
}

/* Scroll Progress Bar at top of viewport */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3.5px;
  background: linear-gradient(90deg, #2563eb, #0891b2, #7c3aed);
  z-index: 9999;
  width: 0%;
  transition: width 0.1s ease-out;
}

/* Back to Top Float Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: all var(--transition-normal);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-primary);
  color: #ffffff;
  transform: translateY(-3px);
}

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-main);
  z-index: 1500;
  padding: 2.25rem 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2.25rem;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

.mobile-nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mobile-nav-link {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (Desktop, Tablet, Android Phone)
   ========================================================================== */
@media (max-width: 1024px) {
  .hero-container {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .hero-content {
    order: 1;
  }

  .hero-visual {
    order: 2;
  }

  .hero-photo-card {
    max-width: 360px;
  }

  .contact-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 860px) {
  .nav-links-island,
  .nav-cmd-chip,
  .nav-resume-btn {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .hero {
    padding: 6.25rem 0 3rem;
  }

  .timeline-line,
  .timeline-progress {
    left: 18px;
  }

  .timeline-marker {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .timeline-item {
    gap: 1.1rem;
    margin-bottom: 2.25rem;
  }

  .timeline-content {
    padding: 1.35rem 1.15rem;
    border-radius: 18px;
  }

  .modal-content {
    max-height: 92vh;
    width: 95vw;
  }

  .modal-header,
  .modal-body {
    padding: 1.15rem 1.25rem;
  }
}

@media (max-width: 640px) {
  .section-wrapper {
    padding: 4.25rem 0;
  }

  .section-header {
    margin-bottom: 2.25rem;
    padding: 0 0.5rem;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .section-desc {
    font-size: 0.88rem;
  }

  .hero {
    padding: 5.5rem 0 2.5rem;
    min-height: auto;
  }

  .hero-container {
    gap: 2rem;
  }

  .hero-title {
    font-size: clamp(2rem, 7.5vw, 2.75rem);
    line-height: 1.18;
    word-break: break-word;
  }

  .hero-subtitle {
    font-size: 1.02rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.75rem;
  }

  .shiny-btn,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  /* Telemetry rail becomes clean 2x2 grid without wrapping clutter */
  .hero-metrics-rail {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-radius: 20px;
    width: 100%;
  }

  .hero-metrics-rail .metric-divider {
    display: none;
  }

  .hero-metrics-rail .metric-num {
    font-size: 1.45rem;
  }

  .hero-metrics-rail .metric-caption {
    font-size: 0.68rem;
  }

  .photo-aura-backdrop {
    width: min(320px, 88vw);
    height: 380px;
    filter: blur(35px);
  }

  .hero-photo-card {
    max-width: 320px;
    padding: 0.85rem;
    border-radius: 22px;
  }

  .photo-top-header {
    padding: 0.65rem 0.85rem;
  }

  .photo-top-name {
    font-size: 1.05rem;
  }

  .photo-top-degree {
    font-size: 0.78rem;
  }

  .photo-badge-top-right,
  .photo-badge-bottom-left {
    position: static;
    margin: 0.4rem 0;
  }

  /* Form controls maintain >= 16px to prevent mobile iOS/Android auto-zoom */
  .form-input,
  .form-textarea {
    font-size: 16px !important;
    padding: 0.75rem 0.95rem;
  }

  .contact-form {
    padding: 1.25rem 1rem;
    border-radius: 18px;
  }

  .copy-contact-card {
    padding: 1.05rem 1rem;
    border-radius: 14px;
  }

  .contact-card-info p {
    font-size: 0.86rem;
    word-break: break-all;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
}

@media (max-width: 400px) {
  .hero-title {
    font-size: 1.85rem;
  }

  .hero-metrics-rail {
    padding: 0.9rem 1rem;
    gap: 0.85rem;
  }

  .hero-metrics-rail .metric-num {
    font-size: 1.3rem;
  }

  .hero-photo-card {
    max-width: 290px;
  }
}
