/* Vision Spaces home page. Same look as the Vision sign-in theme: brand
 * assets come from /spaces/brand/ (the theme's resources folder). */
@font-face {
    font-family: 'Al Jazeera Arabic';
    src: url('/spaces/brand/fonts/al-jazeera-arabic.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --blue: #1677ff;
    --blue-hover: #0f67e0;
    --navy: #0a2342;
    --ink: #0f172a;
    --muted: #64748b;
    --line: rgba(148, 163, 184, 0.35);
    --surface: rgba(255, 255, 255, 0.86);
    --surface-border: rgba(255, 255, 255, 0.8);
    --chip: #f1f5f9;
    --page: #eef5fc;
    --banner: 0px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --blue: #3b8dff;
        --blue-hover: #5aa0ff;
        --navy: #f8fafc;
        --ink: #f8fafc;
        --muted: #94a3b8;
        --line: rgba(148, 163, 184, 0.2);
        --surface: rgba(7, 20, 38, 0.86);
        --surface-border: rgba(255, 255, 255, 0.1);
        --chip: rgba(30, 41, 59, 0.75);
        --page: #061226;
        color-scheme: dark;
    }
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: 'Al Jazeera Arabic', 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
}

body.is-uat {
    --banner: 2.5rem;
}

[hidden] {
    display: none !important;
}

.backdrop {
    position: fixed;
    inset: 0;
    background:
        linear-gradient(
            180deg,
            rgba(241, 247, 253, 0.2) 0%,
            rgba(241, 247, 253, 0.72) 45%,
            rgba(241, 247, 253, 0.96) 100%
        ),
        url('/spaces/brand/img/backdrop-light.jpg') center / cover no-repeat;
}

@media (prefers-color-scheme: dark) {
    .backdrop {
        background:
            linear-gradient(
                180deg,
                rgba(3, 12, 28, 0.25) 0%,
                rgba(3, 12, 28, 0.72) 45%,
                rgba(3, 12, 28, 0.96) 100%
            ),
            url('/spaces/brand/img/backdrop-dark.jpg') center / cover no-repeat;
    }
}

.env-banner {
    position: fixed;
    inset-inline: 0;
    top: 0;
    z-index: 20;
    display: flex;
    min-height: var(--banner);
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    background: #fbbf24;
    color: #451a03;
    font-size: 0.875rem;
    text-align: center;
    box-shadow: 0 1px 0 rgba(120, 53, 15, 0.25);
}

.shell {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
    max-width: 72rem;
    flex-direction: column;
    margin: 0 auto;
    padding: calc(var(--banner) + 1.5rem) 1rem 1.5rem;
}

/* Top bar */
.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1.125rem;
    border: 1px solid var(--surface-border);
    border-radius: 1.5rem;
    background: var(--surface);
    box-shadow: 0 18px 50px -32px rgba(7, 20, 43, 0.55);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-mark {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.85rem;
    box-shadow: 0 10px 24px -14px rgba(7, 25, 103, 0.8);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    color: var(--navy);
    font-size: 1.1rem;
    font-weight: 700;
}

.brand-tagline {
    color: var(--muted);
    font-size: 0.8rem;
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.locales {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.2rem;
    border-radius: 999px;
    background: var(--chip);
}

.locale,
.sign-out,
.primary {
    border: 0;
    font: inherit;
    cursor: pointer;
}

.locale {
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.locale[aria-pressed='true'] {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.sign-out {
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font-size: 0.85rem;
    font-weight: 600;
}

.sign-out:hover {
    border-color: var(--blue);
    color: var(--blue);
}

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* Content */
.main {
    flex: 1;
    padding: 2.5rem 0.25rem 1.5rem;
}

.greeting {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    line-height: 1.3;
}

.lead {
    margin: 0.4rem 0 1.75rem;
    color: var(--muted);
}

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tile {
    display: flex;
    height: 100%;
    flex-direction: column;
    gap: 1rem;
    padding: 1.4rem;
    border: 1px solid var(--surface-border);
    border-radius: 1.5rem;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 18px 50px -34px rgba(7, 20, 43, 0.6);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    transition:
        transform 0.15s,
        box-shadow 0.15s,
        border-color 0.15s;
}

.tile:hover {
    border-color: color-mix(in srgb, var(--blue) 45%, transparent);
    box-shadow: 0 24px 60px -30px rgba(22, 119, 255, 0.55);
    transform: translateY(-2px);
}

.tile-icon {
    display: grid;
    width: 3rem;
    height: 3rem;
    place-items: center;
    border-radius: 1rem;
    background: color-mix(in srgb, var(--blue) 12%, transparent);
    color: var(--blue);
}

.tile-icon svg {
    width: 1.6rem;
    height: 1.6rem;
}

.tile-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.25rem;
}

.tile-name {
    font-size: 1.15rem;
    font-weight: 700;
}

.tile-about {
    color: var(--muted);
    font-size: 0.9rem;
}

.tile-open {
    align-self: flex-start;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: var(--blue);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.tile:hover .tile-open {
    background: var(--blue-hover);
}

.empty,
.state {
    padding: 1.5rem;
    border: 1px solid var(--surface-border);
    border-radius: 1.5rem;
    background: var(--surface);
    color: var(--muted);
    text-align: center;
}

.state {
    max-width: 30rem;
    margin: 3rem auto 0;
}

.state h1 {
    margin: 0 0 0.5rem;
    color: var(--ink);
    font-size: 1.3rem;
}

.primary {
    margin-top: 1rem;
    padding: 0.6rem 1.4rem;
    border-radius: 0.75rem;
    background: var(--blue);
    color: #fff;
    font-weight: 600;
}

.spinner {
    width: 2rem;
    height: 2rem;
    margin: 0 auto 0.75rem;
    border: 3px solid var(--line);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.footer {
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
}

@media (max-width: 40rem) {
    .topbar {
        border-radius: 1.25rem;
    }

    .brand-tagline,
    .env-banner span {
        display: none;
    }

    .main {
        padding-top: 1.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tile,
    .spinner {
        transition: none;
        animation: none;
    }
}
