/* ==========================================================================
   Depthcast — design tokens
   A scan/instrument aesthetic: near-black chassis, violet signal accent for
   the splat itself, warm ember reserved only for the one action that matters
   (generate / progress). Everything else stays quiet.
   ========================================================================== */

:root {
  --bg:            #0A0B0D;
  --panel:         #131418;
  --panel-alt:     #1B1D22;
  --border:        #24262C;
  --border-soft:   #1B1C21;

  --text-hi:       #ECEDEF;
  --text-lo:       #8B8E96;
  --text-faint:    #55585F;

  --accent:        #6E7BFF;   /* signal violet — the splat / interactive things */
  --accent-dim:    #6E7BFF33;
  --ember:         #FF8A4C;   /* reserved for generate + progress only */
  --ember-dim:     #FF8A4C26;

  --font-display:  'Space Grotesk', sans-serif;
  --font-body:     'Inter', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text-hi);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button, input {
  font-family: inherit;
  color: inherit;
}

.app {
  display: grid;
  grid-template-rows: 56px 1fr 44px;
  height: 100vh;
  overflow: hidden;
}

/* ==========================================================================
   Topbar
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #3B45B8);
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.topbar-nav {
  display: flex;
  gap: 4px;
}

.nav-item {
  background: none;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-lo);
  cursor: pointer;
}

.nav-item:hover { color: var(--text-hi); }

.nav-item.is-active {
  color: var(--text-hi);
  background: var(--panel-alt);
}

.topbar-actions {
  margin-left: auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-lo);
  font-family: var(--font-mono);
}

.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
}

.status-pill.is-online .dot { background: #59D68C; }
.status-pill.is-offline .dot { background: #E15B5B; }

/* ==========================================================================
   Workspace grid
   ========================================================================== */

.workspace {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 0;
}

/* ---------- Rail ---------- */

.rail {
  border-right: 1px solid var(--border);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg);
}

.rail-section { padding: 4px 0; }
.rail-section-grow { flex-grow: 1; }

.rail-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-lo);
  margin: 0 0 12px;
}

.rail-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 16px 0;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--text-lo);
  margin-bottom: 8px;
}

/* Dropzone */

.dropzone {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  overflow: hidden;
}

.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--panel-alt);
}

.dropzone-empty {
  text-align: center;
  color: var(--text-lo);
  padding: 20px;
}

.dropzone-empty svg { color: var(--text-faint); margin-bottom: 8px; }

.dropzone-empty p { margin: 0; font-size: 13px; }

.dropzone-hint {
  color: var(--text-faint);
  font-size: 11.5px;
  margin-top: 4px !important;
}

.link-inline { color: var(--accent); }

.dropzone-preview {
  width: 100%;
  height: 100%;
  min-height: 150px;
  object-fit: cover;
}

/* Segmented control */

.segmented {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.segmented button {
  flex: 1;
  background: none;
  border: none;
  border-radius: 4px;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--text-lo);
  cursor: pointer;
}

.segmented button.is-active {
  background: var(--panel-alt);
  color: var(--text-hi);
}

/* Buttons */

.btn {
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  padding: 10px 14px;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--ember);
  color: #1A0E06;
}
.btn-primary:not(:disabled):hover { background: #FF9C67; }

.btn-generate { margin-top: 14px; }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-lo);
  margin-top: 10px;
}
.btn-ghost:hover { color: var(--text-hi); border-color: var(--text-faint); }

.btn-export {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text-hi);
  width: auto;
  padding: 5px 12px;
  font-size: 12.5px;
}
.btn-export:not(:disabled):hover { border-color: var(--accent); }

/* Progress */

.progress-block { margin-top: 16px; }

.progress-track {
  height: 4px;
  border-radius: 2px;
  background: var(--panel-alt);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--ember);
  transition: width 0.3s ease;
}

.progress-label {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-lo);
  font-family: var(--font-mono);
}

/* Slider */

.slider {
  width: 100%;
  accent-color: var(--accent);
  background: transparent;
}

/* ==========================================================================
   Viewport
   ========================================================================== */

.viewport {
  position: relative;
  background: #050506;
  overflow: hidden;
}

.viewer-container {
  position: absolute;
  inset: 0;
}

.viewport-empty[hidden] {
  display: none;
}

.viewport-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.viewport-empty-title {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-lo);
  margin: 0 0 4px;
}

.viewport-empty-sub {
  font-size: 12.5px;
  color: var(--text-faint);
  margin: 0;
}

.viewport-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(19, 20, 24, 0.85);
  border: 1px solid var(--border);
  color: var(--text-lo);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.icon-btn:hover { color: var(--text-hi); border-color: var(--accent); }

.viewport-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  pointer-events: none;
}

/* ==========================================================================
   Status bar
   ========================================================================== */

.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-lo);
  background: var(--bg);
}

.statusbar-sep { color: var(--text-faint); }

.statusbar-export {
  margin-left: auto;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .rail { border-right: none; border-bottom: 1px solid var(--border); max-height: 42vh; }
  .topbar-nav { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Focus visibility */
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
