/* Merkle Tree Certificates demo — tool-specific styles.
   Uses only existing design tokens so it re-themes automatically per brand. */

.narrator {
    font-size: 1.05rem;
    color: var(--color-text-primary);
    opacity: 0.85;
    margin-bottom: var(--spacing-lg);
}

/* Act navigation rail */
.act-rail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: var(--spacing-lg);
}
.act-tab {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}
.act-tab:hover { border-color: var(--color-primary); }
.act-tab.active {
    background: var(--gradient-quantum);
    box-shadow: var(--shadow-quantum);
    border-color: transparent;
}
.act { animation: fade-in 0.4s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Size-comparison bars (Act 0) */
.size-bars { display: flex; flex-direction: column; gap: 1rem; }
.size-bar-row { display: grid; grid-template-columns: 220px 1fr 90px; align-items: center; gap: 1rem; }
.size-bar-label { font-weight: 600; }
.size-bar-track { background: rgba(255, 255, 255, 0.06); border-radius: var(--radius-sm); height: 26px; overflow: hidden; }
.size-bar-fill { height: 100%; border-radius: var(--radius-sm); width: 0; transition: width 1s cubic-bezier(0.22, 1, 0.36, 1); }
.size-bar-fill.classic { background: #64748b; }
.size-bar-fill.pqc { background: #ef4444; }
.size-bar-fill.mtc { background: var(--color-accent); }
.size-bar-value { font-family: 'JetBrains Mono', monospace; text-align: right; }

/* Tree stage */
.tree-controls { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tree-controls select, .tree-controls input {
    background: var(--color-bg-card); color: var(--color-text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15); border-radius: var(--radius-sm); padding: 0.4rem 0.6rem;
}
.proof-readout { font-family: 'JetBrains Mono', monospace; opacity: 0.85; }
.tree-stage {
    background: var(--color-bg-card); border-radius: var(--radius-lg);
    padding: var(--spacing-lg); overflow-x: auto; box-shadow: var(--shadow-quantum);
}
#tree-svg { width: 100%; min-height: 360px; display: block; }
/* Live-log tree: same sizing as the cinematic #tree-svg, so the two read at a consistent scale. */
#log-svg { width: 100%; min-height: 360px; display: block; }

/* SVG nodes / edges */
.mtc-edge { stroke: var(--mtc-edge-color, rgba(255, 255, 255, 0.18)); stroke-width: 2; fill: none; }
.mtc-edge.lit { stroke: var(--color-accent); stroke-width: 3.5; filter: drop-shadow(0 0 6px var(--color-accent)); }
.mtc-node { fill: var(--color-primary); stroke: rgba(255, 255, 255, 0.25); stroke-width: 1.5; cursor: default; transform-box: fill-box; transform-origin: center; transition: fill 0.25s ease, filter 0.25s ease, opacity 0.35s ease, transform 0.45s cubic-bezier(.22,1,.36,1); }
.mtc-node.is-hidden, .mtc-edge.is-hidden { opacity: 0; pointer-events: none; }
.mtc-node.pop { animation: node-pop 0.36s ease; }
@keyframes node-pop { 0% { transform: scale(0.4); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
.node-hash { font-family: 'JetBrains Mono', monospace; font-size: 9px; fill: var(--color-text-primary); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
body.tech-mode .node-hash { opacity: 0.6; }
.mtc-node.leaf { fill: var(--color-secondary); cursor: pointer; }
.mtc-node.leaf:hover { filter: drop-shadow(0 0 8px var(--color-secondary)); }
/* Root keeps the pearl-green across all themes (3 distinct node colours: root / intermediate / leaf). */
.mtc-node.root { fill: #10b981; }
.mtc-node.lit { fill: var(--color-accent); filter: drop-shadow(0 0 9px var(--color-accent)); }
.mtc-node.sibling { fill: #f59e0b; filter: drop-shadow(0 0 7px #f59e0b); }
.mtc-stamp { fill: var(--gradient-quantum, #667eea); }
.verified-seal {
    fill: var(--color-accent); font-weight: 700; font-size: 14px;
    text-anchor: middle; opacity: 0; transition: opacity 0.4s ease;
}
.verified-seal.show { opacity: 1; }

/* Checkpoint card (Act 3) */
.checkpoint-card {
    margin-top: var(--spacing-lg); background: var(--color-bg-card);
    border-left: 4px solid var(--color-accent); border-radius: var(--radius-md);
    padding: var(--spacing-lg); font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem; white-space: pre-wrap; word-break: break-all;
}

/* Dual-cert comparison table */
.compare-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.compare-table th, .compare-table td {
    text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    vertical-align: top;
}
.compare-table th { color: var(--color-text-primary); opacity: 0.9; }
.compare-table td.field { font-weight: 600; white-space: nowrap; }
.badge-shared, .badge-diff {
    display: inline-block; padding: 0.15rem 0.55rem; border-radius: var(--radius-sm);
    font-size: 0.75rem; font-weight: 700; white-space: nowrap;
}
.badge-shared { background: rgba(16, 185, 129, 0.18); color: var(--color-accent); }
.badge-diff { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.compare-table tr.diff td.field { color: #f87171; }
.compare-note { margin-top: 1rem; opacity: 0.8; font-style: italic; }

.btn {
    background: var(--gradient-quantum); color: #fff; border: none;
    border-radius: var(--radius-md); padding: 0.5rem 1.1rem; font-weight: 600; cursor: pointer;
}

/* Guided control bar */
.guided-bar { display: flex; align-items: center; gap: 0.6rem; margin-bottom: var(--spacing-lg); }
.guided-bar .spacer { flex: 1; }
.btn.ghost { background: transparent; border: 1px solid rgba(255, 255, 255, 0.18); color: var(--color-text-primary); }
.btn.ghost:disabled { opacity: 0.35; cursor: not-allowed; }
.mode-toggle { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; opacity: 0.85; cursor: pointer; }
.leaf-counter { font-weight: 600; color: var(--color-secondary); }

/* CA stamp + pulse (Act 3) */
.ca-stamp { font-size: 30px; }
.pulse-ring { fill: none; stroke: var(--color-accent); stroke-width: 3; opacity: 0.5; }

/* Side-by-side handshake panel (Act 4) */
.compare-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: var(--spacing-lg); }
.compare-side { background: var(--color-bg-card); border-radius: var(--radius-lg); padding: var(--spacing-lg); text-align: center; }
.compare-side.classic { border: 1px solid rgba(239, 68, 68, 0.4); }
.compare-side.mtc { border: 1px solid var(--color-accent); box-shadow: var(--shadow-quantum); }
.compare-side h4 { margin-bottom: 0.5rem; }
.big-num { font-family: 'JetBrains Mono', monospace; font-size: 2rem; font-weight: 700; }
.compare-side.classic .big-num { color: #f87171; }
.compare-side.mtc .big-num { color: var(--color-accent); }
.gear { font-size: 2rem; animation: spin 3s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.seal-inline { font-size: 2rem; color: var(--color-accent); opacity: 0; transition: opacity 0.4s ease; }
.seal-inline.show { opacity: 1; }

/* Plain vs technical mode: tooltips are always present; technical mode reveals hash readouts. */
body:not(.tech-mode) .proof-readout { opacity: 0.55; }

/* Info link / explain box (Act 0) */
.info-link { background: none; border: none; color: var(--color-primary); cursor: pointer; font-size: 0.9rem; margin-top: 0.8rem; padding: 0; }
.info-link:hover { text-decoration: underline; }
.explain-box { margin-top: 0.8rem; background: var(--color-bg-card); border-radius: var(--radius-md); padding: var(--spacing-lg); font-size: 0.9rem; }
.explain-box ul { margin: 0 0 0.8rem 1.1rem; }
.explain-box li { margin-bottom: 0.5rem; }
.explain-box table.mini { width: auto; border-collapse: collapse; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.explain-box table.mini th, .explain-box table.mini td { padding: 0.25rem 0.8rem 0.25rem 0; text-align: left; }

/* Artifacts + issued certificates */
.artifacts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.btn.small { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.certs-panel { margin-top: 0.8rem; background: var(--color-bg-card); border-radius: var(--radius-md); padding: 0.5rem var(--spacing-lg); max-height: 320px; overflow: auto; }
.certs-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.certs-table th, .certs-table td { text-align: left; padding: 0.45rem 0.7rem; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.certs-table td.mono, .ck-val { font-family: 'JetBrains Mono', monospace; }

/* Labeled checkpoint card */
.ck-title { font-weight: 700; margin-bottom: 0.5rem; font-family: 'Inter', sans-serif; }
.ck-row { display: grid; grid-template-columns: 120px 1fr; gap: 0.6rem; padding: 0.15rem 0; }
.ck-label { opacity: 0.65; }

/* Info icon + popup */
.info-icon { background: none; border: 1px solid rgba(255, 255, 255, 0.25); color: var(--color-text-primary); border-radius: 50%; width: 20px; height: 20px; font-size: 0.7rem; cursor: pointer; line-height: 1; padding: 0; }
.info-icon:hover { border-color: var(--color-primary); color: var(--color-primary); }
td.nowrap { white-space: nowrap; }
.popup-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.popup-overlay[hidden] { display: none; }
.popup { background: var(--color-bg-card); border-radius: var(--radius-lg); padding: var(--spacing-lg); max-width: 520px; position: relative; box-shadow: var(--shadow-quantum); }
.popup h4 { margin-bottom: 0.6rem; }
.popup-close { position: absolute; top: 0.5rem; right: 0.7rem; background: none; border: none; color: var(--color-text-primary); font-size: 1.4rem; cursor: pointer; line-height: 1; }
.popup { max-height: 80vh; overflow: auto; }
.view-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-bottom: 0.5rem; }
.view-table td { padding: 0.3rem 0.6rem; }
.view-table td.field { font-weight: 600; white-space: nowrap; vertical-align: top; }
.view-table tr.explain-row td { opacity: 0.65; font-size: 0.8rem; padding-top: 0; padding-bottom: 0.6rem; }
.pem-block { background: var(--mtc-code-bg, #0b1220); color: var(--mtc-code-fg, #e5e7eb); border-radius: var(--radius-sm); padding: 0.8rem; font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; white-space: pre-wrap; word-break: break-all; max-height: 200px; overflow: auto; margin-top: 0.6rem; }
.certs-table a.btn, .certs-table .btn { text-decoration: none; }

/* Live log (Act 6) */
.metrics-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: var(--spacing-lg); }
.metric { background: var(--color-bg-card); border-radius: var(--radius-md); padding: 0.5rem 0.9rem; display: flex; flex-direction: column; min-width: 92px; }
.metric-label { font-size: 0.68rem; opacity: 0.65; text-transform: uppercase; letter-spacing: 0.04em; }
.metric-val { font-family: 'JetBrains Mono', monospace; font-size: 1.3rem; font-weight: 700; color: var(--color-accent); }
.mtc-node.revoked { fill: #ef4444; }
.consistency-card { margin-top: var(--spacing-lg); background: var(--color-bg-card); border-left: 4px solid var(--color-accent); border-radius: var(--radius-md); padding: var(--spacing-lg); font-size: 0.9rem; line-height: 1.5; }
.browser-h { margin-top: var(--spacing-lg); margin-bottom: 0.5rem; }
.tech-only { display: none; }
body.tech-mode .tech-only { display: table-cell; }

@media (prefers-reduced-motion: reduce) {
    .size-bar-fill, .mtc-node, .mtc-edge, .verified-seal, .gear, .seal-inline, .act { transition: none; animation: none; }
}
.pem-h { margin: 0.9rem 0 0.3rem; font-size: 0.85rem; opacity: 0.8; font-weight: 700; }
/* Landmark (Act 6) */
.landmark-card { background: var(--color-bg-card); border-left: 4px solid var(--color-secondary); border-radius: var(--radius-md); padding: 0.7rem var(--spacing-lg); margin-bottom: var(--spacing-lg); font-size: 0.88rem; line-height: 1.5; }
.badge-landmark { display: inline-block; padding: 0.15rem 0.55rem; border-radius: var(--radius-sm); font-size: 0.72rem; font-weight: 700; background: rgba(16,185,129,0.18); color: var(--color-accent); white-space: nowrap; }
.badge-cosigned { display: inline-block; padding: 0.15rem 0.55rem; border-radius: var(--radius-sm); font-size: 0.72rem; font-weight: 700; background: rgba(245,158,11,0.18); color: #f59e0b; white-space: nowrap; }
