/* The gallery hero and the sticky facts strip, shared by the template trip page (design J,
   docs/plans/trip-page-redesign.md) and the experience and region pages
   (docs/plans/experience-page-redesign.md, 21 October 2026). The rules were moved out of
   trip-gallery.css and are scoped under .th-gallery, the class both pages put on the wrapper
   around GalleryHero / FactsBar. The trip page loads this file before trip-gallery.css.
   Colours: brand pink #D20158, ink #3D3D3D, hairline #E0E0E0, caption #757575. */

.th-gallery .tg-title {
    font-family: 'Roboto Serif', Georgia, serif;
}

/* ---- Hero ---- */

.th-gallery .tg-hero {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 8px;
    height: 360px;
    border-radius: 16px;
    overflow: hidden;
}

.th-gallery .tg-hero-single {
    grid-template-columns: minmax(0, 1fr);
}

.th-gallery .tg-hero-main {
    position: relative;
    overflow: hidden;
    background: #1B1B1F;
}

.th-gallery .tg-hero-link {
    display: block;
    position: absolute;
    inset: 0;
}

.th-gallery .tg-hero-main img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 35%;
    display: block;
}

.th-gallery .tg-hero-panel {
    pointer-events: none;
    position: absolute;
    left: 24px;
    bottom: 24px;
    right: 24px;
    max-width: 640px;
    padding: 18px 22px;
    color: #fff;
    background: rgba(18, 18, 22, .62);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
}

.th-gallery .tg-hero-empty {
    height: auto;
    background: #1B1B1F;
    padding: 32px;
}

.th-gallery .tg-hero-empty .tg-hero-panel {
    position: static;
    max-width: none;
}

.th-gallery .tg-kicker {
    margin: 0 0 8px;
    font-size: 12px;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 500;
    color: #E7AE4B;
}

.th-gallery .tg-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0;
}

.th-gallery .tg-title {
    margin: 0;
    font-size: 34px;
    line-height: 1.02;
    font-weight: 500;
    letter-spacing: -.01em;
    color: #fff;
}

.th-gallery .tg-title-row .trip-header-action-btn.share-btn {
    pointer-events: auto;
    flex-shrink: 0;
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .5);
    color: #fff;
}

.th-gallery .tg-title-row .trip-header-action-btn.share-btn:hover {
    background: rgba(255, 255, 255, .28);
    border-color: #fff;
    color: #fff;
}

.th-gallery .tg-hero-thumbs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-height: 0;
}

.th-gallery .tg-thumb {
    position: relative;
    display: block;
    overflow: hidden;
    background: #E0E0E0;
    min-height: 0;
}

.th-gallery .tg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.th-gallery .tg-thumb:hover img {
    transform: scale(1.03);
}

.th-gallery .tg-thumb-all {
    background: #1B1B1F;
    color: #fff;
    text-decoration: none;
}

.th-gallery .tg-thumb-all img {
    opacity: .55;
}

.th-gallery .tg-thumb-all-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    text-align: center;
}

.th-gallery .tg-facts {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    border-bottom: 1px solid #E0E0E0;
    margin-top: 4px;
}

.th-gallery .tg-facts-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between; /* spread across the full width (Florian, 9 October 2026) */
    gap: 8px 30px;
    margin: 0;
    padding: 12px 16px; /* a little room at both ends */
    list-style: none;
    font-size: 15.5px;
}

.th-gallery .tg-fact {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 24px;
}

.th-gallery .tg-fact-icon {
    width: 20px;
    height: 20px;
    flex: none;
    filter: grayscale(1) brightness(.55);
}

.th-gallery .tg-fact-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.th-gallery .tg-fact-value {
    font-weight: 600;
    white-space: nowrap;
}

.th-gallery .tg-fact:first-child .tg-tip-text,
.th-gallery .tg-fact:nth-child(2) .tg-tip-text,
.th-gallery .tg-fact:nth-child(3) .tg-tip-text {
    left: 0;
    transform: none;
}

.th-gallery .tg-fact:first-child .tg-tip-text::before,
.th-gallery .tg-fact:nth-child(2) .tg-tip-text::before,
.th-gallery .tg-fact:nth-child(3) .tg-tip-text::before {
    left: 12px;
    transform: rotate(45deg);
}

.th-gallery .tg-fact .ssr-distance-unit-toggle {
    background: none;
    border: 0;
    padding: 0 0 0 3px;
    font: inherit;
    font-weight: 600;
    color: #D20158;
    cursor: pointer;
    text-decoration: underline dotted;
}

@media (max-width: 899px) {
    .th-gallery .tg-hero {
            grid-template-columns: minmax(0, 1fr);
            grid-template-rows: 300px 72px;
            height: auto;
        }

    .th-gallery .tg-hero-single {
            grid-template-rows: 300px;
        }

    .th-gallery .tg-hero-thumbs {
            grid-template-columns: repeat(4, minmax(0, 1fr));
            grid-template-rows: minmax(0, 1fr);
        }

    .th-gallery .tg-hero-panel {
            left: 12px;
            right: 12px;
            bottom: 12px;
            padding: 14px 16px;
        }

    .th-gallery .tg-title {
            font-size: 24px;
        }

    .th-gallery .tg-thumb-all-label {
            font-size: 12px;
            gap: 4px;
        }

    .th-gallery .tg-thumb-all-label svg {
            width: 18px;
            height: 18px;
        }

}

@media (max-width: 480px) {
    .th-gallery .tg-facts-list {
            gap: 8px 20px;
        }

}

@media (max-width: 640.98px) {
    .th-gallery .tg-facts {
            margin-left: -16px;
            margin-right: -16px;
            padding: 0 16px;
        }

    .th-gallery .tg-hero:not(.tg-hero-empty) {
            display: flex;
            flex-direction: column;
            gap: 8px;
            height: auto;
            border-radius: 0;
            overflow: visible;
        }

    .th-gallery .tg-hero-main {
            display: contents;
        }

    .th-gallery .tg-hero-link {
            position: relative;
            inset: auto;
            height: 230px;
            border-radius: 14px;
            overflow: hidden;
            background: #1B1B1F;
        }

    .th-gallery .tg-hero-thumbs {
            order: 1;
            height: 92px;
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

    .th-gallery .tg-hero-thumbs .tg-thumb:nth-child(3):not(:last-child) {
            display: none;
        }

    .th-gallery .tg-hero-thumbs:has(.tg-thumb:nth-child(2):last-child) {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

    .th-gallery .tg-hero-thumbs:has(.tg-thumb:only-child) {
            grid-template-columns: minmax(0, 1fr);
        }

    .th-gallery .tg-thumb {
            border-radius: 8px;
        }

    .th-gallery .tg-hero-main .tg-hero-panel {
            order: -1;
            position: static;
            pointer-events: auto;
            max-width: none;
            padding: 14px 0 6px;
            background: none;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
            border-radius: 0;
            color: #3D3D3D;
        }

    .th-gallery .tg-hero-main .tg-kicker {
            color: #D20158;
        }

    .th-gallery .tg-hero-main .tg-title {
            font-size: 26px;
            color: #3D3D3D;
        }

    .th-gallery .tg-hero-main .trip-header-action-btn.share-btn {
            background: #fff;
            border-color: #D20158;
            color: #D20158;
        }

    .th-gallery .tg-hero-main .trip-header-action-btn.share-btn:hover {
            background: #D20158;
            border-color: #D20158;
            color: #fff;
        }

    .th-gallery .tg-facts-list {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px 14px;
            padding: 14px 0;
            font-size: 15px;
        }

    .th-gallery .tg-fact {
            min-width: 0;
        }

    .th-gallery .tg-fact-value {
            white-space: normal;
        }

}


/* Fewer than four thumbnails (a page with two to four photos): no empty cells. One thumbnail
   takes the column, two share one row, the third of three spans the bottom row. */
.th-gallery .tg-hero-thumbs:has(.tg-thumb:only-child) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}

.th-gallery .tg-hero-thumbs:has(.tg-thumb:nth-child(2):last-child) {
    grid-template-rows: minmax(0, 1fr);
}

.th-gallery .tg-hero-thumbs:has(.tg-thumb:nth-child(3):last-child) .tg-thumb:nth-child(3) {
    grid-column: span 2;
}

/* ---- Place pages: the characters painted on the photo, the facts with their labels ---- */

/* The experience's or region's two characters, top right on the big photo, as on the home
   tiles (the Ma Shan Zheng face is loaded by the page that sets them). */
.th-gallery .tg-hero-brush {
    position: absolute;
    right: 28px;
    top: 18px;
    color: #fff;
    font-family: 'Ma Shan Zheng', 'KaiTi', serif;
    font-size: 92px;
    line-height: .95;
    writing-mode: vertical-rl;
    opacity: .92;
    text-shadow: 0 2px 18px rgba(0, 0, 0, .35);
    pointer-events: none;
}

/* The facts of an experience or region page: "Trip length 7 to 21 days", a grey label and a
   bold value, hairlines between them, left-aligned (the trip strip spreads its icon facts).
   The separator is on the right of each fact with the same gap on both sides, so a wrapped
   second row starts at the left edge like the first. */
.th-gallery .tg-facts-labelled .tg-facts-list {
    justify-content: flex-start;
    gap: 10px 0;
    padding: 12px 0;
    font-size: 15px;
}

.th-gallery .tg-facts-labelled .tg-fact {
    padding-right: 18px;
    margin-right: 18px;
    border-right: 1px solid #E0E0E0;
    gap: 6px;
}

.th-gallery .tg-facts-labelled .tg-fact:last-child {
    padding-right: 0;
    margin-right: 0;
    border-right: 0;
}

.th-gallery .tg-facts-labelled .tg-fact-k {
    color: #757575;
}

.th-gallery .tg-fact-link a {
    font-weight: 600;
    color: #D20158;
    text-decoration: none;
    white-space: nowrap;
}

.th-gallery .tg-fact-link a:hover {
    text-decoration: underline;
}

@media (max-width: 899px) {
    .th-gallery .tg-hero-brush {
        font-size: 56px;
        right: 16px;
        top: 12px;
    }
}

@media (max-width: 640.98px) {
    /* On phones the title sits above the photo and the main tile dissolves into rows (above),
       so the characters have no photo box to sit on. */
    .th-gallery .tg-hero-brush {
        display: none;
    }

    /* The place pages' wrapper has the guide gutter (24px), not the trip page's 16px. */
    .gh-wrap.th-gallery .tg-facts {
        margin-left: -24px;
        margin-right: -24px;
        padding: 0 24px;
    }

    /* Each fact as a small block: the label above its value, two per row. */
    .th-gallery .tg-facts-labelled .tg-fact {
        padding: 0;
        margin: 0;
        border-right: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .th-gallery .tg-facts-labelled .tg-fact-k {
        font-size: 12px;
        letter-spacing: .04em;
        text-transform: uppercase;
    }
}
