/* Additive phase view. Paper, ink and phase colours are the native palette. */
:root[data-theme="dark"] { --e1p-arrow: #a4b7ce; }
.e1p-panel { margin: 0 0 16px; padding: 0 1px 12px; border-bottom: 1px solid var(--rule); color: var(--ink); font-family: var(--sans); }
body[data-e1p=true] .phase-now > div:last-child { min-width: 0; }
body[data-e1p=true] .phase-name { font-size: 27px; }
.e1p-heading { display: flex; justify-content: space-between; align-items: center; gap: 6px; font: 400 21px/1.1 var(--serif); }
.e1p-toggle, #e1p-open, #e1p-close { background: none; border: 0; cursor: pointer; color: var(--ink-2); padding: 5px; font: 500 10px/1.3 var(--mono); text-decoration: underline; text-underline-offset: 3px; }
.e1p-body[hidden] { display: none; }
.e1p-sub { font: 400 10px/1.4 var(--mono); color: var(--ink-2); margin: 5px 0 0; }
.e1p-graph { display: block; width: 100%; max-width: 290px; height: auto; margin: 2px auto; overflow: visible; }
.e1p-graph text { text-anchor: middle; pointer-events: none; fill: var(--ink); }
.e1p-axis { font: 400 9px var(--mono); letter-spacing: .08em; fill: var(--ink-3) !important; }
.e1p-edge { stroke: #929baa; stroke-width: 1.5; stroke-linecap: round; fill: none; }
.e1p-edge.direct { stroke: var(--pw); stroke-width: 1.8; }
.e1p-edge.dominance { stroke: #aab2c0; stroke-dasharray: 3 5; opacity: .65; }
.e1p-edge.next { stroke: var(--ink); stroke-width: 3.5; opacity: 1; }
.e1p-edge.direct.next { stroke: var(--pw); marker-start: none; }
.e1p-wheel { cursor: pointer; outline: none; }
.e1p-halo { stroke: var(--phase); fill: none; stroke-width: 2; opacity: 0; }
.e1p-disc { stroke: var(--phase); stroke-width: 1.5; fill: var(--paper); }
.e1p-wheel.focused .e1p-halo, .e1p-wheel:focus-visible .e1p-halo { opacity: 1; }
.e1p-wheel.focused .e1p-disc { fill: var(--phase); }
.e1p-code { font: 500 19px var(--mono); fill: var(--phase) !important; }
.e1p-stroke { font: 500 9px var(--sans); }
.e1p-wheel.focused .e1p-code, .e1p-wheel.focused .e1p-stroke, .e1p-wheel.focused .e1p-carrier { fill: var(--on-phase) !important; }
.e1p-carrier { font: 500 8px var(--mono); fill: var(--phase) !important; }
.e1p-legend { display: flex; gap: 5px 9px; flex-wrap: wrap; font-size: 9px; line-height: 1.3; color: var(--ink-2); margin: 0 0 9px; }
.e1p-legend span { display: flex; align-items: center; gap: 4px; }
.e1p-legend i { width: 12px; border-top: 2px solid #929baa; display: inline-block; }
.e1p-legend .direct { border-color: var(--pw); }
.e1p-legend .dominance { border-top-style: dashed; border-color: #aab2c0; }
.e1p-route { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-top: 1px solid var(--rule); }
.e1p-route span { font: 400 9px var(--mono); letter-spacing: .07em; color: var(--ink-3); }
.e1p-route b { font: 500 13px var(--mono); }
.e1p-angles { font: 400 10px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.e1p-angles > div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-top: 1px solid var(--rule-soft); }
.e1p-angles b { font-weight: 500; }
.e1p-invariant { font: 500 10px/1.3 var(--mono); padding: 5px 0; color: var(--ink-2); }
.e1p-invariant[data-ok=false] { color: #a3341f; }
.e1p-focus { font-size: 12px; font-weight: 600; line-height: 1.4; margin: 3px 0; }
.e1p-next, .e1p-event { font-size: 11px; line-height: 1.4; color: var(--ink-2); margin: 4px 0; }
.e1p-event { min-height: 31px; }
.e1p-cylinders { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 8px 0; }
.e1p-cylinders button { border: 1px solid var(--rule); border-top: 3px solid var(--phase); background: transparent; padding: 5px 0; cursor: pointer; min-width: 0; }
.e1p-cylinders button.focused { background: var(--ink); color: var(--paper); }
.e1p-cylinders small, .e1p-cylinders b { display: block; font: 500 9px/1.2 var(--mono); }
.e1p-cylinders b { font-size: 15px; margin-top: 3px; }
.e1p-panel button:focus-visible, #e1p-open:focus-visible, #e1p-close:focus-visible, .e1p-mini:focus-visible { outline: 2px solid var(--in); outline-offset: 3px; }
.e1p-evidence { font-size: 11px; color: var(--ink-2); line-height: 1.5; border-top: 1px solid var(--rule); padding-top: 7px; }
.e1p-evidence summary { cursor: pointer; font-weight: 500; }
.e1p-evidence p { margin: 8px 0 0; }
.e1p-mapping { margin: 8px 0; }
.e1p-mapping div { display: flex; gap: 8px; padding: 3px 0; }
.e1p-mapping dt { font-family: var(--mono); font-weight: 500; }
.e1p-mapping dd { margin: 0; }
.e1p-figure-strip { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.e1p-mini-row { position: relative; display: grid; grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(3, 34px); gap: 4px; }
.e1p-mini-row::before, .e1p-mini-row::after { content: ''; position: absolute; background: var(--ink-3); }
.e1p-mini-row::before { left: 17px; right: 17px; top: 54px; height: 1px; }
.e1p-mini-row::after { top: 17px; bottom: 17px; left: 54px; width: 1px; }
.e1p-mini { z-index: 1; width: 34px; height: 34px; border: 1.5px solid var(--phase); border-radius: 50%; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--paper); color: var(--phase); cursor: pointer; }
.e1p-mini[data-phase=CA] { grid-column: 2; grid-row: 1; }
.e1p-mini[data-phase=AC] { grid-column: 2; grid-row: 3; }
.e1p-mini[data-phase=AA] { grid-column: 1; grid-row: 2; }
.e1p-mini[data-phase=CC] { grid-column: 3; grid-row: 2; }
.e1p-mini.focused { background: var(--phase); color: var(--on-phase); }
.e1p-mini b { font: 500 11px/1.1 var(--mono); }
.e1p-mini small { font: 400 7px/1.2 var(--mono); margin-top: 1px; }
#e1p-open { padding-left: 0; margin-top: 4px; }
#e1p-dialog { width: min(390px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 14px 18px; background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); }
#e1p-dialog::backdrop { background: rgba(22, 27, 38, .25); }
:root[data-theme="dark"] #e1p-dialog::backdrop { background: rgba(0, 0, 0, .55); }
:root[data-theme="dark"] .e1p-invariant[data-ok=false] { color: var(--pw); }
.e1p-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--rule); font: 400 10px var(--mono); }
#e1p-dialog .e1p-panel { margin-bottom: 0; border: 0; padding-bottom: 0; }
body[data-layout=unavailable] { overflow: auto; }
.e1p-unavailable { max-width: 600px; margin: 36px auto; padding: 24px; background: var(--paper); border-top: 2px solid var(--ink); font-size: 16px; line-height: 1.5; }
.e1p-overline { font: 400 12px var(--mono); color: var(--ink-2); }
.e1p-unavailable h1 { font-size: 38px; }
.e1p-unavailable svg { display: block; width: min(100%, 300px); height: auto; margin: 24px auto; font-family: var(--sans); }
.e1p-unavailable h2 { font: 400 27px var(--serif); margin-bottom: 8px; }
.e1p-unavailable p { margin: 12px 0; }
.e1p-unavailable-mapping { padding-top: 12px; border-top: 1px solid var(--rule); color: var(--ink-2); font-size: 14px; }
@media (max-height: 820px) and (min-width: 961px) {
  .e1p-graph { max-width: 235px; }
  .e1p-heading { font-size: 20px; }
  .e1p-event { min-height: 0; }
}
@media (max-width: 960px) {
  body[data-e1p=true][data-layout=sheet] .phase-panel { overflow: visible; }
  .e1p-panel { padding-right: 1px; }
}
.e1p-atlas-link { display: inline-block; margin-top: 8px; color: var(--ink); font: 500 13px/1.45 var(--sans); text-underline-offset: 3px; }
.e1p-atlas-link:focus-visible { outline: 2px solid var(--in); outline-offset: 3px; }

.e1p-atlas-notes { margin: 10px 0; }
.e1p-atlas-notes ul { margin: 8px 0 0; padding-left: 18px; }
.e1p-atlas-notes li + li { margin-top: 6px; }
.e1p-atlas-notes a { color: inherit; }

body[data-embedded="true"] .e1p-atlas-link { display: none; }
