/*
 * Gallery pages: /media/photos/ (photos.php) and /gallery/<slug>/ (single-gallery.php)
 * Loaded only by those two templates. Delete this file + restore the templates to revert.
 */

/* ── Hero / breadcrumb ─────────────────────────────────────────── */

section.bread_crumb.hc-gallery-hero {
    height: auto;
    min-height: clamp(240px, 34vw, 400px);
    display: flex;
    align-items: center;
    padding-block: clamp(56px, 8vw, 96px);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

section.bread_crumb.hc-gallery-hero::before {
    top: 0;
    left: 0;
    background: linear-gradient(180deg, rgba(24, 14, 40, 0.42) 0%, rgba(24, 14, 40, 0.68) 100%) !important;
}

.hc-gallery-hero .container {
    width: 100%;
}

.hc-gallery-hero .breadcrumb_content {
    padding-top: 0;
}

.hc-gallery-hero .breadcrumb_content h1 {
    max-width: 900px;
    margin: 0 auto 22px;
    font-size: clamp(1.875rem, 1.1rem + 3.2vw, 3.125rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-wrap: balance;
    overflow-wrap: break-word;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25);
}

/* Long gallery titles (60+ characters) get a calmer size so they stay readable */
.hc-gallery-hero.hc-gallery-hero--long .breadcrumb_content h1 {
    font-size: clamp(1.25rem, 0.9rem + 1.6vw, 2.125rem);
    line-height: 1.35;
}

.hc-gallery-hero .breadcrumb_content p {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2px 8px;
    max-width: 100%;
    margin: 0;
    padding: 8px 22px;
    font-size: 15px;
    line-height: 1.45;
    border-radius: 999px;
}

.hc-gallery-hero .breadcrumb_content p a {
    text-decoration: none;
    text-underline-offset: 3px;
}

.hc-gallery-hero .breadcrumb_content p a:hover {
    text-decoration: underline;
}

.hc-gallery-hero .breadcrumb_content p a:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
    border-radius: 2px;
}

.hc-gallery-hero .breadcrumb_content .bi-chevron-right {
    opacity: 0.75;
    line-height: 1;
}

@media (max-width: 600px) {
    section.bread_crumb.hc-gallery-hero {
        min-height: 220px;
        padding-block: 44px;
    }

    .hc-gallery-hero .breadcrumb_content h1 {
        margin-bottom: 16px;
    }

    .hc-gallery-hero .breadcrumb_content p {
        padding: 7px 16px;
        font-size: 14px;
        border-radius: 18px;
    }
}

/* ── Photo albums index (/media/photos/) ───────────────────────── */

section.hc-albums {
    padding-bottom: clamp(56px, 7vw, 96px);
}

.hc-albums__grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: clamp(32px, 3.5vw, 48px) clamp(20px, 2.5vw, 32px);
}

.hc-album__link {
    display: block;
    color: inherit;
    text-decoration: none;
    border-radius: 8px;
}

.hc-album__link:focus-visible {
    outline: 3px solid #5b358c;
    outline-offset: 8px;
}

/* Cover with two offset sheets behind it, so each tile reads as an album of photos */
.hc-album__cover {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    margin: 12px 12px 0 0;
}

.hc-album__cover::before,
.hc-album__cover::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 6px;
    transition: transform 0.35s ease;
}

.hc-album__cover::after {
    background: #e4dbef;
    transform: translate(12px, -12px);
}

.hc-album__cover::before {
    z-index: 1;
    background: #bca9d6;
    transform: translate(6px, -6px);
}

.hc-album__cover img,
.hc-album__placeholder {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    background: #5b358c;
}

.hc-album__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 2rem;
}

.hc-album__link:hover .hc-album__cover::after,
.hc-album__link:focus-visible .hc-album__cover::after {
    transform: translate(16px, -16px) rotate(1.5deg);
}

.hc-album__link:hover .hc-album__cover::before,
.hc-album__link:focus-visible .hc-album__cover::before {
    transform: translate(8px, -8px) rotate(0.75deg);
}

.hc-album__body {
    display: block;
    padding-top: 16px;
    padding-right: 12px;
}

.hc-album__title {
    margin: 0 0 6px;
    font-family: 'Libre Baskerville', 'Tajawal', serif;
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.45;
    color: #2a1b40;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.hc-album__link:hover .hc-album__title {
    color: #5b358c;
    text-decoration: underline;
}

.hc-album__meta {
    display: block;
    font-family: 'Source Sans 3', 'Tajawal', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.4;
    color: #625a70;
}

/* ── Gallery pages (/media/photos/<album>/ and /gallery/<slug>/) ── */

section.hc-gallery-page {
    padding-block: clamp(28px, 4vw, 48px) clamp(56px, 7vw, 96px);
}

.hc-gallery-page__nav {
    margin-bottom: clamp(24px, 3.5vw, 40px);
}

.hc-backlink {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'Source Sans 3', 'Tajawal', sans-serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: #5b358c;
    text-decoration: none;
    text-underline-offset: 4px;
}

.hc-backlink:hover {
    color: #43266b;
    text-decoration: underline;
}

.hc-backlink:focus-visible {
    outline: 3px solid #5b358c;
    outline-offset: 4px;
    border-radius: 2px;
}

.hc-gallery {
    scroll-margin-top: 24px;
}

/* A hairline between galleries marks where one event's photos end and the next begin */
.hc-gallery + .hc-gallery {
    margin-top: clamp(44px, 5.5vw, 72px);
    padding-top: clamp(44px, 5.5vw, 72px);
    border-top: 1px solid #e5deee;
}

.hc-gallery__header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 32px;
    margin-bottom: clamp(16px, 2vw, 24px);
}

.hc-gallery__title {
    flex: 1 1 32rem;
    max-width: 62ch;
    margin: 0;
    font-family: 'Libre Baskerville', 'Tajawal', serif;
    font-size: clamp(1.125rem, 0.95rem + 0.75vw, 1.5rem);
    font-weight: 700;
    line-height: 1.45;
    color: #2a1b40;
    text-wrap: pretty;
}

.hc-gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 10px;
}

.hc-gallery__item {
    position: relative;
    display: block;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: 4px;
    background: #ece6f3;
}

.hc-gallery__grid--square .hc-gallery__item {
    aspect-ratio: 1 / 1;
}

.hc-gallery__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.hc-gallery__item:hover img {
    transform: scale(1.03);
}

.hc-gallery__item:focus-visible {
    outline: 3px solid #5b358c;
    outline-offset: 3px;
}

.hc-gallery__empty {
    color: #625a70;
}

@media (max-width: 600px) {
    .hc-gallery__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .hc-gallery__title {
        flex-basis: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hc-album__cover::before,
    .hc-album__cover::after,
    .hc-gallery__item img {
        transition: none;
    }
}
