/* WMCGW Portal — navy, gold, teal (World Missions College branding) */

:root {
    --navy-deep: #0a1628;
    --navy-mid: #132a4a;
    --navy-ring: #1e3a5f;
    --gold: #c9a227;
    --gold-dim: rgba(201, 162, 39, 0.35);
    --teal: #3d7ea6;
    --teal-glow: rgba(61, 126, 166, 0.45);
    --text: #e8eef5;
    --text-muted: rgba(232, 238, 245, 0.72);
    --glass: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(201, 162, 39, 0.22);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: "Outfit", system-ui, sans-serif;
    color: var(--text);
    background: linear-gradient(155deg, var(--navy-deep) 0%, var(--navy-mid) 42%, #0d1f35 100%);
    overflow-x: hidden;
    -webkit-tap-highlight-color: rgba(201, 162, 39, 0.15);
}

.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(88px);
    opacity: 0.38;
    z-index: 0;
    pointer-events: none;
}

.shape-1 {
    width: min(420px, 90vw);
    height: min(420px, 90vw);
    background: var(--teal-glow);
    top: -120px;
    right: -100px;
    animation: float-a 22s ease-in-out infinite;
}

.shape-2 {
    width: min(360px, 80vw);
    height: min(360px, 80vw);
    background: rgba(201, 162, 39, 0.25);
    bottom: -80px;
    left: -100px;
    animation: float-b 18s ease-in-out infinite;
}

.shape-3 {
    width: min(280px, 70vw);
    height: min(280px, 70vw);
    background: rgba(30, 58, 95, 0.55);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float-a 26s ease-in-out infinite reverse;
}

@keyframes float-a {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(-24px, 18px) scale(1.05);
    }
}

@keyframes float-b {
    0%,
    100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(20px, -28px);
    }
}

.container {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
    padding:
        max(1.25rem, env(safe-area-inset-top))
        max(1rem, env(safe-area-inset-right))
        max(1.5rem, env(safe-area-inset-bottom))
        max(1rem, env(safe-area-inset-left));
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.brand-lockup {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* White disc behind the seal (visible as a ring around the logo) */
.brand-logo-halo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: clamp(124px, 34vw, 156px);
    height: clamp(124px, 34vw, 156px);
    border-radius: 50%;
    background: #ffffff;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.22),
        0 0 0 1px rgba(0, 0, 0, 0.06);
}

.brand-logo {
    display: block;
    width: clamp(96px, 27vw, 128px);
    height: auto;
    max-height: 100%;
    border-radius: 50%;
    box-shadow:
        0 0 0 3px var(--gold-dim),
        0 8px 28px rgba(0, 0, 0, 0.35);
    object-fit: contain;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.08), transparent 55%);
}

.brand-titles {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.logo-text {
    font-family: "Cormorant Garamond", "Times New Roman", serif;
    font-weight: 700;
    font-size: clamp(1.85rem, 5.5vw, 2.35rem);
    letter-spacing: 0.04em;
    color: var(--text);
    margin: 0;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.portal-text {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 500;
    font-size: clamp(1rem, 3.2vw, 1.15rem);
    color: var(--gold);
    margin: 0;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.apps-icons {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.top-row {
    display: flex;
    justify-content: center;
    gap: clamp(1.25rem, 5vw, 2rem);
    flex-wrap: wrap;
    width: 100%;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-decoration: none;
    color: inherit;
    transition: transform 0.22s ease;
    max-width: 140px;
    min-width: 0;
    padding: 0.35rem 0.5rem 0.5rem;
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

.app-icon:active {
    transform: scale(0.97);
}

@media (hover: hover) {
    .app-icon:hover {
        transform: translateY(-4px);
    }

    .app-icon:hover .icon-glass {
        box-shadow:
            0 16px 40px rgba(0, 0, 0, 0.4),
            0 0 0 1px var(--gold-dim),
            inset 0 1px 0 rgba(255, 255, 255, 0.12);
    }
}

.icon-glass {
    width: 112px;
    height: 112px;
    min-width: 112px;
    min-height: 112px;
    border-radius: 28px;
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    box-shadow:
        0 10px 36px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.65rem;
}

.app-fa {
    font-size: 2.65rem;
    color: var(--icon-color, var(--gold));
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.icon-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.25;
}

.connect-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sub-options {
    position: relative;
    width: 100%;
    max-width: 280px;
    min-height: 160px;
    margin-top: 0.5rem;
    display: none;
    flex-direction: column;
    align-items: center;
}

.sub-options.is-open {
    display: flex;
}

.connecting-lines {
    position: absolute;
    top: -36px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 0;
}

.connecting-lines path {
    fill: none;
    stroke: var(--gold-dim);
    stroke-width: 2;
    stroke-linecap: round;
}

.sub-icon {
    position: absolute;
    z-index: 1;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(19, 42, 74, 0.85);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    color: var(--gold);
    text-decoration: none;
    font-size: 1.35rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, background 0.2s ease;
}

.sub-icon:hover {
    background: rgba(30, 58, 95, 0.95);
    transform: scale(1.06);
}

.left-opt {
    left: 8px;
    top: 52px;
}

.right-opt {
    right: 8px;
    top: 52px;
}

.sub-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.footer {
    margin-top: auto;
    padding-top: 2rem;
    padding-bottom: max(0.25rem, env(safe-area-inset-bottom));
    text-align: center;
}

.share-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
    touch-action: manipulation;
    border-radius: 999px;
}

.share-link__icon {
    color: var(--gold);
}

.share-link:hover {
    color: var(--text);
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--navy-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

.loading-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(201, 162, 39, 0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

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

.toast {
    position: fixed;
    bottom: max(1.25rem, calc(env(safe-area-inset-bottom) + 0.75rem));
    left: 50%;
    max-width: calc(100vw - 2rem);
    transform: translateX(-50%) translateY(120%);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: rgba(19, 42, 74, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    font-size: 0.9rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.is-visible {
    transform: translateX(-50%) translateY(0);
}

.toast .fa-check-circle {
    color: #4ade80;
}

/* —— Mobile / narrow screens —— */
@media (max-width: 420px) {
    .shape-1 {
        opacity: 0.28;
    }

    .top-row {
        gap: 0.75rem 1rem;
    }

    .icon-glass {
        width: 100px;
        height: 100px;
        min-width: 100px;
        min-height: 100px;
        border-radius: 24px;
    }

    .app-fa {
        font-size: 2.35rem;
    }

    .icon-label {
        font-size: 0.82rem;
        max-width: 9rem;
        word-break: break-word;
        hyphens: auto;
    }

    /* Voice / Text: side-by-side row — easier to tap on phones */
    .sub-options.is-open {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 1rem 1.5rem;
        min-height: auto;
        margin-top: 0.75rem;
        padding: 0.25rem 0 0.5rem;
        max-width: 100%;
    }

    .sub-options.is-open .connecting-lines {
        display: none;
    }

    .sub-options.is-open .sub-icon {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        width: 72px;
        height: 72px;
        min-width: 72px;
        min-height: 72px;
        font-size: 1.5rem;
    }

    .sub-options.is-open .sub-label {
        font-size: 0.68rem;
    }
}

@media (max-width: 360px) {
    .brand-logo-halo {
        width: clamp(112px, 38vw, 140px);
        height: clamp(112px, 38vw, 140px);
    }

    .brand-logo {
        width: clamp(86px, 30vw, 118px);
    }
}
