/*
 * Gallery Likes – Stylesheet v3
 * Größen werden über CSS-Custom-Properties gesteuert,
 * die das PHP-Plugin inline setzt (wp_add_inline_style).
 */

/* ── Fallback-Werte (greifen, wenn PHP-Inline-CSS fehlt) ─────── */
:root {
    --gl-font-size:  14px;
    --gl-heart-size: 16px;
    --gl-pad-v:       6px;   /* ≈ btn_padding × 0.75 */
    --gl-pad-h:       8px;   /* = btn_padding */
}

/* ── Gutenberg: figure als Positionierungskontext ────────────── */
.wp-block-gallery .blocks-gallery-item figure {
    position: relative;
}

/* Verhindert, dass der Button vom li abgeschnitten wird */
.wp-block-gallery .blocks-gallery-item {
    overflow: visible;
}

/* ── Like-Button ─────────────────────────────────────────────── */
.gl-like-btn {
    /* Positionierung */
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 10;

    /* Layout */
    display: inline-flex;
    align-items: center;
    gap: calc( var(--gl-font-size) * 0.35 );
    padding: var(--gl-pad-v) var(--gl-pad-h);

    /* Optik */
    background-color: rgba(0, 0, 0, 0.45);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;

    /* Typografie – via CSS-Variable einstellbar */
    font-family: inherit;
    font-size: var(--gl-font-size);
    font-weight: 600;
    line-height: 1;

    transition: background-color 0.2s ease, transform 0.15s ease;
}

.gl-like-btn:hover,
.gl-like-btn:focus-visible {
    background-color: rgba(0, 0, 0, 0.65);
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.gl-like-btn:active {
    transform: scale(0.93);
}

/* ── Herz-Icon – Größe via CSS-Variable ──────────────────────── */
.gl-heart {
    width:  var(--gl-heart-size);
    height: var(--gl-heart-size);
    fill: rgba(255, 255, 255, 0.75);
    flex-shrink: 0;
    transition: fill 0.2s ease;
}

.gl-liked .gl-heart {
    fill: var(--wp--preset--color--vivid-red,
          var(--wp--preset--color--primary,
          var(--color-accent,
          #e0245e)));
}

/* ── Zahl neben dem Herz ─────────────────────────────────────── */
.gl-count {
    display: inline-block;
    min-width: 1ch;
    text-align: center;
}

/* ── Bounce-Animation ────────────────────────────────────────── */
@keyframes gl-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.4); }
    70%  { transform: scale(0.88); }
    100% { transform: scale(1); }
}

.gl-heart.gl-pop {
    animation: gl-pop 0.35s ease forwards;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    .gl-like-btn {
        bottom: 6px;
        right: 6px;
    }
}

/* ── Reduzierte Bewegung ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .gl-like-btn,
    .gl-heart { transition: none; }
    .gl-heart.gl-pop { animation: none; }
}
