/* Property of Sistema THEAD. All rights reserved. */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@500;700&display=swap');

:root {
    --home-blue: #0080C9;
    --home-blue-deep: #006ba8;
    --home-orange: #F59C00;
    --home-white: #ffffff;
    --home-ink: #03283f;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: "DM Sans", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.12), transparent 24%),
        var(--home-blue);
    color: var(--home-white);
}

body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

body::before {
    top: -12vmin;
    right: -10vmin;
    width: 34vmin;
    height: 34vmin;
    background: rgba(255, 255, 255, 0.12);
}

body::after {
    bottom: -18vmin;
    left: -14vmin;
    width: 42vmin;
    height: 42vmin;
    background: rgba(3, 40, 63, 0.08);
}

.home-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(28px, 5vh, 48px);
    /* Extra bottom padding reserves room for the fixed language selector so
       the centred logo + actions never collide with it, and so that on tall
       portrait phones the last action button can scroll clear of it. */
    padding: max(28px, env(safe-area-inset-top)) 24px max(78px, calc(env(safe-area-inset-bottom) + 62px));
}

.home-logo {
    width: min(320px, 72vw);
    height: auto;
}

.home-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(22px, 4vw, 38px);
}

.home-action {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--home-white);
    text-decoration: none;
    background: transparent;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.home-action-button {
    appearance: none;
}

.home-action-button[aria-disabled="true"] {
    cursor: default;
}

.home-action-circle {
    width: clamp(158px, 29vw, 212px);
    height: clamp(158px, 29vw, 212px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 12px solid var(--home-orange);
    background: var(--home-white);
    box-shadow:
        0 16px 30px rgba(3, 40, 63, 0.2),
        inset 0 0 0 2px rgba(3, 40, 63, 0.04);
    transition: transform 0.14s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.home-action img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.home-action--gallery img {
    width: 72%;
    height: 72%;
}

.home-action-label {
    font-size: clamp(1.05rem, 2.1vw, 1.35rem);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.home-action:hover .home-action-circle,
.home-action:focus-visible .home-action-circle {
    box-shadow:
        0 20px 34px rgba(3, 40, 63, 0.28),
        inset 0 0 0 2px rgba(3, 40, 63, 0.06);
    border-color: #ffb31f;
}

.home-action:active .home-action-circle {
    transform: scale(0.96);
}

.home-action-button[aria-disabled="true"]:hover .home-action-circle,
.home-action-button[aria-disabled="true"]:focus-visible .home-action-circle {
    box-shadow:
        0 16px 30px rgba(3, 40, 63, 0.2),
        inset 0 0 0 2px rgba(3, 40, 63, 0.04);
    border-color: var(--home-orange);
}

.home-action-button[aria-disabled="true"]:active .home-action-circle {
    transform: none;
}

.home-action:focus-visible {
    outline: none;
}

.home-action:focus-visible .home-action-label {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

/* -------- Bottom-of-page language selector (portrait + landscape) --------
   Fixed to the viewport bottom-centre so it is always visible at the bottom
   regardless of orientation or whether the tall portrait layout scrolls. */
.home-language {
    position: fixed;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.home-language-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.92);
    pointer-events: none;
}

.home-language-select {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    font-weight: 600;
    font-size: clamp(0.9rem, 1.6vw, 1rem);
    color: var(--home-ink);
    background-color: rgba(255, 255, 255, 0.95);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2303283f' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
    border: 2px solid rgba(255, 255, 255, 0.65);
    border-radius: 999px;
    padding: 9px 38px 9px 16px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(3, 40, 63, 0.2);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.home-language-select:hover {
    border-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 20px rgba(3, 40, 63, 0.26);
}

.home-language-select:focus-visible {
    outline: 3px solid var(--home-orange);
    outline-offset: 2px;
    border-color: var(--home-white);
}

.home-language-select:active {
    transform: scale(0.97);
}

.home-language-select option {
    color: var(--home-ink);
    background-color: var(--home-white);
}

.swal-home-mode-popup {
    width: min(92vw, 760px) !important;
    /* border + border-radius come from the shared popups.css theme. */
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 253, 0.98)) !important;
    color: var(--home-ink) !important;
    box-shadow: 0 24px 46px rgba(3, 40, 63, 0.28) !important;
    padding: clamp(1.2rem, 2vw, 1.6rem) !important;
}

.swal-home-mode-popup .swal2-title {
    margin: 0 1.7rem 0.35rem !important;
    color: var(--home-ink) !important;
    font-size: clamp(1.45rem, 3vw, 2rem) !important;
}

.swal-home-mode-popup .swal2-html-container {
    margin: 0 !important;
    overflow: visible !important;
}

.home-mode-popup-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    color: var(--home-ink);
}

.home-mode-popup-intro {
    margin: 0;
    text-align: center;
    color: rgba(3, 40, 63, 0.78);
    font-size: 1rem;
}

.home-mode-popup-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(16px, 3vw, 24px);
}

.home-mode-popup-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 10px 8px 0;
    color: var(--home-ink);
    text-decoration: none;
}

.home-mode-popup-circle {
    width: clamp(148px, 24vw, 190px);
    height: clamp(148px, 24vw, 190px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 10px solid var(--home-orange);
    background: var(--home-white);
    box-shadow:
        0 16px 28px rgba(3, 40, 63, 0.16),
        inset 0 0 0 2px rgba(3, 40, 63, 0.04);
    transition: transform 0.14s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.home-mode-popup-option img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.home-mode-popup-label {
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 700;
    text-align: center;
}

.home-mode-popup-option:hover .home-mode-popup-circle,
.home-mode-popup-option:focus-visible .home-mode-popup-circle {
    box-shadow: 0 18px 34px rgba(3, 40, 63, 0.24);
    border-color: #ffb31f;
}

.home-mode-popup-option:active .home-mode-popup-circle {
    transform: scale(0.97);
}

.home-mode-popup-option:focus-visible {
    outline: none;
}

@media (orientation: landscape) {
    .home-actions {
        flex-direction: row;
    }
}

@media (min-width: 744px) and (orientation: portrait) {
    .home-actions {
        flex-direction: row;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    .home-shell {
        justify-content: center;
        gap: clamp(12px, 3vh, 18px);
        padding: max(10px, env(safe-area-inset-top)) 18px max(10px, env(safe-area-inset-bottom));
    }

    .home-logo {
        width: clamp(205px, 31vw, 280px);
        height: auto;
        max-height: none;
    }

    .home-actions {
        gap: clamp(18px, 2.8vw, 30px);
    }

    .home-action {
        gap: clamp(8px, 2vh, 12px);
    }

    .home-action-circle {
        width: min(18vw, 38vh);
        height: min(18vw, 38vh);
        min-width: 132px;
        min-height: 132px;
        max-width: 180px;
        max-height: 180px;
        border-width: clamp(8px, 1.8vh, 10px);
    }

    .home-action-label {
        font-size: clamp(1.08rem, 1.8vw, 1.28rem);
    }

    /* Tighter reserved strip + compact selector on short landscape. */
    .home-shell {
        padding: max(10px, env(safe-area-inset-top)) 18px max(54px, calc(env(safe-area-inset-bottom) + 44px));
    }

    .home-language {
        bottom: max(12px, env(safe-area-inset-bottom));
        gap: 6px;
    }

    .home-language-select {
        padding: 6px 32px 6px 13px;
        font-size: 0.88rem;
    }

    .home-language-icon {
        width: 17px;
        height: 17px;
    }
}

@media (min-width: 700px) {
    .home-mode-popup-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .home-shell {
        gap: clamp(16px, 3vh, 24px);
    }

    .home-logo {
        width: min(280px, 78vw);
    }

    /* Phone portrait stacks the three actions vertically; trim the circle
       size and gaps so all three plus their labels clear the fixed language
       selector at the bottom without scrolling or overlap. */
    .home-actions {
        gap: clamp(16px, 3vh, 26px);
    }

    .home-action {
        gap: 10px;
    }

    .home-action-circle {
        width: clamp(126px, 34vw, 158px);
        height: clamp(126px, 34vw, 158px);
        border-width: 10px;
    }

    .swal-home-mode-popup {
        width: min(94vw, 760px) !important;
        padding: 1.05rem !important;
    }

    .home-mode-popup-options {
        gap: 14px;
    }

    .home-mode-popup-circle {
        width: clamp(132px, 38vw, 176px);
        height: clamp(132px, 38vw, 176px);
        border-width: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-action-circle,
    .home-mode-popup-circle {
        transition: none;
    }
}

/*
 * Beagle mascot popup styles — mirrored from index/70-popups.css so the
 * home page's Story-Mode "coming soon" Swal (and any future home Swals)
 * gets the same mascot treatment as the editor / settings popups. The
 * swalMascot.js patch swaps SweetAlert2's default icon for a Beagle
 * image; without these rules, the image renders unsized and unstyled.
 */
.swal-mascot-popup .swal2-image {
    width: clamp(118px, 23vw, 164px) !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 auto 0.72rem !important;
    display: block !important;
    object-fit: contain !important;
}

.swal-mascot-popup .swal2-image.swal-mascot-image--success {
    width: clamp(146px, 29vw, 214px) !important;
}

.swal-mascot-popup .swal2-title {
    margin-top: 0 !important;
}

@media (max-width: 560px) {
    .swal-mascot-popup .swal2-image {
        width: clamp(112px, 40vw, 150px) !important;
        margin-bottom: 0.65rem !important;
    }

    .swal-mascot-popup .swal2-image.swal-mascot-image--success {
        width: clamp(138px, 52vw, 184px) !important;
    }
}
