/* markdown engineering — interactive primer styles (aiminutes shell) */

.content-wrap { position: relative; }

.demo-window {
    border: 1px solid rgba(55,53,47,0.10);
    background: #e8e8e4;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(55,53,47,0.06), 0 1px 3px rgba(55,53,47,0.04);
    overflow: hidden;
    margin: 28px auto;
    max-width: 560px;
    user-select: none;
    transition: transform 0.15s ease;
}
.demo-window.dragging { transition: none; }
.demo-window.wide { max-width: 640px; }
.demo-titlebar {
    height: 28px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    cursor: grab;
}
.demo-titlebar.grabbing { cursor: grabbing; }
.demo-dots { display: flex; gap: 6px; }
.demo-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(55,53,47,0.14); }
.demo-window-title {
    font-size: 10px;
    color: rgba(55,53,47,0.40);
    font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
    margin: 0 auto;
}
.demo-body { background: #fff; padding: 16px; }

.viz-block { margin: 28px 0; }
.viz-frame {
    background: #f5f5f3;
    overflow: hidden;
    box-shadow: 0 1px 8px rgba(55,53,47,0.04);
    position: relative;
    border-radius: 4px;
    border: 1px solid #eee;
}
.viz-frame canvas { display: block; width: 100%; }
.viz-caption {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
}
.viz-title {
    font-size: 12px;
    color: #9a9a95;
    font-style: italic;
    font-family: 'Iowan Old Style', Georgia, serif;
}
.viz-hint {
    font-size: 12px;
    color: #b8b8b2;
    font-family: 'Iowan Old Style', Georgia, serif;
}

.formula-block {
    background: #f8f8f6;
    border: 1px solid rgba(55,53,47,0.08);
    border-radius: 8px;
    padding: 18px 22px;
    margin: 20px 0;
    text-align: center;
}
.formula-label {
    font-size: 10px;
    font-family: 'SF Mono', Menlo, monospace;
    color: #9a9a95;
    text-align: left;
    margin-bottom: 10px;
}
.formula-main {
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 0.95rem;
    color: #37352f;
    line-height: 1.6;
}
.formula-sub {
    margin-top: 10px;
    font-size: 0.82rem;
    color: #6e6e68;
    line-height: 1.5;
}

.term {
    position: relative;
    display: inline;
    font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
    font-size: 0.85em;
    background: #f0f0ee;
    padding: 1px 6px;
    border-radius: 4px;
    color: #5a5852;
    font-weight: 500;
    cursor: default;
    border-bottom: 1px dashed #ccc;
    -webkit-tap-highlight-color: transparent;
}
.term-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: white;
    border: 1px solid rgba(55,53,47,0.10);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(55,53,47,0.08), 0 1px 3px rgba(55,53,47,0.04);
    padding: 10px 14px;
    width: 260px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
}
.term-tooltip.wide { width: 300px; }
.term:hover .term-tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}
.term-tooltip-title {
    display: block;
    font-family: monospace;
    font-size: 10px;
    font-weight: 600;
    color: #37352f;
    margin-bottom: 6px;
}
.term-tooltip-body {
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 11px;
    color: #6e6e68;
    line-height: 1.5;
    font-weight: 400;
}

.me-btn {
    font-size: 11px;
    font-family: 'SF Mono', Menlo, monospace;
    background: #f4f4f2;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 5px 12px;
    cursor: pointer;
    color: #5a5852;
    transition: background 0.15s, color 0.15s;
}
.me-btn:hover { background: #ecece8; color: #37352f; }
.me-btn:disabled { opacity: 0.4; cursor: default; }
.me-btn.active { background: #37352f; color: #fff; border-color: #37352f; }
.me-btn.danger { color: #9b4d43; }
.me-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    flex-wrap: wrap;
}
.me-status {
    font-size: 10px;
    font-family: monospace;
    color: #9a9a95;
}
.me-seg {
    display: flex;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}
.me-seg button {
    flex: 1;
    font-size: 10px;
    font-family: monospace;
    padding: 6px 8px;
    border: none;
    border-left: 1px solid #ddd;
    cursor: pointer;
    background: #f4f4f2;
    color: #6e6e68;
}
.me-seg button:first-child { border-left: none; }
.me-seg button.active { background: #37352f; color: #fff; }

.me-meter {
    height: 10px;
    background: #f0f0ee;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #eee;
}
.me-meter-fill {
    height: 100%;
    width: 0%;
    background: #37352f;
    border-radius: 999px;
    transition: width 0.35s ease, background 0.35s ease;
}
.me-meter-fill.warn { background: #c9842a; }
.me-meter-fill.bad { background: #b85c4a; }
.me-meter-fill.good { background: #4a7c59; }

.me-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.me-chip {
    font-size: 10px;
    font-family: monospace;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f4f4f2;
    border: 1px solid #e4e4e0;
    color: #5a5852;
}
.me-chip.on { background: #37352f; color: #fff; border-color: #37352f; }
.me-chip.faded { opacity: 0.45; }

.me-code {
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 11px;
    line-height: 1.7;
    background: #fafaf8;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 10px 12px;
    color: #5a5852;
    white-space: pre-wrap;
    max-height: 220px;
    overflow: auto;
}
.me-line {
    padding: 1px 6px;
    border-left: 2px solid transparent;
    transition: background 0.2s, border-color 0.2s;
}
.me-line.active {
    background: rgba(74,124,89,0.08);
    border-left-color: #4a7c59;
    color: #37352f;
}
.me-line.fail {
    background: rgba(184,92,74,0.08);
    border-left-color: #b85c4a;
}

.me-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.me-card {
    background: #fafaf8;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 10px 12px;
}
.me-card h4 {
    margin: 0 0 6px;
    font-size: 11px;
    font-family: monospace;
    font-weight: 600;
    color: #37352f;
    text-decoration: none;
}
.me-card p {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: #6e6e68;
}
.me-card.selected {
    border-color: #37352f;
    box-shadow: inset 0 0 0 1px #37352f;
}

.me-progress {
    height: 3px;
    background: #eee;
    border-radius: 2px;
    margin-bottom: 12px;
    overflow: hidden;
}
.me-progress-fill {
    height: 100%;
    width: 0%;
    background: #37352f;
    transition: width 0.3s ease;
}

.me-node-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0;
}
.me-node {
    font-size: 10px;
    font-family: monospace;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    color: #5a5852;
    min-width: 72px;
    text-align: center;
    transition: all 0.25s ease;
}
.me-node.active {
    background: #37352f;
    color: #fff;
    border-color: #37352f;
}
.me-node.done {
    background: rgba(74,124,89,0.12);
    border-color: #4a7c59;
    color: #4a7c59;
}
.me-arrow { color: #b8b8b2; font-family: monospace; font-size: 12px; }

.me-budget {
    display: flex;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #eee;
    margin: 8px 0 6px;
}
.me-budget span {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-family: monospace;
    color: #fff;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: flex 0.35s ease;
}
.me-budget .sys { background: #5a5852; }
.me-budget .tools { background: #6e8a9e; }
.me-budget .hist { background: #8a7a5a; }
.me-budget .mem { background: #7a6a8a; }
.me-budget .free { background: #e8e8e4; color: #9a9a95; }
.me-budget .rot { background: #b85c4a; }

.me-tree-q {
    font-size: 13px;
    color: #37352f;
    margin-bottom: 10px;
    line-height: 1.45;
}
.me-tree-opts { display: flex; flex-direction: column; gap: 6px; }
.me-tree-opt {
    text-align: left;
    font-size: 12px;
    font-family: inherit;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #e4e4e0;
    background: #fafaf8;
    cursor: pointer;
    color: #37352f;
}
.me-tree-opt:hover { border-color: #37352f; }
.me-tree-result {
    margin-top: 12px;
    padding: 12px;
    background: #f7f7f5;
    border-radius: 6px;
    border-left: 2px solid #37352f;
    font-size: 13px;
    line-height: 1.55;
    color: #37352f;
}
.me-tree-path {
    font-size: 10px;
    font-family: monospace;
    color: #9a9a95;
    margin-bottom: 8px;
}

.me-timeline {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding: 8px 0 4px;
    -webkit-overflow-scrolling: touch;
}
.me-tl-item {
    flex: 0 0 auto;
    width: 140px;
    padding: 0 10px;
    border-left: 2px solid #e4e4e0;
    cursor: pointer;
}
.me-tl-item:hover, .me-tl-item.active { border-left-color: #37352f; }
.me-tl-year {
    font-size: 10px;
    font-family: monospace;
    color: #9a9a95;
    margin-bottom: 4px;
}
.me-tl-title {
    font-size: 12px;
    color: #37352f;
    line-height: 1.35;
    font-weight: 500;
}
.me-tl-body {
    margin-top: 10px;
    font-size: 12px;
    color: #6e6e68;
    line-height: 1.5;
    min-height: 48px;
}

.me-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.me-stack-layer {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e4e4e0;
    background: #fff;
    cursor: pointer;
    transition: all 0.25s ease;
}
.me-stack-layer h4 {
    margin: 0 0 2px;
    font-size: 11px;
    font-family: monospace;
    text-decoration: none;
}
.me-stack-layer p { margin: 0; font-size: 11px; color: #6e6e68; line-height: 1.4; }
.me-stack-layer.on {
    transform: translateX(6px);
    border-color: #37352f;
    background: #fafaf8;
}
.me-stack-layer.dim { opacity: 0.35; }

.coinage {
    margin: 22px 0;
    padding: 14px 16px;
    background: #fbfbfa;
    border: 1px solid #eee;
    border-radius: 6px;
}
.coinage-label {
    font-size: 10px;
    font-family: monospace;
    color: #9a9a95;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.coinage p { margin-bottom: 8px; font-size: 0.94rem; }
.coinage p:last-child { margin-bottom: 0; }

.thesis-box {
    margin: 30px 0 36px 0;
    padding: 18px 0 18px 18px;
    border-left: 2px solid #37352f;
}
.thesis-box p { margin-bottom: 8px; }
.thesis-box p:last-child { margin-bottom: 0; }
.thesis-label {
    display: block;
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 10px;
    color: #9a9a95;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.further-list { margin: 0 0 16px 22px; }
.further-list li { margin-bottom: 8px; }

@media (max-width: 600px) {
    .demo-window, .demo-window.wide { max-width: 100%; }
    .me-grid-2 { grid-template-columns: 1fr; }
    .formula-block { padding: 14px 16px; }
    .term .term-tooltip,
    .term:hover .term-tooltip,
    .term:active .term-tooltip {
        width: calc(100vw - 40px) !important;
        max-width: none !important;
        position: fixed !important;
        bottom: auto !important;
        left: 20px !important;
        right: 20px !important;
        z-index: 200 !important;
        transition: none !important;
        transform: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    .term .term-tooltip.mobile-open {
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .demo-window,
    .me-meter-fill,
    .me-progress-fill,
    .me-budget span,
    .me-node,
    .me-stack-layer,
    .me-line {
        transition: none !important;
    }
}

/* harness / interactive chips as buttons */
button.me-chip {
    cursor: pointer;
    font: inherit;
    font-size: 10px;
    font-family: monospace;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
button.me-chip:hover { border-color: #c8c8c2; color: #37352f; }
.me-seg button { white-space: nowrap; }

/* ---------- Act banners / TOC acts (also inlined lightly) ---------- */
.toc-act {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #c4c4c0;
    margin: 14px 0 6px;
    list-style: none;
    padding-left: 0;
    font-family: 'SF Mono', Menlo, monospace;
    font-weight: 500;
}
.toc-act:first-child { margin-top: 0; }

.act-banner {
    margin: 56px 0 8px;
    padding: 10px 0 10px 14px;
    border-left: 2px solid #37352f;
    font-size: 0.92rem;
    color: #5a5852;
    line-height: 1.5;
}
.act-banner-label {
    display: inline-block;
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 10px;
    text-transform: uppercase;
    color: #9a9a95;
    margin-right: 8px;
}

/* ---------- harness Act II demos ---------- */
.me-dof-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-family: monospace;
    color: #9a9a95;
    margin-bottom: 6px;
}
.me-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #e4e4e0;
    outline: none;
    cursor: pointer;
    margin: 8px 0 4px;
}
.me-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #37352f;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(55,53,47,0.25);
}
.me-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #37352f;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(55,53,47,0.25);
}

.me-compound-track {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.me-compound-step {
    flex: 1 1 90px;
    min-width: 90px;
    padding: 10px 8px;
    border: 1px solid #e4e4e0;
    border-radius: 8px;
    text-align: center;
    font-size: 11px;
    font-family: monospace;
    color: #9a9a95;
    background: #fafaf8;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
}
.me-compound-step .me-cs-n {
    display: block;
    font-size: 9px;
    color: #c4c4c0;
    margin-bottom: 4px;
}
.me-compound-step.on {
    border-color: #37352f;
    color: #37352f;
    background: #fff;
    transform: translateY(-1px);
}
.me-compound-step.done {
    border-color: #4a7c59;
    color: #4a7c59;
}

.me-skill-layers {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}
.me-skill-layer {
    font-size: 11px;
    font-family: monospace;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px dashed #e4e4e0;
    color: #9a9a95;
    background: #fbfbfa;
    opacity: 0.45;
    transition: opacity 0.2s, border-color 0.2s, color 0.2s;
}
.me-skill-layer.on {
    opacity: 1;
    border-style: solid;
    border-color: #37352f;
    color: #37352f;
    background: #fff;
}

/* ---------- appendix: public harness anatomies ---------- */
.me-compare {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    font-family: 'SF Mono', Menlo, monospace;
}
.me-compare th, .me-compare td {
    border-bottom: 1px solid #eee;
    padding: 8px 7px;
    text-align: left;
    vertical-align: top;
    color: #5a5852;
    line-height: 1.4;
}
.me-compare th {
    color: #9a9a95;
    font-weight: 500;
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.me-compare tbody tr {
    cursor: pointer;
    transition: background 0.12s ease;
}
.me-compare tbody tr:hover { background: #fafaf8; }
.me-compare tbody tr.on { background: #f3f3f0; }
.me-compare tbody tr.on td:first-child { color: #37352f; font-weight: 600; }

.me-anatomy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.me-anatomy-node {
    border: 1px solid #e4e4e0;
    background: #fafaf8;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 11px;
    font-family: monospace;
    color: #6e6e68;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
}
.me-anatomy-node:hover { border-color: #c8c8c2; color: #37352f; }
.me-anatomy-node.on {
    border-color: #37352f;
    color: #37352f;
    background: #fff;
    transform: translateY(-1px);
}
.me-anatomy-arrow {
    color: #c4c4c0;
    font-size: 12px;
    font-family: monospace;
}

.me-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.me-mini-card {
    border: 1px solid #e4e4e0;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fafaf8;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}
.me-mini-card:hover { border-color: #c8c8c2; }
.me-mini-card.on {
    border-color: #37352f;
    background: #fff;
}
.me-mini-card .me-mc-name {
    font-size: 12px;
    font-weight: 600;
    color: #37352f;
    margin-bottom: 2px;
}
.me-mini-card .me-mc-meta {
    font-size: 10px;
    font-family: monospace;
    color: #9a9a95;
}

@media (max-width: 600px) {
    .me-card-grid { grid-template-columns: 1fr; }
    .me-anatomy-arrow { display: none; }
}

/* ---------- appendix: deep-dive compare highlight ---------- */
.me-compare tbody tr.me-deep td:first-child {
    position: relative;
}
.me-deep-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid #d8d8d2;
    background: #f3f3f0;
    color: #6e6e68;
    font-size: 8.5px;
    font-family: 'SF Mono', Menlo, monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
    white-space: nowrap;
}
.me-compare tbody tr.me-deep.on .me-deep-badge {
    border-color: #37352f;
    color: #37352f;
    background: #fff;
}
button.me-stack-layer {
    width: 100%;
    text-align: left;
    font: inherit;
}
