/* Rampy's own pieces only: the 3D canvas, the photo box, the ramp view and
   the drop veil. Everything else comes from kit.css. */

/* The two panes: one fills the view, or both share it in Split. */
#rockpane, #photopane { position:absolute; inset:0; overflow:hidden; }
#rockpane[hidden], #photopane[hidden] { display:none; }

#gl, #photo {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  display:block;
  touch-action:none;
  outline:none;
}

#srcbox {
  position:relative;
  height:120px;
  margin:10px 0 8px;
  border:1px dashed var(--line);
  border-radius:3px;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--ink);
}
#srcbox.has { border-style:solid; }
#srcbox.over { border-color:var(--accent); }
#srcthumb { width:100%; height:100%; display:block; }
#srcempty {
  font-size:10px;
  color:var(--dim);
  text-align:center;
  line-height:1.7;
}

#rampview {
  display:block;
  width:100%;
  height:78px;
  margin:10px 0 8px;
  border-radius:3px;
  background:var(--ink);
  image-rendering:pixelated;
}

.selrow { align-items:center; }
.selrow select { max-width:62%; }

#chanrow { margin-top:6px; }

#dropveil {
  position:absolute;
  inset:12px;
  z-index:5;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px dashed var(--accent);
  border-radius:6px;
  background:color-mix(in srgb, var(--ink) 70%, transparent);
  color:var(--accent);
  pointer-events:none;
}
#dropveil[hidden] { display:none; }

#uetext p { margin:0 0 8px; }
#uetext code { color:var(--text); }

@media (pointer: coarse) {
  #srcbox { height:110px; }
}

.needsphoto { opacity:.45; }

#photo { cursor:cell; }

/* The photo view's tools: above the photo, under the notice. */
#viewbar {
  position:absolute;
  top:46px;
  left:50%;
  transform:translateX(-50%);
  z-index:4;
  display:flex;
  gap:10px;
  padding:4px;
  border:1px solid var(--line);
  border-radius:6px;
  background:#14181de6;
  width:max-content;
  max-width:calc(100% - 16px);
}
#viewbar[hidden] { display:none; }
#viewbar .btnrow { margin:0; gap:4px; }
#viewbar button { width:auto; margin:0; padding:5px 10px; text-align:center; white-space:nowrap; }
/* On a phone in portrait the bar sits just above the view buttons. */
html.sheet #viewbar { top:auto; bottom:calc(var(--sheet-h, 50vh) + 60px); gap:6px; }
html.sheet #viewbar button { padding:5px 8px; }
html.sheet[data-sheet=full] #viewbar { display:none; }
@media (pointer: coarse) { #viewbar button { min-height:36px; } }

.moderow { margin-top:4px; }
.moderow + .moderow { margin-top:0; }

/* Library rows use the kit's layer folds; this is their kind colour. */
.layer.k-ramp { --k:#e3c88a; --kw:rgba(227, 200, 138, .06); }
#liblist .libmini { flex:none; width:56px; height:10px; border-radius:2px; image-rendering:pixelated; }
#liblist .libstrip { display:block; width:100%; height:22px; margin:9px 0 4px; border-radius:2px; image-rendering:pixelated; }
#liblist .layer .btnrow { margin-top:6px; }
#liblist:empty { display:none; }

/* Split: the divider between the photo (above) and the rock (below). */
#splitbar {
  position:absolute;
  left:0; right:0;
  height:11px;
  margin-top:-5px;
  z-index:5;
  cursor:row-resize;
  touch-action:none;
  display:flex;
  align-items:center;
  justify-content:center;
}
#splitbar[hidden] { display:none; }
#splitbar::before { content:""; position:absolute; left:0; right:0; top:5px; height:1px; background:var(--line); }
#splitbar span { position:relative; width:36px; height:5px; border-radius:3px; background:var(--line); }
#splitbar:hover::before, #splitbar.dragging::before { background:var(--accent); }
#splitbar:hover span, #splitbar.dragging span { background:var(--accent); }
@media (pointer: coarse) { #splitbar { height:25px; margin-top:-12px; } #splitbar::before { top:12px; } #splitbar span { width:44px; height:6px; } }
#view.split #viewbar { top:auto; bottom:8px; }
html.sheet #view.split #viewbar { bottom:8px; }
#splitbar.vertical { top:0; bottom:0; height:auto; width:11px; margin:0 0 0 -5px; cursor:col-resize; flex-direction:column; }
#splitbar.vertical::before { left:5px; right:auto; top:0; bottom:0; width:1px; height:auto; }
#splitbar.vertical span { width:5px; height:36px; }
@media (pointer: coarse) {
  #splitbar.vertical { width:25px; margin:0 0 0 -12px; }
  #splitbar.vertical::before { left:12px; top:0; }
  #splitbar.vertical span { width:6px; height:44px; }
}

#masksrc optgroup { background:var(--panel); color:var(--dim); font-style:normal; }

/* The start message, until a photo or a rock arrives (as Palettize does). */
/* Docked at the top of the view, under the notice; the rock is framed in
   the space below it (main.js sets the 3D view's top inset). */
#welcome {
  position:absolute;
  left:50%; top:52px;
  transform:translateX(-50%);
  z-index:3;
  width:max-content;
  max-width:calc(100% - 32px);
  padding:16px 22px;
  border-radius:6px;
  background:#0d1013c7;
  color:var(--dim);
  font-size:12px;
  line-height:1.9;
  text-align:center;
  pointer-events:none;
}
#welcome[hidden] { display:none; }
#welcome p { margin:0 0 12px; }
#welcome p:last-child { margin-bottom:0; }
#welcome p:first-child { color:var(--text); }
#welcome b { color:var(--accent); font-weight:600; }
/* On a phone, below the row of top chrome the kit starts at --sheet-top. */
html.sheet #welcome { top:calc(var(--sheet-top) + 42px); font-size:11px; line-height:1.7; padding:12px 16px; }
/* In Split it sits in the photo pane, above that pane's tool bar. */
#view.split #welcome { top:calc((var(--photo-h, 50%) - 52px) / 2); transform:translate(-50%, -50%); }
html.sheet #welcome br { display:none; }
/* A sheet this short means the keyboard is open (kit 1.4 keeps the sheet
   then): no room for the message, and no need while typing. */
@media (max-height: 480px) { html.sheet #welcome { display:none; } }
/* On a touch screen there's nothing to drag: the paragraph about dragging
   goes, so the rock keeps room under the message. */
@media (pointer: coarse) { #welcome p:nth-child(2) { display:none; } }
/* A phone held sideways: smaller, higher. */
html.compact:not(.sheet) #welcome { top:54px; padding:10px 16px; font-size:11px; line-height:1.6; }
html.compact:not(.sheet) #welcome br { display:none; }
/* Side by side, it sits in the photo pane, the left one. */
#view.split.side #welcome { left:calc(var(--photo-w, 50%) / 2); top:calc((100% - 120px) / 2); max-width:calc(var(--photo-w, 50%) - 24px); width:auto; }

/* Which pane is which, in Split. */
.panelabel { display:none; position:absolute; top:12px; right:12px; z-index:2; font-size:10px; letter-spacing:.16em; text-transform:uppercase; color:var(--dim); pointer-events:none; }
#view.split .panelabel { display:block; }
#view.split #photopane .panelabel { top:auto; bottom:14px; left:12px; right:auto; }

/* When the 3D view can't draw, it says why. */
#rockmsg { position:absolute; left:50%; top:50%; transform:translate(-50%, -50%); z-index:2; max-width:min(520px, calc(100% - 32px)); padding:12px 16px; border:1px solid var(--line); border-radius:6px; background:var(--panel); color:var(--warn); font-size:11px; line-height:1.6; white-space:pre-wrap; }
#rockmsg[hidden] { display:none; }

/* The view buttons sit in a strip along the bottom of the view, in every
   view (the kit's phone strip, on every screen). The phone sheet's own
   rules still place it above the sheet. */
html:not(.sheet) #view > #toolcol {
  position:absolute;
  left:50%;
  bottom:12px;
  transform:translateX(-50%);
  z-index:6;
  flex-direction:row;
  align-items:center;
  width:auto;
  max-width:calc(100% - 16px);
  overflow-x:auto;
  gap:2px;
  padding:3px 4px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#14181de6;
}
html:not(.sheet) #view > #toolcol button { width:30px; height:30px; margin:0; flex:none; }
html:not(.sheet) #view > #toolcol button svg { width:17px; height:17px; }
html:not(.sheet) #view > #toolcol .ctlsep { width:1px; height:20px; margin:0 3px; border:none; background:var(--line); flex:none; }
@media (pointer: coarse) {
  html:not(.sheet) #view > #toolcol button { width:38px; height:38px; }
  html:not(.sheet) #view > #toolcol button svg { width:20px; height:20px; }
}
/* Side by side, the view strip runs along the bottom across both panes;
   the photo's own bar moves up out of its way. */
#view.split.side #viewbar { bottom:64px; }

/* The export folder or file name: shrinks with an ellipsis rather than
   widening the rail; the full name is in its tooltip. */
#folderrow { gap:8px; }
#folderrow label { flex:none; }
#folderrow output { flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:right; }

/* Presets: a family label, then one ramp strip per preset. */
#presetfold { margin:12px 0 14px; }
#presetlist .famlabel { margin:10px 0 4px; font-size:10px; letter-spacing:.16em; text-transform:uppercase; color:var(--dim); }
#presetlist .presetbtn { display:flex; align-items:center; gap:8px; padding:3px 6px 3px 8px; margin:0 0 3px; }
#presetlist .presetbtn span { flex:none; width:18px; font-size:10px; color:var(--dim); font-variant-numeric:tabular-nums; }
#presetlist .presetbtn canvas { flex:1 1 auto; min-width:0; height:12px; border-radius:2px; image-rendering:pixelated; }
#presetlist .presetbtn[aria-pressed=true] { background:var(--raise); border-color:var(--accent); }
#presetlist .presetbtn[aria-pressed=true] span { color:var(--accent); font-weight:600; }

/* Inserts: accents and partial ramps, as layers. */
.layer.k-accent { --k:#e8a49b; --kw:rgba(232, 164, 155, .06); }
.layer.k-part { --k:#9db4e8; --kw:rgba(157, 180, 232, .06); }
.layer.k-scatter { --k:#c9a8d4; --kw:rgba(201, 168, 212, .06); }
#insertadd { flex-wrap:wrap; }
.inschip { display:inline-block; width:9px; height:9px; border-radius:2px; margin-right:6px; vertical-align:-1px; box-shadow:0 0 0 1px var(--line); }
.insbody { padding:2px 0 4px; }
.insbody .row select { flex:1; min-width:0; margin-left:8px; }
canvas.insstrip { display:block; width:100%; height:14px; border-radius:2px; margin:2px 0 8px; }
#insertadd { margin:6px 0 8px; }
#rampview { touch-action:pan-y; }
