/* ==========================================================================
   Swiss Square : cartes en relief imprimées en 3D
   Palette sombre, accent rouge suisse. CSS natif, aucun build.
   ========================================================================== */

:root {
  --ink: #0a0a0b;
  --ink-2: #121215;
  --ink-3: #18181c;
  --ink-4: #1f1f25;
  --line: #2a2a31;
  --line-soft: #202026;
  --text: #f4f4f2;
  --muted: #9a9aa3;
  --muted-2: #6f6f78;
  --red: #e1251b;
  --red-dark: #b81c14;
  --radius: 4px;
  --maxw: 1280px;
  --header-h: 68px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

/* ---------- Header ---------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgb(10 10 11 / 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 16px;
  margin-right: auto;
  white-space: nowrap;
}

.brand-mark {
  width: 24px;
  height: 24px;
  flex: none;
  display: block;
}

.nav {
  display: flex;
  gap: 24px;
  font-size: 14px;
  color: var(--muted);
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--text);
}

.cart-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}

.cart-link:hover {
  border-color: #40404a;
  background: var(--ink-3);
}

.cart-count {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.cart-count[data-empty="true"] {
  background: var(--ink-4);
  color: var(--muted-2);
}

/* ---------- Sélecteur de langue --------------------------------------- */

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}

.lang-switch button {
  background: none;
  border: 0;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.lang-switch button:hover {
  color: var(--text);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--ink-4);
  color: var(--text);
}

/* ---------- Pastille « Fait en Suisse » -------------------------------- */

.swiss-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.swiss-cross {
  width: 15px;
  height: 15px;
  border-radius: 2px;
  background: var(--red);
  position: relative;
  flex: none;
}

.swiss-cross::before,
.swiss-cross::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 0.5px;
}

.swiss-cross::before {
  inset: 6.5px 3px;
}

.swiss-cross::after {
  inset: 3px 6.5px;
}

/* ---------- Boutons --------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.08s;
  background: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--red);
  color: #fff;
}

.btn-primary:hover {
  background: var(--red-dark);
}

.btn-ghost {
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: #45454f;
  background: var(--ink-3);
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  padding: 9px 15px;
  font-size: 13px;
}

/* ---------- Hero ------------------------------------------------------ */

.hero {
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
  padding-block: 84px 92px;
}

.hero h1 {
  font-size: clamp(34px, 4.6vw, 58px);
  margin-bottom: 20px;
}

.hero h1 em {
  font-style: normal;
  color: var(--red);
}

.hero p.lead {
  font-size: 17px;
  color: var(--muted);
  max-width: 46ch;
  margin: 0 0 30px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 34px;
  font-size: 13px;
  color: var(--muted-2);
}

.hero-facts span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.hero-facts span::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--red);
}

.hero-visual {
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  padding: 26px;
}

/* ---------- Sections -------------------------------------------------- */

.section {
  padding-block: 72px;
  border-bottom: 1px solid var(--line-soft);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 34px;
}

.section-head h2 {
  font-size: clamp(24px, 2.6vw, 32px);
  margin-top: 8px;
}

.section-head p {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 54ch;
}

/* ---------- Filtres --------------------------------------------------- */

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  background: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: 0.15s;
}

.pill:hover {
  color: var(--text);
  border-color: #40404a;
}

.pill[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--ink);
}

/* ---------- Grille produits ------------------------------------------ */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 30px 24px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-media {
  position: relative;
  aspect-ratio: 1;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  place-items: center;
  padding: 20px;
  transition: border-color 0.18s;
}

.card:hover .card-media {
  border-color: #3b3b45;
}

.card-media .plate-mount {
  width: 100%;
}

.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgb(10 10 11 / 0.78);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.card-sub {
  font-size: 12.5px;
  color: var(--muted-2);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.price {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- La « plaque » : simulation du tirage 3D ------------------- */

.plate-mount {
  position: relative;
  display: block;
  padding: 0;
  border-radius: 3px;
}

/* Socle bois optionnel */
.plate-mount[data-mount="true"] {
  padding: 6% 6% 10%;
  background: linear-gradient(158deg, #c89155 0%, #a8733f 45%, #8d5f33 100%);
  box-shadow: 0 22px 46px -22px rgb(0 0 0 / 0.95), inset 0 1px 0 rgb(255 255 255 / 0.18);
}

.plate-mount[data-mount="true"]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: repeating-linear-gradient(
    92deg,
    rgb(0 0 0 / 0.08) 0 2px,
    rgb(255 255 255 / 0.06) 2px 5px,
    rgb(0 0 0 / 0.04) 5px 10px
  );
  pointer-events: none;
}

.plate {
  position: relative;
  display: block;
  border-radius: 2px;
  overflow: hidden;
  background: #d9d9d7;
  box-shadow: 0 18px 40px -22px rgb(0 0 0 / 0.9);
  container-type: inline-size;
}

/* Fond transparent : là où swisstopo n'a pas de données, on voit la plaque. */
.plate-relief {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

/* Matières : filtres qui imitent le rendu du PLA / de la résine.
   Le contraste est piloté par l'exagération choisie dans le configurateur. */
.plate[data-material="gris"] .plate-relief {
  filter: grayscale(1) brightness(0.95) contrast(var(--relief-contrast, 1.2));
}

.plate[data-material="noir"] {
  background: #141416;
}

.plate[data-material="noir"] .plate-relief {
  filter: grayscale(1) invert(1) brightness(0.8) contrast(var(--relief-contrast-dark, 1.45));
}

/* Trace GPS gravée : sombre sur le gris, claire sur le noir. */
.plate-track {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.plate-track polyline {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.plate-track polyline.halo {
  stroke-width: 4.5;
  opacity: 0.75;
}

.plate[data-material="gris"] .plate-track polyline {
  stroke: #1d1d1a;
}

.plate[data-material="gris"] .plate-track polyline.halo {
  stroke: #fbfbf9;
}

.plate[data-material="noir"] .plate-track polyline {
  stroke: #fbfbf9;
}

.plate[data-material="noir"] .plate-track polyline.halo {
  stroke: #090909;
}

.plate-word {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 7% 8% 5.5%;
  font-size: 5.6cqw;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plate[data-material="gris"] .plate-word {
  color: #3c3c3a;
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.55);
  background: linear-gradient(to top, rgb(217 217 215 / 0.96), rgb(217 217 215 / 0));
}

.plate[data-material="noir"] .plate-word {
  color: #dddddb;
  text-shadow: 0 1px 0 rgb(0 0 0 / 0.65);
  background: linear-gradient(to top, rgb(20 20 22 / 0.96), rgb(20 20 22 / 0));
}

/* ---------- Section mono couleur --------------------------------------- */

.mono {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
  gap: 56px;
  align-items: center;
}

.mono h2 {
  font-size: clamp(24px, 2.6vw, 32px);
  margin: 8px 0 18px;
}

.mono p:not(.eyebrow) {
  margin: 0 0 14px;
  color: var(--muted);
  max-width: 58ch;
}

.mono p:last-child {
  margin-bottom: 0;
}

.mono-plates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.mono-plates figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mono-plates figcaption {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
  text-align: center;
}

/* ---------- Étapes ---------------------------------------------------- */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
}

.step {
  background: var(--ink);
  padding: 26px 24px 30px;
}

.step-n {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.1em;
  margin-bottom: 14px;
}

.step h3 {
  font-size: 16px;
  margin-bottom: 7px;
}

.step p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Configurateur --------------------------------------------- */

.config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  gap: 28px;
  align-items: start;
  padding-block: 30px 72px;
}

.map-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--ink-2);
}

#map {
  height: clamp(440px, 64vh, 680px);
  width: 100%;
  background: #0f0f12;
}

.map-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 420;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  pointer-events: none;
}

.map-toolbar > * {
  pointer-events: auto;
}

.search-box {
  position: relative;
  flex: 1 1 230px;
  max-width: 320px;
}

.search-box input {
  width: 100%;
  background: rgb(10 10 11 / 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 13px;
  font-size: 13.5px;
  backdrop-filter: blur(8px);
}

.search-box input::placeholder {
  color: var(--muted-2);
}

.search-box input:focus {
  outline: none;
  border-color: #4a4a56;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 20px 40px -18px rgb(0 0 0 / 0.9);
}

.search-results:empty {
  display: none;
}

.search-results button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 13px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--text);
}

.search-results button:last-child {
  border-bottom: 0;
}

.search-results button:hover {
  background: var(--ink-4);
}

.layer-switch {
  display: flex;
  background: rgb(10 10 11 / 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.layer-switch button {
  background: none;
  border: 0;
  padding: 10px 13px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  cursor: pointer;
}

.layer-switch button[aria-pressed="true"] {
  background: var(--ink-4);
  color: var(--text);
}

/* Cadre de sélection, centré et fixe : on déplace la carte dessous */
.crop-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: var(--frame, 320px);
  height: var(--frame, 320px);
  z-index: 410;
  pointer-events: none;
  border: 2px solid var(--red);
  box-shadow: 0 0 0 9999px rgb(8 8 10 / 0.5);
}

.crop-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgb(225 37 27 / 0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgb(225 37 27 / 0.28) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
}

.crop-hint {
  position: absolute;
  /* Au-dessus du pavé de zoom, qui tient le coin bas gauche : à 12px elle le
     recouvrirait, le pavé étant deux fois plus large qu'un bouton simple. */
  bottom: 76px;
  left: 50%;
  translate: -50% 0;
  z-index: 420;
  background: rgb(10 10 11 / 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  max-width: calc(100% - 24px);
  backdrop-filter: blur(8px);
}

.crop-hint b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Panneau d'options */
.options {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ink-2);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: calc(var(--header-h) + 16px);
}

.preview {
  background: var(--ink-3);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 22px;
  display: grid;
  place-items: center;
}

.preview .plate-mount {
  width: min(100%, 236px);
}

.field > label,
.field-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
  margin-bottom: 10px;
}

.choices {
  display: grid;
  gap: 8px;
}

.choices[data-cols="3"] {
  grid-template-columns: repeat(3, 1fr);
}

.choices[data-cols="2"] {
  grid-template-columns: repeat(2, 1fr);
}

.choice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  cursor: pointer;
  transition: 0.15s;
  background: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.choice:hover {
  border-color: #45454f;
}

.choice[aria-pressed="true"] {
  border-color: var(--red);
  background: rgb(225 37 27 / 0.08);
}

.choice-main {
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.choice-sub {
  font-size: 11.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.swatch {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  border: 1px solid rgb(255 255 255 / 0.16);
  display: inline-block;
  margin-right: 8px;
}

/* Curseur d'exagération du relief */
.field-label b {
  float: right;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.range {
  width: 100%;
  margin: 2px 0 0;
  height: 22px;
  background: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: var(--line);
}

.range::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: var(--line);
}

.range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6.5px;
  border-radius: 999px;
  background: var(--red);
  border: 2px solid var(--ink-2);
  box-shadow: 0 0 0 1px var(--red);
}

.range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--red);
  border: 2px solid var(--ink-2);
  box-shadow: 0 0 0 1px var(--red);
}

.range:focus-visible {
  outline: none;
}

.range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 1px var(--red), 0 0 0 4px rgb(225 37 27 / 0.3);
}

/* Option annoncée mais pas encore ouverte */
.soon {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  font-size: 13.5px;
  color: var(--muted-2);
}

.soon-tag {
  flex: none;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Fichier .gpx chargé */
.gpx-file {
  border: 1px solid var(--line);
  border-left: 2px solid var(--red);
  border-radius: var(--radius);
  padding: 11px 13px;
  display: grid;
  gap: 3px;
}

.gpx-name {
  font-size: 13.5px;
  font-weight: 600;
  word-break: break-word;
}

.gpx-meta {
  font-size: 11.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.gpx-actions {
  display: flex;
  gap: 16px;
  margin-top: 6px;
}

.link-quiet {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-quiet:hover {
  color: var(--text);
}

.range-ends {
  display: flex;
  justify-content: space-between;
  margin: 2px 0 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.text-input {
  width: 100%;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 13px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.text-input:focus {
  outline: none;
  border-color: #4a4a56;
}

.help {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 7px;
}

.recap {
  border-top: 1px solid var(--line-soft);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recap-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  color: var(--muted);
}

.recap-row span:last-child {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.recap-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 19px;
  font-weight: 700;
}

.recap-total span:last-child {
  font-variant-numeric: tabular-nums;
}

/* ---------- Panier ---------------------------------------------------- */

.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
  padding-block: 30px 80px;
}

.cart-list {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.cart-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line-soft);
  align-items: start;
}

.cart-row:last-child {
  border-bottom: 0;
}

.cart-row h3 {
  font-size: 15px;
  margin-bottom: 5px;
}

.cart-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 7px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.cart-specs li {
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
}

.cart-geo {
  font-size: 11px;
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-top: 10px;
  word-break: break-word;
}

.cart-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.qty button {
  background: none;
  border: 0;
  width: 30px;
  height: 30px;
  cursor: pointer;
  color: var(--muted);
}

.qty button:hover {
  background: var(--ink-4);
  color: var(--text);
}

.qty span {
  min-width: 30px;
  text-align: center;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.link-danger {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12px;
  color: var(--muted-2);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-danger:hover {
  color: var(--red);
}

.summary {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ink-2);
  padding: 22px;
  position: sticky;
  top: calc(var(--header-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 64px 24px;
  text-align: center;
  color: var(--muted);
}

.empty h2 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text);
}

.notice {
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-left: 2px solid var(--red);
  border-radius: var(--radius);
  padding: 13px 15px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- Visionneuse 3D -------------------------------------------- */

.v3d {
  position: fixed;
  inset: 0;
  /* Au-dessus des contrôles Leaflet, qui montent à 1000. */
  z-index: 1200;
  background: rgb(6 6 8 / 0.82);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.v3d-panel {
  width: min(960px, 100%);
  height: min(720px, 100%);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  box-shadow: 0 40px 90px -30px rgb(0 0 0 / 0.95);
}

.v3d-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.v3d-head h2 {
  font-size: 16px;
}

.v3d-close {
  background: none;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}

.v3d-close:hover {
  color: var(--text);
}

.v3d-stage {
  position: relative;
  background: #101013;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
}

.v3d-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.v3d-stage canvas:active {
  cursor: grabbing;
}

.v3d-status {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.v3d-foot {
  padding: 16px 20px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v3d-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted-2);
  max-width: 80ch;
}

.v3d-actions .help {
  margin: 0;
}

/* ---------- Toast ----------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 900;
  background: var(--text);
  color: var(--ink);
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 20px 40px -16px rgb(0 0 0 / 0.8);
  opacity: 0;
  translate: -50% 12px;
  transition: opacity 0.22s, translate 0.22s;
  pointer-events: none;
}

.toast[data-show="true"] {
  opacity: 1;
  translate: -50% 0;
}

/* ---------- FAQ ------------------------------------------------------- */

.faq {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px 44px;
}

.faq h3 {
  font-size: 15px;
  margin-bottom: 7px;
}

.faq p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Footer ---------------------------------------------------- */

.site-footer {
  padding-block: 44px 56px;
  color: var(--muted-2);
  font-size: 13px;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.site-footer p {
  display: flex;
  align-items: center;
  gap: 8px 18px;
  flex-wrap: wrap;
  margin: 0;
}

.site-footer a:hover {
  color: var(--text);
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

/* ---------- Responsive ------------------------------------------------ */

@media (max-width: 1020px) {
  .config-layout,
  .cart-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .options,
  .summary {
    position: static;
  }
}

@media (max-width: 860px) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
    padding-block: 52px 60px;
  }

  .hero-visual {
    order: -1;
  }

  .nav {
    display: none;
  }

  .mono {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .mono-plates {
    max-width: 420px;
  }
}

@media (max-width: 640px) {
  /* Le bandeau d'infos passe pleine largeur, au-dessus du zoom Leaflet. */
  .crop-hint {
    left: 12px;
    right: 12px;
    bottom: 86px;
    translate: 0;
    max-width: none;
    white-space: normal;
    text-align: center;
    border-radius: 6px;
    font-size: 11.5px;
  }
}

@media (max-width: 560px) {
  .wrap {
    padding-inline: 16px;
  }

  /* L'en-tête doit tenir sur une ligne : marque, langues et panier. */
  .site-header .wrap {
    gap: 10px;
  }

  .brand {
    font-size: 14px;
    gap: 8px;
  }

  .lang-switch button {
    padding: 5px 6px;
    font-size: 10px;
  }

  .cart-link {
    padding: 6px 10px;
    font-size: 12px;
    gap: 6px;
  }

  .section {
    padding-block: 52px;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 24px 14px;
  }

  .cart-row {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .cart-side {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ---------- Visuels produit : rendus de la pièce ---------------------- */

/* Le conteneur accueille d'abord l'ombrage swisstopo, puis le rendu 3D. */
.shot-slot {
  display: block;
  width: 100%;
}

.shot {
  position: relative;
  display: block;
  line-height: 0;
}

.shot-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

/* La règle d'échelle se superpose au rendu : ses coordonnées viennent de la
   projection de l'arête avant, donc le SVG couvre exactement le canvas. */
.shot-scale {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: rgb(255 255 255 / 0.68);
  font-family: inherit;
  font-weight: 600;
  pointer-events: none;
}

/* Une fois le rendu en place, la tuile n'a plus besoin de sa marge : le
   cadrage de la caméra en ménage déjà une, et le fond du rendu reprend la
   couleur de la tuile. */
.card-media:has(.shot) {
  padding: 0;
}

.card-media:has(.shot) .shot-canvas {
  border-radius: 4px;
}

/* Explication affichée quand le zoom bute sur la limite de détail de la
   carte. Elle s'ajoute dans la pastille d'info plutôt qu'à côté : une
   deuxième étiquette flottante se marcherait dessus sur petit écran. */
.crop-cap {
  display: block;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
}

.crop-cap:empty {
  display: none;
}

/* La pastille tient sur une ligne tant qu'elle n'annonce que la zone et
   l'échelle ; la phrase d'explication, elle, a besoin de respirer. */
.crop-hint:has(.crop-cap:not(:empty)) {
  white-space: normal;
  text-align: center;
  border-radius: 10px;
  max-width: min(40ch, calc(100% - 24px));
}

@media (max-width: 640px) {
  .crop-hint:has(.crop-cap:not(:empty)) {
    max-width: none;
  }
}

/* Zone et échelle portées sur la pièce, sous le mot quand il y en a un. */
.plate-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 8% 4.5%;
  font-size: 3.1cqw;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0.82;
}

/* Quand le mot occupe déjà le bas, la ligne se glisse juste au-dessus. */
.plate-info[data-above="true"] {
  bottom: 7.5%;
}

.plate[data-material="gris"] .plate-info {
  color: #3a3a38;
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.4);
}

.plate[data-material="noir"] .plate-info {
  color: #c9c9cd;
  text-shadow: 0 1px 0 rgb(0 0 0 / 0.5);
}

/* Les deux chiffres qui définissent la pièce, en tête du pied de la
   visionneuse : ils priment sur la note technique qui suit. */
.v3d-zone {
  margin: 0 0 6px;
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Réglages dans la fenêtre 3D ------------------------------- */

/* La 3D garde la place : les réglages prennent une colonne à côté d'elle
   plutôt que de rogner la hauteur de la scène. */
.v3d-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  min-height: 0;
}

.v3d-side {
  border-left: 1px solid var(--line-soft);
  padding: 16px 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--ink);
}

.v3d-field .field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.v3d-field .field-label b {
  color: var(--text);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.v3d-side .choice {
  padding: 8px 9px;
}

.v3d-total {
  margin: auto 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  /* Les deux pistes sont bornées : en `auto`, la colonne d'options se range
     sur sa hauteur de contenu, qui dépasse la fenêtre, et la scène tombe à
     zéro. */
  .v3d-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 46%);
  }

  .v3d-side {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }

  .v3d-total {
    margin-top: 4px;
  }
}

/* ---------- Les deux pas de zoom -------------------------------------- */

/* Colonne de gauche le pas fin, colonne de droite le pas large : la largeur
   du geste se lit dans la position du bouton. */
.zoom-pad {
  display: grid;
  grid-template-columns: repeat(2, 30px);
  grid-auto-rows: 30px;
  gap: 2px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.5);
}

.zoom-btn {
  border: 1px solid var(--line);
  background: rgb(10 10 11 / 0.92);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: 0.15s;
}

.zoom-btn:hover:not(:disabled) {
  background: var(--ink-4);
  border-color: #3b3b45;
}

.zoom-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.v3d-stage {
  min-height: 0;
  min-width: 0;
}

/* ---------- Options qui se cochent ------------------------------------ */

/* Les gravures ne s'excluent pas : elles se cochent, et la case le dit. */
.ticks {
  display: grid;
  gap: 6px;
}

.tick {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: none;
  cursor: pointer;
  text-align: left;
  transition: 0.15s;
}

.tick:hover {
  border-color: #3b3b45;
}

.tick[aria-checked="true"] {
  border-color: var(--red);
  background: rgb(225 37 27 / 0.08);
}

.tick-box {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: none;
  border: 1px solid var(--line-2, #3b3b45);
  border-radius: 3px;
  position: relative;
}

.tick[aria-checked="true"] .tick-box {
  background: var(--red);
  border-color: var(--red);
}

/* La coche : deux traits, dessinés en bordure d'un rectangle tourné. */
.tick[aria-checked="true"] .tick-box::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  rotate: 45deg;
}

.tick-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.tick-label {
  font-size: 13px;
}

.tick-sub {
  font-size: 11px;
  color: var(--muted-2);
}

/* ---------- Exagération : la valeur exacte ---------------------------- */

.exag-exact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.exag-exact .text-input {
  width: 84px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.exag-exact button {
  margin-left: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* La marque de l'atelier sur la pièce : un poinçon, en bas à gauche. */
.plate-brand {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 0 7% 4.5% 0;
  font-size: 2.4cqw;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0.6;
}

.plate[data-material="gris"] .plate-brand {
  color: #3a3a38;
}

.plate[data-material="noir"] .plate-brand {
  color: #c9c9cd;
}

/* La saisie du mot n'apparaît qu'une fois sa case cochée. */
.word-box {
  margin-top: 8px;
}

/* ---------- Choix du caractère ---------------------------------------- */

/* L'échantillon montre la fonte elle-même : un nom de classe ne dit rien à
   qui ne connaît pas le vocabulaire typographique. */
.font-sample {
  font-size: 19px;
  line-height: 1.1;
}

.font-sample[data-font="lineale"] {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.04em;
}

.font-sample[data-font="romaine"] {
  font-family: Georgia, "Times New Roman", Times, serif;
}

.font-sample[data-font="fixe"] {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Courier New", monospace;
  font-size: 17px;
}

/* La gravure de l'aperçu plat suit la fonte choisie. */
.plate[data-font="romaine"] .plate-word,
.plate[data-font="romaine"] .plate-info,
.plate[data-font="romaine"] .plate-brand {
  font-family: Georgia, "Times New Roman", Times, serif;
  letter-spacing: 0.1em;
}

.plate[data-font="fixe"] .plate-word,
.plate[data-font="fixe"] .plate-info,
.plate[data-font="fixe"] .plate-brand {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Courier New", monospace;
  letter-spacing: 0.06em;
}

/* ---------- Bons cadeaux ---------------------------------------------- */

.gift-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

/* Pas de relief à montrer : un carton, dont la seule variable est le format
   qu'il donne droit à. */
.gift-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 8 / 5;
  padding: 18px 20px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: linear-gradient(152deg, #1b1b20 0%, #121215 58%, #0e0e11 100%);
  overflow: hidden;
}

/* Le carré de la marque, en filigrane. */
.gift-card::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -46px;
  width: 150px;
  height: 150px;
  border-radius: 16px;
  border: 2px solid rgb(225 37 27 / 0.22);
  rotate: -12deg;
}

.gift-mark {
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--red);
  position: relative;
  z-index: 1;
}

.gift-size {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

.gift-kind {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.cart-row .gift-card {
  aspect-ratio: auto;
  min-height: 130px;
  padding: 14px 16px;
}

@media (max-width: 860px) {
  .gift-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .gift-grid {
    grid-template-columns: 1fr;
  }
}
