/* THE EDIT ROOM -- the tool strip down the viewer's left edge and the panel
   that slides out on its right (js/edit-view.js). Simon, 4 Nov 2026: "On the
   viewer itself, on the left-hand side, it should have the icons for all of
   the different modes ... it will have a panel on the right-hand side that
   can slide out".

   Everything is under html.ev-on, which js/edit-view.js puts on <html> when
   the rail's Edit is pressed and takes off when it is left; the grid itself
   is not touched here -- the Window-menu sections keep a set for this room
   (the make column down) and js/panelarrange.js computes the template. Both
   pieces live INSIDE #nle-viewer, and the viewer gives them room with its
   own padding, so the picture and the transport shrink beside them rather
   than sitting under them. */

/* No timeline in After Effects, so no Edit room there. */
html:not(.desktop) .rail-btn[data-view="edit"] { display: none; }

/* THE EDIT ROOM IS THE OWNER'S, FOR NOW (Simon, 6 Nov 2026, 08:07: "Hide the
   master edit view ... just me in admin view for now" -- js/edit-view.js
   EDIT_ROOM_ADMIN_ONLY). Out of the rail's layout from the first paint until
   edit-view.js says the room is open to whoever this is (html.ev-ok: the
   owner in Admin view, or everybody once the flag is off). While it is his
   alone it carries a small amber dot, so he knows nobody else sees it. */
html:not(.ev-ok) .rail-btn[data-view="edit"] { display: none !important; }
html.ev-admin-only .rail-btn[data-view="edit"] { position: relative; }
html.ev-admin-only .rail-btn[data-view="edit"]::after {
  content: ""; position: absolute; top: 4px; right: 7px; width: 5px; height: 5px; border-radius: 50%;
  background: #f5a524; box-shadow: 0 0 0 1.5px var(--bg, #08080a); pointer-events: none;
}

#ev-strip, #ev-panel { display: none; }

/* (TOOL NAMES HOVER) the strip always takes 46px; the names open OVER the viewer (#ev-strip.ev-peek, below), so the
   viewer never gives them room. RECORDED REVERSAL: html.ev-names widened it to 168px (the Show names toggle). */
html.ev-on { --ev-strip-w: 46px; --ev-peek-w: 184px; }   /* (TOOL NAMES HOVER) */

/* THE PANEL IS ALWAYS THERE (Simon, 4 Nov 2026, 15:05: "the panel on the
   right-hand side is always there, and as we change the mode, it's just
   changing the view on the right-hand side. At the moment, it flickers"):
   the viewer gives the panel its width for as long as the room is up, with
   no transition -- nothing here moves when a tool is picked. RECORDED
   REVERSAL: the width was given (and slid) only while a tool was open. */
html.desktop.nle-on.ev-on #nle-viewer {
  position: relative;
  overflow: hidden;
  padding-left: var(--ev-strip-w);
  padding-right: var(--ev-panel-w, 440px);
}
html.ev-dragging #nle-viewer, html.ev-dragging #ev-panel, html.ev-dragging #gallery-pane { transition: none !important; }
html.ev-dragging, html.ev-dragging * { cursor: col-resize !important; user-select: none !important; }

/* ---------- the strip ---------- */
html.desktop.nle-on.ev-on #ev-strip {
  display: flex; flex-direction: column;
  position: absolute; left: 0; top: 19px; bottom: 0; width: var(--ev-strip-w);
  box-sizing: border-box; z-index: 3;
  /* (TOOL NAMES HOVER) the strip's own box is see-through: the rail is drawn by ::before (always 46px) and the names'
     panel by ::after (the strip's full width while it peeks), so the panel can fade and slide on its own. */
  background: transparent; isolation: isolate;
  transition: width 0s linear .22s, z-index 0s linear .22s;   /* (TOOL NAMES HOVER) narrows once the names have faded back */
}
/* ---------- (TOOL NAMES HOVER) THE NAMES OPEN ON HOVER AND FOCUS (Simon, 15 Nov 2026 11:04) ----------
   js/edit-view.js puts .ev-peek on the strip while the pointer is in it or a tool has keyboard focus. The strip widens
   (it is absolute: nothing beside it moves), then after a short wait -- passing over it does not flash -- the dark
   panel and every name fade in and slide out from the rail; leaving fades and slides them back, a touch quicker.
   RECORDED REVERSAL: the Show names / Hide names button at the top of the strip (.ev-fold, EDIT ROOM V2). */
html.desktop.nle-on.ev-on #ev-strip::before,
html.desktop.nle-on.ev-on #ev-strip::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; z-index: -1; pointer-events: none; box-sizing: border-box;
  background: var(--ev-rail-bg, var(--card)); border-right: 1px solid var(--ev-rail-line, var(--border));
}
html.desktop.nle-on.ev-on #ev-strip::before { width: var(--ev-strip-w); }
html.desktop.nle-on.ev-on #ev-strip::after {
  right: 0; opacity: 0; transform: translateX(-14px);
  transition: opacity .14s ease-out .08s, transform .14s ease-out .08s;
}
/* (TOOL NAMES HOVER) while it peeks the strip stands over the viewer's own bars too: the mode bar (#nle-vmode, z 60) and
   the Edit tool's head seated in the viewer (#cvmod.ev-inviewer, fixed, z 196) -- still under every modal. */
html.desktop.nle-on.ev-on #ev-strip.ev-peek { width: var(--ev-peek-w); z-index: 197; transition: width 0s linear .12s, z-index 0s linear 0s; }
html.desktop.nle-on.ev-on #ev-strip.ev-peek::after {
  opacity: 1; transform: none; box-shadow: 8px 0 24px rgba(0,0,0,.45);
  transition: opacity .16s ease-out .12s, transform .16s ease-out .12s;
}
@media (prefers-reduced-motion: reduce) {   /* (TOOL NAMES HOVER) fade only, no slide */
  html.desktop.nle-on.ev-on #ev-strip::after,
  html.desktop.nle-on.ev-on #ev-strip .ev-tool .ev-name { transform: none !important; transition-property: opacity !important; }
}
#ev-strip .ev-tools {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 1px; padding: 4px 5px 10px;
  scrollbar-width: none;
}
#ev-strip .ev-tools::-webkit-scrollbar { width: 0; }
#ev-strip .ev-tool {
  flex: none; display: flex; align-items: center; gap: 9px;
  height: 32px; padding: 0 7px; box-sizing: border-box;
  border: 1px solid transparent; border-radius: 6px; background: none;
  color: var(--text); cursor: pointer; text-align: left;
}
#ev-strip .ev-tool .ev-ico {
  flex: none; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  color: var(--tkhue, var(--text));
}
#ev-strip .ev-tool .ev-ico svg { width: 18px; height: 18px; }
#ev-strip .ev-tool .ev-name {
  display: block; min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  /* (TOOL NAMES HOVER) always laid out, hidden by opacity (and clipped by the 46px strip) until the strip peeks */
  opacity: 0; transform: translateX(-8px);
  transition: opacity .14s ease-out .08s, transform .14s ease-out .08s;
}
#ev-strip.ev-peek .ev-tool .ev-name {   /* (TOOL NAMES HOVER) */
  opacity: 1; transform: none;
  transition: opacity .16s ease-out .12s, transform .16s ease-out .12s;
}
#ev-strip .ev-tool:hover { background: var(--card-hover, rgba(255,255,255,.05)); }
#ev-strip .ev-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* The tool that is open: its own tint and its own colour, the way its tile is
   lit in Create's list. */
#ev-strip .ev-tool.on { background: var(--tktint, rgba(255,255,255,.08)); border-color: var(--tkhue, var(--accent)); }
#ev-strip .ev-sep { flex: none; height: 1px; margin: 4px 3px; background: var(--border); }

/* ---------- the panel ---------- */
/* Placed by js/edit-view.js placePanel (top/left/width/height off the
   viewer's box, and down the gallery when that is the cell under it); above
   the panels and their seams' grid, under every menu, drawer and modal. */
html.desktop.nle-on.ev-on #ev-panel {
  display: flex; flex-direction: column;
  position: fixed; box-sizing: border-box; z-index: var(--z-sticky, 40);
  background: var(--bg); border-left: 1px solid var(--border);
}
/* The gallery under the viewer gives up the same width while the panel runs
   down it, and the seam between the two stops short of the panel. */
html.desktop.nle-on.ev-on.ev-span #gallery-pane { padding-right: var(--ev-panel-w, 440px); }
html.desktop.nle-on.ev-on.ev-span #nle-grip-gal { clip-path: inset(0 var(--ev-panel-w, 440px) 0 0); }
#ev-panel .ev-grip {
  position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; z-index: 6; cursor: col-resize;
}
#ev-panel .ev-grip:hover, html.ev-dragging #ev-panel .ev-grip { background: var(--accent); opacity: .7; }
#ev-panel .ev-head {
  flex: none; display: flex; flex-direction: column; gap: 6px;
  padding: 8px 10px; background: var(--card); border-bottom: 1px solid var(--border);
}
#ev-panel .ev-hrow { display: flex; align-items: center; gap: 8px; min-width: 0; }
#ev-panel .ev-hico {
  flex: none; width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tktint, rgba(255,255,255,.08)); color: var(--tkhue, var(--text));
}
#ev-panel .ev-hico svg { width: 16px; height: 16px; }
#ev-panel .ev-htxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
#ev-panel .ev-htxt b { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ev-panel .ev-src { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ev-panel .ev-hbtns { gap: 6px; }
#ev-panel .ev-hbtns:not(:has(.ev-hbtn:not(.hidden))) { display: none; }
#ev-panel .ev-hbtn {
  flex: none; padding: 4px 9px; font-size: 11px; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--border); border-radius: 5px; background: none; color: var(--text);
}
#ev-panel .ev-hbtn:hover { border-color: var(--accent); color: var(--accent); }
#ev-panel .ev-hbtn.hidden { display: none; }
/* (no x on the panel any more -- THE PANEL IS ALWAYS THERE) */
html.ev-pempty #ev-panel .ev-hico { display: none; }
#ev-panel .ev-msg {
  display: none; flex: none; padding: 6px 12px; font-size: 11px; line-height: 1.4;
  color: var(--text); background: rgba(var(--accent-rgb, 230, 30, 90), .08); border-bottom: 1px solid var(--border);
}
#ev-panel .ev-msg.on { display: block; }
#ev-panel .ev-msg.bad { color: #ff9a9a; }
#ev-panel .ev-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }

/* CREATE'S PANE, LENT. The whole pane comes in (its controls are wired
   through it), and the parts the strip already stands for -- the shots, the
   tile list and their seams -- are put out of sight, with the title clip:
   the panel's head names the tool. */
#ev-body > #smmod {
  flex: 1 1 auto; width: auto !important; min-width: 0 !important; min-height: 0 !important;
  max-width: none; order: 0; margin: 0 !important;
}
#ev-body > #smmod.tasks-only { display: none !important; }
#ev-body #sm-shots, #ev-body #sm-shots-rz, #ev-body #sm-tasks, #ev-body #sm-tasks-rz,
#ev-body #sm-hero, #ev-body #sm-hero-classic { display: none !important; }
#ev-body #sm-main { flex: 1 1 auto; min-width: 0; max-width: none; }
#ev-body > #main {
  flex: 1 1 auto; min-height: 0; min-width: 0; width: auto; max-width: none;
  overflow-y: auto; overflow-x: hidden; padding: 10px 12px 24px; box-sizing: border-box;
}

/* ---------- results ---------- */
#ev-panel .ev-results {
  flex: none; max-height: 38%; overflow-y: auto;
  padding: 8px 10px; background: var(--card); border-top: 1px solid var(--border);
}
#ev-panel .ev-results.hidden { display: none; }
#ev-panel .ev-rh { margin: 0 0 6px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
#ev-panel .ev-rh span { margin-left: 6px; font-weight: 400; letter-spacing: 0; text-transform: none; }
#ev-panel .ev-r { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
#ev-panel .ev-rth { flex: none; width: 64px; height: 36px; border-radius: 4px; overflow: hidden; background: #000; cursor: pointer; }
#ev-panel .ev-rth img, #ev-panel .ev-rth video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
#ev-panel .ev-rn { flex: 1; min-width: 0; font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ev-panel .ev-put { flex: none; padding: 4px 9px; font-size: 11px; }

/* ---------- Mask ---------- */
#ev-panel .ev-mask { padding: 12px; overflow-y: auto; }
#ev-panel .ev-note { margin: 0 0 10px; font-size: 12px; line-height: 1.45; color: var(--text-faint); }
#ev-panel .ev-note b { color: var(--text); font-weight: 600; }
#ev-panel .ev-mrow { display: flex; gap: 8px; margin-bottom: 14px; }
#ev-panel .ev-mi { margin-bottom: 4px; padding: 6px 8px; font-size: 12px; border: 1px solid var(--border); border-radius: 5px; }
#ev-panel .ev-mi.ev-none { color: var(--text-faint); border-style: dashed; }

/* ---------- nothing picked ----------
   The panel's calm empty state (js/edit-view.js paintEmpty), and the same
   card under the viewer's crop column while it has nothing to list yet. */
#ev-panel .ev-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px 28px; text-align: center; color: var(--text-faint);
}
#ev-panel .ev-empty b { font-size: 13px; font-weight: 600; color: var(--text); }
#ev-panel .ev-empty span { max-width: 300px; font-size: 12px; line-height: 1.5; }
#ev-panel .ev-empty .ev-eico {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); color: var(--text-faint);
}
#ev-panel .ev-empty .ev-eico svg { width: 16px; height: 16px; }
