/*
 * Home page sections below the hero: Featured Workspace, Explore by Category and Popular
 * Cities (resources/views/frontend/index.blade.php, partials/featured-spaces.blade.php).
 *
 * Hand-written for the same reason as home-search.css: the public site's Tailwind bundle is
 * purged from an old build, so new utilities would silently not exist.
 *
 * The same frosted glass as the hero search, on a plain light background (.hx-zone). Cards
 * rise in as they scroll into view (.hx-reveal, set by the page script), lift on hover, and a
 * light follows the pointer across them (--hx-x / --hx-y).
 *
 * Entrance fades run on the glass card itself, never on a wrapper around it: an ancestor
 * with opacity < 1 becomes a backdrop root and the glass would stop frosting mid-fade.
 */

.hx-zone {
    --hx-ink: #0f172a;
    --hx-ink-2: #1e293b;
    --hx-muted: #475569;
    --hx-faint: #64748b;
    --hx-brand: #2563eb;
    --hx-brand-ink: #1d4ed8;
    --hx-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --hx-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --hx-radius: 24px;

    position: relative;
    background: #f8fafc;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--hx-ink);
}

.hx-section {
    position: relative;
    padding: 4rem 0;
}

@media (min-width: 768px) {
    .hx-section {
        padding: 6rem 0;
    }
}

.hx-section + .hx-section {
    padding-top: 1rem;
}

/* A short section (the category tiles) keeps less room below it. */
.hx-section--tight {
    padding-bottom: 2.5rem;
}

@media (min-width: 768px) {
    .hx-section--tight {
        padding-bottom: 3.5rem;
    }
}

@media (min-width: 768px) {
    .hx-section + .hx-section {
        padding-top: 2rem;
    }
}

/* ── Section heads ─────────────────────────────────────────────────────── */

.hx-head {
    margin-bottom: 2.5rem;
}

@media (min-width: 768px) {
    .hx-head {
        margin-bottom: 3.25rem;
    }
}

.hx-head--center {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 48rem;
    margin-inline: auto;
    text-align: center;
}

.hx-head--split {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem 2rem;
}

.hx-head__text {
    min-width: 0;
    max-width: 48rem;
}

.hx-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0.4375rem 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 999px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.55));
    -webkit-backdrop-filter: blur(12px) saturate(170%);
    backdrop-filter: blur(12px) saturate(170%);
    box-shadow: inset 0 1px 0 #fff, 0 8px 20px -12px rgba(37, 99, 235, 0.55);
    color: var(--hx-brand-ink);
    font: 700 0.75rem/1 'Inter', system-ui, sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hx-eyebrow__dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--hx-brand);
    animation: hx-ping 2.6s ease-out infinite;
}

.hx-title {
    margin: 0 0 0.75rem;
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    font-size: clamp(1.75rem, 1.25rem + 1.6vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--hx-ink);
    text-wrap: balance;
}

.hx-lead {
    margin: 0;
    max-width: 40rem;
    color: var(--hx-muted);
    font-size: 1rem;
    line-height: 1.6;
    text-wrap: pretty;
}

/* Glass pill link ("View all spaces", "View All Cities"). */
.hx-pill-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8125rem 1.375rem;
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 999px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.58));
    -webkit-backdrop-filter: blur(16px) saturate(170%);
    backdrop-filter: blur(16px) saturate(170%);
    box-shadow: inset 0 1px 0 #fff, 0 10px 26px -16px rgba(15, 23, 42, 0.45);
    color: var(--hx-ink-2);
    font: 600 0.9375rem/1 'Inter', system-ui, sans-serif;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition:
        transform 0.4s var(--hx-spring),
        box-shadow 0.35s var(--hx-ease),
        color 0.25s var(--hx-ease);
}

.hx-pill-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.35s var(--hx-spring);
}

.hx-pill-link:hover {
    color: var(--hx-brand-ink);
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 #fff, 0 16px 32px -16px rgba(37, 99, 235, 0.55);
}

.hx-pill-link:hover svg {
    transform: translateX(3px);
}

.hx-pill-link:active {
    transform: scale(0.96);
    transition-duration: 0.12s;
}

.hx-pill-link:focus-visible,
.hx-card:focus-visible,
.hx-credits a:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

.hx-actions {
    display: flex;
    justify-content: center;
    margin-top: 2.5rem;
}

.hx-empty {
    grid-column: 1 / -1;
    padding: 2rem;
    border: 1px dashed rgba(15, 23, 42, 0.15);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.55);
    color: var(--hx-faint);
    text-align: center;
}

/* ── Glass card (shared) ───────────────────────────────────────────────── */

.hx-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: var(--hx-radius);
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.56));
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    backdrop-filter: blur(20px) saturate(170%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -1px 0 rgba(255, 255, 255, 0.35),
        0 1px 2px rgba(15, 23, 42, 0.05),
        0 22px 44px -28px rgba(15, 23, 42, 0.45);
    color: var(--hx-ink);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition:
        transform 0.5s var(--hx-ease),
        box-shadow 0.5s var(--hx-ease),
        border-color 0.3s var(--hx-ease);
}

/* Everything inside sits above the pointer light. */
.hx-card > * {
    position: relative;
    z-index: 1;
}

/* A soft light that follows the pointer (position set by the page script). */
.hx-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background: radial-gradient(420px circle at var(--hx-x, 50%) var(--hx-y, -20%), rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 45%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--hx-ease);
}

/* And a coloured rim that brightens on the edge nearest the pointer. */
.hx-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    z-index: 3;
    padding: 1px;
    border-radius: inherit;
    background: radial-gradient(260px circle at var(--hx-x, 50%) var(--hx-y, 0%), rgba(96, 165, 250, 0.95), rgba(167, 139, 250, 0.55) 40%, rgba(167, 139, 250, 0) 70%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--hx-ease);
}

@media (hover: hover) {
    .hx-card:hover {
        transform: translateY(-6px);
        border-color: rgba(255, 255, 255, 1);
        box-shadow:
            inset 0 1px 0 #fff,
            inset 0 -1px 0 rgba(255, 255, 255, 0.4),
            0 2px 4px rgba(15, 23, 42, 0.04),
            0 34px 60px -30px rgba(37, 99, 235, 0.45);
    }

    .hx-card:hover::before,
    .hx-card:hover::after {
        opacity: 1;
    }
}

.hx-card:active {
    transform: translateY(-2px) scale(0.985);
    transition-duration: 0.15s;
}

/* Round arrow chip: tilted up-right at rest, swings level and fills on hover. */
.hx-arrow {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.1);
    color: var(--hx-brand);
    transition:
        transform 0.5s var(--hx-spring),
        background-color 0.3s var(--hx-ease),
        color 0.3s var(--hx-ease),
        box-shadow 0.3s var(--hx-ease);
}

.hx-arrow svg {
    width: 15px;
    height: 15px;
    transform: rotate(-45deg);
    transition: transform 0.5s var(--hx-spring);
}

@media (hover: hover) {
    .hx-card:hover .hx-arrow {
        background: var(--hx-brand);
        color: #fff;
        transform: translateX(2px);
        box-shadow: 0 8px 18px -8px rgba(37, 99, 235, 0.8);
    }

    .hx-card:hover .hx-arrow svg {
        transform: rotate(0deg);
    }
}

/* ── Featured Workspace ────────────────────────────────────────────────── */

.hx-space-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .hx-space-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .hx-space-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.75rem;
    }
}

.hx-space {
    padding: 8px;
}

.hx-space__media {
    display: block;
    height: 200px;
    overflow: hidden;
    border-radius: 18px;
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.hx-space__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.9s var(--hx-ease);
}

.hx-space__media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.28), rgba(15, 23, 42, 0) 38%);
    pointer-events: none;
}

@media (hover: hover) {
    .hx-space:hover .hx-space__media img {
        transform: scale(1.06);
    }
}

/* Dark glass chip over the photo. */
.hx-chip {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1;
    padding: 0.4375rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.4);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    backdrop-filter: blur(12px) saturate(160%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    color: #fff;
    font: 600 0.75rem/1 'Inter', system-ui, sans-serif;
}

.hx-space__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 14px 10px 6px;
}

.hx-space__title {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--hx-ink);
}

.hx-space__place {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.375rem;
    color: var(--hx-muted);
    font-size: 0.875rem;
}

.hx-space__place svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--hx-brand);
}

.hx-space__label {
    margin: 1rem 0 0.5rem;
    color: var(--hx-faint);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hx-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.hx-tag {
    padding: 0.3125rem 0.625rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 1px 0 #fff;
    color: var(--hx-ink-2);
    font-size: 0.75rem;
    line-height: 1.2;
    transition: border-color 0.3s var(--hx-ease), background-color 0.3s var(--hx-ease);
}

.hx-tag--more {
    color: var(--hx-brand-ink);
    font-weight: 600;
}

@media (hover: hover) {
    .hx-space:hover .hx-tag {
        border-color: rgba(37, 99, 235, 0.22);
        background: rgba(255, 255, 255, 0.92);
    }
}

.hx-space__none {
    margin-bottom: 1rem;
    color: var(--hx-faint);
    font-size: 0.875rem;
}

.hx-space__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.875rem;
    border-top: 1px solid rgba(15, 23, 42, 0.07);
}

.hx-price {
    color: var(--hx-brand-ink);
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.hx-price small {
    color: var(--hx-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.hx-price--ask {
    color: var(--hx-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.hx-space__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--hx-brand-ink);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Explore by Category ───────────────────────────────────────────────── */

/* Compact tiles, unlike the photo-led Featured cards: a small photo with the type's icon
   badge, then the name, a one-line description and the count, in a row. Three across on
   desktop, so all six take two short rows. */
.hx-cat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.625rem;
}

@media (min-width: 768px) {
    .hx-cat-grid {
        gap: 1rem;
    }
}

@media (min-width: 1024px) {
    .hx-cat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.hx-cat {
    --hx-accent: var(--hx-brand);
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 10px 16px 10px 10px;
    border-radius: 20px;
}

@media (hover: hover) {
    .hx-cat:hover {
        transform: translateY(-3px);
    }
}

.hx-cat__thumb {
    flex-shrink: 0;
    width: 76px;
    height: 76px;
}

.hx-cat__photo {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 15px;
    background: color-mix(in srgb, var(--hx-accent) 14%, #fff);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.hx-cat__photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--hx-ease);
}

@media (hover: hover) {
    .hx-cat:hover .hx-cat__photo img {
        transform: scale(1.1);
    }
}

/* The type's icon, a glass badge on the photo's corner. */
.hx-cat__icon {
    position: absolute;
    right: -7px;
    bottom: -7px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 11px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72));
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    backdrop-filter: blur(10px) saturate(180%);
    box-shadow: inset 0 1px 0 #fff, 0 6px 14px -6px rgba(15, 23, 42, 0.45);
    color: var(--hx-accent);
    transition: transform 0.5s var(--hx-spring);
}

.hx-cat__icon img,
.hx-cat__svg {
    width: 17px;
    height: 17px;
    object-fit: contain;
}

@media (hover: hover) {
    .hx-cat:hover .hx-cat__icon {
        transform: rotate(-10deg) scale(1.14);
    }
}

.hx-cat__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 0.1875rem;
}

.hx-cat__title {
    color: var(--hx-ink);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.hx-cat__desc {
    overflow: hidden;
    color: var(--hx-muted);
    font-size: 0.8125rem;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hx-cat__count {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--hx-ink-2);
    font-size: 0.75rem;
    font-weight: 600;
}

.hx-cat__count::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--hx-accent);
}

.hx-cat .hx-arrow {
    background: color-mix(in srgb, var(--hx-accent) 13%, transparent);
    color: var(--hx-accent);
}

@media (hover: hover) {
    .hx-cat:hover .hx-arrow {
        background: var(--hx-accent);
        color: #fff;
        box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--hx-accent) 80%, transparent);
    }
}

/* Phones: two across, photo and name only. */
@media (max-width: 639px) {
    .hx-cat {
        gap: 0.625rem;
        padding: 7px 8px 7px 7px;
        border-radius: 16px;
    }

    .hx-cat__thumb {
        width: 48px;
        height: 48px;
    }

    .hx-cat__photo {
        border-radius: 11px;
    }

    .hx-cat__icon {
        right: -5px;
        bottom: -5px;
        width: 24px;
        height: 24px;
        border-radius: 8px;
    }

    .hx-cat__icon img,
    .hx-cat__svg {
        width: 13px;
        height: 13px;
    }

    .hx-cat__title {
        font-size: 0.875rem;
        line-height: 1.25;
    }

    .hx-cat__desc,
    .hx-cat .hx-arrow {
        display: none;
    }

    .hx-cat__count {
        font-size: 0.6875rem;
    }
}

/* ── Popular Cities ────────────────────────────────────────────────────── */

.hx-city-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.875rem;
}

@media (min-width: 768px) {
    .hx-city-grid {
        gap: 1.25rem;
    }
}

@media (min-width: 1024px) {
    .hx-city-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 1.5rem;
    }
}

/* Full-bleed photo with a glass caption floating over its foot. */
.hx-city {
    justify-content: flex-end;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: linear-gradient(135deg, #c7d2fe, #e0f2fe);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.hx-card > .hx-city__img {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hx-city__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.1s var(--hx-ease);
}

/* The pointer light shows over the photo here. */
.hx-city::before {
    z-index: 1;
    background: radial-gradient(380px circle at var(--hx-x, 50%) var(--hx-y, -20%), rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0) 50%);
}

@media (hover: hover) {
    .hx-city:hover .hx-city__img {
        transform: scale(1.07);
    }
}

.hx-card > .hx-city__panel {
    z-index: 2;
}

.hx-city__panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 10px;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 17px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.56));
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 14px 30px -16px rgba(2, 6, 23, 0.6);
    transition: transform 0.55s var(--hx-ease);
}

@media (hover: hover) {
    .hx-city:hover .hx-city__panel {
        transform: translateY(-4px);
    }
}

.hx-city__text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.hx-city__name {
    overflow: hidden;
    color: var(--hx-ink);
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hx-city__count {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    color: var(--hx-ink-2);
    font-size: 0.8125rem;
    font-weight: 500;
}

.hx-city__count svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--hx-brand);
}

@media (max-width: 639px) {
    .hx-city {
        aspect-ratio: 3 / 4;
        border-radius: 20px;
    }

    .hx-city__panel {
        gap: 0.375rem;
        margin: 7px;
        padding: 0.5625rem 0.5rem 0.5625rem 0.6875rem;
        border-radius: 14px;
    }

    .hx-city__name {
        font-size: 0.9375rem;
    }

    .hx-city__count {
        font-size: 0.75rem;
    }

    .hx-city .hx-arrow {
        width: 26px;
        height: 26px;
    }
}

/* Visible credit for the CC-licensed stand-in photos. */
.hx-credits {
    margin: 1.25rem auto 0;
    max-width: 60rem;
    color: var(--hx-faint);
    font-size: 0.75rem;
    line-height: 1.6;
    text-align: center;
}

.hx-credits a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(100, 116, 139, 0.45);
    text-underline-offset: 2px;
    transition: color 0.2s var(--hx-ease);
}

.hx-credits a:hover {
    color: var(--hx-brand-ink);
}

/* ── Entrance ──────────────────────────────────────────────────────────── */

/* Hidden only when the page script can reveal them; it adds .is-in as each scrolls in. */
@media (scripting: enabled) {
    .hx-reveal:not(.is-in) {
        opacity: 0;
    }
}

.hx-reveal.is-in {
    animation: hx-rise 0.85s var(--hx-ease) var(--hx-delay, 0ms) backwards;
}

@keyframes hx-rise {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.98);
    }
}

@keyframes hx-ping {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5);
    }

    70%,
    100% {
        box-shadow: 0 0 0 7px rgba(37, 99, 235, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hx-reveal.is-in,
    .hx-eyebrow__dot {
        animation: none;
    }

    .hx-zone *,
    .hx-zone *::before,
    .hx-zone *::after {
        transition-duration: 0.01ms !important;
    }
}
