/* ——— Accueil ———
   Tailles fluides en largeur ET en hauteur (vw / vh) : sur une tablette couchée,
   où la barre du navigateur laisse peu de hauteur, tout tient sur un écran. */
.home {
  padding: clamp(14px, 3.2vh, 56px) clamp(16px, 3vw, 24px);
  padding-top: max(clamp(14px, 3.2vh, 56px), env(safe-area-inset-top));
  padding-bottom: max(clamp(14px, 3.2vh, 56px), env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3.2vh, 48px);
}

.home-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2px, 0.8vh, 8px);
  text-align: center;
}
.home-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(44px, min(8vw, 11vh), 92px);
  line-height: 0.95;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--blue);
  text-wrap: balance;
}
.home-title--small {
  font-size: clamp(40px, 6vw, 64px);
  text-align: center;
}
/* Signature « par Eidos-Simul.fr », calée sous la fin du titre comme un logo. */
.home-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.home-by {
  /* Assez bas pour laisser passer la jambe du « p » de Skopéo. */
  margin: clamp(10px, 2.2vh, 20px) 0.15em 0 0;
  display: flex;
  align-items: center;
  gap: 0.62em;
  font-size: clamp(13px, min(1.6vw, 2.3vh), 17px);
  line-height: 1;
  color: var(--text-muted);
}
.home-by::before {
  content: '';
  width: 2.4em;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(182, 189, 255, 0), var(--blue-soft));
}
.home-by__par {
  font-size: 0.76em;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.home-by__name {
  font-family: var(--font-display);
  font-size: 1.12em;
  font-weight: 600;
  color: var(--ink);
}
.home-by__tld {
  color: var(--blue);
}
.home-subtitle {
  margin: 0;
  font-size: clamp(16px, min(2.2vw, 3.2vh), 24px);
  line-height: 1.2;
  font-weight: 400;
  color: var(--text-muted);
}

/* Code de synchronisation */
.sync {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.4vh, 12px);
}
.sync-label {
  font-size: clamp(16px, 2.8vh, 19px);
  line-height: 1.2;
  font-weight: 400;
  color: var(--text-muted);
}
.sync-field {
  position: relative;
  display: flex;
}
.sync-input {
  width: 280px;
  height: clamp(56px, 10vh, 76px);
  padding: 0 24px 0 calc(24px + 0.5em);
  border: 2px solid var(--surface);
  border-radius: var(--radius-tab);
  background: var(--surface);
  box-shadow: var(--shadow-pill);
  font-size: clamp(30px, 6vh, 40px);
  font-weight: 500;
  letter-spacing: 0.5em;
  text-align: center;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.sync-input::placeholder {
  color: var(--placeholder);
}
.sync-input:focus,
.sync-input:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--shadow-blue);
}
.sync-input[aria-invalid='true'] {
  border-color: var(--coral);
}
.sync-ok {
  position: absolute;
  right: -52px;
  top: 50%;
  margin-top: -18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sync-message {
  margin: 0;
  max-width: 340px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 500;
  text-align: center;
  color: var(--ink);
}
.sync-message:empty {
  display: none;
}
.sync-message::before {
  content: '';
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--coral);
}

/* Cartes de rôle : côte à côte dès que la largeur le permet (tablette debout comprise). */
.roles {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(16px, 2.6vw, 36px);
  width: 100%;
  max-width: 1240px;
}
@media (min-width: 560px) {
  .roles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* Deux colonnes : la carte Dinamap occupe seule la dernière rangée. */
  #go-dinamap {
    grid-column: 1 / -1;
  }
}
@media (min-width: 760px) {
  .roles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  #go-dinamap {
    grid-column: auto;
  }
}
.role-card {
  min-width: 0;
  padding: clamp(12px, min(2vw, 2.6vh), 20px);
  background: var(--surface);
  border-radius: clamp(30px, 4vw, 46px);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 3vh, 28px);
  text-decoration: none;
  color: var(--ink);
  container-type: inline-size;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}
.role-card:hover {
  color: var(--ink);
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
}
.role-card:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 6px;
}

.role-preview {
  height: clamp(110px, 24vh, 250px);
  border-radius: clamp(18px, 5cqw, 26px);
}

/* Aperçu Pilote : trois curseurs */
.role-preview--pilot {
  background: var(--preview);
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  padding: 0 clamp(18px, 9cqw, 44px);
}
.mini-slider {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3.5cqw, 18px);
}
.mini-slider--fc {
  --c: var(--teal-deep);
  --v: 46%;
}
.mini-slider--sp {
  --c: var(--amber);
  --v: 82%;
}
.mini-slider--bp {
  --c: var(--blue);
  --v: 63%;
}
.mini-slider__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c);
  flex: none;
}
.mini-slider__track {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--track);
  position: relative;
}
.mini-slider__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--v);
  border-radius: 4px;
  background: var(--c);
}
.mini-slider__thumb {
  position: absolute;
  left: var(--v);
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(50, 57, 78, 0.25);
  border: 4px solid var(--c);
}

/* Aperçu Scope : courbes ECG et pléthysmographie */
.role-preview--scope {
  background: var(--night);
  display: flex;
  gap: 8px;
  padding: clamp(12px, 3.4vh, 24px) 0;
  overflow: hidden;
}
.preview-traces {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.preview-traces svg {
  width: 100%;
  display: block;
}
.preview-traces .trace-ecg {
  flex: 1;
  min-height: 0;
}
.preview-traces .trace-pleth {
  height: 38%;
}
.preview-sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5%;
  background: var(--night);
  animation: home-sweep 3.2s linear infinite;
}
@keyframes home-sweep {
  from {
    left: -5%;
  }
  to {
    left: 100%;
  }
}
.preview-values {
  width: clamp(64px, 22cqw, 112px);
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding-right: clamp(12px, 5cqw, 24px);
  font-weight: 400;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}
.preview-values__fc {
  font-size: clamp(32px, min(11cqw, 7vh), 56px);
  color: var(--teal);
}
.preview-values__sp {
  font-size: clamp(24px, min(8cqw, 5vh), 40px);
  color: var(--amber);
}

/* Aperçu Dinamap : l'appareil en miniature */
.role-preview--dinamap {
  background: var(--preview);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 2.4vh, 18px);
}
.dinamap-preview {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 14px rgba(50, 57, 78, 0.22));
}
.pv-body {
  fill: var(--surface);
}
.pv-base {
  fill: var(--blue);
}
.pv-light {
  fill: var(--track);
}
.pv-key {
  fill: var(--control-hover);
}
.pv-key--coral {
  fill: var(--coral);
}
.pv-key--blue {
  fill: var(--blue);
}
.pv-key--amber {
  fill: var(--amber);
}
.pv-key--ink {
  fill: var(--ink);
}
.pv-bezel {
  fill: var(--ink);
}
.pv-screen {
  fill: var(--night);
}
.pv-ghost {
  fill: rgba(199, 213, 224, 0.07);
}
.pv-pni {
  fill: var(--blue-soft);
}
.pv-pulse {
  fill: var(--teal);
}
.pv-sp {
  fill: var(--amber);
}
.pv-port {
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 3;
  fill: #1c2540;
}
.pv-port--sp {
  stroke: var(--amber);
}

.role-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 clamp(4px, 3cqw, 16px) clamp(4px, 1.4vh, 12px) clamp(6px, 4cqw, 20px);
}
.role-foot__text {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 1vh, 8px);
  min-width: 0;
}
.role-name {
  font-family: var(--font-display);
  font-size: clamp(30px, min(9.5cqw, 6.4vh), 48px);
  line-height: 0.9;
  font-weight: 600;
}
/* Le titre de la carte devient le titre de la page à l'ouverture. */
#go-pilot .role-name {
  view-transition-name: pilot-title;
}
#go-scope .role-name {
  view-transition-name: scope-title;
}
#go-dinamap .role-name {
  view-transition-name: dinamap-title;
}
.role-sub {
  font-size: clamp(15px, min(4cqw, 2.8vh), 20px);
  line-height: 1.2;
  font-weight: 400;
  color: var(--text-muted);
}
.role-go {
  width: clamp(48px, 8vh, 64px);
  height: clamp(48px, 8vh, 64px);
  border-radius: 50%;
  background: var(--blue);
  box-shadow: var(--shadow-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* ——— Pied de page : les autres sites d'Eidos-Simul ——— */
.home-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.4vh, 12px) 18px;
}
.home-foot__label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
}
.home-foot__label::before {
  content: '';
  width: 28px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(182, 189, 255, 0), var(--blue-soft));
}
.home-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.site-link {
  --c: var(--blue);
  --c-soft: rgba(72, 91, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 6px 16px 6px 6px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-pill);
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}
.site-link:hover {
  color: var(--ink);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}
.site-link--pharma {
  --c: var(--teal-ink);
  --c-soft: rgba(51, 211, 212, 0.2);
}
.site-link__icon {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-soft);
  color: var(--c);
}
.site-link__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.1;
}
.site-link__name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}
.site-link__sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}
.site-link__go {
  margin-left: 4px;
  color: var(--placeholder);
  transition:
    transform 0.25s var(--ease-out),
    color 0.2s ease;
}
.site-link:hover .site-link__go {
  color: var(--c);
  transform: translate(2px, -2px);
}

/* Tablette couchée peu haute : aperçus et liens plus compacts pour que tout tienne. */
@media (max-height: 560px) {
  .home {
    gap: 10px;
  }
  .role-preview {
    height: clamp(80px, 18vh, 250px);
  }
  .site-link {
    min-height: 44px;
    padding: 4px 14px 4px 4px;
  }
  .site-link__icon {
    width: 36px;
    height: 36px;
  }
  .site-link__sub {
    display: none;
  }
}

/* ——— Téléphones ——— */
@media (max-width: 480px) {
  .sync-input {
    padding: 0 52px 0 calc(12px + 0.5em);
  }
  .sync-ok {
    right: 12px;
  }
  .role-preview {
    height: clamp(150px, 26vh, 200px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .preview-sweep {
    display: none;
  }
  .role-card,
  .role-card:hover,
  .site-link,
  .site-link:hover,
  .site-link__go,
  .site-link:hover .site-link__go {
    transition: none;
    transform: none;
  }
}
