/* ==========================================================================
   LE PROTOCOLE DES CHEVAUX — Stylesheet
   Identité visuelle : navy + parchemin + or
   ========================================================================== */

* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html, body { background-color: #142844; }
body {
  color: #F5EBD3;
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(212,179,106,.14), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(31,58,95,.55), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.font-display { font-family: 'Cormorant SC', 'Cormorant Garamond', serif; letter-spacing: .06em; }
.font-serif   { font-family: 'Cormorant Garamond', serif; }
.font-body    { font-family: 'Lora', Georgia, serif; }
.font-mono    { font-family: 'JetBrains Mono', monospace; }

.screen { display: none; }
.screen.active { display: block; }

.fade-in { animation: fadeIn .4s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ================ LAYOUT — STRICT CENTERED ================ */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 36px) clamp(16px, 4vw, 32px) 120px;
  position: relative;
  z-index: 1;
  text-align: center;
}
@media (min-width: 768px) { .page { max-width: 680px; } }
@media (min-width: 1280px) { .page { max-width: 720px; } }

.stack > * + * { margin-top: clamp(16px, 2vw, 22px); }

/* ================ BRAND SEAL (horse heraldic) ================ */
.brand-seal {
  width: clamp(56px, 9vw, 72px);
  height: clamp(56px, 9vw, 72px);
  border-radius: 50%;
  border: 2px solid #D4B36A;
  background:
    radial-gradient(circle at 35% 30%, rgba(212,179,106,.18), transparent 60%),
    rgba(31,58,95,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  position: relative;
  box-shadow:
    0 0 0 4px rgba(20,40,68,1),
    0 0 0 5px rgba(168,136,66,.5),
    0 6px 20px rgba(0,0,0,.5);
  flex-shrink: 0;
  overflow: hidden;
}
.brand-seal::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(212,179,106,.45);
  border-radius: 50%;
  pointer-events: none;
}
.brand-seal .horse-icon {
  width: 62%;
  height: auto;
  max-height: 62%;
  color: #D4B36A;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
}

/* Seal variant on parchment */
.brand-seal-parchment {
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,.5), transparent 60%),
    #F2E5C7;
  border-color: #7A6228;
  box-shadow:
    0 0 0 4px #F2E5C7,
    0 0 0 5px #A88842,
    0 4px 12px rgba(0,0,0,.25);
}
.brand-seal-parchment::before { border-color: rgba(122,98,40,.4); }
.brand-seal-parchment .horse-icon { color: #7A6228; }

/* ================ SPLASH ================ */
.splash-content { animation: splashCycle 1.6s ease-in-out forwards; }
@keyframes splashCycle {
  0%   { opacity: 0; }
  28%  { opacity: 1; }
  72%  { opacity: 1; }
  100% { opacity: 0; }
}

.moon-glow {
  position: absolute; left: 50%; top: 28%;
  transform: translate(-50%, -50%);
  width: clamp(260px, 60vw, 420px);
  aspect-ratio: 1;
  background: radial-gradient(circle at center, rgba(245,235,211,.32) 0%, rgba(245,235,211,.08) 35%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.stars { position: absolute; inset: 0; pointer-events: none; opacity: .55; z-index: 0; }
.stars span {
  position: absolute;
  width: 2px; height: 2px;
  background: #F2E5C7;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(245,235,211,.8);
}

/* ================ PARCHMENT CARDS ================ */
.parchment {
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.5), transparent 40%),
    radial-gradient(circle at 80% 100%, rgba(168,136,66,.12), transparent 50%),
    linear-gradient(180deg, #F4E7CA 0%, #EBDCB8 100%);
  border: 1px solid #A88842;
  border-radius: 14px;
  box-shadow:
    0 1px 0 rgba(255,255,255,.3) inset,
    0 0 0 1px rgba(255,255,255,.4) inset,
    0 10px 30px rgba(0,0,0,.35);
  color: #2C2416;
  padding: clamp(22px, 4vw, 32px);
  text-align: left;
  position: relative;
}
.parchment-center { text-align: center; }

/* ================ INPUTS ================ */
.input-wrap { position: relative; }
.input-field {
  width: 100%;
  background: #FBF3DC;
  border: 2px solid #A88842;
  color: #2C2416;
  padding: 18px 64px 18px 18px;
  border-radius: 10px;
  font-size: clamp(18px, 2.4vw, 22px);
  font-family: 'Lora', Georgia, serif;
  font-weight: 500;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
  text-align: center;
}
.input-field::placeholder { color: #8A7752; font-weight: 400; font-style: italic; font-size: clamp(15px, 2vw, 18px); text-align: center; }
.input-field:focus {
  outline: none;
  border-color: #7A6228;
  background: #FFF8E0;
  box-shadow: 0 0 0 4px rgba(212,179,106,.25);
}
.input-suffix {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #7A6228;
  font-size: 18px;
  font-weight: 600;
  pointer-events: none;
  font-family: 'Lora', serif;
}
.input-error { border-color: #A03A2A !important; background: #FDEDE8 !important; }

.field-label {
  display: block;
  color: #2C2416;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(18px, 2.2vw, 20px);
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

/* ================ BUTTONS ================ */
.btn-primary {
  width: 100%;
  background: linear-gradient(180deg, #D4B36A 0%, #B89548 100%);
  color: #2C2416;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  padding: 20px 24px;
  border-radius: 12px;
  font-size: clamp(19px, 2.4vw, 22px);
  letter-spacing: .02em;
  border: 1px solid #7A6228;
  box-shadow: 0 4px 0 #7A6228, 0 6px 16px rgba(0,0,0,.4);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s, filter .2s;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-primary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #7A6228, 0 3px 8px rgba(0,0,0,.4);
}
.btn-primary:disabled {
  background: #5A4A2E;
  color: #9C8E6D;
  box-shadow: 0 4px 0 #2C2416;
  border-color: #2C2416;
  cursor: not-allowed;
}
.btn-primary.pulse { animation: pulseGold 2s ease-in-out infinite; }
@keyframes pulseGold {
  0%, 100% { box-shadow: 0 4px 0 #7A6228, 0 6px 16px rgba(0,0,0,.4), 0 0 0 0 rgba(212,179,106,.6); }
  50%      { box-shadow: 0 4px 0 #7A6228, 0 6px 16px rgba(0,0,0,.4), 0 0 0 16px rgba(212,179,106,0); }
}

.btn-secondary {
  width: 100%;
  background: rgba(212,179,106,.08);
  color: #F2E5C7;
  border: 2px solid #D4B36A;
  padding: 18px 20px;
  border-radius: 12px;
  font-size: clamp(17px, 2.2vw, 19px);
  font-weight: 600;
  font-family: 'Cormorant Garamond', serif;
  cursor: pointer;
  transition: background-color .2s;
}
.btn-secondary:hover { background: rgba(212,179,106,.18); }

.btn-tertiary {
  background: transparent;
  border: none;
  color: #C9B98C;
  padding: 14px;
  font-size: clamp(15px, 2vw, 17px);
  cursor: pointer;
  font-family: 'Lora', serif;
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.btn-tertiary:hover { color: #D4B36A; }

/* ================ ORNAMENTS ================ */
.ornament {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin: clamp(20px, 3vw, 28px) auto;
  color: #D4B36A;
  max-width: 320px;
}
.ornament .line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #D4B36A, transparent); }
.ornament .glyph { font-family: 'Cormorant Garamond', serif; font-size: 20px; line-height: 1; }
.ornament-dark .line { background: linear-gradient(90deg, transparent, #A88842, transparent); }
.ornament-dark .glyph { color: #A88842; }

/* ================ HEADER (per-screen) ================ */
.screen-header {
  text-align: center;
  margin-bottom: clamp(20px, 3vw, 32px);
}
.screen-header .brand-seal { margin-bottom: 14px; }
.screen-header h1.brand-title {
  font-family: 'Cormorant SC', 'Cormorant Garamond', serif;
  font-weight: 700;
  letter-spacing: .08em;
  color: #D4B36A;
  font-size: clamp(16px, 2.2vw, 19px);
  line-height: 1.2;
}
.screen-header .brand-subtitle {
  color: #C9B98C;
  font-style: italic;
  font-size: clamp(12px, 1.6vw, 14px);
  margin-top: 4px;
}

/* ================ LOADING SCREEN WRAP ================ */
.loading-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  position: relative;
  text-align: center;
}
.loading-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.loading-ornament {
  width: 220px !important;
  max-width: 220px !important;
  margin: 28px auto 16px !important;
}

/* ================ RING LOADER ================ */
.ring-loader { width: clamp(140px, 28vw, 180px); aspect-ratio: 1; position: relative; margin: 0 auto; }
.ring-loader svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring-bg { stroke: rgba(212,179,106,.18); }
.ring-fg { stroke: #D4B36A; stroke-linecap: round; transition: stroke-dashoffset .1s linear; filter: drop-shadow(0 0 8px rgba(212,179,106,.5)); }
.ring-pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  color: #F2E5C7; font-size: clamp(26px, 4vw, 32px); font-weight: 700;
}

.loading-text {
  min-height: 28px;
  text-align: center;
  color: #C9B98C;
  font-size: clamp(16px, 2.2vw, 19px);
  font-family: 'Lora', serif;
  font-style: italic;
  transition: opacity .2s;
}
.lt-hidden { opacity: 0; }

/* ================ COMPOSTO CARDS ================ */
.compose {
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.45), transparent 40%),
    linear-gradient(180deg, #F4E7CA 0%, #EBDCB8 100%);
  border: 1px solid #A88842;
  border-top: 4px solid #D4B36A;
  border-radius: 12px;
  padding: clamp(20px, 3vw, 26px);
  box-shadow: 0 6px 18px rgba(0,0,0,.28);
  color: #2C2416;
  text-align: center;
}
.compose-header { padding-bottom: 16px; border-bottom: 1px solid rgba(168,136,66,.35); margin-bottom: 16px; }
.compose-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(22px, 3vw, 28px);
  color: #2C2416;
  line-height: 1.15;
  font-weight: 700;
}
.compose-name-sub {
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: clamp(13px, 1.6vw, 15px);
  color: #5A4A2E;
  margin-top: 4px;
}
.compose-phase {
  display: inline-block;
  font-family: 'Cormorant SC', serif;
  letter-spacing: .12em;
  font-size: clamp(11px, 1.4vw, 13px);
  color: #7A6228;
  margin-top: 6px;
  padding: 2px 10px;
  border: 1px solid rgba(122,98,40,.4);
  border-radius: 999px;
}

.compose-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: center;
}
@media (min-width: 560px) {
  .compose-body { grid-template-columns: 1fr 1fr; gap: 20px; }
}

.compose-cell-label {
  font-family: 'Cormorant SC', serif;
  letter-spacing: .12em;
  font-size: clamp(11px, 1.4vw, 12px);
  color: #7A6228;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.dose-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #7A6228;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1;
}
.dose-unit { color: #5A4A2E; font-size: clamp(15px, 2vw, 18px); font-weight: 600; margin-left: 4px; }
.dose-sub { color: #5A4A2E; font-size: clamp(12px, 1.6vw, 14px); margin-top: 6px; font-style: italic; }

.compose-time {
  font-family: 'JetBrains Mono', monospace;
  color: #2C2416;
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 700;
}

.compose-num {
  font-family: 'Cormorant SC', serif;
  letter-spacing: .14em;
  font-size: clamp(11px, 1.4vw, 12px);
  color: #A88842;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.compose-body-single {
  text-align: center;
  padding: 4px 0;
}

.conc-desc {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #7A6228;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.2;
}

/* ================ HORAIRE BANNER ================ */
.horaire-banner {
  background:
    radial-gradient(circle at 30% 0%, rgba(212,179,106,.25), transparent 60%),
    linear-gradient(180deg, #1F3A5F 0%, #142844 100%);
  border: 2px solid #D4B36A;
  border-radius: 14px;
  padding: clamp(22px, 4vw, 32px) clamp(20px, 3vw, 28px);
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(212,179,106,.3) inset,
    0 8px 24px rgba(0,0,0,.4);
  position: relative;
}
.horaire-banner::before {
  content: "❦";
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: #142844;
  color: #D4B36A;
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  padding: 0 12px;
}
.horaire-label {
  font-family: 'Cormorant SC', serif;
  letter-spacing: .14em;
  font-size: clamp(12px, 1.6vw, 14px);
  color: #C9B98C;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.horaire-time {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  color: #D4B36A;
  font-size: clamp(26px, 4.5vw, 36px);
  line-height: 1.15;
  letter-spacing: .01em;
}
.horaire-sub {
  color: #C9B98C;
  font-style: italic;
  font-size: clamp(13px, 1.7vw, 15px);
  margin-top: 12px;
}

/* ================ PREP STEPS ================ */
.prep-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: prep;
}
.prep-list li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px dashed rgba(168,136,66,.35);
  text-align: left;
}
.prep-list li:last-child { border-bottom: none; }
.prep-num {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(180deg, #D4B36A, #A88842);
  color: #FFF8E0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.prep-text {
  color: #2C2416;
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.5;
  padding-top: 6px;
}
.prep-text strong { color: #7A6228; }

/* ================ CALENDAR ================ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: clamp(6px, 1.2vw, 10px); margin-top: 32px; max-width: 460px; margin-left: auto; margin-right: auto; }
.cal-day {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 700;
  position: relative;
  border: 1px solid;
}
.phase-1 { background: #EBDCB8; border-color: #A88842; color: #5A4A2E; }
.phase-2 { background: #D9B97A; border-color: #7A6228; color: #2C2416; }
.phase-3 { background: #B89548; border-color: #5A4A2E; color: #FFF8E0; }
.day-today { box-shadow: 0 0 0 3px #D4B36A, 0 0 18px rgba(212,179,106,.7); }
.day-today::after {
  content: 'Aujourd''hui';
  position: absolute;
  top: -22px; left: 50%; transform: translateX(-50%);
  font-size: clamp(9px, 1.4vw, 11px);
  color: #D4B36A;
  font-family: 'Cormorant SC', serif;
  font-weight: 700;
  letter-spacing: .08em;
  white-space: nowrap;
}

.legend {
  max-width: 460px;
  margin: 0 auto;
  text-align: left;
}
.legend li { display: flex; align-items: center; gap: 12px; padding: 4px 0; color: #2C2416; }
.legend-sq { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; border: 1px solid; }

/* ================ SIGNES ================ */
.signe-row { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px dashed rgba(168,136,66,.35); text-align: left; }
.signe-row:last-child { border-bottom: none; }
.signe-tag {
  font-family: 'Cormorant SC', serif;
  font-weight: 700;
  letter-spacing: .04em;
  background: linear-gradient(180deg, #D4B36A, #A88842);
  color: #FFF8E0;
  padding: 6px 14px;
  border-radius: 6px;
  flex-shrink: 0;
  min-width: 90px;
  text-align: center;
  font-size: clamp(13px, 1.8vw, 15px);
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.signe-text { color: #2C2416; font-size: clamp(15px, 2vw, 17px); line-height: 1.4; }

/* ================ FOOTER ================ */
.footer-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(14,30,51,.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 2px solid #A88842;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom)) 0;
  z-index: 50;
}
.footer-inner { max-width: 640px; margin: 0 auto; padding: 0 12px; }
.footer-row { display: flex; justify-content: space-between; align-items: center; }
.footer-btn {
  background: none; border: none; color: #C9B98C;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; padding: 6px 8px;
  cursor: pointer; transition: color .2s;
  flex: 1;
  font-family: 'Cormorant SC', serif;
  letter-spacing: .06em;
}
.footer-btn:hover, .footer-btn.active { color: #D4B36A; }
.footer-btn svg { width: 24px; height: 24px; stroke-width: 1.5; }

/* ================ MISC ================ */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

.err-msg { color: #E5A39A; font-size: 14px; margin-top: 8px; min-height: 18px; font-style: italic; text-align: center; }

.trust-note {
  color: rgba(122,98,40,.85);
  font-size: clamp(12px, 1.5vw, 13px);
  font-style: italic;
  text-align: center;
  line-height: 1.5;
  margin-top: 20px;
}

/* Big titles */
.title-l1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  color: #2C2416;
  font-size: clamp(26px, 4.5vw, 34px);
  line-height: 1.15;
  text-align: center;
}
.title-cream {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  color: #F5EBD3;
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.15;
  text-align: center;
}
.intro-text {
  font-family: 'Lora', serif;
  color: #5A4A2E;
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.6;
  text-align: center;
  margin-top: 14px;
}
