:root {
  --bg-deep: #070a0f;
  --bg: #0a1020;
  --bg-mid: #0f1729;
  --bg-elevated: rgba(22, 32, 52, 0.72);
  --border: rgba(148, 163, 184, 0.12);
  --border-bright: rgba(201, 162, 39, 0.35);
  --text: #f1f5fb;
  --text-muted: #94a3b8;
  --accent: #d4a82a;
  --accent-soft: #e8c547;
  --accent-dim: #9a7418;
  --accent-glow: rgba(212, 168, 42, 0.35);
  --danger: #f87171;
  --radius: 14px;
  --radius-lg: 20px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --brand-logo-url: url("/assets/mapiece_logo-removebg-preview.png");
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 40px -8px rgba(212, 168, 42, 0.25);
  /* Logo (verts) + or site */
  --brand-green-dark: #065f46;
  --brand-green: #059669;
  --brand-green-light: #34d399;
  --brand-title-gradient: linear-gradient(
    105deg,
    var(--brand-green-dark) 0%,
    var(--brand-green) 28%,
    var(--brand-green-light) 52%,
    #d4a82a 82%,
    var(--accent-soft) 100%
  );
}

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

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

@media (max-width: 480px) {
  html {
    overflow-x: hidden;
  }
}

::selection {
  background: rgba(212, 168, 42, 0.25);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  isolation: isolate;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 100% 70% at 50% -25%, rgba(212, 168, 42, 0.18), transparent 52%),
    radial-gradient(ellipse 80% 50% at 100% 20%, rgba(59, 130, 246, 0.08), transparent 45%),
    radial-gradient(ellipse 60% 40% at 0% 60%, rgba(212, 168, 42, 0.06), transparent 50%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 100px,
      rgba(255, 255, 255, 0.015) 100px,
      rgba(255, 255, 255, 0.015) 101px
    ),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--brand-logo-url) no-repeat 50% 38% / min(72vw, 340px);
  opacity: 0.042;
}

@media (max-width: 480px) {
  body::before {
    background-size: min(98vw, 400px);
    background-position: 50% 32%;
    opacity: 0.045;
  }
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 50% 40% at 50% 100%, rgba(212, 168, 42, 0.06), transparent 65%);
}

.site-header,
main {
  position: relative;
  z-index: 1;
}

.wrap {
  width: min(680px, calc(100% - clamp(1rem, 5vw, 2.5rem)));
  max-width: 100%;
  margin-inline: auto;
  padding-inline: 0;
}

@media (min-width: 900px) {
  .wrap {
    width: min(720px, calc(100% - 3rem));
  }
}

.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Pas de min-height imposé : le logo définit la hauteur (évite le bandeau vide géant). */
  min-height: 0;
  padding: max(0.65rem, env(safe-area-inset-top)) clamp(0.75rem, 4vw, 1.5rem)
    clamp(0.85rem, 2.5vw, 1.35rem);
  overflow: hidden;
  border-bottom: none;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.07) 0%,
      rgba(255, 255, 255, 0.02) 35%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 85% 95% at 50% -28%,
      rgba(212, 168, 42, 0.16),
      transparent 56%
    ),
    radial-gradient(ellipse 70% 90% at 15% 40%, rgba(59, 130, 246, 0.12), transparent 55%),
    radial-gradient(ellipse 65% 85% at 88% 55%, rgba(212, 168, 42, 0.1), transparent 52%),
    linear-gradient(165deg, #0d1528 0%, #060910 48%, #0a1020 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 60px -20px rgba(212, 168, 42, 0.15);
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 60px,
      rgba(255, 255, 255, 0.012) 60px,
      rgba(255, 255, 255, 0.012) 61px
    ),
    radial-gradient(circle at 50% 0%, rgba(232, 197, 71, 0.12), transparent 38%);
  opacity: 0.9;
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(212, 168, 42, 0.15) 15%,
    rgba(232, 197, 71, 0.55) 50%,
    rgba(212, 168, 42, 0.15) 85%,
    transparent
  );
  box-shadow: 0 0 12px rgba(212, 168, 42, 0.25);
}

.site-header .wrap {
  position: relative;
  z-index: 2;
  text-align: center;
  /* Bandeau plus large que le corps (680/720px) pour le logo panoramique. */
  width: min(960px, calc(100% - clamp(1rem, 4vw, 2rem)));
}

.header-inner {
  display: flex;
  justify-content: center;
  align-items: center;
}

.brand-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
  width: 100%;
  transition: transform 0.25s ease;
}

@media (max-width: 520px) {
  .logo-img {
    flex-shrink: 0;
  }

  .tagline {
    font-size: clamp(0.88rem, 3.2vw, 1.05rem);
    line-height: 1.45;
    max-width: min(36rem, 94vw);
  }
}

.brand-row:hover {
  transform: translateY(-1px);
}

.brand-row:hover .logo-img {
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.42)) brightness(1.08) saturate(1.06);
}

/* Bloc uniquement le logo : largeur du wrap, pas de min-height fantôme. */
.logo-frame {
  display: block;
  width: 100%;
  min-height: 0;
  line-height: 0;
}

.logo-img {
  display: block;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 100%;
  height: auto;
  margin-inline: auto;
  max-width: 100%;
  /* Si le PNG est portrait/long, une petite max-height faisait rétrécir toute l’image (logo minuscule). Plafond large, ou jamais la largeur ne suit. */
  max-height: min(88vh, 56rem);
  object-fit: contain;
  object-position: center;
  transition: filter 0.25s ease;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.42));
}

.brand-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.35rem, 1.2vw, 0.6rem);
  min-width: 0;
  width: 100%;
  text-align: center;
}

.tagline {
  margin: 0;
  max-width: min(32rem, 94vw);
  margin-inline: auto;
  padding-inline: 0.25rem;
  /* Discret vs le logo (le texte dans le PNG suit l’échelle du fichier image). */
  font-size: clamp(0.92rem, 2.2vw, 1.12rem);
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.hero {
  padding: clamp(1.5rem, 5vw, 2.75rem) 0 clamp(0.75rem, 3vw, 1rem);
  text-align: center;
}

@media (prefers-reduced-motion: no-preference) {
  .hero .hero-animate {
    animation: fade-up 0.7s ease backwards;
  }

  .hero .hero-animate:nth-child(1) {
    animation-delay: 0.05s;
  }

  .hero .hero-animate:nth-child(2) {
    animation-delay: 0.18s;
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.45rem, 5.2vw, 2.35rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  text-shadow: 0 2px 32px rgba(212, 168, 42, 0.12);
}

.hero h1::after {
  content: "";
  display: block;
  width: min(5rem, 30%);
  height: 3px;
  margin: 1.1rem auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-soft), transparent);
  opacity: 0.85;
}

.lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.hero-pitch {
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  max-width: 36rem;
  padding: 1.5rem 0 0.5rem;
}

.hero-pitch p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.62;
  letter-spacing: 0.01em;
}

.hero-pitch .hero-pitch-lead {
  color: var(--text);
  font-size: clamp(0.98rem, 3vw, 1.1rem);
  font-weight: 500;
  padding: 0.75rem clamp(0.75rem, 3vw, 1rem);
  border-radius: var(--radius);
  border: 1px solid var(--border-bright);
  background: rgba(212, 168, 42, 0.05);
  box-shadow: var(--shadow-sm);
  max-width: 100%;
}

.form-section {
  padding-bottom: 3.5rem;
}

.form-section .wrap {
  text-align: center;
}

.form-section .card {
  text-align: left;
}

.form-section .radio-row {
  justify-content: center;
}

.form-section .hint {
  text-align: center;
}

.form-section .card .type-fieldset {
  text-align: center;
}

.form-section .checkbox-row {
  justify-content: center;
}

.card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: clamp(12px, 3vw, var(--radius-lg));
  padding: clamp(1.15rem, 4vw, 1.75rem);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 45%,
    rgba(212, 168, 42, 0.08) 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

@media (min-width: 540px) {
  .card {
    padding: 2.15rem 2.25rem;
  }
}

.type-fieldset {
  border: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.type-fieldset legend {
  font-weight: 600;
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

.radio-pill:hover {
  border-color: rgba(212, 168, 42, 0.45);
  background: rgba(212, 168, 42, 0.04);
}

.radio-pill:has(:checked) {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(212, 168, 42, 0.18), rgba(212, 168, 42, 0.06));
  box-shadow: 0 0 0 1px rgba(212, 168, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.radio-pill input {
  accent-color: var(--accent);
}

.hint {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.field-group {
  margin-bottom: 1.35rem;
}

.field-group.hidden {
  display: none;
}

.field-group label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
  letter-spacing: 0.02em;
}

.req {
  color: var(--accent-soft);
}

input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.78rem 1rem;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: rgba(7, 10, 15, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

textarea {
  width: 100%;
  min-height: 7.5rem;
  padding: 0.85rem 1rem;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: rgba(7, 10, 15, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  resize: vertical;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

@media (min-width: 640px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  textarea {
    font-size: inherit;
  }
}

input::placeholder,
textarea::placeholder {
  color: rgba(148, 163, 184, 0.55);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(212, 168, 42, 0.55);
  background: rgba(7, 10, 15, 0.75);
  box-shadow:
    0 0 0 3px rgba(212, 168, 42, 0.15),
    0 4px 14px rgba(0, 0, 0, 0.2);
}

.grid-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 520px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
    row-gap: 0;
  }
}

.field-error {
  min-height: 1.25rem;
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--danger);
}

.checkbox-row .check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-weight: 400;
  cursor: pointer;
  line-height: 1.45;
}

.checkbox-row input {
  margin-top: 0.25rem;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.mailto-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
  line-height: 1.55;
}

.form-section .mailto-note,
.form-section .form-success,
.form-section .form-wide-error {
  text-align: center;
}

.form-success {
  padding: 0.85rem 1.1rem;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(212, 168, 42, 0.15), rgba(212, 168, 42, 0.06));
  border: 1px solid rgba(212, 168, 42, 0.35);
  color: var(--text);
  margin: 0 0 1rem;
  font-size: 0.95rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.form-wide-error {
  margin-bottom: 1rem;
  min-height: 0;
}

.installment-highlight {
  margin: 1.35rem 0 1rem;
  padding: 1rem 1.15rem;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 168, 42, 0.35);
  background: linear-gradient(160deg, rgba(212, 168, 42, 0.14), rgba(7, 10, 15, 0.35));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.25);
}

.installment-kicker {
  margin: 0 0 0.5rem;
  font-size: clamp(0.98rem, 2.8vw, 1.08rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.65rem;
}

.installment-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--bg-deep);
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

.installment-detail {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.installment-detail strong {
  color: var(--text);
  font-weight: 600;
}

.installment-footnote {
  margin: 0.65rem 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: rgba(148, 163, 184, 0.75);
  text-align: center;
}

.form-section .installment-footnote {
  max-width: 26rem;
  margin-left: auto;
  margin-right: auto;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  width: 100%;
  padding: 0.95rem 1.35rem;
  font: inherit;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.03em;
  color: var(--bg-deep);
  border: none;
  border-radius: 11px;
  cursor: pointer;
  background: linear-gradient(165deg, var(--accent-soft) 0%, var(--accent) 45%, var(--accent-dim) 100%);
  box-shadow:
    var(--shadow-sm),
    0 4px 20px var(--accent-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.07);
  box-shadow:
    var(--shadow-sm),
    0 8px 28px rgba(212, 168, 42, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.985);
}

.site-footer {
  padding: 2.25rem 0 2.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.2));
}

.site-footer p {
  margin: 0;
  opacity: 0.85;
}

@media (max-width: 480px) {
  .form-section .radio-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .radio-pill {
    justify-content: center;
    min-height: 2.75rem;
  }

  .btn-primary {
    min-height: 2.875rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .checkbox-row .check {
    gap: 0.75rem;
  }

  .checkbox-row input {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.15rem;
  }
}

@media (max-width: 360px) {
  .wrap {
    width: calc(100% - clamp(0.75rem, 6vw, 1.25rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-row,
  .btn-primary,
  .radio-pill {
    transition: none;
  }

  .hero .hero-animate {
    animation: none;
  }
}
