/* ==========================================================================
   STATiS — DAW storefront
   Scoped under body.daw so the shared checkout styles in app.css are untouched.
   ========================================================================== */

body.daw {
  --bg: #262626;
  --panel: #2b2b2b;
  --panel-2: #323232;
  --line: #3f3f3f;
  --line-2: #4a4a4a;
  --text: #e8e8e8;
  --muted: #a6a6a6;
  --dim: #7d7d7d;
  --gold: #fbb41f;
  --rh: 32px;

  background: var(--bg) !important;
  color: var(--text);
  height: 100vh;
  height: 100dvh;      /* iOS: exclude the browser chrome so nothing hides behind it */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  margin: 0;
}

body.daw * { box-sizing: border-box; }

.daw .mono { font-family: var(--mono, ui-monospace, monospace); font-variant-numeric: tabular-nums; }
.daw .label { font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); font-weight: 600; }

/* ---------------------------------------------------------------- transport */
.daw .transport {
  position: relative;
  display: flex; align-items: center; gap: 18px; height: 54px; flex: none;
  padding: 0 16px 0 18px;
  background: linear-gradient(180deg, #4d4d4d, #444444);
  border-bottom: 1px solid var(--line);
}
.daw .brand { display: flex; align-items: center; }
.daw .brand img { height: 44px; width: auto; display: block; border-radius: 50%; }
.daw .divider { width: 1px; height: 26px; background: var(--line-2); flex: none; }
.daw .tp { display: flex; align-items: center; gap: 4px; }
.daw .tbtn {
  width: 32px; height: 32px; border: 1px solid #5c5c5c; background: #4c4c4c;
  border-radius: 5px; color: #f0f0f0; display: grid; place-items: center;
  cursor: pointer; transition: .12s; font-size: 12px; padding: 0;
}
.daw .tbtn:hover { background: #5a5a5a; color: #fff; }
.daw .tbtn.play { background: #3fbf63; border-color: #55d07a; color: #06140a; }
.daw .tbtn.play:hover { background: #4ed273; }
.daw .readout { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.daw .readout .v { font-family: var(--mono, monospace); font-size: 15px; font-weight: 600; }
.daw .readout .k { font-size: 8px; letter-spacing: .16em; color: var(--dim); text-transform: uppercase; }
.daw .timecode { font-family: var(--mono, monospace); font-size: 19px; font-weight: 600; color: #f2f2f2; }
.daw .spacer { flex: 1; }

.daw .cartwrap { position: relative; }
.daw .cartbtn {
  display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 14px;
  border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2);
  cursor: pointer; color: var(--text); font-size: 11px; letter-spacing: .06em;
}
.daw .cartbtn:hover { border-color: var(--gold); background: #191910; }
.daw .cartbtn .n { font-family: var(--mono, monospace); font-weight: 700; color: var(--gold); font-size: 13px; }
.daw .cartbtn .t { color: var(--muted); }

/* keep the shared popup anchored under the transport button */
.daw .cartwrap .cart-popup { top: 42px; right: 0; left: auto; }

/* -------------------------------------------------------------------- body */
.daw .main3 { flex: 1; display: grid; grid-template-columns: 246px 1fr 316px; min-height: 0; }

/* --------------------------------------------------------------- track rail */
.daw .rail { background: #494949; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.daw .rail-head { height: 30px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--line); background: #515151; }
.daw .rail-body { overflow-y: auto; flex: 1; }
.daw .rail-body::-webkit-scrollbar { width: 8px; }
.daw .rail-body::-webkit-scrollbar-thumb { background: #2a2a30; border-radius: 4px; }

.daw .track {
  display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: center;
  height: var(--rh, 42px); padding: 0 10px 0 8px; cursor: pointer;
  border-bottom: 1px solid #3c3c3c; border-left: 2px solid transparent;
  background: none; width: 100%; text-align: left; color: inherit; font: inherit;
}
.daw .track:hover { background: #535353; }
.daw .track.sel { background: #5b5b5b; border-left-color: var(--gold); }
.daw .track .num { font-family: var(--mono, monospace); font-size: 10px; color: var(--dim); }
.daw .track .inner { display: flex; align-items: center; gap: 8px; min-width: 0; }
.daw .track .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.daw .track .nm { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daw .track.sel .nm { color: var(--gold); }
.daw .track .bpm { font-family: var(--mono, monospace); font-size: 10px; color: var(--dim); }

/* --------------------------------------------------------------- arrangement */
.daw .arrange { position: relative; background: #2b2b2b; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.daw .ruler { height: 30px; border-bottom: 1px solid #3a3a3a; background: #333333; cursor: pointer; display: flex; align-items: flex-end; flex: none; }
.daw .ruler span { flex: 1; border-left: 1px solid #1e1e22; padding: 0 0 5px 6px; font-family: var(--mono, monospace); font-size: 9px; color: var(--dim); }
.daw .lanes { position: relative; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
.daw .lane { position: relative; width: 100%; flex: 0 0 var(--rh, 32px); border-bottom: 1px solid #343434; }
.daw .lane:hover { background: #313131; }
.daw .lane.sel { background: #363636; }

.daw .clip {
  position: absolute; top: 2px; left: 0; height: calc(var(--rh, 42px) - 4px);
  border-radius: 4px; overflow: hidden; border: 1px solid rgba(255,255,255,.07);
  cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 0 8px;
  width: 100%;   /* the clip is the whole 16-bar timeline */
}
.daw .clip:hover { filter: brightness(1.18); }
.daw .clip .cname { position: relative; z-index: 1; font-size: 10px; font-weight: 700; color: var(--ink, rgba(0,0,0,.78)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daw .clip .wave { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: .9; pointer-events: none; }


.daw .playhead {
  position: absolute; top: 0; bottom: 0; width: 1px; background: #f2f2f2;
  box-shadow: 0 0 6px rgba(255,255,255,.35); z-index: 5; pointer-events: none;
}
.daw .playhead::before { content: ""; position: absolute; top: 0; left: -4px; border: 4px solid transparent; border-top-color: #f2f2f2; }

/* ----------------------------------------------------------------- inspector */
.daw .inspector { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.daw .ins-head { height: 30px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.daw .ins-close { display: none; background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.daw .cover { height: 176px; background-size: cover; background-position: center; position: relative; flex: none; border-bottom: 1px solid var(--line); }
.daw .cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(10,10,11,.92)); }
.daw .cover .meta { position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 2; }
.daw .cover .meta h2 { font-family: var(--head, sans-serif); font-size: 20px; font-weight: 800; line-height: 1.1; margin: 0; }
.daw .cover .meta .sub { font-family: var(--mono, monospace); font-size: 10px; color: var(--muted); margin-top: 4px; letter-spacing: .04em; }
.daw .ins-body { padding: 12px; overflow-y: auto; flex: 1; }

.daw .slots { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.daw .slot {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); cursor: pointer;
  transition: .12s; width: 100%; text-align: left; color: inherit; font: inherit;
}
.daw .slot:hover { border-color: #3a3a42; background: #1a1a1e; }
.daw .slot.active { border-color: var(--gold); background: #1b1809; }
.daw .slot .idx { font-family: var(--mono, monospace); font-size: 9px; color: var(--dim); width: 14px; }
.daw .slot .nm { font-size: 11.5px; font-weight: 700; letter-spacing: .02em; display: block; }
.daw .slot .ds { font-size: 10px; color: var(--dim); margin-top: 2px; display: block; }
.daw .slot .pr { margin-left: auto; font-family: var(--mono, monospace); font-size: 12px; color: var(--gold); font-weight: 600; }
.daw .slot.active .pr { color: var(--text); }
.daw .addbtn {
  margin-top: 12px; width: 100%; padding: 11px; border-radius: 6px; border: 0; cursor: pointer;
  background: var(--gold); color: #0b0b0c; font-weight: 800; font-size: 12px;
  letter-spacing: .06em; text-transform: uppercase;
}
.daw .addbtn:hover { background: #ffc63d; }
.daw .terms { margin-top: 10px; text-align: center; }
.daw .terms button { background: none; border: 0; color: var(--dim); font-size: 10px; text-decoration: underline; cursor: pointer; padding: 0; }
.daw .terms button:hover { color: var(--muted); }

/* ------------------------------------------------------------ now playing */
.daw .npbar {
  flex: none; height: 68px; border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #2f2f2f, #272727);
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
}
.daw .np-state { display: flex; align-items: center; gap: 7px; min-width: 78px; }
.daw .np-state i { width: 6px; height: 6px; border-radius: 50%; background: #3a3a42; flex: none; }
.daw .np-state.on i { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,.6); }
.daw .np-state span { font-size: 9px; letter-spacing: .14em; color: var(--dim); text-transform: uppercase; font-weight: 600; }
.daw .np-title { min-width: 120px; }
.daw .np-title b { display: block; font-size: 12.5px; font-weight: 700; }
.daw .np-title span { font-size: 10px; color: var(--dim); }
.daw .np-track { flex: 1; height: 5px; border-radius: 3px; background: #4a4a4a; cursor: pointer; position: relative; min-width: 60px; }
.daw .np-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 3px; background: var(--gold); }
.daw .np-time { font-family: var(--mono, monospace); font-size: 10px; color: var(--muted); min-width: 78px; text-align: right; }
.daw .np-licence {
  display: none; align-items: center; justify-content: center;
  height: 32px; padding: 0 12px; border-radius: 6px;
  border: 1px solid var(--gold); background: transparent; color: var(--gold);
  font-size: 10px; font-weight: 800; letter-spacing: .10em; text-transform: uppercase;
  cursor: pointer; white-space: nowrap;
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) { .daw .main3 { grid-template-columns: 206px 1fr 286px; } }

@media (max-width: 900px) {
  /* mobile: narrow name column + the timeline beside it.
     The timeline is the scroller; the track names follow it (js syncs them). */
  .daw .main3 { grid-template-columns: 118px 1fr; }
  .daw { --rh: 38px; }
  .daw .rail-body { overflow: hidden; }
  .daw .arrange { display: flex; }
  .daw .rail { display: flex; }
  .daw .arrange { display: flex; }
  .daw .np-licence { display: inline-flex; }

  .daw .track { grid-template-columns: 16px 1fr; gap: 6px; padding: 0 6px; }
  .daw .track .bpm { display: none; }
  .daw .track .nm { font-size: 11.5px; }
  .daw .track .num { font-size: 9px; }
  .daw .track .dot { width: 5px; height: 5px; }

  .daw .clip { width: 100%; padding: 0 6px; gap: 4px; }
  .daw .clip .cname { font-size: 9.5px; }
  .daw .ruler span { font-size: 8px; padding-left: 3px; }

  .daw .inspector {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    max-height: 58vh; z-index: 60; border-left: 0; border-top: 1px solid var(--line-2);
    transform: translateY(100%); transition: transform .24s ease;
    border-radius: 14px 14px 0 0; box-shadow: 0 -18px 40px rgba(0,0,0,.55);
  }
  .daw .inspector.open { transform: none; }
  .daw .ins-close { display: block; }
  .daw .cover { height: 132px; }

  .daw .backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.55);
    opacity: 0; pointer-events: none; transition: opacity .24s; z-index: 55;
  }
  .daw .backdrop.show { opacity: 1; pointer-events: auto; }
}

@media (max-width: 620px) {
  .daw .transport { gap: 6px; padding: 0 8px 0 10px; }
  .daw .divider { display: none; }
  .daw .brand img { height: 34px; }
  .daw .timecode { font-size: 15px; }
  .daw .readout .v { font-size: 13px; }
  .daw .readout .k { font-size: 7px; }
  .daw .glass { padding: 5px 10px; gap: 10px; border-radius: 9px; }
  .daw .tp { gap: 4px; }
  .daw .tbtn { width: 30px; height: 30px; font-size: 12px; }
  .daw .cartbtn { padding: 0 10px; gap: 6px; }
  .daw .cartbtn .sep, .daw .cartbtn #cartTotalValue { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .daw .inspector, .daw .backdrop { transition: none; }
}

/* ------------------------------------------------- desktop: centred window */
.daw-window { display: contents; }

@media (min-width: 901px) {
  body.daw {
    background: #090909 !important;
    /* window starts ~2in lower (so it is 2in shorter) with a small side gutter */
    padding: calc(16px + 2in) 16px 16px;
  }
  .daw-window {
    display: flex;
    flex: 1;
    width: 100%;
    max-width: calc(1360px + 4in);
    margin: 0 auto;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #2c2c2c;
    border-radius: 6px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  }
}

/* desktop: a taller transport bar (2in) with proportionally larger controls */
@media (min-width: 901px) {
  .daw .transport {
    height: calc(54px + 1in);
    padding: 0 24px 0 26px;
    gap: 22px;
  }
  .daw .brand img { height: 104px; }
  .daw .divider { height: 44px; }
  .daw .tp { gap: 8px; }
  .daw .tbtn { width: 54px; height: 54px; font-size: 17px; }
  .daw .timecode { font-size: 30px; }
  .daw .readout .v { font-size: 22px; }
  .daw .readout .k { font-size: 9px; letter-spacing: .2em; }
  .daw .cartbtn { height: 48px; padding: 0 20px; font-size: 12px; gap: 12px; }
  .daw .cartbtn .n { font-size: 16px; }
}

/* --------------------------------------------------- transport glass panel */
.daw .transport-center { display: flex; align-items: center; gap: 16px; }

.daw .glass {
  display: flex; align-items: center; gap: 16px;
  padding: 7px 16px;
  border-radius: 12px;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(96,160,255,.30), rgba(20,60,150,.10) 60%, rgba(10,20,50,.05) 100%),
    linear-gradient(180deg, rgba(70,130,255,.18), rgba(20,45,110,.10));
  border: 1px solid rgba(120,170,255,.38);
  box-shadow:
    inset 0 1px 0 rgba(200,225,255,.35),
    inset 0 -1px 0 rgba(0,0,0,.35),
    0 0 18px rgba(70,140,255,.40),
    0 0 46px rgba(40,110,255,.22),
    0 8px 22px rgba(0,0,0,.50);
  backdrop-filter: blur(12px) saturate(1.25);
  -webkit-backdrop-filter: blur(12px) saturate(1.25);
}

@media (min-width: 901px) {
  /* truly centred in the bar, independent of logo / cart widths */
  .daw .transport-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: max-content;   /* stop flex shrinking the buttons against the right edge */
    max-width: none;
  }
  .daw .transport-center .tp .tbtn {
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    min-width: 54px;
    min-height: 54px;
    max-width: 54px;
    max-height: 54px;
  }
  .daw .glass { gap: 26px; padding: 14px 30px; border-radius: 16px; }
  .daw .transport-center { gap: 18px; }
}
