/* ==========================================================
   estime-impôts.ch – Feuille de style
   ========================================================== */

/* Police Montserrat hébergée sur le site (police variable, graisses 400 à 800) : aucun appel à Google */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("polices/montserrat-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("polices/montserrat-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --principal: #327087;        /* bleu pétrole principal */
  --principal-fonce: #234e5f;  /* version plus foncée (survol, écran de calcul) */
  --principal-clair: #eaf2f5;  /* version très claire (fonds de blocs) */
  --gris-texte: #384253;
  --gris-clair: #8f9bb0;
  --bordure: #d3dcea;
  --blanc: #ffffff;
  --rayon: 14px;
  --ombre: 0 12px 32px rgba(50, 112, 135, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: #e4eaf5;         /* fond de page autour de la colonne centrale */
}

/* Le site forme un cadre central (comme une bannière) au lieu d'occuper toute la largeur */
body {
  max-width: 1100px;
  min-height: 100vh;
  margin: 0 auto;
  font-family: "Montserrat", "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--gris-texte);
  background: var(--blanc);
  line-height: 1.5;
  box-shadow: 0 0 40px rgba(50, 112, 135, 0.18);
}
/* Cadre « fini » : détaché des bords haut et bas de la fenêtre, contour bleu complet, coins arrondis
   (seulement quand il y a de la marge autour ; sur petit écran le site reste en pleine largeur) */
@media (min-width: 1101px) {
  body {
    margin: 24px auto;
    min-height: calc(100vh - 48px);
    border: 3px solid var(--principal);
    border-radius: var(--rayon);   /* même arrondi (14 px) que les encadrés du site */
  }
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- En-tête ---------- */
.hero {
  text-align: center;
  padding: 40px 20px 48px;
}
.brand {
  margin: 0 0 24px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--principal);
}
.brand span { color: var(--gris-clair); }

.hero h1 {
  margin: 0;
  color: var(--principal);
  font-size: clamp(1.7rem, 4.5vw, 3rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

/* Titre de la page d'accueil : 2 pt de moins que le titre standard */
.hero h1.titre-accueil {
  font-size: clamp(calc(1.7rem - 2pt), calc(4.5vw - 2pt), calc(3rem - 2pt));
}

/* ---------- Bandeau bleu doux ---------- */
.steps {
  background: var(--principal);
  color: var(--blanc);
  text-align: center;
  padding: 28px 20px 174px; /* espace pour le chevauchement de la carte (bandeau resserré de 32 px) */
}
.steps__inner { max-width: 760px; margin: 0 auto; }

.steps h2 {
  margin: 0 0 8px;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Flèche dans un petit cercle aux teintes du site */
.steps__arrow {
  display: block;
  box-sizing: border-box;
  width: 30px;
  height: 30px;
  padding: 6px;                          /* la flèche reste centrée dans le cercle */
  margin: 0 auto 18px;
  color: #ffffff;                        /* flèche blanche */
  background: var(--principal-fonce);    /* fond du cercle : teinte foncée du site */
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--principal-clair);   /* fin anneau clair */
}

.steps ol {
  list-style: none;
  counter-reset: etape;
  margin: 0;
  padding: 0;
}
.steps li {
  counter-increment: etape;
  margin: 0 0 10px;
  font-size: 1rem;
}
.steps li::before { content: counter(etape) ". "; font-weight: 700; }

/* ---------- Carte ---------- */
main { padding: 0 20px; }

.card {
  position: relative;
  max-width: 980px;
  margin: -150px auto 32px; /* chevauche le bandeau bleu */
  background: var(--blanc);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 40px 40px 28px;
}

/* ---------- Formulaire ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px 28px;
}

.field label,
.consent {
  font-size: 0.92rem;
}
.field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: #1f2836;
}

select,
input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--gris-texte);
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}

select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23327087' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
select:invalid { color: #75819a; }

select:focus,
input:focus {
  outline: none;
  border-color: var(--principal);
  box-shadow: 0 0 0 3px rgba(50, 112, 135, 0.25);
}

.field.has-error select { border-color: #b3261e; }

.actions { text-align: center; margin-top: 32px; }

.btn {
  min-width: 320px;
  max-width: 100%;
  padding: 15px 32px;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--blanc);
  background: var(--principal);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--principal-fonce); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(50, 112, 135, 0.45); outline-offset: 2px; }

/* Effet de surbrillance : reflet lumineux qui balaie le bouton + halo qui pulse */
.btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  animation: halo 2.6s ease-in-out infinite;
}
.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
  transform: skewX(-20deg);
  animation: reflet 2.6s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}
.btn:hover {
  animation: none; /* une animation l'emporterait sur le box-shadow du survol */
  box-shadow: 0 0 22px 4px rgba(100, 180, 210, 0.75);
}
.btn:hover::after { animation-duration: 1.1s; }

@keyframes reflet {
  0%   { left: -75%; }
  55%, 100% { left: 135%; }
}
@keyframes halo {
  0%, 100% { box-shadow: 0 0 0 0 rgba(100, 180, 210, 0); }
  50%      { box-shadow: 0 0 18px 3px rgba(100, 180, 210, 0.55); }
}

/* Ombre portée sous les boutons « Calculer » et « Être contacté » (les <button>, pas le lien de retour).
   L'ombre est reprise dans l'animation du halo et au survol, sinon elle serait écrasée. */
button.btn {
  --ombre-bouton: 0 6px 14px rgba(35, 78, 95, 0.35);
  box-shadow: var(--ombre-bouton);
  animation-name: halo-ombre;
}
button.btn:hover {
  box-shadow: var(--ombre-bouton), 0 0 22px 4px rgba(100, 180, 210, 0.75);
}
@keyframes halo-ombre {
  0%, 100% { box-shadow: var(--ombre-bouton), 0 0 0 0 rgba(100, 180, 210, 0); }
  50%      { box-shadow: var(--ombre-bouton), 0 0 18px 3px rgba(100, 180, 210, 0.55); }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .btn::after { animation: none; }
}

.form-error {
  margin: 20px 0 0;
  text-align: center;
  color: #b3261e;
  font-weight: 600;
  font-size: 0.9rem;
}

.disclaimer {
  margin: 24px auto 6px;
  max-width: 760px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--gris-clair);
}
.duration {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  color: #75819a;
}

/* ---------- Résultat ---------- */
/* La zone reçoit le focus par script à l'affichage du résultat : pas de contour du navigateur autour de l'encadré */
.result:focus,
.result:focus-visible { outline: none; }

.result h2 {
  margin: 0 0 24px;
  text-align: center;
  color: var(--principal);
  font-size: 1.5rem;
  text-transform: uppercase;
}
.result h3 { margin: 0 0 20px; color: var(--principal); font-size: 1.1rem; }
.result h3 small { font-weight: 500; color: var(--gris-clair); }
.result hr { border: 0; border-top: 1px solid var(--bordure); margin: 32px 0; }

.result-main {
  text-align: center;
  background: var(--principal-clair);
  border-radius: var(--rayon);
  padding: 28px 20px;
  margin-bottom: 24px;
}
.result-main .label { margin: 0; font-size: 0.95rem; }
.result-main .amount {
  margin: 6px 0;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  color: var(--principal);
}
.result-main .range { margin: 0; font-size: 0.85rem; color: #59657a; }

/* Résultat principal avec un logo à GAUCHE du texte (toutes les réponses au 3ème pilier) */
.result-main--avec-logo {
  display: flex;
  align-items: center;
  gap: 20px;
}
.result-main__texte { flex: 1; min-width: 0; }
/* Taille commune à tous les logos des encadrés de résultat (aussi .insurance-note__logo plus bas) */
.result-main__logo {
  flex: none;
  width: 130px;
  height: auto;
}
@media (max-width: 560px) {
  .result-main--avec-logo { gap: 12px; }
  .result-main__logo { width: 84px; }
}

/* Résultat « Non » : fond rose très clair, montant en rouge sombre */
.result-main--non { background: #f1d4d4; }
.result-main--non .amount { color: #974040; }

/* Résultat « Oui, le montant maximum » : fond vert clair */
.result-main--max { background: #dbfae2; }

/* Résultat « Oui, partiellement » : fond orangé clair */
.result-main--partiel { background: #ffe2bb; }

/* Encadré « assurances » sous l'estimation */
.insurance-note {
  margin: 24px 0 20px;
  padding: 18px 22px;
  border-left: 4px solid var(--principal);
  border-right: 4px solid var(--principal);   /* même barre à droite, pour la symétrie */
  background: var(--principal-clair);
  border-radius: var(--rayon);   /* même arrondi (14 px) que l'encadré du résultat */
  font-size: 0.95rem;
  line-height: 1.6;
}
.insurance-note p { margin: 0 0 6px; }
.insurance-note p:last-child { margin-bottom: 0; }
.insurance-note strong { color: var(--principal); }
/* Titre de l'encadré : +3 pt par rapport au texte et centré */
.insurance-note p:first-child {
  font-size: calc(0.95rem + 3pt);
  text-align: center;
}

/* Variante avec logo à droite du texte */
.insurance-note--logo {
  display: flex;
  align-items: center;
  gap: 22px;
}
.insurance-note__texte { flex: 1; min-width: 0; }
.insurance-note__logo {
  flex: none;
  width: 130px;
  height: auto;
}
@media (max-width: 560px) {
  .insurance-note--logo { gap: 14px; }
  .insurance-note__logo { width: 84px; }
}

/* Variante « message » (texte plutôt qu'un montant) */
.result-main--message { padding: 32px 28px; }
.result-main--message .amount { font-size: clamp(1.4rem, 4vw, 2rem); }
.result-main--message .range { max-width: 680px; margin: 12px auto 0; font-size: 1rem; line-height: 1.6; color: var(--gris-texte); }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat {
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.stat strong { display: block; font-size: 1.25rem; color: var(--principal); }
.stat span { font-size: 0.8rem; color: #59657a; }

.result-note { font-size: 0.9rem; text-align: center; }

.grid--contact { grid-template-columns: 1fr 1fr 1.5fr; }

/* Champ téléphone : indicatif pays + numéro formaté */
.phone-row {
  display: flex;
  gap: 8px;
}
.phone-row select {
  width: 132px;
  flex: none;
  padding-right: 34px;
  background-position: right 10px center;
}
.phone-row input { min-width: 0; }
.phone-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: #59657a;
}
.phone-hint strong { color: var(--principal); letter-spacing: 0.03em; }
.field.has-error input { border-color: #b3261e; }

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 20px;
}
.consent input { margin-top: 4px; accent-color: var(--principal); }
.consent a { color: var(--principal); }

.success {
  margin: 20px 0 0;
  padding: 16px;
  text-align: center;
  font-weight: 600;
  color: #2e7d4f;            /* vert soutenu (même intensité que le bleu principal) */
  background: #eaf6ee;       /* vert très clair (même intensité que le bleu clair) */
  border-radius: 10px;
}

/* ---------- Page de résultat ---------- */
.steps--slim { padding: 10px 20px 170px; }

.result-title {
  margin: 0 0 24px;
  text-align: center;
  color: var(--principal);
  font-size: 1.5rem;
  text-transform: uppercase;
}

.btn--link { display: inline-block; text-decoration: none; }

.sources {
  margin-top: 28px;
  padding: 14px 18px;
  font-size: 0.85rem;
  border: 1px solid var(--bordure);
  border-radius: 10px;
}
.sources summary { cursor: pointer; font-weight: 700; color: var(--principal); }
.sources h4 { margin: 16px 0 6px; color: var(--principal); }
.sources p, .sources ul { margin: 0 0 6px; }
.sources ul { padding-left: 20px; }
.sources li { margin-bottom: 6px; }
.sources a { color: var(--principal); }

.back { margin: 28px 0 0; text-align: center; font-size: 0.9rem; }
.back a { color: var(--principal); }
.result .disclaimer { margin-top: 20px; }

/* ---------- Animation de calcul ---------- */
.loader { text-align: center; padding-bottom: 32px; }

.loader__title {
  margin: 0 0 20px;
  color: var(--principal);
  font-size: 1.5rem;
  text-transform: uppercase;
}
.loader__title::after {
  content: "";
  display: inline-block;
  width: 0.7em; height: 0.7em;
  margin-left: 12px;
  border: 3px solid var(--principal-clair);
  border-top-color: var(--principal);
  border-radius: 50%;
  animation: tourner 0.8s linear infinite;
}

/* Écran façon « console » */
.calc-screen {
  position: relative;
  overflow: hidden;
  height: 300px;
  padding: 24px 28px;
  text-align: left;
  color: #eaf6fb;
  background: radial-gradient(circle at 50% 0%, #4a95b0 0%, var(--principal-fonce) 75%);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
/* Léger effet de balayage lumineux */
.calc-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(170, 215, 235, 0.14) 50%, transparent 100%);
  height: 40%;
  animation: balayage 1.2s linear infinite;
  pointer-events: none;
}

/* Chiffres qui zooment vers l'écran : départ au centre (petit), arrivée grossie vers les bords */
.calc-screen__symbols span {
  position: absolute;
  left: 50%;
  top: 50%;
  font-family: "Consolas", "Cambria Math", "Courier New", monospace;
  font-size: 22px;
  font-weight: 700;
  color: rgba(205, 235, 250, 0.9);
  text-shadow: 0 0 12px rgba(150, 205, 235, 0.8);
  opacity: 0;
  will-change: transform, opacity;
  animation: zoom-ecran cubic-bezier(0.4, 0, 1, 1) infinite;
}

.calc-screen__formulas {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  gap: 10px;
  font-family: "Cambria Math", "Consolas", "Courier New", monospace;
  font-size: clamp(0.85rem, 2.2vw, 1.15rem);
}
.formula { animation: apparition 0.25s ease-out; white-space: nowrap; overflow: hidden; }
.formula sub, .formula sup { font-size: 0.65em; }
.formula__val { color: #ffd166; font-variant-numeric: tabular-nums; }
.formula__val.is-done { color: #7ee2a8; }

.loader__status { margin: 20px 0 14px; min-height: 1.5em; font-weight: 600; color: var(--principal); }

.progress {
  height: 10px;
  overflow: hidden;
  background: var(--principal-clair);
  border-radius: 999px;
}
.progress__bar {
  height: 100%;
  width: 0;
  background: var(--principal);
  border-radius: 999px;
}
.loader__percent { margin: 8px 0 0; font-size: 0.85rem; color: #59657a; font-variant-numeric: tabular-nums; }

@keyframes tourner { to { transform: rotate(360deg); } }
@keyframes balayage { from { transform: translateY(-100%); } to { transform: translateY(260%); } }
@keyframes zoom-ecran {
  0%   { transform: translate(-50%, -50%) scale(0.1); opacity: 0; }
  15%  { opacity: 0.9; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(7); opacity: 0; }
}
@keyframes apparition {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}

/* Réduction des animations si l'utilisateur le demande */
@media (prefers-reduced-motion: reduce) {
  .calc-screen__symbols, .calc-screen::after { display: none; }
  .loader__title::after { animation: none; }
  .formula { animation: none; }
}

/* ---------- Pied de page ---------- */
.footer {
  text-align: center;
  padding: 24px 20px 40px;
  font-size: 0.85rem;
  color: #59657a;
}
.footer p { margin: 0 0 8px; }
.footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; }
.footer a { color: #59657a; text-decoration: underline; }
.footer a:hover { color: var(--principal); }

/* ---------- Pages légales ---------- */
.legal { max-width: 780px; margin: 0 auto; padding: 0 20px 40px; }
.legal h1 { color: var(--principal); }
.legal h2 { color: var(--principal); margin-top: 40px; }
.legal a { color: var(--principal); }

/* ---------- Bannière de cookies ---------- */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px 24px;
  padding: 16px 20px;
  background: var(--blanc);
  color: var(--gris-texte);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: 0 8px 32px rgba(35, 78, 95, 0.28);
  font-size: 0.88rem;
  line-height: 1.5;
}
.cookie-banner__texte { margin: 0; flex: 1; }
.cookie-banner__texte a { color: var(--principal); }
.cookie-banner__actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-banner__btn {
  font: inherit;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px solid var(--principal);
  cursor: pointer;
}
.cookie-banner__btn--accepter { background: var(--principal); color: var(--blanc); }
.cookie-banner__btn--accepter:hover { background: var(--principal-fonce); border-color: var(--principal-fonce); }
.cookie-banner__btn--refuser { background: var(--blanc); color: var(--principal); }
.cookie-banner__btn--refuser:hover { background: var(--principal-clair); }
.cookie-banner__btn:focus-visible { outline: 3px solid rgba(50, 112, 135, 0.45); outline-offset: 2px; }
@media (max-width: 560px) {
  .cookie-banner { flex-direction: column; align-items: stretch; left: 10px; right: 10px; bottom: 10px; }
  .cookie-banner__actions { width: 100%; }
  .cookie-banner__btn { flex: 1; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid,
  .grid--contact,
  .result-stats { grid-template-columns: 1fr; }
  .card { padding: 28px 20px 22px; margin-top: -140px; }
  .btn { width: 100%; min-width: 0; }
  .steps { padding-bottom: 170px; }
}
