/* ==========================================================================
   Portail de paiement Apluschool — feuille de style client
   Palette tirée du logo : encre marine, bleu ciel, vert lime, jaune soleil.
   ========================================================================== */
:root {
  --ink: #0e2747;
  --ink-2: #1b3a63;
  --sky: #2ea8f0;
  --sky-soft: #e4f3fd;
  --lime: #8ad32b;
  --lime-hover: #7cc31f;
  --lime-soft: #eaf7d4;
  --sun: #ffc533;
  --mist: #f2f7fc;
  --paper: #ffffff;
  --line: #d6e3f0;
  --muted: #556e89;
  --danger: #c93b3b;
  --danger-soft: #fdeeee;
  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; letter-spacing: -0.02em; margin: 0; }
p { margin: 0 0 .75em; }
a { color: var(--ink-2); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }
.wrap { width: min(1160px, 100% - 40px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- En-tête ---------- */
.top { background: var(--paper); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 44px; width: auto; display: block; }
.top-nav { display: flex; align-items: center; gap: 22px; font-weight: 600; font-size: .95rem; }
.top-nav a { color: var(--ink); text-decoration: none; }
.top-nav a:hover { text-decoration: underline; }

/* ---------- Boutons & liens ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 12px; border: 1.5px solid transparent;
  font: 700 1rem/1 var(--body); cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--lime); color: var(--ink); }
.btn-primary:hover { background: var(--lime-hover); }
.btn-primary:disabled { background: #dbe6f0; color: #7d93aa; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-2); }
.link-btn {
  background: none; border: 0; padding: 0; font: 600 .95rem var(--body); color: var(--ink-2);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.link-btn:hover { color: var(--sky); }

/* ---------- Héro ---------- */
.hero { padding: 48px 0 12px; }
.hero h1 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); font-weight: 800; max-width: 20ch; }
.hero .lead { margin-top: 14px; max-width: 58ch; font-size: 1.1rem; color: var(--muted); }
.hero-img { display: block; width: 100%; max-width: 720px; height: auto; border-radius: var(--r-lg); margin: 24px 0 8px; }

/* ---------- Boutique ---------- */
.shop { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 32px; align-items: start; padding: 28px 0 56px; }
.block-head { margin-bottom: 18px; }
.block-head h2 { font-size: 1.5rem; font-weight: 700; }
.block-head p { margin: 4px 0 0; }

.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.mobile-select { display: none; }
.ticket {
  position: relative; display: flex; flex-direction: column; text-align: left;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r-md);
  padding: 0; cursor: pointer; font: inherit; color: var(--ink); overflow: hidden;
  transition: border-color .15s, background-color .15s, color .15s, box-shadow .15s;
}
button.ticket:hover:not(:disabled) { border-color: var(--ink-2); }
.ticket:disabled { opacity: .5; cursor: not-allowed; }
.t-top { padding: 16px 16px 12px; display: flex; align-items: baseline; gap: 8px; }
.ticket .qty { font: 800 3rem/1 var(--display); letter-spacing: -0.04em; }
.ticket .unit { font-size: .95rem; color: var(--muted); font-weight: 500; }
.perf { border-top: 2px dashed var(--line); margin: 0 12px; }
.t-bot { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 2px; }
.ticket .price { font: 700 1.2rem/1.2 var(--display); }
.ticket .per { font-size: .85rem; color: var(--muted); }
.ticket .save {
  margin-top: 8px; align-self: flex-start; font-size: .78rem; font-weight: 700;
  background: var(--lime-soft); color: #2f5a04; padding: 3px 9px; border-radius: 999px;
}
.ticket .best {
  position: absolute; top: 10px; right: 10px; font-size: .72rem; font-weight: 700;
  background: var(--sun); color: var(--ink); padding: 3px 9px; border-radius: 999px;
}
.ticket[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 10px 28px -14px rgba(14, 39, 71, .7); }
.ticket[aria-checked="true"] .unit, .ticket[aria-checked="true"] .per { color: #b9cde3; }
.ticket[aria-checked="true"] .perf { border-color: rgba(255, 255, 255, .28); }
.ticket[aria-checked="true"] .save { background: var(--lime); color: var(--ink); }
.ticket .check {
  position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--lime); color: var(--ink); display: none; align-items: center; justify-content: center;
}
.ticket[aria-checked="true"] .check { display: flex; }
.ticket[aria-checked="true"] .best { display: none; }

.promo-ticket .ticket { max-width: 320px; background: var(--ink); color: #fff; border-color: var(--ink); cursor: default; }
.promo-ticket .ticket .unit, .promo-ticket .ticket .per { color: #b9cde3; }
.promo-ticket .ticket .perf { border-color: rgba(255, 255, 255, .28); }
.promo-ticket .link-btn { margin-top: 16px; }

/* ---------- Panneau de commande ---------- */
.panel {
  position: sticky; top: 16px; background: var(--paper); border: 1.5px solid var(--line);
  border-radius: var(--r-lg); padding: 24px;
}
.panel h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 16px; }
.recap {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  background: var(--sky-soft); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 14px;
}
.recap-label { display: block; font-weight: 700; }
.recap-sub { display: block; font-size: .85rem; color: var(--muted); }
.recap-total { font: 800 1.5rem/1 var(--display); white-space: nowrap; }

.promo-field { margin-bottom: 18px; }
.promo-form { display: flex; gap: 8px; margin-top: 10px; }
.promo-form input { flex: 1; min-width: 0; text-transform: uppercase; }
.promo-form .btn { min-height: 46px; padding: 0 16px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; font: 500 1rem var(--body); color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px; transition: border-color .15s;
}
textarea { min-height: 120px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b7cbe0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(46, 168, 240, .2); }
.phone { display: flex; align-items: stretch; }
.phone .dial {
  display: flex; align-items: center; padding: 0 12px; background: var(--mist);
  border: 1.5px solid var(--line); border-right: 0; border-radius: 12px 0 0 12px; font-weight: 700; color: var(--ink-2);
}
.phone input { border-radius: 0 12px 12px 0; }
.hint { display: block; margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.hint-err { color: var(--danger); font-weight: 600; }
.optional { margin-bottom: 14px; }
.optional summary { cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: .92rem; padding: 4px 0 10px; }
.optional[open] summary { margin-bottom: 4px; }
.alert {
  background: var(--danger-soft); color: #8d2323; border: 1px solid #f3c9c9;
  border-radius: 12px; padding: 12px 14px; font-weight: 600; font-size: .93rem; margin: 0 0 14px;
}
.btn-pay { width: 100%; min-height: 54px; font-size: 1.05rem; }
.secure { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0 0; font-size: .82rem; color: var(--muted); text-align: center; }

/* ---------- Comment ça marche ---------- */
.how { padding: 8px 0 64px; }
.how h2 { font-size: 1.5rem; margin-bottom: 20px; }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.steps li { counter-increment: s; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 20px; }
.steps li::before {
  content: counter(s); display: inline-flex; width: 32px; height: 32px; border-radius: 50%;
  align-items: center; justify-content: center; background: var(--sun); font: 800 1rem var(--display); margin-bottom: 12px;
}
.steps strong { display: block; font: 700 1.15rem var(--display); margin-bottom: 4px; }
.steps span { color: var(--muted); }

/* ---------- Pied de page ---------- */
.foot { background: var(--ink); color: #d3e0ef; padding: 36px 0; margin-top: auto; }
.foot-in { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; font-size: .92rem; }
.foot strong { color: #fff; font: 700 1.05rem var(--display); }
.foot p { margin: 6px 0 0; }
.foot a { color: #fff; }
body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 0 auto; }

/* ---------- Fenêtres modales ---------- */
.modal { border: 0; border-radius: var(--r-lg); padding: 28px; width: min(440px, calc(100% - 32px)); color: var(--ink); background: #fff; }
.modal::backdrop { background: rgba(14, 39, 71, .55); }
.modal h2 { font-size: 1.35rem; margin-bottom: 8px; }
.modal-close-row { display: flex; justify-content: flex-end; margin: -10px -10px 0 0; }
.modal .x { background: none; border: 0; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 10px; }
.modal .btn { width: 100%; }

/* ---------- Pages d'état (retour paiement) ---------- */
.state { padding: 72px 0; max-width: 620px; text-align: center; }
.state h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); margin-bottom: 12px; }
.state .lead { color: var(--muted); font-size: 1.08rem; }
.state .btn { margin: 6px 4px; }
.spinner { width: 46px; height: 46px; margin: 0 auto 22px; border-radius: 50%; border: 5px solid var(--sky-soft); border-top-color: var(--sky); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Barre mobile ---------- */
.mbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1.5px solid var(--line);
}
.mbar[hidden] { display: none; }
.mbar span { display: block; font-size: .8rem; color: var(--muted); }
.mbar strong { font: 800 1.15rem var(--display); }
.mbar .btn { min-height: 44px; }

/* ---------- Page reçu ---------- */
.rc-page { padding: 28px 0 56px; }
.rc-page-title { font-size: 1.5rem; margin-bottom: 16px; }
.rc-banner {
  display: flex; gap: 16px; align-items: flex-start; background: var(--lime-soft); border: 1.5px solid #cbe89b;
  border-radius: var(--r-md); padding: 18px 20px; margin-bottom: 18px;
}
.rc-banner h1 { font-size: 1.4rem; margin-bottom: 2px; }
.rc-banner p { margin: 0; }
.rc-banner .tick { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--lime); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.rc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.is-embed { background: #fff; }
.is-embed .top, .is-embed .foot, .is-embed .rc-banner, .is-embed .rc-page-title { display: none; }
.is-embed .rc-page { padding-top: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .shop { grid-template-columns: 1fr; gap: 24px; padding-bottom: 96px; }
  .panel { position: static; }
  .steps { grid-template-columns: 1fr; }
  .foot-in { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 560px) {
  .wrap { width: min(1160px, 100% - 32px); }
  .hero { padding-top: 32px; }
  .tickets { display: none; }
  .mobile-select { display: block; margin-bottom: 4px; }
  .mobile-select select { font-weight: 700; }
  .panel { padding: 20px 16px; }
  .top-nav a { display: none; }
  .brand img { height: 38px; }
  .rc-actions .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spinner { animation-duration: 3s; }
  * { transition: none !important; }
}
@media print {
  .top, .foot, .rc-banner, .rc-actions, .rc-page-title, .mbar { display: none !important; }
  body { background: #fff; }
}

@media (min-width: 981px) {
  .mbar { display: none !important; }
}
