/* ── Manifesto Film ───────────────────────────────────────────────────────
   Authoring space is a fixed 1920×1080 stage. Everything on it is laid out in
   film pixels; the stage is CSS-scaled to fit whatever viewport it lands in,
   so a frame grabbed headless at 1920×1080 is the same frame you scrub here. */

@font-face { font-family: Selecta; src: url('fonts/Selecta-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: block; }
@font-face { font-family: Selecta; src: url('fonts/Selecta-Italic.woff2')  format('woff2'); font-weight: 400; font-style: italic;  font-display: block; }
@font-face { font-family: Selecta; src: url('fonts/Selecta-Medium.woff2')  format('woff2'); font-weight: 500; font-style: normal; font-display: block; }
@font-face { font-family: Selecta; src: url('fonts/Selecta-Bold.woff2')    format('woff2'); font-weight: 700; font-style: normal; font-display: block; }
@font-face { font-family: Kalice;  src: url('fonts/Kalice-Regular.woff2')  format('woff2'); font-weight: 400; font-style: normal; font-display: block; }

/* Wabi surround: warm paper, mistwater accent, glass chrome. The film itself
   is #f0f0f0, so the room it sits in is warmer and a shade deeper — otherwise
   the frame edge disappears and you can't see what you're cutting. */
:root {
  --paper: #f0f0f0;
  --ink:   #191919;
  --ghost: #bcbcbc;
  --mark:  #fae185;

  --room:   #e7e2d8;
  --room-2: #dbd5c8;
  --tx:     #262320;
  --dim:    #8a8378;
  --mist:   #8fb2c6;
  --mist-d: #5d8ba6;
  --glass:      rgba(255,255,255,.52);
  --glass-hi:   rgba(255,255,255,.86);
  --glass-line: rgba(255,255,255,.72);
  --sunk:   rgba(120,108,92,.13);
  --ed-h:   150px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--tx);
  background:
    radial-gradient(120% 90% at 50% -10%, #f4f1ea 0%, rgba(244,241,234,0) 60%),
    radial-gradient(90% 70% at 88% 108%, rgba(143,178,198,.24) 0%, rgba(143,178,198,0) 62%),
    var(--room);
  font-family: Selecta, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.012em;
  overflow: hidden; -webkit-font-smoothing: antialiased;
}

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ── header ────────────────────────────────────────────────────────────── */
#bar {
  flex: none; height: 52px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none;
}
.brand { display: flex; align-items: baseline; gap: 9px; }
.brand-mark { width: 24px; height: auto; align-self: center; transform: rotate(6deg); }
.brand-t { font-family: Kalice, serif; font-size: 20px; letter-spacing: -0.01em; color: var(--tx); }
.brand-s { font-size: 12px; color: var(--dim); letter-spacing: 0.02em; }
.keys { font-size: 11.5px; color: var(--dim); display: flex; align-items: center; gap: 5px; }
.keys span { opacity: .45; }
.keys kbd {
  font: inherit; font-size: 10.5px; padding: 2.5px 6px; border-radius: 6px;
  background: var(--glass); border: 1px solid var(--glass-line);
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 1px 2px rgba(80,70,55,.10);
  color: #55504a;
}

/* ── stage ─────────────────────────────────────────────────────────────── */
#viewport {
  flex: 1; position: relative; display: grid; place-items: center;
  min-height: 0; padding: 4px 18px 12px;
}
#stage {
  width: 1920px; height: 1080px; flex: none;
  transform-origin: center center;
  position: relative; overflow: hidden;
  background: var(--paper);
  border-radius: 3px;
  box-shadow: 0 30px 70px rgba(72,62,48,.22), 0 6px 18px rgba(72,62,48,.12),
              0 0 0 1px rgba(120,108,92,.14);
}
#film { position: absolute; inset: 0; }

/* clean mode: stage fills the window, no chrome */
body.clean { background: #000; }
body.clean #editor, body.clean #bar { display: none; }
body.clean #viewport { padding: 0; }
body.clean #stage { box-shadow: none; border-radius: 0; }

/* export mode: exactly 1920×1080, nothing else, no scaling */
body.export { background: #000; overflow: hidden; }
body.export #editor, body.export #bar { display: none; }
body.export #viewport { padding: 0; display: block; }
body.export #stage { transform: none !important; position: fixed; top: 0; left: 0; box-shadow: none; border-radius: 0; }

/* ── scenes ────────────────────────────────────────────────────────────── */
.scene {
  position: absolute; inset: 0;
  background: var(--paper);
  isolation: isolate;            /* so multiply-blend chroma layers hit this bg */
  will-change: opacity;
  contain: strict;
}
.scene.hidden { display: none; }

/* a positioned text block. With no explicit y it flex-centres in the frame,
   so a two-line paragraph and a one-line title both sit on the same optical
   centre without hand-computing tops per scene. */
.blk { position: absolute; left: 0; right: 0; will-change: transform, opacity; }
.blk.mid { top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; }
.blk.mid.al-l { justify-content: flex-start; }
.blk.al-c { text-align: center; }
.blk.al-l { text-align: left; }
.blk-in { display: inline-block; position: relative; text-align: inherit; }

.ln {
  font-family: Selecta; font-weight: 400; color: var(--ink);
  letter-spacing: -0.03em; line-height: 1.28;
  margin: 0; position: relative;
}
.ln.kalice { font-family: Kalice; letter-spacing: -0.02em; line-height: 0.99; }
.ln.med { font-weight: 500; }

.w  { display: inline-block; position: relative; white-space: pre; will-change: filter, opacity, transform; }
.w.it { font-style: italic; }
.w.md { font-weight: 500; }
.w.bd { font-weight: 700; }

/* decoration overlays (marker / strike / circle) sit over a word run */
.deco { position: absolute; pointer-events: none; overflow: hidden; }
.deco-fill {
  display: block; height: 100%; max-width: none;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
.deco.mark   { z-index: 0; }
.deco.strike { z-index: 3; }
.deco.circle { z-index: 3; }
.deco.uline  { z-index: 3; }
.w-run { position: relative; display: inline-block; }
.w-run > .w { z-index: 2; }

/* ── media / imagery ───────────────────────────────────────────────────── */
.obj { position: absolute; will-change: transform, opacity; }
.obj img, .obj video { display: block; width: 100%; height: 100%; object-fit: contain; }

.appicon { position: absolute; border-radius: 22.4%; overflow: hidden;
  box-shadow: 0 33px 20px rgba(0,0,0,.10), 0 15px 15px rgba(0,0,0,.17), 0 4px 8px rgba(0,0,0,.20); }
.appicon img { width: 100%; height: 100%; object-fit: cover; }

.card { position: absolute; will-change: transform, opacity; }
.card img { width: 100%; height: auto; display: block; }

.vidwrap { position: absolute; will-change: transform, opacity; }
.vidwrap .chrome { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.vidwrap .screen { position: absolute; overflow: hidden; z-index: 1; background: #000; }
.vidwrap .screen video { width: 100%; height: 100%; object-fit: cover; }

/* wabi 5-circle mark */
.wmark { position: absolute; }
.wmark span { position: absolute; border-radius: 50%; background: var(--ink); }

/* title-safe guides */
#stage.guides::after {
  content: ''; position: absolute; inset: 5% 5%; z-index: 999; pointer-events: none;
  outline: 1px dashed rgba(255,0,80,.5);
  box-shadow: inset 0 0 0 1px rgba(255,0,80,.14);
}
#stage.guides::before {
  content: ''; position: absolute; inset: 10% 10%; z-index: 999; pointer-events: none;
  outline: 1px dashed rgba(0,160,255,.45);
}

/* ── editor chrome: one frosted glass slab floating on the paper ───────── */
#editor {
  flex: none; height: var(--ed-h); margin: 0 14px 14px;
  padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 11px;
  user-select: none;
  border-radius: 20px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(26px) saturate(1.7);
  -webkit-backdrop-filter: blur(26px) saturate(1.7);
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 -1px 0 rgba(255,255,255,.35) inset,
              0 18px 44px rgba(72,62,48,.16), 0 3px 10px rgba(72,62,48,.08);
}
.ed-row { display: flex; align-items: center; gap: 8px; }
.ed-spacer { flex: 1; }

/* glass pill, after the manifesto's own glassmorphic button */
.ed-btn {
  height: 36px; min-width: 36px; padding: 0 13px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,.44));
  color: #3a352f; border: 1px solid rgba(255,255,255,.85);
  font: inherit; font-size: 12.5px; letter-spacing: -0.012em; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 1px 0 rgba(255,255,255,.95) inset, 0 -1px 2px rgba(120,108,92,.10) inset,
              0 2px 5px rgba(80,70,55,.10);
  transition: transform .14s cubic-bezier(.25,1,.5,1), box-shadow .14s ease, background .14s ease;
}
.ed-btn:hover { background: linear-gradient(180deg, #fff, rgba(255,255,255,.6)); transform: translateY(-1px); }
.ed-btn:active { transform: translateY(.5px) scale(.985); }
.ed-btn svg { width: 17px; height: 17px; fill: currentColor; }
.ed-btn.on {
  background: linear-gradient(180deg, var(--mist), var(--mist-d));
  border-color: rgba(255,255,255,.55); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.45) inset, 0 3px 8px rgba(93,139,166,.34);
}
.ed-play {
  width: 46px; color: #fff; border-color: rgba(255,255,255,.5);
  background: linear-gradient(180deg, #2c2926, #191614);
  box-shadow: 0 1px 0 rgba(255,255,255,.28) inset, 0 3px 9px rgba(40,34,28,.30);
}
.ed-play:hover { background: linear-gradient(180deg, #3a3632, #211d1a); }
.ed-play .i-pause { display: none; }
body.playing .ed-play .i-play  { display: none; }
body.playing .ed-play .i-pause { display: block; }

.ed-time { font-variant-numeric: tabular-nums; font-size: 13px; margin-left: 8px; color: #4a453f; }
.ed-dim { color: var(--dim); }

.ed-field {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 13px;
  background: rgba(255,255,255,.44); border: 1px solid rgba(255,255,255,.8);
  border-radius: 999px; font-size: 12.5px;
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset;
}
.ed-sc { color: var(--dim); max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-field input {
  width: 52px; background: transparent; border: 0; color: var(--tx);
  font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: right; outline: none;
  -moz-appearance: textfield;
}
.ed-field input::-webkit-outer-spin-button, .ed-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ed-unit { color: var(--dim); }

/* timeline — a sunken well in the glass */
.ed-track {
  position: relative; flex: 1; height: 56px;
  background: var(--sunk);
  border-radius: 13px; overflow: hidden; cursor: text;
  box-shadow: 0 2px 5px rgba(100,88,72,.14) inset, 0 -1px 0 rgba(255,255,255,.65) inset;
}
.ed-clips { position: absolute; inset: 3px; display: flex; gap: 2px; }
.clip {
  position: relative; height: 100%; min-width: 0; flex: none;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(255,255,255,.80), rgba(255,255,255,.52));
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 1px 3px rgba(90,78,62,.10);
  display: flex; align-items: center; padding: 0 9px; overflow: hidden; cursor: pointer;
  transition: background .12s ease, box-shadow .12s ease;
}
.clip:hover { background: linear-gradient(180deg, #fff, rgba(255,255,255,.68)); }
.clip.act {
  background: linear-gradient(180deg, rgba(143,178,198,.60), rgba(143,178,198,.36));
  box-shadow: 0 0 0 1.5px var(--mist-d) inset, 0 1px 0 rgba(255,255,255,.6) inset;
}
/* the film's dark section reads dark in the timeline too */
.clip.dark {
  background: linear-gradient(180deg, rgba(38,35,32,.86), rgba(38,35,32,.70));
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 1px 3px rgba(50,42,34,.20);
}
.clip.dark b { color: #e8e3da; }
.clip.dark i { color: rgba(232,227,218,.6); }
.clip.dark.act { box-shadow: 0 0 0 1.5px var(--mist) inset; }
.clip b {
  font-weight: 400; font-size: 10.5px; color: #4b463f;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.clip i {
  position: absolute; right: 7px; bottom: 4px; font-style: normal; font-size: 9px;
  color: var(--dim); font-variant-numeric: tabular-nums; pointer-events: none;
}
.clip .grip {
  position: absolute; top: 0; right: -3px; width: 8px; height: 100%; cursor: col-resize; z-index: 4;
  border-radius: 4px;
}
.clip .grip:hover { background: var(--mist-d); opacity: .5; }

.ed-playhead {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, #e2603a, #c8451f);
  pointer-events: none; z-index: 5;
  box-shadow: 0 0 0 1px rgba(255,255,255,.5), 0 0 8px rgba(226,96,58,.55);
}
.ed-playhead::before {
  content: ''; position: absolute; top: -1px; left: 50%; width: 9px; height: 9px;
  transform: translateX(-50%) rotate(45deg); background: #d4512b; border-radius: 2px;
}
