﻿/**
 * Y2 Docs - Documentation Layout 🐙
 * --------------------------------------------------
 * Exclusive styles for the documentation interface.
 */

:root {
    --doc-side-w: 280px;
    --doc-top-h: 0px;
    /* Topo removido no desktop */
    --doc-bg: var(--y2-bg-bas);
    --doc-card: var(--y2-bg-sur);
    --doc-border: var(--y2-neu-9);
}

body {
    background: var(--doc-bg);
    display: flex;
    flex-direction: column;
}

/* --- Layout Structure --- */
.doc-shell {
    display: flex;
    margin-top: var(--doc-top-h);
    min-height: calc(100vh - var(--doc-top-h));
}

.doc-top {
    height: var(--doc-top-h);
    background: transparent;
    border-bottom: none;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    display: none;
    /* Escondido por padrão no desktop */
    align-items: center;
    padding: 0 2rem;
    justify-content: space-between;
    transition: all 0.3s;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--y2-txt-bas);
    font-size: 3.6rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.6rem;
    transition: background 0.2s;
    margin-right: 1rem;
}

.menu-toggle:hover {
    background: var(--y2-pri-opa1);
    color: var(--y2-pri);
}

.doc-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.doc-backdrop.is-active {
    opacity: 1;
    visibility: visible;
}

.doc-logo {
    height: 48px;
    width: auto;
}

.doc-aside {
    width: var(--doc-side-w);
    background: var(--y2-bg-sur);
    border-right: 1px solid var(--doc-border);
    position: fixed;
    top: var(--doc-top-h);
    bottom: 0;
    padding: 3rem 1.2rem 2rem;
    overflow-y: auto;
}

.doc-main {
    flex: 1;
    margin-left: var(--doc-side-w);
    padding: var(--y2-s-xg) var(--y2-s-xxg);
    max-width: 1600px;
    min-height: 100vh;
    overflow-x: visible;
    opacity: 1;
    animation: doc-slide-in 0.2s ease-out;
    transition: margin-left 0.3s, padding 0.3s;
}

.doc-main.is-leaving {
    animation: doc-slide-out 0.22s ease forwards;
    pointer-events: none;
}

@keyframes doc-slide-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes doc-slide-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* --- Content Contrast Fix --- */
.t-mut {
    color: var(--y2-neu-8) !important;
}

.t-lg {
    color: var(--y2-neu-11);
}

h2,
h3,
h4 {
    color: var(--y2-txt-bas) !important;
}

/* --- Reveal Fallback --- */
[class^="reveal-"] {
    /*opacity: 0.1; /* Garantir que pinhões de texto sejam visíveis antes da animação */
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-up.is-revealed,
.reveal-in.is-revealed,
.reveal-left.is-revealed {
    opacity: 1 !important;
}

/* --- Components --- */
/* --- Side Navigation (Collapsible & Compact) --- */
.doc-aside {
    width: var(--doc-side-w);
    background: var(--y2-bg-sur);
    border-right: 1px solid var(--doc-border);
    position: fixed;
    top: 0;
    bottom: 0;
    padding: 3rem 1.2rem 2rem;
    overflow-y: auto;
    overflow-x: visible; /* Mantém as sombras inteiras */
    scroll-behavior: smooth;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 9999;
}

/* --- Sidebar Identity --- */
.sidebar-identity {
    padding: 0;
    margin-bottom: 1.6rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 2rem 1.6rem;
    margin: 0 0.8rem 0.4rem;
    border-radius: var(--y2-r-g, 1.2rem);
    transition: box-shadow 0.3s;
    text-decoration: none;
}

.sidebar-logo:hover {
    box-shadow: 0 6px 24px color-mix(in srgb, var(--y2-pri) 25%, transparent);
}

.sidebar-logo img {
    height: 12rem;
    width: auto;
}

.sidebar-logo span {
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: var(--y2-txt-bas);
}


.nav-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem var(--y2-s-m);
    margin-bottom: 0.4rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--y2-txt-bas);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, color 0.2s;
    user-select: none;
}

.nav-group-title:hover {
    opacity: 1;
    color: var(--y2-pri);
}

.nav-group-title i {
    font-size: 1.8rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-group.is-open .nav-group-title {
    opacity: 0.9;
}

.nav-group.is-open .nav-group-title i {
    transform: rotate(180deg);
}

.nav-group-content {
    max-height: 0;
    overflow: hidden;
    padding: 0 0.8rem; /* Adicionado para dar espaço lateral para as sombras */
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
}

.nav-group.is-open .nav-group-content {
    max-height: 2000px;
    overflow: visible; /* Permite que a sombra do .is-act seja visível */
    padding-bottom: 0.8rem; /* Espaço para a sombra do último item */
    transition: max-height 0.6s cubic-bezier(1, 0, 1, 0);
}

.doc-aside .nav-it {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.2rem;
    border-radius: 0.8rem;
    margin: 0.4rem 0; /* Margem vertical para a sombra não bater no vizinho */
    margin-right: 0.5rem;
    color: var(--y2-txt-bas);
    font-size: 1.4rem;
    /* Reduzido de 1.8rem para 1.4rem (mais proximo de 14px-15px) */
    transition: all 0.2s ease;
    text-decoration: none;
    opacity: 0.7;
}

.doc-aside .nav-it i {
    width: 2rem;
    margin-right: 1rem;
    font-size: 2rem;
    text-align: center;
}

.doc-aside .nav-it:hover {
    background: color-mix(in srgb, var(--y2-pri) 10%, transparent);
    color: var(--y2-pri);
    opacity: 1;
    transform: translateX(3px);
}

.doc-aside .nav-it.is-act {
    background: linear-gradient(195deg,
        color-mix(in srgb, var(--y2-pri) 90%, white),
        color-mix(in srgb, var(--y2-pri) 60%, black)
    );
    color: #fff;
    font-weight: 700;
    opacity: 1;
    border-right: none;
    border-radius: 0.8rem;
    box-shadow: 0 4px 16px color-mix(in srgb, var(--y2-pri) 40%, transparent),
                0 1px 4px  color-mix(in srgb, var(--y2-pri) 20%, transparent);
}

.doc-aside .nav-it.is-act i {
    color: rgba(255,255,255,0.9);
}

.doc-card {
    background: var(--y2-bg-sur);
    border: 1px solid var(--doc-border);
    border-radius: var(--y2-r-gg, 1.6rem);
    padding: 2.4rem;
    margin-bottom: 3rem;
    box-shadow: var(--y2-sha, 0 4px 20px rgba(0,0,0,0.08));
}

.doc-code-preview {
    background: #000000b0 !important;
    color: #f8f8f2 !important;
    padding: 1.5rem 2rem;
    border-radius: 0.8rem;
    font-family: 'Poppins', sans-serif !important;
    font-size: 1.4rem !important;
    line-height: 1.5 !important;
    overflow-x: auto;
    position: relative;
    margin-top: 1.5rem;
    border: 1px solid #404040 !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
}

/* Remove ícone injetado pelo icons.css (y2-code) no preview 🚫 */
.doc-code-preview::before {
    content: none !important;
    display: none !important;
}

.doc-tag {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    border-radius: 2rem;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--y2-pri);
    color: #fff;
    margin-bottom: 1rem;
}

/* --- Dark Theme Class (legacy) --- */
.dark-theme {
    --y2-bg-bas: var(--y2-neu-12);
    --y2-bg-sur: var(--y2-neu-11);
    --y2-txt-bas: var(--y2-neu-2);
    --y2-txt-mut: var(--y2-neu-5);
    --y2-bor: var(--y2-neu-10);
    --y2-gls-bg: rgba(0, 0, 0, 0.3);
    --y2-gls-bor: rgba(255, 255, 255, 0.1);
}

/* --- Y2Day FAB — agora no core 🐙 --- */

.y2-day-fab:hover {
    background: var(--y2-neu-9);
    border-color: var(--y2-pri);
    width: 4.2rem;
}

.y2-day-fab .y2-day-ico {
    font-size: 1.6rem;
    line-height: 1;
    transition: transform .3s;
}

.y2-day-fab:hover .y2-day-ico {
    transform: rotate(20deg) scale(1.1);
}

/* --- Y2Day Light Mode — overrides específicos da doc --- */
html[y2-theme="light"] body {
    background: var(--y2-neu-2);
}

html[y2-theme="light"] .doc-top {
    background: var(--y2-neu-1);
    border-bottom-color: var(--y2-neu-3);
    box-shadow: 0 1px 8px rgba(0, 0, 0, .06);
}

html[y2-theme="light"] .doc-aside {
    background: var(--y2-neu-1);
    border-right-color: var(--y2-neu-3);
}

html[y2-theme="light"] .doc-aside .nav-it {
    color: var(--y2-neu-10);
}

html[y2-theme="light"] .doc-aside .nav-it:hover,
html[y2-theme="light"] .doc-aside .nav-it.is-act {
    background: var(--y2-pri-opa1);
    color: var(--y2-pri);
}

html[y2-theme="light"] .nav-group-title {
    color: var(--y2-neu-12);
}

html[y2-theme="light"] .doc-card {
    background: var(--y2-neu-1);
    border-color: var(--y2-neu-3);
}

html[y2-theme="light"] .t-mut {
    color: var(--y2-neu-6) !important;
}

html[y2-theme="light"] h2,
html[y2-theme="light"] h3,
html[y2-theme="light"] h4 {
    color: var(--y2-neu-12) !important;
}

html[y2-theme="light"] .doc-tag {
    background: var(--y2-pri);
    color: #fff;
}

/* --- Y2Ajax: freeze transitions during content injection --- */
.y2ajax-no-trs,
.y2ajax-no-trs * {
    transition: none !important;
}

/* --- Doc Breadcrumb (.brc / .brc-it aliases) --- */
.brc {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    list-style: none;
    font-size: var(--y2-f-p);
}

.brc-it {
    display: inline-flex;
    align-items: center;
    color: var(--y2-txt-mut);
    text-decoration: none;
    transition: color .18s;
    white-space: nowrap;
}

.brc-it:not(.is-cur):hover {
    color: var(--y2-pri);
}

.brc-it.is-cur {
    color: var(--y2-txt-bas);
    font-weight: 600;
    pointer-events: none;
}

.brc-it:not(:last-child)::after {
    content: '/';
    margin: 0 .7rem;
    color: var(--y2-txt-mut);
    opacity: .5;
    font-weight: 400;
}

/* --- Doc Sections --- */
.doc-container {
    padding: var(--y2-s-gg) 0;
}

.doc-section {
    margin-bottom: var(--y2-s-gg);
    padding: var(--y2-s-g);
    background: var(--y2-bg-sur);
    border: 1px solid var(--doc-border);
    border-radius: var(--y2-r-g);
}

/* --- Simple Grid Utilities (docs) --- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.grid-12 {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
}

.g-pp {
    gap: var(--y2-s-pp);
}

.g-p {
    gap: var(--y2-s-p);
}

.g-m {
    gap: var(--y2-s-m);
}

.g-g {
    gap: var(--y2-s-g);
}

/* --- Flex Aliases (compat) --- */
.alc {
    align-items: center !important;
}

.jc {
    justify-content: center !important;
}

/* Custom grid for docs */
.doc-grid-demo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.doc-grid-demo>div {
    background: var(--y2-pri-opa1);
    border: 1px dashed var(--y2-pri);
    padding: 2rem;
    text-align: center;
    border-radius: 0.8rem;
}

/**/
span.tdocs {
    font-size: 1.2rem;
    font-weight: 600;
    position: relative;
    color: var(--neut5);
    left: -16px;
    top: -6px;
}

/* --- Responsividade 📱 --- */

@media (max-width: 1100px) {
    .doc-main {
        padding: var(--y2-s-g);
    }
}

@media (max-width: 992px) {
    :root {
        --doc-top-h: 60px;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .doc-top {
        display: flex;
        height: 60px;
        background: var(--y2-bg-sur);
        border-bottom: 1px solid var(--doc-border);
        padding: 0 2rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .doc-shell {
        margin-top: 60px;
    }

    .doc-aside {
        top: 0;
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    }

    .doc-main {
        margin-left: 0;
        margin-top: 0;
    }

    body.is-aside-open {
        overflow: hidden;
    }

    body.is-aside-open .doc-aside {
        transform: translateX(0);
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* --- Reference Tables --- */
.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.4rem;
}

.ref-table th {
    background: var(--y2-bg-sec);
    padding: 0.8rem 1.2rem;
    text-align: left;
    font-weight: 700;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--y2-txt-bas);
    border-bottom: 1px solid var(--y2-bor);
}

.ref-table td {
    padding: 0.7rem 1.2rem;
    border-bottom: 1px solid var(--y2-bor);
    vertical-align: top;
}

@media (max-width: 600px) {
    .doc-main {
        padding: 1.5rem;
    }

    .doc-card {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    .doc-top .t-mut {
        display: none;
        /* Esconder versão em telas minúsculas */
    }

    /* Previne overflow horizontal de blocos de código */
    pre, code {
        max-width: 100%;
        overflow-x: auto;
    }

    /* Títulos hero: reduz t-xxg para não estourar no mobile */
    h1.t-xxg, h2.t-xxg {
        font-size: 3.2rem !important;
        line-height: 1.15 !important;
    }
}
