/* ==========================================================================
   BLOCKCHAIN.CSS
   Estilos específicos do módulo academy/01-blockchain (e futuros módulos
   que sigam o mesmo contrato de markup).

   O que NÃO está aqui, de propósito:
   - .navbar, .logo, .nav-links, .language-switch, .footer, .footer-grid,
     .footer-links, .container, .btn/.btn-primary/.btn-secondary, .hero,
     .hero-grid, .hero-content, .hero-title, .hero-description,
     .hero-actions, .hero-stats, .stat-card, .hero-dashboard, .glow,
     .dashboard-header, .dashboard-dot, .tag, .section-title,
     .section-description, .modules, .module, .module-number, .next-grid,
     .next-card, .card, .reveal/.reveal.show
     → todos já existem em components.css / academy.css e são
       reutilizados sem alteração pelo próprio index.html.

   O que está aqui:
   - Layout de leitura (sidebar + coluna de conteúdo) — não existe
     equivalente na Landing, então é genuinamente específico do módulo.
   - Sumário / indicador ativo (TOC).
   - Barra de progresso de leitura (elemento novo dentro do .navbar).
   - Visual da chain (dentro do .hero-dashboard já reutilizado).
   - Bloco de diagrama e demo de hash (conteúdo técnico específico).
   - Lista de passos (roadmap do "First Steps").
   - Glossário (grid + tipografia dos termos).
   - Quiz (opções, feedback, resumo).
   - Ajustes de grid quando os componentes da Landing (.modules,
     .next-grid) são reaproveitados dentro da coluna mais estreita do
     leitor (ver seção 4).

   Todos os valores usam os tokens já existentes em variables.css.
   Nenhuma cor, fonte, espaçamento ou raio novo é criado neste arquivo.
   ========================================================================== */

/* ==========================================================================
   1. READING PROGRESS (novo elemento, filho do .navbar já existente)
   ========================================================================== */

.reading-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: transparent;
    overflow: hidden;
}

.reading-progress__bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    box-shadow: var(--glow-primary);
    transition: width .1s linear;
}

/* ==========================================================================
   2. CHAIN VISUAL (dentro do .hero-dashboard / .dashboard-content reutilizados)
   ========================================================================== */

.chain-visual {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}

.chain-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    width: 84px;
    height: 84px;
    flex-shrink: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    animation: float 5s ease-in-out infinite;
}

.chain-block:nth-child(3) { animation-delay: .4s; }
.chain-block:nth-child(5) { animation-delay: .8s; }
.chain-block:nth-child(7) { animation-delay: 1.2s; }

.chain-block--genesis {
    background: var(--background-secondary);
    border-style: dashed;
    border-color: var(--border-light);
}

.chain-block--active {
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.chain-block__index {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.chain-block--active .chain-block__index {
    color: var(--primary);
}

.chain-block__label {
    font-size: var(--text-xs);
    font-weight: var(--semibold);
    color: var(--text-secondary);
}

.chain-block__hash {
    font-size: 10px;
    color: var(--text-muted);
}

.chain-block--active .chain-block__hash {
    color: var(--text);
}

.chain-link {
    width: 20px;
    height: 2px;
    flex-shrink: 0;
    background: repeating-linear-gradient(90deg, var(--border-light) 0 5px, transparent 5px 9px);
}

/* ==========================================================================
   3. LESSON LAYOUT — sidebar + reading column (sem equivalente na Landing)
   ========================================================================== */

.lesson-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: var(--space-16);
    align-items: start;
    padding: var(--space-16) 0;
}

.lesson-sidebar {
    position: sticky;
    top: calc(var(--navbar-height) + var(--space-8));
    max-height: calc(100vh - var(--navbar-height) - var(--space-16));
    overflow-y: auto;
    padding-bottom: var(--space-6);
}

.toc__list-wrap {
    position: relative;
    margin-top: var(--space-4);
}

.toc__indicator {
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 32px;
    background: var(--primary);
    box-shadow: var(--glow-primary);
    transform: translateY(0);
    transition: transform var(--transition), height var(--transition), opacity var(--transition-fast);
    opacity: 0;
}

.toc__list-wrap.is-tracking .toc__indicator {
    opacity: 1;
}

.toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--border);
}

.toc__list a {
    display: block;
    padding: var(--space-2) 0 var(--space-2) var(--space-5);
    font-size: var(--text-sm);
    color: var(--text-muted);
    transition: color var(--transition);
}

.toc__list a:hover {
    color: var(--text);
}

.toc__list a.is-active {
    color: var(--primary);
    font-weight: var(--semibold);
}

.lesson-content {
    max-width: 760px;
}

.lesson-section {
    border-bottom: 1px solid var(--border);
}

.lesson-section:last-of-type {
    border-bottom: none;
}

.lesson-section .section-title {
    font-size: var(--text-4xl);
}

.lesson-section .section-description {
    max-width: none;
    margin-bottom: var(--space-4);
}

.lesson-section .section-description:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   4. GRIDS REUTILIZADOS (.modules e .next-grid da Landing, adaptados à
      coluna mais estreita do leitor — sem duplicar background/hover)
   ========================================================================== */

.lesson-content .modules {
    grid-template-columns: repeat(2, 1fr);
}

.lesson-content .next-grid {
    grid-template-columns: repeat(2, 1fr);
}

/* ==========================================================================
   5. LISTAS DE CONTEÚDO (sem equivalente na Landing)
   ========================================================================== */

.lesson-list {
    list-style: none;
    margin: var(--space-5) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.lesson-list li {
    position: relative;
    padding-left: var(--space-6);
    line-height: 1.75;
    color: var(--text-secondary);
}

.lesson-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .55em;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--primary);
    opacity: .7;
}

.lesson-list--compact {
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.lesson-list--compact li {
    font-size: var(--text-sm);
}

/* ==========================================================================
   6. BLOCK DIAGRAM (reaproveita .card + .dashboard-header/.dashboard-dot)
   ========================================================================== */

.block-diagram {
    padding: 0;
    overflow: hidden;
    background: var(--surface-2);
    margin-top: var(--space-8);
}

.block-diagram .dashboard-header {
    justify-content: flex-start;
}

.block-diagram__chrome-title {
    margin-left: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.block-diagram__body {
    padding: 0 var(--space-6) var(--space-4);
}

.block-diagram__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-6);
    padding: var(--space-3) 0;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    font-size: var(--text-sm);
}

.block-diagram__row:last-child {
    border-bottom: none;
}

.block-diagram__row--body {
    margin: 0 calc(var(--space-6) * -1);
    padding: var(--space-3) var(--space-6);
    background: rgba(77, 166, 255, .06);
}

.block-diagram__label {
    color: var(--text-muted);
    white-space: nowrap;
}

.block-diagram__value {
    color: var(--text);
    text-align: right;
    word-break: break-all;
}

.block-diagram__value-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.block-diagram__value-group .block-diagram__value {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Copy button (compartilhado entre block-diagram e hash-demo) ---- */

.copy-btn {
    flex-shrink: 0;
    font-size: var(--text-xs);
    font-weight: var(--semibold);
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    transition: var(--transition);
}

.copy-btn:hover {
    border-color: var(--primary);
    color: var(--text);
}

.copy-btn.is-copied {
    color: var(--success);
    border-color: var(--success);
    background: rgba(40, 199, 111, .12);
}

/* ==========================================================================
   7. HASH DEMO (reaproveita .card + .dashboard-header/.dashboard-dot)
   ========================================================================== */

.hash-demo {
    padding: 0;
    overflow: hidden;
    background: var(--surface-2);
    margin-top: var(--space-8);
}

.hash-demo .dashboard-header {
    justify-content: flex-start;
}

.hash-demo__examples {
    padding: var(--space-2) var(--space-6) var(--space-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.hash-demo__row {
    display: grid;
    grid-template-columns: 140px 20px minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
}

.hash-demo__input {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.hash-demo__arrow {
    color: var(--text-muted);
    text-align: center;
}

.hash-demo__output-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.hash-demo__output {
    font-size: var(--text-sm);
    color: var(--primary);
    background: rgba(77, 166, 255, .1);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.hash-demo__output--live {
    box-shadow: var(--glow-primary);
}

.hash-demo__output.is-updated {
    animation: hashFlash .5s ease;
}

@keyframes hashFlash {
    0% { background: rgba(77, 166, 255, .3); }
    100% { background: rgba(77, 166, 255, .1); }
}

.hash-demo__divider {
    height: 1px;
    margin: var(--space-5) var(--space-6) 0;
    background: var(--border);
}

.hash-demo__playground {
    padding: var(--space-6);
}

.hash-demo__playground-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

.hash-demo__playground-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1.4fr);
    align-items: center;
    gap: var(--space-3);
}

.hash-demo__field {
    width: 100%;
    font-size: var(--text-sm);
    color: var(--text);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    transition: border-color var(--transition);
}

.hash-demo__field:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.hash-demo__field::placeholder {
    color: var(--text-muted);
}

/* ==========================================================================
   8. ROADMAP LIST ("First Steps" — timeline vertical, sem equivalente na Landing)
   ========================================================================== */

.roadmap-list {
    list-style: none;
    margin: var(--space-8) 0 0;
    padding: 0;
}

.roadmap-list__item {
    position: relative;
    display: flex;
    gap: var(--space-5);
    padding-bottom: var(--space-8);
}

.roadmap-list__item:last-child {
    padding-bottom: 0;
}

.roadmap-list__item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 19px;
    top: 44px;
    bottom: -4px;
    width: 1px;
    background: var(--border);
}

.roadmap-list__index {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 2px solid var(--primary);
    color: var(--primary);
    font-family: var(--font-heading);
    font-weight: var(--black);
    font-size: var(--text-lg);
    z-index: 1;
}

.roadmap-list__item h3 {
    font-family: var(--font-heading);
    text-transform: uppercase;
    font-weight: var(--extrabold);
    font-size: var(--text-xl);
    color: var(--text);
    margin-bottom: var(--space-2);
}

.roadmap-list__item p {
    color: var(--text-secondary);
    line-height: 1.75;
    margin: 0;
}

/* ==========================================================================
   9. GLOSSARY (reaproveita .card para cada item)
   ========================================================================== */

.glossary-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
    margin: var(--space-8) 0 0;
}

.glossary-list__item dt {
    font-family: var(--font-heading);
    text-transform: uppercase;
    font-weight: var(--extrabold);
    font-size: var(--text-lg);
    color: var(--primary);
    margin-bottom: var(--space-2);
}

.glossary-list__item dd {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: var(--text-sm);
}

/* ==========================================================================
   10. QUIZ (reaproveita .card para cada pergunta e para o resumo)
   ========================================================================== */

.quiz-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    margin-top: var(--space-8);
}

.quiz-item__question {
    font-size: var(--text-lg);
    font-weight: var(--semibold);
    color: var(--text);
    margin-bottom: var(--space-5);
}

.quiz-item__options {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.quiz-option {
    text-align: left;
    width: 100%;
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-secondary);
    background: var(--background-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    transition: var(--transition);
}

.quiz-option:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--text);
}

.quiz-option:disabled {
    cursor: default;
}

.quiz-option.is-selected {
    border-color: var(--primary);
    color: var(--text);
}

.quiz-option.is-correct {
    border-color: var(--success);
    background: rgba(40, 199, 111, .1);
    color: var(--text);
}

.quiz-option.is-incorrect {
    border-color: var(--danger);
    background: rgba(255, 94, 122, .1);
    color: var(--text);
}

.quiz-option.is-muted {
    opacity: .5;
}

.quiz-item__feedback {
    margin: var(--space-4) 0 0;
    font-size: var(--text-sm);
    font-weight: var(--semibold);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
}

.quiz-item__feedback a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.quiz-item__feedback--correct {
    color: var(--success);
    background: rgba(40, 199, 111, .1);
}

.quiz-item__feedback--incorrect {
    color: var(--danger);
    background: rgba(255, 94, 122, .1);
}

.quiz-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
}

.quiz-summary__text {
    font-size: var(--text-lg);
    color: var(--text);
}

.quiz-summary__score {
    color: var(--primary);
    font-family: var(--font-heading);
    font-weight: var(--black);
    font-size: var(--text-xl);
}

/* ==========================================================================
   11. PAGINATION
   ========================================================================== */

.lesson-pagination {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    margin-top: var(--space-16);
}

/* ==========================================================================
   12. RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
    .lesson-content .modules {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {

    .lesson-layout {
        grid-template-columns: 1fr;
        padding-top: var(--space-8);
    }

    .lesson-sidebar {
        position: sticky;
        top: var(--navbar-height);
        z-index: var(--z-sidebar);
        max-height: none;
        margin: 0 -24px;
        padding: var(--space-3) 24px;
        background: rgba(6, 8, 13, .92);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        overflow-y: hidden;
    }

    .toc .tag {
        display: none;
    }

    .toc__list-wrap {
        width: max-content;
        margin-top: 0;
    }

    .toc__list {
        display: flex;
        gap: var(--space-1);
        border-left: none;
        white-space: nowrap;
    }

    .toc__indicator {
        display: none;
    }

    .toc__list a {
        padding: var(--space-2) var(--space-4);
        border-radius: var(--radius-pill);
        border: 1px solid transparent;
    }

    .toc__list a.is-active {
        background: rgba(77, 166, 255, .12);
        border-color: var(--border-light);
    }

    .lesson-content .next-grid,
    .glossary-list {
        grid-template-columns: 1fr;
    }

    .hash-demo__row,
    .hash-demo__playground-row {
        grid-template-columns: 1fr;
    }

    .hash-demo__arrow {
        display: none;
    }

    .block-diagram__row {
        flex-wrap: wrap;
    }

    .lesson-pagination {
        flex-direction: column;
    }
}

@media (max-width: 640px) {

    .quiz-summary {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}
