/* ============================================================
 *  /css/main.css  —  mon-lpp.ch
 *  Design system : precision suisse, modernite confiante.
 *
 *  Tokens : couleurs, typographie, espacement, motion.
 *  Composants chrome : header + nav + mega menu, hero, sections,
 *  utilitaires (kicker, divider).
 *
 *  Le CSS specifique au formulaire multi-step et aux sections de
 *  la home reste inline dans body.php (intacte pour ne pas casser
 *  la mecanique du formulaire).
 * ============================================================ */

/* ============================================================
 *  TOKENS
 * ============================================================ */
:root{
  /* Couleurs primaires */
  --main:#0f3d5c;
  --main-dark:#0a2c45;
  --main-light:#1a5278;
  --accent:#1f7aa8;
  --accent-soft:#dbe9f3;

  /* Surfaces */
  --bg:#ffffff;
  --soft:#f5f7fa;
  --soft-warm:#f8fafb;

  /* Texte */
  --text:#0f1e2e;
  --muted:#475569;
  --muted-light:#64748b;

  /* Bordures et lignes */
  --border:#e5e7eb;
  --line:#e2e8f0;

  /* Motion */
  --ease:cubic-bezier(.16, 1, .3, 1);
  --ease-out:cubic-bezier(.22, 1, .36, 1);
  --t-fast:.2s;
  --t-base:.35s;
  --t-slow:.7s;

  /* Layout */
  --header-h:72px;
  --container:1200px;
}

/* ============================================================
 *  BASE
 * ============================================================ */
*{ box-sizing:border-box; }

html{ scroll-behavior:smooth; }

body{
  margin:0;
  font-family:Nunito, system-ui, sans-serif;
  font-size:16px;
  line-height:1.7;
  color:var(--text);
  background:var(--bg);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

h1,h2,h3,h4,h5{
  font-family:Montserrat, system-ui, sans-serif;
  font-weight:600;
  color:var(--text);
  margin:0 0 .6em;
}
h1{ font-size:44px; line-height:1.15; letter-spacing:-.5px; font-weight:700; }
h2{ font-size:30px; line-height:1.25; letter-spacing:-.3px; }
h3{ font-size:18px; line-height:1.4; }
h4{ font-size:17px; line-height:1.4; }

p{
  line-height:1.7;
  color:var(--muted);
  margin:0 0 1em;
}

a{ color:inherit; text-decoration:none; transition:color var(--t-fast) ease; }
a:hover{ color:var(--main); }

img{ max-width:100%; height:auto; display:block; }

/* ============================================================
 *  CONTAINER
 * ============================================================ */
.container{
  max-width:var(--container);
  margin:0 auto;
  padding:0 24px;
}

/* ============================================================
 *  KICKER (libelle de section, petites capitales avec dash)
 * ============================================================ */
.kicker{
  display:inline-block;
  position:relative;
  padding-left:18px;
  font-family:Montserrat, sans-serif;
  font-size:11px;
  font-weight:600;
  letter-spacing:2px;
  text-transform:uppercase;
  color:var(--accent);
  margin-bottom:14px;
}
.kicker::before{
  content:"";
  position:absolute;
  left:0; top:50%;
  width:10px; height:2px;
  background:var(--accent);
  transform:translateY(-50%);
}
.kicker--light{ color:var(--accent-soft); }
.kicker--light::before{ background:var(--accent-soft); }

/* ============================================================
 *  DIVIDER (ligne fine entre sections, optionnel)
 * ============================================================ */
.section-divider{
  width:60px;
  height:3px;
  background:var(--main);
  border-radius:3px;
  margin:0 auto;
}

/* ============================================================
 *  HEADER
 * ============================================================ */
header{
  position:fixed;
  top:0; left:0; right:0;
  height:var(--header-h);
  display:flex;
  align-items:center;
  background:transparent;
  z-index:100;
  transition:background var(--t-base) ease, border-color var(--t-base) ease, box-shadow var(--t-base) ease;
}
header.scrolled{
  background:#fff;
  border-bottom:1px solid var(--border);
  box-shadow:0 2px 12px rgba(15,30,46,.04);
}

.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  width:100%;
}

/* Logo */
.logo{
  display:inline-flex;
  align-items:center;
  flex-shrink:0;
  color:var(--main);
}
.logo img{
  height:22px;
  width:auto;
}

/* Telephone */
.phone{
  font-family:Montserrat;
  font-weight:600;
  font-size:14.5px;
  color:var(--main);
  white-space:nowrap;
  flex-shrink:0;
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.phone:hover{ color:var(--accent); }

/* ============================================================
 *  NAVIGATION  —  une seule ligne, padding et font serrés
 *  pour eviter le wrap a partir de 1100px et plus.
 * ============================================================ */
nav{
  display:flex;
  flex-wrap:nowrap;        /* HARD : jamais de wrap */
  align-items:center;
  gap:2px;
  flex:1;
  justify-content:center;
  min-width:0;
}
nav > a,
nav .dropdown-trigger,
.nav-cta{
  display:inline-flex;
  align-items:center;
  font-family:Montserrat;
  font-size:13.5px;
  font-weight:500;
  color:var(--text);
  cursor:pointer;
  background:none;
  border:none;
  padding:8px 12px;
  border-radius:6px;
  transition:color var(--t-fast) ease, background var(--t-fast) ease;
  white-space:nowrap;
  line-height:1;
}
nav > a:hover,
nav .dropdown-trigger:hover,
nav > a:focus-visible,
nav .dropdown-trigger:focus-visible{
  color:var(--main);
  background:rgba(15,61,92,.05);
  outline:none;
}

/* CTA dans le nav (le bouton "Rechercher mes avoirs") */
.nav-cta{
  background:var(--main);
  color:#fff;
  font-weight:600;
  margin-left:8px;
  padding:10px 18px;
  transition:background var(--t-base) ease, transform var(--t-base) ease, box-shadow var(--t-base) ease;
}
.nav-cta:hover,
.nav-cta:focus-visible{
  background:var(--main-dark);
  color:#fff;
  transform:translateY(-1px);
  box-shadow:0 8px 20px rgba(15,61,92,.18);
}

/* Caret du dropdown : rotation a l'ouverture */
.caret{
  display:inline-block;
  font-size:9px;
  margin-left:5px;
  transition:transform var(--t-fast) ease;
}
.dropdown.open .caret,
.dropdown-trigger[aria-expanded="true"] .caret{
  transform:rotate(180deg);
}

/* ============================================================
 *  DROPDOWN
 * ============================================================ */
.dropdown{ position:relative; }

.dropdown-menu{
  display:none;
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  min-width:240px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:10px;
  box-shadow:0 16px 48px rgba(15,30,46,.08);
  padding:8px;
  z-index:110;
}
.dropdown-menu a{
  display:block;
  padding:10px 14px;
  font-size:14px;
  color:var(--text);
  border-radius:6px;
  transition:background var(--t-fast) ease, color var(--t-fast) ease;
}
.dropdown-menu a:hover,
.dropdown-menu a:focus-visible{
  background:var(--soft);
  color:var(--main);
  outline:none;
}

/* Ouverture : hover, focus-within, .open (clic) */
.dropdown:hover > .dropdown-menu,
.dropdown:focus-within > .dropdown-menu,
.dropdown.open > .dropdown-menu{
  display:block;
}

/* ============================================================
 *  MEGA MENU (Guides LPP)
 * ============================================================ */
.dropdown.mega .dropdown-menu{
  min-width:760px;
  max-width:820px;
  padding:32px 32px 24px;
  right:0;
  left:auto;
}

.mega-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:28px 36px;
}

.mega-col h5{
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:1.2px;
  color:var(--accent);
  margin:0 0 14px;
  padding-bottom:10px;
  border-bottom:1px solid var(--line);
}

.mega-col ul{ list-style:none; padding:0; margin:0; }
.mega-col li{ margin:0; }

.mega-col a{
  display:block;
  padding:8px 10px;
  font-size:13.5px;
  color:var(--text);
  border-radius:6px;
  transition:background var(--t-fast) ease, color var(--t-fast) ease, padding-left var(--t-fast) ease;
  line-height:1.4;
}
.mega-col a:hover,
.mega-col a:focus-visible{
  background:var(--soft);
  color:var(--main);
  padding-left:14px;
  outline:none;
}

.mega-footer{
  margin-top:20px;
  padding-top:18px;
  border-top:1px solid var(--line);
  text-align:right;
}
.mega-all{
  font-family:Montserrat;
  font-weight:600;
  font-size:13.5px;
  color:var(--main);
}
.mega-all:hover{ color:var(--accent); }

/* ============================================================
 *  BOUTON MENU MOBILE
 * ============================================================ */
.menu-toggle{
  display:none;
  background:none;
  border:none;
  font-size:24px;
  line-height:1;
  color:var(--main);
  cursor:pointer;
  width:40px;
  height:40px;
  padding:0;
  align-items:center;
  justify-content:center;
  user-select:none;
  border-radius:6px;
  transition:background var(--t-fast) ease;
}
.menu-toggle:hover{
  background:rgba(15,61,92,.05);
}

/* ============================================================
 *  RESPONSIVE NAV
 *  Mobile (hamburger) declenche a 1100px pour eviter tout wrap
 *  du nav sur les ecrans de portable etroits.
 * ============================================================ */
@media (max-width: 1100px){
  nav{
    position:fixed;
    top:var(--header-h); left:0; right:0;
    flex-direction:column;
    align-items:stretch;
    justify-content:flex-start;
    background:#fff;
    padding:18px 24px 28px;
    gap:0;
    border-top:1px solid var(--line);
    box-shadow:0 16px 40px rgba(15,30,46,.08);
    transform:translateY(-120%);
    transition:transform var(--t-base) var(--ease);
    z-index:99;
    max-height:calc(100vh - var(--header-h));
    overflow-y:auto;
  }
  nav.open{ transform:translateY(0); }

  nav > a,
  nav .dropdown-trigger,
  .nav-cta{
    width:100%;
    padding:14px 0;
    font-size:15.5px;
    text-align:left;
    border-radius:0;
    border-bottom:1px solid var(--line);
  }
  .nav-cta{
    margin:14px 0 0;
    padding:14px 18px;
    text-align:center;
    border-radius:8px;
    border-bottom:none;
  }

  .dropdown{ width:100%; }
  .dropdown-trigger{
    display:flex;
    align-items:center;
    justify-content:space-between;
  }

  /* Tous les dropdowns deviennent des accordeons */
  .dropdown-menu,
  .dropdown.mega .dropdown-menu{
    position:static;
    width:100%;
    min-width:0;
    max-width:none;
    display:none;
    box-shadow:none;
    border:none;
    border-radius:0;
    padding:4px 0 8px 14px;
    background:transparent;
  }
  .dropdown.open > .dropdown-menu{ display:block; }

  .dropdown-menu a{
    padding-left:16px;
    border-left:2px solid var(--line);
    margin-left:6px;
    border-radius:0;
  }

  /* Mega menu en accordeon empile */
  .mega-grid{ display:block; }
  .mega-col{ margin-bottom:6px; }
  .mega-col h5{
    margin:14px 0 6px;
    padding-bottom:6px;
  }
  .mega-footer{
    text-align:left;
    margin-top:14px;
  }

  .phone{ font-size:13.5px; }
  .menu-toggle{ display:flex; }
}

/* ============================================================
 *  HERO
 * ============================================================ */
.hero{
  padding:150px 0 96px;
  background:var(--soft);
  position:relative;
}
.hero .container{ max-width:1100px; }

.hero h1{
  max-width:780px;
  margin:0 0 22px;
}
.hero .accent{
  color:var(--accent);
  font-weight:700;
}
.hero p{
  max-width:680px;
  font-size:17px;
  margin:0 0 36px;
  color:var(--muted);
}

@media (max-width: 768px){
  .hero{ padding:120px 0 64px; }
  h1{ font-size:32px; }
}

/* ============================================================
 *  FORMULAIRE INLINE (hero, 3 champs)
 * ============================================================ */
.inline-form{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}
.inline-form input{
  flex:1;
  min-width:160px;
  padding:14px 16px;
  border:1px solid var(--border);
  border-radius:8px;
  font-size:15px;
  font-family:Nunito, sans-serif;
  background:#fff;
  transition:border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.inline-form input:focus{
  border-color:var(--main);
  outline:none;
  box-shadow:0 0 0 4px rgba(15,61,92,.08);
}
.inline-form button{
  padding:14px 26px;
  background:var(--main);
  color:#fff;
  border:none;
  border-radius:8px;
  font-family:Montserrat;
  font-weight:600;
  font-size:14.5px;
  cursor:pointer;
  transition:background var(--t-base) var(--ease), transform var(--t-base) var(--ease), box-shadow var(--t-base) ease;
}
.inline-form button:hover{
  background:var(--main-dark);
  transform:translateY(-2px);
  box-shadow:0 14px 28px rgba(15,61,92,.22);
}

@media (max-width: 768px){
  .inline-form{ flex-direction:column; gap:12px; }
  .inline-form input,
  .inline-form button{ width:100%; }
}

/* ============================================================
 *  SECTIONS DE BASE
 * ============================================================ */
section{
  padding:96px 0;
}

@media (max-width: 768px){
  section{ padding:64px 0; }
  h2{ font-size:24px; }
}

/* ============================================================
 *  ANIMATION SECTIONS (fade au scroll)
 * ============================================================ */
.section-animate{
  opacity:1;
  transform:none;
  transition:opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
.section-animate.is-hidden{
  opacity:0;
  transform:translateY(36px);
}

@media (prefers-reduced-motion: reduce){
  *,
  *::before,
  *::after{
    animation-duration:.01ms !important;
    transition-duration:.01ms !important;
  }
  .section-animate,
  .section-animate.is-hidden{
    opacity:1;
    transform:none;
    transition:none;
  }
  html{ scroll-behavior:auto; }
}

/* ============================================================
 *  FOCUS VISIBLE GLOBAL (accessibilite clavier)
 * ============================================================ */
:focus-visible{
  outline:2px solid var(--main);
  outline-offset:3px;
  border-radius:4px;
}

/* ============================================================
 *  UTILITAIRES
 * ============================================================ */
.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;
}

.text-center{ text-align:center; }
