/* Responsive fixes: prevent utility bar from overlapping navigation on mid/desktop widths */

/* Reserve space for the utility buttons (4 x 52px + gaps + buffer) */
:root{ --utility-safe: 260px; }

/* Desktop and tablet landscape: reserve space for utility bar on the container,
   keeping the bar centered and the logo left-aligned. */
@media (min-width: 821px){
  .nav-container{
    padding-right: calc(var(--space-md) + var(--utility-safe));
  }
  /* Keep the same safe padding on scroll to prevent right shift */
  .nav-container.scrolled{
    padding-right: calc(var(--space-md) + var(--utility-safe));
  }
  .nav{
    padding-right: var(--space-xl);
  }
  .nav-menu{ gap: .5rem; }
  .nav-link{ padding: .6rem .9rem; font-size: 1rem; }
}

/* Mobile rules remain as defined elsewhere (hamburger + overlay menu). */

/* Team section styles */
.team-section .section-header{ text-align: center; }
.team-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  max-width: 1100px;
  margin: 0 auto;
}
.team-card{
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-glass);
  display: flex;
  flex-direction: column;
}
.team-photo{
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: rgba(var(--white-rgb), var(--glass-opacity));
}
.team-photo img{
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transform: scale(1.01);
}
.team-meta{
  padding: var(--space-md);
  display: grid; gap: .25rem;
  text-align: center;
}
.team-meta h3{ font-weight: 800; letter-spacing: -.01em; }
.team-meta p{ color: var(--gray-600); font-weight: 600; }

/* Avatar above member name (used in "Meet Our Team") */
.member-avatar{
  width: 84px; height: 84px;
  border-radius: 12px;
  overflow: hidden;
  display: inline-block;
  margin-bottom: .65rem;
  box-shadow: var(--shadow-glass);
  background: rgba(var(--white-rgb), var(--glass-opacity));
}
.member-avatar img{
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
@media (max-width: 480px){
  .member-avatar{ width: 72px; height: 72px; border-radius: 10px; }
}

/* Make swapped project images behave nicely inside cards */
.project-image{
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

/* Mobile responsive adjustments for larger project images */
@media (max-width: 768px) {
  .project-image {
    width: 280px;
    height: 280px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .project-image {
    width: 240px;
    height: 240px;
  }
}

/* Prevent glass-card hover overlaps on small/touch screens */
@media (hover: none), (max-width: 820px){
  .glass-card{ transform-origin: center top; }
  .glass-card:hover{ transform: none; } /* disable scale/translate to avoid stacking overlap */
}

/* About page: disable transforms entirely on cards to avoid stacking overlap */
#about .glass-grid{ gap: var(--space-xl); }
#about .glass-grid .glass-card{
  transform: none !important;
  transform-origin: center top !important;
  transition: none !important;
  will-change: auto !important;
  cursor: default;
  z-index: auto !important;
}
#about .glass-grid .glass-card:hover,
#about .glass-grid .glass-card:focus,
#about .glass-grid .glass-card:active{
  transform: none !important;
  box-shadow: var(--shadow-glass) !important;
}
/* Ensure no inner element applies translate/scale that could cause visual overlap */
#about .glass-grid .glass-card *{
  transform: none !important;
  transition: none !important;
}

/* Liquid glass modal overlay */
.modal-overlay{
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(var(--primary-rgb), .20), transparent 60%),
    radial-gradient(1200px 800px at 10% 110%, rgba(var(--secondary-rgb), .10), transparent 65%),
    rgba(15,18,25,.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1200;
  opacity: 0; pointer-events: none;
  transition: opacity .35s var(--ease-out-expo);
  display: grid; place-items: end center;
  padding: clamp(8px, 2vh, 16px);
  overflow: hidden; /* allow gradient layer to sit neatly inside */
}
/* Apple-like large soft gradient behind the sheet */
.modal-overlay::before{
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 35%, rgba(255,255,255,.12) 70%),
    radial-gradient(1400px 1000px at 20% -20%, rgba(var(--primary-rgb), .22), transparent 65%),
    radial-gradient(1600px 1200px at 110% 120%, rgba(var(--secondary-rgb), .16), transparent 65%);
  filter: blur(6px);
  opacity: .95;
}
.modal-overlay.show{ opacity: 1; pointer-events: auto; }

/* Subtle specular highlight on the sheet for premium feel */
.modal-sheet::before{
  content: "";
  position: absolute; inset: 0;
  pointer-events: none; z-index: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,0) 40%),
    radial-gradient(900px 420px at 85% -10%, rgba(255,255,255,.18), transparent 70%);
  mix-blend-mode: screen;
  opacity: .65;
}

/* Glass sheet */
.modal-sheet{
  position: relative;
  width: min(1100px, 96vw);
  max-height: 92vh;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,.25), 0 8px 32px rgba(0,0,0,.15);
  border: 1px solid rgba(255,255,255,.3);
  transform: translateY(24px);
  opacity: .98;
  transition: transform .45s var(--ease-out-expo);
  /* Hide scrollbars */
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge */
}
.modal-sheet::-webkit-scrollbar{  /* WebKit */
  width: 0; height: 0; display: none;
}
.modal-overlay.show .modal-sheet{ transform: translateY(0); }

.glass-liquid{
  /* Frosted glass with gentle blue tint */
  background:
    linear-gradient(180deg, rgba(255,255,255,.30), rgba(255,255,255,.18)),
    radial-gradient(1400px 800px at 100% -30%, rgba(var(--primary-rgb), .10), transparent 70%);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
}
.glass-liquid::before,
.glass-liquid::after{
  /* Soft brand-tinted highlights */
  content: ''; position: absolute; inset: -20% -20% auto auto;
  width: 60%; height: 50%;
  background:
    radial-gradient(900px 540px at 10% -10%, rgba(var(--primary-rgb), .14), transparent 65%),
    radial-gradient(900px 540px at 120% 120%, rgba(var(--secondary-rgb), .10), transparent 65%);
  filter: blur(22px); pointer-events: none; z-index: 0;
}
.glass-liquid::after{
  inset: auto auto -20% -20%;
  background: radial-gradient(900px 540px at 85% 105%, rgba(var(--primary-rgb), .08), transparent 65%);
}

/* Header: crisp white glass with a subtle blue sheen */
.modal-header{
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background:
    linear-gradient(180deg, rgba(255,255,255,.62), rgba(255,255,255,.42)),
    radial-gradient(600px 320px at 100% -40%, rgba(var(--primary-rgb), .12), transparent 70%);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-top-left-radius: 24px; border-top-right-radius: 24px;
  border-bottom: 1px solid rgba(var(--primary-rgb), .22);
}
.modal-title{ font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 900; letter-spacing: -.01em; }
.modal-close{
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(var(--gray-100), .9); color: var(--gray-800);
  font-weight: 900; font-size: 1.25rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  outline: none;
}
.modal-close:hover{ transform: translateY(-1px); background: rgba(var(--gray-200), .95); }
.modal-close:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .35), inset 0 0 0 1px var(--gray-300);
}

/* Hero banner: only bottom corners rounded, sits flush under header */
.modal-hero{
  position: relative; z-index: 1; overflow: hidden;
  height: clamp(180px, 28vh, 260px);
  border-bottom-left-radius: 24px; border-bottom-right-radius: 24px;
}
.modal-hero-media{
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: saturate(110%) contrast(105%);
  transform: scale(1.03);
}
.modal-hero-overlay{
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.75));
}

/* Body layout */
.modal-body{
  position: relative; z-index: 2;
  display: grid; gap: var(--space-xl);
  grid-template-columns: 1fr;
  padding: var(--space-lg) var(--space-xl);
}
.modal-content{ display: grid; gap: var(--space-sm); }
.modal-subtitle{ color: var(--gray-700); font-weight: 700; }

.modal-tags{ display: flex; flex-wrap: wrap; gap: .5rem; margin: .25rem 0 .5rem; }
.chip{
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .38rem .7rem; border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,.35)),
    radial-gradient(420px 260px at 0% 0%, rgba(var(--primary-rgb), .12), transparent 70%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(var(--primary-rgb), .35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
  font-weight: 700; color: var(--gray-800); font-size: .92rem;
}

.modal-list{ margin-left: 1rem; display: grid; gap: .45rem; }
.modal-list li{ list-style: disc; color: var(--gray-800); }

.modal-actions{ margin-top: var(--space-md); display: flex; gap: .6rem; flex-wrap: wrap; }
.modal-actions .btn{ box-shadow: 0 2px 12px rgba(0,0,0,.1); }

.modal-aside{ display: grid; gap: .7rem; align-content: start; }
.modal-specs{
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .7rem;
}
.modal-specs .spec{
  padding: .75rem .9rem; border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255,255,255,.50), rgba(255,255,255,.34)),
    radial-gradient(520px 320px at 100% 0%, rgba(var(--primary-rgb), .10), transparent 70%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(var(--primary-rgb), .28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.modal-specs .spec span{ color: var(--gray-600); font-weight: 700; font-size: .85rem; }
.modal-specs .spec strong{ display: block; font-size: 1.05rem; color: var(--gray-900); }
.modal-specs .spec:hover{ border-color: rgba(var(--primary-rgb), .4); }

/* Collapsible glass sections */
.modal-sections{ display: grid; gap: .75rem; margin-top: .5rem; }
.glass-detail{
  border-radius: var(--radius-lg);
  background: rgba(var(--white-rgb), .22);
  border: 1px solid rgba(255,255,255,.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
}
.glass-detail > summary{
  cursor: pointer;
  padding: .8rem 1rem;
  font-weight: 800;
  list-style: none;
  position: relative;
}
.glass-detail > summary::-webkit-details-marker{ display:none; }
.glass-detail[open] > summary{ border-bottom: 1px solid rgba(255,255,255,.35); }
.glass-detail .detail-body{ padding: .9rem 1rem; display: grid; gap: .5rem; }
.glass-detail .muted{ color: var(--gray-600); }
.glass-detail .small{ font-size: .9rem; }
.glass-detail .grid-2{
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: .6rem;
}

/* Cooling showcase: large integrated image without shifting layout */
.cooling-showcase{
  position: relative;
  overflow: hidden; /* contain decorative layers */
}
.cooling-showcase > *{ position: relative; z-index: 1; }

/* Hide inline image (we render it as a decorative background for integration) */
.cooling-showcase .project-cover{ display: none; }

/* Soft ambient glow */
.cooling-showcase::after{
  content: "";
  position: absolute;
  left: clamp(10px, 3vw, 32px);
  top: 52%;
  transform: translateY(-50%);
  width: clamp(260px, 34%, 520px);
  height: 70%;
  background: radial-gradient(closest-side, rgba(var(--primary-rgb), .16), transparent 74%);
  filter: blur(18px);
  opacity: .7;
  z-index: 0;
}

/* Decorative large image layer – blended, non-intrusive */
.cooling-showcase::before{
  content: "";
  position: absolute;
  left: clamp(16px, 3.5vw, 36px);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(260px, 34%, 520px);
  height: 72%;
  background: url("/static/img/project-cooling.webp") no-repeat left center / contain;
  /* subtle frosted card look */
  box-shadow:
    0 18px 48px rgba(0,122,255,.18),
    0 6px 22px rgba(0,0,0,.10);
  border-radius: 20px;
  opacity: .96;
  z-index: 0;
}

/* Mobile: show inline image above content instead (for clarity) */
@media (max-width: 860px){
  .cooling-showcase .project-cover{
    display: block;
    width: min(88%, 560px);
    margin: 0 auto var(--space-lg);
    box-shadow:
      0 18px 48px rgba(0,122,255,.18),
      0 6px 22px rgba(0,0,0,.10);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.15));
    border: 1px solid rgba(255,255,255,.45);
  }
  .cooling-showcase::before,
  .cooling-showcase::after{ display: none; }
}

/* ---------- Fallback: ensure the FIRST showcase (Smart Cooling) behaves even if class wasn't added ---------- */

/* Keep layout centered; paint big image and glow behind content only on the first showcase */
#projects .project-showcase:first-of-type{
  position: relative;
  overflow: hidden;
}

/* Large background image (non-intrusive, behind text) */
#projects .project-showcase:first-of-type::before{
  content: "";
  position: absolute;
  left: clamp(16px, 3.5vw, 36px);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(260px, 34%, 520px);
  height: 72%;
  background: url("/static/img/project-cooling.webp") no-repeat left center / contain;
  border-radius: 20px;
  box-shadow:
    0 18px 48px rgba(0,122,255,.18),
    0 6px 22px rgba(0,0,0,.10);
  opacity: .96;
  z-index: 0;
  pointer-events: none;
}

/* Soft ambient glow */
#projects .project-showcase:first-of-type::after{
  content: "";
  position: absolute;
  left: clamp(10px, 3vw, 32px);
  top: 52%;
  transform: translateY(-50%);
  width: clamp(260px, 34%, 520px);
  height: 70%;
  background: radial-gradient(closest-side, rgba(var(--primary-rgb), .16), transparent 74%);
  filter: blur(18px);
  opacity: .7;
  z-index: 0;
  pointer-events: none;
}

/* Hide the small inline Smart Cooling image in that first showcase (even if it lacks the project-cover class) */
#projects .project-showcase:first-of-type img[alt*="Smart Cooling System" i]{ display: none; }

/* Mobile: show the normal inline image instead and disable decorative layers */
@media (max-width: 860px){
  #projects .project-showcase:first-of-type img[alt*="Smart Cooling System" i]{ display: block; width: min(88%, 560px); margin: 0 auto var(--space-lg); }
  #projects .project-showcase:first-of-type::before,
  #projects .project-showcase:first-of-type::after{ display: none; }
}

/* Second showcase (Darasa) — large integrated image like Smart Cooling */
#projects .project-showcase:nth-of-type(2){
  position: relative;
  overflow: hidden; /* keep decorative layers contained */
}

/* Large Darasa image layer behind content */
#projects .project-showcase:nth-of-type(2)::before{
  content: "";
  position: absolute;
  left: clamp(16px, 3.5vw, 36px);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(260px, 34%, 520px);
  height: 72%;
  background: url("/static/img/project-darasa.webp") no-repeat left center / contain;
  border-radius: 20px;
  box-shadow:
    0 18px 48px rgba(0,122,255,.18),
    0 6px 22px rgba(0,0,0,.10);
  opacity: .96;
  z-index: 0;
  pointer-events: none;
}

/* Soft ambient glow */
#projects .project-showcase:nth-of-type(2)::after{
  content: "";
  position: absolute;
  left: clamp(10px, 3vw, 32px);
  top: 52%;
  transform: translateY(-50%);
  width: clamp(260px, 34%, 520px);
  height: 70%;
  background: radial-gradient(closest-side, rgba(var(--primary-rgb), .16), transparent 74%);
  filter: blur(18px);
  opacity: .7;
  z-index: 0;
  pointer-events: none;
}

/* Hide small inline Darasa image on desktop to avoid double-visuals */
#projects .project-showcase:nth-of-type(2) img[alt*="Darasa" i]{ display: none; }

/* Mobile: show inline image centered; disable decorative layers */
@media (max-width: 860px){
  #projects .project-showcase:nth-of-type(2) img[alt*="Darasa" i]{
    display: block;
    width: min(88%, 560px);
    margin: 0 auto var(--space-lg);
    box-shadow:
      0 18px 48px rgba(0,122,255,.18),
      0 6px 22px rgba(0,0,0,.10);
    border-radius: 20px;
  }
  #projects .project-showcase:nth-of-type(2)::before,
  #projects .project-showcase:nth-of-type(2)::after{ display: none; }
}

/* ----------------------- */
/* Dark theme adjustments  */
/* ----------------------- */

/* Balance decorative images/glow on dark */
[data-theme="dark"] #projects .project-showcase:first-of-type::before,
[data-theme="dark"] #projects .project-showcase:nth-of-type(2)::before{
  opacity: .9;
  filter: brightness(0.95) saturate(1.05);
}
[data-theme="dark"] #projects .project-showcase:first-of-type::after,
[data-theme="dark"] #projects .project-showcase:nth-of-type(2)::after{
  background: radial-gradient(closest-side, rgba(var(--primary-rgb), .22), transparent 74%);
  opacity: .6;
}

/* Slightly brighter glass cards in dark for readability */
[data-theme="dark"] .glass{
  background: rgba(255,255,255,.10) !important;
  border-color: rgba(255,255,255,.16) !important;
}
[data-theme="dark"] .glass-heavy{
  background: rgba(255,255,255,.18) !important;
}
[data-theme="dark"] .glass-light{
  background: rgba(255,255,255,.06) !important;
}
.project-showcase .project-cover:hover{
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 24px 64px rgba(0,122,255,.22),
    0 10px 28px rgba(0,0,0,.14);
}

/* Mobile: single column, centered image, no clipping */
@media (max-width: 860px){
  .project-showcase{
    grid-template-columns: 1fr;
    row-gap: var(--space-lg);
  }
  .project-showcase::before{
    left: 50%; transform: translate(-50%,-50%);
    width: min(88%, 560px); height: 56%;
    filter: blur(14px);
  }
  .project-showcase .project-cover{
    margin: 0 auto;
    width: min(92%, 560px);
  }
}

@media (min-width: 900px){
  .modal-body{ grid-template-columns: 1.25fr .9fr; }
}
