/* ══════════════════════════════════════════════════════════════════
   [hp_gallery] — event cards + pagination
   ══════════════════════════════════════════════════════════════════ */

.hp-gallery-container {
    --hp-accent: #e85d26;
    --hp-ink: #1a1612;
    --hp-muted: #6b6460;
    --hp-line: #e0dbd6;
    --hp-shadow: 0 6px 12px rgba(68, 199, 216, 0.342);
    --hp-shadow-hover: 0 8px 20px rgba(7, 141, 179, 0.671);

    width: 100%;
    margin: 40px 0;
    box-sizing: border-box;
    font-family: inherit;
    scroll-margin-top: 180px;
}

.hp-gallery-container *,
.hp-gallery-container *::before,
.hp-gallery-container *::after { box-sizing: border-box; }

/* ── Grid ──────────────────────────────────────────────────────────── */
.hp-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 4), minmax(0, 1fr));
    gap: 24px;
    width: 100%;
    transition: opacity 0.2s ease;
}

.hp-gallery-grid.hp-grid-loading {
    opacity: 0.45;
    pointer-events: none;
    filter: grayscale(0.3);
}

/* ── Card ──────────────────────────────────────────────────────────── */
@keyframes hp-card-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hp-gallery-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--hp-shadow);
    transition: transform 0.35s cubic-bezier(.22, .68, 0, 1.2), box-shadow 0.35s ease;
    animation: hp-card-in 0.5s ease both;
}

.hp-gallery-grid .hp-gallery-card:nth-child(2) { animation-delay: 0.05s; }
.hp-gallery-grid .hp-gallery-card:nth-child(3) { animation-delay: 0.10s; }
.hp-gallery-grid .hp-gallery-card:nth-child(4) { animation-delay: 0.15s; }
.hp-gallery-grid .hp-gallery-card:nth-child(n+5) { animation-delay: 0.20s; }

.hp-gallery-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--hp-shadow-hover);
}

/* ── Featured image = click target ─────────────────────────────────── */
.hp-gallery-image-wrapper {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 100 / 68;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    background: #f0ece6;
    cursor: pointer;
}

.hp-gallery-image-wrapper img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: cover;
    filter: saturate(0.92);
    transition: transform 0.5s cubic-bezier(.25, .46, .45, .94), filter 0.5s ease;
}

.hp-gallery-card:hover .hp-gallery-image-wrapper img {
    transform: scale(1.06);
    filter: saturate(1.08);
}

/* ── Photo count (single place) ────────────────────────────────────── */
.hp-gallery-image-count {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px 5px 9px;
    border-radius: 999px;
    background: rgba(10, 10, 10, 0.65);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.hp-gallery-image-count svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Body ──────────────────────────────────────────────────────────── */
.hp-gallery-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px 18px;
}

.hp-gallery-card-body h3 {
    margin: 0;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.hp-gallery-title {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--hp-ink);
    font: inherit;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    transition: color 0.2s ease;
}

.hp-gallery-title:hover { color:var(--hp-accent); }

.hp-gallery-card-body p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: 0;
    color: var(--hp-muted);
    font-size: 0.75rem;
    line-height: 1.5;
}

.hp-gallery-title:focus-visible,
.hp-page-btn:focus-visible,
.hp-page-num:focus-visible {
    outline: 3px solid var(--hp-accent);
    outline-offset: 3px;
    border-radius: 6px;
}

.hp-no-gallery {
    padding: 60px 20px;
    color: #a09890;
    font-size: 0.9375rem;
    text-align: center;
}

.hp-no-gallery p { margin: 0; }

/* ── Pagination ────────────────────────────────────────────────────── */
.hp-gallery-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
}

.hp-page-btn,
.hp-page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    margin: 0;
    border: 1.5px solid var(--hp-line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.hp-page-btn {
    flex-shrink: 0;
    width: 38px;
    padding: 0;
    color: var(--hp-ink);
}

.hp-page-btn svg {
    display: block;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hp-page-numbers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.hp-page-num {
    min-width: 38px;
    padding: 0 6px;
    color: #3a3330;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
}

.hp-page-btn:hover:not(:disabled),
.hp-page-num:hover:not(.active) {
    border-color: #c8c0b8;
    background: #f5f0eb;
    color: var(--hp-ink);
    transform: scale(1.05);
}

.hp-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.hp-page-num.active {
    border-color: var(--hp-accent);
    background: var(--hp-accent);
    box-shadow: 0 4px 12px rgba(232, 93, 38, 0.35);
    color: #fff;
    font-weight: 600;
    cursor: default;
}

.hp-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 38px;
    color: #a09890;
    font-size: 0.875rem;
    user-select: none;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .hp-gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
}

@media (max-width: 768px) {
    .hp-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

    .hp-gallery-pagination { gap: 4px; margin-top: 28px; }

    .hp-page-btn,
    .hp-page-num {
        width: auto;
        min-width: 34px;
        height: 34px;
        font-size: 0.75rem;
    }

    .hp-page-btn { width: 34px; }
}

@media (max-width: 480px) {
    .hp-gallery-grid { gap: 10px; }
    .hp-gallery-card-body h3 { font-size: 0.875rem; }
    .hp-gallery-card-body p  { font-size: 0.6875rem; }
}

@media (prefers-reduced-motion: reduce) {
    .hp-gallery-card { animation: none; transition: none; }
    .hp-gallery-image-wrapper img { transition: none; }
}

/* ══════════════════════════════════════════════════════════════════
   ALBUM PAGE — masonry grid shown in place of the archive cards.
   No background of its own: it sits on your page like the cards do.
   Selectors are prefixed so theme button/img styles cannot win.
   ══════════════════════════════════════════════════════════════════ */

.hp-gallery-container .hp-album[hidden] { display: none; }

/* No part of the album may be used as a scroll anchor. Otherwise the browser
   keeps the "Load More" button in place and scrolls the page down by the
   height of the photos that were just added. */
.hp-gallery-container .hp-album,
.hp-gallery-container .hp-album * { overflow-anchor: none; }

.hp-gallery-container .hp-album {
    box-sizing: border-box;
    padding: 0;
    background: transparent;
    color: var(--hp-ink);
}

.hp-gallery-container .hp-album-bar {
    width: 100%;
    margin: 0 0 28px;
    padding: 22px 28px 24px;
    border: 1px solid #d9eadf;
    border-radius: 18px;
    background: linear-gradient(135deg, #eef7f1 0%, #f8fbf9 60%, #fff8e8 100%);
    text-align: left;
}

.hp-gallery-container .hp-album-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hp-gallery-container .hp-album-title {
    margin: 20px 0 0;
    padding: 0;
    color: var(--hp-ink);
    font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem);
    font-weight: 700;
    line-height: 1.2;
}

/* Full description, full width */
.hp-gallery-container .hp-album-desc {
    margin: 10px 0 0;
    color: #4a433e;
    font-size: 0.9375rem;
    line-height: 1.7;
    white-space: pre-line;
}

.hp-gallery-container .hp-album-desc[hidden] { display: none; }

.hp-gallery-container .hp-album-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 7px 14px 7px 11px;
    border: 1px solid #d9eadf;
    border-radius: 999px;
    background: #fff;
    color: #0b5a04;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
}

.hp-gallery-container .hp-album-meta svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* One reset for every button inside the album */
.hp-gallery-container .hp-album button {
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
    text-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    min-height: 0;
    font-family: inherit;
}

.hp-gallery-container .hp-album .hp-album-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    height: auto;
    margin: 0;
    padding: 10px 18px 10px 14px;
    border: 0;
    border-radius: 999px;
    background: #142037;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.hp-gallery-container .hp-album .hp-album-back:hover,
.hp-gallery-container .hp-album .hp-album-back:focus-visible {
    background: #fbb034;
    color: #1a1612;
}

.hp-gallery-container .hp-album .hp-album-back:hover svg { transform: translateX(-3px); }

.hp-gallery-container .hp-album-back svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.2s ease;
}

/* Masonry */
.hp-gallery-container .hp-album-grid {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    overflow-anchor: none; /* the browser must not shift the page while photos load */
}

.hp-gallery-container .hp-album-col {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.hp-gallery-container .hp-album .hp-album-item {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: #f0ece6;
    color: inherit;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: zoom-in;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hp-gallery-container .hp-album .hp-album-item:hover {
    background: #f0ece6;
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.hp-gallery-container .hp-album .hp-album-item img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.hp-gallery-container .hp-album .hp-album-more {
    display: block;
    width: auto;
    height: auto;
    margin: 28px auto 0;
    padding: 12px 24px;
    border: 0;
    border-radius: 10px;
    background: #006b54;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.hp-gallery-container .hp-album .hp-album-more:hover:not(.is-loading) { background: #fbb034; color: #1a1612; }
.hp-gallery-container .hp-album .hp-album-more[hidden] { display: none; }
.hp-gallery-container .hp-album .hp-album-more.is-loading { opacity: 0.6; cursor: wait; }

.hp-gallery-container .hp-album .hp-album-item:focus-visible,
.hp-gallery-container .hp-album .hp-album-more:focus-visible,
.hp-gallery-container .hp-album .hp-album-back:focus-visible {
    outline: 3px solid var(--hp-accent);
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .hp-gallery-container .hp-album-bar { padding: 16px 16px 18px; border-radius: 14px; }
    .hp-gallery-container .hp-album-grid,
    .hp-gallery-container .hp-album-col { gap: 10px; }
    .hp-gallery-container .hp-album .hp-album-item { border-radius: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .hp-gallery-container .hp-album .hp-album-item { transition: none; }
}
