/* 6. Editor: a working sample of Logolith's canvas editor. Tool rail, canvas, side panel, live size strip. */
.editor-head { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(24px, 5vw, 72px); align-items: end; }
.editor-intro .side-note { margin-top: 14px; }
.editor-facts { grid-template-columns: repeat(4, 1fr); margin-top: 32px; }
.editor-facts b { margin-bottom: 4px; }

.ed {
  --ed-grid: rgba(23, 23, 28, .06);
  margin-top: clamp(36px, 5vw, 56px); background: var(--card); border-radius: var(--r-xl); overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 60px 100px -70px rgba(23, 23, 28, .7);
}
.ed button { font: 500 13px var(--sans); }
.ed-top { display: flex; align-items: center; gap: 16px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
.ed-views { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--paper-2); }
.ed-views a, .ed-views span { display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; text-decoration: none; color: var(--ink-2); }
.ed-views .on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(23, 23, 28, .12); font-weight: 500; }
.ed-file { font: 400 12px var(--mono); color: var(--ink-3); margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-top-acts { display: flex; gap: 6px; align-items: center; }
.ed-top-acts > button, .ed-bool button, .ed-seg button { min-height: 34px; padding: 0 14px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-strong); transition: background .2s, box-shadow .2s, color .2s; }
.ed-top-acts > button:disabled, .ed-bool button:disabled { opacity: .4; cursor: default; }
.ed-primary { min-height: 34px; padding: 0 16px; border-radius: 999px; background: var(--ink) !important; color: var(--paper); box-shadow: none !important; }
.ed-export { position: relative; }
.ed-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 5; width: 280px; padding: 16px; border-radius: 18px; background: var(--card); box-shadow: 0 0 0 1px var(--line), 0 30px 60px -30px rgba(23, 23, 28, .5); display: grid; gap: 12px; animation: rise .35s var(--ease); }
.ed-pop-t { font: 400 22px/1 var(--serif); }
.ed-pop-n { font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.ed-seg { display: flex; gap: 6px; }
.ed-seg button[aria-checked="true"] { background: var(--ink); color: var(--paper); box-shadow: none; }

.ed-body { display: grid; grid-template-columns: 176px 1fr 236px; min-height: 560px; }

/* Tool rail: words and shortcut keys, grouped like the real editor. */
.ed-rail { border-right: 1px solid var(--line); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; background: var(--paper); }
.ed-rail hr { border: 0; height: 1px; background: var(--line); margin: 6px 8px; }
.ed-rail button { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; padding: 0 10px; border-radius: 10px; text-align: left; color: var(--ink-2); transition: background .2s, color .2s; }
.ed-rail button kbd { font: 500 11px var(--mono); color: var(--ink-3); padding: 2px 6px; border-radius: 6px; background: var(--paper-2); }
.ed-rail button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.ed-rail button[aria-checked="true"] kbd { background: rgba(255, 255, 255, .14); color: var(--paper); }
.ed-rail button.full { color: var(--ink-3); }
@media (hover: hover) and (pointer: fine) { .ed-rail button:hover:not([aria-checked="true"]) { background: var(--paper-2); color: var(--ink); } }

/* Canvas */
.ed-canvas { position: relative; display: grid; place-items: center; padding: 20px; min-width: 0; }
.ed-canvas svg { width: 100%; max-width: 520px; aspect-ratio: 1; height: auto; overflow: hidden; border-radius: 14px; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* Tap tools leave vertical page scroll alone; move and draw tools own every touch on the canvas. */
.ed:is([data-tool="select"], [data-tool="rect"], [data-tool="ellipse"], [data-tool="polygon"], [data-tool="line"], [data-tool="guide-line"], [data-tool="guide-circle"]) .ed-canvas svg { touch-action: none; }
.ed-board { fill: #fbfaf6; transition: fill .4s var(--ease); }
.ed.dark .ed-board { fill: #232329; }
.ed.dark { --ed-grid: rgba(255, 255, 255, .07); }
.ed-gridrect { transition: opacity .3s; }
.ed:not(.v-grid) .ed-gridrect { opacity: 0; }
.ed-keylines, .ed-construct, .ed-userguides { fill: none; stroke-width: 1.5; pointer-events: none; }
.ed-keylines { stroke: rgba(70, 110, 220, .55); opacity: 0; transition: opacity .3s; }
.ed.v-keylines .ed-keylines { opacity: 1; }
.ed-construct { stroke: var(--coral); stroke-dasharray: 6 7; opacity: 0; transition: opacity .3s; }
.ed-construct text { fill: var(--coral-ink); stroke: none; font: 500 16px var(--mono); }
.ed.v-construct .ed-construct { opacity: 1; }
.ed-userguides { stroke: var(--coral); stroke-dasharray: 8 6; }
#edArt [data-part] { cursor: pointer; }
#edArt .v { transition: fill .3s var(--ease), stroke .3s var(--ease); }
#edArt .hit { fill: none; stroke: transparent; stroke-width: 56; pointer-events: stroke; }
#edArt .gone { display: none; }
#edArt .hot .v { filter: drop-shadow(0 0 10px rgba(255, 122, 89, .9)); }
#edArt [data-part]:focus { outline: none; }
.ed-ghosts * { fill: none !important; stroke: var(--coral) !important; stroke-width: 2 !important; stroke-dasharray: 6 6; opacity: .75; cursor: pointer; }
.ed-sel rect.box { fill: none; stroke: #3b82f6; stroke-width: 2; }
.ed-sel rect.h { fill: #fff; stroke: #3b82f6; stroke-width: 2; }
.ed-draft * { fill: none; stroke: #3b82f6; stroke-width: 2; stroke-dasharray: 6 5; }
.ed[data-tool="select"] #edArt [data-part] { cursor: move; }
.ed:is([data-tool="rect"], [data-tool="ellipse"], [data-tool="polygon"], [data-tool="line"], [data-tool="guide-line"], [data-tool="guide-circle"]) .ed-canvas svg,
.ed:is([data-tool="rect"], [data-tool="ellipse"], [data-tool="polygon"], [data-tool="line"], [data-tool="guide-line"], [data-tool="guide-circle"]) #edArt [data-part] { cursor: crosshair; }
.ed[data-tool="eyedropper"] #edArt [data-part] { cursor: copy; }
.ed-log { position: absolute; left: 20px; right: 20px; bottom: 12px; font: 400 12px var(--mono); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-log.note { color: var(--coral-ink); }

/* Side panel */
.ed-side { border-left: 1px solid var(--line); padding: 6px 16px 16px; display: grid; align-content: start; gap: 0; background: var(--paper); }
.ed-side section { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.ed-side section:last-child { border-bottom: 0; }
.ed-side h3 { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.ed-swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ed-swatches button { aspect-ratio: 1; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); transition: transform .2s var(--spring); }
.ed-swatches button[aria-checked="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }
.ed-current { display: flex; align-items: center; gap: 8px; font: 400 12px var(--mono); color: var(--ink-2); }
.ed-current i { width: 18px; height: 18px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.ed-toggle { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); min-height: 28px; cursor: pointer; }
.ed-toggle input { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; }
.ed-selname { font-size: 13px; color: var(--ink); font-weight: 500; }
.ed-bool { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ed-bool button { padding: 0 8px; font-size: 12px; }
.ed-note { font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.ed-history { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font: 400 11.5px/1.35 var(--mono); color: var(--ink-2); max-height: 132px; overflow: auto; }
.ed-history li:first-child { color: var(--ink); }
.ed-history li.empty { color: var(--ink-3); }

/* Live size strip */
.ed-strip { display: flex; align-items: flex-end; gap: 22px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--paper); }
.ed-strip-t { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-right: auto; align-self: center; }
.ed-strip figure { display: grid; justify-items: center; gap: 6px; }
.ed-strip svg { overflow: visible; }
.ed-strip figcaption { font: 400 11px var(--mono); color: var(--ink-3); }
.ed-strip .dark svg { background: #17171c; border-radius: 6px; padding: 4px; width: 40px; height: 40px; box-sizing: border-box; }

@media (max-width: 1080px) {
  .ed-body { grid-template-columns: 150px 1fr; }
  .ed-side { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); grid-template-columns: repeat(2, 1fr); column-gap: 24px; }
  .ed-side section:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 980px) {
  .editor-head { grid-template-columns: 1fr; }
  .editor-facts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .ed-file { display: none; }
  .ed-top { flex-wrap: wrap; position: relative; }
  .ed-top-acts { flex: 1 1 100%; }
  .ed-export { position: static; margin-left: auto; }
  .ed-pop { left: 12px; right: 12px; width: auto; } /* anchor to the bar, not the button, so it never runs off the left edge */
  .ed-body { grid-template-columns: 1fr; min-height: 0; }
  .ed-rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .ed-rail hr { width: 1px; height: auto; margin: 6px 2px; }
  .ed-rail button { flex: none; }
  .ed-rail { overscroll-behavior-x: contain; }
  .ed-side { grid-template-columns: 1fr; }
  .ed-side section:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  .ed-strip { gap: 14px; flex-wrap: wrap; justify-content: space-between; }
  .ed-strip-t { flex-basis: 100%; }
  .ed-canvas { padding: 12px; gap: 10px; }
  .ed-log { position: static; width: 100%; min-height: 34px; white-space: normal; text-align: center; }
  .editor-facts { grid-template-columns: 1fr; }
  .ed-swatches button { min-width: 0; }
  .license-wrap { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
}

/* Touch pass: gated to touch and phones, so a mouse above 1080px looks as before. */
@media (pointer: coarse), (max-width: 720px) {
  .ed-views a, .ed-views span { min-height: 44px; touch-action: manipulation; }
  .ed-top-acts > button, .ed-primary, .ed-bool button, .ed-seg button, .ed-rail button, .ed-toggle { min-height: 44px; }
  .ed-toggle input { width: 20px; height: 20px; }
  #edArt .hit { stroke-width: 80; } /* fingers are wider than a pointer */
  .ed-swatches button:active, .ed-rail button:active, .ed-top-acts > button:active, .ed-bool button:active, .ed-seg button:active { transform: scale(.96); }
}
@media (hover: none) { .ed-rail button kbd { display: none; } } /* no keyboard, no shortcut hints */
