/* Clip prep: a workbench for one clip. The timeline is the centrepiece; the rest stays quiet. */
[hidden] { display: none !important; }
.clip-page main { min-height: 70vh; }
.clip-hero { padding: 64px 0 8px; }
.clip-hero h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); font-weight: 800; }
.clip-hero .lede { margin: 14px 0 28px; }

.bench { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; padding-bottom: 40px; }

/* ---------- drop zone ---------- */
.drop { display: grid; place-items: center; align-content: center; gap: 6px; min-height: 380px; text-align: center; cursor: pointer;
  border: 1.5px dashed color-mix(in srgb, var(--ink-3) 70%, transparent); border-radius: 22px;
  background: radial-gradient(ellipse at 50% 30%, rgba(145, 118, 239, .16), transparent 65%), rgba(22, 26, 66, .5); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: #9176ef; background: radial-gradient(ellipse at 50% 30%, rgba(145, 118, 239, .28), transparent 65%), rgba(22, 26, 66, .7); }
.drop:focus-within { outline: 2px solid #9176ef; outline-offset: 3px; }
.drop-art { width: 92px; height: 92px; margin-bottom: 14px; background: url(/assets/asteria.png) center / contain no-repeat; filter: drop-shadow(0 0 22px #9176efaa); }
.drop-title { font-family: var(--serif); font-size: 1.7rem; }
.drop-sub { color: var(--ink-2); }

/* ---------- player ---------- */
.player-frame { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 18px; overflow: hidden; border: 1px solid var(--night-3); }
.player-frame video { width: 100%; height: 100%; object-fit: contain; display: block; cursor: pointer; }
.crop-guide { position: absolute; border: 2px solid #fff; border-radius: 6px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .55); pointer-events: none; }

.transport { display: flex; align-items: center; gap: 12px; margin: 14px 0 12px; flex-wrap: wrap; }
.transport .time { font-variant-numeric: tabular-nums; }
.transport .muted { color: var(--ink-3); font-size: .9rem; }
.transport .spacer { flex: 1; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--ink); color: var(--night); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.icon-btn .i-pause, .icon-btn.playing .i-play { display: none; }
.icon-btn.playing .i-pause { display: inline; }
.chip { font: inherit; font-weight: 600; font-size: .9rem; color: var(--ink); cursor: pointer; padding: 8px 14px; min-height: 38px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .05); }
.chip:hover { border-color: rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .09); }

/* ---------- timeline: filmstrip, trim handles, slow-mo band, playhead ---------- */
.timeline { position: relative; height: 76px; border-radius: 12px; background: #07081c; overflow: visible; cursor: pointer; touch-action: none; user-select: none; }
.film { position: absolute; inset: 6px 0; display: flex; overflow: hidden; border-radius: 10px; }
.film canvas { flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; }
.shade { position: absolute; top: 0; bottom: 0; background: rgba(7, 8, 28, .72); }
.shade.left { left: 0; border-radius: 12px 0 0 12px; }
.shade.right { right: 0; border-radius: 0 12px 12px 0; }
.slow-band { position: absolute; top: 0; bottom: 0; background: rgba(255, 95, 200, .22); border-inline: 2px solid #ff5fc8; pointer-events: none; }
.slow-band span { position: absolute; top: -24px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .75rem; font-weight: 700; color: #ffb3e6; }
.handle { position: absolute; top: -4px; bottom: -4px; width: 16px; margin-left: -8px; border-radius: 6px; cursor: ew-resize; z-index: 2;
  background: linear-gradient(180deg, #a7b2d0, #5a86eb 30%, #9176ef 65%, #bc61e8); box-shadow: 0 0 14px #9176ef99; touch-action: none; }
.handle::after { content: ""; position: absolute; left: 6px; top: 50%; width: 4px; height: 22px; margin-top: -11px; border-radius: 2px; background: rgba(255, 255, 255, .85); }
.handle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.playhead { position: absolute; top: -8px; bottom: -8px; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; z-index: 3; box-shadow: 0 0 8px #fff; }
.playhead::before { content: ""; position: absolute; top: -2px; left: -5px; border: 6px solid transparent; border-top-color: #fff; }
.selection { margin: 14px 0 2px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.selection b { color: var(--ink); }
.hint { color: var(--ink-3); font-size: .88rem; }
kbd { font: 600 .8rem var(--sans); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--night-3); background: var(--night-2); color: var(--ink-2); }

/* ---------- settings panel ---------- */
.panel { position: sticky; top: 88px; display: grid; gap: 18px; padding: 22px; border-radius: 20px;
  background: rgba(22, 26, 66, .72); border: 1px solid rgba(255, 255, 255, .08); backdrop-filter: blur(8px); }
.panel fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.panel legend { font-weight: 700; font-size: .95rem; margin-bottom: 8px; padding: 0; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg label, .shapes label { position: relative; }
.seg input, .shapes input, .toggle input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; gap: 0; min-height: 52px; padding: 6px 4px; text-align: center; cursor: pointer; font-weight: 700; font-size: .92rem;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .03); line-height: 1.2; }
.seg small { font-weight: 500; font-size: .72rem; color: var(--ink-3); }
.seg input:checked + span, .shapes input:checked + span { border-color: #c9bdff; background: rgba(145, 118, 239, .3); }
.seg input:checked + span small { color: var(--ink-2); }
.seg input:focus-visible + span, .shapes input:focus-visible + span, .toggle input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }
.shapes { display: grid; gap: 6px; }
.shapes span { display: flex; align-items: center; gap: 12px; padding: 9px 12px; cursor: pointer; font-weight: 600; font-size: .92rem;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .03); }
.sh { flex: none; display: inline-block; border: 2px solid var(--ink-2); border-radius: 3px; }
.sh-land { width: 26px; height: 15px; }
.sh-fill, .sh-crop { width: 13px; height: 22px; margin-inline: 6px; }
.sh-fill { background: linear-gradient(180deg, transparent 32%, var(--ink-2) 32%, var(--ink-2) 68%, transparent 68%); }
.sh-crop { background: var(--ink-2); }
.range-row { display: grid; gap: 4px; margin-top: 10px; font-size: .88rem; color: var(--ink-2); }
.range-row output { color: var(--ink); font-weight: 700; }
input[type=range] { width: 100%; accent-color: #9176ef; }
.slow-opts { display: grid; gap: 4px; margin-top: 10px; }
.slow-opts .chip { width: 100%; }
.row2 { display: flex; gap: 12px; align-items: end; justify-content: space-between; }
.select { display: grid; gap: 4px; font-weight: 700; font-size: .95rem; }
.select select { font: inherit; font-weight: 600; color: var(--ink); background: var(--night-2); border: 1px solid rgba(255, 255, 255, .16); border-radius: 10px; padding: 8px 10px; min-height: 40px; }
.toggle span { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; min-height: 40px; }
.toggle span::before { content: ""; width: 38px; height: 22px; border-radius: 999px; background: var(--night-3); transition: background .15s;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.toggle span::after { content: ""; position: absolute; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: transform .15s; }
.toggle { position: relative; }
.toggle span { position: relative; }
.toggle input:checked + span::before { background: #9176ef; }
.toggle input:checked + span::after { transform: translateX(16px); background: #fff; }
.estimate { margin: 0; font-size: .9rem; color: var(--ink-2); }
.export { width: 100%; min-height: 50px; font-size: 1.02rem; cursor: pointer; font-family: inherit; }
.export:disabled { opacity: .45; cursor: default; }
.progress { display: grid; gap: 8px; }
.progress .bar { height: 8px; border-radius: 999px; background: var(--night-3); overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--space); transition: width .3s; }
.progress p { margin: 0; font-size: .9rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.progress .linkish { justify-self: start; font-size: .88rem; color: var(--ink-3); }
.error { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: .9rem; background: rgba(226, 58, 44, .15); border: 1px solid rgba(255, 138, 122, .4); color: #ffc4bb; }
.error.soft { background: rgba(232, 160, 64, .12); border-color: rgba(232, 160, 64, .4); color: #f6d39c; }

/* ---------- results ---------- */
.results { margin-top: 36px; }
.results h2 { font-size: 1.6rem; margin-bottom: 14px; }
.results ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.result { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: center; padding: 12px; border-radius: 16px;
  background: rgba(22, 26, 66, .6); border: 1px solid rgba(255, 255, 255, .08); }
.result video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; object-fit: contain; }
.result video.tall { aspect-ratio: 9 / 16; max-height: 300px; }
.result-meta { display: grid; gap: 8px; justify-items: start; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: rgba(145, 118, 239, .22); border: 1px solid #9176ef55; }
.result-sub { color: var(--ink-3); font-size: .88rem; }

.clip-notes { padding-top: 40px; }
.clip-notes h2 { font-size: 1.6rem; margin-bottom: 14px; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.notes li { padding: 16px; border-radius: 14px; background: rgba(22, 26, 66, .45); border: 1px solid rgba(255, 255, 255, .06); color: var(--ink-2); font-size: .94rem; }
.notes b { display: block; color: var(--ink); margin-bottom: 4px; }

@media (max-width: 900px) {
  .bench { grid-template-columns: 1fr; }
  .panel { position: static; }
}
@media (max-width: 640px) {
  .clip-hero { padding-top: 36px; }
  .drop { min-height: 260px; }
  .seg { grid-template-columns: repeat(2, 1fr); }
  .result { grid-template-columns: 1fr; }
  .timeline { height: 64px; }
}

/* once a clip is loaded, the intro steps aside so the player and timeline fit on one screen */
.has-video .clip-hero { padding: 22px 0 0; }
.has-video .clip-hero h1 { font-size: 1.8rem; }
.has-video .clip-hero .lede { display: none; }
.has-video .clip-hero .wrap { display: flex; align-items: baseline; gap: 16px; margin-bottom: 14px; }
.change-file { font: inherit; font-size: .9rem; color: var(--ink-2); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.player-frame { width: min(100%, max(360px, (100vh - 330px) * 16 / 9)); margin-inline: auto; }

/* compact panel: everything down to the Export button fits on a laptop screen */
.panel { gap: 14px; padding: 18px; top: 80px; }
.panel legend { margin-bottom: 6px; font-size: .9rem; }
.seg span { min-height: 44px; font-size: .88rem; }
.shapes span { padding: 7px 12px; font-size: .9rem; }
.range-row { margin-top: 6px; }
.slow-opts { margin-top: 8px; }
.slow-opts .chip { font-size: .85rem; min-height: 34px; padding: 6px 12px; }
.export { min-height: 46px; }

/* touch screens: no keyboard hint; the trim buttons share a row */
@media (hover: none) { .hint { display: none; } }
@media (max-width: 640px) {
  .transport { display: grid; grid-template-columns: auto 1fr; }
  .transport .spacer { display: none; }
  .transport .chip { grid-row: 2; }
  #setIn { grid-column: 1 / 2; }
  #setOut { grid-column: 2 / 3; justify-self: start; }
}
@media (min-width: 901px) {
  .panel { max-height: calc(100vh - 150px); overflow-y: auto; scrollbar-width: thin; }
  .panel .export { position: sticky; bottom: 0; box-shadow: 0 -14px 18px 4px rgba(22, 26, 66, .95); }
}
