/* Interactive typology state machine, Noesis dark panel palette */

.typ-machine-wrap {
    margin-bottom: 1.25rem;
    border: 1px solid rgba(201, 188, 170, 0.7);
    background: #f7f2e8;
    padding: 1rem 0 0.75rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.typ-machine-hint {
    font-size: 0.72rem;
    color: rgba(28, 27, 25, 0.62);
    margin: 0 1.25rem 0.75rem;
    letter-spacing: 0.02em;
}

.typ-machine-fallback {
    font-size: 0.78rem;
    color: rgba(196, 92, 74, 0.92);
    margin: 0.5rem 0 0;
    padding: 0.75rem 1rem;
    border: 1px dashed rgba(196, 92, 74, 0.45);
    background: rgba(196, 92, 74, 0.06);
}

.typ-machine-scroll {
    overflow-x: auto;
    overflow-y: visible;
    padding: 0 1.25rem 0.75rem;
    -webkit-overflow-scrolling: touch;
}

.typ-machine-canvas {
    min-height: 200px;
}

.typ-machine-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.65rem 1.25rem 0.25rem;
    border-top: 1px solid rgba(201, 188, 170, 0.5);
    font-size: 0.68rem;
    color: rgba(28, 27, 25, 0.72);
}

.typ-machine-legend .legend-title {
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(74, 93, 107, 0.9);
}

.typ-machine-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.typ-machine-legend .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.typ-machine-legend .legend-backbone .dot {
    background: rgba(212, 160, 60, 0.22);
    border: 1px solid rgba(212, 160, 60, 0.55);
}

.typ-machine-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(69, 60, 49, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 200;
}

.typ-machine-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.typ-machine-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(400px, 92vw);
    height: 100vh;
    background: #f9f3e8;
    border-left: 1px solid rgba(201, 188, 170, 0.75);
    box-shadow: -8px 0 36px rgba(69, 60, 49, 0.1);
    padding: 5.5rem 1.5rem 2rem;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 201;
}

.typ-machine-panel.open {
    transform: translateX(0);
}

.typ-machine-panel h3 {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.35rem;
    font-weight: 500;
    margin: 0 0 0.35rem;
    line-height: 1.25;
    color: var(--ink);
}

.typ-machine-panel .panel-type {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 1.25rem;
    font-family: "Source Sans 3", system-ui, sans-serif;
}

.typ-machine-panel .panel-section {
    margin-bottom: 1.15rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(201, 188, 170, 0.55);
}

.typ-machine-panel .panel-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.typ-machine-panel .panel-section h4 {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-soft);
    margin: 0 0 0.45rem;
}

.typ-machine-panel .panel-section p,
.typ-machine-panel .panel-section li {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--ink-muted);
    margin: 0;
}

.typ-machine-panel ul {
    margin: 0;
    padding-left: 1.1rem;
}

.typ-machine-panel .panel-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    background: var(--invariant-bg);
    color: var(--invariant);
    border: 1px solid rgba(107, 91, 74, 0.2);
    margin-top: 0.35rem;
}

.typ-machine-panel .affordance-pill {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 2px;
    margin-right: 0.35rem;
}

.typ-machine-svg {
    display: block;
    user-select: none;
}

.typ-machine-svg .col-header {
    font-family: "Source Sans 3", system-ui, sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    fill: rgba(74, 93, 107, 0.9);
}

.typ-machine-svg .row-modality {
    font-family: "Source Sans 3", system-ui, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.typ-machine-svg .row-citation {
    font-family: "Source Sans 3", system-ui, sans-serif;
    font-size: 9px;
    fill: rgba(28, 27, 25, 0.62);
}

.typ-machine-svg .row-domain-note {
    font-family: "Source Sans 3", system-ui, sans-serif;
    font-size: 8.5px;
    font-style: italic;
    letter-spacing: 0.02em;
}

.typ-machine-svg .fundamental-col {
    fill: rgba(212, 160, 60, 0.09);
    stroke: rgba(212, 160, 60, 0.22);
    stroke-width: 1;
}

.typ-machine-svg .edge-label {
    font-family: "Source Sans 3", system-ui, sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    fill: rgba(28, 27, 25, 0.35);
    pointer-events: none;
}

.typ-machine-svg .edge-label-bg {
    fill: transparent;
}

.typ-machine-svg .stage-node {
    cursor: pointer;
}

.typ-machine-svg .stage-node rect {
    transition: filter 0.15s ease, stroke-width 0.15s ease;
}

.typ-machine-svg .stage-node:hover rect {
    filter: brightness(1.05);
    stroke-width: 2.2;
}

.typ-machine-svg .node-class {
    font-family: "Source Sans 3", system-ui, sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.typ-machine-svg .node-label {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 13px;
    font-weight: 500;
    fill: var(--ink);
}

.typ-machine-svg .node-blurb {
    font-family: "Source Sans 3", system-ui, sans-serif;
    font-size: 9px;
    fill: rgba(28, 27, 25, 0.68);
}

.typ-machine-svg .badge-fundamental {
    font-family: "Source Sans 3", system-ui, sans-serif;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.06em;
    fill: var(--invariant);
}

.typ-machine-svg .badge-variant {
    font-family: "Source Sans 3", system-ui, sans-serif;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.05em;
    fill: var(--accent-soft);
}

.typ-machine-svg .flow-dot {
    opacity: 0.85;
}

@media (max-width: 720px) {
    .typ-machine-panel {
        padding-top: 4.5rem;
    }
}
