/* base: the page, type, the top bar (the homepage's nav), buttons, the prompt bar, fields, and the dark
   frames every screen shows motion graphics in. Tokens: tokens.css. */

/* ================================================================ page */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: rgba(255, 61, 139, .2); }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; }
input, textarea { caret-color: var(--pink); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 99; padding: 9px 14px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }
main:focus { outline: none; }
.mono { font-family: var(--font); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.muted { color: var(--ink-2); }
.ico { display: inline-flex; line-height: 0; }
.wrap { width: min(1200px, 100% - 40px); margin: 0 auto; padding: 40px 0 96px; }
.screen { animation: screenIn .45s var(--ease) both; }
@keyframes screenIn { from { opacity: 0; } }
.wi { display: inline-block; }
kbd {
  display: inline-block; min-width: 20px; padding: 3px 5px; text-align: center; color: var(--ink-2);
  font: 550 11.5px/1 var(--font); background: #fff; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px;
}
.empty-state { padding-top: 12vh; display: grid; gap: 14px; justify-items: start; }

/* ================================================================ top bar: the homepage's nav */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--bar-h); display: flex; align-items: center; gap: 32px;
  padding: 0 max(20px, calc((100vw - 1200px) / 2)); background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.wordmark { display: inline-flex; align-items: center; gap: 9px; flex: none; color: var(--ink); text-decoration: none; font-weight: 650; font-size: 19px; letter-spacing: -.02em; }
.wm { display: inline-flex; align-items: center; gap: 9px; } /* the homepage's 5 px between the two diamonds */
.wm i { width: 9px; height: 9px; background: var(--ink); transform: rotate(45deg); display: inline-block; }
.wm i + i { margin-left: -4px; background: var(--pink); }
.mainnav { display: flex; gap: 26px; margin-right: auto; }
.mainnav a { text-decoration: none; color: var(--ink-2); font-size: 15px; transition: color var(--dur-fast); }
.mainnav a:hover, .mainnav a[aria-current="page"] { color: var(--ink); }
.top-cta { flex: none; }
/* the tools run edge to edge, so their bar does too, and always carries its hairline */
body[data-route="edit"] .topbar, body:has(.gen) .topbar { padding: 0 20px; border-bottom-color: var(--line); }

/* ================================================================ buttons (the homepage's pills) */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-3);
  font: 550 15px/1 var(--font); color: var(--ink); background: #fff; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .15s var(--ease), background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
/* the main action is pink */
.btn.primary { background: var(--pink); color: var(--pink-ink); border-color: var(--pink); }
.btn.primary:hover { background: var(--pink-hover); border-color: var(--pink-hover); }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.dark:hover { background: #26262b; border-color: #26262b; }
.btn.ghost { background: #fff; }
.btn.sm { min-height: 32px; padding: 0 13px; font-size: 13.5px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn .ico svg { width: 18px; height: 18px; }
.btn.sm .ico svg { width: 16px; height: 16px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; cursor: pointer; color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: 999px;
  transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform .15s var(--ease);
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn[aria-pressed="true"] { color: var(--pink); border-color: rgba(255, 61, 139, .45); background: var(--pink-soft); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.icon-btn:disabled:hover { border-color: var(--line-2); }
.chip-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px 0 11px; cursor: pointer;
  font: 500 14px/1 var(--font); color: var(--ink-2); background: #fff; border: 1px solid var(--line-2); border-radius: 999px;
  transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform .15s var(--ease);
}
.chip-btn:hover { color: var(--ink); border-color: var(--ink); }
.chip-btn:active { transform: scale(.97); }
.chip-btn[aria-pressed="true"] { color: var(--pink); border-color: rgba(255, 61, 139, .45); background: var(--pink-soft); }

/* ================================================================ type */
.headline { margin: 0; text-wrap: balance; font: 700 clamp(34px, 5.2vw, 64px)/1.04 var(--font); letter-spacing: -.035em; }
.headline.sm { font-size: clamp(30px, 3.6vw, 46px); }
.headline .w { display: inline-block; animation: wordIn .6s var(--ease) both; }
@keyframes wordIn { from { opacity: 0; filter: blur(6px); transform: translateY(10px); } }
.lede { margin: 16px 0 0; max-width: 52ch; color: var(--ink-2); font-size: clamp(16px, 1.5vw, 19px); line-height: 1.55; text-wrap: pretty; }
.eyebrow { display: block; margin: 0 0 12px; color: var(--pink); font: 600 13px/1 var(--font); letter-spacing: .01em; }

/* ================================================================ the prompt bar (the homepage's .bar) */
.pbar {
  position: relative; display: flex; align-items: center; gap: 12px; width: min(680px, 100%); height: 64px; margin: 0 auto;
  padding: 0 10px 0 18px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-bar); text-align: left;
  box-shadow: var(--shadow-bar); transition: border-color .2s, box-shadow .2s;
}
.pbar:focus-within { border-color: #c9c9d1; box-shadow: 0 0 0 4px var(--pink-ring), 0 12px 32px -14px rgba(15, 15, 30, .18); }
.pbar-mark { display: inline-flex; align-items: center; flex: none; }
.pbar-mark i { width: 10px; height: 10px; background: var(--ink); transform: rotate(45deg); }
.pbar-mark i + i { margin-left: -4px; background: var(--pink); }
.pbar input[type], .pbar input[type]:hover, .pbar input[type]:focus-visible {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; box-shadow: none; background: transparent;
  font: 450 18px/1.2 var(--font); color: var(--ink);
}
.pbar input::placeholder { color: var(--ink-3); }
.pbar-go {
  flex: none; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: var(--pink); color: #fff;
  display: grid; place-items: center; cursor: pointer; transition: transform .15s var(--ease), background .15s;
}
.pbar-go svg { width: 20px; height: 20px; }
.pbar-go:hover { background: var(--pink-hover); }
.pbar-go:active { transform: scale(.9); }
.pbar-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 450 16px/1.3 var(--font); color: var(--ink); }

/* ================================================================ dark frames (motion graphics live in these) */
.stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--frame-r); background: var(--frame); box-shadow: var(--frame-shadow); }
iframe.anim {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block;
  background: transparent; color-scheme: normal; pointer-events: none; transition: opacity .35s var(--ease);
}
iframe.anim.pending { opacity: 0; }
.stage-msg {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 4; padding: 10px 12px; font-size: 14px;
  background: #fff; color: var(--err); border: 1px solid rgba(229, 72, 77, .35); border-radius: var(--r-control);
}
/* backdrops behind a transparent template: studio (default, painted by backdrop.js), checker, footage, light */
.bg-studio, .live { background-color: var(--frame); background-image: radial-gradient(120% 95% at 50% 28%, #1b2130 0%, #0b0f18 58%, #05080f 100%); }
.bg-checker {
  background-color: #1e1f23;
  background-image: conic-gradient(#2a2b30 25%, transparent 0 50%, #2a2b30 0 75%, transparent 0); background-size: 24px 24px;
}
.bg-footage {
  background:
    radial-gradient(55% 75% at 80% 34%, rgba(236, 148, 92, .42), transparent 62%),
    radial-gradient(45% 60% at 12% 74%, rgba(84, 124, 196, .30), transparent 66%),
    linear-gradient(172deg, #212A3B 0%, #282834 56%, #16151A 100%);
}
/* a light plate, for checking a graphic against bright footage */
.bg-paper { background: #e9eaee; color: #55575f; }
/* a template that does not exist yet: an empty dark frame with a wireframe of what it will be */
.sketch-media { background: var(--frame); color: rgba(255, 255, 255, .34); }
.still { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, .34); transition: opacity .4s var(--ease); }
.still.hidden { opacity: 0; pointer-events: none; }
.still img { width: 100%; height: 100%; object-fit: cover; }
.still .sketch { width: 72%; height: 72%; }
.broken::after {
  content: 'Preview failed'; position: absolute; left: 10px; bottom: 10px; z-index: 3; padding: 5px 9px; border-radius: 999px;
  font: 600 12px/1 var(--font); color: var(--err); background: #fff;
}
/* Opus 5.5's name tag: the only yellow in the app */
.cursor-tag {
  display: inline-block; padding: 4px 8px; border-radius: 5px 5px 5px 2px; background: var(--opus); color: var(--ink); white-space: nowrap;
  font: 650 12px/1 var(--font);
}

/* ================================================================ fields */
input[type="text"], input[type="search"], input[type="number"], textarea, select {
  width: 100%; height: 42px; padding: 0 13px; color: var(--ink); background: #fff;
  font: 450 15px/1.3 var(--font); border: 1px solid var(--line-2); border-radius: var(--r-control);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
textarea { height: auto; padding: 10px 13px; resize: vertical; min-height: 76px; line-height: 1.45; }
::placeholder { color: var(--ink-3); opacity: 1; }
input:hover, textarea:hover, select:hover { border-color: var(--line-3); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-ring); }
input[aria-invalid="true"] { border-color: var(--err); }
input[type="range"] { width: 100%; accent-color: var(--pink); margin: 4px 0; }
input[type="color"] { width: 42px; height: 42px; padding: 0; flex: none; cursor: pointer; background: none; border: 0; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(0, 0, 0, .1); border-radius: 50%; }
input[type="color"]::-moz-color-swatch { border: 1px solid rgba(0, 0, 0, .1); border-radius: 50%; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.field { margin: 0 0 16px; }
.f-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.f-label { display: block; color: var(--ink); font: 550 14px/1.25 var(--font); }
.field > .f-label { margin-bottom: 8px; }
.f-count, .f-value { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.f-count.full { color: var(--err); }
.field.inline .f-head { margin-bottom: 0; }
.f-help { font-size: 13px; line-height: 1.45; color: var(--ink-3); margin: 7px 0 0; }
.color-row { display: flex; gap: 8px; }
.color-row .hex { font-variant-numeric: tabular-nums; text-transform: uppercase; }
.image-row { display: flex; align-items: center; gap: 10px; }
.drop {
  flex: 1; display: flex; align-items: center; gap: 12px; padding: 8px; cursor: pointer; font-size: 14px; color: var(--ink-2);
  border: 1px dashed var(--line-3); border-radius: 12px; transition: border-color var(--dur-fast), color var(--dur-fast), background-color var(--dur-fast);
}
.drop:hover, .drop.over { border-color: var(--pink); color: var(--ink); background: var(--pink-soft); }
.image-row input:focus-visible + .drop { outline: 2px solid var(--pink); outline-offset: 2px; }
.thumb {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center; overflow: hidden; color: var(--ink-3);
  border-radius: 9px; background: var(--soft); border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.switch {
  position: relative; flex: none; width: 40px; height: 24px; padding: 0; cursor: pointer;
  background: #e4e4e7; border: 0; border-radius: 12px; transition: background-color .2s;
}
.knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .22); transition: transform .25s var(--ease);
}
.switch[aria-checked="true"] { background: var(--pink); }
.switch[aria-checked="true"] .knob { transform: translateX(16px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
/* segmented control: a soft track, the chosen option a raised white chip */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; }
.seg label { position: relative; display: block; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span {
  display: block; padding: 7px 12px; border-radius: 9px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
  font: 500 14px/1.15 var(--font); transition: color var(--dur-fast), background-color var(--dur-fast), box-shadow var(--dur-fast);
}
.seg label:hover span { color: var(--ink); }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15, 15, 30, .08), 0 0 0 1px rgba(15, 15, 30, .06); }
.seg input:focus-visible + span { outline: 2px solid var(--pink); outline-offset: 1px; }
.seg.small span { padding: 5px 10px; font-size: 13px; }
/* schema-driven control groups (controls.js) */
.controls .group { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 16px 0 4px; min-width: 0; }
.controls legend { padding: 0; color: var(--ink); font: 600 14px/1 var(--font); }
.controls .group > .field:first-of-type { margin-top: 12px; }
.list-rows { display: grid; gap: 6px; margin-bottom: 6px; }
.list-row { display: flex; align-items: center; gap: 6px; }
.row-n { width: 16px; flex: none; font-size: 12px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.cell { min-width: 0; }
.cell.txt { flex: 2; }
.cell.num { flex: 1; }
.add { margin-top: 2px; }
.add .ico svg { width: 16px; height: 16px; }

/* ================================================================ the beta: a compact email / code bar (beta.js) */
.wl { width: 100%; }
.wl-bar {
  display: flex; align-items: center; gap: 6px; width: 100%; height: 46px; padding: 0 4px 0 12px; background: #fff;
  border: 1px solid var(--line-2); border-radius: 14px; transition: border-color .2s, box-shadow .2s;
}
.wl-bar:focus-within { border-color: #c9c9d1; box-shadow: 0 0 0 4px var(--pink-ring); }
.wl-bar:has(input[aria-invalid="true"]) { border-color: var(--err); }
.wl-bar input[type], .wl-bar input[type]:hover, .wl-bar input[type]:focus-visible {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; box-shadow: none; background: transparent;
  font: 450 15px/1.2 var(--font); color: var(--ink);
}
.wl-bar .btn { flex: none; min-height: 36px; }
.wl-msg { margin: 7px 2px 0; font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.wl-msg:empty { display: none; }
.wl-msg.err { color: var(--err); }
.wl-done { display: flex; align-items: flex-start; gap: 9px; margin: 0; padding: 11px 13px; border-radius: 14px; background: var(--soft); font-size: 14px; line-height: 1.45; color: var(--ink); }
.wl-done i { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--pink); }

/* ================================================================ footer (the homepage's) */
.app-foot {
  display: flex; align-items: center; gap: 26px; width: min(1200px, 100% - 40px); margin: 0 auto; padding: 28px 0 40px;
  border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-2);
}
.app-foot .wordmark { margin-right: auto; font-size: 16px; }
.app-foot a { text-decoration: none; }
.app-foot a:hover { color: var(--ink); }
body[data-route="edit"] .app-foot, body:has(.gen) .app-foot { display: none; }

/* ================================================================ small screens + motion preferences */
@media (max-width: 860px) {
  .mainnav { display: none; }
  .topbar { gap: 12px; justify-content: space-between; }
  body[data-route="edit"] .topbar, body:has(.gen) .topbar { padding: 0 16px; }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 32px); padding: 24px 0 64px; }
  .topbar { padding: 0 16px; }
  .wordmark { font-size: 18px; }
  .pbar { height: 58px; padding-left: 16px; }
  .pbar input[type], .pbar input[type]:hover, .pbar input[type]:focus-visible { font-size: 16px; }
  .pbar-go { width: 40px; height: 40px; }
  .app-foot { width: calc(100% - 32px); flex-wrap: wrap; gap: 14px 22px; }
  .app-foot .wordmark { flex-basis: 100%; }
  .wl-bar input[type], .wl-bar input[type]:hover, .wl-bar input[type]:focus-visible { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
