/* =============================================================================
   AOSAWY.ORG — Apple Liquid Glass Design System
   Shared stylesheet linked from all 14 pages.
   Pipeline A (4 HTML pages) + Pipeline B (10 Vite/React pages).
   !important overrides counter Pipeline B's inline style injection.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. GOOGLE FONTS
----------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@400;600;700&display=swap');


/* -----------------------------------------------------------------------------
   2. CSS CUSTOM PROPERTIES
----------------------------------------------------------------------------- */
:root {
  /* -- Colors -- */
  --color-bg:            #f5f5f7;
  --color-text:          #1d1d1f;
  --color-secondary:     #6e6e73;
  --color-tertiary:      #86868b;
  --color-accent:        #0071e3;
  --color-accent-light:  rgba(0, 113, 227, 0.06);
  --color-accent-border: rgba(0, 113, 227, 0.15);
  --color-border:        rgba(0, 0, 0, 0.06);

  /* -- Glass surfaces -- */
  --card-bg:        rgba(255, 255, 255, 0.65);
  --card-blur:      saturate(180%) blur(20px);
  --card-border:    0.5px solid rgba(0, 0, 0, 0.06);
  --card-radius:    16px;
  --card-shadow:    0 1px 4px rgba(0, 0, 0, 0.03);
  --nav-bg:         rgba(255, 255, 255, 0.72);
  --surface-bg:     rgba(255, 255, 255, 0.45);
  --surface-blur:   saturate(120%) blur(12px);

  /* -- Typography -- */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-math:    'Cambria Math', 'Latin Modern Math', 'STIX Two Math', Georgia, 'Times New Roman', serif;

  /* -- Font sizes -- */
  --fs-h1:     clamp(2.4rem, 5.5vw, 3.8rem);
  --fs-h2:     2rem;
  --fs-h3:     1.1rem;
  --fs-body:   0.95rem;
  --fs-label:  0.73rem;
  --fs-pill:   0.73rem;
  --fs-button: 0.85rem;
  --fs-nav:    0.82rem;

  /* -- Spacing -- */
  --section-padding:  80px 24px;
  --card-padding:     24px;
  --container-max:    1200px;

  /* -- Transitions -- */
  --transition-fast:   all 0.2s ease;
  --transition-normal: all 0.3s ease;

  /* -- Button radii -- */
  --button-radius: 12px;
  --pill-radius:   100px;
}


/* -----------------------------------------------------------------------------
   3. BODY FONT OVERRIDE
   !important forces the design-system font stack over Pipeline B's useEffect
   which injects system fonts as inline styles on <body>.
----------------------------------------------------------------------------- */
html {
  background-color: #1d1d1f;
}
body {
  margin: 0;
  font-family: var(--font-body) !important;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* -----------------------------------------------------------------------------
   4. @KEYFRAMES
----------------------------------------------------------------------------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 113, 227, 0.25);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 113, 227, 0.55);
  }
}

@keyframes heroFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes heroButtonGlow {
  0%, 100% {
    box-shadow: 0 0 6px rgba(255,255,255,0.15), 0 0 12px rgba(255,255,255,0.05);
  }
  50% {
    box-shadow: 0 0 12px rgba(255,255,255,0.35), 0 0 24px rgba(255,255,255,0.12);
  }
}


/* -----------------------------------------------------------------------------
   5. SCROLL-REVEAL UTILITY
----------------------------------------------------------------------------- */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}


/* -----------------------------------------------------------------------------
   6. FLOATING BACK-NAVIGATION COMPONENT
   Glass-style fixed button — shared across all showcase pages.
----------------------------------------------------------------------------- */
/* Hidden — persistent site header now provides navigation on all pages */
.site-back-nav {
  display: none !important;
}

.site-back-nav a,
.site-back-nav button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--card-bg);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border: var(--card-border);
  border-radius: 50px;
  box-shadow: var(--card-shadow);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-nav);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.site-back-nav a:hover,
.site-back-nav button:hover {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
  transform: translateY(-1px);
}

.site-back-nav a:active,
.site-back-nav button:active {
  transform: translateY(0);
}


/* -----------------------------------------------------------------------------
   7. CUSTOM SCROLLBAR
----------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.30);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}


/* -----------------------------------------------------------------------------
   8. RESPONSIVE DEFAULTS  (desktop-first: hidden by default)
----------------------------------------------------------------------------- */
.ds-hamburger {
  display: none;
}

.ds-mobile-drawer {
  display: none;
}


/* -----------------------------------------------------------------------------
   8.1 ANIMATED HAMBURGER ICON (Apple-style)
----------------------------------------------------------------------------- */
.ds-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}
.ds-hamburger-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 22px;
}
.ds-hamburger-lines span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--color-text);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}
/* Open state: X animation */
.ds-hamburger.open .ds-hamburger-lines span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.ds-hamburger.open .ds-hamburger-lines span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.ds-hamburger.open .ds-hamburger-lines span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}


/* -----------------------------------------------------------------------------
   8.2 UNIFIED SITE HEADER (injected on showcase/research/teaching pages)
----------------------------------------------------------------------------- */
.ds-site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--color-border);
  height: 56px;
}
.ds-header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.ds-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 10px;
  vertical-align: middle;
}
.ds-header-logo {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
}
.ds-site-header .ds-nav-links {
  display: flex;
  gap: 24px;
}
.ds-site-header .ds-nav-links a {
  font-family: var(--font-body);
  font-size: var(--fs-nav);
  color: var(--color-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}
.ds-site-header .ds-nav-links a:hover {
  color: var(--color-accent);
}
/* Drawer close button */
.ds-drawer-close {
  position: absolute;
  top: 16px;
  right: 24px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--color-text);
  cursor: pointer;
}
/* Scroll-lock when mobile drawer is open — no jump */
body.drawer-open {
  overflow: hidden !important;
}
/* ── Header / Hero Spacing ──────────────────────────────────────────────
   ALL pages: hero background extends behind the glass header (no gap).
   Text content inside the hero starts below the 56px header.
   box-sizing: border-box makes padding eat INTO the 100vh, so
   flex alignItems:center centres within the remaining space.          */

/* Hero sections — internal top padding pushes text below the header */
#hero,
#research-hero,
#root > div > section:first-of-type {
  padding-top: 72px !important;
  box-sizing: border-box !important;
}
/* Neutralise legacy negative-margin hack on showcase wrappers.
   Previously compensated for #root { padding-top: 72px } which is now removed. */
#root .sh-wrapper {
  margin-top: 0 !important;
}
/* Sticky elements below the fixed header */
body:has(.ds-site-header) [style*="position: sticky"] {
  top: 56px !important;
}


/* -----------------------------------------------------------------------------
   8.3 SCROLL INDICATOR (mouse icon with bouncing dot)
----------------------------------------------------------------------------- */
.ds-scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0.6;
  transition: opacity 0.3s ease;
  z-index: 5;
}
.ds-scroll-indicator:hover { opacity: 1; }

.ds-scroll-mouse {
  width: 24px;
  height: 38px;
  border: 2px solid currentColor;
  border-radius: 12px;
  position: relative;
}
.ds-scroll-mouse::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 8px;
  background: currentColor;
  border-radius: 3px;
  animation: scrollBounce 1.5s ease-in-out infinite;
}
.ds-scroll-indicator span {
  font-family: var(--font-body);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: currentColor;
}

@keyframes scrollBounce {
  0%, 100% { opacity: 1; transform: translateX(-50%) translateY(0); }
  50% { opacity: 0.3; transform: translateX(-50%) translateY(10px); }
}

/* Color variants for different hero backgrounds */
.ds-scroll-indicator--light { color: rgba(255,255,255,0.7); }
.ds-scroll-indicator--dark { color: rgba(29,29,31,0.5); }


/* =============================================================================
   9. RESPONSIVE BREAKPOINTS
   ============================================================================= */

/* -----------------------------------------------------------------------------
   9a. TABLET  (640px - 1024px)
----------------------------------------------------------------------------- */
@media (min-width: 640px) and (max-width: 1024px) {
  :root {
    --fs-h1:            clamp(2rem, 4vw, 3rem);
    --fs-h2:            1.75rem;
    --section-padding:  64px 24px;
  }

  /* 3- and 4-column grids collapse to 2 columns */
  .ds-grid-3,
  .ds-grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Hamburger visible on tablet too */
  .ds-hamburger {
    display: flex !important;
  }

  .ds-nav-links {
    display: none !important;
  }

  /* -- Mobile navigation drawer (tablet) -- */
  .ds-mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(245, 245, 247, 0.92);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .ds-mobile-drawer.open {
    opacity: 1;
    pointer-events: all;
  }

  .ds-mobile-drawer a {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: color 0.15s ease;
  }

  .ds-mobile-drawer a:hover {
    color: var(--color-accent);
  }
}


/* -----------------------------------------------------------------------------
   9a-post. RIA LOGO CAP — All viewports
   The RIALogo React component sets width:100% / maxWidth:220px inline.
   Cap it to 160px everywhere so it never dominates its card.
----------------------------------------------------------------------------- */
.page-research img[alt*="RIA - Renewables"],
.page-research img[alt="RIA - Renewables & Industrial Analytics"] {
  max-width: 120px !important;
  width: 120px !important;
  height: auto !important;
  max-height: 120px !important;
  object-fit: contain !important;
  display: block !important;
  margin: 0 auto !important;
}

/* -----------------------------------------------------------------------------
   9a-post. RESEARCH HERO CARD — Logo buttons at bottom (all viewports)
   Moves the RIA + Rutgers logo row to the bottom of the hero card
   and applies dark background + white glow animation.
   These selectors are deeply nested and ONLY match inside the hero card.
----------------------------------------------------------------------------- */
.page-research .research-hero-content > div:first-child {
  display: flex !important;
  flex-direction: column !important;
}

.page-research .research-hero-content > div:first-child > div:first-child {
  order: 10 !important;
  margin-bottom: 0 !important;
  margin-top: 0.75rem !important;
  justify-content: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

.page-research .research-hero-content > div:first-child > div:first-child a {
  background: rgba(0,0,0,0.55) !important;
  border: 0.5px solid rgba(255,255,255,0.2) !important;
  animation: heroButtonGlow 3s ease-in-out infinite !important;
}


/* -----------------------------------------------------------------------------
   9a-post. FRAMEWORK EVOLUTION TIMELINE — responsive HTML figure
----------------------------------------------------------------------------- */
.fw-evolution-timeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 1.5rem 0;
}
.fw-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.fw-node-circle {
  width: var(--node-size, 60px);
  height: var(--node-size, 60px);
  border-radius: 50%;
  background: rgba(204,0,0,0.06);
  border: 2px solid #CC0000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.fw-node-circle:hover {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(204,0,0,0.15);
}
.fw-node-name {
  font-weight: 800;
  font-size: 0.85rem;
  color: #CC0000;
  letter-spacing: 0.02em;
}
.fw-node-id {
  font-size: 0.7rem;
  color: #CC0000;
  opacity: 0.7;
}
.fw-node-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}
.fw-node-year {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text);
}
.fw-node-desc {
  font-size: 0.65rem;
  color: var(--color-tertiary);
}
.fw-arrow {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
  min-width: 160px;
  flex-shrink: 1;
}
.fw-arrow-line {
  flex: 1;
  height: 2px;
  background: repeating-linear-gradient(90deg, #CC0000 0, #CC0000 6px, transparent 6px, transparent 10px);
}
.fw-arrow-head {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid #CC0000;
}
.fw-arrow-label {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  color: var(--color-tertiary);
  white-space: nowrap;
}

/* -- Research Interconnections Network -- */
.ri-network {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: center;
}
.ri-feeds {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.ri-feed-card {
  padding: 0.75rem;
  background: rgba(255,255,255,0.5);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ri-feed-card:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.ri-arrows {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
}
.ri-arrow-lines {
  width: 2px;
  height: 100%;
  min-height: 200px;
  background: repeating-linear-gradient(180deg, var(--color-tertiary) 0, var(--color-tertiary) 4px, transparent 4px, transparent 8px);
  position: relative;
  opacity: 0.3;
}
.ri-arrow-lines::after {
  content: '';
}
.ri-core {
  display: flex;
  align-items: center;
  justify-content: center;
}
.ri-core-circle {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: rgba(204,0,0,0.04);
  border: 2.5px solid #CC0000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: box-shadow 0.3s ease;
}
.ri-core-circle:hover {
  box-shadow: 0 0 30px rgba(204,0,0,0.12);
}
.ri-predecessors {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}
.ri-pred {
  font-size: 0.55rem;
  color: #CC0000;
  background: rgba(204,0,0,0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* -----------------------------------------------------------------------------
   9a-post. PIPELINE MOBILE CARD — hidden on desktop/tablet, shown on mobile
----------------------------------------------------------------------------- */
.pipeline-mobile-card {
  display: none;
}

/* -----------------------------------------------------------------------------
   9a-post. STAT LINK CARD — hover effect for clickable stat boxes
----------------------------------------------------------------------------- */
.stat-link-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}

/* -----------------------------------------------------------------------------
   9a-post. RESEARCH TAB BAR — Wrap buttons on all viewports (no scrollbar)
----------------------------------------------------------------------------- */
.page-research [style*="position: sticky"][style*="top: 56px"] > div,
.page-teaching [style*="position: sticky"][style*="top: 56px"] > div {
  white-space: normal !important;
  overflow-x: visible !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  justify-content: center !important;
}


/* -----------------------------------------------------------------------------
   9b. MOBILE  (< 640px)
   Structure: SHARED > PAGE-HOME > PAGE-RESEARCH > PAGE-TEACHING > PAGE-SHOWCASE
   Each page section is scoped with body.page-xxx so rules ONLY affect that page.
----------------------------------------------------------------------------- */
@media (max-width: 639px) {

  /* =========================================================================
     SHARED MOBILE — applies to ALL pages
     ========================================================================= */

  /* -- Variable overrides -- */
  :root {
    --fs-h1:            clamp(1.6rem, 6vw, 2.4rem);
    --fs-h2:            1.5rem;
    --section-padding:  48px 16px;
    --card-padding:     16px;
  }

  /* -- Layout grids (class-based) -- */
  .ds-grid-2,
  .ds-grid-3,
  .ds-grid-4 {
    grid-template-columns: 1fr !important;
  }
  .ds-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* -- Hero flex stacking (class-based) -- */
  .ds-hero-flex {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
  }
  .ds-hero-photo {
    width: 140px !important;
    height: 140px !important;
    margin: 0 auto 20px !important;
  }
  .ds-hero-buttons {
    flex-direction: column !important;
    width: 100% !important;
    gap: 10px !important;
  }
  .ds-hero-buttons > * {
    width: 100% !important;
    text-align: center !important;
  }
  .ds-hero-buttons a,
  .ds-hero-buttons button {
    padding: 10px 20px !important;
    font-size: 0.8rem !important;
  }

  /* -- Navigation: hamburger visible, links hidden -- */
  .ds-hamburger {
    display: flex !important;
  }
  .ds-nav-links {
    display: none !important;
  }

  /* -- Mobile navigation drawer -- */
  .ds-mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(245, 245, 247, 0.92);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .ds-mobile-drawer.open {
    opacity: 1;
    pointer-events: all;
  }
  .ds-mobile-drawer a {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: color 0.15s ease;
  }
  .ds-mobile-drawer a:hover {
    color: var(--color-accent);
  }

  /* -- Back-nav smaller on mobile -- */
  .site-back-nav a,
  .site-back-nav button {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  /* -- Overflow prevention -- */
  #root {
    overflow-x: clip;
  }
  main, section, article, .scroll-reveal {
    overflow-x: hidden;
  }
  body {
    overflow-x: hidden;
  }

  /* -- Media overflow (images, video, etc.) -- */
  img, video, canvas, svg {
    max-width: 100% !important;
    height: auto !important;
  }

  /* -- Text wrapping -- */
  h1, h2, h3, h4, h5, h6, p, span, a, li {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* -- Scroll indicator: static flow on mobile -- */
  .ds-scroll-indicator {
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    width: fit-content !important;
    margin: 24px auto 16px !important;
  }

  /* -- Footer mobile -- */
  .ds-site-footer {
    padding: 40px 16px 16px !important;
  }
  .ds-footer-inner {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .ds-footer-bar {
    flex-direction: column !important;
    gap: 8px !important;
    text-align: center !important;
  }


  /* =========================================================================
     PAGE-HOME MOBILE — .page-home scoped
     Only affects index.html (homepage)
     ========================================================================= */

  /* Hero section: stack content + scroll indicator vertically */
  .page-home #hero {
    flex-direction: column !important;
  }

  /* Journey image grid: full aspect ratio */
  .page-home .ds-journey-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .page-home .ds-journey-grid > div {
    min-height: auto !important;
    border-radius: 16px !important;
    overflow: hidden !important;
  }
  .page-home .ds-journey-grid img {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    border-radius: 16px !important;
  }

  /* Commencement photo: full width */
  .page-home img[alt*="Commencement"],
  .page-home img[alt*="commencement"],
  .page-home img[alt*="graduation"],
  .page-home img[alt*="Graduation"],
  .page-home img[alt*="Class of 2024"] {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    border-radius: 12px !important;
  }

  /* University logos in degree cards */
  .page-home [alt*="AUC School"],
  .page-home [alt*="Rutgers ISE"] {
    max-height: 60px !important;
    margin-top: 12px !important;
  }

  /* Commencement people info: stack */
  .page-home .ds-people-row {
    flex-direction: column !important;
    gap: 16px !important;
  }

  /* RIA logo button: prevent overflow */
  .page-home [alt="RIA Lab"] {
    max-height: 24px !important;
  }


  /* =========================================================================
     PAGE-RESEARCH MOBILE — .page-research scoped
     Only affects research-showcase.html
     ========================================================================= */

  /* -- Research hero: stack on mobile -- */
  .page-research #research-hero {
    height: auto !important;
    min-height: 100vh;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    padding: 56px 20px 24px !important;
    margin-top: -56px !important;
    overflow: visible !important;
  }

  .page-research #research-hero video,
  .page-research #research-hero > div:first-of-type,
  .page-research #research-hero > div:nth-of-type(2) {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }

  .page-research .research-hero-stats {
    position: static !important;
    order: 1;
    display: flex !important;
    justify-content: center !important;
    gap: 8px !important;
    margin-bottom: 16px;
    z-index: 5;
  }
  .page-research .research-hero-stats > div {
    padding: 8px 12px !important;
    flex: 1;
    max-width: 110px;
  }
  .page-research .research-hero-stats > div > div:first-child {
    font-size: 1rem !important;
  }
  .page-research .research-hero-stats > div > div:last-child {
    font-size: 0.55rem !important;
  }

  .page-research .research-hero-content {
    position: static !important;
    order: 2;
    z-index: 5;
    max-width: 100% !important;
    text-align: center !important;
  }
  .page-research .research-hero-content > div:first-child {
    padding: 1.25rem !important;
    border-radius: 16px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Logo links row — move to bottom of card */
  .page-research .research-hero-content > div:first-child > div:first-child {
    order: 10 !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-bottom: 0 !important;
    margin-top: 1rem !important;
  }
  /* Higher specificity version for #root override */
  .page-research #root .research-hero-content > div:first-child > div:first-child {
    order: 10 !important;
    margin-bottom: 0 !important;
    margin-top: 0.75rem !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  /* Logo buttons — darker background + glow */
  .page-research .research-hero-content > div:first-child > div:first-child a {
    padding: 6px 12px 6px 8px !important;
    border-radius: 12px !important;
    background: rgba(0,0,0,0.55) !important;
    border: 0.5px solid rgba(255,255,255,0.2) !important;
    animation: heroButtonGlow 3s ease-in-out infinite !important;
  }
  .page-research .research-hero-content > div:first-child > div:first-child img {
    height: 26px !important;
    width: auto !important;
    filter: brightness(1.3) !important;
  }

  .page-research .research-hero-content h1 {
    font-size: 1.5rem !important;
    text-align: center !important;
  }
  .page-research .research-hero-content p {
    text-align: center !important;
    font-size: 0.85rem !important;
  }

  /* Author/metadata row: center and wrap */
  .page-research .research-hero-content > div:first-child > div:nth-child(4) {
    justify-content: center !important;
  }
  /* Institution line */
  .page-research .research-hero-content > div:first-child > div:last-child {
    text-align: center !important;
  }

  /* Cap RIA logo everywhere on research page (overview + RIA Group tab) */
  .page-research img[alt*="RIA - Renewables"],
  .page-research img[alt="RIA - Renewables & Industrial Analytics"] {
    max-width: 120px !important;
    width: 120px !important;
    height: auto !important;
    max-height: 120px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto 1rem !important;
  }

  /* Scroll indicator in research hero */
  .page-research #research-hero .ds-scroll-indicator {
    position: static !important;
    order: 3;
    margin: 16px auto 0 !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    width: fit-content !important;
  }

  /* -- Research grid controls by minmax value -- */
  /* Stat/config cards (small minmax) — 2 per row */
  .page-research #root [style*="display: grid"][style*="minmax(160px"],
  .page-research #root [style*="display: grid"][style*="minmax(180px"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .page-research #root [style*="display: grid"][style*="minmax(250px"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  /* Long-text cards (large minmax) — single column */
  .page-research #root [style*="display: grid"][style*="minmax(280px"],
  .page-research #root [style*="display: grid"][style*="minmax(320px"],
  .page-research #root [style*="display: grid"][style*="minmax(340px"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  /* Compact stat card text */
  .page-research #root [style*="display: grid"][style*="minmax(180px"] > div,
  .page-research #root [style*="display: grid"][style*="minmax(250px"] > div {
    padding: 0.75rem !important;
  }

  /* Side-by-side card sections (e.g. Simulation Campaign + Platform Capabilities) — stack */
  .page-research [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Research-specific footer margin */
  .page-research .ds-site-footer {
    margin-top: 0 !important;
  }

  /* Tab bar — wrap buttons, not scrollable (research + teaching) */
  .page-research [style*="position: sticky"][style*="top: 56px"] > div,
  .page-teaching [style*="position: sticky"][style*="top: 56px"] > div {
    white-space: normal !important;
    overflow-x: visible !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: center !important;
  }
  .page-research [style*="position: sticky"][style*="top: 56px"] > div > button,
  .page-teaching [style*="position: sticky"][style*="top: 56px"] > div > button {
    padding: 0.4rem 0.7rem !important;
    font-size: 0.7rem !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    white-space: nowrap !important;
  }

  /* Multi-column fixed grids — 2 per row */
  .page-research #root [style*="display: grid"][style*="repeat(5"],
  .page-research #root [style*="display: grid"][style*="repeat(6"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Sponsor/funding logos — smaller */
  .page-research [style*="Supported By"] + div img,
  .page-research [style*="gap: 2.5rem"] > a img {
    height: 28px !important;
    width: auto !important;
  }
  .page-research [style*="gap: 2.5rem"] {
    gap: 1rem !important;
  }

  /* Dataset Engineering cards — stack title + pills */
  .page-research #root [style*="justify-content: space-between"][style*="align-items: flex-start"],
  .page-research #root [style*="justify-content: space-between"][style*="align-items: center"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }

  /* Monospace filenames: wrap + truncate */
  .page-research #root h4[style*="Courier"] {
    word-break: break-all !important;
    font-size: 0.78rem !important;
    line-height: 1.4 !important;
  }

  /* 3-column detail grids: single column */
  .page-research #root [style*="display: grid"][style*="1fr 1fr 1fr"]:not([style*="repeat"]) {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  /* Overflow containers — horizontal scroll */
  .page-research #root [style*="overflow-x: auto"],
  .page-research #root [style*="overflowX"] {
    max-width: 100% !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Tables — readable min-width */
  .page-research #root [style*="overflow"] table {
    min-width: 600px !important;
    font-size: 0.78rem !important;
  }
  .page-research #root [style*="overflow"] table th,
  .page-research #root [style*="overflow"] table td {
    padding: 0.6rem 0.75rem !important;
    white-space: nowrap !important;
  }
  .page-research #root table,
  .page-research #root pre,
  .page-research #root code {
    font-size: 0.7rem !important;
    word-break: break-all;
  }

  /* Multi-column grids — 2 per row */
  .page-research #root [style*="display: grid"][style*="repeat(3"],
  .page-research #root [style*="display: grid"][style*="repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* SVG figures */
  .page-research #root svg[viewBox] {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Image figures (flowcharts, diagrams) */
  .page-research #root img[alt*="framework"],
  .page-research #root img[alt*="Framework"],
  .page-research #root img[alt*="POSYDON"],
  .page-research #root img[alt*="pipeline"],
  .page-research #root img[alt*="Pipeline"] {
    width: 100% !important;
    height: auto !important;
    max-width: none !important;
  }

  /* Figure containers — scrollable */
  .page-research #root [style*="overflow: hidden"] {
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* DEFENSIVE: No standalone image on research page should exceed card width.
     Excludes images with specific alt-text overrides (e.g. RIA logo).
     Also excludes images inside rounded overflow-hidden card containers
     (thrust/testbed images) — those are handled by the rule below. */
  .page-research #root img[style*="width: 100%"]:not([alt*="RIA"]) {
    width: auto !important;
    max-width: 240px !important;
    max-height: 200px !important;
    object-fit: contain !important;
  }

  /* FIX: Images inside rounded card containers (thrust areas, testbed facility
     cards) should display centered and full-width, not shrunk by the defensive
     rule above. Matches both 8px (thrust) and 10px (area) border-radius. */
  .page-research #root [style*="border-radius: 10px"][style*="overflow: hidden"] > img[style*="width: 100%"],
  .page-research #root [style*="border-radius: 8px"][style*="overflow: hidden"] > img[style*="width: 100%"] {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
    margin: 0 auto !important;
  }

  /* Testbed facility images: allow cover where intended but keep centered */
  .page-research #root [style*="border-radius: 10px"][style*="overflow: hidden"] > img[style*="object-fit: cover"],
  .page-research #root [style*="border-radius: 8px"][style*="overflow: hidden"] > img[style*="object-fit: cover"] {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 220px !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    margin: 0 auto !important;
  }

  /* RIA logo (RIALogo component): cap size on mobile, override inline width */
  .page-research #root img[alt="RIA - Renewables & Industrial Analytics"] {
    max-width: 120px !important;
    width: 120px !important;
    height: auto !important;
    max-height: 120px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto 1rem !important;
  }

  /* Full-width card images: centered, not shrunk by defensive rule */
  .page-research img[alt="Wind Farm Assumptions"],
  .page-research img[alt="MILP Model Structure"],
  .page-research img[alt="Rolling Horizon Algorithm"],
  .page-research img[alt="Experiment Pipeline"] {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
  }

  /* Sensitivity Analysis cards: 3-column grid (1fr 2fr 1fr) → stacked on mobile */
  .page-research [style*="grid-template-columns: 1fr 2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }

  /* Pipeline Overview: hide horizontal SVG, show vertical cards on mobile */
  .page-research .pipeline-svg-card {
    display: none !important;
  }
  .page-research .pipeline-mobile-card {
    display: block !important;
  }

  /* Framework Evolution Timeline: vertical on mobile */
  .fw-evolution-timeline {
    flex-direction: column !important;
    gap: 0 !important;
  }
  .fw-arrow {
    flex-direction: column !important;
    min-width: unset !important;
    min-height: 55px;
    align-items: center !important;
  }
  .fw-arrow-line {
    width: 2px !important;
    height: 40px !important;
    flex: unset !important;
    background: repeating-linear-gradient(180deg, #CC0000 0, #CC0000 6px, transparent 6px, transparent 10px) !important;
  }
  .fw-arrow-head {
    border-top: 8px solid #CC0000 !important;
    border-bottom: none !important;
    border-left: 5px solid transparent !important;
    border-right: 5px solid transparent !important;
  }
  .fw-arrow-label {
    top: auto !important;
    left: auto !important;
    transform: none !important;
    position: relative !important;
    margin-left: 1rem;
    align-self: center;
  }

  /* Research Interconnections: vertical on mobile */
  .ri-network {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .ri-arrows {
    width: 100% !important;
    height: 30px !important;
  }
  .ri-arrow-lines {
    width: 100% !important;
    height: 2px !important;
    min-height: unset !important;
    background: repeating-linear-gradient(90deg, var(--color-tertiary) 0, var(--color-tertiary) 4px, transparent 4px, transparent 8px) !important;
  }
  .ri-arrow-lines::after {
    right: auto !important;
    top: auto !important;
    bottom: -14px !important;
    left: 50% !important;
    transform: translateX(-50%) rotate(90deg) !important;
  }
  .ri-core-circle {
    width: 190px !important;
    height: 190px !important;
    margin: 0 auto !important;
  }

  /* RIA logo inside "Visit RIA Lab" button (Lab Director card): cap size on mobile.
     The shared rule `img { height: auto !important }` (line 688) overrides the
     inline height: 28px, causing the image to expand to its natural height (500px+).
     This selector (specificity 0,2,1) beats the bare `img` rule (0,0,1). */
  .page-research img[alt="RIA Lab"] {
    height: 28px !important;
    width: auto !important;
    max-width: 100px !important;
    max-height: 28px !important;
    object-fit: contain !important;
  }

  /* Lab Director profile photo: preserve 90px circle on mobile */
  .page-research img[alt="Dr. Ahmed Aziz Ezzat"] {
    width: 90px !important;
    height: 90px !important;
    max-width: 90px !important;
    object-fit: cover !important;
    border-radius: 50% !important;
  }


  /* =========================================================================
     PAGE-PORTFOLIO MOBILE — .page-portfolio scoped
     Only affects portfolio.html
     ========================================================================= */

  /* Hero: stack children vertically on mobile (prevents scroll indicator drift) */
  .page-portfolio #hero {
    flex-direction: column !important;
  }

  /* Showcase grid: single column on mobile */
  .page-portfolio .chapter-showcase-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Hero stats: column layout on mobile */
  .page-portfolio .portfolio-hero-stats {
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
  }
  .page-portfolio .portfolio-hero-stats > div {
    width: 200px !important;
  }

  /* Scroll indicator: push to very bottom on mobile */
  .page-portfolio .portfolio-scroll-indicator {
    bottom: 12px !important;
  }


  /* =========================================================================
     PAGE-TEACHING MOBILE — .page-teaching scoped
     Only affects teaching-showcase.html
     ========================================================================= */

  /* Hero: stack children vertically on mobile (prevents scroll indicator drift) */
  .page-teaching #hero {
    flex-direction: column !important;
  }

  /* Hero stats: column layout on mobile */
  .page-teaching .teaching-hero-stats {
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
  }
  .page-teaching .teaching-hero-stats > div {
    width: 200px !important;
  }

  /* Scroll indicator: ensure visible on mobile */
  .page-teaching #hero .ds-scroll-indicator {
    position: static !important;
    margin: 24px auto 0 !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
  }

  /* All 2-column and 3-column grids → single column on mobile */
  .page-teaching [style*="grid-template-columns: 1fr 1fr"],
  .page-teaching [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Module cards grid (repeat 3) → 2 columns on mobile */
  .page-teaching [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Teaching stats: stack properly */
  .page-teaching .ds-teaching-stats {
    flex-direction: column !important;
    gap: 16px !important;
    align-items: stretch !important;
  }
  .page-teaching .ds-teaching-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  .page-teaching [style*="gridTemplateColumns: 'repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Contact cards: single column */
  .page-teaching [style*="gridTemplateColumns: 'repeat(4, 1fr)'"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Math content: wrap and shrink on mobile */
  .page-teaching [style*="Cambria Math"] {
    font-size: 0.85rem !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }


  /* =========================================================================
     PAGE-SHOWCASE MOBILE — .page-showcase scoped
     Only affects the 10 Vite-bundled Pipeline B showcase pages.
     These use broad attribute selectors to override inline styles.
     ========================================================================= */

  /* Grid columns — single column */
  .page-showcase [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Large paddings — reduced */
  .page-showcase [style*="padding: 3rem"],
  .page-showcase [style*="padding:3rem"],
  .page-showcase [style*="padding: 4rem"],
  .page-showcase [style*="padding:4rem"],
  .page-showcase [style*="padding: 100px"],
  .page-showcase [style*="padding:100px"] {
    padding: 24px 16px !important;
  }
  .page-showcase [style*="padding: 80px"],
  .page-showcase [style*="padding:80px"] {
    padding: 48px 16px !important;
  }
  .page-showcase [style*="padding: 64px"],
  .page-showcase [style*="padding:64px"] {
    padding: 40px 16px !important;
  }
  .page-showcase [style*="padding: 60px"],
  .page-showcase [style*="padding:60px"] {
    padding: 36px 16px !important;
  }
  .page-showcase [style*="padding: 48px"],
  .page-showcase [style*="padding:48px"] {
    padding: 32px 16px !important;
  }

  /* 100vh sections — shrink for mobile (exclude hero headers and #root direct children) */
  .page-showcase [style*="height: 100vh"]:not(header):not(#root > *),
  .page-showcase [style*="height:100vh"]:not(header):not(#root > *),
  .page-showcase [style*="min-height: 100vh"]:not(header):not(#root > *),
  .page-showcase [style*="min-height:100vh"]:not(header):not(#root > *) {
    height: auto !important;
    min-height: auto !important;
    padding-top: 60px !important;
    padding-bottom: 40px !important;
  }

  /* Hero video + scroll indicator overrides are in per-page <style> blocks (sh-* classes) */

  /* Large font-sizes — clamped */
  .page-showcase [style*="font-size: 3"],
  .page-showcase [style*="font-size:3"] {
    font-size: clamp(1.5rem, 6vw, 2.2rem) !important;
  }
  .page-showcase [style*="font-size: 2"],
  .page-showcase [style*="font-size:2"] {
    font-size: clamp(1.2rem, 5vw, 1.75rem) !important;
  }

  /* Wide-gap flex rows — column stack */
  .page-showcase [style*="display: flex"][style*="gap: 4"],
  .page-showcase [style*="display:flex"][style*="gap:4"],
  .page-showcase [style*="display: flex"][style*="gap: 3"],
  .page-showcase [style*="display:flex"][style*="gap:3"] {
    flex-direction: column !important;
  }

  /* Background images */
  .page-showcase [style*="background-image"] {
    background-size: cover !important;
    background-position: center !important;
  }

  /* CTA Buttons in content sections: full width */
  .page-showcase section [style*="border-radius: 980px"] {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }

  /* Resume/CV card: tone down glow */
  .page-showcase [style*="boxShadow"][style*="rgba(0,113,227"] {
    box-shadow: 0 2px 12px rgba(0,113,227,0.15) !important;
  }

  /* Section padding tighter */
  .page-showcase section > div[style*="maxWidth"],
  .page-showcase [style*="max-width: 1200px"],
  .page-showcase [style*="maxWidth: '1200px'"] {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Tab bar — wrap + center, matching research page exactly */
  .page-showcase [style*="position: sticky"] {
    padding: 8px 0 !important;
  }
  .page-showcase [style*="position: sticky"] > div {
    white-space: normal !important;
    overflow-x: visible !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: center !important;
    padding: 0 12px !important;
  }
  .page-showcase [style*="position: sticky"] > div > button,
  .page-showcase [style*="position: sticky"] > div > a {
    padding: 0.4rem 0.7rem !important;
    font-size: 0.7rem !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    white-space: nowrap !important;
  }

  /* 3D model viewers & canvas */
  .page-showcase canvas {
    max-width: 100% !important;
    max-height: 60vh !important;
  }
  .page-showcase model-viewer {
    max-width: 100% !important;
    max-height: 300px !important;
  }

  /* Images — prevent overflow */
  .page-showcase img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Tables — natural layout, parent div handles horizontal scroll */
  .page-showcase table {
    display: table !important;
    width: max-content !important;
    min-width: 100% !important;
  }
  .page-showcase table th,
  .page-showcase table td {
    font-size: 0.8rem !important;
    padding: 6px 10px !important;
  }

  /* -- Image cards: show full image, no cropping -- */
  .page-showcase main img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    max-height: none !important;
  }
  .page-showcase main div:has(> img) {
    height: auto !important;
    max-height: none !important;
  }

  /* -- 3D viewer: trim white gap on mobile -- */
  .page-showcase div:has(> model-viewer) {
    height: 300px !important;
  }
  .page-showcase model-viewer {
    height: 300px !important;
  }

  /* -- Footer mobile -- */
  .ds-footer-inner {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

} /* end @media (max-width: 639px) */


/* -----------------------------------------------------------------------------
   10. SITE FOOTER
----------------------------------------------------------------------------- */

/* Kill padding-bottom on any wrapper that contains the dark footer as last child.
   This fixes the white gap caused by React inline paddingBottom (e.g. '4rem')
   on the root wrapper div in research-showcase.html and similar pages.         */
#root > div:has(> .ds-site-footer:last-child) {
  padding-bottom: 0 !important;
}

/* Same fix for Pipeline B pages whose <footer> (no .ds-site-footer class) is the
   last child inside a wrapper with inline padding.                              */
#root > div:has(> footer:last-child) {
  padding-bottom: 0 !important;
}

.ds-site-footer {
  background: #1d1d1f;
  color: rgba(255,255,255,0.7);
  padding: 64px 24px 24px;
  padding-bottom: 80px;
  margin-bottom: 0;
  font-family: var(--font-body);
}
.ds-footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 48px;
}
.ds-footer-heading {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  margin-bottom: 16px;
}
.ds-footer-text {
  font-size: 0.85rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.6);
}
.ds-footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ds-footer-links li {
  margin-bottom: 10px;
}
.ds-footer-links a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s ease;
}
.ds-footer-links a:hover {
  color: #0071e3;
}
.ds-footer-bar {
  max-width: var(--container-max);
  margin: 48px auto 0;
  padding-top: 24px;
  border-top: 0.5px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
}
.ds-footer-bar a {
  color: rgba(255,255,255,0.4);
  text-decoration: none;
}
.ds-footer-bar a:hover {
  color: #0071e3;
}
/* Agentic Lab — visible off-white pill in footer bar */
a.ds-footer-agentic-pill {
  display: inline-block !important;
  padding: 7px 22px !important;
  border-radius: 980px !important;
  background: rgba(255,255,255,0.15) !important;
  border: 1px solid rgba(255,255,255,0.25) !important;
  color: rgba(255,255,255,0.7) !important;
  font-size: 0.73rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.2px !important;
  text-decoration: none !important;
  transition: all 0.3s ease !important;
}
a.ds-footer-agentic-pill:hover {
  background: rgba(255,255,255,0.22) !important;
  border-color: rgba(255,255,255,0.35) !important;
  color: rgba(255,255,255,0.95) !important;
}

/* -----------------------------------------------------------------------------
   11. PAGE TRANSITION — Fade in on load
----------------------------------------------------------------------------- */
@keyframes pageFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
body {
  animation: pageFadeIn 0.4s ease-out;
}

/* -----------------------------------------------------------------------------
   12. TAB BUTTON TRANSITIONS
----------------------------------------------------------------------------- */
.page-showcase #root button,
.page-research #root button,
.page-teaching #root button {
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

/* -----------------------------------------------------------------------------
   13. SCROLL-TO-TOP BUTTON
----------------------------------------------------------------------------- */
.ds-scroll-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.75);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border: 0.5px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.ds-scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.ds-scroll-top:hover {
  background: rgba(255,255,255,0.95);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.ds-scroll-top svg {
  width: 20px;
  height: 20px;
  stroke: #1d1d1f;
  stroke-width: 2;
  fill: none;
}

/* -----------------------------------------------------------------------------
   14. BREADCRUMB — Back to Portfolio
----------------------------------------------------------------------------- */
.ds-breadcrumb {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 900;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.ds-breadcrumb.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.ds-breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 980px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border: 0.5px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  color: #1d1d1f;
  text-decoration: none;
  font-size: 0.8rem;
  font-family: var(--font-body);
  font-weight: 500;
}
.ds-breadcrumb a:hover {
  background: rgba(255,255,255,0.95);
  color: #0071e3;
}
.ds-breadcrumb svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
@media (max-width: 639px) {
  .ds-breadcrumb { bottom: 20px; left: 16px; }
  .ds-breadcrumb a { font-size: 0.7rem; padding: 5px 10px; }
  .ds-scroll-top { bottom: 20px; right: 16px; width: 40px; height: 40px; }
}

/* -----------------------------------------------------------------------------
   15. FOCUS INDICATORS — Keyboard Accessibility
----------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid #0071e3;
  outline-offset: 2px;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid #0071e3;
  outline-offset: 2px;
  border-radius: 4px;
}
.ds-scroll-top:focus-visible,
.ds-breadcrumb a:focus-visible {
  outline-offset: 3px;
  border-radius: 980px;
}

/* -----------------------------------------------------------------------------
   16. SKIP TO CONTENT LINK
----------------------------------------------------------------------------- */
.ds-skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 10000;
  padding: 10px 20px;
  background: #0071e3;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.2s ease;
}
.ds-skip-link:focus {
  top: 0;
  outline: 2px solid #fff;
  outline-offset: -2px;
}

/* -----------------------------------------------------------------------------
   17. READING PROGRESS INDICATOR
----------------------------------------------------------------------------- */
.ds-reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #0071e3, #CC0000);
  z-index: 10001;
  width: 0%;
  pointer-events: none;
  /* iOS: always visible above everything, survive toolbar hide/show */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: width;
}

/* -----------------------------------------------------------------------------
   18. STORY NAVIGATION — Next/Previous Page
----------------------------------------------------------------------------- */
.ds-story-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  max-width: var(--container-max, 1200px);
  margin: 0 auto;
  padding: 48px 24px;
}
.ds-story-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 24px;
  border-radius: 16px;
  background: rgba(255,255,255,0.65);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid rgba(0,0,0,0.06);
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  text-decoration: none;
  color: #1d1d1f;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ds-story-nav a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.ds-story-nav a.next { text-align: right; }
.ds-story-nav .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #86868b;
  font-weight: 600;
}
.ds-story-nav .title {
  font-size: 1rem;
  font-weight: 600;
  color: #0071e3;
}
@media (max-width: 639px) {
  .ds-story-nav { flex-direction: column; padding: 32px 16px; }
  .ds-story-nav a { text-align: left !important; }
  .ds-story-nav a.next { text-align: right !important; }
}

/* -----------------------------------------------------------------------------
   19. IMAGE LIGHTBOX
----------------------------------------------------------------------------- */
.ds-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  cursor: zoom-out;
}
.ds-lightbox.open {
  opacity: 1;
  pointer-events: auto;
}
.ds-lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.ds-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.ds-lightbox-close:hover { background: rgba(255,255,255,0.3); }

/* Mark clickable images */
.page-showcase main img {
  cursor: zoom-in;
}

/* -----------------------------------------------------------------------------
   20. PRINT STYLESHEET
----------------------------------------------------------------------------- */
@media print {
  body { background: #fff !important; }
  .ds-site-header, .ds-site-footer, .ds-hamburger, .ds-mobile-drawer,
  .ds-scroll-top, .ds-breadcrumb, .ds-reading-progress, .ds-story-nav,
  .ds-scroll-indicator, .ds-skip-link, .sh-hero video,
  .ds-lightbox, .ds-lightbox-close { display: none !important; }
  .sh-hero { min-height: auto !important; height: auto !important; padding: 24px !important; }
  main { padding: 0 !important; }
  * { box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
  img { max-width: 100% !important; page-break-inside: avoid; }
  table { page-break-inside: avoid; }
}

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