/* ==========================================================================
   Bespoke Architectural Design System & Production Optimization
   ========================================================================== */

:root {
  /* Elite Monochromatic Palette */
  --color-bg: #030304;
  --color-surface: rgba(25, 25, 28, 0.4);
  --color-surface-blur: rgba(10, 10, 12, 0.6);
  --color-border: rgba(255, 255, 255, 0.08);

  --color-text-100: #ffffff;
  --color-text-200: #e0e0e2;
  --color-text-300: #9a9a9f;
  --color-text-400: #66666c;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  /* Extreme Typographic Scale */
  --text-micro: 0.65rem;
  --text-xs: clamp(0.75rem, 0.8vw, 0.875rem);
  --text-sm: clamp(0.875rem, 1vw, 1rem);
  --text-base: clamp(1rem, 1.2vw, 1.125rem);
  --text-lg: clamp(1.25rem, 1.5vw, 1.5rem);
  --text-xl: clamp(1.5rem, 2vw, 2rem);
  --text-2xl: clamp(2rem, 3vw, 2.75rem);
  --text-3xl: clamp(3rem, 4.5vw, 4.5rem);
  --text-4xl: clamp(4rem, 6vw, 6.5rem);
  --text-display: clamp(3.5rem, 10vw, 12rem);

  /* Whitespace */
  --space-2: 0.5rem;
  --space-4: 1rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --space-32: 8rem;
  --space-48: 12rem;
  --space-64: 16rem;
  --space-128: 24rem;

  /* Easing */
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Dynamic Scroll Variable (Set by JS) */
  --scroll-y: 0px;
  --scroll-progress: 0;
}

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

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

html {
  background-color: var(--color-bg);
  color: var(--color-text-200);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  position: relative;
  width: 100%;
  background-color: var(--color-bg);
}

/* Ensure all page content is always above the fixed ambient background layer */
main, body > header, body > section {
  position: relative;
  z-index: 1;
}

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

/* Touch Target Enhancements (WCAG 2.2 AA) */
a, button, .nav-link, .btn-tactile {
  min-height: 48px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Accessibility Focus Visible Rings */
:focus-visible {
  outline: 2px solid var(--color-text-100);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ==========================================================================
   Ambient Background Layer
   ========================================================================== */
.ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -1; /* Behind all page content - subpage content has no stacking context */
  overflow: hidden;
}

.ambient-noise {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.3;
}

.ambient-gradient {
  position: absolute;
  inset: 0;
  background: transparent; /* Body already provides #030304 background - solid here was covering subpage content */
}

.ambient-vignette {
  display: none !important;
  box-shadow: none !important;
  background: none !important;
}

/* ==========================================================================
   Navigation (Floating Desktop & Drawer Mobile)
   ========================================================================== */
.nav-floating {
  position: fixed;
  top: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 16px;
  background: var(--color-surface-blur);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  transition: transform 0.4s var(--ease-expo), opacity 0.4s var(--ease-expo);
}

.nav-floating.nav-hidden {
  transform: translate(-50%, -120%);
  opacity: 0;
  pointer-events: none;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-300);
  padding: 6px 14px;
  border-radius: 100px;
  transition: color 0.2s ease, background 0.2s ease;
  min-height: 40px;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--color-text-100);
  background: rgba(255, 255, 255, 0.06);
}

/* Mobile Nav Toggle */
.nav-toggle {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 110;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 48px;
  height: 48px;
  background: var(--color-surface-blur);
  backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--color-text-100);
  transition: transform 0.3s var(--ease-expo), opacity 0.3s ease;
}

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

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

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

/* Mobile Nav Drawer */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 105;
  background: rgba(3, 3, 4, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-expo);
}

.mobile-menu.is-active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-link {
  font-size: var(--text-xl);
  font-family: var(--font-sans);
  font-weight: 300;
  color: var(--color-text-200);
}

@media (max-width: 768px) {
  .nav-floating {
    display: none;
  }
  .nav-toggle {
    display: flex;
  }
}

/* ==========================================================================
   Typography & Display Titles
   ========================================================================== */
.t-display {
  font-size: var(--text-display);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--color-text-100);
}

.t-h1 {
  font-size: var(--text-4xl);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
}

.t-h2 {
  font-size: var(--text-3xl);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.t-h3 {
  font-size: var(--text-2xl);
  font-weight: 400;
  line-height: 1.2;
}

.t-body-lg {
  font-size: var(--text-lg);
  color: var(--color-text-200);
  line-height: 1.6;
}

.t-mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-300);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   Hero Section (Apple & Vercel Center Aligned Layout)
   ========================================================================== */
.s-hero {
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px var(--space-4) var(--space-12) var(--space-4);
  max-width: 1100px;
  margin: 0 auto;
  gap: var(--space-6, 24px);
}

.hero-title {
  font-size: clamp(3rem, 7.5vw, 8rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--color-text-100);
  margin-bottom: var(--space-2);
}

.hero-visual {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: fit-content;
  max-width: min(100%, 460px);
  margin: 0 auto;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(8px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  will-change: transform;
}

.hero-visual:hover {
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 24px rgba(255, 255, 255, 0.06);
}

.hero-img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
  object-position: center top;
  display: block;
  border-radius: inherit;
}

.hero-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.hero-role {
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  color: var(--color-text-200);
  line-height: 1.6;
  text-align: center;
  max-width: 760px;
}

.hero-location {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-300);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

/* ==========================================================================
   Section 2: Split Scroll Story (About)
   ========================================================================== */
.s-story {
  padding: var(--space-32) var(--space-8);
  max-width: 1800px;
  margin: 0 auto;
}

.split-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-16);
}

@media (min-width: 1024px) {
  .split-layout {
    grid-template-columns: 4fr 8fr;
    gap: var(--space-24);
  }

  .split-sticky {
    position: sticky;
    top: var(--space-32);
    align-self: start;
  }
}

.story-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-24);
}

.story-block p {
  margin-bottom: var(--space-4);
}

/* ==========================================================================
   Journal Section
   ========================================================================== */
.s-journal {
  padding: var(--space-32) var(--space-8);
  max-width: 1800px;
  margin: 0 auto;
}

.journal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 768px) {
  .journal-grid {
    grid-template-columns: repeat(12, 1fr);
  }
}

.j-item {
  position: relative;
  overflow: hidden;
}

.j-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-expo);
}

.j-item:hover .j-img {
  transform: scale(1.03);
}

.j-caption {
  position: absolute;
  bottom: var(--space-4);
  left: var(--space-4);
  background: rgba(3, 3, 4, 0.8);
  padding: 4px 10px;
  border-radius: 4px;
}

/* Journal Grid Spans */
.j-1 { aspect-ratio: 16/9; }
@media (min-width: 768px) { .j-1 { grid-column: 1 / 8; aspect-ratio: 16/10; } }

.j-2 { aspect-ratio: 4/3; }
@media (min-width: 768px) { .j-2 { grid-column: 9 / 13; aspect-ratio: 3/4; } }

.j-3 { aspect-ratio: 16/9; }
@media (min-width: 768px) { .j-3 { grid-column: 2 / 12; aspect-ratio: 21/9; } }

/* ==========================================================================
   Tactile Contact & Buttons
   ========================================================================== */
.s-contact {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  position: relative;
}

.contact-title {
  margin-bottom: var(--space-8);
}

.btn-tactile {
  display: inline-flex;
  padding: 12px 28px;
  background-color: var(--color-text-100);
  color: var(--color-bg);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 100px;
  border: 1px solid transparent;
  transition: transform 0.3s var(--ease-expo), box-shadow 0.3s var(--ease-expo), background-color 0.3s ease;
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.btn-tactile:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 18px 36px rgba(255, 255, 255, 0.2);
}

.btn-tactile:active {
  transform: translateY(1px) scale(0.98);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text-100);
  border-color: var(--color-border);
  box-shadow: none;
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--color-text-200);
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-8);
}

.footer-copyright {
  margin-top: var(--space-12);
  text-align: center;
}

/* ==========================================================================
   Apple & Linear Style Scroll Reveal Engine (60 FPS, GPU-Accelerated)
   ========================================================================== */
.reveal-fade,
.reveal-text,
.reveal-image,
.reveal-card {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-fade.is-revealed,
.reveal-text.is-revealed,
.reveal-image.is-revealed,
.reveal-card.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger Delays for Cards & Grids */
.d-1 { transition-delay: 0.08s; }
.d-2 { transition-delay: 0.16s; }
.d-3 { transition-delay: 0.24s; }
.d-4 { transition-delay: 0.32s; }

/* Reduced Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Printable ATS-Friendly CV Page (/cv)
   ========================================================================== */
.cv-wrapper {
  max-width: 940px;
  margin: 0 auto var(--space-32) auto;
  padding: 115px var(--space-4) 0 var(--space-4);
}

.cv-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  position: relative;
  z-index: 10;
}

.ambient-vignette {
  display: none !important;
  box-shadow: none !important;
  background: none !important;
}

.cv-container {
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: var(--space-12);
  color: #ffffff;
  box-shadow: none;
  -webkit-font-smoothing: antialiased;
}

.cv-header {
  border-bottom: 2px solid rgba(255, 255, 255, 0.25);
  padding-bottom: var(--space-6, 24px);
  margin-bottom: var(--space-8);
}

.cv-name {
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  font-weight: 700;
  color: #ffffff !important;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.cv-tagline {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: #e5e5ea !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-4);
}

.cv-contact-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: #e5e5ea !important;
}

.cv-contact-link {
  color: inherit !important;
  text-decoration: none !important;
}

.cv-contact-bar strong {
  color: #ffffff !important;
}

.cv-section {
  margin-bottom: var(--space-8);
}

.cv-section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffffff !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 6px;
  margin-bottom: var(--space-4);
}

.cv-item {
  margin-bottom: var(--space-4);
}

/* Enhanced Education Section Styles */
.cv-edu-header {
  margin-bottom: 8px;
}

.cv-edu-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
  gap: 8px;
}

.cv-edu-institution {
  font-size: 0.95rem;
  color: #a0a0a5;
  font-style: italic;
  font-weight: 500;
}

.cv-edu-date {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: #d1d1d6;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.cv-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.cv-item-title {
  font-weight: 600;
  color: #ffffff !important;
  font-size: 1.05rem;
}

.cv-item-subtitle {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: #d1d1d6 !important;
}

.cv-bullets {
  list-style-type: disc;
  padding-left: 20px;
  margin-top: 6px;
}

.cv-bullets li {
  margin-bottom: 4px;
  font-size: 0.95rem;
  color: #f2f2f7 !important;
  line-height: 1.5;
}

.cv-skills-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cv-skill-group h4 {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: #ffffff !important;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.cv-skill-group p {
  font-size: 0.9rem;
  color: #e5e5ea !important;
}

.cv-cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.cv-cert-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cv-cert-title {
  font-weight: 600;
  color: #ffffff !important;
  font-size: 0.95rem;
}

.cv-cert-issuer {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #e5e5ea !important;
}

.cv-cert-meta {
  font-size: 0.75rem;
  color: #d1d1d6 !important;
}

.cv-cert-skills {
  font-size: 0.8rem;
  color: #ffffff !important;
  margin-top: 4px;
}

/* A4 Print Stylesheet (@media print) */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 15mm 5mm 15mm;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
    zoom: 0.9;
  }

  .ambient-bg,
  .nav-floating,
  .nav-toggle,
  .mobile-menu,
  .s-contact,
  .cv-actions,
  .no-print {
    display: none !important;
  }

  .cv-wrapper {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .cv-container {
    background: #ffffff !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    color: #000000 !important;
  }

  .cv-header {
    border-bottom: 2pt solid #000000 !important;
    padding-bottom: 10px !important;
    margin-bottom: 16px !important;
  }

  .cv-name {
    color: #000000 !important;
    font-size: 22pt !important;
  }

  .cv-tagline, .cv-contact-bar, .cv-item-subtitle {
    color: #333333 !important;
  }

  .cv-section-title {
    color: #000000 !important;
    border-bottom: 1pt solid #000000 !important;
    font-size: 12pt !important;
  }

  .cv-item-title {
    color: #000000 !important;
  }

  .cv-bullets li {
    color: #222222 !important;
  }

  .cv-section, .cv-item {
    break-inside: avoid;
  }

  a {
    color: #000000 !important;
    text-decoration: none !important;
  }

  a[href]::after {
    content: none !important;
  }

  .cv-contact-link {
    color: #333333 !important;
  }
}

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-text-400);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-200);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Infinite Auto-Sliding Certificate Carousel */
.cert-carousel-section {
  padding: var(--space-16) var(--space-8);
  max-width: 1800px;
  margin: 0 auto;
  overflow: hidden;
}

.cert-marquee-container {
  overflow: hidden;
  width: 100%;
  position: relative;
  padding: 12px 0;
}

.cert-marquee-track {
  display: flex;
  gap: 20px;
  width: max-content;
  animation: certMarquee 35s linear infinite;
}

.cert-marquee-container:hover .cert-marquee-track {
  animation-play-state: paused;
}

@keyframes certMarquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.cert-slide-card {
  flex: 0 0 auto;
  width: 280px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.cert-slide-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.3);
}

.cert-slide-img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
}

/* Mobile Icon Toggle for View All Button */
@media (max-width: 768px) {
  .view-all-btn .btn-text {
    display: none;
  }
  .view-all-btn .btn-icon {
    display: inline-block !important;
    font-size: 1.25rem !important;
    line-height: 1;
  }
  .view-all-btn {
    padding: 8px 14px;
  }
}
