@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque-400_800-normal.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

/* Kawaki Studio: Motion in Type. Shared identity for public and working screens. */
:root {
  color-scheme: light;
  --ease: cubic-bezier(.22,.72,.2,1);
  --font-display: 'Bricolage Grotesque', Manrope, sans-serif;
}

html { scroll-behavior: smooth; }
body { background: var(--canvas); color: var(--text); }
a { color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* One restrained title-sequence move: the active page heading resolves into place. */
.home-heading h1, .setup-title h1, .page-heading h1, .storyboard-head h1,
.preview-top h1, .hero-copy h1, .signin-story h1 {
  animation: title-resolve 520ms var(--ease) both;
}
@keyframes title-resolve {
  from { opacity: .35; clip-path: inset(0 0 72% 0); translate: 0 12px; }
  to { opacity: 1; clip-path: inset(0 0 0 0); translate: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .home-heading h1, .setup-title h1, .page-heading h1, .storyboard-head h1,
  .preview-top h1, .hero-copy h1, .signin-story h1 { animation: none; }
}

/* The studio masthead is a stable dark frame around a warm working canvas. */
.topbar {
  min-height: 72px;
  padding-inline: clamp(18px, 3vw, 42px);
  background: var(--stage);
  color: var(--stage-text);
  border-bottom: 1px solid var(--stage-border);
}
.brand { color: var(--stage-text); letter-spacing: -.045em; }
.brand-mark { border-radius: 7px; transform: none; background: var(--accent); }
.brand-mark span { background: var(--accent-ink); }
.project-name-input { color: var(--stage-text); }
.project-name-input:hover { background: var(--stage-raised); }
.project-name-input:focus-visible { outline-color: var(--identity); }
.save-state { color: var(--identity); }
.save-state.unsaved { color: var(--accent-soft); }
.top-actions .button.secondary,
.top-actions .button.ghost,
.top-actions .button.icon {
  background: transparent;
  color: var(--stage-text);
  border-color: var(--stage-border);
}
.top-actions .button.secondary:hover:not(:disabled),
.top-actions .button.ghost:hover:not(:disabled),
.top-actions .button.icon:hover:not(:disabled) { background: var(--stage-raised); }
.connection-status { color: var(--stage-text-muted); }
.mobile-actions { color: var(--text); background: var(--surface); border-color: var(--border); }

.stepnav { position: relative; background: var(--surface); border-color: var(--border); }
.step { position: relative; z-index: 1; }
.step.active { color: var(--text); border-color: var(--accent); }
.step.active .step-index { background: var(--stage); color: var(--stage-text); }
.step.done { color: var(--success); }
.step-index { font-variant-numeric: tabular-nums; }
.step:focus-visible { z-index: 2; }

/* Display type carries the brand; working copy remains neutral and readable. */
h1, h2, h3 { color: var(--text); }
.home-heading h1 { max-width: 820px; font-size: clamp(44px, 6.2vw, 82px); line-height: .94; letter-spacing: -.075em; font-weight: 800; }
.home-heading h1, .setup-title h1, .page-heading h1, .storyboard-head h1,
.preview-top h1, .planning-page h1, .export-card h1, .hero-copy h1,
.signin-story h1, .section-intro h2, .public-closer h2, .not-found-content h1 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  text-wrap: balance;
}
.home-heading h1::after {
  display: inline-block;
  width: .14em;
  height: .14em;
  margin: 0 0 .04em .1em;
  background: var(--accent);
  content: "";
}
.home-heading p { color: var(--text-muted); max-width: 48ch; }
.setup-title h1, .page-heading h1, .storyboard-head h1, .preview-top h1,
.planning-page h1 { font-size: clamp(34px, 4.8vw, 58px); line-height: .98; letter-spacing: -.065em; font-weight: 800; }
.setup-title h1::after, .page-heading h1::after, .storyboard-head h1::after,
.preview-top h1::after {
  display: inline-block;
  width: .11em;
  height: .11em;
  margin: 0 0 .03em .1em;
  background: var(--accent);
  content: "";
}
.home, .setup-page { max-width: 1320px; }
.workspace-main { max-width: 1080px; }
.page-heading { align-items: flex-end; }
.eyebrow, .public-eyebrow { color: var(--selection); }

/* Clear surfaces and precise dividers replace competing card decoration. */
.form-card, .settings-card, .inventory-section, .export-card {
  border-radius: 5px;
  border-color: var(--border);
  box-shadow: none;
}
.form-card { background: var(--surface); }
.settings-card { background: var(--stage); color: var(--stage-text); }
.settings-card h2, .settings-card strong { color: var(--stage-text); }
.settings-card p, .settings-card small, .settings-card .field-hint { color: var(--stage-text-muted); }
.settings-card .setting-row { border-color: var(--stage-border); }
.settings-card select, .settings-card input {
  color: var(--stage-text);
  background: var(--stage-surface);
  border-color: var(--stage-border);
}
.settings-card .setup-summary { background: var(--stage-surface); color: var(--stage-text-muted); }
.settings-card .setup-summary strong { color: var(--stage-text); }
.settings-card .button.primary { background: var(--identity); border-color: var(--identity); color: var(--on-identity); }
.settings-card .button.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.field > input, .field > select, .field > textarea, .provider-row select,
.search, .input-suffix, .editor-field {
  border-radius: 4px;
  border-color: var(--border-control);
}
.field > input:focus-visible, .field > select:focus-visible, .field > textarea:focus-visible,
.search:focus-within, .editor-field:focus-within { outline-color: var(--accent); }
.choice, .palette-choice { border-radius: 4px; }
.choice.selected, .palette-choice.selected { border-color: var(--accent); background: var(--selection-surface); box-shadow: inset 0 0 0 1px var(--accent); }
.toggle.on { background: var(--selection); }
.button { border-radius: 4px; }
.button.primary { position: relative; overflow: hidden; }
.button.primary:hover:not(:disabled) { translate: 3px 0; }
.button.primary:active:not(:disabled) { translate: 0 0; }
.button.secondary { border-radius: 4px; }
.button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline-color: var(--accent); }

/* One dark working panel makes the next useful action unmistakable. */
.next-panel {
  align-self: stretch;
  background: var(--stage);
  color: var(--stage-text);
  border-left: 1px solid var(--stage-border);
}
.next-panel h2, .next-panel h3, .next-panel strong { color: var(--stage-text); }
.next-panel p, .next-panel .muted { color: var(--stage-text-muted); }
.next-panel hr { border-color: var(--stage-border); }
.next-panel .readiness-list span:not(.muted) { color: var(--identity); }
.next-panel .readiness-list .icon { color: var(--accent); }
.next-panel .button.primary { background: var(--identity); color: var(--on-identity); border-color: var(--identity); }
.next-panel .button.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.next-panel .button.secondary, .next-panel .button.ghost { color: var(--stage-text); background: transparent; border-color: var(--stage-border); }
.next-panel .button.secondary:hover:not(:disabled), .next-panel .button.ghost:hover:not(:disabled) { background: var(--stage-raised); }
.next-panel .timing-card, .next-panel .setup-summary { background: var(--stage-surface); color: var(--stage-text-muted); }
.next-panel .timing-card small { color: var(--stage-text-muted); }
.mobile-narration-next { border-color: var(--border); }

/* The library and storyboard use real project frames, never decorative mock tiles. */
.project-grid { gap: 18px; }
.new-card, .project-card { border-radius: 5px; }
.new-card { border-color: var(--border-control); color: var(--text-muted); }
.new-card:hover, .project-card:hover { border-color: var(--accent); box-shadow: 0 12px 28px var(--shadow-soft); }
.plus-tile { border-radius: 4px; background: var(--accent); color: var(--accent-ink); }
.thumbnail { border-radius: 0; }
.project-cover-title { font-weight: 800; letter-spacing: -.05em; }
.card-meta { border-top: 1px solid var(--border); }
.empty-state { border-radius: 0; }
.sheet { border-radius: 3px; }
.play-disc { border-radius: 4px; background: var(--accent); color: var(--accent-ink); }
.scene-row { border-radius: 4px; }
.scene-row.selected { background: var(--selection-surface); border-color: var(--selection); box-shadow: inset 3px 0 var(--selection); }
.scene-preview { border-radius: 4px; }
.inspector-head, .inspector-footer { border-color: var(--border); }
.preview-studio { border-radius: 4px; }
.player-area { background: var(--stage); }
.live-canvas { box-shadow: 0 18px 52px var(--shadow-strong); }
.scrubber { accent-color: var(--accent); }
.export-card.success { border-color: var(--success); }
.export-card.success:before { background: var(--identity); }

/* Public introduction: a real export is the image; title type supplies the identity. */
.public-page { background: var(--canvas); color: var(--text); }
.public-nav, .signin-nav { border-color: var(--border); }
.public-brand-mark { border-radius: 4px; transform: none; background: var(--accent); }
.public-brand-mark i { background: var(--accent-ink); }
.public-nav nav>a:first-child { color: var(--text-muted); }
.public-nav nav>a:hover, .signin-home-link:hover, .public-footer a:hover { color: var(--selection); }
.public-brand, .public-nav nav>a { transition: color 180ms var(--ease), translate 180ms var(--ease); }
.public-brand:hover { translate: 3px 0; }
.public-nav nav>a:hover { translate: 0 -2px; }
.hero-index { color: var(--text-muted); }
.public-nav-signin { min-height: 44px; padding-inline: 14px; border: 1px solid var(--border-control); border-radius: 4px; }
.hero-copy h1, .signin-story h1 { font-size: clamp(58px, 7.1vw, 104px); line-height: .91; letter-spacing: -.085em; font-weight: 800; }
.hero-copy h1 em, .section-intro h2 em, .signin-story h1 em { color: var(--selection); }
.hero-copy h1 em { position: relative; }
.hero-note { font-size: 12px; }
.hero-copy h1 em::after { position: absolute; right: 0; bottom: -.05em; left: 0; height: .055em; background: var(--accent); content: ""; transform-origin: left; animation: title-rule 620ms 250ms var(--ease) both; }
@keyframes title-rule { from { scale: 0 1; } to { scale: 1 1; } }
.public-eyebrow > span { background: var(--accent); }
.public-button { border-radius: 4px; }
.public-button.primary { box-shadow: none; }
.public-button.primary:hover { box-shadow: none; translate: 3px 0; }
.public-button.text { text-decoration: underline; text-decoration-color: var(--border-control); text-underline-offset: 5px; }
.showcase { border-radius: 4px; transform: none; box-shadow: 0 28px 70px var(--shadow-medium); }
.showcase:after { border-radius: 4px; }
.showcase-screen { border-radius: 2px; }
.showcase-format { color: var(--identity); border-radius: 2px; }
.showcase-format { font-size: 12px; }
.showcase-screen video, .showcase-poster img { image-rendering: auto; }
.screen-label { display: none; }
.poster-play { border-radius: 4px; background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.showcase-poster:hover .poster-play { background: var(--identity); }
.public-proof { background: var(--surface-subtle); border-color: var(--border); }
.public-proof i { color: var(--selection); }
.workflow-step { border-color: var(--border); }
.workflow-number { color: var(--selection); }
.workflow-step h3 { letter-spacing: -.045em; }
.public-closer { background: var(--stage); }
.public-closer h2 { color: var(--stage-text); }
.public-closer:after { display: none; }
.closer-mark { border-radius: 4px; }
.public-footer { border-color: var(--border); }
.signin-form-wrap { border-radius: 4px; box-shadow: 0 20px 55px var(--shadow-soft); }
.signin-story h1 { font-size: clamp(45px, 5.3vw, 76px); }
.signin-form-wrap .public-button, .ml-clerk-primary { border-radius: 4px !important; }
.signin-private span { color: var(--success); }
.not-found-content { max-width: 1180px; min-height: calc(100vh - 155px); margin: auto; padding: clamp(70px, 12vw, 150px) clamp(22px, 7vw, 108px); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.not-found-index { margin: 0 0 26px; color: var(--text-muted); font: 12px "DM Mono", monospace; letter-spacing: .08em; }
.not-found-content h1 { max-width: 900px; margin: 0; font-size: clamp(54px, 9vw, 112px); line-height: .94; letter-spacing: -.08em; }
.not-found-content h1 span { color: var(--accent); }
.not-found-content > p:not(.not-found-index) { max-width: 48ch; margin: 26px 0 28px; color: var(--text-muted); font-size: 16px; line-height: 1.6; }

@media (max-width: 900px) {
  .next-panel { border-top: 1px solid var(--stage-border); border-left: 0; }
}
@media (max-width: 760px) {
  .topbar { background: var(--stage); }
  .home-heading h1 { font-size: clamp(42px, 11vw, 62px); }
  .home-heading { align-items: flex-start; }
  .home-heading > .button { flex-shrink: 0; }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .thumbnail { height: 250px; }
  .next-panel { padding: 27px 20px 36px; }
  .public-hero { gap: 32px; }
  .hero-copy h1 { font-size: clamp(52px, 13vw, 72px); }
  .showcase { transform: none; }
  .signin-story h1 { font-size: clamp(42px, 10vw, 58px); }
  .not-found-content { min-height: calc(100svh - 155px); padding: 72px 22px; }
  .not-found-content h1 { font-size: clamp(50px, 13vw, 72px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-copy h1 em::after { animation: none; }
  .button, .public-button, .project-card, .new-card { transition: none !important; }
  .button.primary:hover:not(:disabled), .public-button.primary:hover { translate: none; }
}

/* Keep compact production labels legible at phone scale. */
.showcase-head,
.showcase-foot small,
.showcase-foot .foot-index,
.showcase-foot .foot-duration,
.public-proof > p,
.workflow-number,
.public-footer > span,
.public-footer > a:last-child,
.hero-note,
.signin-workflow,
.signin-private { font-size: 12px; }
.public-proof > div { font-size: 12px; }
@media (max-width: 680px) {
  .signin-private { font-size: 12px !important; }
  .public-proof > div { font-size: 12px; }
}

/* The private-access note follows the illustration instead of overlapping it. */
.signin-private { position: relative; left: auto; bottom: auto; margin: 14px 0 0 !important; font-size: 12px !important; }

/* Let the selected scene read as a canvas before its editing controls. */
@media (min-width: 981px) {
  .editor-layout { grid-template-columns: minmax(300px, .82fr) minmax(0, 1.18fr); }
  .scene-preview { min-height: clamp(340px, 44vh, 440px); }
  .scene-preview > .scene-artwork { height: 88%; }
}

/* A legible branded fallback while Clerk and the private editor chunk load. */
.route-status-loading { width: min(520px, 100%); display: grid; justify-items: center; gap: 17px; padding: 32px 20px; text-align: center; }
.route-status-kicker { color: var(--text-muted); font: 500 11px/1.4 "DM Mono", monospace; letter-spacing: .12em; }
.route-status-loading h1 { max-width: 18ch; margin: 0; font: 700 clamp(30px, 5vw, 42px)/1.08 "Bricolage Grotesque", sans-serif; letter-spacing: -.055em; }
.route-status-rule { display: block; width: 64px; height: 4px; background: var(--accent); }
