/* Éditeur / configurateur — habillage clair premium.
   S'appuie sur site.css (chargé avant) pour les tokens et le chrome du site. */

.tool-hero {
  text-align: center;
  padding: 44px 0 34px;
}

.tool-hero h1 {
  font-size: clamp(28px, 3.6vw, 42px);
  max-width: 26ch;
  margin: 0 auto 12px;
}

.tool-hero .sub {
  margin: 0 auto;
}

.tool-shell {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: var(--cream);
}

.tool-grid {
  display: flex;
  min-height: 600px;
  height: 76vh;
  max-width: 1480px;
  margin: 0 auto;
}

#panel {
  width: 352px;
  min-width: 352px;
  overflow-y: auto;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--cream);
  border-right: 1px solid var(--hairline);
}

#viewport {
  flex: 1;
  position: relative;
  min-width: 0;
}

#viewport canvas {
  display: block;
}

/* ---------- Dépôt de fichier ---------- */
.drop {
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  line-height: 1.55;
  background: var(--paper);
}

.drop:hover,
.drop.over {
  border-color: var(--accent);
  background: #edf1ea;
}

.drop strong {
  font-family: var(--serif);
  font-size: 17px;
}

.drop .hint {
  margin-top: 8px;
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

/* ---------- Boutons de l'app ---------- */
#panel button {
  font: inherit;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
}

#panel button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(20, 26, 22, 0.3) !important;
}

.ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.stats {
  font-size: 13px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 11px 13px;
  line-height: 1.5;
}

.hidden {
  display: none;
}

/* ---------- Réglages ---------- */
.controls {
  display: flex;
  flex-direction: column;
  gap: 13px;
  border-top: 1px solid var(--hairline);
  padding-top: 16px;
}

.controls label {
  display: block;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-weight: 500;
}

.controls output {
  float: right;
  color: var(--ink);
  font-weight: 600;
}

.controls input[type='range'] {
  width: 100%;
  margin-top: 7px;
  accent-color: var(--accent);
}

.controls input[type='text'] {
  width: 100%;
  margin-top: 7px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}

.color-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.controls input[type='color'] {
  display: block;
  width: 100%;
  height: 34px;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 2px 3px;
  cursor: pointer;
}

.controls select {
  width: 100%;
  margin-top: 7px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  font: inherit;
  font-size: 14px;
}

/* ---------- Exports & commande ---------- */
.exports {
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-top: 1px solid var(--hairline);
  padding-top: 16px;
}

.order-cta {
  display: block;
  text-align: center;
  background: var(--accent-deep);
  color: var(--cream);
  text-decoration: none;
  border-radius: 12px;
  padding: 13px 14px;
  font-weight: 600;
  font-size: 14.5px;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(20, 26, 22, 0.12);
}

.order-cta:hover {
  background: var(--accent);
  color: var(--cream);
  box-shadow: 0 10px 24px -12px rgba(28, 53, 39, 0.5);
}

#exp1 {
  background: var(--ink);
  color: var(--cream);
}

#exp1:hover:not(:disabled) {
  background: #253029;
}

#exp2 {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(20, 26, 22, 0.3);
}

#exp2:hover:not(:disabled) {
  background: var(--paper-2);
}

/* ---------- Statut ---------- */
.status {
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
  line-height: 1.5;
}

.status.error {
  color: var(--red);
}

.dims {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 500;
}

/* ---------- Portail e-mail (téléchargement) ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 26, 22, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px;
}

.gate.hidden {
  display: none;
}

.gate-card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px;
  max-width: 460px;
  width: 100%;
  position: relative;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.5);
}

.gate-card h2 {
  margin-bottom: 8px;
}

.gate-card > p {
  color: var(--ink-2);
  font-size: 14.5px;
}

.gate-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
}

.gate-close:hover {
  color: var(--ink);
}

#gate-form {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

#gate-form input[type='email'] {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font: inherit;
  font-size: 15px;
  background: var(--paper);
  color: var(--ink);
}

#gate-form input[type='email']:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 87, 65, 0.12);
}

.gate-consent {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  cursor: pointer;
}

.gate-consent input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.gate-btn {
  background: var(--accent-deep);
  color: var(--cream);
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.gate-btn:hover {
  background: var(--accent);
}

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .tool-grid {
    flex-direction: column;
    height: auto;
  }

  #viewport {
    height: 48vh;
    min-height: 380px;
    order: 1;
    border-bottom: 1px solid var(--hairline);
  }

  #panel {
    width: 100%;
    min-width: 0;
    order: 2;
    border-right: 0;
  }
}
