/**
 * Presidium — Galeria de fotos (estilo Apple / Steve Jobs)
 */

.gallery-backdrop--modern {
  background: rgba(0, 0, 0, 0.94);
}

.photo-modal.gal-modern {
  background: #000;
  font-family: var(--pro-font);
  -webkit-font-smoothing: antialiased;
}

/* —— Chrome superior —— */
.gal-modern .gal-chrome {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: linear-gradient(180deg, rgba(12, 12, 18, 0.88) 0%, rgba(12, 12, 18, 0.45) 100%);
  border-bottom: none;
  z-index: 8;
}

.gal-modern .gal-chrome-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5f7;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  transition: background 0.22s ease, transform 0.18s ease, box-shadow 0.22s ease;
}

.gal-modern .gal-chrome-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.gal-modern .gal-chrome-btn:hover {
  background: rgba(74, 144, 200, 0.18);
  transform: scale(1.04);
}

.gal-modern .gal-chrome-btn:active {
  transform: scale(0.96);
}

.gal-modern .gal-chrome-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.gal-modern .gal-chrome-eyebrow {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(235, 235, 245, 0.42);
}

.gal-modern .gal-chrome-counter {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f5f5f7;
  font-variant-numeric: tabular-nums;
}

.gal-modern .gal-chrome-counter span {
  font-weight: 400;
  color: rgba(235, 235, 245, 0.45);
  margin: 0 3px;
}

.gal-modern .gal-chrome-spacer {
  width: 40px;
  height: 40px;
}

/* —— Palco da foto —— */
.gal-modern .gal-stage {
  background: var(--presidium-canvas,
    radial-gradient(ellipse 78% 56% at 50% -12%, rgba(255, 255, 255, 0.034) 0%, transparent 62%),
    radial-gradient(ellipse 92% 74% at 50% 48%, rgba(14, 14, 18, 0.98) 0%, rgba(6, 6, 8, 0.99) 55%, #000 100%));
}

.gal-modern.photo-modal--st .gal-stage {
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(240, 128, 64, 0.04) 0%, transparent 68%),
    radial-gradient(ellipse 92% 74% at 50% 48%, rgba(14, 14, 18, 0.98) 0%, rgba(6, 6, 8, 0.99) 55%, #000 100%);
}

.gal-modern .gal-slide {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.gal-modern .gal-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  position: relative;
}

.gal-modern .gal-frame::before {
  display: none;
}

.gal-modern.photo-modal--desl .gal-frame::before {
  background: radial-gradient(ellipse at center, rgba(74, 144, 200, 0.35) 0%, transparent 72%);
}

.gal-modern.photo-modal--st .gal-frame::before {
  background: radial-gradient(ellipse at center, rgba(240, 128, 64, 0.32) 0%, transparent 72%);
}

.gal-modern .gal-img-shell {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  overflow: hidden;
  background: #0a0a0e;
}

.gal-modern .gal-img-shell img:not(.photo-gal-zooming) {
  display: block;
  transition: none;
  animation: none;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center center;
  border-radius: 0;
  filter: none !important;
  image-rendering: auto;
  box-shadow: none;
}

.gal-modern .gal-img-shell img.photo-zoom-hq {
  image-rendering: auto;
  filter: none !important;
}

.gal-modern .gal-img-shell img.photo-gal-zooming {
  max-width: none !important;
  max-height: none !important;
  object-fit: unset !important;
  border-radius: 0;
}

.gal-modern.photo-modal--desl .gal-img-shell img:not(.photo-gal-zooming),
.gal-modern.photo-modal--st .gal-img-shell img:not(.photo-gal-zooming) {
  box-shadow: none;
}

/* —— Setas —— */
.gal-modern .gal-nav-arrow {
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  color: #f5f5f7;
  opacity: 0.92;
}

.gal-modern .gal-nav-arrow:hover,
.gal-modern .gal-nav-arrow:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 12px 28px rgba(0, 0, 0, 0.38);
  transform: translateY(-50%);
}

.gal-modern .gal-nav-arrow svg {
  width: 22px;
  height: 22px;
}

.gal-modern .gal-close-float {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 9;
}

/* —— Painel da ficha —— */
.gal-modern .gal-panel {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  padding: 22px 22px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #14141c 0%, #0c0c12 100%);
  border-top: none;
  overflow: hidden;
}

.gal-modern .gal-dossier-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.gal-modern .gal-panel-info {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.gal-modern .gal-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 74px;
  gap: 10px;
  flex: 0 0 auto;
}

.gal-modern .gal-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0;
  min-width: 0;
  height: 74px;
  padding: 10px 12px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.gal-modern .gal-field--wide {
  grid-column: 1 / -1;
}

.gal-modern .gal-field-lbl {
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  line-height: 1;
  text-transform: uppercase;
  color: rgba(235, 235, 245, 0.48);
}

.gal-modern .gal-field-val {
  margin-top: 8px;
  font-size: 1.14rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #f5f5f7;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gal-modern .gal-panel-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  z-index: 1;
}

.gal-modern.photo-modal--desl .gal-panel-accent {
  background: linear-gradient(180deg, #5a9fd4 0%, #2a5a8a 100%);
}

.gal-modern.photo-modal--st .gal-panel-accent {
  background: linear-gradient(180deg, #f08040 0%, #c85018 100%);
}

.gal-modern .gal-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  padding-left: 20px;
}

.gal-modern .gal-panel-info {
  min-width: 0;
}

.gal-modern .gal-type-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
}

.gal-modern .gal-anklet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(232, 237, 244, 0.22);
}

.gal-modern .gal-anklet .inicio-anklet-svg {
  width: 18px;
  height: 18px;
  display: block;
}

.gal-modern .gal-panel-badge-row {
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}

.gal-modern .gal-panel-badge-row .arch-exit-type-tag {
  pointer-events: none;
}

.gal-modern .gal-panel-badge-row .inicio-card-mark {
  font-size: 0.62rem;
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.gal-modern .gal-panel-badge-row .inicio-card-mark--cadastro {
  display: none !important;
}

.gal-modern .gal-panel-badge-row .inicio-card-mark--desl,
.gal-modern .gal-panel-badge-row .inicio-card-mark--st {
  position: static;
  max-width: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.gal-modern .gal-panel-badge-row .inicio-desl-svg,
.gal-modern .gal-panel-badge-row .inicio-st-svg {
  width: 12px;
  height: 12px;
}

.gal-modern .gal-edit-btn[hidden],
.gal-modern .gal-edit-form[hidden] {
  display: none;
}

.gal-modern .gal-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  color: rgba(245, 245, 247, 0.88);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.gal-modern .gal-edit-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.gal-modern .gal-edit-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.gal-modern .gal-edit-tipo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.gal-modern .gal-tipo-btn,
.gal-modern .gal-edit-save,
.gal-modern .gal-edit-actions .gal-segment-btn {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.gal-modern .gal-tipo-btn {
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  color: rgba(245, 245, 247, 0.62);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gal-modern .gal-tipo-btn.is-on {
  background: rgba(255, 255, 255, 0.14);
  color: #f5f5f7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.gal-modern .gal-edit-name,
.gal-modern #galEditVulgo {
  text-transform: uppercase;
}

.gal-modern .gal-edit-name {
  width: 100%;
  height: 2.5em;
  min-height: 2.5em;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f5f5f7;
  font: inherit;
  font-size: 1.28rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.25;
  outline: none;
}

.gal-modern .gal-edit-name:focus {
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.35);
}

.gal-modern .gal-edit-input,
.gal-modern .gal-edit-toggle {
  margin-top: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f5f5f7;
  font: inherit;
  font-size: 1.14rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-align: left;
  outline: none;
}

.gal-modern .gal-edit-toggle {
  cursor: pointer;
}

.gal-modern .gal-edit-toggle.is-on {
  color: #f5f5f7;
}

.gal-modern .gal-field:focus-within {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.gal-modern .gal-edit-err {
  margin: 8px 0 0;
  color: #f0c7c7;
  font-size: 0.82rem;
}

.gal-modern .gal-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.gal-modern .gal-edit-actions .gal-segment-btn {
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  color: #f5f5f7;
  font-size: 0.92rem;
  font-weight: 650;
}

.gal-modern .gal-edit-save {
  background: rgba(255, 255, 255, 0.14);
}

.gal-modern .gal-panel-name {
  margin: 0 0 14px;
  height: 2.5em;
  min-height: 2.5em;
  max-height: 2.5em;
  font-size: 1.28rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  word-spacing: 0.14em;
  line-height: 1.25;
  color: #f5f5f7;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.gal-modern .gal-panel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gal-modern .gal-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
  min-width: 0;
}

.gal-modern .gal-chip-lbl {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(235, 235, 245, 0.42);
}

.gal-modern .gal-chip-val {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f5f5f7;
  font-variant-numeric: tabular-nums;
}

/* —— Toolbar —— */
.gal-modern .gal-panel-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  width: 100%;
}

.gal-modern .gal-zoom-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
}

.gal-modern .gal-zoom-pair .gal-segment-btn,
.gal-modern .gal-panel-toolbar > .gal-segment-btn--text,
.gal-modern .gal-tool-actions,
.gal-modern .gal-print-btn {
  min-width: 0;
}

.gal-modern .gal-tool-actions {
  display: contents;
}

.gal-modern .gal-panel-toolbar .gal-segment-btn {
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 14px;
  border: none;
  border-radius: 14px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.055);
  color: #f5f5f7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 8px 18px rgba(0, 0, 0, 0.22);
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.gal-modern .gal-panel-toolbar .gal-segment-btn:hover {
  background: rgba(255, 255, 255, 0.11);
}

.gal-modern .gal-panel-toolbar .gal-segment-btn + .gal-segment-btn,
.gal-modern .gal-zoom-pair .gal-segment-btn + .gal-segment-btn {
  border-left: none;
}

.gal-modern .gal-panel-toolbar .gal-segment-btn--copy.is-copied {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 8px 18px rgba(0, 0, 0, 0.22);
}

.gal-modern .gal-print-btn {
  grid-column: 1 / -1;
}

.gal-modern .gal-print-btn.is-ready {
  background: rgba(255, 255, 255, 0.14);
}

.gal-modern .gal-segment {
  display: inline-flex;
  align-items: stretch;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

.gal-modern .gal-segment-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  height: 42px;
  margin: 0;
  padding: 0 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #f5f5f7;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.gal-modern .gal-segment-btn + .gal-segment-btn {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.gal-modern .gal-segment-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.gal-modern .gal-segment-btn:hover {
  background: rgba(74, 144, 200, 0.14);
}

.gal-modern .gal-segment-btn--text {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.gal-modern .gal-segment-btn--primary {
  border-radius: 12px;
  background: linear-gradient(180deg, #5a9fd4 0%, #3d7eb5 100%);
  color: #f5f5f7;
  box-shadow: 0 6px 22px rgba(74, 144, 200, 0.32);
  font-size: 0.78rem;
  font-weight: 600;
  margin-left: auto;
}

.gal-modern .gal-segment-btn--primary:hover {
  background: linear-gradient(180deg, #5a9fd4 0%, #3d7eb5 100%);
}

/* —— Indicadores —— */
.gal-modern .gal-indicators {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px 14px;
}

.gal-modern .gal-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: width 0.28s ease, background 0.28s ease;
}

.gal-modern .gal-dot.is-active {
  width: 22px;
  background: #5a9fd4;
}

.gal-modern.photo-modal--st .gal-dot.is-active {
  background: #f08040;
}

.gal-modern .gal-slide-empty {
  color: rgba(235, 235, 245, 0.45);
  font-size: 0.88rem;
  font-weight: 500;
}

/* —— Desktop: foto na coluna, ficha ao lado, cartão no centro —— */
@media (min-width: 900px) {
  #modal-root .gallery-backdrop--modern {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(0, 0, 0, 0.78);
  }

  #modal-root .photo-modal.gal-modern {
    display: grid;
    grid-template-columns: minmax(280px, calc(min(84dvh, 760px) * 0.5625)) minmax(320px, 400px);
    grid-template-rows: minmax(0, 1fr);
    width: max-content;
    max-width: calc(100vw - 56px);
    height: min(84dvh, 760px);
    max-height: 84dvh;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
      0 0 0 1px rgba(74, 144, 200, 0.1),
      0 28px 90px rgba(0, 0, 0, 0.62);
    overflow: hidden;
    background: #0c0c12;
  }

  #modal-root .photo-modal.gal-modern .gal-stage {
    height: 100%;
    min-height: 0;
    min-width: 0;
    border-radius: 22px 0 0 22px;
    background: #0a0a0e;
  }

  #modal-root .photo-modal.gal-modern .gal-panel {
    height: 100%;
    border-radius: 0 22px 22px 0;
    padding: 26px 24px 20px;
  }

  .gal-modern .gal-segment-btn--primary,
  .gal-modern .gal-segment-btn--copy {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .gal-modern .gal-nav-arrow--prev {
    left: 14px;
  }

  .gal-modern .gal-nav-arrow--next {
    right: 14px;
  }
}

@media (max-width: 639px) {
  .gal-modern .gal-panel-toolbar {
    width: 100%;
  }

  .gal-modern .gal-segment-btn--primary {
    flex: 1;
    margin-left: 0;
    justify-content: center;
  }
}
