/* ═══════════════════════════════════════════════════════════════
   Explore the Area — the tenant's local guide
   An editorial page: cream paper, Playfair headlines, photographs set in a 12-column rhythm
   (7+5, 5+7, 4+4+4) with every second card dropped a little, so the guide reads like a printed
   travel piece rather than a tiled directory. Colours come from the tenant's own tokens:
   --color-navy (Primary), --color-brown (Secondary), --color-secondary (Accent).
   ═══════════════════════════════════════════════════════════════ */

.xa {
    --xa-ink: var(--color-secondary, #4A4036);
    --xa-ink-soft: rgba(74, 64, 54, 0.78);
    --xa-ink-muted: rgba(74, 64, 54, 0.58);
    --xa-line: rgba(44, 62, 80, 0.1);
    --xa-radius: 14px;
    --xa-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

    background: var(--color-background, #FDF8F3);
    /* The page reserves the fixed header's real height itself (measured by explore.js), instead
       of the wrapper's flat 80px — the header is shorter than that, and the gap showed the body's
       patterned background as a band between the header and the hero. */
    padding-top: var(--xa-header-h, 76px);
    padding-bottom: clamp(4rem, 8vw, 7rem);
    font-family: 'Montserrat', sans-serif;
}

body.page-explore .page-body-wrapper { padding-top: 0; }

/* ── Hero ─────────────────────────────────────────────────────── */
.xa-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: center;
    padding-top: clamp(2rem, 4.5vw, 3.5rem);
    padding-bottom: clamp(2rem, 4vw, 3rem);
}

.xa-hero--text {
    grid-template-columns: minmax(0, 46rem);
}

.xa-eyebrow {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--color-brown, #6B4423);
    margin: 0 0 1.1rem;
}

.xa-hero__title {
    font-family: 'Playfair Display', 'Amiri', serif;
    font-size: clamp(2.5rem, 5.2vw, 4.25rem);
    font-weight: 600;
    line-height: 1.04;
    letter-spacing: -0.015em;
    color: var(--xa-ink);
    margin: 0;
}

.xa-rule {
    display: block;
    width: 56px;
    height: 2px;
    background: var(--color-brown, #6B4423);
    margin: 1.6rem 0 1.4rem;
}

.xa-hero__intro {
    font-size: 1.02rem;
    line-height: 1.85;
    color: var(--xa-ink-soft);
    max-width: 44ch;
    margin: 0;
    white-space: pre-line;
}

/* Collage of the guide's own photographs: one tall, two stacked, the last one stepped down. */
.xa-collage {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0.9rem;
    /* Compact on purpose: the guide, not the hero, is what the visitor came for. */
    height: clamp(240px, 26vw, 340px);
}

.xa-collage img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    border-radius: var(--xa-radius);
    display: block;
}

.xa-collage--3 img:first-child { grid-row: 1 / span 2; }
.xa-collage--3 img:nth-child(3) { transform: translateY(1.5rem); }

.xa-collage--2 { grid-template-rows: 1fr; }
.xa-collage--2 img:nth-child(2) { height: 82%; align-self: end; }

.xa-collage--1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }

/* ── Filters ──────────────────────────────────────────────────── */
.xa-filters-bar {
    position: sticky;
    top: var(--xa-header-h, 76px);
    z-index: 20;
    background: rgba(253, 248, 243, 0.92);
    background: color-mix(in srgb, var(--color-background, #FDF8F3) 90%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--xa-line);
    border-bottom: 1px solid var(--xa-line);
}

.xa-filters {
    display: flex;
    gap: clamp(1.4rem, 3vw, 2.75rem);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}

.xa-filters::-webkit-scrollbar { display: none; }

.xa-filter {
    appearance: none;
    background: none;
    border: 0;
    position: relative;
    flex: 0 0 auto;
    padding: 1.15rem 0 1.05rem;
    min-height: 48px;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--xa-ink-muted);
    white-space: nowrap;
    cursor: pointer;
    scroll-snap-align: start;
    transition: color 0.25s ease;
}

.xa-filter::after {
    content: '';
    position: absolute;
    inset-inline: 0;
    bottom: -1px;
    height: 2px;
    background: var(--color-brown, #6B4423);
    transform: scaleX(0);
    transition: transform 0.4s var(--xa-ease);
}

.xa-filter:hover { color: var(--color-navy, #2C3E50); }

.xa-filter.is-active {
    color: var(--color-navy, #2C3E50);
    font-weight: 600;
}

.xa-filter.is-active::after { transform: scaleX(1); }

.xa-filter:focus-visible {
    outline: 2px solid var(--color-brown, #6B4423);
    outline-offset: -2px;
    border-radius: 3px;
}

.xa-filter__count {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    margin-inline-start: 0.3rem;
    transform: translateY(-0.45em);
    opacity: 0.7;
}

/* ── Grid ─────────────────────────────────────────────────────── */
.xa-guide { padding-top: clamp(2.25rem, 5vw, 4rem); }

.xa-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(1.5rem, 3vw, 2.75rem);
    row-gap: clamp(2.75rem, 5vw, 4.25rem);
    align-items: start;
}

.xa-card {
    grid-column: span var(--span, 6);
    min-width: 0;
}

.xa-card[hidden] { display: none; }

/* The drop that makes the grid flow. Only where there is room for it. */
.xa-card.is-shifted { margin-top: clamp(2rem, 5vw, 4.5rem); }

.xa-card__media {
    position: relative;
    /* Width over a shared height: cards side by side get (nearly) equal image heights whatever
       their span, so the stagger reads as intent rather than as mismatched photos. */
    aspect-ratio: var(--span, 6) / 4.4;
    border-radius: var(--xa-radius);
    overflow: hidden;
    background: var(--color-light-gray, #F8F1EA);
}

.xa-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 1.4s var(--xa-ease);
}

@media (hover: hover) {
    .xa-card:hover .xa-card__media img { transform: scale(1.045); }
}

/* No photo: a framed typographic plate with the category's mark, not a broken image. */
.xa-card__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-brown, #6B4423);
    background: #F6EFE7;
    /* Barely tinted paper: Secondary is often near-black, and a stronger mix turns the plate grey. */
    background: color-mix(in srgb, var(--color-brown, #6B4423) 4%, var(--color-light-gray, #F8F1EA));
}

.xa-card__placeholder::before {
    content: '';
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(107, 68, 35, 0.14);
    border: 1px solid color-mix(in srgb, var(--color-brown, #6B4423) 14%, transparent);
    border-radius: calc(var(--xa-radius) - 6px);
}

.xa-card__placeholder i {
    font-size: clamp(2rem, 3.6vw, 2.75rem);
    opacity: 0.55;
}

.xa-card__body {
    padding-top: 1.35rem;
    max-width: 54ch;
}

.xa-card__cat {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--color-brown, #6B4423);
    margin: 0 0 0.7rem;
}

.xa-card__title {
    font-family: 'Playfair Display', 'Amiri', serif;
    font-size: 1.45rem;
    font-weight: 600;
    line-height: 1.22;
    color: var(--xa-ink);
    margin: 0 0 0.65rem;
}

.xa-card[data-span="7"] .xa-card__title,
.xa-card[data-span="12"] .xa-card__title { font-size: clamp(1.6rem, 2.2vw, 1.95rem); }

.xa-card__desc {
    font-size: 0.92rem;
    line-height: 1.8;
    color: var(--xa-ink-soft);
    margin: 0 0 0.85rem;
}

.xa-card__addr {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--xa-ink-muted);
    margin: 0 0 0.9rem;
}

.xa-card__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.5rem;
}

.xa-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-navy, #2C3E50);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.5em;
    text-decoration-color: rgba(44, 62, 80, 0.25);
    transition: color 0.25s ease, text-decoration-color 0.25s ease;
}

.xa-link:hover {
    color: var(--color-brown, #6B4423);
    text-decoration-color: currentColor;
}

.xa-link:focus-visible {
    outline: 2px solid var(--color-brown, #6B4423);
    outline-offset: 3px;
    border-radius: 2px;
}

.xa-link i { font-size: 0.85em; }

/* Licence attribution for CC-licensed photos: present, legible, never competing with the guide. */
.xa-credits {
    margin-top: clamp(2rem, 4vw, 3rem);
    padding-top: 1rem;
    border-top: 1px solid var(--xa-line);
    font-size: 0.72rem;
    line-height: 1.6;
    color: var(--xa-ink-muted);
    white-space: pre-line;
}

/* One card alone on its row: photograph and text side by side instead of a banner. */
.xa-card--wide {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    column-gap: clamp(1.75rem, 4vw, 3.5rem);
    align-items: center;
}

.xa-card--wide .xa-card__media { aspect-ratio: 7 / 4.4; }
.xa-card--wide .xa-card__body { padding-top: 0; }

/* ── Entrance ─────────────────────────────────────────────────── */
/* Only once the script has run, so the guide is never invisible without it. */
.xa-js .xa-card {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.9s var(--xa-ease), transform 0.9s var(--xa-ease);
}

.xa-js .xa-card.is-in {
    opacity: 1;
    transform: none;
}

::view-transition-group(*) {
    animation-duration: 0.5s;
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ── Arabic ───────────────────────────────────────────────────── */
[lang="ar"] .xa { font-family: 'IBM Plex Sans Arabic', 'Montserrat', sans-serif; }

[lang="ar"] .xa-hero__title,
[lang="ar"] .xa-card__title {
    font-family: 'Amiri', 'Playfair Display', serif;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.35;
}

[lang="ar"] .xa-eyebrow,
[lang="ar"] .xa-card__cat,
[lang="ar"] .xa-link {
    letter-spacing: 0;
    text-transform: none;
}

[lang="ar"] .xa-eyebrow { font-size: 0.9rem; }
[lang="ar"] .xa-card__cat { font-size: 0.82rem; }
[lang="ar"] .xa-link { font-size: 0.88rem; }
[lang="ar"] .xa-filter { font-size: 0.92rem; letter-spacing: 0; }
[lang="ar"] .xa-hero__intro,
[lang="ar"] .xa-card__desc { line-height: 1.95; }

/* The arrow points out of the reading direction. */
[dir="rtl"] .xa-link .bi-arrow-up-right { transform: scaleX(-1); }

/* ── Tablet: two even columns, no stagger ─────────────────────── */
@media (max-width: 991.98px) {
    .xa-hero { grid-template-columns: minmax(0, 1fr); }
    .xa-collage { height: clamp(200px, 38vw, 280px); }

    /* The filter row scrolls sideways here; fade its trailing edge so that reads as "more". */
    .xa-filters {
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
        mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
        padding-inline-end: 48px;
    }
    [dir="rtl"] .xa-filters {
        -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent);
        mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent);
    }

    .xa-card,
    .xa-card--wide { grid-column: span 6; display: block; }
    .xa-card.is-shifted { margin-top: 0; }
    .xa-card__media,
    .xa-card--wide .xa-card__media { aspect-ratio: 4 / 3; }
    .xa-card--wide .xa-card__body { padding-top: 1.35rem; }
}

/* ── Phone: one column ────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .xa-collage { gap: 0.6rem; height: 180px; }
    .xa-collage--3 img:nth-child(3) { transform: translateY(0.75rem); }

    .xa-card,
    .xa-card--wide { grid-column: span 12; }
    .xa-grid { row-gap: 2.75rem; }
    .xa-card__media,
    .xa-card--wide .xa-card__media { aspect-ratio: 3 / 2; }
}

@media (prefers-reduced-motion: reduce) {
    .xa-js .xa-card { opacity: 1; transform: none; transition: none; }
    .xa-card__media img,
    .xa-filter::after { transition: none; }
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) { animation: none !important; }
}
