/* Prism — editorial minimalist UI. Warm monochrome + prism accent. */
:root {
  --bg: #faf8f5;
  --ink: #0d0d0d;
  --muted: #6b645a;
  --line: #e8e2d8;
  --card: #ffffff;
  --accent: #ff5b3a;
  --accent-2: #3a6bff;
  --accent-3: #ffb23a;
  --ok: #2e8b57;
  --err: #c43b3b;
  --radius: 14px;
  --serif: 'Instrument Serif', 'Playfair Display', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0c0a;
    --ink: #f3efe8;
    --muted: #9b9286;
    --line: #23211d;
    --card: #151310;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* Top nav */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px); z-index: 50;
}
.brand {
  font-family: var(--serif); font-size: 28px; font-weight: 400;
  letter-spacing: -0.01em;
}
.brand em { font-style: italic; color: var(--accent); font-weight: 400; }
.nav-actions { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); object-fit: cover; }

/* Layout */
.container { max-width: 1280px; margin: 0 auto; padding: 32px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 16px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav { padding: 14px 20px; }
  .container { padding: 20px; }
  .brand { font-size: 24px; }
}

/* Typography */
h1.display {
  font-family: var(--serif);
  font-size: clamp(48px, 8vw, 120px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-weight: 400;
  margin: 0 0 24px;
}
h1.display em { font-style: italic; color: var(--accent); }
h2 { font-family: var(--serif); font-weight: 400; font-size: 36px; letter-spacing: -0.02em; margin: 0 0 12px; }
h3 { font-size: 18px; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.005em; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  border-radius: 999px; transition: transform .1s ease, background .2s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--bg); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; transition: border-color .2s ease;
}
.card:hover { border-color: color-mix(in oklab, var(--ink) 30%, var(--line)); }
.card.clickable { cursor: pointer; }

/* Form controls */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.input, .textarea, .select {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font-size: 15px; outline: none;
  transition: border-color .15s ease;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--ink); }
.textarea { resize: vertical; min-height: 100px; font-family: var(--sans); }

/* Scene editor */
.scene-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 18px;
  background: var(--card); display: flex; flex-direction: column; gap: 12px;
  position: relative;
}
.scene-card .tc { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.1em; }
.scene-card .idx {
  position: absolute; top: -12px; left: 18px;
  background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: 11px;
  padding: 3px 10px; border-radius: 999px; letter-spacing: 0.1em;
}
.scene-card .row-fields { display: grid; grid-template-columns: 140px 1fr; gap: 8px; align-items: start; }
@media (max-width: 600px) { .scene-card .row-fields { grid-template-columns: 1fr; } }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--line);
}
.pill.ok { background: color-mix(in oklab, var(--ok) 15%, transparent); border-color: var(--ok); color: var(--ok); }
.pill.warn { background: color-mix(in oklab, var(--accent-3) 15%, transparent); border-color: var(--accent-3); color: #a76a00; }
.pill.err { background: color-mix(in oklab, var(--err) 15%, transparent); border-color: var(--err); color: var(--err); }
.pill.info { background: color-mix(in oklab, var(--accent-2) 12%, transparent); border-color: var(--accent-2); color: var(--accent-2); }

/* Hero (landing) */
.hero { padding: 80px 32px 120px; max-width: 1280px; margin: 0 auto; }
.hero .kicker { margin-bottom: 24px; }
.hero p.lede { font-family: var(--serif); font-size: clamp(22px, 2.8vw, 32px); line-height: 1.3; max-width: 720px; color: var(--muted); margin: 0 0 40px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; padding: 32px; max-width: 1280px; margin: 0 auto 80px; border-top: 1px solid var(--line); padding-top: 64px; }
@media (max-width: 860px) { .features { grid-template-columns: 1fr; } }
.feature h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; }
.feature .num { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.2em; margin-bottom: 12px; }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 32px; text-align: center; transition: all .15s ease; cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 5%, transparent); }

/* Toasts */
.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 14px 20px;
  background: var(--ink); color: var(--bg); border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 200; animation: slideIn .25s ease;
}
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }

/* Project tiles */
.proj-tile {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  background: var(--card); transition: all .15s ease; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px; min-height: 140px;
}
.proj-tile:hover { transform: translateY(-2px); border-color: var(--ink); }
.proj-tile h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0; }
.proj-tile .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab { padding: 10px 16px; background: transparent; border: none; border-bottom: 2px solid transparent; font-size: 14px; color: var(--muted); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* Video preview */
.video-frame { width: 100%; border-radius: var(--radius); background: #000; display: block; aspect-ratio: 16/9; }

hr.divider { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

/* Render banner & locked tabs */
.render-banner {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 18px;
  background: color-mix(in oklab, var(--accent) 10%, var(--card));
  border: 1px solid color-mix(in oklab, var(--accent) 40%, var(--line));
  border-radius: 12px; margin-bottom: 20px;
}
.render-banner-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); margin-top: 7px;
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 60%, transparent);
  animation: pulse 1.6s ease-out infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 60%, transparent); }
  100% { box-shadow: 0 0 0 14px color-mix(in oklab, var(--accent) 0%, transparent); }
}
.tab-locked { position: relative; }
.tab-locked button:not(.always-enabled),
.tab-locked input,
.tab-locked textarea,
.tab-locked select,
.tab-locked .dropzone { pointer-events: none !important; opacity: 0.55 !important; }
.tab-locked .card { filter: saturate(0.7); }

/* Progress bar */
.progress-track {
  width: 100%; height: 8px; background: var(--line);
  border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--accent);
  transition: width 1s linear;
  box-shadow: 0 0 12px color-mix(in oklab, var(--accent) 60%, transparent);
}

/* Loading overlay */
.loading-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.loading-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 40px 48px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  max-width: 420px;
}
.loading-spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
  margin-bottom: 16px;
}
.loading-title {
  font-family: var(--serif); font-size: 24px; font-weight: 400;
  letter-spacing: -0.01em; margin: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Utility */
.hidden { display: none !important; }
.w-full { width: 100%; }
.gap-sm { gap: 8px; }
.mt-lg { margin-top: 32px; }
.mb-lg { margin-bottom: 32px; }
.text-sm { font-size: 13px; }
