/* Galerie publique : rangées proportionnelles, ordre conservé et photos entières. */
.grc-public-gallery, .grc-manager, .grc-login-panel { box-sizing: border-box; }
.grc-public-gallery *, .grc-manager *, .grc-login-panel * { box-sizing: border-box; }
.grc-public-gallery {
  width: 100% !important;
  max-width: 1240px !important;
  margin: 0 auto !important;
  padding: 8px 12px 24px;
}
.grc-public-gallery .grc-mosaic-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  width: 100%;
}
.grc-public-gallery .grc-mosaic-grid > .grc-mosaic-tile {
  position: relative;
  display: block;
  flex: var(--grc-ratio, 1.5) 1 calc(var(--grc-ratio, 1.5) * 250px);
  aspect-ratio: var(--grc-ratio, 1.5);
  width: auto;
  height: auto;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
  border: 0 !important;
  border-radius: 10px !important;
  background: #f1f4f1 !important;
  color: #21382b !important;
  cursor: zoom-in;
  line-height: 0 !important;
  box-shadow: 0 2px 8px rgba(23, 44, 31, .07) !important;
  appearance: none;
  isolation: isolate;
  transition: box-shadow .2s ease;
}
.grc-public-gallery .has-justified-layout > .grc-mosaic-tile { flex: 0 0 auto; aspect-ratio: auto; }
.grc-public-gallery .grc-mosaic-tile:hover { box-shadow: 0 6px 22px rgba(23, 44, 31, .17) !important; }
.grc-public-gallery .grc-mosaic-tile:focus-visible { outline: 3px solid #249a43 !important; outline-offset: 4px; }
.grc-public-gallery .grc-mosaic-tile img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: contain !important;
  border: 0 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}
.grc-comparison-photos {
  display: grid;
  grid-template-columns: var(--grc-pair-columns, 1fr 1fr);
  gap: 0;
  width: 100%;
  height: 100%;
}
.grc-comparison-photo { position: relative; display: block; min-width: 0; min-height: 0; height: 100%; }
.grc-comparison-photo + .grc-comparison-photo::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 2px; background: rgba(255,255,255,.9); pointer-events: none; }
.grc-pair-label {
  position: absolute;
  z-index: 1;
  top: 12px;
  left: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 6px;
  background: rgba(255,255,255,.95);
  color: #244330;
  font: 650 12px/1.3 Arial, sans-serif;
  letter-spacing: .02em;
  pointer-events: none;
  box-shadow: 0 1px 7px rgba(0,0,0,.10);
}
.grc-gallery-empty { min-height: 80px; text-align: center; color: #68756c; }
@media (max-width: 700px) {
  .grc-public-gallery { padding: 6px 8px 18px; }
  .grc-public-gallery .grc-mosaic-grid { gap: 10px; }
  .grc-public-gallery .grc-mosaic-grid > .grc-mosaic-tile { border-radius: 8px !important; }
  .grc-public-gallery .grc-pair-label { top: 8px; left: 8px; padding: 5px 8px; font-size: 11px; }
}

/* Visionneuse grand format, sans panneau de texte. */
html.grc-lightbox-open { overflow: hidden !important; }
.grc-lightbox[hidden] { display: none !important; }
.grc-lightbox { position: fixed !important; inset: 0 !important; z-index: 2147483645 !important; display: flex; align-items: center; justify-content: center; }
.grc-lightbox-backdrop { position: absolute; inset: 0; background: rgba(5, 8, 10, .95); }
.grc-lightbox-stage { position: relative; z-index: 1; display: flex; justify-content: center; align-items: center; width: calc(100vw - 144px); height: calc(100dvh - 60px); pointer-events: none; }
.grc-lightbox-stage img { display: block !important; max-width: 100% !important; max-height: 100% !important; width: auto !important; height: auto !important; object-fit: contain !important; border: none !important; box-shadow: none !important; }
.grc-lightbox button { position: absolute; z-index: 3; display: flex; justify-content: center; align-items: center; width: 54px; height: 60px; padding: 0; color: white !important; background: rgba(255,255,255,.12) !important; border: 0 !important; border-radius: 10px !important; font-family: Arial, sans-serif !important; font-size: 40px; line-height: 1; cursor: pointer; }
.grc-lightbox button:hover { background: rgba(255,255,255,.24) !important; }
.grc-lightbox button:focus-visible { outline: 3px solid white; }
.grc-lightbox-close { top: 18px; right: 22px; width: 45px !important; height: 45px !important; font-size: 34px !important; }
.grc-lightbox-prev { left: 18px; top: calc(50% - 30px); }
.grc-lightbox-next { right: 18px; top: calc(50% - 30px); }
.grc-lightbox-counter { position: absolute; z-index: 2; bottom: 12px; left: 50%; transform: translateX(-50%); color: white; font: 500 14px/1.3 Arial, sans-serif; background: rgba(0,0,0,.4); padding: 6px 14px; border-radius: 20px; }
@media (max-width: 640px) {
  .grc-lightbox-stage { width: calc(100vw - 24px); height: calc(100dvh - 85px); }
  .grc-lightbox button { width: 38px; height: 46px; font-size: 30px; }
  .grc-lightbox-prev, .grc-lightbox-next { top: auto; bottom: 13px; }
  .grc-lightbox-prev { left: 12px; } .grc-lightbox-next { right: 12px; }
  .grc-lightbox-close { top: 12px; right: 12px; }
}

/* Gestion frontend, partagée entre tous les utilisateurs du rôle galerie. */
.grc-manager :where(button) { font-family: inherit; font-size: 14px; line-height: 1.35; font-weight: 600; text-transform: none; letter-spacing: normal; text-shadow: none; }
.grc-manager { max-width: 1140px; width: 100%; margin: 20px auto 48px; font-family: inherit; color: #172018; }
.grc-manager-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 24px; }
.grc-manager h2 { margin: 0 0 8px; font-size: clamp(24px, 3vw, 34px); font-weight: 650; line-height: 1.2; }
.grc-manager-header p { margin: 0; color: #5b665c; line-height: 1.5; }
.grc-logout { color: #3b463e; font-size: 14px; text-decoration: underline; white-space: nowrap; margin-top: 9px; }
.grc-manager-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.grc-upload-button, .grc-manager .grc-primary-button, .grc-login-panel .grc-primary-button { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 45px; padding: 10px 20px; border: 0 !important; border-radius: 9px !important; box-shadow: none !important; background: #249b43 !important; color: #fff !important; font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap; }
.grc-upload-button:hover, .grc-primary-button:hover { background: #1d8338 !important; }
.grc-upload-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 0; cursor: pointer; }
.grc-upload-icon { font-size: 25px; line-height: 18px; font-weight: 400; }
.grc-manager .grc-secondary-button { min-height: 45px; padding: 10px 16px; border-radius: 9px !important; box-shadow: none !important; background: #f3f5f3 !important; border: 1px solid #d7dfd8 !important; color: #273529 !important; font-weight: 600; cursor: pointer; }
.grc-photo-count { color: #5b665c; font-size: 14px; margin-left: auto; }
.grc-manager.is-busy .grc-upload-button { opacity: .65; pointer-events: none; }
.grc-progress-section[hidden], .grc-help-text[hidden] { display: none !important; }
.grc-progress-section { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; margin: 8px 0 20px; }
.grc-progress-label { grid-column: 1 / -1; font-size: 14px; }
.grc-progress-track { width: 100%; height: 13px; border-radius: 999px; overflow: hidden; background: #e8eeea; }
.grc-progress-track span { display: block; width: 0; height: 100%; background: #249b43; transition: width .12s linear; border-radius: inherit; }
.grc-progress-percent { min-width: 42px; color: #245e31; font-size: 14px; line-height: 13px; font-weight: 700; }
.grc-manager-status { min-height: 25px; font-size: 14px; color: #287c3c; line-height: 1.5; }
.grc-manager-status.is-error { color: #ad2323; }
.grc-manager-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 14px; margin: 14px 0 20px; }
.grc-manage-tile { position: relative; aspect-ratio: 1.18; border-radius: 12px; overflow: hidden; border: 1px solid #e2e8e2; background: #eff0ef; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.grc-manage-tile > img { display: block !important; width: 100% !important; height: 100% !important; object-fit: cover !important; margin: 0 !important; }
.grc-manage-tile.is-dragging { opacity: .52; outline: 3px dashed #229842; outline-offset: 1px; }
.grc-remove-photo, .grc-drag-handle { position: absolute; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0 !important; font-family: Arial, sans-serif !important; line-height: 1 !important; cursor: pointer; border: 0 !important; border-radius: 50% !important; box-shadow: 0 1px 5px rgba(0,0,0,.17); }
.grc-remove-photo { top: 7px; right: 7px; color: white !important; background: #dc3030 !important; font-size: 26px; }
.grc-remove-photo:hover { background: #b71c1c !important; }
.grc-drag-handle { bottom: 7px; left: 7px; color: #18201a !important; background: rgba(255,255,255,.94) !important; font-size: 28px; cursor: grab; touch-action: none; user-select: none; }
.grc-drag-handle:active { cursor: grabbing; }
.grc-help-text { font-size: 14px; color: #66746a; line-height: 1.5; }
@media (max-width: 480px) { .grc-manager-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; } .grc-manager { padding: 0 10px; } .grc-photo-count { margin-left: 0; } }

/* Connexion autonome : aucun formulaire WordPress n'est affiché au client. */
.grc-login-panel { width: min(100%, 440px); margin: 35px auto; padding: 28px; border-radius: 17px; border: 1px solid #e1e6e1; box-shadow: 0 7px 25px rgba(0,0,0,.05); }
.grc-login-panel h2 { margin: 0 0 22px; font-size: 26px; }
.grc-login-panel form > label { display: block; margin-bottom: 17px; font-weight: 600; }
.grc-login-panel input[type=text], .grc-login-panel input[type=password] { display: block; width: 100%; height: 45px; margin-top: 8px; padding: 10px 12px; border: 1px solid #cbd5cc; border-radius: 9px; background: white; color: #1d261f; }
.grc-login-panel .grc-remember { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; }
.grc-login-panel .grc-primary-button { width: 100%; justify-content: center; }
.grc-alert { padding: 12px 14px; margin-bottom: 18px; border-radius: 9px; border: 1px solid #eeafaf; background: #fff1f1; color: #a52121; }
@media (prefers-reduced-motion: reduce) { .grc-mosaic-tile img, .grc-progress-track span { transition: none !important; } }

/* Gestion des groupes : une croix par photo, une poignée par élément. */
.grc-manager [hidden] { display: none !important; }
.grc-manager button:disabled { opacity: .48; cursor: default; }
.grc-manager .grc-select-photo:disabled { opacity: 1; }
.grc-manager button:focus-visible, .grc-upload-button:focus-within { outline: 3px solid #207d3e; outline-offset: 3px; }
.grc-manager-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); align-items: start; }
.grc-manage-tile { aspect-ratio: auto; padding-bottom: 48px; overflow: visible; }
.grc-manage-tile.is-pair { grid-column: span 2; }
.grc-manage-photos { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; overflow: hidden; border-radius: 11px 11px 0 0; }
.grc-manage-tile.is-pair .grc-manage-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; }
.grc-manage-photo { position: relative; min-width: 0; height: 160px; background: #e8ece8; }
.grc-manage-photo > img { display: block !important; width: 100% !important; height: 100% !important; object-fit: contain !important; margin: 0 !important; border-radius: 0 !important; }
.grc-select-photo { display: block; width: 100%; height: 100%; margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; cursor: default; box-shadow: none !important; }
.grc-select-photo img { display: block !important; width: 100% !important; height: 100% !important; margin: 0 !important; object-fit: cover !important; border-radius: 0 !important; }
.grc-manage-tile.is-pair .grc-select-photo img { object-fit: contain !important; }
.grc-manage-photo .grc-pair-label { top: 7px; left: 7px; max-width: calc(100% - 48px); }
.grc-manage-tile .grc-drag-handle { bottom: 2px; left: 6px; width: 44px; height: 44px; box-shadow: none; }
.grc-pair-actions { position: absolute; bottom: 6px; left: 56px; right: 6px; display: flex; gap: 5px; justify-content: flex-end; }
.grc-pair-action { min-height: 32px; padding: 5px 9px !important; margin: 0 !important; color: #254d32 !important; background: #fff !important; border: 1px solid #cbd7ce !important; border-radius: 7px !important; font: 600 12px/1.3 Arial, sans-serif; cursor: pointer; box-shadow: none !important; }
/* Création d’une paire : deux emplacements et un choix explicite de la source. */
.grc-pair-panel { border: 1px solid #d3e2d7; background: #f5f9f6; padding: 22px; border-radius: 14px; margin: 14px 0 24px; }
.grc-pair-instruction { margin: 0 0 18px; color: #284833; font-size: 15px; font-weight: 600; line-height: 1.5; }
.grc-pair-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 740px; margin: 0 0 18px; }
.grc-pair-preview-figure { display: flex; flex-direction: column; align-items: stretch; gap: 9px; min-width: 0; margin: 0 !important; padding: 14px; background: #fff; border: 1px solid #dbe5dd; border-radius: 10px; }
.grc-pair-preview-figure figcaption { margin: 0 0 2px; color: #294d35; text-align: left; font-family: inherit; font-size: 14px; line-height: 1.4; font-weight: 700; }
.grc-manager .grc-pair-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 142px;
  padding: 12px !important;
  margin: 0 !important;
  border: 1px dashed #a9c7b2 !important;
  border-radius: 8px !important;
  background: #f7faf7 !important;
  color: #276b3b !important;
  box-shadow: none !important;
  white-space: normal;
  cursor: pointer;
}
.grc-pair-preview-figure:not([data-grc-selected-id]) .grc-pair-upload::before { content: '+'; font-size: 29px; line-height: 1; font-weight: 400; }
.grc-manager .grc-pair-upload:hover:not(:disabled) { border-color: #2b8c47 !important; background: #edf6ef !important; }
.grc-pair-upload img { display: block !important; width: 100% !important; height: 160px !important; max-width: 100% !important; object-fit: contain !important; margin: 0 !important; border-radius: 4px; }
.grc-pair-upload span { font-size: 14px; font-weight: 650; line-height: 1.4; }
.grc-manager .grc-pair-existing, .grc-manager .grc-pair-clear, .grc-manager .grc-pair-picker-close {
  min-height: 40px;
  padding: 8px 10px !important;
  margin: 0 !important;
  border: 1px solid #dbe3dd !important;
  border-radius: 7px !important;
  background: #fff !important;
  color: #345540 !important;
  font-size: 13px;
  line-height: 1.4;
  white-space: normal;
  box-shadow: none !important;
  cursor: pointer;
}
.grc-manager .grc-pair-existing:hover:not(:disabled), .grc-manager .grc-pair-picker-close:hover:not(:disabled) { background: #eef5ef !important; border-color: #aac6b2 !important; }
.grc-manager .grc-pair-clear { min-height: 30px; padding: 2px 5px !important; color: #68756c !important; border-color: transparent !important; background: transparent !important; text-decoration: underline; text-underline-offset: 3px; font-size: 12px; }
.grc-pair-picker { position: relative; padding: 18px; margin: 0 0 18px; border: 1px solid #c6dace; border-radius: 10px; background: #fff; }
.grc-pair-picker-title { padding-right: 70px; margin: 0 0 16px; font-size: 14px; font-weight: 600; line-height: 1.5; color: #284833; }
.grc-manager .grc-pair-picker-close { position: absolute; top: 10px; right: 10px; min-height: 34px; }
.grc-pair-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; max-height: 340px; overflow: auto; padding: 4px; overscroll-behavior: contain; }
.grc-manager .grc-pair-choice { position: relative; display: block; min-width: 0; aspect-ratio: 4 / 3; padding: 0 !important; margin: 0 !important; border: 2px solid transparent !important; border-radius: 7px !important; background: #f1f4f1 !important; overflow: hidden; cursor: pointer; box-shadow: none !important; }
.grc-pair-choice img { display: block !important; width: 100% !important; height: 100% !important; object-fit: contain !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; }
.grc-manager .grc-pair-choice:hover:not(:disabled), .grc-manager .grc-pair-choice[aria-pressed="true"] { border-color: #248a41 !important; }
.grc-pair-choice-used { position: absolute; bottom: 5px; left: 5px; padding: 4px 7px; border-radius: 4px; background: #fff; color: #345540; font-size: 11px; line-height: 1.3; }
.grc-pair-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.grc-manager.is-pairing .grc-manage-tile[data-grc-type="photo"] .grc-select-photo { cursor: pointer; }
.grc-manage-photo.is-selected { outline: 4px solid #239646; outline-offset: -4px; }
.grc-manager.is-pairing .grc-manage-tile[data-grc-type="pair"] { opacity: .55; }

/* Glisser-déposer : source stable, aperçu flottant et repère de dépôt. */
.grc-manager.is-drag-sorting, .grc-manager.is-drag-sorting * { cursor: grabbing !important; user-select: none !important; }
.grc-manage-tile.is-dragging { opacity: .25; outline: 2px dashed #9dbda7; outline-offset: 3px; }
.grc-drag-ghost { position: fixed !important; z-index: 100001 !important; pointer-events: none !important; opacity: .92; margin: 0 !important; box-shadow: 0 14px 38px rgba(23,44,31,.25) !important; border: 2px solid #2a9145; border-radius: 10px; overflow: hidden; background: #fff; transform: rotate(2deg); }
.grc-drag-ghost * { pointer-events: none !important; }
.grc-drag-ghost .grc-remove-photo, .grc-drag-ghost .grc-drag-handle, .grc-drag-ghost .grc-pair-actions { visibility: hidden !important; }
.grc-drop-indicator { position: fixed; z-index: 100002; width: 4px; background: #249b43; border-radius: 3px; box-shadow: 0 0 0 2px rgba(255,255,255,.9); pointer-events: none; }
.grc-drop-indicator[hidden] { display: none !important; }
.grc-drop-indicator::before, .grc-drop-indicator::after { content: ''; position: absolute; left: -3px; width: 10px; height: 10px; border-radius: 50%; background: #249b43; }
.grc-drop-indicator::before { top: -3px; }
.grc-drop-indicator::after { bottom: -3px; }
@media (max-width: 480px) {
  .grc-manager-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grc-manage-photo { height: 145px; }
  .grc-pair-panel { padding: 12px; }
  .grc-pair-preview { gap: 10px; }
  .grc-pair-preview-figure { padding: 9px; }
  .grc-manager .grc-pair-upload { min-height: 122px; padding: 8px !important; }
  .grc-pair-upload img { height: 120px !important; }
  .grc-manager .grc-pair-existing { font-size: 12px; }
  .grc-pair-picker { padding: 12px; }
  .grc-pair-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grc-pair-toolbar .grc-primary-button { flex: 1 1 100%; justify-content: center; order: -1; }
}

/* Visionneuse : paire entière sur ordinateur, empilée sur petit écran. */
.grc-lightbox, .grc-lightbox * { box-sizing: border-box; }
.grc-lightbox button[hidden] { display: none !important; }
.grc-lightbox-stage { pointer-events: auto; touch-action: pan-y pinch-zoom; }
.grc-lightbox-stage.is-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); gap: 16px; align-items: stretch; }
.grc-lightbox-figure { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; margin: 0 !important; padding: 34px 0 0; overflow: hidden; }
.grc-lightbox-stage:not(.is-pair) > .grc-lightbox-figure { width: 100%; height: 100%; padding: 0; }
.grc-lightbox-figure img { width: 100% !important; height: 100% !important; object-fit: contain !important; }
.grc-lightbox-label { position: absolute; top: 4px; left: 0; right: 0; color: white; text-align: center; font: 650 14px/1.4 Arial, sans-serif; }
@media (max-width: 640px) {
  .grc-lightbox-stage.is-pair { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 9px; height: calc(100dvh - 100px); margin-top: 18px; }
  .grc-lightbox-figure { padding-top: 26px; }
  .grc-lightbox-label { font-size: 13px; }
}
