/* Bopcat video maker: token system.

   Every color comes from Bopcat's own material, none invented:
   - plum scale: the token art's background family
   - mauve: the cat's body color
   - cream: the pale rim of the cat's eyes
   - chroma: the official green-screen clip's key color; reserved for the
     one action that "puts you inside the edit" (render, drop target)
   Type: Knewave is the display face the project's own site used; body is
   the system stack; utility is the system mono for small working labels. */

@font-face {
  font-family: "Knewave";
  src: url("../fonts/knewave-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --plum-900: #2b1226;
  --plum-700: #562941;
  --plum-500: #71435b;
  --mauve: #96666d;
  --mauve-bright: #c39aa0;
  --cream: #f2e9e4;
  --chroma: #14ff08;
  --ink: #1a0f14;
  --error: #ffb3a7;

  --font-display: "Knewave", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-utility: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, monospace;

  --radius: 12px;
  --gap: 1rem;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--plum-700);
  color: var(--cream);
  font-family: var(--font-body);
  line-height: 1.55;
}

a { color: var(--mauve-bright); }

button:focus-visible,
a:focus-visible,
.file-button:has(+ input:focus-visible) {
  outline: 3px solid var(--chroma);
  outline-offset: 2px;
}

/* ---------- header ---------- */

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--gap);
  padding: 1.1rem 1.5rem 0;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0;
  letter-spacing: 0.01em;
}

.wordmark-sub {
  font-family: var(--font-utility);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mauve-bright);
}

.top-note {
  font-family: var(--font-utility);
  font-size: 0.75rem;
  color: var(--mauve-bright);
  margin: 0;
  text-align: right;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.top-links .chip {
  text-decoration: none;
  border: 2px solid var(--mauve);
  color: var(--cream);
  font-family: var(--font-utility);
  font-size: 0.75rem;
}
.top-links .chip:hover { background: var(--cream); color: var(--plum-900); }
.top-links .chip svg { width: 0.9em; height: 0.9em; display: block; }

/* ---------- hero ---------- */

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 6.5vw, 3.4rem);
  line-height: 1.04;
  margin: 2rem 0 0.6rem;
}

h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  margin: 0 0 0.75rem;
}

.lede {
  max-width: 52ch;
  margin: 0 0 1.75rem;
  color: var(--cream);
}

/* ---------- the stage: the signature element ---------- */

.stage-wrap { margin-bottom: 1.75rem; }

.stage {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--plum-900);
  border: 3px solid var(--plum-900);
  box-shadow: 0 14px 40px rgba(26, 15, 20, 0.45);
}

/* Drag state: the stage becomes the green screen. */
.stage.dragging { border-color: var(--chroma); }
.stage.dragging::after {
  content: "Drop it";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--ink);
  background: rgba(20, 255, 8, 0.82);
  pointer-events: none;
}

.stage video {
  display: block;
  max-width: 100%;
  max-height: 62vh;
}

.preview-cat {
  position: absolute;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.preview-cat.draggable {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.preview-cat.dragging { cursor: grabbing; }

.stage-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem var(--gap);
  margin: 0.6rem auto 0;
}

.stage-hint {
  font-family: var(--font-utility);
  font-size: 0.75rem;
  color: var(--mauve-bright);
  margin: 0;
}

/* ---------- controls tray ---------- */

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.25rem var(--gap);
  align-items: start;
  background: var(--plum-500);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.25rem;
}

.control-label {
  display: block;
  font-family: var(--font-utility);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--cream);
  margin-bottom: 0.55rem;
}

.control-label em {
  font-style: normal;
  color: var(--mauve-bright);
  text-transform: none;
  letter-spacing: normal;
}

.control-note {
  font-size: 0.82rem;
  color: var(--mauve-bright);
  margin: 0.45rem 0 0;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

button, .file-button, .download {
  font: inherit;
  font-weight: 600;
  border: 2px solid var(--cream);
  border-radius: var(--radius);
  background: transparent;
  color: var(--cream);
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  display: inline-block;
  transition: background 0.12s, color 0.12s;
}

button:hover:not(:disabled), .file-button:hover {
  background: var(--cream);
  color: var(--plum-900);
}

button:disabled { opacity: 0.4; cursor: default; }
.control:has(input:disabled) .file-button { opacity: 0.4; pointer-events: none; }

.primary {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.15rem;
  background: var(--chroma);
  border-color: var(--chroma);
  color: var(--ink);
  padding: 0.55rem 1.4rem;
}

.primary:hover:not(:disabled) { background: var(--cream); border-color: var(--cream); }

.ghost {
  border-color: var(--mauve);
  color: var(--cream);
  font-weight: 400;
  font-size: 0.9rem;
}

.linklike {
  border: none;
  background: none;
  padding: 0;
  font-size: inherit;
  font-weight: 400;
  color: var(--mauve-bright);
  text-decoration: underline;
  cursor: pointer;
}
.linklike:hover:not(:disabled) { background: none; color: var(--cream); }

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}

.stepper button { min-width: 2.4rem; }

.stepper span {
  min-width: 2ch;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 400;
  padding: 0.32rem 0.7rem;
  border-color: var(--mauve);
  border-radius: 999px;
}

.chip[aria-pressed="true"] {
  border-color: var(--cream);
  background: var(--plum-900);
}

.chip-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 1px solid rgba(242, 233, 228, 0.5);
}

.control-render { grid-column: 1 / -1; }

.status {
  min-height: 1.5em;
  font-size: 0.9rem;
  margin: 0.55rem 0 0;
}

.status.error { color: var(--error); font-weight: 600; }

/* ---------- result ---------- */

.result { margin-top: 3rem; }

.result video {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  border-radius: var(--radius);
  border: 3px solid var(--plum-900);
}

.result .download {
  margin-top: 1rem;
  text-decoration: none;
}

/* ---------- how it works, footer ---------- */

.how {
  margin-top: 3.5rem;
  max-width: 62ch;
}

.how ol {
  margin: 0;
  padding-left: 1.2rem;
}

.how li { margin-bottom: 0.5rem; }
.how li::marker { font-family: var(--font-utility); color: var(--mauve-bright); }

.footer {
  padding: 2rem 1.5rem 2.5rem;
  font-size: 0.8rem;
  font-family: var(--font-utility);
  color: var(--mauve-bright);
  border-top: 2px solid var(--plum-500);
  max-width: 880px;
  margin: 0 auto;
}

.footer p { margin: 0.3rem 0; }

/* ---------- small screens ---------- */

input[type="range"] {
  width: 100%;
  max-width: 220px;
  accent-color: var(--chroma);
  margin: 0.5rem 0 0;
}

@media (max-width: 560px) {
  .top { flex-wrap: wrap; gap: 0.5rem; }
  .top-links { margin-left: 0; }
  .top-note { text-align: left; }
  main { padding: 0 1rem 3rem; }
  .controls { grid-template-columns: 1fr 1fr; padding: 1rem; }
  .control-render { grid-column: 1 / -1; }
}

/* The bop is the show; nothing else on the page moves. */
@media (prefers-reduced-motion: reduce) {
  button, .file-button { transition: none; }
}
