/* «Imagínate aquí» (public/js/imagine-here.js): the launcher under the photos and its panel.
   Colours from the organization's brand variables (public/js/brand.js); neutral defaults in variables.css. */

.ih-slot { margin: 16px 0 8px; }
.ih-slot:empty { display: none; }

.ih-launch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ih-open { display: inline-flex; align-items: center; gap: 8px; }
.ih-hint { flex-basis: 100%; margin: 0; font-size: var(--font-size-sm, 0.875rem); color: var(--color-ink-muted, #5b6470); text-wrap: pretty; }

.ih-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--brand-primary, #1F3A5F);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}
.ih-ai-badge:hover, .ih-ai-badge:focus-visible { text-decoration: underline; }

.ih-dialog {
  /* Centred in the viewport, both ways: layout.css resets every margin to 0, which would pin a
     modal dialog to the top-left, so the centring is explicit. */
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  margin: 0;
  transform: translate(-50%, -50%);
  width: min(740px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: 90dvh;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--color-paper, #fff);
  color: var(--color-ink, #1b1f24);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
/* The header stays; the body scrolls inside the dialog when it is taller than the screen. */
.ih-dialog[open] { display: flex; flex-direction: column; }
.ih-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.ih-dialog::backdrop { background: rgba(10, 14, 20, 0.6); }

.ih-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--color-paper, #fff);
  border-bottom: 1px solid var(--color-line, #e3e6ea);
}
.ih-title { margin: 0; font-size: var(--font-size-xl, 1.25rem); text-wrap: balance; }
.ih-close {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.ih-close:hover, .ih-close:focus-visible { background: var(--gray-100, #f1f3f5); }

.ih-body, .ih-result { padding: 16px; }
.ih-step { margin: 18px 0 8px; font-size: var(--font-size-base, 1rem); text-wrap: balance; }
.ih-step:first-child { margin-top: 0; }

.ih-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.ih-actions .btn { display: inline-flex; align-items: center; gap: 6px; }

.ih-camera video, .ih-preview img {
  display: block;
  width: 100%;
  max-width: 300px;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--gray-900, #111);
  margin-bottom: 8px;
}

/* One scrollable strip of small thumbnails (a listing can have dozens of photos): every photo stays
   selectable, and the steps after it stay in view. */
.ih-settings { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.ih-setting { flex: 0 0 108px; scroll-snap-align: start; }
.ih-poses { display: flex; flex-wrap: wrap; gap: 8px; }

.ih-choice { position: relative; cursor: pointer; }
.ih-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ih-setting img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 3px solid transparent;
}
.ih-setting input:checked + img { border-color: var(--brand-cta, #2E8540); }
.ih-setting input:focus-visible + img { outline: 2px solid var(--brand-primary, #1F3A5F); outline-offset: 2px; }
.ih-pose span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--color-line-strong, #c9ced4);
  border-radius: 999px;
  font-size: var(--font-size-sm, 0.875rem);
}
.ih-pose input:checked + span { border-color: var(--brand-cta, #2E8540); background: var(--brand-cta, #2E8540); color: var(--brand-on-cta, #fff); }
.ih-pose input:focus-visible + span { outline: 2px solid var(--brand-primary, #1F3A5F); outline-offset: 2px; }

.ih-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 20px 0 12px;
  font-size: var(--font-size-sm, 0.875rem);
  line-height: 1.5;
}
.ih-consent input { margin-top: 3px; flex: none; width: 18px; height: 18px; }
.ih-consent a { color: var(--brand-primary, #1F3A5F); }

.ih-error { margin: 8px 0; color: var(--error, #b42318); font-size: var(--font-size-sm, 0.875rem); }
.ih-gate { margin: 8px 0 0; min-height: 1.4em; font-size: var(--font-size-sm, 0.875rem); color: var(--color-ink-muted, #5b6470); text-align: center; }
.ih-gate:empty { display: none; }

/* «Crear mi imagen» until there is a photo and the consent: plainly unavailable, in both flavors.
   Flat grey with dark grey text (about 6:1), no hover lift, no pointer. */
.ih-dialog .ih-generate:disabled,
.ih-dialog .ih-generate[aria-disabled="true"],
.ih-dialog .ih-generate:disabled:hover,
.ih-dialog .ih-generate[aria-disabled="true"]:hover {
  background: var(--gray-200, #e5e7eb);
  border-color: var(--gray-300, #d1d5db);
  color: var(--gray-700, #374151);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}
[data-flavor="elegant"] .ih-dialog .ih-generate:disabled,
[data-flavor="elegant"] .ih-dialog .ih-generate[aria-disabled="true"],
[data-flavor="elegant"] .ih-dialog .ih-generate:disabled:hover,
[data-flavor="elegant"] .ih-dialog .ih-generate[aria-disabled="true"]:hover {
  background: var(--gray-100, #f1ede8);
  border-color: var(--gray-300, #d6cfc6);
  color: var(--gray-700, #4a4540);
}

/* The cover while the image is made: over the whole dialog, blocks every control under it. */
.ih-busy {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.93);
  cursor: progress;
}
.ih-busy-icon { display: inline-flex; color: var(--brand-primary, #1F3A5F); animation: ih-spin 1.1s linear infinite; }
.ih-busy-text { margin: 0; max-width: 28ch; font-weight: 600; text-wrap: balance; }
[data-flavor="elegant"] .ih-busy-text { font-family: var(--font-heading, inherit); font-weight: 500; }
@keyframes ih-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ih-busy-icon { animation: none; }
}
.ih-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.ih-result figure { margin: 0; }
.ih-result img { display: block; width: 100%; height: auto; border-radius: 8px; }
.ih-result figcaption { margin-top: 6px; font-size: var(--font-size-sm, 0.875rem); color: var(--color-ink-muted, #5b6470); }

.ih-dialog [hidden], .ih-slot[hidden] { display: none !important; }

@media (max-width: 600px) {
  .ih-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); max-height: 94dvh; }
}
@media (max-width: 480px) {
  .ih-setting { flex-basis: 92px; }
}
