/* ClipLab — Opus-inspired modern dark UI */
:root {
  --bg: #07070c;
  --bg-elevated: #0e0e16;
  --bg-card: #12121c;
  --bg-card-hover: #171724;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f4f8;
  --text-muted: #9898b0;
  --text-dim: #6b6b84;
  --accent: #8b5cf6;
  --accent-2: #6366f1;
  --accent-3: #22d3ee;
  --accent-grad: linear-gradient(135deg, #a78bfa 0%, #6366f1 45%, #22d3ee 100%);
  --success: #34d399;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  --font: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

/* Ambient glow */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.28), transparent 55%),
    radial-gradient(ellipse 40% 30% at 90% 10%, rgba(139, 92, 246, 0.15), transparent 50%),
    radial-gradient(ellipse 35% 25% at 10% 30%, rgba(34, 211, 238, 0.08), transparent 50%);
}

.container {
  width: min(1180px, calc(100% - 2.5rem));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(7, 7, 12, 0.72);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-grad);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.logo-mark svg {
  width: 18px;
  height: 18px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-cta {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.7rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent-grad);
  color: white;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.btn-lg {
  padding: 0.95rem 1.6rem;
  font-size: 1.05rem;
}

/* Hero */
.hero {
  padding: 5.5rem 0 3rem;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.hero h1 {
  font-size: clamp(2.4rem, 5.5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.08;
  max-width: 16ch;
  margin: 0 auto 1.1rem;
}

.hero h1 .grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  color: var(--text-muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  max-width: 38rem;
  margin: 0 auto 2.25rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
  margin-bottom: 2.75rem;
}

/* Upload card */
.upload-card {
  width: min(720px, 100%);
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 0.5rem;
  box-shadow: var(--shadow);
}

.upload-zone {
  border: 1.5px dashed rgba(139, 92, 246, 0.45);
  border-radius: 20px;
  padding: 2.75rem 1.5rem;
  background: rgba(10, 10, 18, 0.7);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: #a78bfa;
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-1px);
}

.upload-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  background: rgba(139, 92, 246, 0.15);
  display: grid;
  place-items: center;
  color: #c4b5fd;
}

.upload-zone h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.upload-zone p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.upload-zone .hint {
  margin-top: 0.85rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Social proof strip */
.proof {
  padding: 2.5rem 0 1rem;
  text-align: center;
}

.proof p {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
}

.proof-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.chip {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Sections */
.section {
  padding: 5rem 0;
}

.section-head {
  text-align: center;
  margin-bottom: 2.75rem;
}

.section-head h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 0.75rem;
}

.section-head p {
  color: var(--text-muted);
  max-width: 36rem;
  margin: 0 auto;
  font-size: 1.05rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.15rem;
}

@media (max-width: 860px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .nav-links {
    display: none;
  }
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}

.feature-card:hover {
  border-color: rgba(139, 92, 246, 0.35);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
  font-size: 1.15rem;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
  letter-spacing: -0.02em;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.94rem;
}

/* How it works steps */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .steps {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

.step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  position: relative;
  overflow: hidden;
}

.step-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: #a78bfa;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.step h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.step p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* FAQ */
.faq {
  max-width: 720px;
  margin: 0 auto;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  margin-bottom: 0.65rem;
  overflow: hidden;
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.15rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  color: var(--text-muted);
  font-size: 1.2rem;
  font-weight: 400;
}

.faq-item[open] summary::after {
  content: "–";
}

.faq-item p {
  padding: 0 1.15rem 1.1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Footer CTA */
.footer-cta {
  text-align: center;
  padding: 4rem 0 3rem;
}

.footer-cta h2 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.footer-cta p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ========== Studio app ========== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.app-main {
  flex: 1;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.app-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.app-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.panel + .panel {
  margin-top: 1rem;
}

.panel-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 0.9rem;
}

.layout-2 {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1rem;
}

@media (max-width: 960px) {
  .layout-2 {
    grid-template-columns: 1fr;
  }
}

.field {
  margin-bottom: 0.9rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.field select,
.field input[type="number"] {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  outline: none;
}

.field select:focus,
.field input:focus {
  border-color: rgba(139, 92, 246, 0.55);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.toggle-row:last-child {
  border-bottom: none;
}

/* Custom checkbox */
.switch {
  position: relative;
  width: 42px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #2a2a3d;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}

.switch span::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + span {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

.switch input:checked + span::before {
  transform: translateX(18px);
}

/* Progress */
.progress-wrap {
  margin-top: 1rem;
}

.progress-bar {
  height: 8px;
  background: #1a1a28;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-grad);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.status-pill.processing {
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.12);
}

.status-pill.ready,
.status-pill.done {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.1);
}

.status-pill.error {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
}

/* Clip grid */
.clips-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.clip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.clip-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.clip-card:hover {
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateY(-2px);
}

.clip-card.selected {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.4);
}

.clip-thumb {
  aspect-ratio: 9 / 16;
  background: #0a0a12;
  position: relative;
  overflow: hidden;
}

.clip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clip-score {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #c4b5fd;
}

.clip-check {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.clip-card.selected .clip-check {
  background: #8b5cf6;
  border-color: #8b5cf6;
}

.clip-check::after {
  content: "✓";
  font-size: 0.7rem;
  color: white;
  opacity: 0;
}

.clip-card.selected .clip-check::after {
  opacity: 1;
}

.clip-body {
  padding: 0.85rem;
}

.clip-body h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.clip-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
  font-family: var(--mono);
}

.clip-reason {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state h3 {
  color: var(--text);
  margin-bottom: 0.4rem;
}

/* File row after pick */
.url-row input[type="url"] {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  outline: none;
  font-size: 0.92rem;
}

.url-row input[type="url"]:focus {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.9rem 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.file-picked {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  margin-top: 1rem;
}

.file-picked .name {
  flex: 1;
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picked .size {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-family: var(--mono);
}

.hidden {
  display: none !important;
}

.error-box {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #fca5a5;
  font-size: 0.9rem;
}

.exports-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.export-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
}

.export-item a {
  color: #a5b4fc;
  font-weight: 600;
}

.export-item a:hover {
  text-decoration: underline;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
