/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #000;
  color: #fff;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Logo Styles */
.logo {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  height: 150px;
  width: auto;
  transition: all 0.3s ease;
}

.logo img {
  height: 100%;
  width: auto;
}

.logo:hover {
  transform: scale(1.05);
}

/* Clock in top-left - match logo sizing */
.clock {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 1000;
  height: 150px;
  min-width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e6eef8;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  background: transparent;
}

/* Resume download link - unified with nav styles below */
/* Styles for `#download-resume` are handled together with `nav a` further down to ensure consistent appearance */

/* Topbar containing logo, greeting, and clock */
.topbar {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 1001;
  pointer-events: none; /* keep topbar decorative; inner interactive elements can override */
}

.topbar .logo, .topbar .clock {
  pointer-events: auto;
}

.greeting {
  flex: 1 1 auto;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 500;
  color: #e6eef8;
  letter-spacing: 0.03em;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}

/* Topbar links group (Resume / Contact) */
.top-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: auto;
}
.topbar-links {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
}
.topbar-links a {
  color: #e6eef8;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0; /* keep as inline text */
  border: none;
  border-radius: 0;
  background: transparent;
  transition: color 150ms ease, text-decoration 150ms ease;
}
.topbar-links a:hover,
.topbar-links a:focus {
  color: #ffffff;
  text-decoration: underline;
  transform: none;
  background: transparent;
}

.greeting.flash {
  animation: greetingFlash 800ms ease-in-out 1;
}

@keyframes greetingFlash {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.85; }
  100% { transform: scale(1); opacity: 1; }
}

/* Visual skills grid (placeholder for skillsicon.dev) */
.skills-visual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 1rem;
  max-width: 1000px;
  margin: 1.5rem auto;
  align-items: center;
  justify-items: center;
}

.skill-bubble {
  width: 92px;
  height: 92px;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  color: #e6eef8;
  font-weight: 600;
  transition: transform 260ms cubic-bezier(.2,.9,.2,1), box-shadow 260ms;
  cursor: default;
  box-shadow: 0 6px 18px rgba(4,13,30,0.35);
}

.skill-bubble:hover {
  transform: translateY(-8px) scale(1.04);
  box-shadow: 0 14px 30px rgba(4,13,30,0.6);
}

/* subtle staggered entrance */
.skills-visual-grid .skill-bubble { opacity: 0; transform: translateY(12px); }
.skills-visual-grid.loaded .skill-bubble { opacity: 1; transform: translateY(0); }
.skills-visual-grid .skill-bubble[data-index] { transition-delay: calc(var(--i) * 80ms); }

/* Skillicons.dev embed image styling */
.skillsicons-wrap {
  max-width: 900px;
  margin: 1.2rem auto 0 auto;
  text-align: center;
}
.skillsicons-img {
  width: 100%;
  max-width: 760px;
  height: auto;
  display: inline-block;
  filter: drop-shadow(0 8px 24px rgba(4,13,30,0.45));
}

/* Entrance + hover animations */
.skillsicons-img {
  opacity: 0;
  transform: translateY(8px) scale(1);
  transition: transform 320ms cubic-bezier(.2,.9,.2,1), opacity 420ms ease, filter 240ms ease;
}
.skillsicons-wrap.revealed .skillsicons-img { opacity: 1; transform: translateY(0) scale(1); }
.skillsicons-img:hover { transform: translateY(-6px) scale(1.02); filter: drop-shadow(0 18px 42px rgba(4,13,30,0.6)); }

/* shimmer overlay using pseudo-element */
.skillsicons-wrap { position: relative; }
.skillsicons-wrap::after {
  content: '';
  position: absolute;
  left: -30%;
  top: 0;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0) 100%);
  transform: translateX(-100%);
  pointer-events: none;
  transition: transform 1.6s ease;
  opacity: 0.9;
}
.skillsicons-wrap.revealed::after { transform: translateX(220%); transition: transform 1.6s ease; }

/* Header */
header {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 2rem;
  position: relative;
  overflow: hidden;
}

/* Animated background grid */
header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 20s linear infinite;
  z-index: -1;
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

header h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 300;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  opacity: 0;
  transform: translateY(50px);
  transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

header p {
  font-size: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: 3rem;
  opacity: 0.8;
  font-weight: 200;
  opacity: 0;
  transform: translateY(30px);
  transition: all 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

/* Navigation */
nav {
  display: flex;
  gap: 2rem;
  margin-top: 2rem;
}

nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 400;
  padding: 0.5rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

nav a:nth-child(1) { animation-delay: 0.4s; }
nav a:nth-child(2) { animation-delay: 0.5s; }
nav a:nth-child(3) { animation-delay: 0.6s; }
nav a:nth-child(4) { animation-delay: 0.7s; }

nav a:hover {
  /* subtle hover for nav so it doesn't flash full white on mobile */
  background-color: rgba(255,255,255,0.12);
  color: #000;
  transform: translateY(-2px);
}

/* Unified navbar button styles (applies to main nav links and the resume button) */
nav a, #download-resume {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  padding: 0.45rem 1.1rem;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02));
  transition: transform 140ms ease, background 140ms ease, box-shadow 120ms ease;
  backdrop-filter: blur(10px);
}

nav a:hover, #download-resume:hover, nav a:focus, #download-resume:focus {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
  color: #000;
}

/* Prevent harsh tap highlights on mobile (removes the default flash) */
nav a, .topbar-links a {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  touch-action: manipulation;
}

/* Make interactive elements avoid inverting to full white on touch/active states */
button, a, .project-short, .project-download, .links a, #download-resume {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Subtle active state that doesn't invert colors strongly */
button:active, a:active, .project-short:active, .project-download:active, #download-resume:active, .links a:active {
  transform: translateY(0);
  background-color: rgba(255,255,255,0.04);
  color: inherit; /* avoid switching to black text */
  box-shadow: none;
}

/* Avoid heavy :hover inversion on small screens (touch devices) */
@media (max-width: 700px) {
  nav a:hover, nav a:active, nav a:focus, .links a:hover, .links a:active, .links a:focus {
    background-color: rgba(255,255,255,0.06);
    color: #fff; /* keep text white to avoid stark contrast */
    transform: none !important;
  }

  /* Make sure the large white background animation doesn't trigger on scroll/tap */
  .links a::before { transition: none; }

  /* Slightly reduce the backdrop brightness for active state */
  #download-resume:active {
    background: rgba(255,255,255,0.04);
    box-shadow: none;
  }

  /* Ensure project-short doesn't jump during scroll/tap */
  .project-short:active, .project-short:focus {
    transform: none;
  }
}

/* Make touch interactions subtle: no transform/white inversion on small screens */
@media (max-width: 700px) {
  nav a, .topbar-links a {
    transform: none !important;
  }
  nav a:hover, nav a:active, nav a:focus {
    background-color: rgba(255,255,255,0.06);
    color: #fff;
  }
  /* ensure no full-white background */
  nav a { -webkit-backface-visibility: hidden; backface-visibility: hidden; }
}

/* Mobile specific adjustments */
@media (max-width: 700px) {
  .topbar {
    left: 0.5rem;
    right: 0.5rem;
    height: auto;
    padding: 0.5rem;
    gap: 0.5rem;
  }
  .logo { height: 56px; top: 0.6rem; }
  .clock { height: 56px; min-width: 56px; font-size: 0.9rem; top: 0.6rem; }
  .greeting { font-size: 1rem; }
  .topbar-links { gap: 0.4rem; }
  nav { margin-top: 1rem; }
  nav a { padding: 0.5rem 1rem; font-size: 0.95rem; }
  /* Make resume slightly smaller on mobile while keeping pill feel */
  #download-resume { padding: 6px 10px; font-size: 0.92rem; border-radius: 18px; }

  /* Allow project details to expand more on small screens and make download links easier to tap */
  .project-details.open { max-height: 1200px; }
  .project-download { display: block; width: 100%; box-sizing: border-box; margin-top: 0.8rem; }
}

/* Mobile: neutralize navbar fancy styles to avoid flashing on touch */
@media (max-width: 700px) {
  nav a, #download-resume {
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    box-shadow: none !important;
    transform: none !important;
    transition: none !important;
    opacity: 1 !important;
  }
  /* disable entrance animation which can cause repaints during scroll */
  nav a {
    animation: none !important;
  }
}

/* Floating geometric shapes */
.geometric-bg {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  opacity: 0.02;
}

.geometric-bg svg {
  width: 100%;
  height: 100%;
}

.shape-1 {
  top: 10%;
  left: 10%;
  width: 100px;
  height: 100px;
  animation: float 20s infinite ease-in-out;
}

.shape-2 {
  top: 60%;
  right: 10%;
  width: 150px;
  height: 150px;
  animation: float 25s infinite ease-in-out reverse;
}

.shape-3 {
  bottom: 20%;
  left: 15%;
  width: 80px;
  height: 80px;
  animation: float 30s infinite ease-in-out;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33% { transform: translateY(-20px) rotate(120deg); }
  66% { transform: translateY(20px) rotate(240deg); }
}

/* Sections */
section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6rem 2rem;
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

section.visible {
  opacity: 1;
  transform: translateY(0);
}

section h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 200;
  margin-bottom: 2rem;
  letter-spacing: -0.01em;
  position: relative;
  display: inline-block;
}

section h2::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #fff;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}

section.visible h2::after {
  width: 50px;
}

section p {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
  opacity: 0.9;
  font-weight: 300;
}

/* Skills section */
.skills {
  margin-top: 3rem;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(5px);
  position: relative;
}

.skills::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  border-radius: 12px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.skills:hover::before {
  opacity: 1;
}

.skills h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  font-weight: 300;
  display: flex;
  align-items: center;
}

.skills h3::before {
  content: '</>';
  font-family: 'Courier New', monospace;
  margin-right: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2rem;
}

.skills p {
  margin-bottom: 1rem;
}

.skills strong {
  color: #fff;
  font-weight: 500;
}

/* Ensure SVG images used as icons fit the tile */
.icon-svg {
  width: 64px;
  height: 64px;
  /*display: block;*/
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.35));
  transition: transform 280ms cubic-bezier(.2,.9,.2,1), filter 220ms;
}

.skill .icon-svg { border-radius: 6px; padding: 0; background: transparent; }

/* Projects and Experience */
.project, .job, .volunteer, .leadership {
  margin-bottom: 3rem;
  padding: 2rem;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
  padding-left: 2rem;
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

/* Expandable project details */
.project-short {
  cursor: pointer;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  display: inline-block;
  transition: transform 180ms ease, background 200ms ease;
}
.project-short:focus, .project-short:hover {
  transform: translateY(-4px);
  background: linear-gradient(180deg, rgba(58,141,255,0.06), rgba(58,141,255,0.02));
}

.project-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 360ms cubic-bezier(0.16, 1, 0.3, 1), padding 240ms ease;
  margin-top: 0.6rem;
}
.project-details.open {
  max-height: 400px; /* generous height for content */
  padding: 0.8rem 0.6rem 0.6rem 0.6rem;
}
.project-details-inner {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  padding: 1rem;
  border-radius: 8px;
}
.project-download {
  display: inline-block;
  margin-top: 0.6rem;
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
}

/* Project media (responsive iframe) */
.project-media {
  margin-top: 0.8rem;
}
.project-media iframe {
  max-width: 100%;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}
.media-caption {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  color: rgba(230,238,248,0.9);
}

/* Video modal */
.video-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;
}
.video-modal.open {
  display: flex;
}
.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
}
.video-modal-content {
  position: relative;
  max-width: 96vw;
  width: min(1100px, 95%);
  background: #0b0b0b;
  padding: 0.6rem;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  z-index: 2;
}
.video-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
}
.video-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 6px;
}
.video-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 3;
  background: transparent;
  color: #fff;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
}
.video-modal-close:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.project::before, .job::before, .volunteer::before, .leadership::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 2rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.project:hover::before, .job:hover::before, .volunteer:hover::before, .leadership:hover::before {
  background-color: #fff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.project.visible, .job.visible, .volunteer.visible, .leadership.visible {
  opacity: 1;
  transform: translateX(0);
  border-left-color: #fff;
}

.project h3, .job h3, .volunteer h3, .leadership h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  font-weight: 400;
}

.project:hover, .job:hover, .volunteer:hover, .leadership:hover {
  transform: translateX(10px);
  border-left-color: #fff;
}

/* Contact links */
.links {
  display: flex;
  gap: 2rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.links a {
  color: #fff;
  text-decoration: none;
  padding: 1rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  transition: all 0.3s ease;
  font-weight: 300;
  opacity: 0;
  transform: translateY(20px);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Contact icons (from skillicons.dev) */
.contact-icon {
  width: 26px;
  height: 26px;
  display: inline-block;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
}

.links a::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  transition: all 0.3s ease;
  transform: translate(-50%, -50%);
}

.links a:hover::before {
  width: 200px;
  height: 200px;
}

.links.visible a {
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.links a:nth-child(1) { animation-delay: 0.1s; }
.links a:nth-child(2) { animation-delay: 0.2s; }
.links a:nth-child(3) { animation-delay: 0.3s; }

.links a:hover {
  background-color: #fff;
  color: #000;
  transform: translateY(-5px);
}

/* Arrow decoration for external links */
.external-link::after {
  content: '↗';
  font-size: 0.8rem;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.external-link:hover::after {
  transform: translate(2px, -2px);
  opacity: 1;
}

/* Footer */
footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0.6;
  font-weight: 300;
}

/* Animations */
@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Page load animations */
.slide-in.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .logo {
    top: 1rem;
    right: 1rem; /* keep logo on the right like desktop */
    height: 72px; /* slightly bigger on mobile */
  }
  
  nav {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }
  
  nav a {
    text-align: center;
  }
  
  .links {
    flex-direction: row; /* keep contact links horizontal on mobile */
    align-items: center;
    justify-content: center;
    gap: 1rem;
  }

  /* Ensure contact buttons are visible at this breakpoint too */
  .links a {
    opacity: 1 !important;
    transform: none !important;
  }
  
  section {
    padding: 4rem 1rem;
  }
  
  .project, .job, .volunteer, .leadership {
    padding: 1.5rem;
    padding-left: 1.5rem;
    border-left-width: 1px;
  }

  .geometric-bg {
    display: none;
  }
}

/* Smooth scrolling enhancements */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* High contrast for accessibility */
@media (prefers-contrast: high) {
  section h2::after {
    background-color: #fff;
  }
  
  nav a, .links a {
    border-color: #fff;
  }
}

/* Additional mobile-safe overrides: reduce repaint-heavy styles and neutralize tap/hover inversion */
@media (max-width: 700px) {
  /* Turn off backdrop-filter on mobile for nav/buttons to avoid expensive repaints */
  nav a, #download-resume, .links a, .topbar-links a, .video-modal-content {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Keep transitions cheap and predictable on touch devices */
  nav a, #download-resume, .links a, .topbar-links a {
    transition: background-color 120ms linear, color 120ms linear !important;
    will-change: auto !important;
    animation: none !important;
  }

  /* Avoid stark inversion on press/hover; keep subtle translucent feedback */
  nav a:hover, nav a:active, nav a:focus,
  #download-resume:hover, #download-resume:active, #download-resume:focus,
  .links a:hover, .links a:active, .links a:focus {
    background-color: rgba(255,255,255,0.06) !important;
    color: #fff !important;
    transform: none !important;
    box-shadow: none !important;
  }

  /* Explicitly silence OS tap highlight */
  nav a, #download-resume, .links a, .topbar-links a, button {
    -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    tap-highlight-color: rgba(0,0,0,0) !important;
    touch-action: manipulation !important;
  }

  /* Disable pseudo-element ripple / big radial effects on small screens */
  .links a::before, nav a::before, #download-resume::before {
    transition: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
  }

  /* Ensure nav buttons are composited on their own layer to reduce flicker */
  nav a, #download-resume, .links a {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform, opacity !important;
  }

  /* Allow project details to expand on mobile only when opened; don't force closed state */
  .project-details.open {
    overflow: visible !important;
    max-height: 2000px !important; /* large safe value so content isn't clipped when open */
    transition: none !important; /* avoid transition jank when opening */
    padding: 0.8rem 0.6rem 0.6rem 0.6rem !important;
  }

  /* Ensure contact buttons are visible on mobile (initial animations are disabled) */
  .links a {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Some parent/backdrop elements still used backdrop-filter; turn them off on mobile */
  header, .topbar, .skills, .video-modal-backdrop, .video-modal-content {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Ensure hover rules that set black text/white background are fully overridden */
  nav a, #download-resume, .links a {
    background-color: transparent !important;
    color: #fff !important;
    border: 0 !important;
  }

  nav a:hover, nav a:active, nav a:focus,
  #download-resume:hover, #download-resume:active, #download-resume:focus,
  .links a:hover, .links a:active, .links a:focus {
    background-color: rgba(255,255,255,0.06) !important;
    color: #fff !important;
    text-decoration: none !important;
    transform: none !important;
  }

  /* Extra mobile composition hints */
  html, body, a, button {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
  }
}

/* Touch-detection helper class: apply when JS detects a touch device.
   This lets us keep desktop visuals but switch to safe UI on touch only. */
.no-fancy-ui nav a,
.no-fancy-ui #download-resume,
.no-fancy-ui .links a,
.no-fancy-ui .topbar-links a,
.no-fancy-ui .video-modal-content {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: background-color 120ms linear, color 120ms linear !important;
  animation: none !important;
  transform: none !important;
  box-shadow: none !important;
}

.no-fancy-ui nav a:hover,
.no-fancy-ui nav a:active,
.no-fancy-ui nav a:focus,
.no-fancy-ui #download-resume:hover,
.no-fancy-ui #download-resume:active,
.no-fancy-ui #download-resume:focus,
.no-fancy-ui .links a:hover,
.no-fancy-ui .links a:active,
.no-fancy-ui .links a:focus {
  background-color: rgba(255,255,255,0.06) !important;
  color: #fff !important;
  text-decoration: none !important;
  transform: none !important;
}

.no-fancy-ui .links a {
  opacity: 1 !important;
  transform: none !important;
}

.no-fancy-ui header,
.no-fancy-ui .topbar,
.no-fancy-ui .skills,
.no-fancy-ui .video-modal-backdrop,
.no-fancy-ui .video-modal-content {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.no-fancy-ui .links a::before,
.no-fancy-ui nav a::before,
.no-fancy-ui #download-resume::before {
  transition: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

.no-fancy-ui .project-details.open {
  overflow: visible !important;
  max-height: 2000px !important;
  transition: none !important;
}

/* Debug / small fix: ensure the main nav is visible if animations or reduced-motion
   settings prevent the fade-in from running. This keeps the original animations
   intact unless a user prefers reduced motion — it's intentionally scoped to the
   main nav and marked important so it fixes cases where animation:none is applied. */
header nav a {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}