/* MasterPilot extras: loader + Présence only.
   Layout, type scale, chassis width, and controls come from the app CSS.
   Do not cap .chassis, do not restack controls, do not inflate the title. */

:root {
  --mp-hold: 4s;
}

*, *::before, *::after { box-sizing: border-box; }

/* ——— loader: character + line stay ~4s, bar fills under the speech, then fade ——— */
.mp-load {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: #121418;
  color: #ece7df;
  opacity: 1;
  visibility: visible;
}
.mp-load.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.55s ease, visibility 0.55s ease;
}
.mp-load-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 46% 40% at 50% 42%, rgba(212, 168, 90, 0.12), transparent 70%);
  pointer-events: none;
}
.mp-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  width: min(100%, 28rem);
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
}
.mp-bubble {
  position: relative;
  max-width: 20rem;
  margin: 0;
  padding: 0.85rem 1.15rem;
  background: #ece7df;
  color: #16181c;
  border-radius: 1.15rem 1.15rem 1.15rem 0.35rem;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: clamp(1.05rem, 3vw, 1.2rem);
  line-height: 1.35;
  letter-spacing: -0.02em;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}
.mp-bubble::after {
  content: "";
  position: absolute;
  left: 1.4rem;
  bottom: -0.48rem;
  border: 9px solid transparent;
  border-top-color: #ece7df;
  border-bottom: 0;
}
.loading-bar,
.mp-bar {
  width: min(100%, 18rem);
  height: 12px;
  margin: 0.15rem 0 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(212, 168, 90, 0.45);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}
.loading-bar span,
.mp-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #d4a85a, #f0d7a2);
  animation: mp-fill var(--mp-hold) linear forwards;
}
.mp-guy {
  width: clamp(128px, 38vw, 168px);
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.35));
  animation: mp-bob 2.8s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.mp-guy svg { width: 100%; height: auto; display: block; overflow: visible; }
.mp-arm-l { transform-origin: 48px 90px; animation: mp-arm-l 2.8s ease-in-out infinite; }
.mp-arm-r { transform-origin: 112px 90px; animation: mp-arm-r 2.8s ease-in-out infinite; }
.mp-shadow { transform-origin: 80px 188px; animation: mp-shadow 2.8s ease-in-out infinite; }
.mp-brand {
  margin: 0.2rem 0 0;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 1.35rem;
}
.mp-brand em { font-style: normal; color: #d4a85a; }
@keyframes mp-fill { to { width: 100%; } }
@keyframes mp-bob {
  0%, 100% { transform: translateY(0) rotate(-0.6deg); }
  50% { transform: translateY(-7px) rotate(0.6deg); }
}
@keyframes mp-shadow {
  0%, 100% { transform: scaleX(1); opacity: 0.45; }
  50% { transform: scaleX(0.82); opacity: 0.28; }
}
@keyframes mp-arm-l {
  0%, 100% { transform: rotate(4deg); }
  50% { transform: rotate(-8deg); }
}
@keyframes mp-arm-r {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(8deg); }
}
@media (scripting: none) {
  .mp-load { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .mp-guy, .mp-arm-l, .mp-arm-r, .mp-shadow { animation: none; }
  .loading-bar span, .mp-bar span { animation: none; width: 100%; }
}

/* Corner character, only while Présence is on. Does not take layout space. */
.mp-buddy {
  display: none;
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 15;
  width: 56px;
  pointer-events: none;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}
.mp-buddy svg { width: 100%; height: auto; display: block; }
html.is-presence .mp-buddy { display: block; }

/* Présence sits in the existing nav. Wrap if needed; never stretch links full-bleed. */
body .product-nav {
  flex-wrap: wrap;
  row-gap: 8px;
}
body .mp-presence {
  margin-left: auto;
  cursor: pointer;
  border: 0;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
body .mp-presence[aria-pressed="true"] {
  background: var(--color-amber);
  color: var(--color-amber-ink);
}
body .nav-link:focus-visible,
body .btn:focus-visible,
body .mp-presence:focus-visible {
  outline: 2px solid var(--color-amber);
  outline-offset: 3px;
}

/* Title must stay inside the chassis. Do not enlarge it. */
body .mast h1,
body .pilot .mast h1,
body .studio .mast h1 {
  max-width: 100%;
  overflow: visible;
  text-wrap: balance;
}

@media (max-width: 520px) {
  body .mp-presence { margin-left: 0; }
  body .mp-buddy { right: 10px; bottom: 10px; width: 48px; }
}

/* iPhone: loaded clip and the saved file must stay visible.
   Fixed dock, not a chassis restyle. No overflow clip. */
body .file-name {
  color: #f4efe4;
}
.mp-dock {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: max(6px, env(safe-area-inset-top)) 12px 8px;
  background: #16130e;
  color: #f4efe4;
  border-bottom: 1px solid #d4a85a;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 0.95rem;
  line-height: 1.3;
}
.mp-dock strong { color: #f0d7a2; font-weight: 600; }
.mp-dock canvas {
  width: 112px;
  height: 28px;
  background: #101114;
  border-radius: 4px;
  flex: 0 0 auto;
}
.mp-dock audio {
  flex: 1 1 180px;
  width: 100%;
  height: 32px;
  min-width: 160px;
}
body.mp-has-dock { padding-top: var(--mp-dock-h, 44px); }
.mp-save {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #16130e;
  color: #f4efe4;
  border: 1px solid #d4a85a;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}
.mp-save p { margin: 0; }
.mp-save .mp-save-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mp-save a, .mp-save button {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: #d4a85a;
  color: #1c1812;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 12px;
}
.mp-save button.mp-save-ghost {
  background: transparent;
  color: #f4efe4;
  border: 1px solid #8e96a0;
}

/* Bas de l'accueil Pilot : comment ça marche + caractéristiques réelles.
   Injecté après l'hydratation par mp-boot.js. */
.mp-how {
  max-width: 1180px;
  margin: 18px auto 0;
  padding: 18px 16px 16px;
  border: 1px solid var(--color-line);
  border-radius: 20px;
  background-color: var(--color-chassis);
  background-image: repeating-linear-gradient(90deg, #0000, #0000 2px, #8e96a009 2px 3px);
  box-shadow: inset 0 1px #e6e8eb0a;
  box-sizing: border-box;
}
.mp-how-steps {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mp-how-steps li {
  background: var(--color-well);
  border: 1px solid #000;
  box-shadow: inset 0 0 0 1px var(--color-line);
  padding: 14px 14px 16px;
}
.mp-how-n {
  font-family: var(--font-label);
  letter-spacing: .14em;
  color: var(--color-amber);
  font-size: .8rem;
}
.mp-how-steps h2 {
  font-family: var(--font-label);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 1.05rem;
  margin: 6px 0 4px;
  color: #f4efe4;
}
.mp-how-steps p {
  margin: 0;
  font-size: .88rem;
  line-height: 1.45;
  color: var(--color-metal);
}
.mp-how-specs {
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.mp-how-specs div {
  border-top: 1px solid var(--color-line);
  padding: 10px 2px 2px;
}
.mp-how-specs dt {
  font-family: var(--font-label);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-metal);
  font-size: .72rem;
  margin: 0;
}
.mp-how-specs dd {
  margin: 4px 0 0;
  font-size: .9rem;
  color: #e6e8eb;
}
@media (max-width: 720px) {
  .mp-how { margin-top: 12px; }
  .mp-how-steps { grid-template-columns: 1fr; }
  .mp-how-specs { grid-template-columns: repeat(2, 1fr); }
}
.mp-presence-sub { margin-left: 6px; }

.mp-how-foot {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--color-line);
  display: flex;
  gap: 10px;
  justify-content: center;
  font-family: var(--font-label);
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: .78rem;
  color: var(--color-metal-dim);
}
.mp-how-foot a { color: var(--color-metal); text-decoration: none; padding: 4px 2px; }
.mp-how-foot a:hover, .mp-how-foot a:focus-visible { color: var(--color-amber); }
