/* Brand editor (public/editor.js). The Tune section's language: hairline rows, a sans label over a mono tag,
   serif for what is current, round icon buttons and pill chips. A side drawer on wide screens, a bottom sheet
   on phones and tablets; the page reflows beside the drawer so the design stays in view while it changes. */

.ed {
  --ed-w: 400px;
  position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: var(--ed-w);
  display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  border-left: 1px solid var(--line-2);
  box-shadow: -24px 0 60px -36px rgba(22, 19, 15, 0.45);
  animation: ed-in 0.35s var(--ease);
}
@keyframes ed-in { from { transform: translateX(24px); opacity: 0; } }
body.ed-open #main { margin-right: var(--ed-w, 400px); transition: margin 0.3s var(--ease); }
body.ed-open .toast { left: calc(50% - 200px); }

.ed-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 12px;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--line);
}
.ed-grip { display: none; }
.ed-title-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
.ed-x { width: 36px; height: 36px; }
.ed-head h2 { font: 400 26px/1.05 var(--serif); letter-spacing: -0.01em; }
.ed-head h2:focus { outline: none; }
.ed-count { font: 400 11px/1.2 var(--mono); color: var(--muted); }
.ed-count.on { color: var(--accent); }
.ed-tools { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
.ed-tools .ed-compare { margin-left: auto; }
.ed-tools .icon-btn { width: 36px; height: 36px; }
.ed-tools .icon-btn:disabled { opacity: 0.35; cursor: default; border-color: var(--line-2); }
.ed-compare { white-space: nowrap; }
.chip:disabled { opacity: 0.4; cursor: not-allowed; border-color: var(--line-2); }

.ed-main { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.ed-tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 12px; border-bottom: 1px solid var(--line); }
.ed-tabs [role="tab"] {
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 12px 4px 10px; font: 500 14px/1 var(--sans); color: var(--muted); cursor: pointer;
}
.ed-tabs [role="tab"]:hover { color: var(--ink); }
.ed-tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.ed-compare-note { margin: 12px 18px 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; color: var(--ink-2); }

.ed-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 18px 24px; }
.ed-body[inert] { opacity: 0.45; }
.ed-lede { font-size: 13px; line-height: 1.45; color: var(--ink-2); padding: 14px 0 4px; }
.ed-preview-wrap { position: sticky; top: 0; z-index: 2; background: var(--paper); padding: 14px 0 6px; }
.ed-preview {
  height: 120px; border-radius: 12px; display: grid; place-items: center; padding: 14px 18px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07);
}
.ed-preview svg { width: 100%; height: 100%; }

.ed-row { display: grid; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.ed-row:last-child { border-bottom: 0; }
.ed-lab { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ed-name { font: 500 15px/1.2 var(--sans); }
.ed-tag { font: 400 11px/1.2 var(--mono); color: var(--accent); }
.ed-tag.mine { color: var(--muted); }
.ed-ctl { display: grid; gap: 10px; min-width: 0; }

.ed-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-seg .chip { min-height: 34px; }

.ed-note { font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.ed-note:empty { display: none; }
.ed-note[data-tone="bad"], .ed-status[data-tone="bad"] { color: #a2321a; }
.ed-note[data-tone="warn"], .ed-status[data-tone="warn"] { color: #8a5a12; }

.ed-input {
  width: 100%; min-width: 0; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); color: var(--ink);
  font: 400 15px/1.35 var(--sans);
}
.ed-input:hover { border-color: var(--ink-2); }
.ed-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
textarea.ed-input { resize: vertical; min-height: 64px; }
select.ed-input { cursor: pointer; }
.ed-own { display: flex; gap: 8px; align-items: center; }
.ed-input-sm::placeholder { text-transform: none; letter-spacing: 0; }
.ed-input-sm { width: 112px; text-transform: uppercase; font-family: var(--mono); letter-spacing: 0.08em; }
.ed-field { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font: 400 11px/1.2 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ed-field select { margin-top: 6px; text-transform: none; letter-spacing: 0; }
.ed-pair { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 10px; }
.ed-pair .ed-field { flex-direction: column; align-items: stretch; gap: 0; }
.ed-n { font: 400 11px/1 var(--mono); color: var(--muted); text-transform: none; }
.ed-spec { font-size: 30px; line-height: 1.1; overflow-wrap: anywhere; }
.ed-spec-text { font-size: 16px; line-height: 1.5; color: var(--ink-2); }

.ed-slider { display: flex; justify-content: space-between; align-items: baseline; font: 400 11px/1.2 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: -4px; }
.ed-slider output { color: var(--ink); text-transform: none; letter-spacing: 0; }
.ed input[type="range"] { width: 100%; accent-color: var(--ink); margin: 0; height: 28px; cursor: pointer; }

.ed-more { border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.35); }
.ed-more summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.ed-more summary::-webkit-details-marker { display: none; }
.ed-more summary b { color: var(--ink); font-weight: 500; }
.ed-more[open] .ed-plus { transform: rotate(45deg); }
.ed-plus { font: 400 18px/1 var(--sans); transition: transform 0.2s var(--ease); }
.ed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; padding: 0 10px 10px; }
.ed-grid .thumb { width: 100%; height: 56px; }

.ed-mono { display: flex; align-items: center; gap: 8px; }
.ed-mono .thumb { width: 64px; height: 56px; padding: 6px; }
.ed-mono-kind { font: 400 20px/1.1 var(--serif); margin-left: 6px; min-width: 0; }

.ed-colctl { display: flex; align-items: center; gap: 8px; }
.ed-sw {
  position: relative; flex: none; width: 44px; height: 40px; border-radius: 10px; background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14); cursor: pointer;
}
.ed-sw:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.ed-sw input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.ed-hex { width: 108px; flex: none; font-family: var(--mono); font-size: 14px; letter-spacing: 0.02em; }
.ed-colctl .link-btn { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ed-ramp { display: grid; grid-template-columns: repeat(11, 1fr); height: 10px; border-radius: 5px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); }
.ed-ramp i { display: block; }
.ed-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-checks:empty, .ed-fix:empty { display: none; }
.ed-check { font: 400 11px/1.2 var(--mono); padding: 5px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.5); box-shadow: inset 0 0 0 1px var(--line); }
.ed-check em { font-style: normal; color: var(--muted); }
.ed-check.bad { background: #f6dcd3; box-shadow: inset 0 0 0 1px #e2a693; color: #8e2b16; }
.ed-check.warn { background: #f5e8cf; box-shadow: inset 0 0 0 1px #e1c58d; color: #6f4a0d; }
.ed-fix { display: grid; gap: 8px; justify-items: start; }
.ed-fix .btn { white-space: normal; text-align: left; line-height: 1.25; padding-top: 6px; padding-bottom: 6px; }
.ed-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); }

.ed-foot { border-top: 1px solid var(--line); padding: 10px 18px calc(12px + env(safe-area-inset-bottom)); display: grid; gap: 6px; }
.ed-status { font-size: 13px; color: var(--ink-2); min-height: 1.2em; }
.ed-status:empty { min-height: 0; }
.ed-resets { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ed-resets .link-btn:disabled { opacity: 0.4; cursor: default; }

/* the page's own entry points */
.ed-open-btn[aria-expanded="true"] { --bg: var(--ink); --fg: var(--paper); --bd: var(--ink); }
body.ed-comparing #package::before {
  content: 'Jev’s original'; position: fixed; z-index: 35; left: 16px; bottom: 16px;
  padding: 8px 12px; border-radius: 999px; background: var(--ink); color: var(--paper); font: 500 12px/1 var(--mono);
}

/* tablets and phones: a bottom sheet over the page; the page keeps room to scroll above it */
@media (max-width: 1000px) {
  .ed {
    top: auto; left: 0; width: auto; height: min(62vh, 640px);
    border-left: 0; border-top: 1px solid var(--line-2); border-radius: 18px 18px 0 0;
    box-shadow: 0 -24px 60px -30px rgba(22, 19, 15, 0.5);
    animation-name: ed-up;
  }
  @keyframes ed-up { from { transform: translateY(32px); opacity: 0; } }
  .ed.min { height: auto; }
  .ed.min .ed-main, .ed.min .ed-tools { display: none; }
  body.ed-open #main { margin-right: 0; padding-bottom: min(62vh, 640px); }
  body.ed-open.ed-sheet-min #main { padding-bottom: 96px; }
  body.ed-open .toast { left: 50%; bottom: calc(min(62vh, 640px) + 12px); }
  .ed-grip { display: block; grid-column: 1 / -1; justify-self: center; width: 64px; height: 18px; margin: -10px 0 -2px; padding: 0; border: 0; background: none; cursor: pointer; }
  .ed-grip span { display: block; width: 40px; height: 4px; margin: 0 auto; border-radius: 2px; background: var(--line-2); }
  .ed-head { padding: 12px 16px 10px; }
  .ed-head h2 { font-size: 22px; }
  .ed-body { padding: 0 16px 20px; }
  .ed-foot { padding-left: 16px; padding-right: 16px; }
  .ed-preview-wrap { position: static; padding-top: 10px; }
  .ed-preview { height: 88px; }
}
@media (max-width: 640px) {
  .pkg-actions .ed-open-btn { display: inline-flex; }
  .ed-tools .icon-btn { width: 34px; height: 34px; }
  .ed-compare { padding: 6px 10px; font-size: 12px; }
}
@media (max-width: 400px) {
  .ed-pair { grid-template-columns: minmax(0, 1fr) 84px; }
  .ed-colctl .link-btn { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ed { animation: none; } body.ed-open #main { transition: none; } }
@media print { .ed { display: none !important; } body.ed-open #main { margin: 0; padding: 0; } }

/* lockup sub-controls and on/off switches (drawn-idea logos) */
.ed-sub { display: grid; gap: 8px; }
.ed-subl { font: 400 11px/1.2 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ed-switch { gap: 8px; }
.ed-sw-dot { width: 26px; height: 14px; border-radius: 7px; background: var(--line-2); position: relative; flex: none; transition: background 0.2s; }
.ed-sw-dot::after { content: ''; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); transition: transform 0.2s var(--ease); }
.ed-switch[aria-pressed="true"] .ed-sw-dot { background: var(--accent); }
.ed-switch[aria-pressed="true"] .ed-sw-dot::after { transform: translateX(12px); }
