/* MASSIF - configurateur de cartes en relief imprimees en 3D */

:root {
  /* Ecart tonal large : le fond descend presque au noir, le texte monte
     presque au blanc, l'accent est franc. C'est ce qui evite le rendu fade. */
  --ink: #0b1013;
  --panel: #161e22;
  --panel-2: #242f35;
  --line: #3a474e;
  --line-soft: #232e33;
  --cream: #f8f4ec;
  --muted: #b9c5c9;
  --track: #2c383e;
  --accent: #ff8534;
  --accent-deep: #d95f14;
  --accent-soft: rgba(255, 133, 52, 0.16);
  --accent-glow: rgba(255, 133, 52, 0.28);
  --radius: 10px;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  height: 60px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
  position: sticky;
  top: 0;
  z-index: 30;
}

.logo {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0.16em;
  text-decoration: none;
  white-space: nowrap;
}
.logo span { color: var(--accent); }

.topbar .spacer { flex: 1; }

.tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(380px, 1.15fr);
  gap: 1px;
  background: var(--line);
  height: calc(100vh - 60px);
}

.pane {
  background: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--panel);
  flex-shrink: 0;
}

/* La carte garde une hauteur utilisable ; ce sont les reglages qui defilent. */
.pane-body { flex: 1 1 auto; min-height: 260px; position: relative; }

.controls {
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 14px 16px 18px;
  overflow-y: auto;
  max-height: 46vh;
  flex: 0 1 auto;
  min-height: 0;
}

/* ---------------------------------------------------------------- carte */

#map { position: absolute; inset: 0; background: #0b1013; }

.leaflet-container { background: #0b1013; font-family: var(--sans); }
.leaflet-control-attribution {
  background: rgba(7, 9, 10, 0.88) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a {
  background: var(--panel) !important;
  color: var(--cream) !important;
  border-color: var(--line) !important;
}
.leaflet-bar a:hover { background: var(--panel-2) !important; }

/* Voile sombre autour de la zone retenue, avec grille des tiers */
/* overflow:hidden indispensable : le voile du cadre est un box-shadow de
   9999px. Sans decoupe il deborde de la carte et assombrit tout le panneau
   de reglages en dessous. */
.crop-veil {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 400;
}
.crop-hole {
  position: absolute;
  border: 2px solid var(--accent);
  box-shadow:
    0 0 0 9999px rgba(3, 5, 6, 0.74),
    0 0 24px 2px var(--accent-glow),
    inset 0 0 0 1px rgba(0, 0, 0, 0.5);
  border-radius: 2px;
}
.crop-hole::before,
.crop-hole::after { content: ''; position: absolute; }
.crop-hole::before {
  left: 33.33%; right: 33.33%; top: 0; bottom: 0;
  border-left: 1px solid rgba(255, 133, 52, 0.4);
  border-right: 1px solid rgba(255, 133, 52, 0.4);
}
.crop-hole::after {
  top: 33.33%; bottom: 33.33%; left: 0; right: 0;
  border-top: 1px solid rgba(255, 133, 52, 0.4);
  border-bottom: 1px solid rgba(255, 133, 52, 0.4);
}

.search { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 500; max-width: 380px; }
.search input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(10, 14, 16, 0.94);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 14px;
}
.search input:focus { outline: none; border-color: var(--accent); }
.search-results {
  margin-top: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: none;
}
.search-results.on { display: block; }
.search-results button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  line-height: 1.35;
}
.search-results button:last-child { border-bottom: 0; }
.search-results button:hover { background: var(--panel-2); }

/* ------------------------------------------------------------- controles */

.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }

.field > label,
.field > .lbl {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #cdd8db;
  margin-bottom: 8px;
}
.field > label b,
.field > .lbl b {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
}

.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: #dae3e6;
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  transition: 0.14s;
}
.seg button:hover { color: var(--cream); border-color: var(--accent); background: #2e3a41; }
.seg button[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a0d03;
  font-weight: 600;
}

/* La portion parcourue est peinte en accent : on lit la valeur d'un
   coup d'oeil, et le reglage cesse d'etre un trait gris perdu. */
input[type='range'] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent) var(--fill, 0%),
    var(--track) var(--fill, 0%),
    var(--track) 100%
  );
  outline: none;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--cream); cursor: pointer;
  border: 4px solid var(--accent);
  box-shadow: 0 0 12px -2px var(--accent-glow);
}
input[type='range']::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--cream); cursor: pointer;
  border: 4px solid var(--accent);
  box-shadow: 0 0 12px -2px var(--accent-glow);
}

.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #1a0d03;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: 0.15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 0 22px -4px var(--accent-glow); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { background: none; color: var(--cream); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover:not(:disabled) { border-color: var(--accent); filter: none; }

/* -------------------------------------------------------------- apercu 3D */

#view {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 42%, #1a2329 0%, #0a0e10 62%, #06080a 100%);
}
#view canvas { display: block; width: 100%; height: 100%; }

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 30px;
  color: var(--muted);
  pointer-events: none;
}
.placeholder p { max-width: 260px; font-size: 13px; line-height: 1.6; margin: 0; }

.progress {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(14, 18, 20, 0.9);
  z-index: 10;
}
.progress.on { display: flex; }
.progress-bar { width: 190px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 0.25s; }
.progress span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.readout { border-top: 1px solid var(--line); background: var(--panel); padding: 14px 16px; flex-shrink: 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.stat small {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #77848a;
  margin-bottom: 4px;
}
.stat b { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--cream); }

.checkout { display: flex; align-items: center; gap: 12px; }
.price { flex-shrink: 0; line-height: 1.15; }
.price b { font-family: var(--mono); font-size: 27px; font-weight: 500; color: var(--accent); letter-spacing: -0.01em; }
.price small { display: block; font-size: 10px; color: var(--muted); letter-spacing: 0.06em; }
.checkout .btn { width: auto; flex: 1; }

.notice { margin-top: 10px; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.notice.warn { color: var(--accent); }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; height: auto; }
  /* En colonne, flex-basis pilote la hauteur : un height simple serait ignore. */
  .pane-body { flex: 0 0 58vh; }
  .controls { max-height: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------------------------------------------------- couleurs */

.fam {
  margin: 10px 0 5px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7d8a90;
}
.fam:first-of-type { margin-top: 4px; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 2px solid var(--line);
  background: var(--sw);
  cursor: pointer;
  padding: 0;
  transition: 0.14s;
}
.swatches button:hover { border-color: var(--muted); transform: translateY(-1px); }
.swatches button[aria-pressed='true'] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--accent), 0 0 16px -2px var(--accent-glow);
}

/* Une seule action possible : le bouton occupe toute la largeur restante. */
.checkout .btn { width: auto; flex: 1; }

.field > .lbl { display: flex; justify-content: space-between; align-items: baseline; }

/* Chaque famille se lit a la pastille : le metal a un reflet, le degrade
   part en biais, le phosphorescent rayonne. */
.swatches button.sw-metal {
  background:
    linear-gradient(135deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,0) 42%,
      rgba(0,0,0,.35) 58%, rgba(255,255,255,.25) 100%),
    var(--sw);
}
.swatches button.sw-phospho {
  box-shadow: 0 0 14px 1px var(--sw), inset 0 0 10px rgba(255,255,255,.35);
}
.swatches button.sw-phospho[aria-pressed='true'] {
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--accent), 0 0 20px 2px var(--sw);
}

/* Texte statique sous le configurateur : il sert au visiteur qui hesite,
   et il donne a Google de quoi indexer la page qui convertit. */
.creer-texte {
  border-top: 1px solid var(--line);
  background: var(--ink);
  padding: 8px 0 0;
}
.creer-texte .wrap { max-width: 1080px; margin: 0 auto; padding: 56px 24px; }
.creer-texte h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 3vw, 34px);
  margin: 0 0 14px;
}
.creer-texte .sub { color: var(--muted); max-width: 62ch; line-height: 1.65; margin: 0 0 32px; }
.creer-texte .grid { display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); }
.creer-texte .card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}
.creer-texte .card h3 { font-size: 17px; font-weight: 600; margin: 0 0 9px; color: var(--cream); }
.creer-texte .card p { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 0; }
.creer-texte .notice a { color: var(--accent); }

@media (max-width: 860px) {
  .creer-texte .grid { grid-template-columns: 1fr; }
}

/* Pied de page : /creer ne charge pas site.css (dont les regles h1 casseraient
   le titre en pastille de la barre), on reprend donc juste ce qu'il faut. */
footer { color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
footer .wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

/* ---------------------------------------------------------------- modale */

.modale { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modale[hidden] { display: none; }
.modale-fond { position: absolute; inset: 0; background: rgba(3, 5, 6, 0.82); backdrop-filter: blur(4px); }
.modale-boite {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 40px 90px -30px #000;
}
.modale-boite h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  margin: 0 0 8px;
}
.modale-recap {
  margin: 0 0 22px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--cream);
}
.modale-x {
  position: absolute; top: 14px; right: 16px;
  width: 32px; height: 32px;
  border: 0; border-radius: 8px;
  background: none; color: var(--muted);
  font-size: 26px; line-height: 1; cursor: pointer;
}
.modale-x:hover { background: var(--panel-2); color: var(--cream); }
.modale-note { margin: 14px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.modale-note a { color: var(--accent); }
.modale .form { max-width: none; }


/* Formulaires. Ils vivent ici et pas dans site.css : la modale de commande
   est sur /creer, qui ne charge pas la feuille de la vitrine. */
/* ------------------------------------------------------------ formulaires */

.form { max-width: 620px; }
.form .champ { margin-bottom: 16px; }
.form label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #cdd8db;
  margin-bottom: 7px;
}
.form input[type='text'],
.form input[type='email'],
.form input[type='tel'],
.form textarea,
.form select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 15px;
}
.form textarea { min-height: 140px; resize: vertical; line-height: 1.55; }
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form .duo { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.form .piege { position: absolute; left: -9999px; }
.form button {
  padding: 14px 28px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #1a0d03;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.form button:disabled { opacity: 0.5; cursor: not-allowed; }
.form button:hover:not(:disabled) { filter: brightness(1.08); }

.retour {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  display: none;
}
.retour.on { display: block; }
.retour.ok { background: rgba(111, 185, 143, 0.12); border: 1px solid #4e8c68; color: #b7e6cb; }
.retour.ko { background: rgba(255, 107, 107, 0.1); border: 1px solid #a44; color: #ffb3b3; }

@media (max-width: 600px) { .form .duo { grid-template-columns: 1fr; } }

/* Mise en page du formulaire de commande : deux colonnes quand les champs
   sont courts, une seule quand ils ne le sont pas. */
.form .paire { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form .trio { display: grid; grid-template-columns: 0.8fr 1.4fr 1.1fr; gap: 0 14px; }
.form label em {
  font-style: normal;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #77848a;
  margin-left: 4px;
}
.form select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.form textarea { min-height: 92px; }

.avis-pays {
  margin: -4px 0 16px;
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  line-height: 1.5;
  color: var(--cream);
}
.avis-pays[hidden] { display: none; }

@media (max-width: 560px) {
  .form .paire, .form .trio { grid-template-columns: 1fr; }
}
