/* Layout (16 Nov 2026): collapsible and resizable columns (library, centre, panel) and rows (deck, main).
   js/layout.js sets .app grid-template-rows and .body grid-template-columns inline; this file places the handles and
   bars and draws the collapsed states. Phones (760px and under) keep the stacked layout: everything here is hidden. */

/* ---------- desktop and tablet ---------- */
@media (min-width:761px){
  .app{grid-template-rows:60px 150px 1fr;transition:grid-template-rows .15s ease}
  .app>*{grid-column:1}.app>.top{grid-row:1}.app>.strip{grid-row:2}.app>.body,.app>.rowbar,.app>.mainbar{grid-row:3}
  .body{transition:grid-template-columns .15s ease}
  .body>.nav{grid-column:1;grid-row:1}.body>.centre,.body>.cbar{grid-column:2;grid-row:1}.body>.insp{grid-column:3;grid-row:1}.body>.irail{grid-column:4;grid-row:1}
  .body[hidden],.centre[hidden],.insp[hidden],.cbar[hidden],.mainbar[hidden],.rowbar[hidden]{display:none!important}

  /* deck row: its height comes from the row; the tempo column (BPM, Confidence, Edit points) is only as wide as its
     content, so the waveform fills every pixel left, at every width. #strip outranks skin.css/skin-um's older .strip columns. */
  #strip{height:auto;min-height:0;overflow:hidden;grid-template-columns:250px minmax(0,1fr) auto 36px;grid-template-rows:minmax(0,1fr)}
  #strip .wave canvas{height:auto;flex:1 1 0;min-height:40px}
  #strip.short .tags{display:none}
  .deckbtn{align-self:center;justify-self:end}

  /* deck row collapsed: a slim bar with Play, the title and the BPM */
  #strip.collapsed{grid-template-columns:minmax(0,1fr) auto 36px;gap:18px;padding:2px 8px 2px 16px;align-items:center}
  #strip.collapsed .meta{justify-content:center}
  #strip.collapsed #stripCaps,#strip.collapsed #stripSub,#strip.collapsed #stripTags,#strip.collapsed .wave,
  #strip.collapsed .tempo .r,#strip.collapsed #tflags,#strip.collapsed #cutsoon{display:none}
  #strip.collapsed .srow{margin:0}
  #strip.collapsed .title{font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #strip.collapsed .tempo{display:flex;align-items:center}
  #strip.collapsed .bpm{font-size:22px;line-height:1}

  /* main row collapsed: a 44px bar with one button */
  .mainbar{margin:8px 14px 12px;display:flex;align-items:center;background:var(--u-p1);border:1px solid var(--u-line);border-radius:var(--r)}
  .mainbar button,.cbar button{display:flex;align-items:center;gap:8px;min-height:44px;padding:0 16px;font:600 13px/1 var(--u-sans);color:var(--u-ink)}
  .mainbar button:hover,.cbar button:hover{background:var(--u-raise)}

  /* centre collapsed: a 40px strip with one button (the panel takes the space) */
  .cbar{display:flex;background:var(--u-p2);border:1px solid var(--u-line);border-radius:var(--r);min-height:0}
  .cbar button{writing-mode:vertical-rl;width:100%;min-height:44px;padding:16px 0;justify-content:flex-start}
  .body.r-closed>.centre{margin-right:-12px} /* the 0px panel column: the centre runs up to the icon rail */

  /* library collapsed: only the icon column (also at 761-1180px, where the open library hides it) */
  .body.l-closed .nav{grid-template-columns:56px}
  .body.l-closed .rail{display:flex}
  .body.l-closed .tree{display:none}

  /* column handles sit in the 12px gaps: an 8px hit area with a 1px line, and a collapse button at the top */
  .hcol{grid-row:1;justify-self:start;width:8px;margin-left:-10px;position:relative;z-index:4}
  .hcol1{grid-column:2}.hcol2{grid-column:3}
  .body.r-closed .hcol2{grid-column:4}
  .body.c-closed .hcol2{display:none}
  .lay-sep{position:absolute;inset:0;cursor:col-resize;touch-action:none;outline:none}
  .lay-sep::before{content:"";position:absolute;left:50%;top:64px;bottom:12px;width:1px;transform:translateX(-50%);background:var(--u-rule-s)}
  .lay-sep:hover::before,.lay-drag .lay-sep:focus::before{background:var(--u-hot)}
  .lay-sep:focus-visible{outline:2px solid var(--u-hot);outline-offset:0}
  .lay-btn{display:grid;place-items:center;color:var(--u-fog);background:var(--u-p1);border:1px solid var(--u-line);border-radius:var(--r);cursor:pointer}
  .lay-btn:hover{color:var(--u-ink);background:var(--u-raise)}
  .lay-btn:focus-visible,.cbar button:focus-visible,.mainbar button:focus-visible,.dmreset:focus-visible{outline:2px solid var(--u-hot);outline-offset:2px}
  .lay-btn svg.i{width:16px;height:16px}
  .hcol .lay-btn{position:absolute;top:12px;left:50%;width:20px;height:44px;transform:translateX(-50%)}
  .deckbtn,.panelbtn{width:36px;height:44px}
  .insp-head{display:flex;align-items:flex-end;gap:6px}
  .insp-head .tabs{flex:1;min-width:0;overflow-x:auto;scrollbar-width:none}
  .panelbtn{flex:none;margin:0 0 4px}

  /* row handle: between the deck row and the main row; the main row's button sits at its left end */
  .rowbar{align-self:start;height:12px;margin:0 14px;display:flex;align-items:center;position:relative;z-index:5}
  .rowbar .lay-sep{position:relative;inset:auto;flex:1;height:12px;cursor:row-resize}
  .rowbar .lay-sep::before{left:12px;right:12px;top:50%;bottom:auto;width:auto;height:1px;transform:translateY(-50%)}
  .mainbtn{flex:none;width:44px;height:20px}

  /* chevrons point the way the column or row will move */
  #libBtn[aria-expanded=true] svg,#centreBtn svg{transform:rotate(180deg)}
  #deckBtn[aria-expanded=true] svg,#mainExp svg{transform:rotate(-90deg)}
  #deckBtn[aria-expanded=false] svg,#mainBtn svg{transform:rotate(90deg)}

  /* while dragging: no transitions, no text selection */
  .lay-drag,.lay-drag .body,.lay-drag .strip{transition:none!important}
  .lay-drag{user-select:none;-webkit-user-select:none}
  .lay-drag .rowbar .lay-sep::before,.lay-drag .hcol .lay-sep:focus::before{background:var(--u-hot)}
}
/* reduced motion: collapse and expand at once */
.rm .app,.rm .body,.rm .strip{transition:none!important}
.hc .lay-btn{color:var(--u-ink);border-width:2px}
.hc .lay-sep::before{background:var(--u-fog)}

/* Display menu: Reset layout, under the three switches */
.dmreset{display:block;width:100%;text-align:left;margin-top:6px;padding:12px 8px;border-top:1px solid var(--u-line);font:700 14px/1.2 var(--u-sans);color:var(--u-ink);min-height:44px}
.dmreset small{display:block;font:400 13px/1.3 var(--u-sans);color:var(--u-fog);margin-top:2px}
.dmreset:hover{background:var(--u-raise)}

/* ---------- phones: the stacked layout stays exactly as it is ---------- */
@media (max-width:760px){
  .hcol,.lay-btn,.lay-sep,.rowbar,.mainbar,.cbar{display:none!important}
}
/* 375px phones: the header row ran 1px wider than the screen (logo, Beta, Free for now, Display) */
@media (max-width:380px){.top{gap:8px}}
