/* =========================================================
   Simulateur de coût de l'alternance · ISPN Rouen
   Charte : bleu marine #132B4A, orange #FFA000, Roboto / Roboto Slab
   ========================================================= */

@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/roboto-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("assets/fonts/roboto-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto Slab";
  src: url("assets/fonts/roboto-slab-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --marine: #132b4a;
  --marine-clair: #2a4568;
  --orange: #ffa000;
  --orange-pale: #fff4e0;
  --orange-texte: #7a4a00; /* orange foncé lisible sur fond clair */
  --fond: #ffffff;
  --carte: #f5f6f8;
  --bordure: #c9ced6;
  --texte: #132b4a;
  --texte-doux: #4a5a70;
  --erreur: #b00020;
  --erreur-pale: #fdecee;
  --rayon: 8px;
  --police-titre: "Roboto Slab", Georgia, serif;
  --police-texte: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police-texte);
  font-size: 1rem;
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

/* Le contenu reste invisible tant que les textes ne sont pas posés (évite que la page « saute »).
   Filet de sécurité : il s'affiche de toute façon au bout de 4 secondes. */
html:not(.pret) main,
html:not(.pret) .pied {
  visibility: hidden;
  animation: apparaitre 0s 4s forwards;
}

@keyframes apparaitre {
  to {
    visibility: visible;
  }
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--marine);
}

h1,
h2,
h3 {
  font-family: var(--police-titre);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: clamp(1.6rem, 5vw, 2.25rem);
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 1rem;
}

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--marine);
}

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

.lien-evitement {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--marine);
  color: #fff;
  border-radius: var(--rayon);
}
.lien-evitement:focus {
  top: 1rem;
}

/* ---------- Mise en page ---------- */

.conteneur {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.entete {
  padding-top: 1rem;
  padding-bottom: 0.5rem;
}

.entete__logo {
  display: block;
  width: 84px;
  height: auto;
}

.intro {
  padding: 0.5rem 0 1.25rem;
}

.intro__sous-titre {
  color: var(--texte-doux);
  font-size: 1.05rem;
  margin: 0;
}

.carte {
  background: var(--carte);
  border-radius: var(--rayon);
  padding: 1.25rem 1rem;
}

@media (min-width: 600px) {
  .carte {
    padding: 2rem;
  }
}

.pied {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--bordure);
  color: var(--texte-doux);
  font-size: 0.9rem;
}

.pied p {
  margin: 0 0 0.5rem;
}

.pied__liens {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pied a {
  color: var(--texte-doux);
}

/* ---------- Barre de progression ---------- */

.progression {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  counter-reset: etape;
}

.progression li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding-top: 0.5rem;
  border-top: 4px solid var(--bordure);
  color: var(--texte-doux);
  font-size: 0.85rem;
  line-height: 1.3;
}

.progression__numero {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--carte);
  border: 1px solid var(--bordure);
  font-weight: 700;
  font-size: 0.85rem;
}

.progression li.est-faite {
  border-top-color: var(--marine);
  color: var(--marine);
}
.progression li.est-faite .progression__numero {
  background: var(--marine);
  border-color: var(--marine);
  color: #fff;
}

.progression li.est-courante {
  border-top-color: var(--orange);
  color: var(--marine);
  font-weight: 700;
}
.progression li.est-courante .progression__numero {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--marine);
}

@media (min-width: 600px) {
  .progression li {
    flex-direction: row;
    align-items: center;
    font-size: 0.95rem;
  }
}

/* ---------- Formulaires ---------- */

.etape h2 {
  margin-bottom: 1.25rem;
}

.etape h2:focus {
  outline: none;
}

.accroche {
  margin-top: -0.5rem;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.champ {
  margin-bottom: 1.5rem;
}

.champ__label {
  display: block;
  margin-bottom: 0.4rem;
  padding: 0;
  font-weight: 700;
}

.facultatif {
  font-weight: 400;
  color: var(--texte-doux);
}

.champ__aide {
  margin: 0.4rem 0 0;
  color: var(--texte-doux);
  font-size: 0.9rem;
}

.champ__message {
  margin: 0;
  font-size: 0.95rem;
}

.champ__message:empty {
  display: none;
}

.champ__message--erreur,
.champ__message--alerte {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-left: 4px solid;
  border-radius: 0 var(--rayon) var(--rayon) 0;
}

.champ__message--erreur {
  color: var(--erreur);
  background: var(--erreur-pale);
  border-color: var(--erreur);
  font-weight: 700;
}

.champ__message--alerte {
  color: var(--orange-texte);
  background: var(--orange-pale);
  border-color: var(--orange);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.75rem;
  border: 1px solid #7d8796;
  border-radius: var(--rayon);
  background: #fff;
  color: var(--texte);
  font: inherit;
  font-size: 1rem; /* 16 px : évite le zoom automatique sur iPhone */
}

select {
  appearance: none;
  padding-right: 2.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--marine) 50%), linear-gradient(135deg, var(--marine) 50%, transparent 50%);
  background-position: calc(100% - 1.25rem) 50%, calc(100% - 0.85rem) 50%;
  background-size: 0.45rem 0.45rem;
  background-repeat: no-repeat;
}

select:disabled {
  background-color: #eceef1;
  color: var(--texte-doux);
}

[aria-invalid="true"] {
  border-color: var(--erreur);
  border-width: 2px;
}

.saisie-unite {
  position: relative;
  max-width: 14rem;
}

.saisie-unite input {
  padding-right: 2.25rem;
}

.saisie-unite__unite {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--texte-doux);
  pointer-events: none;
}

.grille-2 {
  display: grid;
  gap: 0 1.25rem;
}

@media (min-width: 600px) {
  .grille-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Boutons radio en « cartes » */
.choix {
  display: grid;
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .choix {
    grid-template-columns: 1fr 1fr;
  }
  .choix--colonne {
    grid-template-columns: 1fr;
  }
}

.choix__option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 48px;
  padding: 0.6rem 0.85rem;
  border: 1px solid #7d8796;
  border-radius: var(--rayon);
  background: #fff;
  cursor: pointer;
}

.choix__option:has(input:checked) {
  border: 2px solid var(--marine);
  padding: calc(0.6rem - 1px) calc(0.85rem - 1px);
  font-weight: 700;
}

input[type="radio"],
input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--marine);
}

/* Case à cocher simple */
.case {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.25rem 0;
  cursor: pointer;
}

.case input {
  margin-top: 0.15rem;
}

.sous-champ {
  margin-top: 0.75rem;
  max-width: 22rem;
}

/* Interrupteur oui/non */
.interrupteur {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  cursor: pointer;
}

.interrupteur input {
  position: absolute;
  opacity: 0;
  width: 3rem;
  height: 1.75rem;
  margin: 0;
}

.interrupteur__piste {
  position: relative;
  flex-shrink: 0;
  width: 3rem;
  height: 1.75rem;
  border-radius: 1rem;
  background: #7d8796;
  transition: background 0.15s;
}

.interrupteur__piste::after {
  content: "";
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.interrupteur input:checked + .interrupteur__piste {
  background: var(--marine);
}

.interrupteur input:checked + .interrupteur__piste::after {
  transform: translateX(1.25rem);
}

.interrupteur input:focus-visible + .interrupteur__piste {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--marine);
}

/* Bloc contrat de professionnalisation */
.bloc {
  margin: 0 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--bordure);
  border-left: 4px solid var(--marine);
  border-radius: var(--rayon);
  background: #fff;
}

.bloc__titre {
  padding: 0 0.25rem;
  font-family: var(--police-titre);
  font-weight: 700;
}

.bloc .champ:last-child {
  margin-bottom: 0;
}

/* Section repliée « Affiner l'estimation » */
.affiner {
  margin: 0 0 1.5rem;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  background: #fff;
}

.affiner summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.6rem 1rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.affiner summary::-webkit-details-marker {
  display: none;
}

.affiner summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--marine);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
}

.affiner[open] summary::before {
  content: "−";
}

.affiner__contenu {
  padding: 0.5rem 1rem 0.25rem;
}

/* Pot de miel : hors de l'écran */
.pot-de-miel {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Lien qui se comporte comme un bouton (« En savoir plus ») */
.lien-bouton {
  min-height: 44px;
  margin-left: 1.9rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--marine);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.rgpd {
  margin: 0.25rem 0 0 1.9rem;
  padding: 0.75rem 1rem;
  border-radius: var(--rayon);
  background: #fff;
  font-size: 0.9rem;
}

.rgpd p:last-child {
  margin-bottom: 0;
}

.formulaire__erreur {
  margin: 0 0 1rem;
  color: var(--erreur);
  font-weight: 700;
}

.formulaire__erreur:empty {
  display: none;
}

/* ---------- Boutons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap-reverse;
  gap: 0.75rem;
  justify-content: flex-end;
}

.bouton {
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--marine);
  border-radius: var(--rayon);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.bouton--principal {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--marine);
}

.bouton--principal:hover {
  background: #ffb333;
}

.bouton--secondaire {
  background: #fff;
  color: var(--marine);
}

.bouton--secondaire:hover {
  background: var(--carte);
}

.bouton:disabled {
  cursor: progress;
  opacity: 0.75;
}

@media (max-width: 479px) {
  .actions .bouton {
    width: 100%;
  }
}

/* ---------- Résultat ---------- */

.resultat-principal {
  margin-bottom: 1rem;
  padding: 1.5rem 1.25rem;
  border-radius: var(--rayon);
  background: var(--marine);
  color: #fff;
  text-align: center;
}

.resultat-principal h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: #fff;
}

.resultat-principal__chiffre {
  margin: 0 0 0.5rem;
  line-height: 1.15;
}

.resultat-principal__montant {
  display: block;
  font-family: var(--police-titre);
  font-size: clamp(2.5rem, 12vw, 3.5rem);
  font-weight: 700;
  color: var(--orange); /* orange sur bleu marine : contraste suffisant */
}

.resultat-principal__unite {
  font-size: 1.1rem;
}

.resultat-principal__sous-titre {
  margin: 0;
}

.bloc-resultat {
  margin-bottom: 1rem;
}

.bloc-resultat h3 {
  margin-bottom: 0.75rem;
}

.recap {
  display: grid;
  gap: 0.5rem;
  margin: 0;
}

.recap dt {
  color: var(--texte-doux);
  font-size: 0.9rem;
}

.recap dd {
  margin: 0;
  font-weight: 700;
}

@media (min-width: 600px) {
  .recap {
    grid-template-columns: 2fr 1.4fr 1fr;
  }
}

.detail {
  margin: 0;
}

.detail__ligne {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--bordure);
}

.detail dd {
  margin: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.detail__ligne--moins dd {
  color: #1d6b3a;
}

.detail__ligne--total {
  border-bottom: 0;
  font-weight: 700;
  font-size: 1.1rem;
}

.tableau {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.tableau th,
.tableau td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--bordure);
  text-align: right;
}

.tableau th:first-child,
.tableau td:first-child {
  text-align: left;
}

.tableau thead th {
  font-size: 0.85rem;
  color: var(--texte-doux);
  vertical-align: bottom;
}

/* Sur mobile, chaque année devient une petite fiche */
@media (max-width: 599px) {
  .tableau thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .tableau tr {
    display: block;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bordure);
  }
  .tableau th,
  .tableau td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.2rem 0;
    border: 0;
    text-align: right;
  }
  .tableau tbody th {
    font-family: var(--police-titre);
    font-size: 1.05rem;
  }
  .tableau td::before {
    content: attr(data-label);
    color: var(--texte-doux);
    text-align: left;
  }
}

.salaire-net {
  margin: 1rem 0 0;
}

.encadre {
  margin-bottom: 1rem;
  padding: 1.25rem;
  border-radius: var(--rayon);
}

.encadre p:last-child {
  margin-bottom: 0;
}

.encadre--aide {
  background: var(--orange-pale);
  border-left: 4px solid var(--orange);
}

.texte-airtable {
  white-space: pre-line;
}

.encadre--contact {
  background: var(--carte);
  border-left: 4px solid var(--marine);
}

.encadre__texte {
  font-weight: 700;
}

.contact-liens {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.contact-liens a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.contact-liens__tel {
  font-size: 1.25rem;
  font-weight: 700;
}

.actions--resultat {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin: 1.5rem 0 1rem;
}

.mention {
  color: var(--texte-doux);
  font-size: 0.85rem;
}

/* ---------- Intégration en iframe ---------- */

.en-iframe .entete {
  display: none;
}

/* Page exemple-integration.html (pour le webmestre) */
.exemple {
  max-width: 60rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.exemple__code {
  overflow-x: auto;
  padding: 1rem;
  border-radius: var(--rayon);
  background: var(--carte);
  font-size: 0.85rem;
}

.exemple__iframe {
  display: block;
  width: 100%;
  height: 1500px;
  border: 2px dashed var(--bordure);
}

/* ---------- Impression / PDF ---------- */

@media print {
  @page {
    margin: 15mm;
  }
  body {
    font-size: 11pt;
  }
  .lien-evitement,
  .intro,
  .progression-nav,
  .actions,
  #etape-1,
  #etape-2,
  .pied__liens {
    display: none !important;
  }
  .en-iframe .entete,
  .entete {
    display: block !important;
  }
  .conteneur {
    max-width: none;
    padding: 0;
  }
  .resultat-principal {
    background: #fff;
    color: var(--marine);
    border: 2px solid var(--marine);
  }
  .resultat-principal h2 {
    color: var(--marine);
  }
  .resultat-principal__montant {
    color: var(--marine);
  }
  .carte,
  .encadre {
    break-inside: avoid;
    background: #fff;
    border: 1px solid var(--bordure);
  }
  .pied {
    margin-top: 1rem;
    padding-top: 0.5rem;
  }
  a {
    text-decoration: none;
  }
}
