/*
 * BBBS Flipbox
 * Brand: #00fc87 (primary), black text on green and black bg everywhere else
 * Front: full-bleed image with 1px green border
 * Back: green/black scheme, left image (square), right text, mobile stacks
 *
 * Fonts:
 * - Steelfish 400 (headlines, button label)
 * - Zilla Slab 400 (body)
 * Provide local @font-face if you host fonts at /assets/fonts/.
 */

/* Optional: host fonts locally; if you don't have files yet, this simply falls back gracefully */
@font-face {
  font-family: "Steelfish";
  src: url("../fonts/Steelfish-Regular.woff2") format("woff2"),
       url("../fonts/Steelfish-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Zilla Slab";
  src: url("../fonts/ZillaSlab-Regular.woff2") format("woff2"),
       url("../fonts/ZillaSlab-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Root variables for easy tuning */
:root {
  --bbbs-green: #00fc87;
  --bbbs-black: #000000;
  --bbbs-radius: 16px;
  --bbbs-gap: 24px;
  --bbbs-maxw: 100%;
  --bbbs-perspective: 1000px;

  --bbbs-head-font: "Steelfish", Impact, "Anton", sans-serif;
  --bbbs-body-font: "Zilla Slab", Georgia, "Times New Roman", serif;

  --bbbs-head-size: 58px;   /* per spec */
  --bbbs-copy-size: 18px;   /* per spec */
  --bbbs-btn-size: 28px;    /* per spec */
}

#flipbox-section-container {
    background: var(--bbbs-black); 
}

/* Container */
.bbbs-flipbox {
  position: relative;
  width: 1000px;
  max-width:100%;
  margin: 10px;
  padding: 10px;
  perspective: var(--bbbs-perspective);
  -webkit-perspective: var(--bbbs-perspective);
  background: var(--bbbs-black);
  border: 1px solid var(--bbbs-green);
  border-radius: var(--bbbs-radius);
  overflow: hidden; /* keep corners clean */
  aspect-ratio: 1440 / 810;
}

.flipbox-wrapper {
    display: flex;
  justify-content: center; /* centers horizontally */
  flex-wrap: wrap;          /* allows multiple rows on smaller screens */
  gap: 10px;
}

/* 3D inner */
.bbbs-flipbox__inner {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(.2,.7,.2,1);
  will-change: transform;
}

/* Faces */
.bbbs-flipbox__face {
  position: relative;
  width: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  box-sizing: border-box;
}

/* FRONT */
.bbbs-flipbox__front {
  transform: rotateY(0deg);
  background: var(--bbbs-black);
}

.bbbs-flipbox__front-img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1440 / 810;
  object-fit: cover;
  background: var(--bbbs-black);
}

.bbbs-flipbox__front-placeholder {
  display: grid;
  place-items: center;
  min-height: 300px;
  color: var(--bbbs-green);
  background: var(--bbbs-black);
  font-family: var(--bbbs-head-font);
  border-top: 1px solid var(--bbbs-green);
}

/* BACK */
.bbbs-flipbox__back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  background: var(--bbbs-black);
  color: var(--bbbs-green); /* default text color; copy area overrides to black on green surfaces as needed */
}

/* Grid: image left (square), text right */
.bbbs-flipbox__back-grid {
  display: grid;
  height: 100%;
  grid-template-columns: 1fr 1.5fr;
  gap: var(--bbbs-gap);
  align-items: center; /* centers vertically */
  justify-items: center; /* optional, also centers horizontally if widths differ */
  padding: clamp(16px, 3vw, 32px);
}

/* Left image block */
.bbbs-flipbox__back-media {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bbbs-black);
  border: none;
  border-radius: var(--bbbs-radius);
  overflow: hidden;
}

.bbbs-flipbox__back-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;      /* square */
  object-fit: cover;
  object-position: center;
}

.bbbs-flipbox__back-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  color: var(--bbbs-green);
  background: var(--bbbs-black);
}

/* Right text block */
.bbbs-flipbox__back-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  text-align: left; /* per spec */
}

.bbbs-flipbox__headline {
  margin: 0 0 6px 0;
  font-family: var(--bbbs-head-font);
  font-weight: 600;
  font-size: var(--bbbs-head-size);
  line-height: 1;
  color: var(--bbbs-green);
}

.bbbs-flipbox__copy {
  font-family: var(--bbbs-body-font);
  font-weight: 400;
  font-size: var(--bbbs-copy-size);
  line-height: 1.6;
  color: #fff!important;
}

.bbbs-flipbox__copy p {
  margin: 0 0 10px 0;
}

/* CTA Button – pill, green bg, black text */
.bbbs-flipbox__cta {
  margin-top: 8px;
}

.bbbs-flipbox__button {
  display: inline-block;
  font-family: var(--bbbs-head-font);
  font-weight: 600;
  font-size: var(--bbbs-btn-size);
  text-decoration: none;
  line-height: 1;
  padding: 12px 24px;
  background: var(--bbbs-green);
  color: var(--bbbs-black); /* per spec */
  border: 1px solid var(--bbbs-green);
  border-radius: 9999px; /* full pill */
  transition: transform .2s ease, box-shadow .2s ease;
  will-change: transform;
  text-transform: uppercase;
}

.bbbs-flipbox__button:focus,
.bbbs-flipbox__button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0,252,135,0.2);
}

/* Interaction: flip on hover and when toggled */
.bbbs-flipbox:hover .bbbs-flipbox__inner,
.bbbs-flipbox:focus-within .bbbs-flipbox__inner,
.bbbs-flipbox.is-flipped .bbbs-flipbox__inner {
  transform: rotateY(180deg);
}

/* The hidden-but-accessible toggle */
.bbbs-flipbox__toggle {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Mobile: stack back side (image on top) */
@media (max-width: 768px) {
  .bbbs-flipbox__back-grid {
    grid-template-columns: 1fr;
    align-items: center;
  }
}

/* Reduce motion preference – disable the spin but keep access to back via JS toggle */
@media (prefers-reduced-motion: reduce) {
  .bbbs-flipbox__inner {
    transition: none;
  }
}

.bbbs-flipbox__back-media,
.bbbs-flipbox__back-content {
  align-self: center;
}

.bbbs-flipbox__inner,
.bbbs-flipbox__face {
  height: 100%;
}

/* ---- MOBILE: disable 3D so text doesn't mirror ---- */
@media (max-width: 768px) {
  /* no perspective, no spin */
  .bbbs-flipbox {
    perspective: none !important;
    -webkit-perspective: none !important;
    aspect-ratio: auto; /* let height be natural */
  }

  .bbbs-flipbox__inner {
    transform: none !important;
    transform-style: flat !important;
    height: auto;
  }

  /* neutralize ALL transforms on faces/content */
  .bbbs-flipbox__face,
  .bbbs-flipbox__face * {
    transform: none !important;
  }

  /* make backface actually visible (Safari) */
  .bbbs-flipbox__front,
  .bbbs-flipbox__back {
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
    position: static !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* stop hover/keyboard flip from rotating the stack on mobile */
  .bbbs-flipbox:hover .bbbs-flipbox__inner,
  .bbbs-flipbox:focus-within .bbbs-flipbox__inner,
  .bbbs-flipbox.is-flipped .bbbs-flipbox__inner {
    transform: none !important;
  }

  /* show one face at a time via display */
  .bbbs-flipbox__front { display: block; }
  .bbbs-flipbox__back  { display: none;  }
  .bbbs-flipbox.is-flipped .bbbs-flipbox__front { display: none; }
  .bbbs-flipbox.is-flipped .bbbs-flipbox__back  { display: block; }

  /* mobile stack for the back (image on top, text below) */
  .bbbs-flipbox__back-grid { display: block; padding: clamp(16px, 4vw, 24px); }
  .bbbs-flipbox__back-media { margin: 0 0 var(--bbbs-gap) 0; }
  .bbbs-flipbox__back-img { width: 100%; height: auto; aspect-ratio: auto; object-fit: cover; display: block; }
  .bbbs-flipbox__front-img { height: auto; }
}