/*
 * ════════════════════════════════════════════════════════════
 *  Simulator for galleries — ART AU FÉMININ
 *  Loaded by: simulators/show.html.erb
 * ════════════════════════════════════════════════════════════
 */

/* The intro on the left, the steps on a card on the right; stacked on narrow screens */
.sim {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: var(--space-20);
  align-items: start;
  padding-top: 8rem;
}

.sim-intro {
  position: sticky;
  top: 8rem;
}

.sim-intro .kicker { margin-bottom: var(--space-8); }

.sim-h1 {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: var(--tracking-tight);
  color: var(--foreground);
  margin: 0 0 var(--space-8);
  text-wrap: balance;
}

.sim-h1 em { font-style: italic; color: var(--accent); }

.sim-sub {
  color: var(--muted-foreground);
  line-height: 1.8;
  max-width: 30rem;
  text-wrap: pretty;
}

/* A step that cannot load (network down) says so below the card */
.sim-offline { margin-top: var(--space-4); }

/* The card: one surface step above the page (design.md, tonal layering, no border) */
.sim-card {
  display: block;
  background: var(--muted);
  border-radius: var(--radius-lg);
  padding: var(--space-12);
}

/* Turbo scrolls each new step's first element to the top (autoscroll): keep the card's top
   edge clear of the fixed navigation bar */
.sim-card > :first-child { scroll-margin-top: calc(var(--space-12) + 5rem); }

/* ── Progress ────────────────────────────────────────── */

.sim-progress {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: 0 0 var(--space-10);
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.sim-progress li { position: relative; display: inline-flex; align-items: center; gap: var(--space-2); }

.sim-progress-num {
  display: inline-grid;
  place-items: center;
  inline-size: 1.5rem;
  block-size: 1.5rem;
  border-radius: var(--radius-pill);
  background: var(--secondary);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.sim-progress .is-done .sim-progress-num { background: var(--accent-tint); color: var(--accent); }

/* Only the current step's label shows; the others stay for screen readers */
.sim-progress li:not([aria-current]) .sim-progress-label {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.sim-progress [aria-current="step"] { color: var(--foreground); }
.sim-progress [aria-current="step"] .sim-progress-num { background: var(--foreground); color: var(--background); }

/* ── Shared ──────────────────────────────────────────── */

.sim-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: var(--tracking-tight);
  color: var(--foreground);
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}

/* Focused by the step change for screen readers, not by the keyboard: no ring */
.sim-title:focus { outline: none; }

.sim-subtitle {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--foreground);
  margin: 0 0 var(--space-3);
}

.sim-text {
  color: var(--muted-foreground);
  line-height: 1.7;
  max-width: 34rem;
  margin: 0 0 var(--space-6);
  text-wrap: pretty;
}

.sim-form .btn-lg { margin-top: var(--space-8); }

/* ── Step 1: where ───────────────────────────────────── */

.sim-locate-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
}

.sim-locate-form[hidden] { display: none; }

.sim-or {
  margin: var(--space-4) 0;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.sim-locate > .field-message { margin: 0 0 var(--space-4); }
.sim-locate > .field-message:empty { margin: 0; }

/* ── Step 2: the catchment area, then the sales ──────── */

.sim-figure {
  display: block;
  font-style: italic;
  color: var(--accent);
}

/* The catchment area on the map of France: the land a shade of ink, the départements the zone
   reaches and its circle in copper. Strokes stay a hairline whatever the map's size. */
.sim-map {
  --map-land: color-mix(in srgb, var(--foreground) 7%, transparent);
  --map-reached: color-mix(in srgb, var(--accent) 38%, transparent);
  --map-zone: color-mix(in srgb, var(--accent) 60%, transparent);
  margin: var(--space-8) 0 var(--space-6);
}

.sim-map svg {
  display: block;
  inline-size: 100%;
  max-inline-size: 26rem;
  block-size: auto;
  overflow: visible;   /* a zone on the coast or the border spills past the map's edge */
}

.sim-map-departments path {
  fill: var(--map-land);
  stroke: var(--muted);
  stroke-width: 0.75px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.sim-map-departments .is-reached { fill: var(--map-reached); }

.sim-map-zone {
  fill: var(--map-zone);
  stroke: var(--accent);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
}

.sim-map-gallery { fill: var(--foreground); }

.sim-map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--muted-foreground);
}

.sim-map-key { display: inline-flex; align-items: center; gap: var(--space-2); }

.sim-map-key::before {
  content: "";
  inline-size: 0.75rem;
  block-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.sim-map-key-zone::before { border-radius: var(--radius-pill); background: var(--map-zone); box-shadow: inset 0 0 0 1.5px var(--accent); }
.sim-map-key-reached::before { background: var(--map-reached); }
.sim-map-source { margin-inline-start: auto; }

.sim-back { margin-bottom: var(--space-12); }

/* The turnover brackets: one choice per row, the whole row clickable, the chosen one ringed */
.sim-brackets {
  display: grid;
  gap: var(--space-2);
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.sim-brackets legend { padding: 0; margin-bottom: var(--space-3); }
.sim-brackets .sim-text { margin-bottom: var(--space-4); }

.sim-bracket {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--card);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--foreground);
  cursor: pointer;
}

.sim-bracket:hover { background: var(--secondary); }
.sim-bracket:has(:checked) { box-shadow: inset 0 0 0 1.5px var(--foreground); }
.sim-bracket:has(:focus-visible) { outline: var(--focus-ring); outline-offset: 2px; }

.sim-bracket input {
  inline-size: 1.1rem;
  block-size: 1.1rem;
  margin: 0;
  accent-color: var(--foreground);
}

.sim-bracket input:focus-visible { outline: none; }

.sim-brackets + .field-message { margin-top: var(--space-3); }

/* ── Step 3: the result ──────────────────────────────── */

/* "19 000 à 48 000 €": may break around "à", never inside an amount (non-breaking spaces) */
.sim-amount {
  display: block;
  margin-block: var(--space-3);
  font-size: var(--text-3xl);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.sim-lead {
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--muted-foreground);
  margin: 0;
  text-wrap: pretty;
}

.sim-lead strong { color: var(--foreground); font-weight: 500; white-space: nowrap; }

/* The call to action: a card on the card, one step lighter */
.sim-booking {
  margin-top: var(--space-10);
  padding: var(--space-8);
  border-radius: var(--radius-md);
  background: var(--card);
}

.sim-booking .btn-row { margin-top: var(--space-6); }
.sim-booking-hint { margin: var(--space-4) 0 0; }

.sim-method { margin-top: var(--space-12); }

.sim-method-steps {
  display: grid;
  gap: var(--space-3);
  margin: 0 0 var(--space-6);
  padding-inline-start: var(--space-5);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--muted-foreground);
}

.sim-method-steps strong { color: var(--foreground); font-weight: 500; }
.sim-method-steps a { color: var(--accent); }

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 900px) {
  .sim { grid-template-columns: minmax(0, 1fr); gap: var(--space-12); padding-top: 6rem; }
  .sim-intro { position: static; }
  .sim-card { padding: var(--space-8) var(--space-6); }
}

@media (max-width: 480px) {
  .sim { padding-top: 4rem; }
  .sim-progress { gap: var(--space-2) var(--space-3); }
  .sim-card { padding: var(--space-6) var(--space-5); }
  .sim-booking { padding: var(--space-6) var(--space-5); }
}
