/* Clear reading and generous controls on phones, keyboards and enlarged screens. */
:root { --muted:#4b5263; --line:#858b98; }
html { scroll-behavior:auto; scroll-padding-top:24px; }
body { font-size:18px; line-height:1.5; }
body::after,.reading-progress { display:none; }
h1,h2,h3 { font-family:"Segoe UI",Arial,sans-serif; font-weight:700; letter-spacing:-.025em; line-height:1.2; }
:is(a,button,input,select,summary):focus-visible { outline:3px solid #101b40; outline-offset:4px; box-shadow:0 0 0 7px #fff; }
body .button,body .text-link,body .text-button,body .round-action { font-size:18px; min-height:52px; padding:12px 18px; line-height:1.4; gap:10px; }
.topbar .button-compact,.gallery-folder-actions .button,.camera-actions .button,.upload-footer .button,.viewer-bottom .button,.selection-row .text-link { font-size:18px; min-height:52px; }
.brand { min-height:52px; }
body .button:hover,body .round-action:hover { transform:none; }
body button:disabled { opacity:1; background:#e2e4e9; color:#545b68; border-color:#a1a7b1; cursor:default; box-shadow:none; }
.button-secondary { background:var(--white); border-color:#697286; }
body .field>span:first-child { font-size:20px; }
body .field input,body .event-picker select,body .select-control,body .search-box input { font-size:18px; min-height:56px; color:var(--ink); background:#fff; border-color:#697286; }
body .field input::placeholder,body .search-box input::placeholder { font-size:18px; color:#596171; opacity:1; }
body .field input:focus-visible { outline:3px solid #101b40; outline-offset:3px; }
body .password-field input { padding-right:112px; }
body .text-button { right:2px; padding-inline:10px; }
body .form-message,body .event-status,body .selection-summary,body .upload-progress,body .toast,body .gallery-loading,body .gallery-empty p { font-size:18px; line-height:1.5; }
.login-layout { grid-template-columns:minmax(0,1fr) minmax(0,1fr); min-height:100svh; }
.login-brand-panel { min-height:0; padding:40px; justify-content:center; }
.login-brand-copy { padding-top:40px; }
.login-brand-copy h1 { font-size:clamp(36px,5vw,64px); line-height:1.2; }
.login-collage { display:none; }
.login-form-panel { justify-content:center; padding:36px; }
.login-card { max-width:480px; padding:24px 0; }
.login-card-heading h2 { font-size:36px; }
.login-card-heading>p:last-child { max-width:none; font-size:18px; line-height:1.5; }
.brand-copy strong, .topbar .brand-copy strong { font-size:20px; line-height:1.3; }
.topbar { position:relative; flex-wrap:wrap; gap:16px; padding:20px 5%; }
.main-nav { display:flex; flex-wrap:wrap; gap:12px; }
.main-nav a { display:flex; align-items:center; min-height:56px; padding:12px 18px; border:2px solid var(--blue); border-radius:8px; color:var(--blue-dark); font-size:20px; font-weight:700; }
.main-nav a:first-child { background:var(--blue); color:white; }
.main-nav a::after { display:none; }
.topbar-actions { margin-left:auto; }
.camera-sticky { min-height:100svh; padding:24px 5%; }
.is-scroll-scene .camera-sticky { position:sticky; top:var(--camera-pin-top,0px); }
.camera-layout { grid-template-columns:minmax(0,.85fr) minmax(0,1.3fr); gap:24px; }
.camera-copy { padding:12px 0; }
.camera-copy h1 { font-size:clamp(40px,5.9vw,90px); line-height:1.2; }
.camera-title-desktop { display:none; }
@media (min-width:901px) {
  .camera-title-mobile { display:none; }
  .camera-title-desktop { display:block; }
  .camera-copy h1 { color:#fffdf7; font-size:clamp(64px,7vw,108px); line-height:1.04; letter-spacing:-.04em; }
  .camera-title-lead { display:block; margin-bottom:20px; font:600 clamp(24px,2.4vw,36px)/1.3 "Segoe UI",Arial,sans-serif; letter-spacing:-.025em; }
  .camera-title-memory,.camera-title-together { display:block; }
  .camera-title-memory { font-family:Georgia,"Times New Roman",serif; font-style:italic; font-weight:400; color:var(--lime); }
  .camera-title-together { font-weight:650; }
  .camera-copy .camera-actions { margin-top:32px; }
}
.camera-stage { height:clamp(300px,62svh,680px); min-width:0; }
.camera-actions { margin-top:20px; }
.camera-action-download { background:var(--lime); color:#101b40; border-color:var(--lime); order:-1; }
.camera-action-upload { background:transparent; color:white; border:2px solid white; box-shadow:none; }
.camera-action-upload:hover { background:#294173; }
.camera-action-download:hover { background:#f8ffac; }
.camera-coordinate,.camera-timeline,.camera-top-label,.camera-wordmark>span,.lens-bezel>span,.lens-bezel>small { display:none; }
.section { padding:36px 5%; }
.gallery-toolbar { margin-top:0; flex-wrap:wrap; gap:20px; }
.gallery-toolbar h2,.upload-intro h2 { font-size:clamp(28px,3vw,40px); padding:0; }
.section-subtitle { font-size:18px; color:var(--muted); }
.view-switch { display:none; }
.gallery-folder-bar { gap:16px; padding:20px; }
.gallery-folder-bar>p,.download-help { font-size:18px; color:var(--muted); }
.download-help { margin:16px 0; }
.media-fallback>span,.media-fallback small { font:18px/1.5 "Segoe UI",Arial,sans-serif; }
.video-badge { font-size:16px; }
.gallery-controls { flex-wrap:wrap; gap:16px; }
.search-box { flex:1 1 280px; min-width:0; }
.search-box input { width:100%; min-width:0; }
.select-control { max-width:100%; }
.gallery-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:24px; }
.photo-card { min-width:0; border:1px solid #a5aaba; border-radius:12px; padding:12px; background:#fff; }
.photo-card,.login-card,.photo-viewer[open] { animation:none; }
.photo-card:hover .photo-visual img { transform:none; }
.photo-card.is-selected { border:3px solid var(--blue); padding:10px; background:#edf1ff; }
.photo-select { display:flex; align-items:center; gap:12px; min-height:52px; padding:8px 4px; cursor:pointer; font-size:18px; font-weight:600; }
.photo-select input { width:28px; height:28px; margin:0; flex-shrink:0; accent-color:var(--blue); }
.photo-number { display:none; }
.photo-visual,.photo-visual.is-hovered { transform:none; }
.photo-visual { width:100%; }
.photo-meta { display:flex; flex-direction:column; align-items:stretch; gap:12px; }
.photo-meta-copy { width:100%; min-width:0; }
.photo-meta-copy strong { font-size:18px; }
.photo-meta-copy span { font:18px/1.5 "Segoe UI",Arial,sans-serif; }
.photo-card-actions { width:100%; }
.photo-card-actions { flex-wrap:wrap; }
.photo-card-actions .button-danger { width:100%; }
.button-danger { background:#a52222; color:white; border-color:#a52222; }
.button-danger:hover:not(:disabled) { background:#791717; }
body .event-picker select[aria-invalid="true"] { border:3px solid #a52222; background:#fff4f0; }
#upload-album-error.visible { margin-bottom:18px; }
#admin-badge { font-size:18px; font-weight:700; color:var(--blue-dark); }
.topbar-actions { flex-wrap:wrap; }
body .round-action { display:flex; justify-content:center; width:100%; height:auto; border-radius:8px; background:var(--blue); color:white; border:0; font-weight:700; }
body .round-action:hover { background:var(--blue-dark); }
.gallery-selection { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin:20px 0; }
#download-selection-count { font-size:20px; font-weight:600; }
.gallery-more-wrap { margin-top:24px; text-align:center; }
.full-gallery .camera-story,.full-gallery .upload-section,.full-gallery .site-footer { display:none; }
#gallery-full-heading { font-size:28px; margin:20px 0; overflow-wrap:anywhere; }
.full-gallery .gallery-toolbar { display:none; }
.upload-layout { grid-template-columns:minmax(0,1fr); gap:24px; padding-top:0; max-width:800px; margin:auto; }
.upload-flower { display:none; }
.upload-card { padding:28px; }
.new-event summary,body .new-event #create-event { font-size:18px; min-height:52px; }
.dropzone { min-height:180px; border:2px dashed var(--blue); }
.dropzone strong { font:700 22px/1.4 "Segoe UI",Arial,sans-serif; letter-spacing:0; }
.dropzone>span:not(.upload-icon) { font-size:18px; color:var(--ink); }
.selection-row { flex-wrap:wrap; }
.upload-footer .button { width:100%; }
.site-footer { padding:24px 5%; }
.footer-bottom { border:0; padding:0; }
.back-top { border-radius:8px; min-height:52px; width:auto; height:auto; padding:10px 16px; font-size:18px; }
.viewer-close,.viewer-arrow { width:auto; height:auto; min-height:52px; border-radius:8px; padding:10px 14px; font-size:18px; }
.viewer-counter { font-size:18px; letter-spacing:0; }
.viewer-stage { gap:12px; }
.viewer-stage img,.viewer-stage video { width:calc(100% - 260px); }
.viewer-bottom h2 { font:600 20px/1.4 "Segoe UI",Arial,sans-serif; }
.viewer-bottom p,#viewer-error { font-size:18px; }
.viewer-bottom { flex-wrap:wrap; }
.viewer-bottom>div { flex:1 1 180px; }
.reveal-pending { opacity:1; transform:none; }
.download-dialog { width:min(640px,calc(100% - 24px)); max-height:90svh; padding:28px; border:2px solid var(--blue); border-radius:12px; background:var(--paper); color:var(--ink); overflow:auto; }
.download-dialog::backdrop { background:#101b40cc; }
.download-dialog h2 { font-size:28px; }
.download-dialog p,.download-dialog .field { margin:18px 0; font-size:18px; overflow-wrap:anywhere; }
.download-actions { display:flex; flex-wrap:wrap; gap:12px; }
.download-actions .button { flex:1 1 220px; }
.download-error { color:#8d2926; }
#download-count-hint { display:block; font-size:22px; font-weight:400; line-height:1.5; }
#download-count-word { font-weight:700; }
#download-status:empty { display:none; }
.download-preview img,.download-preview video { display:block; max-width:100%; max-height:55svh; margin:16px auto; object-fit:contain; }
#download-retry summary,#download-retry a { display:block; min-height:52px; padding:12px 0; font-size:18px; cursor:pointer; overflow-wrap:anywhere; }
#download-retry a { color:var(--blue-dark); text-decoration:underline; }
@media (max-width:900px) {
  .topbar .brand { flex:1 1 200px; }
  .main-nav { order:3; width:100%; }
  .main-nav a { flex:1 1 200px; justify-content:center; text-align:center; }
  .camera-layout { grid-template-columns:1fr; }
  .camera-stage { display:block; height:clamp(280px,44svh,420px); }
  .camera-orbit--outer { width:min(290px,85vw); height:min(290px,85vw); }
  .camera-orbit--inner { width:min(245px,75vw); height:min(245px,75vw); }
  .gallery-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .login-layout { grid-template-columns:1fr; align-content:start; }
  .login-brand-panel { padding:24px; }
  .login-brand-copy { padding-top:16px; }
  .login-brand-copy h1 { font-size:32px; }
  .login-form-panel { padding:24px; }
}
@media (max-width:600px) {
  .search-box { flex:0 0 auto; }
  .gallery-grid { grid-template-columns:minmax(0,1fr); }
  .photo-visual { aspect-ratio:4/3; }
  .camera-actions { display:flex; flex-direction:column; }
  .gallery-selection { align-items:stretch; }
  .gallery-selection>* { width:100%; }
  .gallery-selection>span { flex:1 1 100%; }
  .gallery-folder-actions { width:100%; flex-direction:column; }
  .select-control { width:100%; align-self:stretch; }
  .upload-card { padding:20px 16px; }
  .viewer-stage { padding-bottom:64px; }
  .viewer-stage img,.viewer-stage video { width:100%; }
  .viewer-arrow { position:absolute; bottom:0; }
  #viewer-prev { left:0; }
  #viewer-next { right:0; }
  .viewer-bottom .button { width:100%; }
  #viewer-error { left:5%; width:90%; top:20%; }
  .footer-bottom .brand { width:100%; }
}

.gallery-top { display:none; }
.full-gallery .gallery-top {
  display:inline-flex; position:fixed; right:max(16px,env(safe-area-inset-right));
  bottom:max(16px,env(safe-area-inset-bottom)); z-index:30;
  background:var(--blue); color:white; min-height:56px; font-size:18px;
  box-shadow:0 4px 20px #0003;
}
.full-gallery #galeria { padding-bottom:110px; }
#viewer-select[aria-pressed="true"] { background:var(--blue); color:white; }

#toast { padding:18px 58px 18px 20px; min-height:58px; text-align:left; }
#toast[hidden] { display:none; }
#toast.is-visible { pointer-events:auto; }
#toast-close { position:absolute; top:2px; right:2px; width:44px; height:44px; border:0; background:transparent; color:inherit; font:30px/1 Arial,sans-serif; cursor:pointer; }
#toast-close:focus-visible { outline:3px solid var(--lime); outline-offset:-4px; }


/* Mismo aspecto para los controles secundarios de ambos formularios */
.reset-control {
  min-height: 52px !important;
  width: auto;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px !important;
  padding: 12px 18px !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--ink) !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
  white-space: nowrap;
  text-decoration: none !important;
  box-shadow: none !important;
}

.reset-control:hover:not(:disabled) {
  background: var(--lime) !important;
  border-color: var(--ink) !important;
  transform: translateY(-2px);
  box-shadow: 3px 4px 0 var(--ink) !important;
}

.reset-control:active:not(:disabled) {
  transform: none;
  box-shadow: none !important;
}

.reset-control:disabled {
  opacity: .55;
}

#reload-events.reset-control {
  margin: 0 0 24px;
}

.gallery-selection .reset-control,
.selection-row .reset-control {
  min-width: 174px;
}

@media (max-width: 680px) {
  .reset-control {
    width: 100%;
    min-width: 0;
  }

  .selection-row {
    align-items: stretch;
  }

  .gallery-folder-actions .reset-control,
  .gallery-selection .reset-control,
  .selection-row .reset-control {
    flex: 1 1 100% !important;
  }
}


/* ===== Ajustes finales de portada, galería y vídeo ===== */

/* La portada de acceso ocupa exactamente el viewport. */
body.login-page {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}
.login-page #login-view {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
.login-page .login-brand-panel,
.login-page .login-form-panel {
  min-height: 0 !important;
  height: 100%;
}

/* Mientras llega el primer fotograma solo hay fondo neutro:
   no se usa ninguna portada genérica. */
.photo-visual video,
#viewer-video {
  background: #ded9cd;
}
.photo-visual video {
  object-fit: cover;
}

/* El estado de conversión se lee mejor sobre el visor. */
#viewer-error.viewer-converting {
  display: block !important;
  visibility: visible !important;
  background: rgba(246,243,233,.94);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 14px 18px;
  border-radius: 8px;
}

@media (max-width: 900px) {
  .login-page #login-view {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(150px, 34dvh) minmax(0, 1fr);
  }
  .login-page .login-brand-panel {
    height: 100%;
    overflow: hidden;
  }
  .login-page .login-form-panel {
    height: 100%;
    min-height: 0 !important;
    overflow: auto;
    overscroll-behavior: contain;
  }
  .login-page .login-card {
    margin: auto;
  }
}

@media (max-width: 600px) {
  .login-page #login-view {
    grid-template-rows: minmax(135px, 31dvh) minmax(0, 1fr);
  }
  .login-page .login-brand-panel {
    padding-block: 18px;
  }
  .login-page .login-brand-copy {
    padding-top: 8px;
  }
  .login-page .login-brand-copy h1 {
    font-size: clamp(27px, 8vw, 34px);
    line-height: 1.08;
  }
}


/* =========================================================
   Descarga múltiple: confirmación simple y muy visible
   ========================================================= */
.download-confirmation {
  text-align: center;
  padding: 6px 4px 10px;
}
.download-confirmation-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--ink);
  font-size: 34px;
  font-weight: 800;
}
#download-dialog-title {
  margin: 0 0 12px;
  font: 700 30px/1.2 "Segoe UI", Arial, sans-serif;
}
#download-confirmation-message {
  margin: 0 !important;
  font-size: 22px !important;
  line-height: 1.45;
}
#download-confirmation-message strong {
  white-space: nowrap;
  color: var(--blue-dark);
}
.download-confirmation-note {
  margin: 8px 0 0 !important;
  font-size: 17px !important;
  color: var(--muted);
}
.download-actions {
  margin-top: 20px;
}

/* =========================================================
   Miniaturas de vídeo: la portada es SIEMPRE el primer
   fotograma extraído del propio archivo.
   ========================================================= */
.photo-visual .video-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #ded9cd;
}
#viewer-video-poster {
  object-fit: contain;
  max-height: min(70vh, 720px);
  background: #ded9cd;
}
#viewer-video.hidden + #viewer-error,
#viewer-video-poster:not(.hidden) ~ #viewer-error:not(.hidden) {
  z-index: 4;
}
