/* ==========================================================
   DESIGN SYSTEM : "Orchidée de nuit"
   Site de cours de coréen collectifs
   Polices : Sora + Noto Sans KR (licence OFL).
   RGPD : les héberger en local (ex. paquets npm @fontsource),
   ne pas les charger depuis fonts.googleapis.com.
   ========================================================== */

/* ---------- 1. TOKENS ---------- */
:root {
  /* Couleurs */
  --c-night:      #1E1530;  /* fond principal */
  --c-aubergine:  #2F2247;  /* surfaces, cartes */
  --c-aubergine-2:#3C2D59;  /* surface survolée / bordures */
  --c-orchid:     #B07CE0;  /* accent secondaire, liens, jauge */
  --c-rose:       #E58FA9;  /* ACTION : réservé aux CTA */
  --c-rose-hover: #F0A6BB;
  --c-cream:      #F3E9EE;  /* texte principal */
  --c-muted:      #BDAFCB;  /* texte secondaire */
  --c-success:    #7FD1A8;
  --c-warning:    #F2C14E;
  --c-danger:     #FF8A8A;

  /* Rôles */
  --bg:        var(--c-night);
  --surface:   var(--c-aubergine);
  --text:      var(--c-cream);
  --text-soft: var(--c-muted);
  --link:      var(--c-orchid);
  --cta-bg:    var(--c-rose);
  --cta-text:  var(--c-night);
  --focus:     var(--c-orchid);

  /* Typo */
  --font-body: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-kr:   "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --fs-xs: .8125rem;
  --fs-sm: .9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --fs-2xl: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
  --fs-3xl: clamp(2.5rem, 1.6rem + 3.6vw, 4.25rem);
  --lh-tight: 1.1;
  --lh-body: 1.6;

  /* Espacement (base 4px) */
  --sp-1: .25rem; --sp-2: .5rem;  --sp-3: .75rem; --sp-4: 1rem;
  --sp-5: 1.5rem; --sp-6: 2rem;   --sp-7: 3rem;   --sp-8: 5rem;

  /* Formes */
  --r-sm: 10px; --r-md: 14px; --r-lg: 22px; --r-pill: 999px;
  --shadow: 0 12px 32px rgba(14, 8, 26, .45);
  --container: 1120px;
}

/* ---------- 2. BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}
:lang(ko), .kr { font-family: var(--font-kr); }
img, svg { max-width: 100%; display: block; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--c-cream); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* ---------- 3. TYPO ---------- */
h1, h2, h3 { font-weight: 700; line-height: var(--lh-tight); margin: 0 0 var(--sp-4); letter-spacing: -.01em; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
p  { margin: 0 0 var(--sp-4); }
.eyebrow { font-size: var(--fs-sm); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-rose); }
.lead { font-size: var(--fs-lg); color: var(--text-soft); max-width: 60ch; }
.muted { color: var(--text-soft); }

/* ---------- 4. LAYOUT ---------- */
.container { width: min(100% - 2rem, var(--container)); margin-inline: auto; }
.section { padding-block: var(--sp-8); }
.grid { display: grid; gap: var(--sp-5); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.watermark { /* grand hangeul décoratif : ajouter aria-hidden="true" */
  position: absolute; font-family: var(--font-kr); font-weight: 700;
  font-size: clamp(10rem, 30vw, 26rem); line-height: 1;
  color: var(--c-orchid); opacity: .14; pointer-events: none; user-select: none;
}

/* ---------- 5. BOUTONS ----------
   RÈGLE : le rose (--cta-bg) n'apparaît QUE sur .btn--primary.  */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 48px; padding: .85rem 1.6rem;
  font: 700 var(--fs-md)/1 var(--font-body);
  border: 2px solid transparent; border-radius: var(--r-pill);
  text-decoration: none; cursor: pointer;
  transition: background .2s, transform .2s, border-color .2s, box-shadow .2s;
}
.btn--primary { background: var(--cta-bg); color: var(--cta-text); box-shadow: 0 4px 16px rgba(229, 143, 169, .22); }
.btn--primary:hover { background: var(--c-rose-hover); color: var(--cta-text); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(229, 143, 169, .34); }
.btn--secondary { background: transparent; color: var(--text); border-color: var(--c-orchid); }
.btn--secondary:hover { background: var(--c-aubergine-2); color: var(--text); }
.btn--ghost { background: transparent; color: var(--link); padding-inline: var(--sp-3); }
.btn--lg { min-height: 56px; padding: 1rem 2rem; font-size: var(--fs-lg); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* CTA sticky mobile */
.cta-sticky { display: none; }
@media (max-width: 720px) {
  .cta-sticky {
    display: block; position: fixed; inset: auto 0 0 0; z-index: 50;
    padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom));
    background: var(--c-night); border-top: 1px solid var(--c-aubergine-2);
  }
  .cta-sticky .btn { width: 100%; }
  body { padding-bottom: 88px; }
  .cookie-banner { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* ---------- 6. NAVIGATION ---------- */
.nav { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); padding-block: var(--sp-4); }
.nav__links { display: flex; align-items: center; gap: var(--sp-5); list-style: none; margin: 0; padding: 0; }
.nav__links a { color: var(--text); text-decoration: none; font-weight: 600; }
.nav__links a:hover, .nav__links a[aria-current="page"] { color: var(--c-orchid); }

/* ---------- 7. CARTES ---------- */
.card {
  background: linear-gradient(165deg, rgba(60, 45, 89, .38) 0%, var(--surface) 100%);
  border: 1px solid var(--c-aubergine-2);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: inset 0 1px 0 rgba(243, 233, 238, .08), 0 6px 20px rgba(14, 8, 26, .25);
}
.card--hover { transition: transform .22s, border-color .22s, box-shadow .22s; }
.card--hover:hover {
  transform: translateY(-3px);
  border-color: var(--c-orchid);
  box-shadow: inset 0 1px 0 rgba(243, 233, 238, .12), 0 14px 32px rgba(14, 8, 26, .42);
}

/* Carte de cours (/cours, /planning) */
.course-card { display: flex; flex-direction: column; gap: var(--sp-3); }
.course-card__level { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-orchid); }
.course-card__title { font-size: var(--fs-xl); font-weight: 700; line-height: var(--lh-tight); margin: 0; }
.course-card__meta { color: var(--text-soft); font-size: var(--fs-sm); margin: 0; }
.course-card__price { font-weight: 700; font-size: var(--fs-lg); }
.course-card .btn { margin-top: auto; }

/* ---------- 8. JAUGE DE PLACES ----------
   <div class="gauge" style="--value:62" role="progressbar"
        aria-valuemin="0" aria-valuemax="100" aria-valuenow="62"
        aria-label="Places réservées"><span class="gauge__fill"></span></div>
   <p class="gauge__label">3 places restantes</p>
   (--value = % de places PRISES, calculé depuis les données réelles) */
.gauge { height: 10px; border-radius: var(--r-pill); background: var(--c-aubergine-2); overflow: hidden; }
.gauge__fill { display: block; height: 100%; width: calc(var(--value, 0) * 1%); background: var(--c-orchid); border-radius: inherit; transition: width .4s; }
.gauge[data-state="low"]  .gauge__fill { background: var(--c-warning); }  /* ex. >= 80 % */
.gauge[data-state="full"] .gauge__fill { background: var(--c-danger); }   /* 100 % : liste d'attente */
.gauge__label { margin: var(--sp-2) 0 0; font-size: var(--fs-sm); color: var(--text-soft); }

/* ---------- 9. BADGES ---------- */
.badge { display: inline-block; padding: .25rem .75rem; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; background: var(--c-aubergine-2); color: var(--text); }
.badge--open  { background: rgba(127,209,168,.16); color: var(--c-success); }
.badge--low   { background: rgba(242,193,78,.16);  color: var(--c-warning); }
.badge--full  { background: rgba(255,138,138,.16); color: var(--c-danger); }

/* ---------- 10. FORMULAIRES (réservation, test de niveau, liste d'attente) ---------- */
.field { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.field label { font-weight: 600; font-size: var(--fs-sm); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: .75rem 1rem;
  background: var(--c-night); color: var(--text);
  border: 2px solid var(--c-aubergine-2); border-radius: var(--r-md);
  font: inherit;
}
.input::placeholder { color: var(--text-soft); opacity: .8; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-color: var(--c-orchid); outline-offset: 2px; }
.field--error .input { border-color: var(--c-danger); }
.field__error { color: var(--c-danger); font-size: var(--fs-sm); }
.consent { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: var(--fs-sm); color: var(--text-soft); }
.consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--c-orchid); } /* jamais pré-cochée */

/* ---------- 11. PREUVE SOCIALE & FAQ ---------- */
.testimonial { border-left: 4px solid var(--c-orchid); padding-left: var(--sp-4); }
.testimonial__author { font-size: var(--fs-sm); color: var(--text-soft); }
.faq details { border-bottom: 1px solid var(--c-aubergine-2); padding-block: var(--sp-4); }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--c-orchid); }
.faq details[open] summary::after { content: "–"; }

/* ---------- 12. BANDEAU COOKIES (visuel : logique à brancher sur ta CMP) ---------- */
.cookie-banner {
  position: fixed; inset: auto var(--sp-4) var(--sp-4) var(--sp-4); z-index: 100;
  max-width: 560px; background: var(--surface); border: 1px solid var(--c-orchid);
  border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow);
}
.cookie-banner__actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; } /* "Refuser" aussi visible que "Accepter" */

/* ---------- 13. DYNAMISME JS (scroll, atelier hangeul, feedback) ---------- */
.site-header--scrolled {
  box-shadow: 0 8px 28px rgba(10, 5, 20, .45);
}
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .45s ease, transform .45s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
.form-feedback {
  margin: var(--sp-3) 0 0;
  padding: .75rem 1rem;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.form-feedback--error {
  background: rgba(255, 138, 138, .14);
  color: var(--c-danger);
  border: 1px solid rgba(255, 138, 138, .35);
}
.form-feedback--success {
  background: rgba(127, 209, 168, .14);
  color: var(--c-success);
  border: 1px solid rgba(127, 209, 168, .35);
}
.hangeul-lab {
  margin-top: var(--sp-6);
  border-color: var(--c-orchid);
}
.hangeul-lab__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-4) 0;
}
.hangeul-lab__btn {
  min-height: 44px;
  padding: .5rem 1.15rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-aubergine-2);
  background: var(--c-night);
  color: var(--text);
  font: 700 var(--fs-md)/1 var(--font-kr);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.hangeul-lab__btn:hover { border-color: var(--c-orchid); }
.hangeul-lab__btn[aria-pressed="true"] {
  background: var(--c-rose);
  border-color: var(--c-rose);
  color: var(--c-night);
}
.hangeul-lab__result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-4);
  background: var(--c-night);
  border-radius: var(--r-md);
  border: 1px solid var(--c-aubergine-2);
}
.hangeul-lab__word {
  font-family: var(--font-kr);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--c-rose);
  line-height: 1;
}
