/* Homepage: a search-first globe hero. Colours come from tokens.css (the
   site-wide monochrome palette); this file only lays out the page. */

.site-header {
    border-block-end-color: transparent;
}

/* ---- Globe hero ---------------------------------------------------------- */

.globe-hero {
    position: relative;
    display: grid;
    place-items: center;
    min-height: calc(100svh - 4.5rem);
    /* 3.5rem more below than the plain padding: lifts the centred text 28px,
       the same as the globe (globe.js LIFT). */
    padding: var(--space-6) var(--container-padding) calc(var(--space-8) + 3.5rem);
    overflow: hidden;
    isolation: isolate;
}

.globe-hero__canvas {
    position: absolute;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    touch-action: pan-y;
    cursor: grab;
}

.globe-hero__canvas.is-dragging {
    cursor: grabbing;
}

.globe-hero__canvas.is-over-destination {
    cursor: pointer;
}

/* The text layer lets drags and clicks reach the globe, except on controls. */
.globe-hero__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-5);
    width: min(100%, 48rem);
    text-align: center;
    pointer-events: none;
}

.globe-hero__inner > * {
    pointer-events: auto;
}

.globe-hero__title {
    margin: 0;
    font-size: clamp(2rem, 4.6vw, 3.25rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.05em;
    pointer-events: none;
}

:lang(fa) .globe-hero__title,
:lang(zh) .globe-hero__title {
    letter-spacing: 0;
    line-height: 1.4;
}

.globe-hero__heading {
    display: grid;
    gap: var(--space-2);
    pointer-events: none;
}

.globe-hero__stats {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
}

.globe-hero__search {
    position: relative;
    width: min(100%, 36rem);
}

.globe-hero__search input {
    width: 100%;
    height: 3.5rem;
    padding-inline: 3rem var(--space-4);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    /* Frosted glass: a faint tinted gradient over a blurred globe, with a
       one-pixel highlight along the top edge. */
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    color: var(--color-text-primary);
    font: inherit;
    font-size: 1.0625rem;
    box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
    transition: border-color 0.15s ease;
}

.globe-hero__search input::placeholder {
    color: var(--color-text-muted);
}

.globe-hero__search input:hover {
    border-color: var(--color-border-strong);
}

.globe-hero__search input:focus {
    outline: none;
    border-color: var(--color-border-focus);
}

.globe-hero__search input::-webkit-search-cancel-button {
    display: none;
}

.globe-hero__icon {
    position: absolute;
    inset-inline-start: 1.1rem;
    top: 50%;
    width: 1.15rem;
    height: 1.15rem;
    z-index: 1; /* above the input, whose backdrop blur makes its own layer */
    transform: translateY(-50%);
    fill: none;
    stroke: var(--color-text-muted);
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
}

/* Quick links: a labelled row of destinations and one of industries, each
   ending in a way out to the full list. Rows scroll sideways on phones. */
/* One grid for both rows, so labels and first chips line up. */
.globe-hero__links {
    display: grid;
    grid-template-columns: auto minmax(0, auto);
    justify-content: center;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    width: 100%;
}

.quick-row {
    display: contents;
}

.quick-row__label {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    text-align: end;
    text-transform: uppercase;
}

:lang(fa) .quick-row__label,
:lang(zh) .quick-row__label {
    letter-spacing: 0;
    font-size: var(--font-size-sm);
}

.quick-row__items {
    display: flex;
    gap: var(--space-2);
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.quick-row__chip,
.quick-row__all {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.3rem 0.85rem;
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.quick-row__chip {
    background: color-mix(in srgb, var(--color-surface-page) 60%, transparent);
    color: var(--color-text-secondary);
}

.quick-row__chip:hover {
    border-color: var(--color-border-strong);
    color: var(--color-text-primary);
}

/* The way out: no fill, dashed edge, so it reads as "more", not one more option. */
.quick-row__all {
    border-style: dashed;
    color: var(--color-text-muted);
}

.quick-row__all:hover {
    border-style: solid;
    border-color: var(--color-border-strong);
    color: var(--color-text-primary);
}

.quick-row__all svg {
    width: 0.9rem;
    height: 0.9rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

[dir="rtl"] .quick-row__all svg {
    transform: scaleX(-1);
}

@media (max-width: 40rem) {
    /* Phones: a calmer headline that sits on two lines without dominating. */
    .globe-hero__title {
        font-size: 1.625rem;
        letter-spacing: -0.03em;
    }

    .globe-hero__stats {
        font-size: var(--font-size-sm);
    }

    .globe-hero__links {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-1);
    }

    .quick-row__label {
        text-align: center;
    }

    .quick-row + .quick-row .quick-row__label {
        margin-block-start: var(--space-2);
    }

    .quick-row__items {
        overflow-x: auto;
        scrollbar-width: none;
        padding-inline: var(--space-1);
        /* Centred when it fits, scrolls from the start when it doesn't. */
        justify-content: safe center;
    }

    .quick-row__items::-webkit-scrollbar {
        display: none;
    }
}

/* The globe's country card: positioned beside the clicked dot by globe.js. */
.globe-hero__popup {
    z-index: 3;
}

.globe-hero__more {
    position: absolute;
    inset-block-end: var(--space-4);
    left: 50%;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    transform: translateX(-50%);
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
}

:lang(fa) .globe-hero__more,
:lang(zh) .globe-hero__more {
    letter-spacing: 0;
}

.globe-hero__more svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.globe-hero__more:hover {
    color: var(--color-text-primary);
}

/* ---- Sections below the fold ----------------------------------------------- */

.home-section {
    padding-block: var(--space-7);
    border-block-start-color: var(--color-border-subtle);
}

.home-section h2 {
    margin-block-end: var(--space-5);
    font-size: var(--font-size-xl);
    font-weight: 600;
    letter-spacing: -0.02em;
}

:lang(fa) .home-section h2,
:lang(zh) .home-section h2 {
    letter-spacing: 0;
}

/* Small links under a homepage section ("All industries", "Ask us on WhatsApp"). */
.open-now__more {
    margin-block: var(--space-4) 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.open-now__more a {
    color: var(--color-text-link);
    text-decoration: underline;
}

/* One line for organizers, above the footer. */
.home-organizers {
    padding-block: var(--space-5);
    border-block-start: 1px solid var(--color-border-subtle);
}

.home-organizers__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.home-organizers__row p {
    margin: 0;
    color: var(--color-text-secondary);
}

/* Homepage grid: a fixed number of columns per width, so the "All exhibitions"
   tile can take exactly what is left of the last row (the grid never ends in a
   hole), or a slim full-width row when the cards fill their rows. */
.home-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-grid:has(> .exhibition-card:nth-child(3n):nth-last-child(2)) .exhibition-grid__all {
    grid-column: 1 / -1;
}

.home-grid:has(> .exhibition-card:nth-child(3n + 1):nth-last-child(2)) .exhibition-grid__all {
    grid-column: span 2;
}

@media (max-width: 52rem) {
    .home-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-grid:has(> .exhibition-card:nth-child(3n):nth-last-child(2)) .exhibition-grid__all,
    .home-grid:has(> .exhibition-card:nth-child(3n + 1):nth-last-child(2)) .exhibition-grid__all {
        grid-column: auto;
    }

    .home-grid:has(> .exhibition-card:nth-child(2n):nth-last-child(2)) .exhibition-grid__all {
        grid-column: 1 / -1;
    }
}

@media (max-width: 36rem) {
    .home-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.exhibition-grid__all {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    min-height: 4rem;
    border: 1px dashed var(--color-border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    color: var(--color-text-secondary);
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.exhibition-grid__all:hover {
    border-style: solid;
    border-color: var(--color-border-strong);
    color: var(--color-text-primary);
}

.exhibition-grid__all-title {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    font-weight: var(--font-weight-medium);
}

.exhibition-grid__all-count {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.exhibition-grid__all svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

[dir="rtl"] .exhibition-grid__all svg {
    transform: scaleX(-1);
}

@media (prefers-reduced-motion: reduce) {
    .globe-hero__search input,
    .quick-row__chip,
    .quick-row__all,
    .exhibition-grid__all {
        transition: none;
    }
}
