@import url("https://fonts.googleapis.com/css2?family=Goudy+Bookletter+1911&display=swap");

@import url("https://fonts.googleapis.com/css2?family=Tomorrow:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

:root {
  --btn-bg-color: #0066cc;
  --btn-text-color: white;
  --btn-hover-bg-color: #005bb5;
  --btn-hover-text-color: white;
  --font-title: "Goudy Bookletter 1911", serif;
  --font-body: "Tomorrow", sans-serif;
}

body {
  font-family: var(--font-body);
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f5f5f5;
}

h1 {
  color: #333;
  border-bottom: 2px solid #cc5109;
  padding-bottom: 10px;
  font-weight: normal;
}

h2 {
  font-weight: normal;
}

li a {
  border: 1px solid #cc5109;
  font-size: 18px;
}

.header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  padding: 10px 0;
}

.library-logo {
  height: 80px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  flex: 1;
}

.breadcrumb-item {
  position: relative;
  display: flex;
  align-items: center;
}

.breadcrumb-link {
  padding: 10px 16px;
  background: #cc5109;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  margin-right: 8px;
}

.breadcrumb-link:hover {
  background: #aa4308;
  box-shadow: 0 4px 6px #aa43087d;
}

.breadcrumb-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.breadcrumb-item:hover .breadcrumb-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.dropdown-content a {
  display: block;
  padding: 12px 16px;
  color: #cc5109;
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
}

.dropdown-content a:hover {
  background: #cc5109;
  color: white;
  border-left-color: #aa4308;
  padding-left: 20px;
}

.dropdown-content a:first-child {
  border-radius: 12px 12px 12px 12px;
}

.dropdown-content a:last-child {
  border-radius: 12px 12px 12px 12px;
}

h2 + ul {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

h2 + ul li {
  display: flex;
}

h2 + ul li a.dirs {
  flex: 1;
  padding: 15px;
  text-decoration: none;
  border-radius: 8px;
  text-align: center;
  transition: all 0.3s ease;
  overflow: auto;
}

h2 + ul li a:hover {
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  h2 + ul {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
  }

  h2 + ul li a {
    padding: 10px;
    font-size: 14px;
  }
}

ul {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 26px;
}
li {
  margin: 10px 0;
}

.dirs {
  color: #cc5109;
  text-decoration: none;
  padding: 5px 10px;
  display: inline-block;
  border-radius: 4px;
  transition: all 0.3s;
}

.dirs:hover {
  background-color: #cc5109;
  color: white;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.image-item {
  display: flex;
  flex-direction: column;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-grid img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s;
}
.image-grid img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.btn {
  padding: 0;
}
.lightbox-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
}

.lightbox-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  position: relative;
  max-width: 95%;
  max-height: 95%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

.lightbox-counter {
  order: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  user-select: none;
  color: white;
  background: #cc51098c;
  backdrop-filter: blur(10px);
  padding: 10px 15px;
  border-radius: 4px;
  white-space: nowrap;
}

.lightbox-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  z-index: 1002;
  pointer-events: all;
  flex-wrap: nowrap;
}

.lightbox-controls .lightbox-btn {
  pointer-events: all;
  background-color: #cc51098c;
  backdrop-filter: blur(10px);
  color: white;
  border: none;
  padding: 10px 15px;
  font-size: 24px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.3s;
  user-select: none;
  height: 44px;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  order: 1;
}

.lightbox-controls .lightbox-btn:first-of-type {
  order: 1;
}

.lightbox-controls .lightbox-btn:last-of-type {
  order: 3;
}

.lightbox-controls .lightbox-btn:hover {
  background-color: #ff60048c;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  transition: color 0.3s;
  z-index: 10;
}
.lightbox-close:hover {
  color: #aaa;
}

.lightbox-zoom-controls {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
  z-index: 10;
  background: #cc51098c;
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 5px;
  backdrop-filter: blur(10px);
}

.lightbox-zoom-info {
  position: absolute;
  width: 336px;
  top: 115px;
  left: 20px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #cc51098c;
  z-index: 10;
  padding: 10px;
  border-radius: 5px;
  flex-direction: column;
  backdrop-filter: blur(10px);
  color: #ddd;
  transition: all 0.3s ease;
}

.lightbox-zoom-info.collapsed {
  max-width: 40px;
  padding: 5px;
  align-items: center;
}

.zoom-info-toggle:hover {
  color: #fff;
}

.zoom-info-toggle {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.lightbox-zoom-info:not(.collapsed) .zoom-info-toggle {
  transform: rotate(180deg);
}

.zoom-info-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #ddd;
  font-size: 12px;
  line-height: 1.4;
}

.lightbox-zoom-info.collapsed .zoom-info-content {
  display: none;
}

.zoom-info-content span {
  display: block;
}

#zoom-instruction {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

#pan-instruction {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.lightbox-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.lightbox-btn:disabled:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.zoom-control-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.lightbox-btn svg {
  width: 24px;
  height: 24px;
}

.zoom-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  white-space: nowrap;
}

.lightbox-zoom-controls .lightbox-btn {
  background: rgba(255, 255, 255, 0);
  color: #fff;
  border: none;
  font-size: 22px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  outline: none;
  pointer-events: all;
}

.lightbox-zoom-controls .lightbox-btn:hover {
  transform: scale(1.2);
}

.lightbox-zoom-controls .lightbox-btn:active {
  background: #666;
}

.lightbox-main {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin: 20px 0;
}

.lightbox-metadata-panel {
  width: 240px;
  top: 22vh;
  right: 95px;
  position: absolute;
  background: #cc51098c;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 15px;
  backdrop-filter: blur(10px);
  max-height: 70vh;
  overflow-y: auto;
  color: rgba(255, 255, 255, 0.9);
  z-index: 1000;
  transition: all 0.3s ease;
}

.lightbox-metadata-panel.collapsed {
  width: 40px;
  padding: 10px 5px;
  overflow: hidden;
}

.metadata-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  min-height: 24px;
}

.zoom-info-header {
  display: flex;
  align-items: center;
  width: 95%;
  gap: 5px;
  margin-bottom: 0;
  min-height: 24px;
  padding: 5px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.lightbox-zoom-info.collapsed .zoom-info-header {
  flex-direction: column;
  margin-bottom: 0;
  padding: 5px;
}

.lightbox-metadata-panel.collapsed .metadata-header {
  flex-direction: column;
  margin-bottom: 0;
}

.metadata-toggle {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.metadata-toggle:hover {
  color: #fff;
}

.lightbox-metadata-panel.collapsed .metadata-toggle {
  transform: rotate(180deg);
}

.metadata-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  writing-mode: horizontal-tb;
  white-space: nowrap;
  flex: 1;
}

.zoom-info-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  flex: 1;
}

.lightbox-zoom-info.collapsed .zoom-info-header h3 {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  white-space: normal;
  width: 20px;
  text-align: center;
}

.lightbox-metadata-panel.collapsed .metadata-header h3 {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  white-space: normal;
  width: 20px;
}

.lightbox-metadata-panel h3 {
  margin: 0 0 15px 0;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 10px;
}

.lightbox-zoom-info h3 {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 10px;
}

.metadata-content {
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
}

.lightbox-metadata-panel.collapsed .metadata-content {
  display: none;
}

.metadata-content strong {
  display: block;
  color: rgba(255, 255, 255, 0.95);
  margin-top: 8px;
  font-weight: 600;
}

.metadata-content strong::after {
  content: ":";
}

.lightbox-img-container {
  width: 80vw;
  height: 90vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  position: relative;
  flex-shrink: 0;
}

.lightbox-img-container.panning {
  cursor: grabbing;
}

#lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.1s;
  transform-origin: center;
}

.image-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #f5f5f5;
  aspect-ratio: 4/5;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s;
}

.image-wrapper img:hover {
  transform: scale(1.05);
}

.image-metadata {
  padding: 10px;
  border-top: 1px solid #eee;
  background: #fafafa;
  font-size: 12px;
}

.image-metadata details {
  cursor: pointer;
}

.image-metadata summary {
  font-weight: bold;
  color: #666;
  padding: 5px 0;
  user-select: none;
}

.image-metadata pre {
  margin: 8px 0 0 0;
  background: #fff;
  padding: 8px;
  border-radius: 4px;
  font-size: 11px;
  overflow-x: auto;
  color: #333;
}

.img-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border: 3px solid rgba(3, 113, 113, 0.2);
  border-top-color: #cc5109;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.img-anchor .grid-img.loaded + .img-spinner {
  display: none;
}

/* Estilo para el input de búsqueda */
.lightbox-search-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid white;
  font-size: 16px;
  color: white;
  text-align: center;
  width: 40px;
  padding: 0 4px;
  font-family: inherit;
  cursor: text;
  outline: none;
  height: 24px;
  display: flex;
  align-items: center;
}

/* Remover las flechas del input number */
.lightbox-search-input::-webkit-outer-spin-button,
.lightbox-search-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.lightbox-search-input[type="number"] {
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Estilos al hacer focus */
.lightbox-search-input:focus {
  border-bottom-color: #666;
  background-color: rgba(0, 0, 0, 0.02);
}

/* Estilo del placeholder */
.lightbox-search-input::placeholder {
  color: #ccc;
}

/* Que el counter se vea como un conjunto de elementos */
.lightbox-counter {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 14px;
  user-select: none;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
.image-wrapper {
  position: relative;
}

.grid-img.loaded ~ .img-spinner {
  display: none;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

footer.build-info {
  margin-top: 40px;
  padding: 20px;
  border-top: 1px solid #ddd;
  text-align: center;
  font-size: 16px;
  color: #999;
}

footer.build-info small {
  display: block;
  line-height: 1.6;
}

@media (max-width: 1024px) {
  .lightbox-main {
    flex-direction: column;
  }

  .metadata-header {
    flex-direction: row;
  }

  .lightbox-metadata-panel.collapsed .metadata-header h3 {
    writing-mode: vertical-rl;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    white-space: normal;
    width: 20px;
  }
}

@media (max-width: 768px) {
  body.lightbox-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
  }

  footer.build-info {
    padding: 15px;
    font-size: 10px;
  }

  .header {
    flex-direction: row;
    gap: 10px;
    align-items: flex-start;
  }

  .library-logo {
    height: 40px;
  }

  /* Lightbox modal en mobile */
  .lightbox-modal.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
  }

  .lightbox-content {
    position: relative;
    flex-direction: column;
    gap: 0;
    max-height: 100vh;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
  }

  /* Imagen ocupa la mayor parte */
  .lightbox-img-container {
    width: 100%;
    height: 100%;
    flex: 1;
    order: 1;
  }

  /* Panel metadata arriba, pequeño, centrado y colapsado */
  .lightbox-metadata-panel {
    font-size: 10px;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60vw;
    max-width: 90%;
    max-height: 300px;
    padding: 8px 12px;
    z-index: 1001;
    border-radius: 20px;
    background: #cc51098c;
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
  }

  .lightbox-metadata-panel.collapsed {
    max-height: 40px;
    padding: 8px 12px;
    width: 35vw;
  }

  .lightbox-metadata-panel:not(.collapsed) .metadata-content {
    display: block;
    margin-top: 8px;
    max-height: 250px;
    overflow-y: auto;
  }

  .metadata-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    min-height: 24px;
  }

  .lightbox-metadata-panel.collapsed .metadata-header {
    flex-direction: row;
    margin: 0;
  }

  .lightbox-metadata-panel.collapsed .metadata-header h3 {
    writing-mode: horizontal-tb;
    transform: none;
    width: auto;
    white-space: nowrap;
    font-size: 12px;
    margin: 0;
  }

  .lightbox-metadata-panel.collapsed .metadata-content {
    display: none;
  }

  .metadata-toggle {
    padding: 2px;
    width: 20px;
    height: 20px;
  }

  .metadata-toggle svg {
    width: 14px;
    height: 14px;
  }

  .metadata-content {
    display: none;
  }

  /* Zoom info oculto en mobile */
  .lightbox-zoom-info {
    display: none !important;
  }

  /* Zoom controls ocultos en mobile */
  .lightbox-zoom-controls {
    display: none !important;
  }

  /* Controles en la parte inferior */
  .lightbox-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    transform: none;
    padding: 15px;
    box-sizing: border-box;
    z-index: 1000;
    gap: 12px;
    flex-wrap: nowrap;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.5);
  }

  .lightbox-controls .lightbox-btn {
    padding: 8px 12px;
    font-size: 18px;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
  }

  .lightbox-counter {
    position: relative;
    transform: none;
    background: transparent;
    padding: 8px 12px;
    margin: 0;
    flex-shrink: 1;
    min-width: auto;
    gap: 2px;
    font-size: 12px;
  }

  .lightbox-search-input {
    width: 30px;
    font-size: 12px;
  }

  .lightbox-close {
    top: 10px;
    right: 10px;
    font-size: 24px;
    z-index: 1002;
  }

  .lightbox-main {
    margin: 0;
  }

  .breadcrumb-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
}
