/* ============================================================
   PokéGallery — gallery.css

   Styles the output of make_gallery() in functions.php:
     <div class="responsive-gallery"><div class="gallery">...

   ============================================================ */

/* Changes the bottom padding of a main content box when it
   contains a responsive gallery. This affects the main box
   surrounding the photo gallery on type pages. */
.box.main:has(.responsive-gallery) {

    padding-bottom: 12px;

}

/* Makes each gallery item appear as a card in a three-column
   layout on larger screens. It also adds spacing between the
   cards and applies the card-in animation. */
.responsive-gallery {

    display: inline-block;

    width: calc(33.333% - 14px);

    margin: 0 14px 18px 0;

    vertical-align: top;

    animation: card-in 0.5s ease both;

}

/* Creates the animation used when gallery cards appear.
   The cards start slightly smaller, lower and transparent,
   then move into their normal position and size. */
@keyframes card-in {

    from { opacity: 0; transform: translateY(14px) scale(0.97); }

    to   { opacity: 1; transform: translateY(0) scale(1); }

}

/* Removes the gallery card animation for users who have
   reduced-motion enabled in their accessibility settings. */
@media (prefers-reduced-motion: reduce) {

    .responsive-gallery { animation: none; }

}

/* Adds different animation delays to the first six gallery
   cards so they appear one after another instead of all
   appearing at exactly the same time. */
.responsive-gallery:nth-child(1) { animation-delay: 0.02s; }

.responsive-gallery:nth-child(2) { animation-delay: 0.08s; }

.responsive-gallery:nth-child(3) { animation-delay: 0.14s; }

.responsive-gallery:nth-child(4) { animation-delay: 0.20s; }

.responsive-gallery:nth-child(5) { animation-delay: 0.26s; }

.responsive-gallery:nth-child(6) { animation-delay: 0.32s; }

/* Gives all gallery cards from the seventh card onwards
   the same final animation delay. */
.responsive-gallery:nth-child(n+7) { animation-delay: 0.36s; }

/* Controls the right margin of every third gallery card.
   This helps keep the three-column gallery spacing consistent. */
.responsive-gallery:nth-child(3n+1) {

    margin-right: 14px;

}

/* Controls the individual gallery card created inside
   the responsive-gallery container. It creates the square
   shape, rounded corners, border, outline and background. */
.gallery {

    position: relative;

    border-radius: 8px;

    overflow: hidden;

    border: 3px solid var(--card);

    outline: 1px solid var(--line);

    background: #F1EEE3;

    aspect-ratio: 1 / 1;

}

/* Makes the link surrounding each gallery image fill the
   entire gallery card. This allows the whole image area
   to be clickable. */
.gallery a { display: block; height: 100%; }

/* Controls the images inside each gallery card.
   The image fills the square card while object-fit: cover
   keeps the image from becoming distorted. */
.gallery img {

    width: 100%;

    height: 100%;

    object-fit: cover;

    transition: transform 0.25s ease;

}

/* Creates a small Pokéball-style badge in the top-right
   corner of every gallery card. It is decorative and does
   not interfere with clicking the image. */
.gallery::after {

    /* small Pokéball corner badge on every card */

    content: "";

    position: absolute;

    top: 8px;

    right: 8px;

    width: 18px;

    height: 18px;

    border-radius: 50%;

    background: linear-gradient(var(--accent) 0 47%, var(--ink) 47% 53%, #fff 53% 100%);

    box-shadow: 0 0 0 2px rgba(255,255,255,0.85), 0 1px 3px rgba(0,0,0,0.3);

    pointer-events: none;

}

/* Enlarges the gallery image slightly when the user
   hovers over the gallery card. This creates a zoom effect. */
.gallery:hover img {

    transform: scale(1.06);

}

/* Changes the outline around the gallery card when the
   user hovers over it. The outline uses the current
   Pokémon type's accent colour. */
.gallery:hover {

    outline: 2px solid var(--accent);

}

/* Adds a smooth transition to the gallery outline so the
   hover colour change does not happen instantly. */
.gallery {

    transition: outline-color 0.3s ease;

}

/* Changes the gallery layout when the screen is 700px
   wide or smaller. Two columns are used instead of three
   so the images have more space on smaller screens. */
@media (max-width: 700px) {

    .responsive-gallery {

        width: calc(50% - 10px);

    }

}

/* Changes the gallery layout when the screen is 440px
   wide or smaller. Each gallery card takes the full width,
   creating a single-column layout for very small screens. */
@media (max-width: 440px) {

    .responsive-gallery {

        width: 100%;

        margin-right: 0 !important;

    }

}

/* --- Featured Pokémon thumbnails ----------------------------- */

/* Controls the row of featured Pokémon images at the top
   of the type gallery pages. In fire.php these are the
   Charizard, Vulpix, Growlithe, Arcanine, Ponyta and Moltres
   thumbnails. */
.type-strip {

    display: flex;

    flex-wrap: wrap;

    justify-content: center;

    align-items: flex-end;

    gap: 18px;

    margin: 4px 0 22px;

}

/* Controls the normal size and appearance of the featured
   Pokémon thumbnails. It also adds a shadow, hover animation
   and makes the mouse cursor show that they are clickable. */
.type-thumb {

    width: 96px;

    height: 96px;

    object-fit: contain;

    filter: drop-shadow(0 6px 10px rgba(34, 38, 43, 0.22));

    transition: transform 0.18s ease, filter 0.18s ease;

    cursor: pointer;

}

/* Makes the first Pokémon thumbnail larger than the other
   thumbnails. On the Fire page this affects Charizard because
   it is the first image in the .type-strip. */
.type-thumb:first-child {

    width: 150px;

    height: 150px;

}

/* Makes a featured Pokémon thumbnail slightly larger when
   the user hovers over it. */
.type-thumb:hover {

    transform: scale(1.15);

}

/* Removes the default browser focus outline from the
   Pokémon thumbnails. The more visible focus style below
   replaces it for keyboard users. */
.type-thumb:focus {

    outline: none;

}

/* Creates a custom visible focus indicator for keyboard
   navigation. This helps users see which Pokémon thumbnail
   currently has keyboard focus. */
.type-thumb:focus-visible {

    outline: none;

    border-radius: 8px;

    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 0 6px var(--accent);

}

/* Controls the appearance of the currently selected Pokémon.
   It gives the active thumbnail several glowing shadows using
   the current Pokémon type's accent colour and starts a
   pulsing animation. */
.type-thumb.active {

    filter:

        drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 85%, transparent))

        drop-shadow(0 0 26px color-mix(in srgb, var(--accent) 65%, transparent))

        drop-shadow(0 0 46px color-mix(in srgb, var(--accent) 40%, transparent));

    animation: active-glow-pulse 1.6s ease-in-out infinite;

}

/* Creates the pulsing glow animation for the currently
   selected Pokémon thumbnail. */
@keyframes active-glow-pulse {

    0%, 100% {

        filter:

            drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 85%, transparent))

            drop-shadow(0 0 26px color-mix(in srgb, var(--accent) 65%, transparent))

            drop-shadow(0 0 46px color-mix(in srgb, var(--accent) 40%, transparent));

    }

    50% {

        filter:

            drop-shadow(0 0 14px color-mix(in srgb, var(--accent) 95%, transparent))

            drop-shadow(0 0 34px color-mix(in srgb, var(--accent) 75%, transparent))

            drop-shadow(0 0 60px color-mix(in srgb, var(--accent) 50%, transparent));

    }

}

/* Stops the active Pokémon's glow animation when the user
   has reduced-motion enabled. */
@media (prefers-reduced-motion: reduce) {

    .type-thumb.active { animation: none; }

}

/* Controls the information panel that appears underneath
   the featured Pokémon thumbnails after a Pokémon is selected.
   It creates a centred cream-coloured box with an accent border. */
.type-summary {

    max-width: 420px;

    margin: 0 auto 22px;

    padding: 16px 20px;

    background: #FFF8E7;

    border: 2px dashed var(--accent);

    border-radius: 10px;

    text-align: center;

}

/* Controls the layout of the Pokémon information panel
   when it is visible. It centres the content and creates
   space between the previous button, information and next button. */
.type-summary:not([hidden]) {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 12px;

}

/* Allows the main information inside the Pokémon summary
   to use the available space without overflowing. */
.type-summary-content {

    flex: 1 1 auto;

    min-width: 0;

}

/* Controls the previous and next buttons in the Pokémon
   information panel. They are circular and use the current
   Pokémon type's accent colour. */
.type-nav-prev,

.type-nav-next {

    flex: 0 0 auto;

    width: 32px;

    height: 32px;

    border: none;

    border-radius: 50%;

    background: var(--accent);

    color: #fff;

    font-size: 1.1rem;

    line-height: 1;

    cursor: pointer;

    transition: background 0.15s ease, transform 0.1s ease;

}

/* Changes the previous and next button colour when the
   user hovers over them. */
.type-nav-prev:hover,

.type-nav-next:hover {

    background: var(--accent-dark);

}

/* Slightly shrinks the previous and next buttons while
   the user is actively pressing them. */
.type-nav-prev:active,

.type-nav-next:active {

    transform: scale(0.92);

}

/* Controls the Pokémon name/title inside the summary panel.
   It uses the Pokémon-style font and the darker accent colour. */
.type-summary h4 {

    font-family: var(--font-display);

    font-size: 0.95rem;

    color: var(--accent-dark);

    margin: 0 0 8px;

}

/* Controls the description text inside the Pokémon summary.
   It removes the default paragraph margin and uses the
   softer text colour and smaller font size. */
.type-summary p {

    margin: 0;

    color: var(--ink-soft);

    font-size: 0.95rem;

}

/* Makes the featured Pokémon thumbnails and their layout
   smaller on screens 600px wide or less. */
@media (max-width: 600px) {

    /* Reduces the normal featured Pokémon thumbnail size
       on mobile devices. */
    .type-thumb { width: 68px; height: 68px; }

    /* Keeps the first featured Pokémon larger than the others
       while reducing its size for mobile screens. */
    .type-thumb:first-child { width: 110px; height: 110px; }

    /* Reduces the spacing between featured Pokémon thumbnails
       on smaller screens. */
    .type-strip { gap: 12px; }

}

/* Changes the background of the lightbox overlay.
   This is the dark background shown when a gallery image
   is opened in the larger lightbox view. */
.sl-overlay { background: rgba(20, 20, 20, 0.92) !important; }

/* Changes the colour of the lightbox close button to
   the Pokémon yellow used elsewhere on the website. */
.sl-close { color: var(--poke-yellow) !important; }

/* Controls the previous and next arrows in the lightbox.
   It makes them circular, larger and uses the current
   Pokémon type accent colour. */
.sl-next, .sl-prev {

    background: var(--accent) !important;

    border-radius: 50% !important;

    width: 44px !important;

    height: 44px !important;

    opacity: 0.9 !important;

}

/* Changes the lightbox navigation arrows when the user
   hovers over them. They become the darker accent colour
   and become fully visible. */
.sl-next:hover, .sl-prev:hover {

    background: var(--accent-dark) !important;

    opacity: 1 !important;

}

/* Controls the caption shown underneath/over the image
   inside the lightbox. It gives the caption a dark transparent
   background and uses the website's normal body font. */
.sl-caption {

    background: rgba(0, 0, 0, 0.65) !important;

    font-family: var(--font-body) !important;

}