/*
 * walk-editor.css — styles for the walk-editor room (app/assets/js/walk-editor.js).
 *
 * Restyled to the Valais+ "All Subjects" editorial brand (see brand.css):
 * white/paper panels, thin Carbon-gray (--g-20) hairlines, IBM Plex Serif/
 * Sans/Mono, crimson (--crimson) as the single accent for primary actions,
 * selection and focus, slate (--slate) for neutral secondary emphasis
 * (callouts). Structure, layout and hit areas are unchanged from the prior
 * dark-glass pass — only colors, fonts, borders, radii and shadows moved.
 *
 * A couple of transient focus washes need an alpha-blended crimson that
 * brand.css doesn't expose as a var() (no --crimson-rgb triplet); those are
 * called out inline as literal rgba(166, 33, 34, x) == var(--crimson) + alpha.
 *
 * #walk-editor is the full-screen room shell; it is hidden by default and
 * shown by toggling the "we-open" class (walk-editor.js does this in
 * ensureDom()/open()/closeEditor()).
 */

#walk-editor {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  color: var(--g-100);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.4;
}
#walk-editor * { box-sizing: border-box; }
#walk-editor.we-open { display: flex; }
#walk-editor svg { max-width: 100%; }

#walk-editor header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--g-20);
  background: var(--g-white);
  flex: none;
  flex-wrap: wrap;
}
#walk-editor header .logo {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 15px;
  color: var(--g-100);
}
#walk-editor .we-seg {
  display: flex; gap: 3px; background: var(--g-10);
  border: 1px solid var(--g-20); border-radius: 4px; padding: 3px;
}
#walk-editor .we-seg button {
  border: 0; background: transparent; color: var(--g-60); font-family: var(--font-sans);
  font-size: 12px; font-weight: 500;
  padding: 6px 14px; border-radius: 3px; cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
#walk-editor .we-seg button.on { background: var(--g-white); color: var(--crimson); box-shadow: 0 1px 2px rgba(22, 22, 22, 0.12); }
#walk-editor .we-seg button[hidden] { display: none; }
#walk-editor header .we-sp { flex: 1; }
#walk-editor .we-stepper { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.4px; color: var(--g-60); }
#walk-editor .we-stepper[hidden] { display: none; }
#walk-editor .we-stepper button {
  border: 1px solid var(--g-20); background: var(--g-10); color: var(--g-100); width: 28px; height: 28px;
  border-radius: 3px; cursor: pointer; font-size: 13px;
}
#walk-editor .we-stepper button:hover { border-color: var(--g-40); }
#walk-editor header .we-ghost { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.3px; color: var(--g-60); }
#walk-editor header .we-ghost[hidden] { display: none; }

#walk-editor .we-view { flex: 1; display: none; min-height: 0; }
#walk-editor .we-view.on { display: flex; }

#walk-editor button.we-btn {
  padding: 7px 13px; border-radius: 3px; border: 1px solid var(--g-30);
  background: var(--g-white); color: var(--g-100); font-family: var(--font-sans);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
#walk-editor button.we-btn:hover { background: var(--g-10); border-color: var(--g-40); }
#walk-editor button.we-btn.sm { padding: 4px 9px; font-size: 11px; border-radius: 3px; }
#walk-editor button.we-btn:disabled { opacity: .4; cursor: default; }
#walk-editor button.we-btn.primary { background: var(--crimson); border-color: var(--crimson); color: var(--g-white); }
#walk-editor button.we-btn.primary:hover { background: var(--crimson-hover); border-color: var(--crimson-hover); }

/* ================= COVER: toolbar | canvas | layers ================= */
#walk-editor #we-vCover.on { display: flex; }
@media (max-aspect-ratio: 1/1) { #walk-editor #we-vCover.on { flex-direction: column; overflow-y: auto; } }
#walk-editor .we-covtools {
  flex: none; display: flex; flex-direction: column; gap: 2px; padding: 12px 8px;
  background: var(--g-white);
  border-right: 1px solid var(--g-20);
}
@media (max-aspect-ratio: 1/1) {
  #walk-editor .we-covtools { flex-direction: row; justify-content: center; border-right: 0; border-bottom: 1px solid var(--g-20); padding: 8px; }
}
#walk-editor .we-covtools button {
  border: 0; background: transparent; color: var(--g-70); opacity: .7; cursor: pointer; border-radius: 3px;
  width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  transition: background-color 120ms ease, opacity 120ms ease;
}
#walk-editor .we-covtools button:hover { background: var(--g-10); opacity: 1; }
#walk-editor .we-covtools button svg {
  width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
#walk-editor .we-covmid { flex: 1; display: flex; align-items: center; justify-content: center; padding: 18px; min-width: 0; }
#walk-editor .we-covstage svg {
  display: block; border-radius: 3px; box-shadow: 0 16px 40px rgba(22, 22, 22, .14), 0 0 0 1px var(--g-20);
  touch-action: none; -webkit-user-select: none; user-select: none;
}
#walk-editor .we-covstage svg text { -webkit-user-select: none; user-select: none; pointer-events: auto; }
#walk-editor .we-covstage svg .we-selbox { fill: none; stroke: #fff; stroke-dasharray: 6 5; stroke-width: 2; pointer-events: none; }

#walk-editor #we-lpanel { flex: none; width: 330px; overflow-y: auto; background: var(--g-white); border-left: 1px solid var(--g-20); padding: 12px; }
@media (max-aspect-ratio: 1/1) { #walk-editor #we-lpanel { width: auto; border-left: 0; border-top: 1px solid var(--g-20); } }
#walk-editor #we-lpanel h4 { font-family: var(--font-mono); font-weight: 500; font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--g-60); margin: 2px 4px 10px; }
#walk-editor .we-lrow { background: var(--g-white); border: 1px solid var(--g-20); border-radius: 6px; margin-bottom: 8px; overflow: hidden; }
#walk-editor .we-lrow.sel { border-color: var(--crimson); }
#walk-editor .we-lhead { display: flex; align-items: center; gap: 8px; padding: 9px 11px; cursor: pointer; }
#walk-editor .we-lhead .nm { flex: 1; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--g-100); }
#walk-editor .we-lhead .mini { display: flex; gap: 2px; }
#walk-editor .we-lhead .mini button {
  border: 0; background: transparent; color: var(--g-60); width: 22px; height: 22px; border-radius: 3px;
  cursor: pointer; font-size: 11px;
}
#walk-editor .we-lhead .mini button:hover { background: var(--g-10); color: var(--g-100); }
#walk-editor .we-lhead svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.7; opacity: .7; flex: none; }
#walk-editor .we-lset { padding: 2px 11px 11px; display: flex; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--g-20); }
@media (max-aspect-ratio: 1/1) { #walk-editor .we-lrow:not(.open) .we-lset { display: none; } }
#walk-editor .we-lset .fld { display: flex; flex-direction: column; }
#walk-editor .we-lset label { font-family: var(--font-mono); font-weight: 500; font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--g-60); margin: 6px 0 3px; }
#walk-editor .we-lset input[type=text] {
  background: var(--g-10); border: none; border-bottom: 1px solid var(--g-50); border-radius: 0; color: var(--g-100);
  padding: 5px 8px; font-family: var(--font-sans); font-size: 12px; width: 100%;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
#walk-editor .we-lset textarea {
  background: var(--g-10); border: none; border-bottom: 1px solid var(--g-50); border-radius: 0; color: var(--g-100);
  padding: 5px 8px; font-size: 12px; width: 100%; min-width: 220px; resize: vertical;
  font-family: inherit; white-space: pre-wrap;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
#walk-editor .we-lset input[type=text]:focus,
#walk-editor .we-lset textarea:focus {
  outline: none; border-bottom-color: var(--crimson); box-shadow: 0 1px 0 0 var(--crimson);
}
#walk-editor .we-lset input[type=range] { width: 120px; accent-color: var(--crimson); }
#walk-editor .we-lset input[type=color] { width: 30px; height: 24px; border: 0; background: none; padding: 0; cursor: pointer; }
#walk-editor .we-lset select {
  background: var(--g-10); border: none; border-bottom: 1px solid var(--g-50); border-radius: 0; color: var(--g-100);
  padding: 5px 8px; font-family: var(--font-sans); font-size: 12px; max-width: 130px;
}
#walk-editor .we-lset select:focus { outline: none; border-bottom-color: var(--crimson); }
#walk-editor .we-tgl { display: flex; gap: 4px; }
#walk-editor .we-tgl button {
  border: 1px solid var(--g-30); background: var(--g-white); color: var(--g-60); font-size: 12px;
  width: 30px; height: 26px; border-radius: 3px; cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
/* a lone toggle (e.g. the wrap toggle "↵ An"/"↵ Aus") needs a wider label
   than the fixed 30px square used for a same-row pair like bold/italic */
#walk-editor .we-tgl button:only-child { width: auto; padding: 0 10px; }
#walk-editor .we-tgl button.on { background: var(--crimson-soft); border-color: var(--crimson); color: var(--crimson); }
#walk-editor .we-segm { display: flex; background: var(--g-10); border: 1px solid var(--g-20); border-radius: 4px; padding: 2px; }
#walk-editor .we-segm button { border: 0; background: transparent; color: var(--g-60); font-size: 11px; padding: 4px 10px; border-radius: 3px; cursor: pointer; }
#walk-editor .we-segm button.on { background: var(--g-white); color: var(--crimson); }

/* ================= CONTENT ================= */
#walk-editor #we-vContent.on { display: flex; flex-direction: column; align-items: center; overflow: hidden; }
#walk-editor .we-phbar { flex: none; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 10px 14px 0; max-width: 760px; }
#walk-editor .we-phbar .lbl { font-family: var(--font-mono); font-size: 10px; color: var(--g-60); align-self: center; letter-spacing: .1em; text-transform: uppercase; margin-right: 2px; }
#walk-editor .we-phbar .we-note { font-family: var(--font-mono); font-size: 10px; color: var(--g-50); align-self: center; }
#walk-editor .we-phc {
  font-family: var(--font-sans); font-size: 11.5px; padding: 4px 10px; border-radius: 3px; border: 1px dashed var(--crimson);
  color: var(--crimson); cursor: pointer; background: var(--crimson-soft);
  transition: background-color 120ms ease, color 120ms ease;
}
#walk-editor .we-phc:hover { background: var(--crimson); color: var(--g-white); border-style: solid; }
#walk-editor .we-pagewrap { flex: 1; overflow-y: auto; width: 100%; display: flex; justify-content: center; padding: 12px 14px 40px; }
#walk-editor .we-page {
  width: min(100%, 720px); background: var(--g-white); border: 1px solid var(--g-20); border-radius: 6px;
  padding: 24px 26px 60px; user-select: text; height: max-content;
}
#walk-editor .we-phx {
  display: inline-block; background: var(--crimson-soft); border-bottom: 1.5px solid var(--crimson);
  border-radius: 3px; padding: 0 4px; font-size: .92em; white-space: nowrap;
}
#walk-editor .we-blk { position: relative; border-radius: 6px; padding: 2px 6px; margin: 0 -6px; }
#walk-editor .we-blk:hover { background: var(--g-10); }
#walk-editor .we-blk .we-bbar { position: absolute; top: 2px; right: 2px; display: none; gap: 3px; z-index: 3; }
#walk-editor .we-blk:hover .we-bbar { display: flex; }
#walk-editor .we-bbar button {
  border: 1px solid var(--g-30); background: var(--g-white); color: var(--g-70); font-size: 11px;
  width: 24px; height: 24px; border-radius: 3px; cursor: pointer; opacity: .85;
}
#walk-editor .we-bbar button:hover { opacity: 1; border-color: var(--g-50); }
#walk-editor [data-slot] { outline: none; border-radius: 2px; }
#walk-editor [data-slot]:focus { background: rgba(166, 33, 34, 0.06); /* crimson wash */ }
#walk-editor [data-slot]:empty::before { content: attr(data-ph); color: var(--g-50); }
#walk-editor .we-blk h1 { font-family: var(--font-serif); font-weight: 400; font-size: 25px; line-height: 1.2; margin: 10px 0 4px; }
#walk-editor .we-blk h2 { font-family: var(--font-serif); font-weight: 400; font-size: 18px; margin: 12px 0 4px; }
#walk-editor .we-blk .lead { font-family: var(--font-serif); font-style: italic; font-size: 16px; color: var(--g-70); line-height: 1.55; margin: 2px 0 8px; }
#walk-editor .we-blk p { font-family: var(--font-sans); font-size: 14.5px; line-height: 1.65; margin: 4px 0 8px; }
#walk-editor .we-blk blockquote { border-left: 3px solid var(--crimson); padding: 4px 0 4px 14px; margin: 8px 0; }
#walk-editor .we-blk blockquote p { font-family: var(--font-serif); font-size: 16px; font-style: italic; margin: 0; }
#walk-editor .we-blk blockquote footer { font-family: var(--font-mono); font-size: 11.5px; color: var(--g-60); margin-top: 4px; }
#walk-editor .we-blk ul { margin: 4px 0 8px 20px; font-family: var(--font-sans); font-size: 14.5px; line-height: 1.7; }
#walk-editor .we-blk .imgbox {
  position: relative; border-radius: 6px; overflow: hidden; background: var(--g-10); margin: 8px 0 4px;
  min-height: 110px; display: flex; align-items: center; justify-content: center; cursor: pointer;
  border: 1px solid var(--g-20);
}
#walk-editor .we-blk .imgbox img { display: block; width: 100%; }
#walk-editor .we-blk .imgbox .ph { color: var(--g-60); font-family: var(--font-mono); font-size: 12px; padding: 30px; }
#walk-editor .we-blk .cap { font-family: var(--font-mono); font-size: 11.5px; color: var(--g-60); margin: 2px 0 8px; }
#walk-editor .we-blk .cols { display: flex; gap: 14px; align-items: flex-start; margin: 8px 0; }
#walk-editor .we-blk .cols .imgbox { flex: 0 0 42%; margin: 0; }
#walk-editor .we-blk .cols .tx { flex: 1; }
#walk-editor .we-blk.rev .cols { flex-direction: row-reverse; }
#walk-editor .we-blk .info {
  background: var(--slate-soft); border: 1px solid var(--slate); border-radius: 6px;
  padding: 12px 14px; margin: 8px 0;
}
#walk-editor .we-blk .info b { display: block; font-family: var(--font-sans); font-size: 12.5px; margin-bottom: 3px; color: var(--slate); }
#walk-editor .we-blk .info p { margin: 0; font-family: var(--font-sans); font-size: 13px; }
#walk-editor .we-blk .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
#walk-editor .we-blk .facts .f { background: var(--g-10); border: 1px solid var(--g-20); border-radius: 4px; padding: 9px 12px; }
#walk-editor .we-blk .facts .k { font-family: var(--font-mono); font-size: 9px; letter-spacing: .13em; text-transform: uppercase; color: var(--g-60); margin-bottom: 2px; }
#walk-editor .we-blk .facts .v { font-family: var(--font-sans); font-size: 14px; font-weight: 700; color: var(--g-100); }
#walk-editor .we-blk .gal { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
#walk-editor .we-blk .gal .imgbox { margin: 0; min-height: 90px; }
#walk-editor .we-blk hr { border: 0; border-top: 1px solid var(--g-20); margin: 16px 0; }
#walk-editor .we-blk .lcard {
  display: block; background: var(--g-10); border: 1px solid var(--g-20); border-radius: 6px;
  padding: 12px 14px; margin: 8px 0; color: var(--g-100);
}
#walk-editor .we-blk .lcard .t { font-family: var(--font-sans); font-weight: 700; font-size: 14px; display: block; }
#walk-editor .we-blk .lcard .u { font-family: var(--font-mono); font-size: 11px; color: var(--crimson); margin-top: 2px; display: block; }
#walk-editor .we-adder { display: flex; justify-content: center; padding: 10px 0 2px; }
#walk-editor .we-adder button {
  border: 1px dashed var(--g-40); background: transparent; color: var(--g-60); font-family: var(--font-sans);
  border-radius: 4px; padding: 7px 18px; font-size: 12px; cursor: pointer;
}
#walk-editor .we-adder button:hover { color: var(--g-100); border-color: var(--crimson); }

#walk-editor #we-pal {
  position: fixed; inset: 0; z-index: 50; display: none; background: rgba(22, 22, 22, .4); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 18px;
}
#walk-editor #we-pal.on { display: flex; }
#walk-editor #we-palcard {
  background: var(--g-white); border: 1px solid var(--g-20); border-radius: 8px; padding: 18px;
  width: min(94vw, 640px); max-height: 88dvh; overflow-y: auto;
  box-shadow: 0 24px 70px rgba(22, 22, 22, .22);
}
#walk-editor #we-palcard h4 { font-family: var(--font-mono); font-weight: 500; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--g-60); margin: 6px 0 10px; }
#walk-editor .we-palgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
#walk-editor .we-palit { background: var(--g-10); border: 1px solid var(--g-20); border-radius: 6px; padding: 12px; cursor: pointer; text-align: center; }
#walk-editor .we-palit:hover { border-color: var(--crimson); }
#walk-editor .we-palit .ic { font-size: 20px; margin-bottom: 6px; opacity: .85; }
#walk-editor .we-palit .nm { font-family: var(--font-sans); font-size: 12px; font-weight: 600; color: var(--g-100); }
#walk-editor .we-palit .ds { font-family: var(--font-sans); font-size: 10px; color: var(--g-60); margin-top: 2px; line-height: 1.4; }

/* ================= TABLE ================= */
#walk-editor #we-vTable.on { display: flex; flex-direction: column; padding: 14px; }
#walk-editor .we-tbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; flex: none; }
#walk-editor .we-tbar .grow { flex: 1; font-family: var(--font-sans); font-size: 13px; font-weight: 700; color: var(--g-100); }
#walk-editor .we-tblwrap { flex: 1; overflow: auto; background: var(--g-white); border: 1px solid var(--g-20); border-radius: 6px; user-select: text; }
#walk-editor table.we-grid { border-collapse: collapse; min-width: 100%; font-family: var(--font-sans); font-size: 13px; }
#walk-editor .we-grid th {
  position: sticky; top: 0; z-index: 2; background: var(--g-10); padding: 0; text-align: left;
  border-bottom: 1px solid var(--g-20); white-space: nowrap;
}
#walk-editor .we-grid th .h {
  display: flex; align-items: center; gap: 5px; padding: 8px 10px; cursor: pointer;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--g-60); font-weight: 500;
}
#walk-editor .we-grid th .h:hover { color: var(--g-100); }
#walk-editor .we-grid td { border-bottom: 1px solid var(--g-20); padding: 0; vertical-align: top; }
#walk-editor .we-grid td .cell { padding: 7px 10px; min-width: 90px; outline: none; min-height: 1.2em; color: var(--g-100); }
#walk-editor .we-grid td .cell:focus { background: var(--crimson-soft); }
#walk-editor .we-grid tr.sel td { background: var(--slate-soft); }
#walk-editor .we-grid td.rowh { width: 34px; text-align: center; color: var(--g-60); font-size: 10px; cursor: pointer; }
#walk-editor .we-grid td.rowh:hover { color: var(--crimson); }
#walk-editor .we-hmenu {
  position: fixed; z-index: 55; background: var(--g-white); border: 1px solid var(--g-20); border-radius: 6px;
  padding: 5px; display: none; flex-direction: column; box-shadow: 0 14px 36px rgba(22, 22, 22, .18);
}
#walk-editor .we-hmenu.on { display: flex; }
#walk-editor .we-hmenu button {
  border: 0; background: transparent; color: var(--g-100); font-family: var(--font-sans); text-align: left; font-size: 12.5px;
  padding: 7px 12px; border-radius: 3px; cursor: pointer; white-space: nowrap;
}
#walk-editor .we-hmenu button:hover { background: var(--g-10); }

#walk-editor #we-toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(16px); z-index: 60;
  background: var(--g-100); border: 1px solid var(--g-70); border-radius: 4px;
  color: var(--paper); font-family: var(--font-sans);
  padding: 9px 15px; font-size: 12.5px; opacity: 0; transition: all .3s; pointer-events: none;
}
#walk-editor #we-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
