/* ===== CSS Variables & Reset ===== */
:root {
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --primary-dark: #5A4BD1;
  --accent: #00CEC9;
  --accent-light: #81ECEC;
  --bg: #0F0F1A;
  --bg-card: #1A1A2E;
  --bg-card-hover: #222240;
  --surface: #16213E;
  --text: #EAEAEA;
  --text-muted: #8892B0;
  --text-light: #CCD6F6;
  --border: rgba(255,255,255,0.06);
  --gradient-1: linear-gradient(135deg, #6C5CE7, #00CEC9);
  --gradient-2: linear-gradient(135deg, #A29BFE, #81ECEC);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent);
}

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

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  outline: none;
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-light);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }

.gradient-text {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 80px 0;
}

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  padding: 16px 0;
  transition: background var(--transition), box-shadow var(--transition);
}

.nav.scrolled {
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 var(--border);
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-light);
}

.nav-logo svg {
  width: 32px;
  height: 32px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color var(--transition);
}

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

.nav-cta {
  padding: 10px 24px;
  background: var(--gradient-1);
  color: #fff !important;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

.nav-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
  color: #fff !important;
}

.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  padding: 4px;
}

.mobile-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--gradient-1);
  color: #fff;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(108, 92, 231, 0.5);
  color: #fff;
}

.btn-outline {
  border: 2px solid var(--primary-light);
  color: var(--primary-light);
  background: transparent;
}

.btn-outline:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-3px);
}

.btn-ghost {
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-light);
}

/* ===== Hero Section ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding-top: 80px;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(0, 206, 201, 0.06) 0%, transparent 50%);
  animation: heroGlow 15s ease-in-out infinite alternate;
}

@keyframes heroGlow {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-5%, 5%) rotate(3deg); }
}

.hero .container {
  position: relative;
  z-index: 1;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(108, 92, 231, 0.1);
  border: 1px solid rgba(108, 92, 231, 0.2);
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--primary-light);
  margin-bottom: 24px;
  animation: fadeInUp 0.6s ease-out;
}

.hero h1 {
  margin-bottom: 20px;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.hero p {
  max-width: 600px;
  margin: 0 auto 40px;
  font-size: 1.15rem;
  color: var(--text-muted);
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.hero-preview {
  margin-top: 60px;
  perspective: 1000px;
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hero-preview-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  transform: rotateX(5deg);
  transition: transform 0.6s ease;
}

.hero-preview-inner:hover {
  transform: rotateX(0deg);
}

.hero-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 120px);
  gap: 8px;
  border-radius: var(--radius);
  overflow: hidden;
}

.hero-preview-grid .cell {
  border-radius: 8px;
  transition: transform 0.3s ease;
}

.hero-preview-grid .cell:hover {
  transform: scale(1.05);
  z-index: 1;
}

.hero-preview-grid .cell:nth-child(1) { background: linear-gradient(135deg, #667eea, #764ba2); grid-row: span 2; }
.hero-preview-grid .cell:nth-child(2) { background: linear-gradient(135deg, #f093fb, #f5576c); }
.hero-preview-grid .cell:nth-child(3) { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.hero-preview-grid .cell:nth-child(4) { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.hero-preview-grid .cell:nth-child(5) { background: linear-gradient(135deg, #fa709a, #fee140); }

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Features Section ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 48px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  transition: all var(--transition);
}

.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(108, 92, 231, 0.2);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(108, 92, 231, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.feature-card h3 {
  margin-bottom: 12px;
}

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

/* ===== Templates Section ===== */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.template-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
}

.template-card:hover {
  border-color: var(--primary);
  transform: scale(1.03);
  box-shadow: 0 0 30px rgba(108, 92, 231, 0.2);
}

.template-card .template-preview {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 4px;
  padding: 4px;
  background: var(--bg-card);
}

.template-card .cell {
  background: rgba(108, 92, 231, 0.15);
  border-radius: 4px;
}

.template-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  font-size: 0.85rem;
  font-weight: 600;
}

/* ===== How It Works ===== */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  margin-top: 48px;
  counter-reset: step;
}

.step {
  text-align: center;
  position: relative;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: var(--gradient-1);
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.step h3 {
  margin-bottom: 12px;
}

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

/* ===== CTA Section ===== */
.cta-section {
  text-align: center;
  position: relative;
}

.cta-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  position: relative;
  overflow: hidden;
}

.cta-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-1);
}

.cta-box h2 {
  margin-bottom: 16px;
}

.cta-box p {
  color: var(--text-muted);
  margin-bottom: 32px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 12px;
  max-width: 300px;
}

.footer-col h4,
.footer-heading {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: var(--text-light);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== Editor Page ===== */
.editor-page {
  padding-top: 70px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.editor-toolbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
}

.toolbar-group:last-child {
  border-right: none;
  margin-left: auto;
}

.toolbar-btn {
  padding: 8px 16px;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-light);
}

.toolbar-btn.active {
  background: var(--primary);
  color: #fff;
}

.toolbar-btn svg {
  width: 16px;
  height: 16px;
}

.editor-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.editor-sidebar {
  width: 280px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
  flex-shrink: 0;
  transition: margin-left 0.3s ease, opacity 0.3s ease;
}

.editor-sidebar.hidden {
  margin-left: -280px;
  opacity: 0;
  pointer-events: none;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.layout-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.layout-option {
  aspect-ratio: 1;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 2px;
  padding: 6px;
  transition: all var(--transition);
}

.layout-option:hover {
  border-color: var(--primary-light);
}

.layout-option.selected {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(108, 92, 231, 0.3);
}

.layout-option .cell {
  background: rgba(108, 92, 231, 0.2);
  border-radius: 2px;
}

.editor-canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg);
  position: relative;
  overflow: auto;
}

/* Download bar below collage */
.mobile-download-bar {
  display: flex;
  gap: 12px;
  margin-top: 36px;
  width: 100%;
  justify-content: center;
}

.mobile-download-btn {
  padding: 12px 28px;
  font-size: 0.9rem;
}

.canvas-wrapper {
  position: relative;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  overflow: hidden;
}

.collage-grid {
  display: grid;
  background: #ffffff;
  position: relative;
}

.collage-cell {
  position: relative;
  min-height: 80px;
  background: #f0f0f0;
  overflow: hidden;
  cursor: pointer;
  transition: outline 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.collage-cell:hover {
  outline: 3px solid var(--primary);
  outline-offset: -3px;
  z-index: 2;
}

.collage-cell.active {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  z-index: 2;
}

.collage-cell .placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #aaa;
  font-size: 0.8rem;
  pointer-events: none;
}

.collage-cell .placeholder svg {
  width: 32px;
  height: 32px;
  opacity: 0.4;
}

.collage-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.collage-cell .cell-controls {
  position: absolute;
  top: 4px;
  right: 4px;
  display: none;
  gap: 4px;
  z-index: 5;
}

.collage-cell:hover .cell-controls {
  display: flex;
}

.cell-control-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  backdrop-filter: blur(4px);
  transition: background var(--transition);
}

.cell-control-btn:hover {
  background: var(--primary);
}

/* Cell Text Overlay */
.cell-text-overlay {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 3;
  padding: 8px;
  font-family: 'Inter', -apple-system, sans-serif;
  word-break: break-word;
  line-height: 1.2;
}

.cell-text-overlay.pos-top {
  top: 8px;
}

.cell-text-overlay.pos-center {
  top: 50%;
  transform: translateY(-50%);
}

.cell-text-overlay.pos-bottom {
  bottom: 8px;
}

/* Text Editor Modal */
.text-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.text-editor-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}

.text-editor-panel h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.text-input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

.text-input:focus {
  border-color: var(--primary);
}

select.text-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238892B0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

select.text-input option {
  background: var(--bg-card);
  color: var(--text);
}

.text-position-grid {
  display: flex;
  gap: 6px;
}

.text-pos-btn {
  flex: 1;
  padding: 6px 8px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all var(--transition);
}

.text-pos-btn.active {
  background: var(--primary);
  color: #fff;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 16px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--primary);
}

.text-editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.text-editor-actions .btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 0.85rem;
  justify-content: center;
}

/* Sidebar Controls */
.control-group {
  margin-bottom: 16px;
}

.control-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.control-group input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--surface);
  outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(108, 92, 231, 0.4);
}

.control-group input[type="color"] {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  padding: 2px;
}

.control-group select {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
}

/* Drop zone styling */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(108, 92, 231, 0.1);
  border: 3px dashed var(--primary);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--primary-light);
  pointer-events: none;
}

.drop-overlay.visible {
  display: flex;
}

/* File input hidden */
.hidden-input {
  display: none;
}

/* ===== Blog / SEO Pages ===== */
.page-header {
  padding: 120px 0 60px;
  text-align: center;
  position: relative;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 0%, rgba(108, 92, 231, 0.1), transparent 60%);
}

.page-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 700px;
  margin: 16px auto 0;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(108, 92, 231, 0.2);
}

.blog-card-image {
  height: 200px;
  overflow: hidden;
}

.blog-card-image div {
  width: 100%;
  height: 100%;
  transition: transform 0.4s ease;
}

.blog-card:hover .blog-card-image div {
  transform: scale(1.05);
}

.blog-card-body {
  padding: 24px;
}

.blog-card-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary-light);
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.blog-card-body h3 {
  margin-bottom: 8px;
}

.blog-card-body h3 a {
  color: var(--text-light);
}

.blog-card-body h3 a:hover {
  color: var(--primary-light);
}

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

.blog-card-meta {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Article page */
.article-content {
  max-width: 760px;
  margin: 0 auto;
  padding-bottom: 80px;
}

.article-content h2 {
  margin-top: 40px;
  margin-bottom: 16px;
}

.article-content p {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 1.05rem;
}

.article-content ul,
.article-content ol {
  color: var(--text-muted);
  padding-left: 24px;
  margin-bottom: 20px;
}

.article-content li {
  margin-bottom: 8px;
}

.article-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 16px 24px;
  margin: 24px 0;
  background: rgba(108, 92, 231, 0.05);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-light);
  font-style: italic;
}

/* FAQ section */
.faq-list {
  max-width: 760px;
  margin: 40px auto 0;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color var(--transition);
}

.faq-item:hover {
  border-color: rgba(108,92,231,0.2);
}

.faq-question {
  width: 100%;
  padding: 20px 24px;
  background: var(--bg-card);
  color: var(--text-light);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--transition);
}

.faq-question:hover {
  background: var(--bg-card-hover);
}

.faq-question .arrow {
  transition: transform var(--transition);
  color: var(--text-muted);
}

.faq-item.open .faq-question .arrow {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.faq-item.open .faq-answer {
  max-height: 300px;
}

.faq-answer-inner {
  padding: 0 24px 20px;
  color: var(--text-muted);
  line-height: 1.7;
}

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

/* Tablet */
@media (max-width: 900px) {
  .container {
    padding: 0 20px;
  }

  .section {
    padding: 60px 0;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .editor-sidebar {
    width: 220px;
  }

  .editor-canvas-area {
    padding: 20px;
  }

  .features-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  .cta-box {
    padding: 48px 24px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .nav {
    padding: 12px 0;
  }

  .nav-logo {
    font-size: 1.2rem;
  }

  .nav-logo svg {
    width: 26px;
    height: 26px;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(15, 15, 26, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 24px;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    overflow-y: auto;
    max-height: calc(100vh - 54px);
    max-height: calc(100dvh - 54px);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 1.05rem;
  }

  .nav-links a:hover,
  .nav-links a.active {
    background: rgba(108, 92, 231, 0.1);
  }

  .nav-cta {
    text-align: center;
    margin-top: 8px;
  }

  .mobile-toggle {
    display: flex;
  }

  /* Hero */
  .hero {
    min-height: auto;
    padding: 100px 0 60px;
  }

  .hero p {
    font-size: 1rem;
    margin-bottom: 28px;
  }

  .hero-preview {
    margin-top: 40px;
  }

  .hero-preview-inner {
    padding: 12px;
  }

  .hero-preview-grid {
    grid-template-rows: repeat(2, 70px);
    gap: 6px;
  }

  /* Features */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .feature-card {
    padding: 24px;
  }

  .feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin-bottom: 16px;
  }

  /* Steps */
  .steps {
    gap: 32px;
  }

  .step::before {
    width: 52px;
    height: 52px;
    font-size: 1.2rem;
  }

  /* CTA */
  .cta-box {
    padding: 40px 20px;
  }

  /* Footer */
  .footer {
    padding: 32px 0 20px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    font-size: 0.8rem;
  }

  /* Blog */
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .blog-card-image {
    height: 160px;
  }

  .blog-card-body {
    padding: 16px;
  }

  .blog-card-meta {
    padding: 12px 16px;
  }

  /* Article */
  .article-content {
    padding-bottom: 40px;
  }

  .article-content p {
    font-size: 0.95rem;
  }

  .article-content h2 {
    margin-top: 32px;
  }

  .article-content blockquote {
    padding: 12px 16px;
    margin: 16px 0;
  }

  /* Page header */
  .page-header {
    padding: 90px 0 40px;
  }

  .page-header p {
    font-size: 0.95rem;
  }

  /* FAQ */
  .faq-question {
    padding: 16px;
    font-size: 0.9rem;
  }

  .faq-answer-inner {
    padding: 0 16px 16px;
    font-size: 0.9rem;
  }

  /* Templates */
  .templates-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* === Editor Mobile === */
  .editor-page {
    padding-top: 54px;
  }

  .editor-toolbar {
    padding: 8px 12px;
    gap: 6px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .toolbar-group {
    padding-right: 8px;
    gap: 4px;
    flex-shrink: 0;
  }

  .toolbar-btn {
    padding: 8px 10px;
    font-size: 0.75rem;
    gap: 4px;
    white-space: nowrap;
  }

  .toolbar-btn svg {
    width: 14px;
    height: 14px;
  }

  /* Hide text labels on small toolbar buttons on mobile, keep icon */
  .toolbar-btn-text-hide {
    font-size: 0;
  }

  .editor-main {
    flex-direction: column;
    height: calc(100vh - 54px - 48px);
    height: calc(100dvh - 54px - 48px);
  }

  .editor-sidebar {
    position: fixed;
    top: 54px;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    margin-left: 0 !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .editor-sidebar.hidden {
    transform: translateX(-100%);
  }

  .editor-sidebar:not(.hidden) {
    transform: translateX(0);
  }

  /* Overlay behind sidebar on mobile */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }

  .sidebar-backdrop.visible {
    display: block;
  }

  .editor-canvas-area {
    padding: 12px;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    justify-content: flex-start;
  }

  .mobile-download-bar {
    gap: 10px;
    margin-top: 36px;
  }

  .mobile-download-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.85rem;
  }

  .collage-cell .placeholder span {
    display: none;
  }

  .collage-cell .placeholder svg {
    width: 24px;
    height: 24px;
  }

  .collage-cell .cell-controls {
    display: flex;
  }

  .cell-control-btn {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
  }

  /* Toast */
  .toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    text-align: center;
    font-size: 0.85rem;
    padding: 12px 16px;
  }
}

/* Small phones */
@media (max-width: 380px) {
  .container {
    padding: 0 16px;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }

  .hero {
    padding: 90px 0 40px;
  }

  .hero-badge {
    font-size: 0.75rem;
    padding: 6px 14px;
  }

  .btn {
    padding: 12px 24px;
    font-size: 0.9rem;
  }

  .hero-preview-grid {
    grid-template-rows: repeat(2, 55px);
  }

  .templates-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .template-label {
    font-size: 0.7rem;
    padding: 8px;
  }

  .editor-toolbar {
    padding: 6px 8px;
  }

  .toolbar-btn {
    padding: 6px 8px;
    font-size: 0;
  }

  .toolbar-btn svg {
    width: 16px;
    height: 16px;
  }

  .editor-canvas-area {
    padding: 8px;
  }
}

/* Use dvh for mobile viewport (iOS Safari safe area) */
@supports (height: 100dvh) {
  .hero {
    min-height: 100dvh;
  }

  @media (max-width: 768px) {
    .hero {
      min-height: auto;
    }

    .editor-main {
      height: calc(100dvh - 54px - 48px);
    }
  }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
  .collage-cell .cell-controls {
    display: flex;
  }

  .collage-cell:hover {
    outline: none;
  }

  .collage-cell.active {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
  }

  .feature-card:hover {
    transform: none;
  }

  .blog-card:hover {
    transform: none;
  }

  .template-card:hover {
    transform: none;
  }

  .btn-primary:hover,
  .btn-outline:hover {
    transform: none;
  }

  /* Larger touch targets */
  .layout-option {
    min-height: 44px;
  }

  .size-preset {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .faq-question {
    min-height: 48px;
  }

  .control-group input[type="range"]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ===== Loading / Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-light);
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10001;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: rgba(0, 206, 201, 0.3);
}

.toast.error {
  border-color: rgba(255, 107, 107, 0.3);
}

/* Size presets */
.size-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.size-preset {
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
  transition: all var(--transition);
}

.size-preset:hover {
  border-color: var(--primary-light);
  color: var(--text-light);
}

.size-preset.active {
  border-color: var(--primary);
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary-light);
}
