:root {
  --bg-canvas: #f9fafb;
  --bg-surface: #ffffff;
  --bg-muted: #f3f4f6;
  --border-hairline: #e5e7eb;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-soft: #f0fdfa;
  --danger: #dc2626;
  --font-ar: 'Cairo', 'Tajawal', sans-serif;
  --font-latin: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

html[dir='rtl'] body {
  font-family: var(--font-ar);
}

html[dir='ltr'] body {
  font-family: var(--font-latin);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

.studio-frosted {
  background-color: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

.studio-checkerboard {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #eef0f3 25%, transparent 25%),
    linear-gradient(-45deg, #eef0f3 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef0f3 75%),
    linear-gradient(-45deg, transparent 75%, #eef0f3 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .container {
    padding: 0 1.5rem;
  }
}

/* Header */
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border-hairline);
}

.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.125rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

.lang-select {
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.btn:hover:not(:disabled) {
  background: var(--bg-canvas);
}

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

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-dark {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #ffffff;
}

.btn-dark:hover:not(:disabled) {
  background: #1e293b;
}

.btn-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

/* Hero */
.hero {
  padding: 2rem 0 1.25rem;
}

.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
}

.hero-title {
  margin: 0.5rem 0 0;
  font-size: clamp(1.75rem, 3.2vw, 2.625rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  max-width: 48rem;
}

.hero-subtitle {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 42rem;
}

/* Workspace Bar */
.workspace-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 16px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  margin-bottom: 1.25rem;
}

.segmented {
  display: inline-flex;
  padding: 0.25rem;
  border-radius: 10px;
  background: var(--bg-muted);
  gap: 0.25rem;
}

.segmented button {
  border: none;
  background: transparent;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.segmented button.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.engine-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.engine-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Progress Banner */
.progress-card {
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
}

.progress-track {
  height: 6px;
  width: 100%;
  background: var(--border-hairline);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 180ms ease;
}

.notice-banner {
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background: var(--accent-soft);
  color: #115e59;
  padding: 0.625rem 1rem;
  font-size: 0.75rem;
  margin-bottom: 1rem;
}

/* Empty Dropzone Grid */
.empty-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .empty-grid {
    grid-template-columns: 7fr 5fr;
  }
}

.dropzone-card {
  border: 2px dashed #d1d5db;
  border-radius: 16px;
  background: var(--bg-surface);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.dropzone-card:hover,
.dropzone-card.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.samples-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-hairline);
}

.sample-btn {
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  background: var(--bg-canvas);
  padding: 0.5rem;
  cursor: pointer;
  text-align: center;
}

.sample-btn:hover {
  border-color: var(--accent);
  background: var(--bg-surface);
}

.sample-btn img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin-bottom: 0.4rem;
}

.sample-btn span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.showcase-card {
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  background: var(--bg-surface);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.showcase-img-wrap {
  aspect-ratio: 4/3;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  overflow: hidden;
}

.showcase-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Studio Editor Grid */
.studio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .studio-grid {
    grid-template-columns: 8fr 4fr;
  }
}

.stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  margin-bottom: 0.75rem;
}

.stage-viewport {
  position: relative;
  min-height: 460px;
  border-radius: 16px;
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1.5rem;
}

.stage-viewport canvas {
  max-height: 520px;
  max-width: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  touch-action: none;
}

.stage-meta {
  position: absolute;
  bottom: 0.65rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* Before/After Curtain */
.curtain-box {
  position: relative;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 4/3;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
}

.curtain-box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.curtain-before-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.curtain-before-wrap img {
  background: var(--bg-muted);
}

.curtain-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.curtain-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

/* Inspector Sidebar */
.inspector {
  border-radius: 16px;
  border: 1px solid var(--border-hairline);
  overflow: hidden;
}

.inspector-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.25rem;
  padding: 0.25rem;
  border-bottom: 1px solid var(--border-hairline);
  background: rgba(249, 250, 251, 0.85);
}

.inspector-tabs button {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 0.5rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inspector-tabs button.active {
  background: var(--bg-surface);
  border-color: var(--border-hairline);
  color: var(--accent);
}

.inspector-body {
  padding: 1.125rem;
  max-height: 560px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-hairline);
}

.control-group:first-child {
  padding-top: 0;
  border-top: none;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

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

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

input[type='range'].studio-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--border-hairline);
  outline: none;
}

input[type='range'].studio-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.text-input, .select-input {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  padding: 0.45rem 0.65rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  cursor: pointer;
}

.swatch.active {
  border: 2px solid var(--accent);
}

.gradient-swatch {
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
  cursor: pointer;
}

/* Bulk Studio */
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--border-hairline);
  margin-bottom: 1rem;
}

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

.bulk-card {
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  overflow: hidden;
}

.bulk-thumb {
  position: relative;
  aspect-ratio: 4/3;
  border-bottom: 1px solid var(--border-hairline);
}

.bulk-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.bulk-card-foot {
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Landing / Features / FAQ */
.sections-wrap {
  border-top: 1px solid var(--border-hairline);
  margin-top: 3rem;
  padding: 3rem 0;
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.feature-card {
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  padding: 1.35rem;
}

.faq-list {
  margin-top: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  overflow: hidden;
}

.faq-item + .faq-item {
  border-top: 1px solid var(--border-hairline);
}

.faq-q {
  width: 100%;
  text-align: start;
  background: transparent;
  border: none;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-a {
  padding: 0 1.25rem 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.footer {
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  padding: 1.25rem 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
