/* =============================================
   BASE STYLES (desktop)
============================================= */

body {
  background: #111;
  display: flex;
  justify-content: center;
  padding: 60px 0;
  margin: 0;
  font-family: "Avenir", sans-serif;
}

.card-grid {
  display: flex;
  gap: 40px;
}

.card {
  width: 450px;
  height: 750px;
  perspective: 1200px;
  position: relative;
  overflow: visible;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.7s ease;
}

.card:hover .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  overflow: hidden;
}

.card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 60px 24px 48px 24px;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.6) 100%
  );
  color: white;
  font-family: "Avenir", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.03em;
  pointer-events: none;
}

.card-back {
  transform: rotateY(180deg);
}

.blue  { background: #1e4f8a; }
.red   { background: #8a1e1e; }
.teal  { background: #1e8a7a; }

.card-back-content {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  box-sizing: border-box;
}

.back-patch {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 240px;
  object-fit: contain;
}

.back-text-wrapper {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
}

.back-text {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.7;
  color: white;
}

/* ======================================
   BLUE CARD
====================================== */

.open-panel-blue {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: white;
  color: #1e4f8a;
  border: none;
  border-radius: 8px;
  font-size: 1.05rem;
  font-family: "Avenir", sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.slide-up-blue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background: #f8f5f2;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  padding: 25px 32px 32px 32px;
  box-sizing: border-box;
  transform: translateY(100%);
  transition: transform 0.35s ease;
  z-index: 10;
  backface-visibility: hidden;
}

.card-blue.panel-open .slide-up-blue {
  transform: translateY(0%);
}

.blue-panel-title {
  flex-shrink: 0;
  margin: 0 0 16px 0;
  font-size: 1.45rem;
  text-align: center;
  color: #111;
}

.video-gallery-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

.video-gallery {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.video-gallery::-webkit-scrollbar { display: none; }

.video-item {
  flex-shrink: 0;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
}

.video-item video {
  width: 100%;
  display: block;
  border-radius: 6px;
}

.video-item iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
}

.video-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 0.95rem;
  border-radius: 6px;
}

.video-gallery-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(
    to bottom,
    rgba(248, 245, 242, 0) 0%,
    rgba(248, 245, 242, 1) 100%
  );
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.close-bottom-blue {
  flex-shrink: 0;
  margin-top: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: none;
  border: 2.5px solid #1e4f8a;
  color: #1e4f8a;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  line-height: 1;
  transition: background 0.2s ease, transform 0.2s ease;
}

.close-bottom-blue:hover {
  background: rgba(30, 79, 138, 0.08);
  transform: scale(1.05);
}

/* ======================================
   RED CARD
====================================== */

.open-panel-red {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: white;
  color: #8a1e1e;
  border: none;
  border-radius: 8px;
  font-size: 1.05rem;
  font-family: "Avenir", sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.slide-up-red {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background: #f8f5f2;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  padding: 25px 32px 32px 32px;
  overflow-y: auto;
  box-sizing: border-box;
  transform: translateY(100%);
  transition: transform 0.35s ease;
  z-index: 10;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
}

.card-red.panel-open .slide-up-red {
  transform: translateY(0%);
}

.slide-up-content {
  color: #111;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.slide-up-content h2 {
  margin: 0 0 4px 0;
  font-size: 1.45rem;
  text-align: center;
}

.team-portraits {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-shrink: 0;
  margin: 4px 0 4px 0;
}

.team-portrait {
  flex: 1;
  min-width: 0;
}

.team-portrait img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  object-position: center 15%;
  border-radius: 6px;
  display: block;
}

.team-portrait:last-child img {
  object-position: center 25%;
}

.team-portrait span {
  display: none;
}

.slide-up-content p {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.42;
  text-align: center;
}

.slide-up-content p:first-of-type {
  margin-top: 24px;
}


.close-bottom {
  flex-shrink: 0;
  margin-top: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: none;
  border: 2.5px solid #8a1e1e;
  color: #8a1e1e;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  line-height: 1;
  transition: background 0.2s ease, transform 0.2s ease;
}

.close-bottom:hover {
  background: rgba(138, 30, 30, 0.08);
  transform: scale(1.05);
}

/* ======================================
   TEAL CARD
====================================== */

.open-panel-teal {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: white;
  color: #1e8a7a;
  border: none;
  border-radius: 8px;
  font-size: 1.05rem;
  font-family: "Avenir", sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.slide-up-teal {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background: #f8f5f2;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  padding: 25px 32px 32px 32px;
  box-sizing: border-box;
  transform: translateY(100%);
  transition: transform 0.35s ease;
  z-index: 10;
  backface-visibility: hidden;
}

.card-teal.panel-open .slide-up-teal {
  transform: translateY(0%);
}

.teal-panel-title {
  flex-shrink: 0;
  margin: 0 0 16px 0;
  font-size: 1.45rem;
  text-align: center;
  color: #111;
}

.ad-gallery-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

.ad-gallery {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ad-gallery::-webkit-scrollbar { display: none; }

.ad-item {
  flex-shrink: 0;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
}

.ad-item img {
  width: 100%;
  height: auto;
  display: block;
}

.ad-gallery-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(
    to bottom,
    rgba(248, 245, 242, 0) 0%,
    rgba(248, 245, 242, 1) 100%
  );
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.close-bottom-teal {
  flex-shrink: 0;
  margin-top: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: none;
  border: 2.5px solid #1e8a7a;
  color: #1e8a7a;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  line-height: 1;
  transition: background 0.2s ease, transform 0.2s ease;
}

.close-bottom-teal:hover {
  background: rgba(30, 138, 122, 0.08);
  transform: scale(1.05);
}

/* =============================================
   TABLET (1100px and below)
============================================= */

@media (max-width: 1100px) {

  body {
    padding: 40px 0 60px 0;
    align-items: center;
  }

  .card-grid {
    flex-direction: column;
    align-items: center;
    gap: 32px;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
  }

  .card {
    width: min(450px, 90vw);
    height: calc(min(450px, 90vw) * (750 / 450));
  }

  .card:hover .card-inner {
    transform: none;
  }

  .card-label {
    font-size: 1.1rem;
    padding: 50px 20px 44px 20px;
  }

  .back-patch {
    width: min(240px, 50vw);
    height: min(240px, 50vw);
  }

  .back-text {
    font-size: 1.05rem;
  }
}

/* =============================================
   MOBILE (480px and below)
============================================= */

@media (max-width: 480px) {

  body {
    padding: 24px 0 48px 0;
  }

  .card-grid {
    gap: 24px;
    padding: 0 16px;
  }

  .back-text {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .back-patch {
    width: min(200px, 48vw);
    height: min(200px, 48vw);
  }

  .slide-up-blue,
  .slide-up-red,
  .slide-up-teal {
    padding: 20px 20px 24px 20px;
  }

  .slide-up-content h2,
  .blue-panel-title,
  .teal-panel-title {
    font-size: 1.25rem;
  }

  .team-portrait img {
    height: 130px;
  }

  .slide-up-content p {
    text-wrap: pretty;
  }
}
