/* ═══════════════════════════════════════════════════════
   MODULE 2 — EXTRA STYLES
   Components: four-tools grid, hash-props grid,
               merkle-tree diagram
   ═══════════════════════════════════════════════════════ */

/* ── Four-Tools Grid (Section 1) ───────────────────── */
.four-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
    margin: 1.5rem 0;
}
.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.4rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.tool-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 16px rgba(247, 147, 26, 0.10);
}
.tool-card-icon {
    font-size: 1.8rem;
    margin-bottom: 0.6rem;
}
.tool-card h4 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.4rem;
}
.tool-card p {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0;
}
@media (max-width: 640px) {
    .four-tools-grid { grid-template-columns: 1fr; }
}

/* colour accents per tool */
.tool-card--hash  { border-left: 3px solid var(--accent-primary); }
.tool-card--keys  { border-left: 3px solid var(--accent-eth); }
.tool-card--sig   { border-left: 3px solid var(--accent-ok); }
.tool-card--tree  { border-left: 3px solid var(--accent-info); }


/* ── Hash Properties Grid (Section 2) ──────────────── */
.hash-props-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.2rem;
    margin: 1.5rem 0;
}
.hash-prop {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.2rem;
    position: relative;
}
.hash-prop-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}
.hash-prop h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.35rem;
}
.hash-prop p {
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
}


/* ── Merkle Tree Diagram (Section 5) ───────────────── */
.merkle-tree-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin: 2rem 0;
    padding: 2rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.merkle-level {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    position: relative;
}
.merkle-level::before {
    content: '';
    position: absolute;
    top: -0.6rem;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 0.6rem;
    background: var(--border-color);
}
.merkle-root::before { display: none; }

.merkle-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    min-width: 100px;
    text-align: center;
}
.merkle-node--root {
    background: linear-gradient(135deg, rgba(247,147,26,0.12), rgba(247,147,26,0.04));
    border-color: var(--accent-primary);
}
.merkle-node--leaf {
    background: linear-gradient(135deg, rgba(139,92,246,0.10), rgba(139,92,246,0.03));
    border-color: var(--accent-eth);
}
.merkle-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}
.merkle-node code {
    font-size: 0.72rem;
    color: var(--text-tertiary);
}

@media (max-width: 500px) {
    .merkle-level { gap: 0.4rem; flex-wrap: wrap; }
    .merkle-node { min-width: 70px; padding: 0.4rem 0.5rem; }
    .merkle-node code { font-size: 0.62rem; }
}


/* ── Anatomy / Pipeline Table (Section 6) ──────────── */
.anatomy-table {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 1.8rem 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}
.anatomy-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}
.anatomy-row:last-child { border-bottom: none; }
.anatomy-row:hover { background: rgba(247, 147, 26, 0.03); }

.anatomy-field {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 180px;
    min-width: 180px;
    padding: 1rem 1.2rem;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}
.anatomy-field code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-primary);
    white-space: nowrap;
    background: rgba(247, 147, 26, 0.10);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(247, 147, 26, 0.18);
    letter-spacing: 0.02em;
}

.anatomy-desc {
    flex: 1;
    padding: 1rem 1.4rem;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-secondary);
}


/* ── Block Diagram (Section 6) ─────────────────────── */
.block-diagram {
    margin: 2rem auto;
    max-width: 520px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.block-diagram-header {
    background: linear-gradient(135deg, var(--bg-secondary), rgba(247, 147, 26, 0.06));
    padding: 0.9rem 1.4rem;
    border-bottom: 2px solid var(--border-color);
}
.block-num {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.block-diagram-body {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.block-field {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1.4rem;
    border-bottom: 1px solid rgba(128, 128, 128, 0.12);
}
.block-field:last-child { border-bottom: none; }

.block-field-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 100px;
    flex-shrink: 0;
}
.block-field code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background: rgba(247, 147, 26, 0.08);
    color: var(--accent-primary);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    border: 1px solid rgba(247, 147, 26, 0.15);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.block-diagram-txs {
    padding: 0.7rem 1.4rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    text-align: center;
}
.block-tx-label {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .anatomy-field {
        width: 120px;
        min-width: 120px;
        padding: 0.7rem 0.6rem;
    }
    .anatomy-field code { font-size: 0.75rem; padding: 0.2rem 0.5rem; }
    .anatomy-desc { padding: 0.7rem 0.8rem; font-size: 0.84rem; }

    .block-diagram { margin: 1.5rem 0; }
    .block-field { padding: 0.6rem 1rem; gap: 0.6rem; }
    .block-field-label { min-width: 80px; font-size: 0.78rem; }
    .block-field code { font-size: 0.72rem; }
}
@media (max-width: 400px) {
    .anatomy-row { flex-direction: column; }
    .anatomy-field {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 0.6rem 0.8rem;
        justify-content: flex-start;
    }
}