/* Storyling — design tokens */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=Playfair+Display:wght@700;800&display=swap');

:root {
  --bg: #0f0a1a;
  --bg-2: #1a1230;
  --surface: #22183a;
  --border: #2e2048;
  --text: #e8e0f0;
  --text-muted: #9b8fb8;
  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --danger: #f87171;
  --radius: 12px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Navigation ───────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-brand span { color: var(--accent); }

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

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

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

/* ── Layout ───────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

.section { padding: 5rem 0; }

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #0f0a1a;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #0f0a1a; }

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

/* ── Forms ────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input[type="text"],
input[type="email"],
textarea, select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  transition: border-color 0.2s;
  width: 100%;
}

textarea { resize: vertical; min-height: 100px; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

.hint { font-size: 0.8rem; color: var(--text-muted); }

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}

.character-card {
  transition: transform 0.2s, border-color 0.2s;
  cursor: pointer;
}

.character-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.character-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ── Grid ────────────────────────────────── */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* ── Hero ────────────────────────────────── */
.hero {
  text-align: center;
  padding: 6rem 0 4rem;
}

.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.03em;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

/* ── Page header ─────────────────────────── */
.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

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

/* ── Flash messages ──────────────────────── */
.flash {
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.flash-error { background: rgba(248,113,113,0.15); color: var(--danger); border: 1px solid var(--danger); }
.flash-success { background: rgba(167,139,250,0.15); color: var(--accent); border: 1px solid var(--accent); }

/* ── Loading spinner ─────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Empty state ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

/* ── Profile page ────────────────────────── */
.profile-backstory { font-size: 1.05rem; line-height: 1.8; }
.episode-box {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 16px;
  padding: 2rem;
  margin-top: 2rem;
}
.episode-box h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 1rem;
}
.episode-box p { line-height: 1.8; }

.profile-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

/* ── Create page ─────────────────────────── */
.create-form { max-width: 680px; margin: 0 auto; }
.create-form .form-group { margin-bottom: 1.5rem; }

/* ── Divider ──────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ── Footer ──────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Landing page: hero ─────────────────── */
.hero {
  text-align: center;
  padding: 7rem 0 5rem;
}

.hero-eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.8rem, 7vw, 5rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 2.5rem;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
}

/* ── Concept section ─────────────────────── */
.concept-section {
  padding: 5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}

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

.concept-item {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.concept-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.concept-item h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.concept-item p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

/* ── Steps section ───────────────────────── */
.steps-section {
  padding: 5rem 0;
}

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3.5rem;
  letter-spacing: -0.02em;
}

.steps-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1.5rem;
}

.step {
  flex: 1;
  max-width: 260px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.step-number {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 700;
}

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

.step-arrow {
  font-size: 1.5rem;
  color: var(--border);
  padding-top: 1.2rem;
  flex-shrink: 0;
}

/* ── Final CTA ─────────────────────────────── */
.final-cta {
  padding: 6rem 0;
  text-align: center;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
}

.cta-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.cta-sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 0 1.25rem; }
  .nav { padding: 1rem 1.25rem; }
  .nav-links { gap: 1rem; }
  .hero { padding: 4rem 0 3rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .concept-grid { grid-template-columns: 1fr; gap: 2rem; }
  .steps-row { flex-direction: column; align-items: center; gap: 0.75rem; }
  .step-arrow { transform: rotate(90deg); }
  .step { max-width: 100%; }
}