/* Custom Scrollbar Utilities */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

body {
  font-family: 'Inter', sans-serif;
}

.bg-grid {
  background-size: 32px 32px;
  background-image: radial-gradient(circle, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
}

.dark .bg-grid {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

/* Glassmorphism System */
.glass-panel {
  background-color: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.04);
}

.dark .glass-panel {
  background-color: rgba(22, 25, 34, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
}

.glass-card {
  background-color: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(226, 232, 240, 0.75);
}

.dark .glass-card {
  background-color: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Horizontal Expanding Projects, Awards & Speaking Accordion
   ========================================================================== */

.projects-expand-container,
.awards-expand-container,
.speaking-expand-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

@media (min-width: 1024px) {
  .projects-expand-container,
  .awards-expand-container,
  .speaking-expand-container {
    flex-direction: row;
    align-items: stretch;
    height: 580px;
    min-height: 580px;
    max-height: 580px;
  }

  /* Default (unhovered): all cards are equal in size with consistent height */
  .projects-expand-container .project-expand-card,
  .awards-expand-container .award-expand-card,
  .speaking-expand-container .speaking-expand-card {
    flex: 1 1 0%;
    min-width: 0;
    height: 100%;
    cursor: pointer;
    overflow: hidden;
    transition: flex 0.5s cubic-bezier(0.25, 1, 0.35, 1),
                background-color 0.35s ease,
                border-color 0.35s ease,
                box-shadow 0.35s ease,
                opacity 0.35s ease;
  }

  /* When the container is hovered, non-hovered sibling cards shrink horizontally only */
  .projects-expand-container:hover .project-expand-card,
  .awards-expand-container:hover .award-expand-card,
  .speaking-expand-container:hover .speaking-expand-card {
    flex: 0.75 1 0%;
    opacity: 0.88;
  }

  /* The hovered card expands ONLY horizontally on the side */
  .projects-expand-container .project-expand-card:hover,
  .projects-expand-container .project-expand-card.is-active,
  .awards-expand-container .award-expand-card:hover,
  .awards-expand-container .award-expand-card.is-active,
  .speaking-expand-container .speaking-expand-card:hover,
  .speaking-expand-container .speaking-expand-card.is-active {
    flex: 2.75 1 0%;
    opacity: 1;
    z-index: 10;
  }

  /* Summary toggle: collapsed view shows punchy summary, expanded view shows full technical architecture */
  .project-expand-card .project-summary-collapsed,
  .award-expand-card .award-summary-collapsed,
  .speaking-expand-card .speaking-summary-collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .project-expand-card .project-summary-expanded,
  .award-expand-card .award-summary-expanded,
  .speaking-expand-card .speaking-summary-expanded {
    display: none;
  }

  .projects-expand-container .project-expand-card:hover .project-summary-collapsed,
  .projects-expand-container .project-expand-card.is-active .project-summary-collapsed,
  .awards-expand-container .award-expand-card:hover .award-summary-collapsed,
  .awards-expand-container .award-expand-card.is-active .award-summary-collapsed,
  .speaking-expand-container .speaking-expand-card:hover .speaking-summary-collapsed,
  .speaking-expand-container .speaking-expand-card.is-active .speaking-summary-collapsed {
    display: none !important;
  }
  .projects-expand-container .project-expand-card:hover .project-summary-expanded,
  .projects-expand-container .project-expand-card.is-active .project-summary-expanded,
  .awards-expand-container .award-expand-card:hover .award-summary-expanded,
  .awards-expand-container .award-expand-card.is-active .award-summary-expanded,
  .speaking-expand-container .speaking-expand-card:hover .speaking-summary-expanded,
  .speaking-expand-container .speaking-expand-card.is-active .speaking-summary-expanded {
    display: -webkit-box !important;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Footer swap on desktop hover */
  .project-expand-card .card-collapsed-footer,
  .award-expand-card .card-collapsed-footer,
  .speaking-expand-card .card-collapsed-footer {
    display: flex;
  }
  .project-expand-card .card-expanded-footer,
  .award-expand-card .card-expanded-footer,
  .speaking-expand-card .card-expanded-footer {
    display: none;
  }

  .project-expand-card:hover .card-collapsed-footer,
  .project-expand-card.is-active .card-collapsed-footer,
  .award-expand-card:hover .card-collapsed-footer,
  .award-expand-card.is-active .card-collapsed-footer,
  .speaking-expand-card:hover .card-collapsed-footer,
  .speaking-expand-card.is-active .card-collapsed-footer {
    display: none !important;
  }
  .project-expand-card:hover .card-expanded-footer,
  .project-expand-card.is-active .card-expanded-footer,
  .award-expand-card:hover .card-expanded-footer,
  .award-expand-card.is-active .card-expanded-footer,
  .speaking-expand-card:hover .card-expanded-footer,
  .speaking-expand-card.is-active .card-expanded-footer {
    display: flex !important;
  }
}

@media (min-width: 1280px) {
  .projects-expand-container,
  .awards-expand-container,
  .speaking-expand-container {
    height: 600px;
    min-height: 600px;
    max-height: 600px;
  }
}

/* Mobile & Tablet Styles (< 1024px) - Compact Horizontal Side-by-Side Scroll */
@media (max-width: 1023px) {
  .projects-expand-container,
  .awards-expand-container,
  .speaking-expand-container,
  #posters-grid,
  #training-courses,
  #field-visits,
  #focus .grid {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y pinch-zoom !important;
    gap: 0.75rem !important;
    padding: 0.25rem 0.25rem 0.6rem 0.25rem !important;
    width: 100% !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .projects-expand-container::-webkit-scrollbar,
  .awards-expand-container::-webkit-scrollbar,
  .speaking-expand-container::-webkit-scrollbar,
  #posters-grid::-webkit-scrollbar,
  #training-courses::-webkit-scrollbar,
  #field-visits::-webkit-scrollbar,
  #focus .grid::-webkit-scrollbar {
    display: none !important;
  }

  /* Compact Uniform Cards across all sections (< 1024px) */
  .projects-expand-container .project-expand-card,
  .awards-expand-container .award-expand-card,
  .speaking-expand-container .speaking-expand-card,
  .poster-card,
  #training-courses > div,
  #field-visits > div {
    flex: 0 0 74vw !important;
    max-width: 275px !important;
    min-width: 240px !important;
    width: 74vw !important;
    height: 360px !important;
    min-height: 360px !important;
    max-height: 360px !important;
    scroll-snap-align: start !important;
    scroll-snap-stop: normal !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    border-radius: 1.25rem !important;
    padding: 0.75rem !important;
    overflow: hidden !important;
  }

  /* Compact Focus / Domains Cards */
  #focus .grid > div {
    flex: 0 0 74vw !important;
    max-width: 275px !important;
    min-width: 240px !important;
    width: 74vw !important;
    height: 250px !important;
    min-height: 250px !important;
    max-height: 250px !important;
    scroll-snap-align: start !important;
    scroll-snap-stop: normal !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    border-radius: 1.25rem !important;
    padding: 0.85rem !important;
    overflow: hidden !important;
  }
  #focus .grid > div .w-11 {
    width: 2rem !important;
    height: 2rem !important;
    margin-bottom: 0.35rem !important;
    font-size: 0.8rem !important;
  }
  #focus .grid > div h3 {
    font-size: 0.9rem !important;
    margin-bottom: 0.15rem !important;
  }
  #focus .grid > div p {
    font-size: 0.75rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0.35rem !important;
    -webkit-line-clamp: 3 !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  /* Full uncropped 16:9 cover photo on all cards */
  .project-expand-card .aspect-video,
  .award-expand-card .aspect-video,
  .speaking-expand-card .aspect-video,
  .poster-card .aspect-video,
  .poster-card .h-48,
  .poster-card .h-52,
  #training-courses .h-36,
  #training-courses .h-40,
  #field-visits .h-36,
  #field-visits .h-38,
  #field-visits .aspect-video {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    height: auto !important;
    max-height: none !important;
    border-radius: 0.75rem !important;
    margin-bottom: 0.35rem !important;
    overflow: hidden !important;
    shrink: 0 !important;
    flex-shrink: 0 !important;
  }
  .project-expand-card .aspect-video img,
  .award-expand-card .aspect-video img,
  .speaking-expand-card .aspect-video img,
  .poster-card img,
  #training-courses img,
  #field-visits img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center;
  }

  .project-expand-card .aspect-video img.object-left,
  img.object-left {
    object-position: left center !important;
  }

  /* Compact Titles */
  .project-expand-card h3,
  .award-expand-card h3,
  .speaking-expand-card h3,
  .poster-card h3,
  #training-courses h4,
  #field-visits h3 {
    font-size: 0.875rem !important;
    line-height: 1.25 !important;
    margin-bottom: 0.15rem !important;
    -webkit-line-clamp: 1 !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    font-weight: 700 !important;
  }

  /* Compact Summaries */
  .project-expand-card .project-summary-collapsed,
  .award-expand-card .award-summary-collapsed,
  .speaking-expand-card .speaking-summary-collapsed,
  .poster-card p,
  #training-courses p,
  #field-visits p {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    font-size: 0.74rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0.2rem !important;
  }
  .project-expand-card .project-summary-expanded,
  .award-expand-card .award-summary-expanded,
  .speaking-expand-card .speaking-summary-expanded {
    display: none !important;
  }

  /* Compact Tags Row */
  .project-expand-card .flex-wrap,
  .award-expand-card .flex-wrap,
  .speaking-expand-card .flex-wrap,
  .poster-card .flex-wrap,
  #training-courses .flex-wrap,
  #field-visits .flex-wrap {
    max-height: 22px !important;
    overflow: hidden !important;
    gap: 0.25rem !important;
    margin-bottom: 0.15rem !important;
  }
  .project-expand-card .flex-wrap span,
  .award-expand-card .flex-wrap span,
  .speaking-expand-card .flex-wrap span,
  .poster-card .flex-wrap span,
  #training-courses .flex-wrap span,
  #field-visits .flex-wrap span {
    font-size: 0.62rem !important;
    padding: 0.1rem 0.35rem !important;
    line-height: 1.2 !important;
  }

  /* Direct Action Footers on mobile - ALWAYS PINNED, NEVER CUT OFF */
  .project-expand-card .card-collapsed-footer,
  .award-expand-card .card-collapsed-footer,
  .speaking-expand-card .card-collapsed-footer {
    display: none !important;
  }
  .project-expand-card .card-expanded-footer,
  .award-expand-card .card-expanded-footer,
  .speaking-expand-card .card-expanded-footer,
  .poster-card > div:last-child,
  #training-courses > div > div:last-child,
  #field-visits > div > div:last-child {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding-top: 0.35rem !important;
    margin-top: auto !important;
    flex-shrink: 0 !important;
  }

  /* Compact Action Buttons in Footers */
  .card-expanded-footer a,
  .card-expanded-footer button,
  .poster-card button,
  .poster-card a,
  #training-courses a,
  #field-visits a,
  .project-action-link,
  .award-action-link,
  .speaking-action-link {
    padding: 0.25rem 0.65rem !important;
    font-size: 0.72rem !important;
    border-radius: 0.625rem !important;
    line-height: 1.3 !important;
  }
}

/* ==========================================================================
   Mobile-Only Specific Overrides (< 768px)
   ========================================================================== */
@media (max-width: 767px) {
  /* Tighter section spacing */
  section {
    margin-bottom: 3.5rem !important;
  }

  /* Upward raised bottom navigation dock */
  .mobile-nav-dock {
    bottom: 3.25rem !important;
  }

  /* Feature Industrial Audit Card */
  #audit-card {
    padding: 0.875rem 1rem !important;
    border-radius: 1.25rem !important;
    margin-bottom: 1.25rem !important;
  }

  /* Experience Cards (Clean vertical list) */
  #experience-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem !important;
  }
  #experience-list > div {
    padding: 0.875rem 1rem !important;
    border-radius: 1.25rem !important;
    gap: 0.5rem !important;
  }
  #experience-list h3 {
    font-size: 0.95rem !important;
  }
  #experience-list ul {
    gap: 0.25rem !important;
  }
  #experience-list li {
    font-size: 0.8rem !important;
    line-height: 1.35 !important;
  }

  /* Education Card */
  #education > div {
    padding: 0.875rem 1rem !important;
    border-radius: 1.25rem !important;
    gap: 0.75rem !important;
  }
  #education h3 {
    font-size: 1rem !important;
  }

  /* 3D Touch Mac Dock Bottom Navigation */
  .mobile-nav-dock {
    bottom: 3.25rem !important;
    pointer-events: none;
    z-index: 50;
  }

  .mobile-dock-tooltip {
    position: absolute;
    bottom: 100%;
    margin-bottom: 2.25rem !important;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%) scale(0.8) translateY(10px);
    transform-origin: bottom center;
    transition: opacity 0.15s ease, transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    will-change: transform, opacity;
    z-index: 60;
  }

  .mobile-dock-tooltip.is-visible {
    opacity: 1 !important;
    transform: translateX(-50%) scale(1) translateY(0) !important;
  }

  #mobileDockTooltipArrow {
    transition: transform 0.12s ease-out;
    will-change: transform;
  }

  .mobile-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .mobile-bottom-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-dock-item {
    position: relative;
    width: auto;
    height: 36px;
    flex: 1 1 0%;
    max-width: 38px;
    min-width: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    transform-origin: bottom center;
    transition: transform 0.12s cubic-bezier(0.2, 0.9, 0.3, 1),
                background-color 0.2s ease,
                color 0.2s ease;
    will-change: transform;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none !important;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
  }

  .mobile-dock-item i {
    pointer-events: none;
    font-size: 0.85rem;
    transition: transform 0.12s ease;
  }

  .mobile-dock-item.dock-popping {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.45), rgba(13, 148, 136, 0.8)) !important;
    color: #ffffff !important;
    box-shadow: 0 12px 28px -2px rgba(13, 148, 136, 0.7), 0 0 16px rgba(20, 184, 166, 0.6) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
    border-radius: 9999px !important;
  }

  .mobile-dock-item.dock-popping i {
    color: #ffffff !important;
    transform: scale(1.25) !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6) !important;
  }

  .mobile-dock-item.active {
    background-color: rgba(20, 184, 166, 0.18) !important;
    color: #0d9488 !important;
  }

  .dark .mobile-dock-item.active {
    background-color: rgba(20, 184, 166, 0.28) !important;
    color: #2dd4bf !important;
  }

  .mobile-dock-item.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    width: 4px;
    height: 4px;
    border-radius: 9999px;
    background-color: #0d9488;
  }

  .dark .mobile-dock-item.active::after {
    background-color: #2dd4bf;
  }

  /* ==========================================================================
     Project Detail Pages Mobile Overhaul (< 768px)
     Applies to all 13 case study & expedition detail pages
     ========================================================================== */
  
  /* Global text justification reset on mobile (fixes awkward word-spacing gaps) */
  .text-justify {
    text-align: left !important;
    text-justify: auto !important;
    hyphens: auto;
  }

  /* Target Project Detail Pages specifically */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) {
    overflow-x: hidden !important;
  }

  /* Fixed Top Header on Mobile */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) header.fixed {
    top: 0.5rem !important;
    padding-left: 0.6rem !important;
    padding-right: 0.6rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) header.fixed nav {
    padding: 0.35rem 0.75rem !important;
    gap: 0.5rem !important;
    border-radius: 9999px !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) header.fixed nav a {
    font-size: 0.75rem !important;
    white-space: nowrap !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) header.fixed nav span {
    font-size: 0.72rem !important;
  }

  /* Main Viewport Container Padding: Reclaim valuable vertical height */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) main {
    padding-top: 4.75rem !important;
    padding-left: 0.875rem !important;
    padding-right: 0.875rem !important;
    padding-bottom: 3rem !important;
  }

  /* Headings & Typography Hierarchy */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) h1 {
    font-size: 1.55rem !important;
    line-height: 1.25 !important;
    letter-spacing: -0.02em !important;
    margin-top: 0.35rem !important;
    margin-bottom: 0.5rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) h2 {
    font-size: 1.25rem !important;
    line-height: 1.3 !important;
    letter-spacing: -0.015em !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) h3 {
    font-size: 1.05rem !important;
    line-height: 1.35 !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) p {
    text-align: left !important;
    text-justify: auto !important;
    hyphens: auto;
    word-break: break-word;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .text-base,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .text-lg {
    font-size: 0.875rem !important;
    line-height: 1.55 !important;
  }

  /* Category / Intro Micro-Pills */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .inline-flex.items-center.gap-2.px-3\.5 {
    padding: 0.25rem 0.65rem !important;
    font-size: 0.68rem !important;
    line-height: 1.3 !important;
  }

  /* Tech Stack Badges & Keywords */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .flex.flex-wrap.gap-2 {
    gap: 0.35rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .flex.flex-wrap.gap-2 span {
    font-size: 0.68rem !important;
    padding: 0.2rem 0.55rem !important;
    border-radius: 0.5rem !important;
  }

  /* Academic Metadata & Supervisor 4-Grid */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4.gap-4 {
    display: grid !important;
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    gap: 0.6rem !important;
    padding: 0.75rem !important;
    border-radius: 1rem !important;
  }

  /* Hero Performance Highlights Grid: Transform 4 massive stacked cards into 2x2 executive matrix */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-2.md\:grid-cols-4,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-3 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.55rem !important;
    margin-bottom: 1.5rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4 > div,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-2.md\:grid-cols-4 > div,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-3 > div {
    padding: 0.75rem !important;
    border-radius: 0.875rem !important;
    min-height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
  }

  /* Hero Stat Numbers */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4 .text-3xl,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-2.md\:grid-cols-4 .text-3xl,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-3 .text-3xl {
    font-size: 1.25rem !important;
    line-height: 1.2 !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4 .w-8.h-8,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-3 .w-8.h-8 {
    width: 1.65rem !important;
    height: 1.65rem !important;
    font-size: 0.72rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4 .text-xs.font-mono.uppercase,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-3 .text-xs.font-mono.uppercase {
    font-size: 0.625rem !important;
    margin-top: 0.25rem !important;
    letter-spacing: 0.02em !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4 p.text-xs,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .grid.grid-cols-1.sm\:grid-cols-3 p.text-xs {
    font-size: 0.68rem !important;
    line-height: 1.35 !important;
    margin-top: 0.3rem !important;
  }

  /* Multi-Column Performance Tables: Smooth horizontal touch scroll & compact cells */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .overflow-x-auto {
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y pinch-zoom !important;
    margin-left: -0.25rem !important;
    margin-right: -0.25rem !important;
    padding-bottom: 0.5rem !important;
    scrollbar-width: thin !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) table {
    min-width: 500px !important;
    font-size: 0.72rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) table th,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) table td {
    padding: 0.45rem 0.55rem !important;
    line-height: 1.35 !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) table th {
    font-size: 0.65rem !important;
    letter-spacing: 0.02em !important;
  }

  /* Interactive Gallery Filter Buttons & View Mode Controls */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) #galleryFilters,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .gallery-filters,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) div:has(> .view-bubble),
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) div:has(> .filter-btn) {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y pinch-zoom !important;
    gap: 0.4rem !important;
    padding-bottom: 0.4rem !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    width: 100% !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) #galleryFilters::-webkit-scrollbar,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) div:has(> .view-bubble)::-webkit-scrollbar,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) div:has(> .filter-btn)::-webkit-scrollbar {
    display: none !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .filter-btn,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .view-bubble {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 0.72rem !important;
    padding: 0.35rem 0.65rem !important;
    border-radius: 9999px !important;
  }

  /* Interactive Gallery Stage & Description Overlay */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) #galleryStage {
    min-height: 220px !important;
    max-height: 340px !important;
    border-radius: 1rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) #galleryStage .gallery-view img {
    max-height: 340px !important;
    object-contain: true;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) #galleryStage .absolute.bottom-0 {
    padding: 0.65rem 0.75rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) #galleryStage .absolute.bottom-0 p {
    font-size: 0.72rem !important;
    line-height: 1.3 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) #galleryStage .absolute.top-4 {
    top: 0.5rem !important;
    right: 0.5rem !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 0.65rem !important;
  }

  /* Gallery Thumbnail Strip */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .thumb-btn {
    padding: 0.4rem 0.5rem !important;
    gap: 0.45rem !important;
    border-radius: 0.75rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .thumb-btn img {
    width: 2.25rem !important;
    height: 2.25rem !important;
    border-radius: 0.5rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .thumb-btn span.text-xs {
    font-size: 0.68rem !important;
  }

  /* Tour / Expedition 3-Row Slider Track: Reconfigure for smooth mobile browsing */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) #sliderTrack {
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-columns: 210px !important;
    gap: 0.5rem !important;
    padding: 0.25rem 0 !important;
    touch-action: pan-x pan-y pinch-zoom !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) #sliderTrack > div {
    height: 135px !important;
    border-radius: 0.75rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) #sliderPrevBtn,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) #sliderNextBtn {
    display: none !important;
  }

  /* General Card Padding & Layout Gaps */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .p-6,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .p-8,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .p-10 {
    padding: 0.85rem !important;
    border-radius: 1rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .mb-14,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .mb-16 {
    margin-bottom: 1.5rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .mb-10,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .mb-12 {
    margin-bottom: 1.25rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .space-y-12 > :not([hidden]) ~ :not([hidden]),
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .space-y-10 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 1.35rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .space-y-8 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 1.15rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .gap-10,
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .gap-8 {
    gap: 1.25rem !important;
  }

  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) .rounded-3xl {
    border-radius: 1.25rem !important;
  }

  /* Code & Telemetry Monospace Pre Blocks */
  :is(.project-detail-body, body:has(header nav a[href*="index.html"])) pre {
    padding: 0.65rem 0.75rem !important;
    font-size: 0.7rem !important;
    border-radius: 0.75rem !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}
