/* ==========================================================================
   Página inicial — tema escuro
   Medidas transcritas da especificação (seção 4 a 6).
   ========================================================================== */

:root {
    --bg: #000000;
    --panel: #2B2B2B;
    --text: #F3F3F3;
    --yellow: #D8C40F;
    --yellow-hover: #E5D220;
    --btn-off-bg: #1A1A1A;
    --btn-off-text: #707070;
    --btn-on-text: #151515;
    --border-strong: rgba(255, 255, 255, 0.34);
    --border-line: rgba(255, 255, 255, 0.16);
    --border-circle: rgba(255, 255, 255, 0.45);
    --muted: #898989;
    --err-field: #D9787A;
    --err-request: #FFB4B4;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.home {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Layout desktop (> 950px) -------------------------------------------- */
.home-layout {
    display: grid;
    grid-template-columns: 1fr 578px;
    min-height: 100vh;
}

.home-identity {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 72px;
    background: radial-gradient(circle at 32% 50%,
        #4D4614 0%, #35300E 14%, #1C1A08 32%, #0A0A08 52%, #000000 78%);
}

.home-identity__inner { display: flex; align-items: center; justify-content: center; }

.home-identity__img {
    width: min(300px, 40vw);
    height: auto;
}

.home-panel-wrap {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}

.home-panel {
    width: 500px;
    margin-top: 16px;
    margin-bottom: 13px;
    min-height: calc(100vh - 29px);
    padding: 32px 40px 36px;
    background: var(--panel);
    border-radius: 42px;
    box-shadow: -30px 0 80px rgba(0, 0, 0, 0.22);
}

/* --- Cabeçalho ------------------------------------------------------------ */
.hp-header {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    gap: 18px;
    align-items: center;
}

.hp-iconbtn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-circle);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    padding: 0;
}
.hp-iconbtn svg { width: 26px; height: 26px; }
.hp-iconbtn:hover { color: var(--yellow); border-color: var(--yellow); }
.hp-iconbtn:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

.hp-title {
    margin: 0;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text);
}

/* --- Imagem central ------------------------------------------------------ */
.hp-center { display: flex; justify-content: center; }
.hp-center__frame {
    position: relative;
    width: 100%;
    max-width: 287px;
    aspect-ratio: 431 / 272;
    margin: 34px 0 24px;
}
.hp-center__img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hp-center__overlay {
    position: absolute;
    left: 0; right: 0;
    bottom: 12%;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 18px;
    letter-spacing: 0.12em;
    color: #ECECEC;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* --- Formulário ---------------------------------------------------------- */
.hp-form { width: 100%; }

.hp-fieldbox {
    width: calc(100% - 18px);
    margin: 0 auto;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 0 21px;
    transition: border-color 0.2s;
}
.hp-fieldbox.is-error { border-color: rgba(217, 120, 122, 0.55); }

.hp-label {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 16px;
    font-weight: 500;
    color: #DDDDDD;
}
.hp-fieldbox.is-error .hp-label { color: var(--err-field); }

.hp-input {
    width: 100%;
    height: 70px;
    padding: 0 8px;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--border-line);
    border-bottom: 1px solid var(--border-line);
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 31px;
    font-weight: 500;
    letter-spacing: 0.34em;
    text-align: center;
    color: #ECECEC;
    outline: none;
}
.hp-input::placeholder { color: #AEAEAE; font-weight: 400; letter-spacing: 0.2em; }
.hp-input:focus { color: #FFFFFF; }
.hp-input:focus-visible { box-shadow: inset 0 -2px 0 0 var(--yellow); }

.hp-switchrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 66px;
}
.hp-switchrow__label { font-size: 15px; font-weight: 600; color: #E6E6E6; }

.hp-switch {
    flex: none;
    position: relative;
    width: 66px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: #D8D8D8;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s;
}
.hp-switch__knob {
    position: absolute;
    top: 6px; left: 6px;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #FFFFFF;
    transition: transform 0.2s;
}
.hp-switch[aria-checked="true"] { background: var(--yellow); }
.hp-switch[aria-checked="true"] .hp-switch__knob { transform: translateX(26px); }
.hp-switch:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }

/* --- Concordâncias ------------------------------------------------------- */
.hp-agree__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-top: 20px;
    cursor: pointer;
}
.hp-agree__text {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.35;
    color: #EEEEEE;
}
.hp-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.hp-link:hover { color: var(--yellow); }
/* Checkbox customizado (moderno, mesmo tema escuro/amarelo) */
.hp-cbx {
    position: relative;
    flex: none;
    width: 30px;
    height: 30px;
    display: inline-block;
}
.hp-cbx__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.hp-cbx__box {
    position: absolute;
    inset: 0;
    border-radius: 10px;
    border: 1.5px solid var(--border-strong);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #151515;
    pointer-events: none;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.hp-cbx__box svg {
    width: 18px;
    height: 18px;
    opacity: 0;
    transform: scale(0.55);
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.hp-cbx__input:hover + .hp-cbx__box { border-color: var(--yellow); }
.hp-cbx__input:active + .hp-cbx__box { transform: scale(0.92); }
.hp-cbx__input:focus-visible + .hp-cbx__box { outline: 2px solid var(--yellow); outline-offset: 3px; }
.hp-cbx__input:checked + .hp-cbx__box {
    background: var(--yellow);
    border-color: var(--yellow);
}
.hp-cbx__input:checked + .hp-cbx__box svg { opacity: 1; transform: scale(1); }

.hp-helper {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--muted);
    margin: 30px 0 18px;
}

/* --- Erros --------------------------------------------------------------- */
.hp-fielderror {
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--err-field);
    margin: 14px 0 0;
}
.hp-requesterror {
    font-size: 14px;
    font-weight: 500;
    color: var(--err-request);
    margin: 16px 0 0;
    text-align: center;
}

/* --- Botão principal ----------------------------------------------------- */
.hp-submit {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-ui);
    background: var(--btn-off-bg);
    color: var(--btn-off-text);
    cursor: not-allowed;
    margin-top: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.2s, color 0.2s;
}
.hp-submit:not([disabled]) {
    background: var(--yellow);
    color: var(--btn-on-text);
    cursor: pointer;
}
.hp-submit:not([disabled]):hover { background: var(--yellow-hover); }
.hp-submit:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
/* Mantém o botão amarelo enquanto mostra "Aguarde..." (mesmo desabilitado). */
.hp-submit.is-sending { background: var(--yellow); color: var(--btn-on-text); cursor: progress; }

.hp-bottomlink {
    display: block;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 4px;
    margin-top: 26px;
}
.hp-bottomlink:hover { color: var(--yellow); }

/* --- Placeholders de imagem ---------------------------------------------- */
.ph {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #8a8a8a;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    font-size: 12px;
    padding: 10px;
}
.ph--identity { width: min(300px, 40vw); aspect-ratio: 1 / 1; }
.ph--center { width: 100%; height: 100%; }
.ph--splash { width: 100%; height: 100%; border-radius: 20px; }

/* ==========================================================================
   Splash de abertura (seção 5)
   ========================================================================== */
.splash[hidden] { display: none; }
.splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background:
        radial-gradient(circle at 50% 48%, rgba(255, 223, 0, 0.06) 0%, rgba(255, 223, 0, 0) 55%),
        radial-gradient(circle at 50% 48%,
            #4D4614 0%, #35300E 14%, #1C1A08 32%, #0A0A08 52%, #000000 78%);
    transition: opacity 0.45s ease, visibility 0.45s ease;
}
.splash.is-hiding { opacity: 0; visibility: hidden; }
.splash__inner { display: flex; flex-direction: column; align-items: center; gap: 32px; }
.splash__logo {
    width: 160px; height: 160px;
    display: flex; align-items: center; justify-content: center;
    animation: splash-in 0.7s ease both, splash-pulse 2.4s ease-in-out 0.7s infinite;
    filter: drop-shadow(0 0 24px rgba(196, 216, 48, 0.30));
}
.splash__logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.splash__bar {
    width: 160px; height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    animation: splash-in 0.6s ease 0.4s both;
}
.splash__seg {
    display: block;
    width: 40%; height: 100%;
    border-radius: 2px;
    background: var(--yellow);
    animation: splash-slide 1.2s ease-in-out infinite;
}
@keyframes splash-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
@keyframes splash-pulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 24px rgba(196, 216, 48, 0.30)); }
    50% { transform: scale(1.04); filter: drop-shadow(0 0 36px rgba(196, 216, 48, 0.50)); }
}
@keyframes splash-slide { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }

/* ==========================================================================
   Modal (tema escuro) — componente deste projeto (seção 11)
   ========================================================================== */
.modal[hidden] { display: none; }
.modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.modal__overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.modal__dialog {
    position: relative;
    width: 100%;
    max-height: 85vh;
    display: flex; flex-direction: column;
    animation: modal-in 0.18s ease both;
}
.modal--dark .modal__dialog {
    max-width: 520px;
    background: #2B2B2B;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
}
.modal__header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 8px; }
.modal__title { margin: 0; font-size: 19px; font-weight: 600; }
.modal__close {
    width: 36px; height: 36px; border-radius: 50%;
    border: 0; background: transparent; color: inherit; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.modal__close svg { width: 22px; height: 22px; }
.modal--dark .modal__close:hover { color: var(--yellow); }
.modal__body { padding: 8px 22px 16px; overflow-y: auto; line-height: 1.5; }
.modal__footer { padding: 8px 22px 20px; display: flex; justify-content: flex-end; }
.modal__action {
    border: 0; border-radius: 999px; padding: 11px 22px;
    font-weight: 700; font-size: 15px; cursor: pointer;
    background: var(--yellow); color: var(--btn-on-text);
}
.modal__action:hover { background: var(--yellow-hover); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   Responsivo — 950px ou menos (seção 6)
   ========================================================================== */
@media (max-width: 950px) {
    body.home {
        background: radial-gradient(circle at 50% 32%,
            #4D4614 0%, #2F2A0C 20%, #121110 48%, #000000 100%);
    }
    .home-layout { display: block; min-height: auto; }
    .home-identity {
        min-height: 190px;
        height: auto;
        padding: 46px 30px;
        background:
            radial-gradient(circle at 50% 40%,
                rgba(77, 70, 20, 0.5) 0%, rgba(28, 26, 8, 0.35) 45%, transparent 72%);
    }
    .home-identity__img, .ph--identity { width: min(247px, 72vw); }
    .home-panel-wrap { display: block; }
    .home-panel {
        width: 100%;
        margin: 0;
        min-height: auto;
        border-radius: 34px 34px 0 0;
        padding: 30px 24px 40px;
        box-shadow: none;
    }
}

/* --- 480px ou menos ------------------------------------------------------ */
@media (max-width: 480px) {
    .home-panel { padding: 30px 16px 36px; }
    .hp-header { gap: 8px; }
    .hp-iconbtn svg { width: 25px; height: 25px; }
    .hp-center__frame { margin-top: 30px; }
    .hp-fieldbox { padding: 0 16px; }
    .hp-input { height: 80px; font-size: 31px; letter-spacing: 0.30em; }
    .hp-switchrow { min-height: 80px; }
    .hp-switchrow__label { font-size: 16px; }
    .hp-switch { width: 72px; height: 45px; }
    .hp-switch__knob { width: 31px; height: 31px; top: 7px; left: 7px; }
    .hp-switch[aria-checked="true"] .hp-switch__knob { transform: translateX(27px); }
    .hp-agree__text { font-size: 15px; }
    .hp-cbx { width: 32px; height: 32px; }
    .hp-bottomlink { font-size: 14px; margin-top: 22px; }
    .splash__logo { width: 120px; height: 120px; }
    .splash__bar { width: 120px; }
}

/* --- Movimento reduzido -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .splash__logo, .splash__bar, .splash__seg { animation: none; }
    .splash { transition: opacity 0.2s; }
}
