/*
Theme Name: Child Theme
Author: STFC
Description: <themeDescription>
Version: 1.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.0
Text Domain: UKRI
Template: masters-theme
*/


/* //// Gallery Flexible Panel //// */

  /* Gallery Grid */
  .gallery-grid {
    display: grid;
    gap: 24px;
    width: 100%;
    margin-bottom: 32px;
  }

  .gallery-columns-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-columns-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-columns-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  @media (max-width: 992px) {
    .gallery-columns-3,
    .gallery-columns-4 {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (max-width: 576px) {
    .gallery-columns-2,
    .gallery-columns-3,
    .gallery-columns-4 {
      grid-template-columns: 1fr;
      gap: 16px;
    }
  }

  /* Gallery Items */
  .gallery-item {
    display: flex;
    flex-direction: column;
  }

  .gallery-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    overflow: hidden;
    border-radius: 8px;
    background-color: #f0f0f0;
  }

  /* Gallery Button */
  .gallery-image-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .gallery-image-btn:focus {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
    border-radius: 8px;
  }

  .gallery-image-btn:focus:not(:focus-visible) {
    outline: none;
  }

  /* Thumbnail Image */
  .gallery-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Hover Overlay */
  .gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background-color 0.3s ease;
  }

  @media (prefers-reduced-motion: reduce) {
    .gallery-overlay {
      transition: none;
    }
  }

  .gallery-image-btn:hover .gallery-overlay,
  .gallery-image-btn:focus .gallery-overlay {
    background-color: rgba(0, 0, 0, 0.5);
  }

  .gallery-icon {
    width: 48px;
    height: 48px;
    stroke-width: 1.5;
  }

  /* Caption */
  .gallery-caption {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
  }

  /* Modal Lightbox */
  .gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .gallery-modal.active {
    opacity: 1;
    visibility: visible;
  }

  @media (prefers-reduced-motion: reduce) {
    .gallery-modal {
      transition: none;
    }
  }

  .gallery-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
  }

  .gallery-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    z-index: 1051;
  }

  /* Close Button */
  .gallery-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
  }

  .gallery-modal-close:focus {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
    border-radius: 4px;
  }

  .gallery-modal-close:hover {
    color: #ccc;
  }

  @media (max-width: 576px) {
    .gallery-modal-close {
      top: 10px;
      right: 10px;
    }
  }

  /* Image Wrapper */
  .gallery-modal-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    /* overflow: auto; */
    min-height: 300px;
  }

  .gallery-modal-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  /* Navigation */
  .gallery-modal-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    pointer-events: none;
  }

  .gallery-modal-btn {
    background: none;
    border: none;
    color: white;
    font-size: 48px;
    cursor: pointer;
    padding: 8px 16px;
    pointer-events: auto;
    user-select: none;
    transition: color 0.2s ease;
  }

  .gallery-modal-btn:hover {
    color: #ccc;
  }

  .gallery-modal-btn:focus {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
    border-radius: 4px;
  }

  .gallery-modal-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
  }

  /* Caption */
  .gallery-modal-caption {
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 16px;
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
  }

  .gallery-modal-caption-text {
    margin: 0;
  }

  /* Counter */
  .gallery-modal-counter {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
  }

  @media (max-width: 576px) {
    .gallery-modal-btn {
      font-size: 32px;
      padding: 4px 8px;
    }

    .gallery-modal-counter {
      bottom: 8px;
      right: 8px;
      font-size: 11px;
    }
  }
