/* BASIC STYLES */
* {
  box-sizing: border-box;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:root {
  /* gradient */
  --bg-gradient-onyx: linear-gradient(
    to bottom right, 
    hsl(240, 1%, 25%) 3%, 
    hsl(0, 0%, 19%) 97%
  );
  --bg-gradient-jet: linear-gradient(
    to bottom right, 
    hsla(240, 1%, 18%, 0.251) 0%, 
    hsla(240, 2%, 11%, 0) 100%
  ), hsl(240, 2%, 13%);
  --bg-gradient-gray-1: linear-gradient(
    to bottom right, 
    hsl(0, 0%, 65%) 0%, 
    hsla(0, 0%, 65%, 0) 50%
  );
  --bg-gradient-gray-2: linear-gradient(
    135deg, 
    hsla(0, 0%, 65%, 0.251) 0%, 
    hsla(0, 0%, 65%, 0) 59.86%
  ), hsl(240, 2%, 13%);
  --border-gradient-onyx: linear-gradient(
    to bottom right, 
    hsl(0, 0%, 25%) 0%, 
    hsla(0, 0%, 25%, 0) 50%
  );
  --text-gradient-white: linear-gradient(
    to right, 
    hsl(0, 0%, 85%), 
    hsl(0, 0%, 85%)
  );

  /* solid */
  --jet: hsl(0, 0%, 22%);
  --onyx: hsl(240, 1%, 17%);
  --eerie-black-1: hsl(240, 2%, 13%);
  --eerie-black-2: hsl(240, 2%, 12%);
  --smoky-black: hsl(0, 0%, 7%);
  --white-1: hsl(0, 0%, 100%);
  --white-2: hsl(0, 0%, 98%);
  --orange-yellow-crayola: hsl(0, 0%, 85%);
  --vegas-gold: hsl(0, 0%, 85%);
  --light-gray: hsl(0, 0%, 84%);
  --light-gray-70: hsla(0, 0%, 84%, 0.7);
  --bittersweet-shimmer: hsl(0, 43%, 51%);

  /* typography */
  /* font-family */
  --ff-poppins: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;

  /* font-size */
  --fs-1: 24px;
  --fs-2: 18px;
  --fs-3: 17px;
  --fs-4: 16px;
  --fs-5: 15px;
  --fs-6: 14px;
  --fs-7: 13px;
  --fs-8: 11px;

  /* font-weight */
  --fw-300: 300;
  --fw-400: 400;
  --fw-500: 500;
  --fw-600: 600;

  /* shadow */
  --shadow-1: -4px 8px 24px hsla(0, 0%, 0%, 0.25);
  --shadow-2: 0 16px 30px hsla(0, 0%, 0%, 0.25);
  --shadow-3: 0 16px 40px hsla(0, 0%, 0%, 0.25);
  --shadow-4: 0 25px 50px hsla(0, 0%, 0%, 0.15);
  --shadow-5: 0 24px 80px hsla(0, 0%, 0%, 0.25);

  /* transition */
  --transition-1: 0.25s ease;
  --transition-2: 0.5s ease-in-out;
  --transition-theme: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* LANGUAGE TRANSITION ANIMATION - OPTIMIZED */
:root {
  --lang-transition-duration: 0.3s;
  --lang-transition-easing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Language transition overlay effect - optimized for GPU */
body::before {
  content: '';
  position: fixed;
  top: -100%;
  left: 0;
  width: 100%;
  height: 200%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.02) 30%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.02) 70%,
    transparent 100%
  );
  transition: opacity 0.15s ease;
  z-index: 9997;
  will-change: transform, opacity;
  transform: translateZ(0);
}

/* Animate during language transition */
html[data-lang-transitioning] body::before {
  opacity: 1;
  animation: langSweepDown var(--lang-transition-duration) var(--lang-transition-easing);
}

/* Language sweep animation - optimized for 60fps */
@keyframes langSweepDown {
  0% {
    transform: translateY(-100%) translateZ(0);
    opacity: 0;
  }
  25% {
    transform: translateY(-50%) translateZ(0);
    opacity: 1;
  }
  75% {
    transform: translateY(50%) translateZ(0);
    opacity: 1;
  }
  100% {
    transform: translateY(100%) translateZ(0);
    opacity: 0;
  }
}

/* Text content transition animations - optimized */
[data-lang-en], [data-lang-vi] {
  transition: transform var(--lang-transition-duration) var(--lang-transition-easing),
              opacity var(--lang-transition-duration) var(--lang-transition-easing);
  will-change: transform, opacity;
}

/* Language transitioning state for text elements */
html[data-lang-transitioning] [data-lang-en],
html[data-lang-transitioning] [data-lang-vi] {
  animation: textFadeSlide var(--lang-transition-duration) var(--lang-transition-easing);
}

/* Special animation for headings during language change */
html[data-lang-transitioning] h1[data-lang-en],
html[data-lang-transitioning] h1[data-lang-vi],
html[data-lang-transitioning] h2[data-lang-en],
html[data-lang-transitioning] h2[data-lang-vi],
html[data-lang-transitioning] h3[data-lang-en],
html[data-lang-transitioning] h3[data-lang-vi] {
  animation: headingTypewriter var(--lang-transition-duration) var(--lang-transition-easing);
}

@keyframes textFadeSlide {
  0% {
    transform: translateY(0px) translateZ(0);
    opacity: 1;
  }
  50% {
    transform: translateY(-2px) translateZ(0);
    opacity: 0.5;
  }
  100% {
    transform: translateY(0px) translateZ(0);
    opacity: 1;
  }
}

@keyframes headingTypewriter {
  0% {
    transform: translateX(0px) translateZ(0);
    opacity: 1;
  }
  50% {
    transform: translateX(-1px) translateZ(0);
    opacity: 0.6;
  }
  100% {
    transform: translateX(0px) translateZ(0);
    opacity: 1;
  }
}

/* Language button special animation */
html[data-lang-transitioning] .lang-btn {
  animation: langButtonBounce var(--lang-transition-duration) var(--lang-transition-easing);
}

html[data-lang-transitioning] .lang-btn.active {
  animation: langButtonActivate var(--lang-transition-duration) var(--lang-transition-easing);
}

@keyframes langButtonBounce {
  0% {
    transform: scale(1) rotate(0deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  30% {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  }
  60% {
    transform: scale(1.1) rotate(-1deg);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
  }
  80% {
    transform: scale(1.03) rotate(1deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  }
  100% {
    transform: scale(1) rotate(0deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
}

@keyframes langButtonActivate {
  0% {
    transform: scale(1) rotate(0deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    filter: brightness(1);
  }
  25% {
    transform: scale(1.15) rotate(3deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
  }
  50% {
    transform: scale(1.2) rotate(-2deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    filter: brightness(1.15);
  }
  75% {
    transform: scale(1.1) rotate(1deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
  }
  100% {
    transform: scale(1) rotate(0deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    filter: brightness(1);
  }
}

/* Subtle page content shift during language transition */
html[data-lang-transitioning] .sidebar,
html[data-lang-transitioning] article {
  animation: contentSlideShift var(--lang-transition-duration) var(--lang-transition-easing);
}

@keyframes contentSlideShift {
  0% {
    transform: translateX(0px);
    opacity: 1;
  }
  25% {
    transform: translateX(-3px);
    opacity: 0.95;
  }
  50% {
    transform: translateX(-5px);
    opacity: 0.9;
  }
  75% {
    transform: translateX(-3px);
    opacity: 0.95;
  }
  100% {
    transform: translateX(0px);
    opacity: 1;
  }
}

/* THEME TRANSITION ANIMATION */
:root {
  --theme-transition-duration: 0.8s;
  --theme-transition-easing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Smooth transitions for all theme-related properties */
*,
*::before,
*::after {
  transition: 
    background var(--theme-transition-duration) var(--theme-transition-easing),
    background-color var(--theme-transition-duration) var(--theme-transition-easing),
    background-image var(--theme-transition-duration) var(--theme-transition-easing),
    border-color var(--theme-transition-duration) var(--theme-transition-easing),
    color var(--theme-transition-duration) var(--theme-transition-easing),
    box-shadow var(--theme-transition-duration) var(--theme-transition-easing),
    fill var(--theme-transition-duration) var(--theme-transition-easing),
    stroke var(--theme-transition-duration) var(--theme-transition-easing);
}

/* Preserve text visibility and cursor interaction during transitions */
*:not(input):not(textarea):not(select) {
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Create an elegant gradient sweep transition overlay */
html::before {
  content: '';
  position: fixed;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    120deg,
    transparent 0%,
    transparent 35%,
    rgba(255, 255, 255, 0.03) 45%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.03) 55%,
    transparent 65%,
    transparent 100%
  );
  transition: opacity 0.2s var(--theme-transition-easing);
  z-index: 9999;
}

/* Add a secondary shimmer effect */
html::after {
  content: '';
  position: fixed;
  top: 0;
  left: -100%;
  width: 300%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.01) 4px,
    rgba(255, 255, 255, 0.02) 6px,
    transparent 8px,
    transparent 20px
  );
  z-index: 9998;
}

/* Animate both overlays during theme transition */
html[data-theme-transitioning]::before {
  opacity: 1;
  animation: gradientSweep var(--theme-transition-duration) var(--theme-transition-easing);
}

html[data-theme-transitioning]::after {
  opacity: 1;
  animation: shimmerLines var(--theme-transition-duration) var(--theme-transition-easing) 0.1s;
}

/* Animate the gradient sweep during theme transition */
html[data-theme-transitioning]::before {
  opacity: 1;
  animation: gradientSweep var(--theme-transition-duration) var(--theme-transition-easing);
}

/* Elegant gradient sweep animation */
@keyframes gradientSweep {
  0% {
    left: -100%;
    opacity: 0;
    background: linear-gradient(
      120deg,
      transparent 0%,
      transparent 35%,
      rgba(255, 255, 255, 0.02) 45%,
      rgba(255, 255, 255, 0.06) 50%,
      rgba(255, 255, 255, 0.02) 55%,
      transparent 65%,
      transparent 100%
    );
  }
  15% {
    left: -80%;
    opacity: 1;
    background: linear-gradient(
      120deg,
      transparent 0%,
      transparent 30%,
      rgba(255, 255, 255, 0.04) 40%,
      rgba(255, 255, 255, 0.1) 50%,
      rgba(255, 255, 255, 0.04) 60%,
      transparent 70%,
      transparent 100%
    );
  }
  50% {
    left: -20%;
    opacity: 1;
    background: linear-gradient(
      120deg,
      transparent 0%,
      transparent 25%,
      rgba(255, 255, 255, 0.06) 35%,
      rgba(255, 255, 255, 0.12) 50%,
      rgba(255, 255, 255, 0.06) 65%,
      transparent 75%,
      transparent 100%
    );
  }
  85% {
    left: 50%;
    opacity: 0.8;
    background: linear-gradient(
      120deg,
      transparent 0%,
      transparent 35%,
      rgba(255, 255, 255, 0.03) 45%,
      rgba(255, 255, 255, 0.08) 50%,
      rgba(255, 255, 255, 0.03) 55%,
      transparent 65%,
      transparent 100%
    );
  }
  100% {
    left: 100%;
    opacity: 0;
  }
}

/* Shimmer lines animation for extra sparkle */
@keyframes shimmerLines {
  0% {
    left: -100%;
    opacity: 0;
    transform: skewX(-15deg);
  }
  20% {
    left: -60%;
    opacity: 0.6;
    transform: skewX(-10deg);
  }
  60% {
    left: 20%;
    opacity: 0.8;
    transform: skewX(-5deg);
  }
  85% {
    left: 80%;
    opacity: 0.4;
    transform: skewX(-2deg);
  }
  100% {
    left: 100%;
    opacity: 0;
    transform: skewX(0deg);
  }
}

/* Sophisticated depth transition with layered perspective */
html[data-theme-transitioning] {
  animation: depthTransition var(--theme-transition-duration) var(--theme-transition-easing);
}

@keyframes depthTransition {
  0% {
    transform: perspective(1000px) rotateX(0deg) scale(1);
  }
  25% {
    transform: perspective(1000px) rotateX(0.5deg) scale(1.002);
  }
  50% {
    transform: perspective(1000px) rotateX(1deg) scale(1.005);
  }
  75% {
    transform: perspective(1000px) rotateX(0.5deg) scale(1.002);
  }
  100% {
    transform: perspective(1000px) rotateX(0deg) scale(1);
  }
}

/* Add subtle stagger effect with floating and scaling animations */
html[data-theme-transitioning] .sidebar {
  animation: floatingScale var(--theme-transition-duration) var(--theme-transition-easing) 0.05s both;
}

html[data-theme-transitioning] article {
  animation: floatingScale var(--theme-transition-duration) var(--theme-transition-easing) 0.1s both;
}

html[data-theme-transitioning] .icon-box {
  animation: iconBoxFloat var(--theme-transition-duration) var(--theme-transition-easing) 0.15s both;
}

html[data-theme-transitioning] .social-link {
  animation: socialLinkFloat var(--theme-transition-duration) var(--theme-transition-easing) 0.2s both;
}

/* Elegant floating scale animation for main containers */
@keyframes floatingScale {
  0% {
    transform: translateY(0px) scale(1) rotateX(0deg);
    opacity: 1;
    box-shadow: var(--shadow-1);
  }
  20% {
    transform: translateY(-3px) scale(1.01) rotateX(1deg);
    opacity: 0.95;
    box-shadow: 0 8px 32px hsla(0, 0%, 0%, 0.15), var(--shadow-1);
  }
  50% {
    transform: translateY(-6px) scale(1.02) rotateX(2deg);
    opacity: 0.9;
    box-shadow: 0 16px 48px hsla(0, 0%, 0%, 0.2), var(--shadow-1);
  }
  80% {
    transform: translateY(-3px) scale(1.01) rotateX(1deg);
    opacity: 0.95;
    box-shadow: 0 8px 32px hsla(0, 0%, 0%, 0.15), var(--shadow-1);
  }
  100% {
    transform: translateY(0px) scale(1) rotateX(0deg);
    opacity: 1;
    box-shadow: var(--shadow-1);
  }
}

/* Special animation for icon boxes with rotation */
@keyframes iconBoxFloat {
  0% {
    transform: translateY(0px) scale(1) rotate(0deg);
    opacity: 1;
  }
  25% {
    transform: translateY(-2px) scale(1.05) rotate(2deg);
    opacity: 0.9;
  }
  50% {
    transform: translateY(-4px) scale(1.08) rotate(4deg);
    opacity: 0.8;
  }
  75% {
    transform: translateY(-2px) scale(1.05) rotate(2deg);
    opacity: 0.9;
  }
  100% {
    transform: translateY(0px) scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Subtle wave animation for social links */
@keyframes socialLinkFloat {
  0% {
    transform: translateX(0px) translateY(0px) scale(1);
    opacity: 1;
  }
  25% {
    transform: translateX(1px) translateY(-1px) scale(1.02);
    opacity: 0.95;
  }
  50% {
    transform: translateX(2px) translateY(-2px) scale(1.05);
    opacity: 0.9;
  }
  75% {
    transform: translateX(1px) translateY(-1px) scale(1.02);
    opacity: 0.95;
  }
  100% {
    transform: translateX(0px) translateY(0px) scale(1);
    opacity: 1;
  }
}

/* Ensure icons and text remain crisp during transition */
ion-icon,
.icon,
h1, h2, h3, h4, h5, h6,
p, span, a, button {
  will-change: color;
  transform: translateZ(0);
}

/* Smooth morphing for gradients and complex backgrounds */
.sidebar,
article,
.icon-box,
.social-link,
.theme-toggle-btn,
.pdf-download-btn,
.lang-btn {
  will-change: background, background-color, border-color, box-shadow;
  transform: translateZ(0);
}

/* Special animation for the theme toggle button during transition */
html[data-theme-transitioning] .theme-toggle-btn {
  animation: themeButtonMorph var(--theme-transition-duration) var(--theme-transition-easing);
}

@keyframes themeButtonMorph {
  0% {
    transform: scale(1) rotate(0deg);
    box-shadow: 
      0 0 0 0 rgba(255, 255, 255, 0.1),
      0 4px 8px rgba(0, 0, 0, 0.1);
    filter: brightness(1) saturate(1);
  }
  15% {
    transform: scale(1.1) rotate(45deg);
    box-shadow: 
      0 0 0 4px rgba(255, 255, 255, 0.08),
      0 8px 16px rgba(0, 0, 0, 0.15);
    filter: brightness(1.1) saturate(1.2);
  }
  35% {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 
      0 0 0 8px rgba(255, 255, 255, 0.06),
      0 12px 24px rgba(0, 0, 0, 0.2);
    filter: brightness(1.15) saturate(1.4);
  }
  50% {
    transform: scale(1.2) rotate(180deg);
    box-shadow: 
      0 0 0 12px rgba(255, 255, 255, 0.04),
      0 16px 32px rgba(0, 0, 0, 0.25);
    filter: brightness(1.2) saturate(1.5);
  }
  65% {
    transform: scale(1.15) rotate(270deg);
    box-shadow: 
      0 0 0 8px rgba(255, 255, 255, 0.06),
      0 12px 24px rgba(0, 0, 0, 0.2);
    filter: brightness(1.15) saturate(1.4);
  }
  85% {
    transform: scale(1.1) rotate(315deg);
    box-shadow: 
      0 0 0 4px rgba(255, 255, 255, 0.08),
      0 8px 16px rgba(0, 0, 0, 0.15);
    filter: brightness(1.1) saturate(1.2);
  }
  100% {
    transform: scale(1) rotate(360deg);
    box-shadow: 
      0 0 0 0 rgba(255, 255, 255, 0),
      0 4px 8px rgba(0, 0, 0, 0.1);
    filter: brightness(1) saturate(1);
  }
}

/* Enhanced icon transformation with prismatic effect */
html[data-theme-transitioning] .theme-toggle-btn ion-icon {
  animation: iconPrismaticSpin var(--theme-transition-duration) var(--theme-transition-easing);
}

@keyframes iconPrismaticSpin {
  0% {
    transform: rotate(0deg) scale(1);
    opacity: 1;
    filter: hue-rotate(0deg) brightness(1) contrast(1);
  }
  20% {
    transform: rotate(72deg) scale(0.9);
    opacity: 0.8;
    filter: hue-rotate(30deg) brightness(1.1) contrast(1.1);
  }
  40% {
    transform: rotate(144deg) scale(0.8);
    opacity: 0.6;
    filter: hue-rotate(60deg) brightness(1.2) contrast(1.2);
  }
  60% {
    transform: rotate(216deg) scale(0.8);
    opacity: 0.6;
    filter: hue-rotate(90deg) brightness(1.2) contrast(1.2);
  }
  80% {
    transform: rotate(288deg) scale(0.9);
    opacity: 0.8;
    filter: hue-rotate(30deg) brightness(1.1) contrast(1.1);
  }
  100% {
    transform: rotate(360deg) scale(1);
    opacity: 1;
    filter: hue-rotate(0deg) brightness(1) contrast(1);
  }
}

/* Light Mode Variables */
[data-theme="light"] {
  /* gradient */
  --bg-gradient-onyx: linear-gradient(
    to bottom right, 
    hsl(0, 0%, 95%) 3%, 
    hsl(0, 0%, 90%) 97%
  );
  --bg-gradient-jet: linear-gradient(
    to bottom right, 
    hsla(0, 0%, 100%, 0.8) 0%, 
    hsla(0, 0%, 95%, 0.5) 100%
  ), hsl(0, 0%, 98%);
  --bg-gradient-gray-1: linear-gradient(
    to bottom right, 
    hsl(0, 0%, 20%) 0%, 
    hsla(0, 0%, 20%, 0) 50%
  );
  --bg-gradient-gray-2: linear-gradient(
    135deg, 
    hsla(0, 0%, 25%, 0.8) 0%, 
    hsla(0, 0%, 25%, 0) 59.86%
  ), hsl(0, 0%, 15%);
  --border-gradient-onyx: linear-gradient(
    to bottom right, 
    hsl(0, 0%, 70%) 0%, 
    hsla(0, 0%, 70%, 0) 50%
  );
  --text-gradient-white: linear-gradient(
    to right, 
    hsl(0, 0%, 15%), 
    hsl(0, 0%, 15%)
  );

  /* solid colors */
  --jet: hsl(0, 0%, 75%);
  --onyx: hsl(0, 0%, 95%);
  --eerie-black-1: hsl(0, 0%, 98%);
  --eerie-black-2: hsl(0, 0%, 100%);
  --smoky-black: hsl(0, 0%, 98%);
  --white-1: hsl(0, 0%, 10%);
  --white-2: hsl(0, 0%, 15%);
  --orange-yellow-crayola: hsl(0, 0%, 20%);
  --vegas-gold: hsl(0, 0%, 20%);
  --light-gray: hsl(0, 0%, 35%);
  --light-gray-70: hsla(0, 0%, 35%, 0.7);

  /* Special adjustments for light mode */
  --shadow-1: -4px 8px 24px hsla(0, 0%, 0%, 0.1);
  --shadow-2: 0 16px 30px hsla(0, 0%, 0%, 0.1);
  --shadow-3: 0 16px 40px hsla(0, 0%, 0%, 0.1);
  --shadow-4: 0 25px 50px hsla(0, 0%, 0%, 0.08);
  --shadow-5: 0 24px 80px hsla(0, 0%, 0%, 0.1);
}

/* Light mode specific icon adjustments */
[data-theme="light"] .icon-box {
  color: hsl(0, 0%, 25%);
  background: linear-gradient(
    to bottom right, 
    hsl(0, 0%, 80%) 0%, 
    hsl(0, 0%, 70%) 100%
  );
}

[data-theme="light"] .icon-box::before {
  background: hsl(0, 0%, 95%);
}

[data-theme="light"] .social-link {
  color: hsl(0, 0%, 40%) !important;
}

[data-theme="light"] .social-link:hover {
  color: hsl(0, 0%, 20%) !important;
}

[data-theme="light"] .social-link i {
  color: hsl(0, 0%, 40%) !important;
}

[data-theme="light"] .social-link:hover i {
  color: hsl(0, 0%, 20%) !important;
}

[data-theme="light"] .pdf-download-btn ion-icon,
[data-theme="light"] .theme-toggle-btn ion-icon {
  color: hsl(0, 0%, 25%);
}

[data-theme="light"] .info_more-btn {
  color: hsl(0, 0%, 25%);
}

/* Light mode hover adjustments */
[data-theme="light"] .pdf-download-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: hsl(0, 0%, 20%);
}

[data-theme="light"] .pdf-download-btn:hover::before {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .pdf-lang-option:hover {
  background: rgba(0, 0, 0, 0.08);
  color: hsl(0, 0%, 10%);
}

[data-theme="light"] .theme-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: hsl(0, 0%, 20%);
}

[data-theme="light"] .theme-toggle-btn:hover::before {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .lang-btn:hover {
  color: hsl(0, 0%, 20%);
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .lang-btn.active {
  background: rgba(0, 0, 0, 0.15);
  color: hsl(0, 0%, 10%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .lang-btn.active::before {
  background: rgba(0, 0, 0, 0.05);
}

/* Light mode scrollbar adjustments */
[data-theme="light"] .has-scrollbar::-webkit-scrollbar-track {
  background: hsl(0, 0%, 85%);
}

[data-theme="light"] .has-scrollbar::-webkit-scrollbar-thumb {
  background: hsl(0, 0%, 45%);
}

[data-theme="light"] body::-webkit-scrollbar-track {
  background: hsl(0, 0%, 95%);
}

[data-theme="light"] body::-webkit-scrollbar-thumb {
  border: 5px solid hsl(0, 0%, 95%);
  background: hsla(0, 0%, 0%, 0.2);
  border-radius: 20px;
  box-shadow: inset 1px 1px 0 hsla(0, 0%, 0%, 0.1),
              inset -1px -1px 0 hsla(0, 0%, 0%, 0.1);
}

[data-theme="light"] body::-webkit-scrollbar-thumb:hover {
  background: hsla(0, 0%, 0%, 0.3);
}

/* RESET */

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

a { text-decoration: none; }

li { list-style: none; }

img, ion-icon, a, button, time, span { display: block; }

button {
  font: inherit;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}

input, textarea {
  display: block;
  width: 100%;
  background: none;
  font: inherit;
}

::selection {
  background: hsl(0, 0%, 85%);
  color: var(--smoky-black);
}

:focus { outline-color: hsl(0, 0%, 85%); }

html { font-family: var(--ff-poppins); }

body { 
  background: var(--smoky-black);
  /* Remove individual transition as it's handled by the global theme transition system */
}





/* REUSED STYLE */

.sidebar,
article {
  background: var(--eerie-black-2);
  border: 1px solid var(--jet);
  border-radius: 20px;
  padding: 15px;
  box-shadow: var(--shadow-1);
  z-index: 1;
}

.separator {
  width: 100%;
  height: 1px;
  background: var(--jet);
  margin: 16px 0;
}

.icon-box {
  position: relative;
  background: var(--border-gradient-onyx);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  color: hsl(0, 0%, 85%);
  box-shadow: var(--shadow-1);
  z-index: 1;
}

.icon-box::before {
  content: "";
  position: absolute;
  inset: 1px;
  background: var(--eerie-black-1);
  border-radius: inherit;
  z-index: -1;
}

.icon-box ion-icon { --ionicon-stroke-width: 35px; }

article { display: none; }

article.active {
  display: block;
  animation: fade 0.5s ease backwards;
}

@keyframes fade {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.h2,
.h3,
.h4,
.h5 {
  color: var(--white-2);
  text-transform: capitalize;
}

.h2 { font-size: var(--fs-1); }

.h3 { font-size: var(--fs-2); }

.h4 { font-size: var(--fs-4); }

.h5 {
  font-size: var(--fs-7);
  font-weight: var(--fw-500);
}

.article-title {
  position: relative;
  padding-bottom: 7px;
  text-transform: none;
}

.article-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 30px;
  height: 3px;
  background: var(--text-gradient-white);
  border-radius: 3px;
}

.has-scrollbar::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.has-scrollbar::-webkit-scrollbar-track {
  background: var(--onyx);
  border-radius: 5px;
}

.has-scrollbar::-webkit-scrollbar-thumb {
  background: hsl(0, 0%, 85%);
  border-radius: 5px;
}

.has-scrollbar::-webkit-scrollbar-button { width: 20px; }

.content-card {
  position: relative;
  background: var(--border-gradient-onyx);
  padding: 15px;
  padding-top: 45px;
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  cursor: pointer;
  z-index: 1;
}

.content-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  background: var(--bg-gradient-jet);
  border-radius: inherit;
  z-index: -1;
}





/* MAIN */

main {
  margin: 15px 12px;
  margin-bottom: 75px;
  min-width: 259px;
}





/* SIDEBAR */

.sidebar {
  margin-bottom: 15px;
  max-height: 112px;
  overflow: hidden;
  transition: var(--transition-2);
}

.sidebar.active { max-height: 405px; }

.sidebar-info {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0px;
  min-height: 70px; /* Base minimum height for consistent centering */
}

.info-content {
  text-align: center;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center; /* Vertical centering for content */
}

.info-content .name {
  color: var(--white-2);
  font-size: var(--fs-1);
  font-weight: var(--fw-500);
  letter-spacing: -0.25px;
  margin: 0;
  padding: 0;
  line-height: 1.2;
}

.info-content .title {
  color: var(--white-1);
  background: var(--onyx);
  font-size: var(--fs-8);
  font-weight: var(--fw-300);
  width: max-content;
  padding: 3px 12px;
  border-radius: 8px;
}

.info_more-btn {
  position: absolute;
  top: -15px;
  right: -15px;
  border-radius: 0 15px;
  font-size: 13px;
  color: hsl(0, 0%, 85%);
  background: var(--border-gradient-onyx);
  padding: 10px;
  box-shadow: var(--shadow-2);
  transition: var(--transition-1);
  z-index: 1;
}

.info_more-btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: var(--bg-gradient-jet);
  transition: var(--transition-1);
  z-index: -1;
}

.info_more-btn:hover,
.info_more-btn:focus { background: var(--bg-gradient-gray-1); }

.info_more-btn:hover::before,
.info_more-btn:focus::before { background: var(--bg-gradient-gray-2); }

.info_more-btn span { 
  display: block;
  font-size: var(--fs-8);
}

.info_more-btn ion-icon { display: none; }

.sidebar-info_more {
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-2);
}

.sidebar.active .sidebar-info_more {
  opacity: 1;
  visibility: visible;
}

.contacts-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.contact-item {
  min-width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.contact-info {
  max-width: calc(100% - 46px);
  width: calc(100% - 46px);
}

.contact-title {
  color: var(--light-gray-70);
  font-size: var(--fs-8);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.contact-info :is(.contact-link, time, address) {
  color: var(--white-2);
  font-size: var(--fs-7);
}

.contact-info address { font-style: normal; }

/* Contact copyable functionality */
.contact-copyable-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-copyable {
  color: var(--white-2);
  font-size: var(--fs-7);
  cursor: pointer;
  transition: var(--transition-1);
  position: relative;
  user-select: none;
  outline: none;
  border-radius: 2px;
  padding: 1px 2px;
}

.contact-copyable:hover {
  color: var(--orange-yellow-crayola);
}

.contact-copyable:focus-visible {
  outline: 2px solid var(--orange-yellow-crayola);
  outline-offset: 2px;
}

/* Tooltip for desktop */
.contact-copyable::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--jet);
  color: var(--white-2);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: var(--fs-8);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-1);
  z-index: 100;
  pointer-events: none;
  border: 1px solid var(--light-gray-70);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.contact-copyable::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--jet);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-1);
  z-index: 101;
  pointer-events: none;
}

.contact-copyable:hover::after,
.contact-copyable:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Copy button for mobile */
.copy-btn {
  background: transparent;
  border: none;
  color: var(--light-gray-70);
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-1);
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  position: relative;
  outline: none;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: scale(1.05);
}

.copy-btn:active {
  transform: scale(0.95);
}

.copy-btn:focus-visible {
  outline: 2px solid var(--light-gray-70);
  outline-offset: 2px;
}

.copy-btn ion-icon {
  font-size: 16px;
  transition: var(--transition-1);
}

/* Copied state */
.contact-copyable.copied::after {
  content: 'Copied!';
  opacity: 1;
  visibility: visible;
}

.contact-copyable.copied::before {
  opacity: 1;
  visibility: visible;
}

.social-list {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  padding-bottom: 4px;
  padding-left: 7px;
}

.social-item .social-link {
  color: var(--light-gray-70);
  font-size: 18px;
}

/* Font Awesome icons in social links */
.social-item .social-link i {
  font-size: 18px;
  transition: var(--transition-1);
}

.social-item .social-link:hover { color: var(--light-gray); }









/* ABOUT */

.about .article-title { margin-bottom: 15px; }

.about-text {
  color: var(--light-gray);
  font-size: var(--fs-6);
  font-weight: var(--fw-300);
  line-height: 1.6;
}

.about-text p { margin-bottom: 15px; }




/* RESUME */

.article-title { margin-bottom: 30px; }


/* education and experience */

.timeline { margin-bottom: 30px; }

.timeline .title-wrapper {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  width: fit-content;
}

.timeline-list {
  font-size: var(--fs-6);
  margin-left: 45px;
}

.timeline-item { position: relative; }

.timeline-item:not(:last-child) { margin-bottom: 25px; }

.timeline-item-title {
  font-size: var(--fs-5);
  line-height: 1.3;
  margin-bottom: 5px;
  text-transform: none;
}

.timeline-item-title a {
  color: var(--white-2);
  text-decoration: none;
  transition: var(--transition-1);
}

.timeline-item-title a:hover {
  color: var(--vegas-gold);
}

.timeline-list span {
  color: var(--vegas-gold);
  font-weight: var(--fw-400);
  line-height: 1.4;
  display: block;
  margin-bottom: 8px;
}

.timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  top: -22px;
  left: -30px;
  width: 1px;
  height: calc(100% + 55px);
  background: var(--jet);
}

.timeline-item::after {
  content: "";
  position: absolute;
  top: 7px;
  left: -33px;
  height: 6px;
  width: 6px;
  background: var(--text-gradient-white);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--jet);
}

.timeline-text {
  color: var(--light-gray);
  font-weight: var(--fw-300);
  line-height: 1.6;
  margin-bottom: 3px;
}

.timeline-text:last-child {
  margin-bottom: 0;
}

/* Fix for timeline flex alignment - ensure date stays on first line of wrapped titles */
.timeline-item div[style*="align-items: baseline"] {
  align-items: baseline !important;
  flex-wrap: nowrap !important;
}

/* Force start alignment for all timeline flex containers with maximum specificity */
.timeline-item > div[style*="display: flex"][style*="justify-content: space-between"][style*="align-items: baseline"] {
  align-items: baseline !important;
  flex-wrap: nowrap !important;
}


/* skills */

.skills-title { margin-bottom: 20px; }

.skills-list { padding: 20px; }


.skills-item:not(:last-child) { margin-bottom: 15px; }

.skill .title-wrapper {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
}

.skill .title-wrapper data {
  color: var(--light-gray);
  font-size: var(--fs-7);
  font-weight: var(--fw-300);
}

.skill-progress-bg {
  background: var(--jet);
  width: 100%;
  height: 8px;
  border-radius: 10px;
}

.skill-progress-fill {
  background: var(--text-gradient-white);
  height: 100%;
  border-radius: inherit;
}





/* LANGUAGE TOGGLE */

.header-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.language-toggle {
  display: flex;
  background: var(--border-gradient-onyx);
  border-radius: 10px;
  padding: 2px;
  box-shadow: var(--shadow-2);
  position: relative;
}

.language-toggle::before {
  content: "";
  position: absolute;
  inset: 1px;
  background: var(--bg-gradient-jet);
  border-radius: inherit;
  z-index: -1;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--light-gray-70);
  font-family: var(--ff-poppins);
  font-size: var(--fs-8);
  font-weight: var(--fw-500);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-1);
  position: relative;
  min-width: 32px;
  text-transform: uppercase;
}

.lang-btn:hover {
  color: var(--orange-yellow-crayola);
  background: rgba(255, 255, 255, 0.06);
}

.lang-btn.active {
  background: var(--bg-gradient-gray-2);
  color: var(--white-1);
  box-shadow: var(--shadow-1);
}

.lang-btn.active::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--text-gradient-white);
  border-radius: inherit;
  opacity: 0.1;
}

/* PDF Download Styles */
.pdf-download-container {
  position: relative;
}

.pdf-download-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--border-gradient-onyx);
  color: var(--white-2);
  border: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-family: var(--ff-poppins);
  font-size: var(--fs-8);
  font-weight: var(--fw-500);
  cursor: pointer;
  transition: var(--transition-1);
  position: relative;
  box-shadow: var(--shadow-2);
  white-space: nowrap;
}

.pdf-download-btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  background: var(--bg-gradient-jet);
  border-radius: inherit;
  z-index: -1;
  transition: var(--transition-1);
}

.pdf-download-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--orange-yellow-crayola);
}

.pdf-download-btn:hover::before {
  background: rgba(255, 255, 255, 0.05);
}

.pdf-download-btn ion-icon {
  font-size: 16px;
}

.pdf-language-selector {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background: var(--border-gradient-onyx);
  border-radius: 10px;
  padding: 4px;
  box-shadow: var(--shadow-3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition-1);
  z-index: 9900;
  min-width: 140px;
  pointer-events: none;
}

.pdf-language-selector::before {
  content: "";
  position: absolute;
  inset: 1px;
  background: var(--bg-gradient-jet);
  border-radius: inherit;
  z-index: -1;
}

/* Bridge element to prevent dropdown from closing */
.pdf-language-selector::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 5px;
  background: transparent;
}

.pdf-language-selector.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.pdf-lang-option {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--light-gray);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--ff-poppins);
  font-size: var(--fs-8);
  font-weight: var(--fw-400);
  cursor: pointer;
  transition: var(--transition-1);
  text-align: left;
}

.pdf-lang-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white-2);
}

.pdf-lang-option:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.98);
}

/* Theme Toggle Styles */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-gradient-onyx);
  color: var(--white-2);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 24px; /* 60% of 40px = 24px for icon */
  cursor: pointer;
  transition: var(--transition-1);
  position: relative;
  box-shadow: var(--shadow-2);
}

.theme-toggle-btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  background: var(--bg-gradient-jet);
  border-radius: inherit;
  z-index: -1;
  transition: var(--transition-1);
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--orange-yellow-crayola);
  transform: scale(1.05);
}

.theme-toggle-btn:hover::before {
  background: rgba(255, 255, 255, 0.05);
}

.theme-toggle-btn ion-icon {
  transition: var(--transition-1);
  pointer-events: none;
  width: 60%;
  height: 60%;
  font-size: inherit;
  --ionicon-width: 60%;
  --ionicon-height: 60%;
  display: block;
  aspect-ratio: 1/1;
}

.theme-toggle-btn:hover ion-icon {
  transform: rotate(15deg);
}

/* Disable all tooltips on ion-icons */
.theme-toggle-btn ion-icon::before,
.theme-toggle-btn ion-icon::after,
.social-link ion-icon::before,
.social-link ion-icon::after {
  display: none !important;
}

.theme-toggle-btn ion-icon[title],
.social-link ion-icon {
  pointer-events: none;
}

/* Theme transition */
* {
  transition: background-color var(--transition-1), 
              color var(--transition-1), 
              border-color var(--transition-1),
              box-shadow var(--transition-1) !important;
}





/* RESPONSIVE */

/* responsive smaller than 320px screen (very small devices) */
@media (max-width: 320px) {
  main {
    margin: 8px 6px;
    margin-bottom: 50px;
  }
  
  .sidebar {
    max-height: 70px; /* Even smaller for very small screens */
    margin-bottom: 10px;
  }
  
  .sidebar.active { 
    max-height: 350px; 
  }
  
  .sidebar-info {
    gap: 6px;
    padding: 12px;
  }
  
  .sidebar, article {
    padding: 15px;
  }
  
  .timeline-item-title {
    font-size: var(--fs-6);
    line-height: 1.3;
  }
  
  /* Ensure timeline dates stay on same line as title for very small screens */
  .timeline-item div[style*="display: flex"] {
    flex-wrap: nowrap !important;
    align-items: baseline !important;
  }
  
  .timeline-item .timeline-item-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    margin-right: 6px;
  }
  
  .timeline-item span[style*="white-space: nowrap"] {
    flex-shrink: 0;
    font-size: var(--fs-8) !important;
    margin-left: 6px !important;
  }
  
  .contact-info {
    max-width: calc(100% - 40px);
  }
  
  .header-controls {
    gap: 6px;
  }
  
  .lang-btn, .theme-toggle-btn, .pdf-download-btn {
    padding: 6px 8px;
    font-size: var(--fs-8);
    min-height: 44px; /* Ensure minimum touch target size */
    min-width: 44px;
  }
  
  .theme-toggle-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 26px; /* 60% of 44px ≈ 26px for icon */
  }
  
  .theme-toggle-btn ion-icon {
    width: 60%;
    height: 60%;
    font-size: inherit;
    --ionicon-width: 60%;
    --ionicon-height: 60%;
  }
  
  /* Improve link touch targets */
  .timeline-item-title a {
    display: block;
    padding: 4px 0;
    min-height: 44px;
    line-height: 1.3;
  }
  
  .info-content .name {
    font-size: var(--fs-1); /* Same as resume title */
    margin-bottom: 2px;
  }
  
  .info_more-btn {
    padding: 6px 10px;
    font-size: var(--fs-8);
  }
  
  .info_more-btn span {
    font-size: var(--fs-8);
  }
}

/* responsive smaller than 450px screen */

/* Timeline responsive improvements */
.timeline-item-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.timeline-item-title a {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  line-height: 1.4;
}

/* Force proper timeline layout - override inline styles */
.timeline-item div[style*="display: flex"] {
  display: flex !important;
  justify-content: space-between !important;
  align-items: baseline !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
}

.timeline-item div[style*="display: flex"] h4 {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  hyphens: auto !important;
  white-space: normal !important;
  overflow: hidden !important;
}

.timeline-item div[style*="display: flex"] h4 a {
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  hyphens: auto !important;
  line-height: 1.4 !important;
  display: block !important;
}

.timeline-item div[style*="display: flex"] span {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  text-align: right !important;
  margin-left: 8px !important;
  min-width: auto !important;
}

/* Legacy timeline items support (fallback for inline styles) */
.timeline-item div[style*="flex"] {
  display: flex !important;
  justify-content: space-between !important;
  align-items: baseline !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

.timeline-item div[style*="flex"] h4 {
  margin: 0 !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.timeline-item div[style*="flex"] span {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  font-size: var(--fs-7) !important;
  opacity: 0.8 !important;
  margin-left: 0 !important;
}

/* Center social icons in sidebar for small screens and adjust header for screens up to 450px */
@media (max-width: 450px) {
  /* Fix sidebar spacing on mobile */
  .sidebar {
    max-height: 90px; /* Optimized height for better vertical centering */
    margin-bottom: 15px;
  }
  
  .sidebar.active { 
    max-height: 380px; /* Adjust for mobile content */
  }
  
  .sidebar-info {
    gap: 8px; /* Reduce gap to minimize spacing */
    padding: 15px; /* Add padding for better touch targets */
    display: flex;
    justify-content: center;
    align-items: center; /* Ensure vertical centering */
    min-height: 60px; /* Minimum height for proper centering */
  }
  
  .info-content {
    text-align: left; /* Left align the name for mobile */
    flex: 1; /* Take available space */
  }
  
  .info-content .name {
    font-size: var(--fs-1); /* Same as resume title */
    line-height: 1.2; /* Tighter line height for better centering */
    margin-bottom: 2px; /* Minimal bottom margin */
  }
  
  .info_more-btn {
    position: relative; /* Change from absolute positioning */
    top: auto;
    right: auto;
    padding: 8px 12px;
    font-size: var(--fs-8);
    white-space: nowrap;
  }
  
  .info_more-btn span {
    font-size: var(--fs-8);
  }
  
  .timeline-item-title {
    font-size: var(--fs-6);
    line-height: 1.3;
  }
  
  .timeline-item-title a {
    font-size: var(--fs-6) !important;
    line-height: 1.3 !important;
  }
  
  /* Ensure timeline dates stay on same line as title */
  .timeline-item div[style*="display: flex"] {
    flex-wrap: nowrap !important;
    align-items: baseline !important;
  }
  
  .timeline-item .timeline-item-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    margin-right: 8px;
  }
  
  .timeline-item span[style*="white-space: nowrap"] {
    flex-shrink: 0;
    font-size: var(--fs-7) !important;
    margin-left: 8px !important;
  }
  
  /* LANGUAGE TOGGLE */
  .header-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .header-controls {
    align-self: flex-end;
    flex-direction: row;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .pdf-language-selector {
    right: auto;
    left: 0;
  }
  .social-list {
    justify-content: center !important;
  }
  
  /* Improve header controls spacing on mobile */
  .pdf-download-btn span {
    display: none; /* Hide text on very small screens */
  }
  
  .pdf-download-btn {
    min-width: auto;
    padding: 8px;
  }
  
  .theme-toggle-btn {
    padding: 8px;
    min-width: auto;
  }
  
  .lang-btn {
    padding: 6px 8px;
    font-size: var(--fs-8);
  }
  
  .language-toggle {
    min-width: fit-content;
  }
}

/* Additional responsive fix for extremely small screens */
@media (max-width: 280px) {
  .timeline-item span[style*="white-space: nowrap"] {
    font-size: calc(var(--fs-8) - 1px) !important;
    margin-left: 4px !important;
  }
  
  .timeline-item .timeline-item-title {
    margin-right: 4px;
  }
}

/* responsive larger than 450px screen */

@media (min-width: 451px) {
  /* Restore normal sidebar spacing for larger screens */
  .sidebar {
    max-height: 112px; /* Restore original height */
  }
  
  .sidebar.active { 
    max-height: 405px; /* Restore original expanded height */
  }
  
  .sidebar-info {
    gap: 15px; /* Restore larger gap */
    padding: 0; /* Remove mobile padding */
  }
  
  .info-content {
    text-align: center; /* Center alignment for larger screens */
  }
  
  .info-content .name {
    font-size: var(--fs-1); /* Restore original font size */
    margin-bottom: 10px; /* Restore original margin */
  }
  
  .info_more-btn {
    position: absolute; /* Restore absolute positioning */
    top: -15px;
    right: -15px;
    padding: 10px 15px;
  }
  
  /* client */
  .clients-item { min-width: calc(33.33% - 10px); }
  /* LANGUAGE TOGGLE */
  .header-wrapper {
    flex-direction: row;
    align-items: center;
  }
  .header-controls {
    align-self: auto;
    flex-direction: row;
    gap: 10px;
  }
  .pdf-language-selector {
    right: 0;
    left: auto;
  }
  
  /* Restore download button text */
  .pdf-download-btn span {
    display: inline;
  }
  
  .pdf-download-btn {
    padding: 10px 15px;
    white-space: nowrap;
  }
  
  /* Legacy timeline items medium screen support */
  .timeline-item div[style*="flex"] {
    flex-direction: row !important;
    align-items: baseline !important;
  }
  
  .timeline-item div[style*="flex"] span {
    font-size: var(--fs-7) !important;
    align-self: auto !important;
    margin-left: 12px !important;
  }
}

/* responsive larger than 640px screen (medium tablets) */
@media (min-width: 640px) {
  
  :root {
    --fs-1: 28px;
    --fs-2: 20px;
    --fs-3: 22px;
  }
  
  .sidebar, article {
    width: 600px;
    padding: 25px;
  }
  
  main {
    margin-top: 50px;
    margin-bottom: 80px;
  }
  
  .sidebar {
    max-height: 120px; /* Increased to accommodate balanced spacing */
    margin-bottom: 25px;
  }
  
  .sidebar.active { 
    max-height: 550px; 
  }
  
  .sidebar-info {
    min-height: 85px; /* Increased to accommodate the balanced spacing */
    display: flex;
    justify-content: center;
    align-items: center; /* Perfect vertical centering */
    padding: 10px 0; /* Add some vertical padding for better centering */
  }
  
  .info-content {
    text-align: center; /* Ensure center alignment */
  }
  
  .info-content .name {
    line-height: 1.2; /* Match mobile line height */
    margin-bottom: 25px; /* Add bottom space to balance the "Show Contact" button at top */
  }
  
  .header-controls {
    gap: 12px;
  }
  
  .lang-btn, .theme-toggle-btn, .pdf-download-btn {
    padding: 10px 14px;
    min-height: 48px;
    min-width: 48px;
  }
  
  .theme-toggle-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 29px; /* 60% of 48px ≈ 29px for icon */
  }
}

/* Landscape orientation optimizations */
@media (max-height: 500px) and (orientation: landscape) {
  main {
    margin-top: 20px;
    margin-bottom: 40px;
  }
  
  .sidebar {
    max-height: 80px;
    margin-bottom: 15px;
  }
  
  .sidebar.active {
    max-height: 300px;
  }
  
  .article-title {
    margin-bottom: 15px;
  }
  
  .timeline-list {
    margin-top: 15px;
  }
  
  /* iPad-specific fix: Ensure time/period aligns with first line of wrapped titles */
  .timeline-item div[style*="display: flex"][style*="align-items: baseline"] {
    flex-wrap: nowrap !important;
    align-items: baseline !important;
  }
  
  .timeline-item .timeline-item-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    margin-right: 8px;
  }
  
  .timeline-item div[style*="display: flex"] span[style*="white-space: nowrap"] {
    flex-shrink: 0;
    font-size: var(--fs-6) !important;
    margin-left: 8px !important;
  }
}

/* responsive larger than 580px screen */

@media (min-width: 580px) {

  /* CUSTOM PROPERTY */

  :root {
    /* typography */
    --fs-1: 32px;
    --fs-2: 24px;
    --fs-3: 26px;
    --fs-4: 18px;
    --fs-6: 15px;
    --fs-7: 15px;
    --fs-8: 12px;
  }

  /* REUSED STYLE */

  .sidebar, article {
    width: 520px;
    margin-inline: auto;
    padding: 30px;
  }

  .article-title {
    font-weight: var(--fw-600);
    padding-bottom: 15px;
  }

  .article-title::after {
    width: 40px;
    height: 5px;
  }

  .icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 18px;
  }



  /* MAIN */

  main {
    margin-top: 60px;
    margin-bottom: 100px;
  }

  /* SIDEBAR */

  .sidebar {
    max-height: 180px;
    margin-bottom: 30px;
  }

  .sidebar.active { max-height: 584px; }

  .sidebar-info { 
    gap: 0px; 
    padding: 0; /* Remove any mobile padding */
  }

  .info-content {
    text-align: center; /* Center align for tablets+ */
  }

  .info-content .name { 
    margin: 0;
    padding: 0;
    line-height: 1.2;
    font-size: var(--fs-1); /* Use larger font size */
    margin-bottom: 10px; /* Restore spacing */
  }

  .info-content .title { padding: 5px 18px; }

  .info_more-btn {
    position: absolute; /* Restore absolute positioning */
    top: -30px;
    right: -30px;
    padding: 10px 15px;
  }

  .separator { margin: 32px 0; }

  .contacts-list { gap: 20px; }

  .contact-info {
    max-width: calc(100% - 64px);
    width: calc(100% - 64px);
  }



  /* ABOUT */

  .about .article-title { margin-bottom: 20px; }

  .about-text { margin-bottom: 40px; }

  .content-card {
    padding: 30px;
    padding-top: 25px;
  }

  /**
   * #RESUME
   */

  .timeline-list { margin-left: 65px; }

  .timeline-item:not(:last-child)::before { left: -40px; }

  .timeline-item::after {
    height: 8px;
    width: 8px;
    left: -43px;
  }

  .skills-item:not(:last-child) { margin-bottom: 25px; }

  /* Fix timeline alignment for tablet screens - ensure time/period stays on first line */
  .timeline-item div[style*="display: flex"][style*="align-items: baseline"] {
    flex-wrap: nowrap !important;
    align-items: baseline !important;
  }
  
  .timeline-item .timeline-item-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    margin-right: 8px;
    line-height: 1.4;
  }
  
  .timeline-item div[style*="display: flex"] span[style*="white-space: nowrap"] {
    flex-shrink: 0;
    font-size: var(--fs-6) !important;
    margin-left: 8px !important;
  }





}





/**
 * CERTIFICATION SECTION - Responsive styles
 */

/* Base styles for mobile (less than 768px) - normal timeline display */
.certification-grid {
  display: block !important;
  list-style: none;
  padding: 0;
}

.certification-item {
  grid-column: unset !important;
  grid-row: unset !important;
}

.certification-gap {
  display: none !important;
}

/**
 * responsive larger than 768px screen
 */

@media (min-width: 768px) {

  /**
   * REUSED STYLE
    color: var(--light-gray-70) !important;
  }
  .copy-btn.copied {
    color: var(--light-gray-70) !important;
  }
  .copy-btn ion-icon {
    color: var(--light-gray-70) !important;
   */

  .sidebar, article { width: 700px; }

  .has-scrollbar::-webkit-scrollbar-button { width: 100px; }

  /**
   * SIDEBAR - iPad optimization
   */
   
  .sidebar {
    max-height: 115px; /* Increased to accommodate balanced spacing */
  }
  
  .sidebar.active { 
    max-height: 520px; 
  }
  
  .sidebar-info {
    min-height: 85px; /* Increased to match tablet proportions for consistency */
    display: flex;
    justify-content: center;
    align-items: center; /* Perfect vertical alignment */
    padding: 8px 0; /* Consistent padding with tablet */
  }
  
  .info-content {
    text-align: center; /* Ensure center alignment */
  }
  
  .info-content .name {
    line-height: 1.2; /* Match tablet line height for consistency */
    margin-bottom: 25px; /* Add bottom space to balance the "Show Contact" button at top */
  }

  .contacts-list {
    grid-template-columns: 1fr 1fr;
    gap: 30px 15px;
  }



  /**
   * ABOUT
   */

  /* testimonials modal */

  .testimonials-modal {
    gap: 35px;
    max-width: 680px;
  }

  /**
   * CERTIFICATION
   */
  
  /* Restore grid layout for 768px+ */
  .certification-grid {
    display: grid !important;
    grid-template-columns: 1fr 0.2fr 1fr;
    gap: 0;
    list-style: none;
    padding: 0;
  }

  .certification-gap {
    display: block !important;
  }

}

/**
 * responsive larger than 1024px screen
 */

@media (min-width: 1024px) {

  /**
   * CUSTOM PROPERTY
   */

  :root {

    /**
    * shadow
    */

    --shadow-1: -4px 8px 24px hsla(0, 0%, 0%, 0.125);
    --shadow-2: 0 16px 30px hsla(0, 0%, 0%, 0.125);
    --shadow-3: 0 16px 40px hsla(0, 0%, 0%, 0.125);

  }



  /**
   * REUSED STYLE
   */

  .sidebar, article {
    width: 950px;
    box-shadow: var(--shadow-5);
  }



  /**
   * MAIN 
   */

  main { margin-bottom: 60px; }

  .main-content {
    position: relative;
    width: max-content;
    margin: auto;
  }



  /**
   * CONTACT COPY FUNCTIONALITY - Desktop
   */
   
  .copy-btn {
    display: none;
  }
  
  .contact-copyable {
    cursor: pointer;
  }
  
  .contact-copyable::after,
  .contact-copyable::before {
    display: block;
  }



  /**
   * BLOG
   */

  .blog-banner-box { height: 230px; }

}





/**
 * responsive larger than 1250px screen
 */

@media (min-width: 1250px) {

  /**
   * RESET
   */

  body::-webkit-scrollbar { width: 20px; }

  body::-webkit-scrollbar-track { background: var(--smoky-black); }

  body::-webkit-scrollbar-thumb {
    border: 5px solid var(--smoky-black);
    background: hsla(0, 0%, 100%, 0.1);
    border-radius: 20px;
    box-shadow: inset 1px 1px 0 hsla(0, 0%, 100%, 0.11),
                inset -1px -1px 0 hsla(0, 0%, 100%, 0.11);
  }

  body::-webkit-scrollbar-thumb:hover { background: hsla(0, 0%, 100%, 0.15); }

  body::-webkit-scrollbar-button { height: 60px; }



  /**
   * REUSED STYLE
   */

  .sidebar, article { width: auto; }

  article { min-height: 100%; }



  /**
   * MAIN
   */

  main {
    max-width: 1200px;
    margin-inline: auto;
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 25px;
  }

  .main-content {
    min-width: 75%;
    width: 75%;
    margin: 0;
  }



  /**
   * SIDEBAR
   */

  .sidebar {
    position: sticky;
    top: 60px;
    max-height: max-content;
    height: 100%;
    margin-bottom: 0;
    padding-top: 25px;
    z-index: 1;
  }

  .sidebar-info { flex-direction: column; }

  .info-content .name {
    white-space: nowrap;
    text-align: center;
    margin: 0;
    padding: 0;
    line-height: 1.0;
  }

  .info-content .title { margin: auto; }

  .info_more-btn { display: none; }

  .sidebar-info_more {
    opacity: 1;
    visibility: visible;
  }

  .contacts-list { grid-template-columns: 1fr; }

  .contact-info :is(.contact-link) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .contact-info :is(.contact-link, time, address) {
    --fs-7: 14px;
    font-weight: var(--fw-300);
  }

  .separator:last-of-type {
    margin: 15px 0;
    opacity: 0;
  }

  .social-list { justify-content: center; }



  /**
	 * RESUME
	 */

  .timeline-text { max-width: 700px; }

}

/* Print styles for responsive printing */
@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  .sidebar {
    max-height: none !important;
    page-break-inside: avoid;
  }
  
  .timeline-item {
    page-break-inside: avoid;
    margin-bottom: 15pt;
  }
  
  .theme-toggle-btn,
  .pdf-download-btn,
  .lang-btn {
    display: none !important;
  }
  
  a {
    color: black !important;
    text-decoration: underline !important;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Add visual indicator for touch devices */
  .pdf-download-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    opacity: 0.7;
    transition: transform var(--transition-1);
  }
  
  /* Rotate arrow when dropdown is active */
  .pdf-download-container:has(.pdf-language-selector.active) .pdf-download-btn::after {
    transform: translateY(-50%) rotate(180deg);
  }
  
  /* Fallback for browsers that don't support :has() */
  .pdf-language-selector.active ~ .pdf-download-btn::after {
    transform: translateY(-50%) rotate(180deg);
  }
  
  /* Adjust button padding to accommodate arrow */
  .pdf-download-btn {
    padding-right: 24px;
  }
  
  /* Enhanced touch feedback */
  .pdf-download-btn:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.1);
  }
  
  .pdf-lang-option:active {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(0.98);
  }
}

/* Focus and keyboard navigation improvements */
@media (max-width: 768px) {
  /* Copy button visibility on mobile */
  .copy-btn {
    display: flex;
  }
  
  /* Disable text copying on mobile - only button should work */
  .contact-copyable {
    cursor: default;
    pointer-events: none;
  }
  
  /* Hide tooltip on mobile */
  .contact-copyable::after,
  .contact-copyable::before {
    display: none;
  }
  
  /* PDF dropdown touch improvements */
  .pdf-download-btn {
    position: relative;
  }
  
  .pdf-download-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    opacity: 0.7;
    transition: transform var(--transition-1);
  }
  
  .pdf-language-selector.active + .pdf-download-btn::after {
    transform: translateY(-50%) rotate(180deg);
  }
  
  /* Ensure all interactive elements have visible focus indicators */
  button:focus-visible,
  .lang-btn:focus-visible,
  .theme-toggle-btn:focus-visible,
  .pdf-download-btn:focus-visible,
  [data-sidebar-btn]:focus-visible,
  .copy-btn:focus-visible {
    outline: 2px solid var(--light-gray-70);
    outline-offset: 2px;
  }
  
  /* Skip link for accessibility */
  .skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--orange-yellow-crayola);
    color: var(--smoky-black);
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
  }
  
  .skip-link:focus {
    top: 6px;
  }
}

/* Tablet and medium screen adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Show both tooltip and copy button on tablets for flexibility */
  .copy-btn {
    display: flex;
  }
  
  .contact-copyable::after,
  .contact-copyable::before {
    display: block;
  }
}