@charset "utf-8";
/* CSS Document */
* { box-sizing: border-box; }
  body { margin: 0; font-family: 'Montserrat', sans-serif; }

  /* Demo filler so you can scroll - delete these two blocks on your real page */
  .demo-space { height: 80vh; display: grid; place-items: center; background: #f2f2f2; font-size: 1.2rem; }

  /* ---------- FLIP SECTION ---------- */

  /* Scroll runway: the taller this is, the slower the spin.
     Total scroll distance for the flip = runway height - 700px. */
  .flip-runway {
    position: relative;
    width: 100%;
    height: 1500px;            /* adjust for faster/slower flip */
  }

  /* Stays pinned in view while the flip happens */
  .flip-sticky {
    position: sticky;
    top: 0;
    width: 100%;
    height: 700px;
    perspective: 1800px;
    overflow: hidden;          /* stops horizontal scrollbar during rotation */
  }

  .flip-card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    will-change: transform;
  }

  .flip-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
  }

  /* FRONT: video background */
  .flip-front { background: #000; }
  .flip-front video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* BACK: text + image */
.flip-back {
  transform: rotateY(180deg);
  background: #FFFFFF;
  color: #000;
  display: flex;
  align-items: stretch;      /* children fill full height */
  justify-content: flex-start;
  gap: 0;                    /* remove gap so the image sits flush */
  padding: 0;                /* remove side padding so the image reaches the edge */
}

.flip-back .text {
  flex: 0 0 50%;             /* exactly 50% */
  max-width: none;
  display: flex;
  flex-direction: column;
  justify-content: center;   /* keep text vertically centred */
  padding: 0 6%;             /* put the breathing room back on the text only */
}

.flip-back .image {
  flex: 0 0 50%;             /* exactly 50% */
  max-width: none;
  position: relative;
}

.flip-back img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;          /* remove the 520px cap */
  object-fit: cover;
  border-radius: 0;          /* remove if you want square edges against the page */
  display: block;
}

@media (max-width: 800px) {
  .flip-back {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    text-align: center;
  }
  .flip-back .text {
    flex: 0 0 auto;
    padding: 150px 6% 20px;  /* clears the nav bar */
  }
  .flip-back .image {
    flex: 1 1 auto;          /* image takes the remaining space */
    min-height: 200px;
  }
  .flip-back h2 { font-size: 25px; }
  .flip-back p  { font-size: 20px; line-height: 1.6; }
}
