/* Reset léger */
*{ box-sizing: border-box; }
html,body{ height:100%; margin:0; overflow: hidden; }
body{ font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }

/* Fond océan (fallback CSS) */
.ocean{
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 650px at 35% 30%, rgba(255,255,255,.10), transparent 60%),
    radial-gradient(1000px 800px at 70% 75%, rgba(0,210,255,.10), transparent 62%),
    radial-gradient(circle at 50% 50%,
      #1ea7c6 0%,
      #0a6f93 28%,
      #07405e 55%,
      #031b2a 100%
    );
  z-index: 0;
}

/* Canvas WebGL */
#oceanCanvas{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Conteneur centré */
.stage{
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 3vh 3vw;
}

/* Meilleur vh sur mobile (barres navigateur) */
@supports (height: 100dvh){
  .stage{ min-height: 100dvh; }
}

/* Accessibilité */
.sr-only{
  position:absolute;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);
  white-space:nowrap;border:0;
}

/* ------------------ Île ------------------ */
.island{
  /* Desktop/tablette */
  width: min(697px, 92vw);
  height: min(782px, 90vh);

  position: relative;
  perspective: 1200px;
  transform-style: preserve-3d;
  cursor: pointer;
  outline: none;
}

@supports (height: 100dvh){
  .island{ height: min(782px, 90dvh); }
}

.island:focus-visible{
  outline: 3px solid rgba(255,255,255,.75);
  outline-offset: 10px;
  border-radius: 16px;
}

/* Faces */
.island-face{
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;

  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  transition: transform .85s cubic-bezier(.4,.2,.2,1);
  transform-origin: center center;
  will-change: transform;
}

.island-face.front{
  transform: rotateY(0deg) translateZ(2px);
  pointer-events: auto;
  z-index: 2;
}

.island-face.back{
  transform: rotateY(180deg) translateZ(0);
  cursor: default;
  pointer-events: none;
  z-index: 1;
}

.island.is-flipped .front{
  transform: rotateY(180deg) translateZ(2px);
  pointer-events: none;
}
.island.is-flipped .back{
  transform: rotateY(360deg) translateZ(0);
  pointer-events: auto;
}

/* Forme masquée */
.island-shape{
  position: absolute;
  inset: 0;

  -webkit-mask-image: url("reunion-mask-soft.svg");
  mask-image: url("reunion-mask-soft.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* Recto : image */
.island-shape-front{
  --zoom: 110%;
  --pos-x: 50%;
  --pos-y: 50%;

  background-color: #062a3c;
  background-image: url("reunion-satellite.jpg");
  background-repeat: no-repeat;
  background-size: var(--zoom) auto;
  background-position: var(--pos-x) var(--pos-y);
}

.island-shape-front::before{
  content:"";
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.18);
}

/* CTA : responsive + centrée */
.island-cta{
  position:absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  padding: clamp(10px, 2.2vw, 18px) clamp(16px, 4vw, 34px);
  border-radius: 999px;
  background: rgba(0,0,0,.38);
  color: rgba(255,255,255,.92);
  font-size: clamp(14px, 3.2vw, 24px);
  letter-spacing: .2px;
  pointer-events: none;
}

/* Verso : symétrie + fondu vers l’océan */
.island-shape-back{
  background: radial-gradient(circle at 50% 50%,
    rgba(3,27,42,.60) 0%,
    rgba(3,27,42,.45) 55%,
    rgba(3,27,42,.22) 78%,
    rgba(3,27,42,0) 100%
  );

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  transform: scaleX(-1);
  transform-origin: center;

  display: grid;
  place-items: center;
  padding: 8% 9%;
}

.island-shape-back .panel{
  transform: scaleX(-1);
  transform-origin: center;
}

/* Panel : dimensions fluides + reste dans la silhouette */
.panel{
  width: min(360px, 72%);
  max-height: 78%;

  overflow: auto;
  -webkit-overflow-scrolling: touch;

  padding: 15px 15px 13px;
  color: #fff;

  display: grid;
  align-content: start;
  gap: 10px;

  border: 0;
  border-radius: 0;
  background: transparent;

  /* ✅ remonte, mais de façon adaptative */
  margin-top: clamp(-12%, -6vh, -4%);
}

.panel h2{
  margin: 0;
  text-align: center;
  font-size: clamp(18px, 4.2vw, 20px);
  letter-spacing: .3px;
}

.contact{
  display: grid;
  gap: 10px;
}

.contact label{
  display: grid;
  gap: 6px;
  font-size: 13px;
  opacity: .95;
}

.contact input,
.contact textarea{
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.25);
  color: #fff;
  padding: 9px 10px;
  outline: none;
}

.contact input:focus,
.contact textarea:focus{
  border-color: rgba(255,255,255,.55);
}

.contact button{
  margin-top: 4px;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255,255,255,.92);
  color: #0b3a53;
  font-weight: 650;
  cursor: pointer;
}

.hint{
  margin: 6px 0 0;
  font-size: 12px;
  opacity: .75;
  text-align: center;
}

/* Mobile : l’île un peu plus courte + panel plus petit */
@media (max-width: 480px){
  .island{
    width: min(560px, 92vw);
    height: min(680px, 88vh);
  }
  @supports (height: 100dvh){
    .island{ height: min(680px, 88dvh); }
  }

  .island-shape-back{ padding: 7% 8%; }

  .panel{
    width: min(320px, 78%);
    max-height: 72%;
    padding: 13px 12px 11px;
    margin-top: clamp(-10%, -4vh, -3%);
    gap: 9px;
  }

  .contact textarea{ rows: 5; }
}

/* Masquer scrollbar du panel (scroll OK) */
.panel{
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.panel::-webkit-scrollbar{
  width: 0;
  height: 0;
}

/* ✅ Desktop : le panel dans l'île doit TOUJOURS être remis à l'endroit */
.island-shape-back .panel{
  transform: scaleX(-1);
}

/* ✅ Mobile uniquement : panel "free" + apparition au milieu du flip */
@media (max-width: 520px){
  .stage{ padding: 0; }
  .panel.panel--free{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);


    width: min(92vw, 420px);
    max-height: min(80dvh, 560px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;

    padding: 16px 14px 14px;
    border-radius: 18px;
    background: rgba(0,0,0,.38);
    border: 1px solid rgba(255,255,255,.14);

    /* apparition "milieu du flip" */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s ease, visibility 0s linear .18s;
  }

  .island.is-flipped .panel.panel--free{
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: .42s, .42s;
  }
}
