/* Studio d’affiches — chrome SEO autour, outil sombre dans .dash. */

.affiche-wire {
  padding-bottom: 0;
}
.affiche-wire .seo-title { margin-bottom: 8px; }

.dash {
  --studio-bg: #0e0f12;
  --bg: #0e0f12;
  --panel: #14161c;
  --line: #26282d;
  --ink: #f1f2f4;
  --soft: #c2c6cd;
  --muted: #888d96;
  --purple: #6c2163;
  --sans: Inter, ui-sans-serif, system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --top: 0px;
  color-scheme: dark;
  color: var(--ink);
  background: var(--studio-bg);
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  min-height: 72vh;
  height: 72vh;
  width: 100%;
  margin: 0 0 36px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.dash a { color: var(--soft); }
.dash a:hover { color: var(--ink); }

.dash-controls {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 20px 48px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}
.dash-controls h1 {
  font-family: var(--serif);
  font-size: 1.55rem;
  line-height: 1.12;
  margin: 0 0 6px;
}
.dash-lead { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; }

fieldset {
  border: 0;
  margin: 0 0 20px;
  padding: 0;
}
legend {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.choices label[hidden] { display: none !important; }
.choices label {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--soft);
  font: 600 12.5px/1.2 var(--sans);
  padding: 8px 12px;
  border-radius: 999px;
}
.choices input { position: absolute; opacity: 0; width: 0; height: 0; }
.choices label:has(input:checked) {
  border-color: var(--purple);
  color: var(--ink);
  background: color-mix(in srgb, var(--purple) 28%, var(--bg));
}
.choices label:has(input:focus-visible) {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

select.greeting {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%23C2C6CD'><path d='M0 0l6 8 6-8z'/></svg>") no-repeat right 12px center;
  color: var(--ink);
  font: 600 14px/1.35 var(--sans);
  padding: 10px 32px 10px 12px;
  border-radius: 12px;
}
select.greeting:focus {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}
.field-hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.photo-grid label {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #111;
}
.photo-grid label:has(input:checked) {
  border-color: var(--purple);
  box-shadow: 0 0 0 1px var(--purple);
}
.photo-grid input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.photo-grid img, .photo-grid .solid {
  display: block;
  width: 100%;
  aspect-ratio: 11 / 17;
  object-fit: cover;
  pointer-events: none;
}
.solid--radar {
  position: relative;
  background:
    linear-gradient(var(--purple), var(--purple)) top / 100% 7px no-repeat,
    repeating-radial-gradient(circle at 50% 36%, transparent 0 10px, rgba(241, 242, 244, 0.1) 10px 11px),
    linear-gradient(rgba(241, 242, 244, 0.06), rgba(241, 242, 244, 0.06)) center 36% / 100% 1px no-repeat,
    linear-gradient(90deg, rgba(241, 242, 244, 0.06), rgba(241, 242, 244, 0.06)) 50% / 1px 100% no-repeat,
    #0e0f12;
  color: var(--soft);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}
.solid--radar img {
  position: absolute;
  top: 22%;
  left: 50%;
  width: 44%;
  height: auto;
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 10px;
}
.solid--radar span {
  position: absolute;
  right: 6px;
  bottom: 8px;
  left: 6px;
}
.photo-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: 700 12px/1.2 var(--sans);
  cursor: pointer;
}
.photo-more:hover {
  border-color: var(--purple);
  background: color-mix(in srgb, var(--purple) 18%, var(--bg));
}
.photo-more[hidden] { display: none !important; }
#photo-upload-box[hidden] { display: none !important; }
.photo-upload {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: 700 12px/1.2 var(--sans);
  cursor: pointer;
}
.photo-upload:hover {
  border-color: var(--purple);
  background: color-mix(in srgb, var(--purple) 18%, var(--bg));
}
.photo-upload input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}
.photo-meta { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.dash-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 22px;
}
.dash-actions--end {
  margin: 8px 0 16px;
}
.btn-row {
  display: flex;
  gap: 8px;
}
.btn {
  appearance: none;
  cursor: pointer;
  border: 1px solid var(--purple);
  background: var(--purple);
  color: #fff;
  font: 650 14px/1 var(--sans);
  padding: 12px 16px;
  border-radius: 999px;
  width: 100%;
  flex: 1;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--purple);
}
.btn:disabled { opacity: 0.45; cursor: wait; }
.status { margin: 0; font-size: 12.5px; color: var(--muted); }
.status strong { color: var(--ink); font-weight: 650; }

.dash-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 16px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--purple) 14%, transparent), transparent 55%),
    var(--bg);
}
.preview-stage {
  display: grid;
  place-items: center;
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
}
.preview-frame {
  max-width: 100%;
  max-height: calc(72vh - 24px);
  width: auto;
  height: auto;
  box-shadow: 0 28px 80px #000c, 0 0 0 1px #ffffff10;
  background: #111;
  position: relative;
}
.preview-frame.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #0e0f12aa;
  pointer-events: none;
}
.preview-frame canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}
.preview-frame { cursor: grab; }
.preview-frame:active { cursor: grabbing; }
.crop-tools {
  flex: 0 0 210px;
  width: 210px;
  align-self: center;
  display: grid;
  gap: 10px;
  align-content: center;
}
.crop-tools[hidden] { display: none !important; }
.crop-lead {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.crop-hint { margin: 0; font-size: 12px; color: var(--muted); }
.crop-tools label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--soft);
}
.crop-tools input[type="range"] { width: 100%; accent-color: var(--purple); }
.btn-quiet {
  appearance: none;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--soft);
  font: 600 12px/1 var(--sans);
  padding: 8px 10px;
  border-radius: 999px;
  justify-self: start;
}
.preview-hint { font-size: 12.5px; color: var(--muted); text-align: center; max-width: 28rem; margin: 0; }
.recipe {
  font-size: 12.5px;
  color: var(--soft);
  text-align: center;
  max-width: 28rem;
}

.dash-foot {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.dash-foot p { margin: 0 0 8px; }

@media (max-width: 900px) {
  .dash {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .dash-preview,
  .dash-preview.has-crop {
    order: -1;
    flex-direction: column;
    position: sticky;
    top: var(--top);
    z-index: 3;
    min-height: 48vh;
    height: 48vh;
    max-height: none;
    padding: 12px;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
  }
  .preview-stage {
    width: 100%;
    min-height: 0;
    height: 100%;
  }
  .preview-frame,
  .preview-frame canvas {
    max-height: calc(48vh - 24px);
  }
  .crop-tools {
    flex: none;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }
  .dash-controls {
    border-right: 0;
    overflow: visible;
    padding-bottom: 120px;
  }
}

/* iPad portrait (768–900) : l’affiche occupait ~42 vh, trop petite dans la scène. */
@media (min-width: 700px) and (max-width: 900px) {
  .dash-preview,
  .dash-preview.has-crop {
    min-height: 62vh;
    height: 62vh;
  }
  .preview-frame,
  .preview-frame canvas {
    max-height: calc(62vh - 24px);
  }
}

/* Barre Format locale : ne pas masquer les téléchargements. */
body:has(#local-lab-format-bar) .dash-controls {
  padding-bottom: 120px;
}
