/* The trim panel of Reelcut, a made-up editing app: one panel alone on black, a single amber accent. */
:root {
  --fondo: #000000;
  --carta: #111113;
  --bordo: #26262b;
  --tinta: #1c1c20;          /* the play button, the length pill, the time labels */
  --testo: #f4f3f0;
  --testo-2: #a8a7ad;
  --testo-3: #6c6b72;
  --accento: #f6c445;        /* the single accent: the handles, the frame between them, the Trim button */
  --accento-scuro: #1a1406;  /* the ink on the accent */
  --testina: #ffffff;        /* the playhead */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(10px, min(3.6vw, 3.05vh), 17px); }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.stage { height: 100vh; display: grid; place-items: center; padding: 2vh 4vw; }

/* the panel: a body, a 1px edge that catches light at the top, soft shadows that read on black */
.panel {
  position: relative;
  width: min(24em, 92vw);
  padding: 1.15em 1.15em 1em;
  border-radius: 1.2em;
  background: var(--carta);
  border: 1px solid var(--bordo);
  box-shadow: 0 .1em .2em rgba(0,0,0,.6), 0 1.4em 3em -1em rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.02) inset;
}
.panel__edge {
  position: absolute; left: 12%; right: 12%; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  pointer-events: none;
}

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1em; margin-bottom: .8em; }
.head__title { font-size: 1em; font-weight: 640; letter-spacing: -.01em; line-height: 1.15; }
.head__sub { font-size: .72em; color: var(--testo-3); font-weight: 500; line-height: 1.35; }
.total { font-size: .7em; color: var(--testo-3); text-align: right; line-height: 1.35; }
.total__val { font-family: "JetBrains Mono Variable", ui-monospace, monospace; color: var(--testo-2); }

/* the preview: a drawn frame, no photo; the timecode sits in a dark pill */
.preview {
  position: relative;
  aspect-ratio: 2 / 1;
  border-radius: .7em;
  overflow: hidden;
  background: #0b0d18;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06) inset;
}
.scene { display: block; width: 100%; height: 100%; }
.tc {
  position: absolute; left: .6em; bottom: .55em;
  display: grid; place-items: center;
  height: 1.6em; padding: 0 .55em;
  border-radius: 99em;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  font-family: "JetBrains Mono Variable", ui-monospace, monospace;
  font-size: .66em; line-height: 1; color: #fff; letter-spacing: .02em;
}

/* the strip: ten frames, the shade outside the cut, the amber frame between the handles */
.strip {
  position: relative;
  margin-top: .85em;
  height: 3.1em;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.frames {
  position: absolute; inset: .3em 0;
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 1px;
  border-radius: .45em;
  overflow: hidden;
  background: #000;
}
.frames svg { display: block; width: 100%; height: 100%; }
.shade {
  position: absolute; top: .3em; bottom: .3em;
  background: rgba(0,0,0,.62);
  pointer-events: none;
}
.shade--l { left: 0; border-radius: .45em 0 0 .45em; }
.shade--r { right: 0; border-radius: 0 .45em .45em 0; }
.sel {
  position: absolute; top: 0; bottom: 0; left: 0;
  border-top: .22em solid var(--accento);
  border-bottom: .22em solid var(--accento);
  pointer-events: none;
  box-shadow: 0 0 1.2em -.3em rgba(246,196,69,.35);
}

/* the playhead: a white line with a round cap, only while playing */
.head-line {
  position: absolute; top: -.15em; bottom: -.15em; left: 0;
  width: 2px; margin-left: -1px;
  background: var(--testina);
  border-radius: 2px;
  box-shadow: 0 0 .5em rgba(255,255,255,.5);
  opacity: 0;
  pointer-events: none;
}
.head-line__cap {
  position: absolute; left: 50%; top: -.25em;
  width: .55em; height: .55em; margin-left: -.275em;
  border-radius: 50%; background: var(--testina);
}

/* the handles: a button for the pointer (wide hit area), a body for GSAP's spring */
.handle {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 2.2em; margin-left: -1.1em;
  display: grid; place-items: center;
  cursor: ew-resize;
  touch-action: none;
}
.handle__body {
  display: grid; place-items: center;
  width: .95em; height: 100%;
  background: var(--accento);
  color: var(--accento-scuro);
  box-shadow: 0 .15em .5em rgba(0,0,0,.45);
}
.handle--l .handle__body { border-radius: .45em 0 0 .45em; transform-origin: 100% 50%; }
.handle--r .handle__body { border-radius: 0 .45em .45em 0; transform-origin: 0 50%; }
.handle--l { margin-left: -1.575em; }
.handle--r { margin-left: -.625em; }
.grip { display: grid; grid-auto-flow: column; gap: .14em; place-items: center; }
.grip i { display: block; width: .1em; height: .95em; border-radius: .1em; background: currentColor; opacity: .75; }
.handle:focus-visible { outline: none; }
.handle:focus-visible .handle__body { box-shadow: 0 0 0 .18em rgba(246,196,69,.35); }

/* the times under the handles */
.times { position: relative; height: 1.5em; margin-top: .25em; }
.time {
  position: absolute; top: 0; left: 0;
  font-family: "JetBrains Mono Variable", ui-monospace, monospace;
  font-size: .66em; line-height: 2.1; color: var(--testo-2);
  white-space: nowrap;
}

/* the controls: Play, the length that rolls, Trim */
.controls { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .7em; margin-top: .6em; }
.play {
  position: relative;
  width: 2.6em; height: 2.6em;
  border-radius: 50%;
  background: var(--tinta);
  box-shadow: 0 0 0 1px var(--bordo) inset;
  transition: background .2s;
}
.play__face { position: absolute; inset: 0; display: grid; place-items: center; }
.play__face svg { width: 1.25em; height: 1.25em; fill: var(--testo); }
.play__face--go svg { transform: translateX(.06em); }
.play__face--stop { opacity: 0; }
@media (hover: hover) { .play:hover { background: #26262b; } }

.len { display: flex; align-items: baseline; gap: .55em; min-width: 0; }
.len__lab { font-size: .7em; color: var(--testo-3); font-weight: 500; }
.roll {
  display: inline-flex;
  font-family: "JetBrains Mono Variable", ui-monospace, monospace;
  font-size: 1.15em; font-weight: 500; line-height: 1.2; color: var(--testo);
  letter-spacing: .01em;
}
.roll__win { display: inline-block; height: 1.2em; overflow: hidden; }
.roll__col { display: flex; flex-direction: column; }
.roll__col span, .roll__fix { display: block; height: 1.2em; }

.trim {
  position: relative;
  width: 5.6em; height: 2.6em;
  border-radius: 99em;
  background: var(--accento);
  color: var(--accento-scuro);
  font-weight: 650;
  box-shadow: 0 .4em 1.2em -.4em rgba(246,196,69,.45), 0 1px 0 rgba(255,255,255,.4) inset;
}
.trim__face { position: absolute; inset: 0; display: grid; place-items: center; }
.trim__lab { font-size: .9em; line-height: 1; font-stretch: 100%; }
.trim__face--busy, .trim__face--done { opacity: 0; }
.ring { width: 1.2em; height: 1.2em; }
.ring circle { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: .34 1; }
.tick { width: 1.25em; height: 1.25em; }
.tick path { fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
@media (hover: hover) { .trim:hover .trim__lab { font-stretch: 112%; } .trim__lab { transition: font-stretch .35s cubic-bezier(.3,1.6,.5,1); } }

.saved {
  height: 1.6em; margin-top: .45em;
  font-size: .72em; line-height: 1.6em; color: var(--testo-2);
  text-align: right;
  opacity: 0;
}
.saved span { font-family: "JetBrains Mono Variable", ui-monospace, monospace; color: var(--accento); }
