/* ============================================================
   SIMULATEUR DE VISION — Pôle Ophtalmo Melun
   Section autonome, réutilisable sur toute page (réfractif, myopie…).
   Dépend des variables de styles.css (--creme, --jade, --smooth…).
   ============================================================ */

.sim-band {
  background: var(--vert-profond);
  color: var(--creme);
  position: relative;
  overflow: hidden;
}
.sim-band .eyebrow { color: var(--jade); }
.sim-band .h2 { color: var(--creme); }
.sim-band .h2 em { color: var(--jade); font-style: italic; }

.sim-lede {
  margin-top: 1.5rem;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.6;
  color: rgba(245, 241, 234, 0.78);
}

.sim-sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* La photo prend la colonne large, le panneau s'étire à sa hauteur. */
.sim-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: stretch;
}

/* ---------- La fenêtre ---------- */

.sim-window-wrap { margin: 0; display: flex; flex-direction: column; }

/* La fenêtre absorbe toute la hauteur libre de sa colonne : elle vient donc
   exactement à la hauteur du panneau, quelle que soit la largeur de l'écran.
   La photo est carrée, le recadrage se fait sur les côtés (object-fit: cover)
   et reste sous 3 % aux largeurs de bureau courantes. */
.sim-window {
  position: relative;
  flex: 1 1 auto;
  min-height: 420px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--vert-noir);
  box-shadow: 0 24px 60px rgba(10, 27, 18, 0.45);
}

/* Les deux ambiances sont superposées et se fondent l'une dans l'autre. */
.sim-img {
  position: absolute; inset: 0;
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  /* Léger sur-cadrage : les bords adoucis par le flou restent hors champ. */
  transform: scale(1.06);
  transform-origin: center;
  opacity: 0;
  transition: opacity 0.5s var(--smooth);
  will-change: filter, opacity;
}
.sim-img.is-active { opacity: 1; }

/* Balayage lumineux au passage du laser. */
.sim-flash {
  position: absolute; inset: -20% -60%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    100deg,
    rgba(245, 241, 234, 0) 42%,
    rgba(245, 241, 234, 0.5) 50%,
    rgba(184, 204, 181, 0.24) 55%,
    rgba(245, 241, 234, 0) 62%
  );
}
.sim-flash.is-on { animation: sim-balayage 0.95s var(--smooth) 1; }

@keyframes sim-balayage {
  0%   { opacity: 0; transform: translateX(-42%); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(42%); }
}

/* Menuiserie discrète, pour que le cadre se lise comme une fenêtre. */
.sim-frame {
  position: absolute; inset: 0;
  pointer-events: none;
  border-radius: 16px;
  box-shadow:
    inset 0 0 0 1px rgba(245, 241, 234, 0.22),
    inset 0 0 90px rgba(10, 27, 18, 0.35);
}

.sim-caption {
  margin-top: 0.9rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgba(245, 241, 234, 0.62);
}

/* ---------- Le panneau de contrôle ----------
   Colonne flexible : le pied est poussé en bas, si bien que le panneau
   remplit exactement la hauteur de la photo. */

.sim-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(245, 241, 234, 0.06);
  border: 1px solid rgba(245, 241, 234, 0.14);
  border-radius: 16px;
  padding: 1.85rem;
}

.sim-state {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  font-size: 1.65rem;
  line-height: 1.15;
  color: var(--creme);
}

.sim-dioptrie {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  font-size: 2.9rem;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--jade);
  margin-top: 0.3rem;
  font-variant-numeric: tabular-nums;
}

.sim-sub {
  margin-top: 0.6rem;
  min-height: 4.6em;
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(245, 241, 234, 0.72);
}

/* ---------- L'acuité estimée ---------- */

.sim-acuite {
  margin-top: 0.4rem;
  border: 1px solid rgba(184, 204, 181, 0.32);
  border-radius: 14px;
  padding: 0.85rem 1.1rem 0.95rem;
  background: rgba(184, 204, 181, 0.07);
}

.sim-acuite-titre {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--jade);
}

.sim-acuite-valeur {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  font-size: 1.85rem;
  line-height: 1.1;
  color: var(--creme);
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}

.sim-acuite-note {
  margin-top: 0.3rem;
  min-height: 2.5em;
  font-size: 0.76rem;
  line-height: 1.5;
  color: rgba(245, 241, 234, 0.68);
}

/* ---------- Le curseur ---------- */

.sim-control { margin-top: 1.5rem; }

.sim-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--jade);
  margin-bottom: 0.6rem;
}

.sim-track { position: relative; }

/* Repère du zéro : 0 D sur une échelle de -8 à +6, soit 8/14 = 57,14 %. */
.sim-zero-mark {
  position: absolute;
  left: 57.14%;
  top: 50%;
  height: 16px;
  transform: translateY(-50%);
  width: 1px;
  background: rgba(184, 204, 181, 0.55);
  pointer-events: none;
}

.sim-range {
  -webkit-appearance: none; appearance: none;
  /* 44px : cible tactile minimale (RGAA, charte). Le rail reste à 3px, centré. */
  width: 100%; height: 44px;
  background: transparent;
  cursor: grab;
  display: block;
  margin: 0;
}
.sim-range:active { cursor: grabbing; }

.sim-range::-webkit-slider-runnable-track {
  height: 3px; border-radius: 999px;
  background: rgba(245, 241, 234, 0.3);
}
.sim-range::-moz-range-track {
  height: 3px; border-radius: 999px;
  background: rgba(245, 241, 234, 0.3);
}
.sim-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; margin-top: -11.5px;
  border-radius: 999px;
  background: var(--creme);
  border: 5px solid var(--vert-ophta);
  box-shadow: 0 2px 12px rgba(10, 27, 18, 0.5);
  transition: transform 0.2s var(--smooth);
}
.sim-range::-moz-range-thumb {
  width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--creme);
  border: 5px solid var(--vert-ophta);
  box-shadow: 0 2px 12px rgba(10, 27, 18, 0.5);
}
.sim-range:hover::-webkit-slider-thumb { transform: scale(1.12); }
.sim-range:focus-visible { outline-color: var(--jade); }

.sim-scale {
  position: relative;
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.74rem;
  color: rgba(245, 241, 234, 0.68);
  margin-top: 0.15rem;
}
.sim-scale-zero {
  position: absolute;
  left: 57.14%;
  transform: translateX(-50%);
  color: var(--jade);
  font-weight: 600;
}

/* ---------- Le geste principal : la chirurgie laser ---------- */

.sim-laser-bloc { margin-top: 1.4rem; }

.sim-laser {
  display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  width: 100%;
  min-height: 60px;
  padding: 1rem 1.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--jade);
  color: var(--vert-profond);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(184, 204, 181, 0.26);
  transition: background 0.25s var(--smooth), box-shadow 0.25s var(--smooth),
              transform 0.25s var(--smooth);
}
.sim-laser:hover {
  background: #d3e2cf;
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(184, 204, 181, 0.38);
}
.sim-laser:active { transform: translateY(0); }
.sim-laser:focus-visible { outline-color: var(--jade); outline-offset: 4px; }

.sim-baguette { flex: none; transition: transform 0.3s var(--smooth); }
.sim-laser:hover .sim-baguette { transform: translate(1px, -2px) rotate(-8deg); }

.sim-but {
  margin-top: 0.65rem;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(245, 241, 234, 0.62);
}

/* ---------- Lumière ambiante ---------- */

.sim-lumiere { margin-top: 1.4rem; }

.sim-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.sim-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 44px; /* cible tactile minimale */
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-family: inherit; font-size: 0.86rem; font-weight: 600;
  border: 1.5px solid rgba(245, 241, 234, 0.4);
  background: transparent;
  color: var(--creme);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s var(--smooth), border-color 0.25s var(--smooth),
              color 0.25s var(--smooth), transform 0.25s var(--smooth);
}
.sim-btn:hover { background: rgba(245, 241, 234, 0.12); transform: translateY(-2px); }
.sim-btn:focus-visible { outline-color: var(--jade); }
.sim-btn[aria-pressed="true"] {
  background: rgba(184, 204, 181, 0.2);
  border-color: var(--jade);
  color: var(--jade);
}

/* ---------- Pied du panneau ---------- */

.sim-pied {
  margin-top: auto;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(245, 241, 234, 0.14);
}
.sim-pied .sim-btn { width: 100%; justify-content: center; }

/* ---------- Mention légale ---------- */

.sim-disclaimer {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(245, 241, 234, 0.14);
  font-size: 0.85rem;
  line-height: 1.75;
  color: rgba(245, 241, 234, 0.62);
  max-width: 900px;
}
.sim-disclaimer strong { color: rgba(245, 241, 234, 0.82); font-weight: 600; }

/* ---------- Adaptatif ---------- */

@media (max-width: 1150px) {
  .sim-grid { grid-template-columns: 1fr; gap: 2.25rem; }
  /* En colonne unique, la photo redevient carrée : plus rien à égaliser. */
  .sim-window { flex: none; aspect-ratio: 1 / 1; min-height: 0; }
  .sim-panel { padding: 1.6rem; height: auto; }
  .sim-dioptrie { font-size: 2.6rem; }
  .sim-sub { min-height: 0; }
  .sim-acuite-note { min-height: 0; }
  .sim-pied { margin-top: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sim-btn,
  .sim-laser,
  .sim-baguette,
  .sim-img,
  .sim-range::-webkit-slider-thumb { transition: none; }
  .sim-flash.is-on { animation: none; }
}
