/* =====================================================================
   Motio — base layout & components (shared by all four directions)
   Theme tokens live in themes.css; this file only consumes variables.
   ===================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--stage-bg);
  font-family: var(--font-body);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Stage + iPhone frame ---------- */
.stage { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
html.embed body { background: transparent; }
html.embed .stage { padding: 0; min-height: 0; }
.device {
  width: 417px; height: 876px; padding: 12px; border-radius: 66px;
  background: #0c0c0e;
  box-shadow: inset 0 0 0 1.5px #3b3b40, inset 0 0 0 4px #121214, 0 40px 90px -30px rgb(0 0 0 / .5);
}
html.embed .device { box-shadow: inset 0 0 0 1.5px #3b3b40, inset 0 0 0 4px #121214; }
.screen {
  position: relative; width: 393px; height: 852px; border-radius: 54px; overflow: hidden;
  background: var(--bg); display: flex; flex-direction: column;
}
.statusbar {
  position: relative; z-index: 30; height: 54px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 30px 0 46px;
  font: 600 17px/1 -apple-system, "SF Pro Text", system-ui, sans-serif; color: var(--fg);
}
.island { position: absolute; left: 50%; top: 11px; width: 126px; height: 37px; border-radius: 20px; background: #000; transform: translateX(-50%); }
.sb-icons { display: flex; gap: 6px; align-items: center; }
.sb-icons svg { fill: currentColor; }
.home-ind { position: absolute; z-index: 60; bottom: 8px; left: 50%; transform: translateX(-50%); width: 139px; height: 5px; border-radius: 3px; background: var(--fg); }

/* ---------- Nav ---------- */
.nav { position: relative; z-index: 5; height: 50px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 0 16px; }
.nav-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--fg); }
.nav-btn.back { margin-left: -10px; color: var(--accent-ink, var(--accent)); }
.nav-title { position: absolute; left: 50%; transform: translateX(-50%); font: var(--nav-title-font); letter-spacing: var(--nav-title-tracking, 0); text-transform: var(--nav-title-transform, none); white-space: nowrap; }
.nav-link { min-width: 44px; height: 44px; padding: 0 6px; display: grid; place-items: center; font-weight: 600; font-size: 17px; color: var(--accent-ink, var(--accent)); }
.nav-spacer { width: 44px; }
.wordmark { display: flex; align-items: center; gap: 8px; font: var(--wordmark-font); letter-spacing: -.01em; }
.logo { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--logo-radius, 9px); background: var(--accent); color: var(--accent-fg); }
.logo .i { width: 20px; height: 20px; }

/* ---------- Scroll area ---------- */
.content { flex: 1; overflow-y: auto; scrollbar-width: none; padding-bottom: 130px; }
.content::-webkit-scrollbar { display: none; }
.content.no-dock { padding-bottom: 40px; }

/* ---------- Titles ---------- */
.title-block { padding: 6px 20px 16px; }
.eyebrow { font: var(--eyebrow-font); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 8px; }
.h1 { font-family: var(--font-display); font-size: var(--h1-size); font-weight: var(--h1-weight); letter-spacing: var(--h1-tracking); line-height: 1.02; }
.lede { margin-top: 10px; color: var(--muted); font-size: 15px; line-height: 1.4; text-wrap: pretty; }

/* ---------- Segmented control ---------- */
.seg { display: flex; margin: 0 20px 16px; padding: 2px; background: var(--surface-2); border-radius: calc(var(--radius-sm) + 2px); }
.seg button { flex: 1; height: 34px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--muted); transition: background .18s, color .18s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button .i { width: 18px; height: 18px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgb(0 0 0 / .14); }

/* ---------- Video frames (gradient fallback; paint() layers the clip's still from img/videos) ---------- */
.frame {
  --sx: 50%; --sy: 45%; --ha: 220; --hb: 280;
  background:
    radial-gradient(circle at var(--sx) var(--sy), oklch(95% .06 var(--ha)) 0, oklch(90% .1 var(--ha) / .55) 9%, transparent 26%),
    radial-gradient(ellipse at calc(100% - var(--sx)) calc(var(--sy) + 22%), oklch(72% .16 var(--hb) / .8) 0, transparent 42%),
    radial-gradient(ellipse at 20% 110%, oklch(30% .08 var(--hb)) 0, transparent 60%),
    linear-gradient(165deg, oklch(66% .13 var(--ha)), oklch(30% .09 var(--hb)));
}

/* ---------- Import grid ---------- */
.grid { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: var(--gap, 2px); padding: 0 var(--grid-pad, 0px); }
.tile { position: relative; aspect-ratio: var(--tile-ratio, 1); border-radius: var(--tile-radius, 0); overflow: hidden; text-align: left; transition: transform .2s; }
.tile .frame { position: absolute; inset: 0; transition: filter .25s; }
.tile .name { display: var(--tile-name, none); position: absolute; left: 12px; bottom: 11px; right: 48px; color: #fff; font-weight: 700; font-size: 14px; line-height: 1.15; text-shadow: 0 1px 6px rgb(0 0 0 / .35); }
.tile .dur { position: absolute; right: 7px; bottom: 6px; font: 600 12px/1 var(--font-mono); color: #fff; text-shadow: 0 1px 3px rgb(0 0 0 / .5); font-variant-numeric: tabular-nums; }
.tile .check { position: absolute; right: 7px; top: 7px; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid #fff; background: rgb(0 0 0 / .18); display: grid; place-items: center; color: var(--accent-fg); }
.tile .check .i { width: 15px; height: 15px; stroke-width: 3; opacity: 0; }
.tile[aria-pressed="true"] .check { background: var(--accent); border-color: var(--accent); }
.tile[aria-pressed="true"] .check .i { opacity: 1; }
.tile[aria-pressed="true"]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 3px var(--accent); pointer-events: none; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- Bottom dock ---------- */
.dock {
  position: absolute; z-index: 20; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 12px; padding: 12px 16px 34px;
  background: var(--dock-bg); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--border);
}
.dock-sel { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.sel-thumb { width: 44px; height: 44px; border-radius: var(--radius-sm); flex: none; background: var(--surface-2); }
.sel-thumb.empty-thumb { background: var(--surface-2); }
.sel-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sel-text b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-text span { font: 500 12px/1.2 var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }

.btn-primary {
  position: relative; overflow: hidden; height: 50px; padding: 0 24px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--btn-radius); background: var(--accent); color: var(--accent-fg);
  font-weight: 600; font-size: 17px; transition: opacity .2s, transform .1s;
}
.btn-primary:active { transform: scale(.97); }
.btn-primary[aria-disabled="true"] { opacity: .32; pointer-events: none; }
.btn-primary.wide { flex: 1; }
.btn-primary .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgb(255 255 255 / .25); }
.btn-primary span { position: relative; }
.btn-secondary { width: 50px; height: 50px; flex: none; display: grid; place-items: center; border-radius: var(--btn-radius); background: var(--surface-2); color: var(--fg); }

/* ---------- Trim: preview ---------- */
.preview { position: relative; margin: 4px 16px 0; height: 316px; border-radius: var(--radius); overflow: hidden; }
.preview > .frame { position: absolute; inset: 0; }
.badge-live {
  position: absolute; z-index: 2; left: 12px; top: 12px; height: 26px; padding: 0 9px 0 6px;
  display: inline-flex; align-items: center; gap: 5px; border-radius: var(--badge-radius, 6px);
  background: var(--badge-bg, rgb(255 255 255 / .82)); color: var(--badge-fg, #111);
  font: 700 11px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.badge-live .i { width: 16px; height: 16px; stroke-width: 1.6; }
.preview-tc { position: absolute; z-index: 2; right: 12px; top: 12px; height: 26px; padding: 0 8px; display: grid; place-items: center; border-radius: var(--badge-radius, 6px); background: rgb(0 0 0 / .45); color: #fff; font: 600 12px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.play { position: absolute; z-index: 2; left: 12px; bottom: 12px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: rgb(0 0 0 / .45); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.play .i { width: 20px; height: 20px; }
.still-flag { position: absolute; z-index: 2; left: 50%; bottom: 18px; transform: translateX(-50%); height: 26px; padding: 0 10px; display: grid; place-items: center; border-radius: 13px; background: rgb(0 0 0 / .5); color: #fff; font: 600 12px/1 var(--font-body); opacity: 0; transition: opacity .2s; }
.still-flag.on { opacity: 1; }

/* ---------- Trim: panel rows ---------- */
.row-head { display: flex; justify-content: space-between; align-items: baseline; padding: 22px 20px 10px; gap: 12px; }
.label { font: var(--label-font); text-transform: var(--label-transform); letter-spacing: var(--label-tracking); color: var(--label-color, var(--muted)); }
.val { font: 500 13px/1 var(--font-mono); color: var(--fg); font-variant-numeric: tabular-nums; }
.hint { font-size: 13px; color: var(--muted); }

/* ---------- Trim: filmstrip ---------- */
.strip { position: relative; height: 58px; margin: 6px 36px 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.strip-frames { position: absolute; inset: 0; display: flex; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; }
.strip-frames .frame { flex: 1; height: 100%; box-shadow: inset -1px 0 0 rgb(0 0 0 / .18); }
.strip-dim { position: absolute; top: 0; bottom: 0; background: var(--strip-dim, rgb(0 0 0 / .58)); pointer-events: none; }
.strip-dim.l { left: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.strip-dim.r { right: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.win { position: absolute; top: -3px; bottom: -3px; border-top: 3px solid var(--win, var(--accent)); border-bottom: 3px solid var(--win, var(--accent)); cursor: grab; }
.win:active { cursor: grabbing; }
.grip { position: absolute; top: -3px; bottom: -3px; width: 16px; background: var(--win, var(--accent)); display: grid; place-items: center; cursor: ew-resize; }
.grip::before { content: ""; position: absolute; inset: -6px -10px; }
.grip::after { content: ""; width: 3px; height: 18px; border-radius: 2px; background: var(--win-ink, var(--accent-fg)); opacity: .7; }
.grip.l { left: -16px; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.grip.r { right: -16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.playhead { position: absolute; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; background: #fff; border-radius: 1px; box-shadow: 0 0 0 1px rgb(0 0 0 / .25); pointer-events: none; }
.keyframe { position: absolute; z-index: 3; top: -16px; bottom: -6px; width: 28px; margin-left: -14px; cursor: ew-resize; display: flex; flex-direction: column; align-items: center; }
.keyframe .key-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--key, #fff); border: 2px solid var(--key-ring, var(--bg)); display: grid; place-items: center; color: var(--key-ink, #111); box-shadow: 0 1px 4px rgb(0 0 0 / .3); }
.keyframe .key-dot .i { width: 12px; height: 12px; stroke-width: 2.4; }
.keyframe .key-line { flex: 1; width: 3px; background: var(--key, #fff); box-shadow: 0 0 0 1px rgb(0 0 0 / .25); border-radius: 2px; }
.ruler { display: var(--ruler, block); position: relative; height: 20px; margin: 8px 36px 0; }
.ruler span { position: absolute; top: 0; width: 1px; height: 5px; background: var(--muted); opacity: .5; }
.ruler span.major { height: 8px; opacity: .9; }
.ruler em { position: absolute; top: 10px; transform: translateX(-50%); font: 500 10px/1 var(--font-mono); font-style: normal; color: var(--muted); }

/* ---------- Trim: cover ---------- */
.cover-row { display: flex; gap: 14px; align-items: center; margin: 0 20px; }
.cover { width: 64px; height: 84px; border-radius: var(--radius-sm); flex: none; position: relative; overflow: hidden; }
.cover-row b { font-size: 15px; font-weight: 600; display: block; margin-bottom: 4px; }
.cover-row b .val { font-size: 15px; }
.cover-row p { font-size: 13px; color: var(--muted); line-height: 1.35; }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 8px; padding: 0 20px; }
.chips button { flex: 1; height: 42px; border-radius: var(--chip-radius); background: var(--surface-2); font: 600 15px/1 var(--font-mono); font-variant-numeric: tabular-nums; transition: background .15s, color .15s; }
.chips button[aria-pressed="true"] { background: var(--chip-on, var(--accent)); color: var(--chip-on-fg, var(--accent-fg)); }
.seg.lg { margin: 0 20px; }
.seg.lg button { height: 40px; font-size: 15px; }

/* ---------- Export ---------- */
.result { display: flex; flex-direction: column; align-items: center; padding: 6px 20px 0; }
.result-card { position: relative; width: 244px; height: 326px; border-radius: var(--radius); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.result-card.pressing { transform: scale(1.04); }
.result-card > .frame { position: absolute; inset: 0; }
.press-hint { position: absolute; z-index: 2; left: 50%; bottom: 14px; transform: translateX(-50%); white-space: nowrap; height: 28px; padding: 0 12px; display: grid; place-items: center; border-radius: 14px; background: rgb(0 0 0 / .45); color: #fff; font-size: 12px; font-weight: 600; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: opacity .2s; }
.result-card.pressing .press-hint { opacity: 0; }
.result-meta { margin-top: 14px; text-align: center; display: flex; flex-direction: column; gap: 5px; }
.result-meta b { font-size: 17px; font-weight: 600; }
.result-meta span { font: 500 12px/1 var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }

.list { margin: 0 16px; background: var(--surface); border-radius: var(--radius); border: var(--list-border, 1px solid var(--border)); overflow: hidden; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; min-height: 62px; text-align: left; }
.opt + .opt, .tgl + .tgl { border-top: 1px solid var(--border); }
.opt .ico { width: 36px; height: 36px; flex: none; border-radius: var(--radius-sm); background: var(--surface-2); display: grid; place-items: center; color: var(--fg); }
.opt .ico .i { width: 20px; height: 20px; }
.opt[aria-checked="true"] .ico { background: var(--ico-on, var(--accent)); color: var(--ico-on-fg, var(--accent-fg)); }
.opt-text { flex: 1; min-width: 0; }
.opt-text b { display: block; font-size: 16px; font-weight: 600; }
.opt-text small { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.radio { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid var(--border-strong); transition: border .15s; }
.opt[aria-checked="true"] .radio { border: 7px solid var(--accent); }
.tgl { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; min-height: 52px; font-size: 16px; }
.tgl.disabled { opacity: .4; }
.switch { position: relative; width: 51px; height: 31px; flex: none; border-radius: 16px; background: var(--switch-off, var(--surface-2)); transition: background .2s; }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgb(0 0 0 / .2); transition: transform .2s cubic-bezier(.3,.7,.3,1); }
.switch[aria-checked="true"] { background: var(--switch-on, var(--success)); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch:disabled { cursor: not-allowed; }

/* ---------- Overlays: share sheet, success, toast ---------- */
.scrim { position: absolute; inset: 0; z-index: 40; background: rgb(0 0 0 / .35); opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet { position: absolute; z-index: 45; left: 8px; right: 8px; bottom: 8px; padding: 18px 16px 30px; border-radius: 38px 38px 46px 46px; background: var(--sheet-bg, var(--surface)); transform: translateY(110%); transition: transform .32s cubic-bezier(.2,.8,.2,1); }
.sheet.on { transform: none; }
.sheet h2 { font-size: 15px; font-weight: 600; text-align: center; margin-bottom: 16px; }
.share-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.share-row button { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; }
.share-row .av { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; }
.sheet .btn-cancel { margin-top: 18px; width: 100%; height: 50px; border-radius: var(--btn-radius); background: var(--surface-2); font-weight: 600; font-size: 17px; }

.success { position: absolute; z-index: 50; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px 32px 60px; background: var(--success-bg, var(--bg)); text-align: center; opacity: 0; pointer-events: none; transition: opacity .3s; }
.success.on { opacity: 1; pointer-events: auto; }
.success .done-mark { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--success); color: #fff; transform: scale(.6); transition: transform .45s cubic-bezier(.3,1.6,.5,1); }
.success.on .done-mark { transform: none; }
.success .done-mark .i { width: 38px; height: 38px; stroke-width: 3; }
.success h2 { font-family: var(--font-display); font-size: 28px; font-weight: var(--h1-weight); letter-spacing: var(--h1-tracking); margin-top: 6px; }
.success p { color: var(--muted); font-size: 15px; line-height: 1.4; max-width: 280px; }
.success .mini { width: 120px; height: 160px; border-radius: var(--radius-sm); margin: 6px 0; position: relative; overflow: hidden; }
.success .actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 18px; }
.success .actions .btn-primary { width: 100%; }
.success .actions .ghost { height: 48px; font-weight: 600; font-size: 16px; color: var(--accent-ink, var(--accent)); }

.toast { position: absolute; z-index: 70; left: 50%; top: 62px; transform: translate(-50%, -12px); max-width: 320px; padding: 10px 16px; border-radius: 20px; background: var(--toast-bg, oklch(20% 0 0 / .92)); color: #fff; font-size: 14px; font-weight: 500; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.row-head .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-head .val { flex: none; white-space: nowrap; }
