/* =====================================================================
   Efeitos e animações (Dark Glass & Cyan)
   Os estados "escondidos" só valem com html.fx, que o effects.js liga.
   ===================================================================== */

/* ---------- Fundo vivo ---------- */
body {
    background: #080b11;
}

.bg-fx {
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    position: fixed;
    z-index: -1;
}

.bg-grid {
    background-image:
        linear-gradient(rgba(0, 229, 255, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, .05) 1px, transparent 1px);
    background-size: 56px 56px;
    inset: -56px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, #000 20%, transparent 75%);
    position: absolute;
    animation: grid-pan 22s linear infinite;
}

.bg-blob {
    border-radius: 50%;
    filter: blur(80px);
    opacity: .5;
    position: absolute;
    will-change: transform;
}

.blob-a {
    background: rgba(0, 229, 255, .22);
    height: 42vw;
    left: 38%;
    top: -16vw;
    width: 42vw;
    animation: blob-drift-a 18s ease-in-out infinite alternate;
}

.blob-b {
    background: rgba(99, 102, 241, .22);
    height: 36vw;
    right: -12vw;
    top: 30vh;
    width: 36vw;
    animation: blob-drift-b 24s ease-in-out infinite alternate;
}

.blob-c {
    background: rgba(16, 185, 129, .1);
    bottom: -18vw;
    height: 40vw;
    left: -10vw;
    width: 40vw;
    animation: blob-drift-a 28s ease-in-out infinite alternate-reverse;
}

@keyframes grid-pan {
    to { transform: translate3d(56px, 56px, 0); }
}

@keyframes blob-drift-a {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(-8vw, 6vh, 0) scale(1.15); }
}

@keyframes blob-drift-b {
    0% { transform: translate3d(0, 0, 0) scale(1.1); }
    100% { transform: translate3d(-10vw, -8vh, 0) scale(.9); }
}

/* ---------- Topbar ---------- */
.topbar {
    background: rgba(8, 11, 17, .72);
}

.scroll-progress {
    background: linear-gradient(90deg, #00e5ff, #6366f1);
    bottom: -1px;
    box-shadow: 0 0 12px rgba(0, 229, 255, .6);
    height: 2px;
    left: 0;
    position: absolute;
    transform: scaleX(var(--p, 0));
    transform-origin: left;
    width: 100%;
}

.brand-mark {
    animation: mark-glow 4s ease-in-out infinite;
}

@keyframes mark-glow {
    50% { box-shadow: 0 0 34px rgba(0, 229, 255, .65), inset 0 1px 0 rgba(255, 255, 255, .45); }
}

.top-links {
    gap: 18px;
}

/* ---------- Seletor de idioma ---------- */
.lang-switch {
    background: rgba(12, 16, 24, .75);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 999px;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    padding: 3px;
    position: relative;
}

.lang-thumb {
    background: linear-gradient(135deg, rgba(0, 229, 255, .22), rgba(99, 102, 241, .22));
    border-radius: 999px;
    bottom: 3px;
    box-shadow: inset 0 0 0 1px rgba(0, 229, 255, .45), 0 0 18px rgba(0, 229, 255, .25);
    left: 3px;
    position: absolute;
    top: 3px;
    transition: transform .45s cubic-bezier(.34, 1.56, .64, 1);
    width: calc(50% - 3px);
}

.lang-switch[data-active="en-US"] .lang-thumb {
    transform: translateX(100%);
}

.lang-option {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: #94a3b8;
    cursor: pointer;
    display: inline-flex;
    font: 700 11px var(--mono);
    gap: 6px;
    justify-content: center;
    letter-spacing: .4px;
    padding: 6px 11px;
    position: relative;
    transition: color .25s;
    z-index: 1;
}

.lang-option:hover {
    color: #e2e8f0;
}

.lang-option.active {
    color: #b8f8ff;
}

.lang-flag {
    font-size: 13px;
    line-height: 1;
}

body.lang-swapping main,
body.lang-swapping .sidebar {
    animation: lang-swap .45s cubic-bezier(.16, 1, .3, 1);
}

@keyframes lang-swap {
    0% { filter: blur(6px); opacity: .25; transform: translateY(6px); }
    100% { filter: none; opacity: 1; transform: none; }
}

/* ---------- Entrada do hero ---------- */
html.fx .hero-in {
    animation: hero-in .9s cubic-bezier(.16, 1, .3, 1) both;
    animation-delay: calc(var(--d, 0) * 120ms + 80ms);
}

@keyframes hero-in {
    from { filter: blur(8px); opacity: 0; transform: translateY(22px); }
    to { filter: none; opacity: 1; transform: none; }
}

.hero h1 span {
    animation: shimmer 6s linear infinite;
    background: linear-gradient(95deg, #00e5ff 0%, #6366f1 35%, #a5f3fc 55%, #00e5ff 100%);
    background-clip: text;
    -webkit-background-clip: text;
    background-size: 220% 100%;
}

@keyframes shimmer {
    to { background-position: -220% 0; }
}

/* ---------- Átomo ---------- */
.hero-art {
    perspective: 700px;
    transform-style: preserve-3d;
}

.hero-art > .art-stage {
    inset: 0;
    position: absolute;
}

.art-orbit::before {
    animation: electron 5.5s linear infinite;
    background: radial-gradient(circle at 50% 0, #ffffff 0 2.5px, #00e5ff 3.5px, rgba(0, 229, 255, .35) 6px, transparent 9px);
    border-radius: 50%;
    content: "";
    inset: -5px;
    position: absolute;
}

.orbit-two::before {
    animation-direction: reverse;
    animation-duration: 7.5s;
    background: radial-gradient(circle at 50% 0, #ffffff 0 2.5px, #818cf8 3.5px, rgba(129, 140, 248, .35) 6px, transparent 9px);
}

.orbit-three {
    border-color: rgba(16, 185, 129, .18);
    transform: rotate(90deg) scaleY(.36);
}

.orbit-three::before {
    animation-duration: 9s;
    background: radial-gradient(circle at 50% 0, #ffffff 0 2px, #10b981 3px, rgba(16, 185, 129, .35) 5px, transparent 8px);
}

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

.art-core {
    animation: core-pulse 3.6s ease-in-out infinite, core-float 6s ease-in-out infinite;
    transition: transform .3s ease-out;
}

@keyframes core-pulse {
    50% { box-shadow: 0 0 80px rgba(60, 140, 255, .55), 0 0 0 10px rgba(60, 140, 255, .06), inset 0 0 22px rgba(120, 190, 255, .25); }
}

@keyframes core-float {
    50% { translate: 0 -6px; }
}

.art-tag {
    animation: tag-float 4.5s ease-in-out infinite;
    backdrop-filter: blur(8px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

.tag-server { animation-delay: -1.5s; }
.tag-state { animation-delay: -3s; }

@keyframes tag-float {
    50% { translate: 0 -7px; }
}

/* ---------- Botões ---------- */
.button {
    isolation: isolate;
    overflow: hidden;
    position: relative;
}

.button-primary::after {
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
    content: "";
    inset: 0;
    position: absolute;
    transform: translateX(-120%);
    z-index: -1;
}

.button-primary:hover::after {
    transform: translateX(120%);
    transition: transform .7s ease;
}

.ripple {
    animation: ripple .6s ease-out forwards;
    background: rgba(255, 255, 255, .45);
    border-radius: 50%;
    height: 12px;
    margin: -6px 0 0 -6px;
    pointer-events: none;
    position: absolute;
    width: 12px;
}

@keyframes ripple {
    to { opacity: 0; transform: scale(18); }
}

/* ---------- Revelar ao rolar ---------- */
html.fx .reveal {
    opacity: 0;
    transform: translateY(26px) scale(.985);
    transition:
        opacity .8s cubic-bezier(.16, 1, .3, 1),
        transform .8s cubic-bezier(.16, 1, .3, 1),
        border-color .2s, box-shadow .2s;
    transition-delay: calc(var(--i, 0) * 70ms);
}

html.fx .reveal.in {
    opacity: 1;
    transform: none;
}

html.fx .api-category.reveal tbody tr {
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity .5s ease, transform .5s cubic-bezier(.16, 1, .3, 1);
    transition-delay: calc(var(--i, 0) * 28ms + 120ms);
}

html.fx .api-category.reveal.in tbody tr {
    opacity: 1;
    transform: none;
}

/* Resultados de busca/aba/idioma: aparecem na hora, com um fade curto. */
.quick-in {
    animation: quick-in .28s ease both;
}

@keyframes quick-in {
    from { opacity: .35; }
    to { opacity: 1; }
}

/* ---------- Brilho que segue o mouse ---------- */
.spot {
    background-image: radial-gradient(420px circle at var(--mx, -999px) var(--my, -999px), rgba(0, 229, 255, .09), transparent 42%);
}

.api-table-wrap.spot {
    background-color: rgba(12, 16, 24, .55);
}

/* ---------- Abas Server/Client com indicador deslizante ---------- */
.tabs {
    position: relative;
}

.tabs-thumb,
.seg-thumb {
    border-radius: 9px;
    box-shadow: inset 0 0 0 1px rgba(0, 229, 255, .45), 0 0 18px rgba(0, 229, 255, .16);
    background: rgba(0, 229, 255, .12);
    height: var(--th, 0);
    left: 0;
    position: absolute;
    top: 0;
    transform: translate(var(--tx, 0), var(--ty, 0));
    transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), width .45s cubic-bezier(.34, 1.56, .64, 1);
    width: var(--tw, 0);
}

.tab,
.seg {
    position: relative;
    z-index: 1;
}

.tabs .tab.active,
.segmented .seg.active {
    background: transparent;
    box-shadow: none;
}

.segmented {
    position: relative;
}

.seg-thumb {
    border-radius: 8px;
}

/* ---------- Sidebar ---------- */
.side-link {
    position: relative;
    transition: color .25s, background .25s, padding-left .25s;
}

.side-link.active {
    padding-left: 16px;
}

.side-link::before {
    background: #00e5ff;
    border-radius: 2px;
    box-shadow: 0 0 10px #00e5ff;
    content: "";
    height: 0;
    left: 0;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: height .3s cubic-bezier(.34, 1.56, .64, 1);
    width: 2px;
}

.side-link.active::before {
    height: 60%;
}

.side-link.active {
    box-shadow: none;
}

/* ---------- Playground ---------- */
.pg-terminal {
    overflow: hidden;
    position: relative;
}

.pg-term-bar {
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    display: flex;
    gap: 6px;
    margin: -16px -16px 4px;
    padding: 10px 14px;
}

.pg-term-bar i {
    background: #f43f5e;
    border-radius: 50%;
    height: 9px;
    opacity: .85;
    width: 9px;
}

.pg-term-bar i:nth-child(2) { background: #f59e0b; }
.pg-term-bar i:nth-child(3) { background: #10b981; }

.pg-term-bar span {
    color: #64748b;
    font: 10px var(--mono);
    margin-left: 8px;
}

.pg-terminal::after {
    background: linear-gradient(180deg, transparent, rgba(0, 229, 255, .16), transparent);
    content: "";
    height: 80px;
    left: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: -80px;
}

.pg-terminal.flash::after {
    animation: scan .9s cubic-bezier(.16, 1, .3, 1);
}

@keyframes scan {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(620px); }
}

.pg-line {
    animation: line-in .35s cubic-bezier(.16, 1, .3, 1) both;
    display: flex;
    gap: 8px;
}

.pg-arrow {
    flex: 0 0 auto;
    margin: 0;
}

.pg-body {
    min-width: 0;
}

.pg-dim {
    color: #64748b;
    font-size: 10px;
}

.pg-dim .pg-arrow {
    color: #00e5ff;
    font-size: 8px;
    line-height: 17px;
}

.pg-run {
    color: #94a3b8;
}

.pg-ret pre {
    text-shadow: 0 0 12px rgba(0, 229, 255, .35);
}

@keyframes line-in {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: none; }
}

.pg-spinner {
    animation: spin .7s linear infinite;
    border: 2px solid rgba(0, 229, 255, .25);
    border-radius: 50%;
    border-top-color: #00e5ff;
    display: inline-block;
    height: 11px;
    vertical-align: -1px;
    width: 11px;
}

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

#pg-run.is-running {
    animation: run-pulse .9s ease-in-out infinite;
}

#pg-run .run-icon {
    display: inline-block;
    transition: transform .25s;
}

#pg-run:hover .run-icon {
    transform: translateX(3px) scale(1.15);
}

@keyframes run-pulse {
    50% { box-shadow: 0 0 34px rgba(0, 229, 255, .65); }
}

#pg-reset .reset-icon {
    display: inline-block;
}

#pg-reset.spin .reset-icon {
    animation: spin .6s cubic-bezier(.34, 1.56, .64, 1);
}

.pane-in .pg-field,
.pg-field-in {
    animation: field-in .45s cubic-bezier(.16, 1, .3, 1) both;
    animation-delay: calc(var(--i, 0) * 45ms);
}

@keyframes field-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* Interruptor "manter estado" */
.pg-toggle {
    align-items: flex-start;
    cursor: pointer;
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.pg-toggle input {
    height: 1px;
    opacity: 0;
    position: absolute;
    width: 1px;
}

.pg-switch {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    flex: 0 0 34px;
    height: 20px;
    margin-top: 1px;
    position: relative;
    transition: background .25s, border-color .25s;
}

.pg-switch::after {
    background: #94a3b8;
    border-radius: 50%;
    content: "";
    height: 14px;
    left: 2px;
    position: absolute;
    top: 2px;
    transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), background .25s;
    width: 14px;
}

.pg-toggle input:checked + .pg-switch {
    background: rgba(0, 229, 255, .2);
    border-color: rgba(0, 229, 255, .55);
}

.pg-toggle input:checked + .pg-switch::after {
    background: #00e5ff;
    box-shadow: 0 0 10px #00e5ff;
    transform: translateX(14px);
}

.pg-toggle input:focus-visible + .pg-switch {
    box-shadow: 0 0 0 3px rgba(0, 229, 255, .25);
}

.pg-toggle-text {
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    font-size: 12px;
    gap: 2px;
}

.pg-toggle-text small {
    color: #64748b;
    font-size: 10px;
}

/* ---------- Celular ---------- */
@media (max-width: 720px) {
    .top-links {
        gap: 10px;
    }

    .lang-option {
        padding: 5px 8px;
    }

    .lang-flag {
        display: none;
    }

    .bg-grid {
        background-size: 40px 40px;
    }
}

@media (max-width: 420px) {
    .github-link {
        display: none;
    }
}

/* ---------- Acessibilidade: menos movimento ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        scroll-behavior: auto !important;
        transition: none !important;
    }

    html.fx .reveal,
    html.fx .hero-in,
    html.fx .api-category tbody tr {
        filter: none;
        opacity: 1;
        transform: none;
    }
}

svg.lang-flag {
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .15);
    flex: 0 0 auto;
    height: 11px;
    width: 16px;
}

@media (max-width: 720px) {
    svg.lang-flag {
        display: inline-block;
    }
}

/* ---------- Glow do botão: folga lateral para o overflow do hero ---------- */
.hero {
    border-bottom: 0;
    margin-left: -36px;
    padding-left: 36px;
}

.hero::after {
    background: rgba(255, 255, 255, .07);
    bottom: 0;
    content: "";
    height: 1px;
    left: 36px;
    position: absolute;
    right: 0;
}

@media (max-width: 980px) {
    .hero {
        margin-left: -24px;
        padding-left: 24px;
    }

    .hero::after {
        left: 24px;
    }
}

@media (max-width: 720px) {
    .hero {
        margin-left: -16px;
        padding-left: 16px;
    }

    .hero::after {
        left: 16px;
    }
}

/* ---------- Playground: argumentos em Lua ---------- */
.pg-lua {
    font-family: var(--mono);
}

textarea.pg-input {
    line-height: 1.5;
    min-height: 40px;
    resize: vertical;
}

.pg-type {
    color: #818cf8;
    font-size: 9px;
    letter-spacing: 0;
    text-transform: none;
}

.pg-doc {
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.55;
    margin: 8px 0 0;
}

.pg-lua-hint {
    margin: -2px 0 12px;
}

.pg-noargs {
    margin: 0 0 8px;
}

.pg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.pg-chip {
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    font: 10px var(--mono);
    max-width: 100%;
    overflow: hidden;
    padding: 3px 7px;
    text-overflow: ellipsis;
    transition: border-color .15s, color .15s, background .15s, transform .15s;
    white-space: nowrap;
}

.pg-chip:hover {
    background: rgba(0, 229, 255, .08);
    border-color: rgba(0, 229, 255, .45);
    color: #b8f8ff;
    transform: translateY(-1px);
}

.pg-ret pre {
    white-space: pre-wrap;
}

.pg-err pre {
    background: none;
    border: 0;
    box-shadow: none;
    color: #fb7185;
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
}

.pg-fx-state { color: #67e8f9; }
.pg-fx-state .pg-arrow { color: #00e5ff; }
.pg-fx-sql { color: #a5b4fc; }
.pg-fx-sql .pg-arrow { color: #818cf8; }
.pg-fx-event { color: #94a3b8; }
.pg-fx-event .pg-arrow { color: #64748b; }
.pg-fx-warn { color: #fbbf24; }
.pg-fx-warn .pg-arrow { color: #f59e0b; }
.pg-fx-info { color: #818cf8; }
.pg-fx-info .pg-arrow { color: #818cf8; }

.pg-output {
    max-height: 420px;
}

/* ---------- Espaço em parallax (space.js) ---------- */
.bg-space {
    inset: 0;
    pointer-events: none;
    position: absolute;
    /* mais forte nas laterais, discreto atrás da coluna de leitura */
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 14%, rgba(0, 0, 0, .4) 34%, rgba(0, 0, 0, .4) 66%, #000 86%, #000 100%);
    mask-image: linear-gradient(90deg, #000 0%, #000 14%, rgba(0, 0, 0, .4) 34%, rgba(0, 0, 0, .4) 66%, #000 86%, #000 100%);
}

@media (max-width: 720px) {
    .bg-space {
        -webkit-mask-image: none;
        mask-image: none;
        opacity: .7;
    }
}

/* Brilhos e grade também acompanham a rolagem, mais devagar que o conteúdo */
.bg-blob {
    translate: 0 calc(var(--sy, 0) * -0.025px);
}

.bg-grid {
    background-position: 0 calc(var(--sy, 0) * -0.12px);
}


/* "Str." quebra junto, nunca o ponto sozinho */
.hero h1 .title-word {
    font-weight: inherit;
    white-space: nowrap;
}
