.elgea-dialog {
  --elgea-navy: #071e2b;
  --elgea-cyan: #38bcd0;
  --elgea-yellow: #ffe168;
  --elgea-muted: #b9ccd5;
  --elgea-line: rgba(185, 204, 213, .19);
  color-scheme: dark;
  box-sizing: border-box;
  width: min(1100px, calc(100% - 40px));
  max-width: none;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  border: 1px solid rgba(56, 188, 208, .34);
  border-radius: 20px;
  color: #f5fafc;
  background: var(--elgea-navy);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .5);
  font: inherit;
  overflow: hidden;
}

.elgea-dialog::backdrop { background: rgba(2, 11, 17, .82); backdrop-filter: blur(5px); }
.elgea-dialog *, .elgea-dialog *::before, .elgea-dialog *::after { box-sizing: border-box; }
.elgea-dialog [hidden] { display: none !important; }
.elgea-dialog button { font: inherit; -webkit-tap-highlight-color: transparent; }
.elgea-dialog button:focus-visible, .elgea-dialog [tabindex]:focus-visible { outline: 3px solid var(--elgea-yellow); outline-offset: 3px; }
.elgea-dialog button:disabled { opacity: .45; cursor: default; }
.elgea-dialog button svg { flex: 0 0 22px; width: 22px; height: 22px; }
.elgea-dialog-shell { display: flex; flex-direction: column; max-height: calc(100vh - 42px); max-height: calc(100dvh - 42px); }
.elgea-dialog-header { display: flex; flex: 0 0 auto; align-items: flex-start; gap: 24px; padding: 27px 30px 23px; border-bottom: 1px solid var(--elgea-line); }
.elgea-dialog-heading { flex: 1; min-width: 0; }
.elgea-dialog-eyebrow { margin: 0 0 7px; color: var(--elgea-cyan); font-size: 11px; font-weight: 700; letter-spacing: .14em; line-height: 1.4; }
.elgea-dialog-title { margin: 0; color: #fff; font-size: clamp(22px, 3vw, 30px); font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.elgea-dialog-description { max-width: 800px; margin: 11px 0 0; color: var(--elgea-muted); font-size: 14px; line-height: 1.6; }
.elgea-icon-button { display: inline-flex; flex: 0 0 44px; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 1px solid rgba(255, 225, 104, .32); border-radius: 50%; background: #102d3d; color: var(--elgea-yellow); cursor: pointer; transition: color .16s ease, background-color .16s ease, border-color .16s ease; }
.elgea-icon-button:hover { background: var(--elgea-yellow); border-color: var(--elgea-yellow); color: var(--elgea-navy); }
.elgea-close { margin: 0 0 0 auto; }
.elgea-grid-pane { min-height: 0; padding: 18px 30px 30px; overflow: auto; overscroll-behavior: contain; scrollbar-color: #446474 #071e2b; }
.elgea-grid-intro { margin: 0 0 17px; color: var(--elgea-muted); font-size: 13px; line-height: 1.5; }
.elgea-gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.elgea-thumbnail { display: flex; flex-direction: column; align-items: stretch; min-width: 0; margin: 0; padding: 0 0 12px; border: 1px solid var(--elgea-line); border-radius: 11px; color: #f5fafc; background: #0e2a39; text-align: left; overflow: hidden; cursor: pointer; transition: border-color .16s ease, background-color .16s ease; }
.elgea-thumbnail:hover { border-color: var(--elgea-cyan); background: #143646; }
.elgea-thumbnail-image { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; margin: 0; border: 0; object-fit: cover; background: #14313f; }
.elgea-thumbnail-caption { display: block; margin: 11px 13px 0; font-size: 13px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.elgea-kind-note { display: block; margin-top: 5px; color: #8facba; font-size: 10px; font-weight: 400; line-height: 1.5; }
.elgea-thumbnail > .elgea-kind-note { margin-left: 13px; margin-right: 13px; }
.elgea-thumbnail-unavailable::before { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; padding: 16px; color: var(--elgea-muted); background: #14313f; content: 'Vista previa no disponible'; font-size: 12px; }
.elgea-viewer { display: flex; flex-direction: column; min-height: 0; padding: 15px 25px 15px; overflow: auto; overscroll-behavior: contain; }
.elgea-viewer-toolbar { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 0 5px 13px; }
.elgea-text-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; margin: 0; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--elgea-yellow); font-size: 13px !important; line-height: 1.3; cursor: pointer; }
.elgea-text-button:hover:not(:disabled) { background: #153747; border-color: var(--elgea-line); }
.elgea-counter { color: var(--elgea-muted); font-size: 13px; line-height: 1.4; font-variant-numeric: tabular-nums; white-space: nowrap; }
.elgea-viewer-figure { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin: 0; }
.elgea-viewer-stage { display: flex; align-items: center; gap: 12px; min-height: 0; }
.elgea-viewer-viewport { flex: 1 1 auto; min-width: 0; height: min(56vh, 620px); height: min(56dvh, 620px); min-height: 160px; border: 1px solid var(--elgea-line); border-radius: 10px; background: #03121c; overflow: auto; overscroll-behavior: contain; scrollbar-color: #446474 #03121c; touch-action: pan-x pan-y pinch-zoom; }
.elgea-viewer-canvas { display: grid; place-items: center; width: 100%; min-height: 100%; }
.elgea-full-image { display: block; width: auto; height: auto; max-width: 100%; max-height: min(56vh - 2px, 618px); max-height: min(56dvh - 2px, 618px); margin: 0; border: 0; object-fit: contain; }
.elgea-is-zoomed .elgea-viewer-canvas { width: max-content; min-width: 100%; }
.elgea-is-zoomed .elgea-full-image { max-width: none; max-height: none; }
.elgea-image-error { max-width: 360px; padding: 24px; color: var(--elgea-muted); font-size: 14px; line-height: 1.6; text-align: center; }
.elgea-viewer-caption { margin: 13px 56px 0; color: #dceaf0; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.elgea-viewer-hint { flex: 0 0 auto; margin: 13px 0 0; color: #8facba; font-size: 11px; line-height: 1.4; text-align: center; }

@media (max-width: 650px) {
  .elgea-dialog { width: calc(100% - 18px); max-height: calc(100vh - 18px); max-height: calc(100dvh - 18px); border-radius: 15px; }
  .elgea-dialog-shell { max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .elgea-dialog-header { gap: 12px; padding: 21px 17px 18px; }
  .elgea-dialog-title { font-size: 22px; }
  .elgea-dialog-description { margin-top: 8px; font-size: 13px; line-height: 1.5; }
  .elgea-dialog-eyebrow { font-size: 10px; letter-spacing: .1em; }
  .elgea-grid-pane { padding: 15px 17px 21px; }
  .elgea-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .elgea-thumbnail-caption { margin: 9px 10px 0; font-size: 12px; }
  .elgea-thumbnail > .elgea-kind-note { margin-left: 10px; margin-right: 10px; }
  .elgea-viewer { padding: 11px 11px 14px; }
  .elgea-viewer-toolbar { gap: 3px; padding: 0 0 10px; }
  .elgea-text-button { gap: 6px; padding: 7px 5px; font-size: 12px !important; }
  .elgea-text-button svg { width: 18px; height: 18px; flex-basis: 18px; }
  .elgea-counter { font-size: 11px; }
  .elgea-viewer-stage { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 11px 8px; }
  .elgea-viewer-viewport { grid-column: 1 / -1; grid-row: 1; width: 100%; height: min(48vh, 520px); height: min(48dvh, 520px); }
  .elgea-full-image { max-height: min(48vh - 2px, 518px); max-height: min(48dvh - 2px, 518px); }
  .elgea-is-zoomed .elgea-full-image { max-height: none; }
  .elgea-previous { grid-column: 1; grid-row: 2; justify-self: end; }
  .elgea-next { grid-column: 2; grid-row: 2; justify-self: start; }
  .elgea-viewer-caption { margin: 12px 4px 0; font-size: 12px; }
  .elgea-viewer-hint { display: none; }
}

@media (max-width: 370px) {
  .elgea-back span { max-width: 78px; }
  .elgea-viewer-toolbar { column-gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .elgea-dialog *, .elgea-dialog *::before, .elgea-dialog *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
