/* The timeline zoom slider: the editing panel of an invented video editor on black. The main view and the overview
   are two canvases drawn by the script; the window, its glass and the two metal handles are elements over the
   overview, moved with transforms. */
:root {
  --page: #000000;          /* the page */
  --panel: #0f1013;         /* the body of the panel */
  --panel-top: #17191e;     /* the top of the panel, where the light falls */
  --lane: #15171b;          /* the lanes of the tracks */
  --edge: rgba(255, 255, 255, 0.075); /* hairline edges */
  --ink: #ececef;           /* the words */
  --muted: #7d808a;         /* the small words */
  --accent: #ffb54d;        /* the amber of the window, the playhead and the cuts */
  --clip: #4a5d86;          /* the video clips */
  --clip-light: #7189bd;    /* the light edge of the clips */
  --audio: #58a596;         /* the audio waveform */
  --metal-hi: #f4f4f6;      /* the bright side of the handles */
  --metal-lo: #8d9099;      /* the dark side of the handles */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

.editor {
  position: relative;
  width: min(640px, 92vw);
  padding: clamp(12px, 2.6vh, 18px) clamp(12px, 2.4vw, 18px) clamp(10px, 2vh, 14px);
  border-radius: 18px;
  background:
    linear-gradient(180deg, var(--panel-top), var(--panel) 46%),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 0 0 1px var(--edge),
    0 1px 1px rgba(0, 0, 0, 0.6),
    0 14px 30px -12px rgba(0, 0, 0, 0.9),
    0 40px 80px -30px rgba(0, 0, 0, 0.95);
  opacity: 0;
}

/* a whisper of grain on the panel */
.editor::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* the amber light that the window throws on the panel's top edge */
.editor::after {
  content: '';
  position: absolute;
  left: var(--lx, 50%);
  top: -1px;
  width: 180px;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 70%, transparent), transparent);
  opacity: var(--lo, 0.35);
  pointer-events: none;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: clamp(8px, 1.8vh, 12px);
  min-width: 0;
}

.file {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.file__icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.3;
}

.file__name {
  font-size: 13px;
  font-weight: 600;
  font-stretch: 105%;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.file__meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.readout {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.readout__range {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
}

.readout__dash {
  width: 8px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
}

.chip__icon {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* rolling digits: every digit is a column of 0 to 9 that slides */
.roll {
  display: inline-flex;
  height: 1.2em;
  line-height: 1.2em;
  overflow: hidden;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
}

.roll__slot {
  position: relative;
  display: inline-block;
  height: 1.2em;
  text-align: center;
}

.roll__slot--d {
  width: 0.62em;
}

.roll__col {
  display: flex;
  flex-direction: column;
}

.roll__col span {
  display: block;
  height: 1.2em;
}

.view {
  position: relative;
  height: clamp(118px, 33vh, 196px);
  border-radius: 11px;
  overflow: hidden;
  background: var(--lane);
  box-shadow: inset 0 0 0 1px var(--edge), inset 0 8px 18px -10px rgba(0, 0, 0, 0.8);
}

.view__cv,
.mini__cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* the edges of the main view darken when there is more film beyond them */
.view__edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  pointer-events: none;
  opacity: 0;
}

.view__edge--l {
  left: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.55), transparent);
}

.view__edge--r {
  right: 0;
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.55), transparent);
}

.mini {
  position: relative;
  height: clamp(34px, 8vh, 42px);
  margin: clamp(10px, 2.2vh, 14px) 9px 0;
  border-radius: 8px;
  background: var(--lane);
  box-shadow: inset 0 0 0 1px var(--edge);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.win {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 0;
  width: 100px;
  cursor: grab;
  touch-action: none;
}

.win.is-panning {
  cursor: grabbing;
}

/* the window: a frame of amber with a faint glass in it, and outside it the overview is dimmed */
.win__glass {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  box-shadow:
    inset 0 0 0 1.5px var(--accent),
    inset 0 1px 0 1.5px color-mix(in srgb, white 30%, var(--accent)),
    0 0 18px -2px color-mix(in srgb, var(--accent) 45%, transparent);
}

.win__sheen {
  position: absolute;
  top: 1.5px;
  bottom: 1.5px;
  left: 12px;
  right: 12px;
  border-radius: 5px;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.09) 48%, transparent 62%);
  background-size: 260% 100%;
  background-position: 100% 0;
  opacity: 0;
  pointer-events: none;
}

.grip {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 30px;
  display: grid;
  place-items: center;
  cursor: ew-resize;
  outline: none;
  touch-action: none;
  z-index: 2;
}

.grip--a {
  left: -15px;
}

.grip--b {
  right: -15px;
}

/* the metal handle: brushed light from the top left, a lit bevel, two grip lines */
.grip__metal {
  position: relative;
  width: 11px;
  height: 100%;
  border-radius: 5px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 2px),
    linear-gradient(100deg, var(--metal-hi), var(--metal-lo) 52%, color-mix(in srgb, var(--metal-hi) 70%, var(--metal-lo)) 78%, var(--metal-lo));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 3px 6px rgba(0, 0, 0, 0.6),
    0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent);
  transition: box-shadow 0.25s;
}

.grip__lines {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 12px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.42) 0 1px, transparent 1px 3px, rgba(0, 0, 0, 0.42) 3px 4px);
}

.grip.is-held .grip__metal,
.grip:focus-visible .grip__metal {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 3px 8px rgba(0, 0, 0, 0.6),
    0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent);
}

.hint {
  margin: clamp(8px, 1.6vh, 11px) 0 0;
  font-size: 10.5px;
  text-align: center;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #ffffff;
  stroke: #000000;
  stroke-width: 1.2;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

@media (max-width: 460px) {
  .file__meta,
  .readout__range {
    display: none;
  }
}

@media (hover: hover) {
  .grip:hover .grip__metal {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.95),
      inset 0 -1px 0 rgba(0, 0, 0, 0.35),
      0 0 0 1px rgba(0, 0, 0, 0.55),
      0 3px 8px rgba(0, 0, 0, 0.6),
      0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
  }
}
