@font-face { font-family: Barlow; src: url("/assets/fonts/barlow-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Barlow; src: url("/assets/fonts/barlow-600.woff2") format("woff2"); font-weight: 600 900; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/assets/fonts/barlow-condensed-800.woff2") format("woff2"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: Caveat; src: url("/assets/fonts/caveat-latin-500.woff2") format("woff2"); font-style: normal; font-weight: 500; font-display: swap; }

@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-ExtraBold.ttf') format('truetype'); font-weight: 800; }
@font-face { font-family: 'Bebas Neue'; src: url('/fonts/BebasNeue-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Anton'; src: url('/fonts/Anton-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: 'Poppins'; src: url('/fonts/Poppins-Bold.ttf') format('truetype'); font-weight: 700; }
@font-face { font-family: 'Bangers'; src: url('/fonts/Bangers-Regular.ttf') format('truetype'); font-weight: 400; }

:root {
  --font-display: "Barlow Condensed", sans-serif;
  --font-body: Barlow, system-ui, sans-serif;
  --bg: #0b0c0a;
  --paper: #f1f0e8;
  --acid: #caff32;
  --acid-hover: #e1ff95;
  --muted: #a8aaa1;
  --line: #35382f;
  --workspace: #11130f;
  --field: #161a11;
  --surface: #151713;
  --clip-paper: #d7ddc5;
  --clip-ink: #171b11;
  --ink: #101307;
  --gutter: clamp(20px, 4.4vw, 84px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  /* Aliases so existing rules keep working */
  --text: var(--paper);
  --panel: var(--workspace);
  --panel-2: var(--field);
  --accent: var(--acid);
  --good: var(--acid);
  --danger: #caff32;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--paper);
  font: 400 15px/1.4 var(--font-body);
}
button, input { font: inherit; }
a { color: var(--paper); text-decoration: none; }
a:hover { color: var(--acid); }

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 100;
  background: var(--acid);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 2px;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 90px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; gap: 10px; align-items: center; color: inherit; flex-shrink: 0; }
.brand:hover { color: inherit; }
.brand-logo { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; }
.wordmark {
  display: block;
  font: 800 26px/1 var(--font-display);
  letter-spacing: 0.025em;
  color: var(--paper);
}
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; font-weight: 400; max-width: 42ch; }
.studio-nav { display: flex; gap: 22px; align-items: center; margin-left: auto; }
.studio-nav a { font-size: 15px; color: #cccfc3; }
.studio-nav a:hover, .studio-nav a:focus-visible { color: var(--acid); }
.top-actions { display: flex; gap: 10px; flex-shrink: 0; }

.btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border: 1px solid #565b4d;
  border-radius: 2px;
  background: transparent;
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:hover:not(:disabled) { background: #262b20; border-color: var(--paper); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible, .chip:focus-visible, .clip-card:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 2px;
}
.btn.btn-primary, .btn.primary, .btn.good {
  color: var(--ink);
  background: var(--acid);
  border-color: var(--acid);
}
.btn.btn-primary:hover:not(:disabled),
.btn.primary:hover:not(:disabled),
.btn.good:hover:not(:disabled) {
  background: var(--acid-hover);
  border-color: var(--acid-hover);
  color: var(--ink);
}
.btn.ghost { background: transparent; }

.layout {
  display: grid;
  grid-template-columns: 260px minmax(360px, 1fr) 340px;
  gap: 16px;
  padding: 16px 24px 24px;
  height: calc(100vh - 90px);
}
.pane {
  background: var(--workspace);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 16px;
  overflow: auto;
}
.pane h2 {
  margin: 18px 0 8px;
  font: 800 15px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.pane h2:first-child { margin-top: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.clip-list { display: flex; flex-direction: column; gap: 8px; }
.clip-card {
  text-align: left;
  width: 100%;
  background: var(--field);
  border: 1px solid var(--line);
  color: inherit;
  border-radius: 2px;
  padding: 10px 12px;
  cursor: pointer;
}
.clip-card.active {
  border-color: var(--acid);
  box-shadow: inset 3px 0 0 var(--acid);
}
.clip-card .name { font-weight: 600; }
.clip-card .meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.badge {
  display: inline-block;
  background: var(--field);
  color: var(--acid);
  border: 1px solid var(--acid);
  border-radius: 2px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 6px;
}

.stage { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.phone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: var(--workspace);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.viewport {
  position: relative;
  aspect-ratio: 9/16;
  height: min(72vh, 820px);
  width: auto;
  max-width: 100%;
  background: #000;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--line);
}
.viewport video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; }
#bgVideo { filter: blur(18px) saturate(1.1); transform: scale(1.15); opacity: 0; }
.viewport[data-layout="podcast_blur_fit"] #bgVideo { opacity: 1; }
.viewport[data-layout="podcast_blur_fit"] #fgVideo { object-fit: contain; object-position: center; }
.viewport[data-grade="warm"] { filter: contrast(1.05) saturate(1.08) sepia(.12); }
.viewport[data-grade="cool"] { filter: contrast(1.04) saturate(.95) hue-rotate(8deg); }
.viewport[data-grade="contrast"] { filter: contrast(1.16) saturate(1.1); }
.viewport[data-grade="film"] { filter: contrast(1.08) saturate(.86) sepia(.18); }
.viewport[data-grade="vivid"] { filter: contrast(1.14) saturate(1.28); }
.viewport.punch #fgVideo, .viewport.punch #bgVideo { transform: scale(1.12); transition: transform 90ms ease-out; }
#fgVideo { transition: transform 180ms ease-out; }

.captions {
  position: absolute; left: 6%; right: 6%; text-align: center; z-index: 3;
  font-weight: 800; line-height: 1.05; letter-spacing: -.02em; pointer-events: none;
  -webkit-text-stroke: 0;
}
.captions[data-pos="top"] { top: 14%; }
.captions[data-pos="center"] { top: 44%; }
.captions[data-pos="lower"] { bottom: 16%; }
.captions[data-pos="bottom"] { bottom: 8%; }
.captions span { display: inline; padding: 0 .08em; }
.captions.boxed { padding: 10px 14px; border-radius: 2px; width: fit-content; max-width: 88%; margin: 0 auto; }
.captions[data-motion="pop"].on { animation: pop .12s ease-out; }
.captions[data-motion="bounce"].on { animation: bounce .16s ease-out; }
.captions[data-motion="slide"].on { animation: slide .18s ease-out; }
.captions[data-motion="shake"].on { animation: shake .16s steps(2); }
@keyframes pop { from { transform: scale(.86); } to { transform: scale(1); } }
@keyframes bounce { 0% { transform: scale(.8, 1.2); } 60% { transform: scale(1.08, .92); } 100% { transform: scale(1); } }
@keyframes slide { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(2deg); } 75% { transform: rotate(-2deg); } }

.title-card {
  position: absolute; top: 7%; left: 6%; right: 6%; z-index: 4; text-align: center;
  font-weight: 800; font-size: 34px; line-height: 1.05; padding: 12px 14px; border-radius: 2px;
  background: rgba(0,0,0,.72);
  font-family: var(--font-display);
}
.sticker { position: absolute; right: 8%; top: 28%; font-size: 64px; z-index: 4; filter: drop-shadow(0 6px 0 #000); }
.progress-bar { position: absolute; top: 0; left: 0; right: 0; height: 8px; background: rgba(255,255,255,.15); z-index: 5; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--acid); }
.hidden { display: none !important; }

.transport { width: min(420px, 100%); padding: 12px 0 0; }
.transport input[type=range] { width: 100%; }
.times {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  color: var(--muted); font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px;
}
.times input {
  width: 64px; background: var(--field); color: var(--paper);
  border: 1px solid var(--line); border-radius: 2px; padding: 4px 6px;
}
.status { min-height: 1.4em; color: var(--muted); text-align: center; }

.controls .group { margin: 0 0 14px; }
.label {
  display: block; color: var(--muted); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px;
  font-weight: 600;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--paper);
  border-radius: 2px;
  padding: 7px 11px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}
.chip.on { background: var(--acid); color: var(--ink); border-color: var(--acid); }
.colours { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.colours input { width: 100%; height: 36px; border: none; background: transparent; }
.row { display: flex; gap: 10px; }
.row label, .stack { display: flex; flex-direction: column; gap: 4px; flex: 1; color: var(--muted); font-size: 11px; }
input[type=range] { width: 100%; }
.toggles { display: flex; flex-direction: column; gap: 7px; margin: 0 0 12px; }
.toggles label { color: var(--paper); }
.stack input[type=text], .save-row input {
  background: var(--field);
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 13px 15px;
  width: 100%;
}
.template-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.template-item { display: flex; gap: 6px; }
.template-item button.use { flex: 1; text-align: left; }
.save-row { align-items: center; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .viewport { height: 62vh; }
  .topbar { flex-wrap: wrap; min-height: 0; height: auto; }
  .brand-logo { width: 50px; height: 50px; }
  .studio-nav { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
