/* =========================================================
   ENTRANCE
   ========================================================= */

#entrance {
    position: fixed;
    z-index: 1000;
    inset: 0;

    width: 100vw;
    height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    background: #ffffff;

    transition:
        background-color 0.9s ease-in-out;
}

#entrance.showing-head-sequence {
    background: transparent !important;

    pointer-events: none;
}

/* =========================================================
   BOTÃO INICIAL
   ========================================================= */

#remember-button {
    position: relative;

    width: min(
        390px,
        calc(100vw - 48px)
    );

    min-height: 58px;

    padding: 0 22px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    outline: 0;

    background: transparent;
    color: var(--black);

    cursor: default;

    opacity: 1;

    transition:
        opacity 0.9s ease-in-out,
        transform 0.9s ease-in-out;
}

#remember-button.ready {
    cursor: pointer;
}

#remember-button.disappearing {
    opacity: 0;

    transform: scale(0.985);

    pointer-events: none;
}

#remember-word {
    position: relative;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 13px;
    font-weight: 300;
    letter-spacing: 3px;
    line-height: 1;

    text-transform: lowercase;
    white-space: nowrap;
}

.remember-letter {
    display: inline-block;

    opacity: 0;

    filter: blur(2px);

    transform:
        translateY(2px)
        scale(0.98);

    transition:
        opacity 0.8s ease-in-out,
        filter 0.8s ease-in-out,
        transform 0.8s ease-in-out;
}

.remember-letter.visible {
    opacity: 1;

    filter: blur(0);

    transform:
        translateY(0)
        scale(1);
}

.remember-letter.hiding {
    opacity: 0;

    filter: blur(2px);

    transform:
        translateY(-1px)
        scale(0.99);

    transition:
        opacity 0.55s ease-in-out,
        filter 0.55s ease-in-out,
        transform 0.55s ease-in-out;
}

#remember-word::before,
#remember-word::after {
    content: none !important;

    display: none !important;
}

/* =========================================================
   BORDA DO BOTÃO
   ========================================================= */

.button-border {
    position: absolute;

    display: block;

    background: var(--black);

    pointer-events: none;
}

.border-top {
    top: 0;
    left: 0;

    width: 0;
    height: 1px;
}

.border-right {
    top: 0;
    right: 0;

    width: 1px;
    height: 0;
}

.border-bottom {
    right: 0;
    bottom: 0;

    width: 0;
    height: 1px;
}

.border-left {
    bottom: 0;
    left: 0;

    width: 1px;
    height: 0;
}

#remember-button.drawing
.border-top {
    animation:
        draw-border-horizontal
        0.8s
        ease-in-out
        forwards;
}

#remember-button.drawing
.border-right {
    animation:
        draw-border-vertical
        0.8s
        ease-in-out
        0.8s
        forwards;
}

#remember-button.drawing
.border-bottom {
    animation:
        draw-border-horizontal
        0.8s
        ease-in-out
        1.6s
        forwards;
}

#remember-button.drawing
.border-left {
    animation:
        draw-border-vertical
        0.8s
        ease-in-out
        2.4s
        forwards;
}

@keyframes draw-border-horizontal {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes draw-border-vertical {
    from {
        height: 0;
    }

    to {
        height: 100%;
    }
}

#remember-button.hide-border
.button-border {
    opacity: 0;

    transition:
        opacity 0.7s ease-in-out;
}

/* =========================================================
   INITIALIZING BERNARD
   ========================================================= */

.initializing-sequence {
    position: fixed;
    z-index: 1100;
    inset: 0;

    width: 100vw;
    height: 100vh;

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.55s ease-in-out,
        visibility 0s linear 0.55s;
}

.initializing-sequence.visible {
    opacity: 1;
    visibility: visible;

    transition:
        opacity 0.55s ease-in-out,
        visibility 0s linear 0s;
}

.initializing-status {
    position: absolute;

    right: clamp(22px, 3vw, 48px);
    bottom: clamp(22px, 3vw, 46px);

    width: min(
        270px,
        calc(100vw - 44px)
    );

    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 11px;
}

.bernard-welcome {
    margin: 0;

    display: flex;
    justify-content: flex-end;

    color: #111111;

    font-size: 10px;
    font-weight: 300;
    letter-spacing: 4px;
    line-height: 1.2;

    white-space: nowrap;

    opacity: 0;

    text-shadow:
        0 0 8px rgba(
            255,
            255,
            255,
            0.95
        );
}

.bernard-welcome.sequence-visible {
    animation:
        initializing-pulse
        1.25s
        ease-in-out
        infinite;
}

@keyframes initializing-pulse {
    0%,
    100% {
        opacity: 0.58;
    }

    50% {
        opacity: 1;
    }
}

.initializing-letter {
    display: inline-block;

    opacity: 0;

    transition:
        opacity 0.65s ease-in-out;
}

.initializing-letter.visible {
    opacity: 1;
}

.initializing-progress {
    width: 100%;
    height: 1px;

    position: relative;

    overflow: hidden;

    background:
        rgba(
            17,
            17,
            17,
            0.22
        );
}

#initializing-progress-fill {
    position: absolute;
    inset:
        0
        auto
        0
        0;

    width: 0%;
    height: 100%;

    display: block;

    background: #111111;

    transition:
        width 1.1s
        cubic-bezier(
            0.22,
            0.61,
            0.36,
            1
        );
}

/* =========================================================
   RESPONSIVO
   ========================================================= */

@media (max-width: 700px) {
    #remember-button {
        width:
            calc(
                100vw - 32px
            );

        min-height: 54px;

        padding:
            0
            14px;
    }

    #remember-word {
        font-size: 10px;
        letter-spacing: 2px;
    }

    .initializing-status {
        right: 18px;
        bottom: 18px;

        width:
            min(
                225px,
                calc(100vw - 36px)
            );
    }

    .bernard-welcome {
        font-size: 9px;
        letter-spacing: 3px;
    }
}


/* =========================================================
   BERNARD v1.0.0 — BUTTON READY PULSE
   ========================================================= */

#remember-button.ready-pulse {
    animation:
        remember-button-ready-pulse
        0.72s
        cubic-bezier(
            0.22,
            0.61,
            0.36,
            1
        )
        both;
}

@keyframes remember-button-ready-pulse {
    0% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.035);
    }

    100% {
        transform: scale(1);
    }
}

/* =========================================================
   BERNARD v1.5.0 — CINEMATIC RECONSTRUCTION SEQUENCE
   ========================================================= */

.entrance-visual-sequence {
    position: absolute;
    z-index: 0;
    inset: 0;

    overflow: hidden;

    background: #ffffff;

    pointer-events: none;
}

.entrance-visual-frame {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
    object-position: center;

    opacity: 0;
    filter: blur(8px);
    transform: scale(1.025);

    user-select: none;

    transition:
        opacity 2800ms cubic-bezier(0.22, 0.61, 0.36, 1),
        filter 2800ms cubic-bezier(0.22, 0.61, 0.36, 1),
        transform 6200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.entrance-visual-frame.is-visible {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
}

.entrance-visual-frame.is-leaving {
    opacity: 0;
    filter: blur(5px);
    transform: scale(0.992);

    transition:
        opacity 2200ms ease-in-out,
        filter 2200ms ease-in-out,
        transform 2200ms ease-in-out;
}

#remember-button {
    z-index: 2;
}

#entrance.showing-head-sequence
.entrance-visual-sequence {
    opacity: 0;
    visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .entrance-visual-frame {
        transition-duration: 700ms;
    }
}

/* =========================================================
   BERNARD v1.6.0 — SIGNATURE ENTRANCE
   ========================================================= */

.entrance-brand {
    position: absolute;
    z-index: 3;
    left: clamp(28px, 5vw, 92px);
    top: 50%;
    width: 210px;
    display: flex;
    align-items: center;
    gap: 15px;
    transform: translateY(-50%);
    color: #111;
    pointer-events: none;
}

.entrance-brand-mark {
    width: 58px;
    height: auto;
    flex: 0 0 auto;
    overflow: visible;
}

.brand-line {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.15;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    stroke-dasharray: 112;
    stroke-dashoffset: 112;
}

.entrance-brand.drawing .brand-line-a {
    animation: entrance-brand-draw 1.35s cubic-bezier(.65,0,.35,1) forwards;
}

.entrance-brand.drawing .brand-line-b {
    animation: entrance-brand-draw 1.35s cubic-bezier(.65,0,.35,1) .72s forwards;
}

@keyframes entrance-brand-draw {
    to { stroke-dashoffset: 0; }
}

.entrance-brand-type {
    min-width: 118px;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

#entrance-brand-name,
#entrance-brand-project {
    display: flex;
    justify-content: center;
    white-space: nowrap;
    text-transform: uppercase;
}

#entrance-brand-name {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 4.2px;
}

#entrance-brand-project {
    margin-top: 8px;
    font-size: 7px;
    font-weight: 300;
    letter-spacing: 3.2px;
}

.entrance-brand-letter {
    display: inline-block;
    opacity: 0;
    filter: blur(2px);
    transform: translateY(2px);
    transition: opacity .8s ease, filter .8s ease, transform .8s ease;
}

.entrance-brand-letter.visible {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

.entrance-brand.leaving {
    opacity: 0;
    transform: translateY(-50%) scale(.985);
    transition: opacity .9s ease .25s, transform .9s ease .25s;
}

#remember-button {
    width: 76px;
    height: 76px;
    min-height: 76px;
    padding: 0;
    border-radius: 50%;
}

#remember-word {
    position: absolute;
    inset: 0;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.on-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    transform: rotate(-90deg);
}

.on-ring-track {
    fill: rgba(255,255,255,.08);
    stroke: #111;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
    stroke-dasharray: 195;
    stroke-dashoffset: 195;
    transition: stroke-dashoffset 1.15s cubic-bezier(.65,0,.35,1);
}

#remember-button.drawing .on-ring-track {
    animation: entrance-on-ring-draw 2.2s cubic-bezier(.65,0,.35,1) forwards;
}

@keyframes entrance-on-ring-draw {
    to { stroke-dashoffset: 0; }
}

#remember-button.ring-reversing .on-ring-track {
    animation: entrance-on-ring-reverse .9s cubic-bezier(.65,0,.35,1) forwards;
}

@keyframes entrance-on-ring-reverse {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -195; }
}

#remember-button.hide-border .button-border {
    opacity: 0;
}

#remember-button.ready-pulse {
    animation: entrance-on-ready .72s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes entrance-on-ready {
    0% { transform: scale(1); }
    48% { transform: scale(1.09); }
    72% { transform: scale(.985); }
    100% { transform: scale(1); }
}

#entrance.showing-head-sequence .entrance-brand {
    opacity: 0;
    visibility: hidden;
}

@media (max-width: 700px) {
    .entrance-brand {
        left: 22px;
        top: 22%;
        width: 175px;
        gap: 11px;
    }

    .entrance-brand-mark { width: 48px; }
    #entrance-brand-name { font-size: 9px; letter-spacing: 3px; }
    #entrance-brand-project { font-size: 6px; letter-spacing: 2.4px; }

    #remember-button {
        width: 68px;
        height: 68px;
        min-height: 68px;
        padding: 0;
    }
}


/* =========================================================
   BERNARD v1.6.1 — LOGO + ON POSITION FIX
   ========================================================= */

.entrance-brand-mark {
    width: 54px;
}

.brand-line {
    stroke-width: 1.35;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

#remember-button {
    position: absolute;
    z-index: 4;
    right: clamp(34px, 8vw, 150px);
    top: 50%;
    left: auto;
    bottom: auto;
    margin: 0;
    transform: translateY(-50%);
}

#remember-button.disappearing {
    transform: translateY(-50%) scale(0.985);
}

#remember-button.ready-pulse {
    animation: entrance-on-ready-right .72s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes entrance-on-ready-right {
    0% { transform: translateY(-50%) scale(1); }
    48% { transform: translateY(-50%) scale(1.09); }
    72% { transform: translateY(-50%) scale(.985); }
    100% { transform: translateY(-50%) scale(1); }
}

.on-ring-track {
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

@keyframes entrance-on-ring-draw {
    0% { stroke-dashoffset: 100; }
    99% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -0.35; }
}

@keyframes entrance-on-ring-reverse {
    from { stroke-dashoffset: -0.35; }
    to { stroke-dashoffset: -100; }
}

@media (max-width: 700px) {
    #remember-button {
        right: 24px;
        top: 50%;
    }
}


/* =========================================================
   BERNARD v1.6.2 — PRECISE MARK ALIGNMENT + CLOSED ON RING
   ========================================================= */

/* Two perfectly mirrored paths sharing the same centre axis. */
.entrance-brand-mark {
    width: 54px;
    height: 49px;
    display: block;
}

.brand-line {
    stroke-width: 1.35;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100 100;
    stroke-dashoffset: 100;
}

/* Keep the lettering optically aligned with the corrected symbol. */
.entrance-brand {
    align-items: center;
}

.entrance-brand-type {
    transform: translateY(1px);
}

/* Explicit two-value dash pattern while drawing. */
.on-ring-track {
    stroke-linecap: round;
    stroke-dasharray: 100 100;
    stroke-dashoffset: 100;
}

@keyframes entrance-on-ring-draw {
    from { stroke-dasharray: 100 100; stroke-dashoffset: 100; }
    to   { stroke-dasharray: 100 100; stroke-dashoffset: 0; }
}

/* Once ready, render a truly continuous circumference with no seam. */
#remember-button.ready .on-ring-track,
#remember-button.ready-pulse .on-ring-track {
    animation: none !important;
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
}

@keyframes entrance-on-ring-reverse {
    from { stroke-dasharray: 100 100; stroke-dashoffset: 0; }
    to   { stroke-dasharray: 100 100; stroke-dashoffset: -100; }
}

/* =========================================================
   BERNARD v1.6.3 — COMPACT SIGNATURE + LEFT-ALIGNED PROJECT
   ========================================================= */
.entrance-brand-mark {
    width: 45px;
    height: 41px;
}

.entrance-brand {
    gap: 13px;
}

.entrance-brand-type {
    min-width: 118px;
    align-items: flex-start;
}

#entrance-brand-name,
#entrance-brand-project {
    width: auto;
    justify-content: flex-start;
    text-align: left;
}

#entrance-brand-project {
    align-self: flex-start;
}

@media (max-width: 700px) {
    .entrance-brand-mark {
        width: 41px;
        height: 37px;
    }
}


/* =========================================================
   BERNARD v1.6.4 — SMALLER, STRONGER ENTRANCE MARK
   ========================================================= */
.entrance-brand-mark {
    width: 31px;
    height: 28px;
    flex: 0 0 31px;
}

.brand-line {
    stroke-width: 2;
}

@media (max-width: 700px) {
    .entrance-brand-mark {
        width: 29px;
        height: 26px;
        flex-basis: 29px;
    }
}
