/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --bg: #0a0a0a;
  --bg-secondary: #111111;
  --surface: #161616;
  --border: rgba(255, 255, 255, 0.08);
  --text-primary: #e8e6e0;
  --text-secondary: rgba(232, 230, 224, 0.45);
  --text-muted: rgba(232, 230, 224, 0.25);
  --accent: #c8ff00;
  --accent-dim: rgba(47, 49, 44, 0.712);
  --link: #817f77;
  --link-hover: #c8ff00;
  --nav-dot-active: #c8ff00;
  --nav-dot-inactive: rgba(77, 75, 69, 0.658);
  --scrollbar-thumb: rgba(70, 62, 62, 0.1);
  --frame-gap-bg: #ffffff; 

  /* Glassmorphism settings for standard theme configurations */
  --header-bg: rgba(10, 10, 10, 0.65);
  --header-glass-border: rgba(255, 255, 255, 0.06);
  --header-blur: 16px;

  --font-sans: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --header-h: 56px; 
  --sidebar-w: 220px;
  --content-pad: 48px;
}

[data-theme="light"] {
  --bg: #f5f4f0;
  --bg-secondary: #eceae4;
  --surface: #e8e6e0;
  --border: rgba(0, 0, 0, 0.1);
  --text-primary: #111111;
  --text-secondary: rgba(17, 17, 17, 0.5);
  --text-muted: rgba(17, 17, 17, 0.3);
  --accent: #1a1a1a;
  --accent-dim: rgba(0, 0, 0, 0.06);
  --link: #555555;
  --link-hover: #111111;
  --nav-dot-active: #111111;
  --nav-dot-inactive: rgba(17, 17, 17, 0.2);
  --scrollbar-thumb: rgba(0,0,0,0.15);
  --frame-gap-bg: #000000; 

  --header-bg: rgba(245, 244, 240, 0.7);
  --header-glass-border: rgba(0, 0, 0, 0.05);
}

[data-theme="mono"] {
  --bg: #0c0c0c;
  --bg-secondary: #141414;
  --surface: #1a1a1a;
  --border: rgba(255, 255, 255, 0.1);
  --text-primary: #e0e0e0;
  --text-secondary: rgba(224, 224, 224, 0.4);
  --text-muted: rgba(224, 224, 224, 0.2);
  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.08);
  --link: #a0a0a0;
  --link-hover: #ffffff;
  --nav-dot-active: #ffffff;
  --nav-dot-inactive: rgba(255, 255, 255, 0.2);
  --font-sans: 'DM Mono', monospace;
  --frame-gap-bg: #ffffff; 

  --header-bg: rgba(12, 12, 12, 0.65);
  --header-glass-border: rgba(255, 255, 255, 0.06);
}

/* ============================================================
   INTRO 3-SECOND SPLASH SCREEN WITH LOAD & EXIT ANIMATIONS
   ============================================================ */
#intro-splash-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: #0a0a0a; 
  z-index: 99999; 
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
              visibility 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

#intro-splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.intro-splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
}

.intro-splash-logo {
  height: 48px; 
  width: auto;
  object-fit: contain;
  opacity: 0;
  transform: translateY(10px);
  animation: splashLoadIn 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards 0.2s;
}

.intro-splash-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: #e8e6e0; 
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(12px);
  animation: splashLoadIn 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards 0.4s;
}

.intro-splash-subtitle {
  color: rgba(232, 230, 224, 0.45);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: none;
  margin-left: 4px;
}

#intro-splash-screen.animating-exit .intro-splash-logo,
#intro-splash-screen.animating-exit .intro-splash-title {
  opacity: 0 !important;
  transform: translateY(-10px) !important;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

@keyframes splashLoadIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE LOGO ARCHITECTURE
   ============================================================ */
.site-logo-container {
  display: flex;
  align-items: center;
  height: 24px;
  width: auto;
  flex-shrink: 0;
}

.site-logo {
  height: 162%;
  width: auto;
  object-fit: contain;
  display: none;
}

html[data-theme="dark"] .logo-dark-theme,
html[data-theme="mono"] .logo-dark-theme {
  display: block;
}

html[data-theme="light"] .logo-light-theme {
  display: block;
}

/* ============================================================
   RESET & FRAME BASE (10PX SCREEN MARGIN CONTROLS)
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--frame-gap-bg); 
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: background-color 0.4s ease;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0 !important;
  height: 0 !important;
}

body {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  background: var(--bg);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.7;
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

ul, ol {
  list-style: none;
}

/* ============================================================
   BACKGROUND CANVAS GRAPHICS OVERRIDES
   ============================================================ */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.95; 
}

/* ============================================================
   FLOATING GLASSMORPHIC HEADER WITH LIVE DATETIME VIEW
   ============================================================ */
.site-header {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  height: var(--header-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  
  background: var(--header-bg);
  backdrop-filter: blur(var(--header-blur));
  -webkit-backdrop-filter: blur(var(--header-blur));
  border: 1px solid var(--header-glass-border);
  border-radius: 30px; 
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
  
  transition: background 0.4s ease, border-color 0.4s ease, transform 0.3s ease;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-toggle-btn {
  display: none; 
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
  width: 18px;
  height: 12px;
  z-index: 110;
  padding: 0;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 1.5px;
  background-color: var(--text-primary);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), 
              opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  transform-origin: left center;
}

.nav-toggle-btn.menu-open .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(1px, -1px);
}
.nav-toggle-btn.menu-open .hamburger-line:nth-child(2) {
  opacity: 0;
}
.nav-toggle-btn.menu-open .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(1px, 1px);
}

.site-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.site-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px; 
}

.header-live-datetime {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  border-right: 1px solid var(--border);
  padding-right: 20px;
  user-select: none;
  font-weight: 400;
  white-space: nowrap;
}

.theme-buttons-cluster {
  display: flex;
  gap: 4px;
}

.project-meta {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.theme-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  cursor: pointer;
  border-radius: 20px; 
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.theme-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: var(--accent-dim);
}


/* ============================================================
   LAYOUT ARCHITECTURE
   ============================================================ */
.layout {
  position: absolute;
  top: 0; 
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  z-index: 1;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 98;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   SIDEBAR NAV MODULES
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  padding: calc(var(--header-h) + 40px) 24px 28px; 
  transition: border-color 0.4s ease, transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), background 0.4s ease;
  overflow: hidden;
  background: transparent;
  z-index: 99;
}

.sidebar-name {
  margin-bottom: 36px;
}

.sidebar-name h1 {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: var(--text-primary);
}

.sidebar-role {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.main-nav {
  flex: 1;
}

.main-nav ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  transition: color 0.2s ease;
  cursor: pointer;
}

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

.nav-dot {
  font-size: 6px;
  color: var(--nav-dot-inactive);
  transition: color 0.2s ease;
  line-height: 1;
  flex-shrink: 0;
}

.nav-link.active .nav-dot {
  color: var(--nav-dot-active);
}

.sidebar-footer {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-top: auto;
  padding-top: 20px;
}

/* ============================================================
   CONTENT SCROLL LAYOUT & ASYNC PAGE ROUTING TRANSITIONS
   ============================================================ */
.content-area {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.section {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  padding: calc(var(--header-h) + 40px) var(--content-pad) var(--content-pad); 
  scroll-behavior: smooth !important;
  display: flex;
  flex-direction: column;
  align-items: flex-end; 
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.section::-webkit-scrollbar {
  display: none;
  width: 0 !important;
}

.section.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 5;
}

.section-content-wrap {
  width: 100%;
      padding: 20px;
    margin-top: 80px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  opacity: 1;
  transform: translateY(0);
}


/* ── SMOOTH TEXT ENTRANCE AND EXIT TRANSITIONS ── */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-16px);
  }
}

/* Trigger structural page entrance effects */
.section.active .section-content-wrap {
  animation: fadeSlideIn 0.45s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Trigger structural page departure effects */
.section.exiting .section-content-wrap {
  animation: fadeSlideOut 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.project-item {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  /* Prevents individual items from ever overflowing the content wrap */
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.project-item:first-child {
  border-top: 1px solid var(--border);
}

.project-item h2 {
  font-size: 34px;
  font-weight: 400;
  line-height: 1.25;
  margin-bottom: 6px;
  /* CRITICAL FOR SIDEBAR: Forces long technical titles to wrap cleanly instead of stretching layouts */
  word-break: break-word;
  overflow-wrap: break-word;
}

.project-item p {
    text-align: justify;
  font-size: 14px; 
  margin-bottom: 2px;
  /* Protects descriptions and meta paragraphs from overflowing */
  word-break: break-word;
  overflow-wrap: break-word;
}

.project-item h2 a {
  color: var(--text-primary);
  letter-spacing: -0.01em;
  position: relative;
  display: inline-block;
  /* Keeps layout sizing within its bounds */
  max-width: 100%;
}

.project-item h2 a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: 0;
  width: 0;
  height: 1px;
  background: var(--link-hover);
  transition: width 0.25s ease;
}

.project-item:hover h2 a::after {
  width: 100%;
}

.project-item:hover h2 a {
  color: var(--link-hover);
}
/* ============================================================
   HOME VIEWPORT PROFILES
   ============================================================ */
.home-text {
  max-width: 280px;
  text-align: left;
}

.home-text p {
  font-size: 18px;
  font-weight: 300;
  line-height: 1.9;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

/* ============================================================
   INFO COLUMNS
   ============================================================ */
.info-columns {
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: 100%;
  max-width: 520px;
  text-align: right;
}

.info-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-links a {
  font-size: 12px;
  color: var(--text-secondary);
}

.info-links a:hover {
  color: var(--link-hover);
}

.info-awards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-awards li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.award-title {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
}

.award-year {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ============================================================
   RESPONSIVE DESIGN SYSTEM OVERRIDES
   ============================================================ */
@media (max-width: 960px) {
  .header-live-datetime {
    display: none; 
  }
}

@media (max-width: 768px) {
  :root {
    --content-pad: 28px;
    --header-h: 50px;
  }

  .nav-toggle-btn {
    display: flex; 
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    transform: translateX(-100%); 
    box-shadow: 20px 0 40px rgba(0, 0, 0, 0.15);
    padding-top: calc(var(--header-h) + 40px);
  }

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

  .site-logo-container { height: 20px; }
  .site-header { padding: 0 16px; top: 10px; left: 10px; right: 10px; }
  .section { padding: calc(var(--header-h) + 30px) var(--content-pad) var(--content-pad); }
  .site-subtitle { display: none; }
  .home-text p { font-size: 15px; }
}

@media (max-width: 540px) {
  :root {
    --sidebar-w: 200px; 
    --content-pad: 20px;
  }
  .site-title { display: none; }
}