/* ----------------------------------------
   PROJECTS PAGE STYLES
----------------------------------------- */

.hb-projects {
  padding-top: 120px;
}

/* Hero — matches .hb-about-hero */
.hb-projects-hero {
  text-align: center;
  padding: clamp(60px, 10vw, 100px) 20px clamp(48px, 7vw, 72px);
  background: var(--hb-bg);
}

.hb-projects-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(48px, 6.5vw, 70px);
  font-weight: 300;
  letter-spacing: -0.05em;
  line-height: 1.0;
  text-transform: uppercase;
  margin-bottom: 0;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Main section — frosted glass like .hb-career */
.hb-projects-section {
  position: relative;
  background: rgb(var(--hb-glass) / 0.72);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  padding: clamp(48px, 7vw, 96px) clamp(24px, 3vw, 48px);
}

.hb-projects-section::before,
.hb-projects-section::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgb(var(--hb-glass) / 0.95) 30%,
    rgba(200, 230, 255, 0.9) 50%,
    rgb(var(--hb-glass) / 0.95) 70%,
    transparent);
  box-shadow: 0 0 10px rgba(180, 220, 255, 0.6);
}
.hb-projects-section::before { top: 0; }
.hb-projects-section::after  { bottom: 0; }

.hb-projects-inner {
  max-width: 1300px;
  margin: 0 auto;
}

/* ----------------------------------------
   THREE PROJECT CARDS
----------------------------------------- */

.hb-project-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 3vw, 40px);
}

.hb-project-card {
  display: block;
  text-decoration: none;
  -webkit-text-decoration: none;
  position: relative;
  background: rgb(var(--hb-glass) / 0.78);
  border: 1px solid rgb(var(--hb-glass) / 0.6);
  border-radius: 20px;
  padding: 36px 32px 32px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  /* Safari fix: force GPU layer so overflow:hidden clips child canvas */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgb(var(--hb-glass) / 1);
  -webkit-transition: -webkit-transform 0.25s ease, background 0.25s ease,
              box-shadow 0.25s ease, border-color 0.25s ease;
  transition: transform 0.25s ease, background 0.25s ease,
              box-shadow 0.25s ease, border-color 0.25s ease;
  /* Tap highlight off on iOS */
  -webkit-tap-highlight-color: transparent;
}

.hb-project-card:hover {
  transform: translateY(-10px) scale(1.03);
  border-color: rgba(96, 165, 250, 0.5);
  background: rgb(var(--hb-glass) / 0.95);
  box-shadow: 0 24px 56px rgba(96, 165, 250, 0.22), 0 8px 24px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgb(var(--hb-glass) / 0.9);
}

/* Institution tag */
.hb-project-card-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hb-text-3);
  margin-bottom: 12px;
}

/* Card title — always gradient */
.hb-project-card-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1.4;
  margin-bottom: 16px;
  margin-top: 16px;
  text-decoration: none;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Tags */
.hb-project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 40px;
}

.hb-project-tags span {
  padding: 4px 10px;
  background: rgb(var(--hb-line) / 0.04);
  color: var(--hb-text-2);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  letter-spacing: 0.01em;
  transition: background 0.2s, color 0.2s;
}

.hb-project-card:hover .hb-project-tags span {
  background: rgba(96, 165, 250, 0.1);
  color: #38bdf8;
}

/* ----------------------------------------
   EXPANDABLE DETAIL PANELS
----------------------------------------- */

.hb-project-detail-panel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}

.hb-project-detail-panel--active {
  max-height: 1000px;
  opacity: 1;
}

.hb-project-detail-inner {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid rgb(var(--hb-line) / 0.06);
}

.hb-project-detail-placeholder {
  font-size: 16px;
  color: var(--hb-text-3);
  font-style: italic;
  text-align: center;
  padding: 24px 0;
}

/* ----------------------------------------
   RESPONSIVE
----------------------------------------- */

/* Tablet: 2 columns */
@media (max-width: 1024px) and (min-width: 601px) {
  .hb-project-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Phone: 1 column */
@media (max-width: 600px) {
  .hb-projects-section {
    padding: 32px 16px 40px;
  }

  .hb-project-cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .hb-projects-hero {
    padding: 24px 16px 16px;
  }

  .hb-project-card {
    padding: 24px 20px 20px;
    /* solid fallback when backdrop-filter unsupported */
    background: rgb(var(--hb-glass) / 0.95);
    text-decoration: none !important;
    display: block;
  }

  .hb-project-card-title {
    font-size: clamp(28px, 7vw, 36px);
  }

  /* Return button — force center on mobile */
  .hb-pd-return {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    padding: 40px 24px 60px;
  }

  .hb-pd-return-btn {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    margin: 0 auto;
    /* solid fallback without backdrop-filter */
    background: rgb(var(--hb-glass) / 0.9);
  }
}

/* Backdrop-filter fallback — covers browsers without webkit or standard support */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .hb-project-card {
    background: rgb(var(--hb-glass) / 0.95) !important;
    text-decoration: none !important;
  }
  .hb-pd-return-btn {
    background: rgb(var(--hb-glass) / 0.9) !important;
  }
}

/* Safari / iOS specific */
@media not all and (min-resolution: 0.001dpcm) {
  @supports (-webkit-appearance: none) {
    .hb-project-card {
      -webkit-backdrop-filter: blur(24px) saturate(180%);
    }
    .hb-water-canvas {
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
    }
  }
}
/* ── Return to Projects button — Liquid Glass ── */
.hb-pd-return {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 56px 24px 80px;
  background: var(--hb-bg);
  text-align: center;
}

.hb-pd-return-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 40px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--hb-text);
  text-decoration: none;
  border-radius: 980px;
  background: rgb(var(--hb-glass) / 0.65);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgb(var(--hb-line) / 0.08);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.07),
    inset 0 1px 0 rgb(var(--hb-glass) / 0.9);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
}

/* animated liquid shimmer — sweeps across surface above the text */
@keyframes liquid-sweep {
  0%   { transform: translateX(-120%) skewX(-20deg); opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateX(320%) skewX(-20deg); opacity: 0; }
}

@keyframes liquid-sweep-2 {
  0%   { transform: translateX(-120%) skewX(-15deg); opacity: 0; }
  20%  { opacity: 0.6; }
  80%  { opacity: 0.6; }
  100% { transform: translateX(320%) skewX(-15deg); opacity: 0; }
}

.hb-pd-return-btn::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 0;
  width: 30%;
  height: 140%;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgb(var(--hb-glass) / 0.55) 40%,
    rgba(200, 230, 255, 0.35) 55%,
    rgb(var(--hb-glass) / 0.55) 70%,
    transparent 100%
  );
  animation: liquid-sweep 4s ease-in-out infinite;
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 1;
}

.hb-pd-return-btn::after {
  content: '';
  position: absolute;
  top: -20%;
  left: 0;
  width: 18%;
  height: 140%;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(180, 210, 255, 0.4) 50%,
    transparent 100%
  );
  animation: liquid-sweep-2 4s 0.6s ease-in-out infinite;
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 1;
}

.hb-pd-return-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 32px rgba(96, 165, 250, 0.18),
    inset 0 1px 0 rgb(var(--hb-glass) / 0.95);
}

/* ── Water Canvas Overlay ── */
.hb-water-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: 20px;
  /* normal blending: "screen" could only lighten, so troughs never showed and
     the ripple turned into grey haze on the dark theme */
  z-index: 5;
}
