/*
 * Modal "Sobre a Altéria" — abertura tipo génio, a partir do ponto clicado
 *
 * Tema: Altéria
 * Ficheiro: assets/css/modal-about.css
 *
 * Namespace próprio (.about-modal). Não colide com .service-modal.
 */

.about-modal {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    color: var(--color-white);
}

.about-modal::backdrop {
    background: rgba(5, 16, 35, 0.32);
}

/* ---------------------------------------------------------------- */
/* Superfície com o degradê — é ela que faz o efeito                  */
/* ---------------------------------------------------------------- */

/*
 * O degradê vive aqui, e não no ::backdrop, porque só um elemento
 * real aceita transform-origin ancorado às coordenadas do clique.
 */
.about-modal__surface {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: linear-gradient(135deg,
            rgba(62, 88, 130, 0.62),
            rgba(5, 16, 35, 0.86));
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    backdrop-filter: blur(22px) saturate(140%);
    transform-origin: var(--genie-x, 50%) var(--genie-y, 100%);
    pointer-events: none;
}

/* Sem backdrop-filter, compensa-se com opacidade */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .about-modal__surface {
        background: linear-gradient(135deg,
                rgba(62, 88, 130, 0.94),
                rgba(5, 16, 35, 0.97));
    }
}

/* ---------------------------------------------------------------- */
/* Estrutura                                                          */
/* ---------------------------------------------------------------- */

.about-modal__inner {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    padding: clamp(96px, 14vh, 140px) var(--container-padding) clamp(56px, 10vh, 100px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.about-modal__content {
    width: min(100%, 760px);
    margin-inline: auto;
}

/* ---------------------------------------------------------------- */
/* Botão de fecho                                                     */
/* ---------------------------------------------------------------- */

.about-modal__close {
    position: fixed;
    top: clamp(20px, 4vh, 44px);
    right: clamp(20px, 4vw, 52px);
    z-index: 2;
    display: flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    padding-bottom: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background-color: transparent;
    color: var(--color-white);
    font-family: var(--font-body);
    font-size: 30px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition:
        border-color var(--transition-fast),
        background-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

.about-modal__close:hover {
    border-color: var(--color-gold);
    background-color: var(--color-gold);
    color: var(--color-navy);
    transform: rotate(90deg);
}

.about-modal__close:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 3px;
}

/* ---------------------------------------------------------------- */
/* Conteúdo                                                           */
/* ---------------------------------------------------------------- */

.about-modal__label {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    color: var(--color-gold);
    font-family: var(--font-body);
    font-size: var(--font-size-small);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.about-modal__label::after {
    display: block;
    width: 34px;
    height: 1px;
    background-color: var(--color-gold);
    content: "";
}

.about-modal__title {
    margin-top: 20px;
    color: var(--color-white);
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 4.4vw, 3.6rem);
    font-weight: 400;
    line-height: 1.08;
}

.about-modal__title span {
    color: var(--color-gold);
}

.about-modal__text {
    max-width: 62ch;
    margin-top: 38px;
    padding-top: 30px;
    border-top: 1px solid rgba(177, 145, 84, 0.35);
}

.about-modal__text p {
    color: rgba(255, 255, 255, 0.82);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.75;
}

.about-modal__text p+p {
    margin-top: 18px;
}

.about-modal__mission {
    max-width: 52ch;
    margin-top: 40px;
    padding-left: 22px;
    border-left: 2px solid var(--color-gold);
}

.about-modal__mission span {
    display: block;
    margin-bottom: 10px;
    color: var(--color-gold);
    font-family: var(--font-body);
    font-size: var(--font-size-small);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.about-modal__mission strong {
    color: var(--color-white);
    font-family: var(--font-heading);
    font-size: clamp(20px, 2vw, 27px);
    font-weight: 400;
    line-height: 1.4;
}

/* ---------------------------------------------------------------- */
/* Animação                                                           */
/* ---------------------------------------------------------------- */

/*
 * Estica primeiro na vertical (o fumo a sair do gargalo), só depois
 * alarga; o border-radius passa de círculo a reto no mesmo movimento.
 */
@keyframes about-genie-out {
    0% {
        opacity: 0;
        transform: scale(0.05, 0.02);
        border-radius: 50%;
    }

    28% {
        opacity: 0.95;
        transform: scale(0.16, 0.7);
        border-radius: 48% 48% 34% 34%;
    }

    60% {
        transform: scale(0.8, 1.04);
        border-radius: 22% 22% 8% 8%;
    }

    100% {
        opacity: 1;
        transform: scale(1, 1);
        border-radius: 0;
    }
}

@keyframes about-genie-back {
    0% {
        opacity: 1;
        transform: scale(1, 1);
        border-radius: 0;
    }

    45% {
        opacity: 0.9;
        transform: scale(0.22, 0.78);
        border-radius: 46% 46% 32% 32%;
    }

    100% {
        opacity: 0;
        transform: scale(0.05, 0.02);
        border-radius: 50%;
    }
}

@keyframes about-fade-up {
    from {
        opacity: 0;
        transform: translateY(22px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes about-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.about-modal[open]::backdrop {
    animation: about-fade 300ms ease both;
}

.about-modal[open] .about-modal__surface {
    animation: about-genie-out 720ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/*
 * O atraso de 400ms é o que separa "génio" de "aparecer":
 * o painel já está aberto quando o texto entra.
 */
.about-modal[open] .about-modal__content {
    animation: about-fade-up 520ms cubic-bezier(0.22, 1, 0.36, 1) 400ms both;
}

.about-modal[open] .about-modal__close {
    animation: about-fade 320ms ease 560ms both;
}

.about-modal.is-closing::backdrop {
    animation: about-fade 260ms ease reverse both;
}

.about-modal.is-closing .about-modal__surface {
    animation: about-genie-back 440ms cubic-bezier(0.55, 0, 0.68, 0.35) both;
}

.about-modal.is-closing .about-modal__content,
.about-modal.is-closing .about-modal__close {
    animation: about-fade 160ms ease reverse both;
}

/* Bloqueia o scroll do fundo */
html.about-modal-open,
html.about-modal-open body {
    overflow: hidden;
}

/* ---------------------------------------------------------------- */
/* Gatilho                                                            */
/* ---------------------------------------------------------------- */

.text-link--about span {
    display: inline-block;
    transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.text-link--about:hover span {
    transform: rotate(90deg) scale(1.15);
}

/* ---------------------------------------------------------------- */
/* Responsivo                                                         */
/* ---------------------------------------------------------------- */

@media (max-width: 768px) {

    .about-modal__inner {
        align-items: flex-start;
        padding-top: 100px;
    }

    .about-modal__text {
        margin-top: 30px;
        padding-top: 24px;
    }

    .about-modal__close {
        width: 42px;
        height: 42px;
        font-size: 26px;
    }
}

/* ---------------------------------------------------------------- */
/* Movimento reduzido                                                 */
/* ---------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    .about-modal[open]::backdrop,
    .about-modal[open] .about-modal__surface,
    .about-modal[open] .about-modal__content,
    .about-modal[open] .about-modal__close,
    .about-modal.is-closing::backdrop,
    .about-modal.is-closing .about-modal__surface,
    .about-modal.is-closing .about-modal__content,
    .about-modal.is-closing .about-modal__close {
        animation: none;
    }

    .about-modal__close:hover,
    .text-link--about:hover span {
        transform: none;
    }
}