/* ── Reset & Base ──────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0e0c0b;
  --surface: #1a1715;
  --surface-hover: #242019;
  --border: #3a322a;
  --text: #e8ddd0;
  --text-muted: #a89a8a;
  --accent: #c9a96e;
  --accent-glow: rgba(201, 169, 110, 0.25);
  --serif: 'Cormorant Garamond', 'Georgia', serif;
  --sans: 'Inter', -apple-system, sans-serif;
  --radius: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Film-grain overlay ───────────────────────── */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}

/* ── Main container ───────────────────────────── */
main {
  width: 100%;
  max-width: 640px;
  padding: 4rem 1.5rem 2rem;
  flex: 1;
}

/* ── Banner ────────────────────────────────────── */
.banner {
  text-align: center;
  margin-bottom: 2rem;
  animation: fadeInDown 0.8s ease-out;
}

.banner h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.2rem, 7vw, 4.5rem);
  letter-spacing: 0.2em;
  white-space: nowrap;
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent-glow);
}

.banner-rule {
  width: 60px;
  height: 2px;
  background: var(--accent);
  margin: 1rem auto;
  opacity: 0.6;
}

.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text-muted);
}

/* ── Section Divider ───────────────────────────── */
.section-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 0 auto 2rem;
  width: 80%;
  opacity: 0.4;
}

/* ── Explainer ─────────────────────────────────── */
.explainer {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeIn 1s ease-out 0.2s both;
}

.explainer p {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.75;
}

.explainer strong {
  color: var(--text);
}

/* ── Controls ──────────────────────────────────── */
.controls {
  display: flex;
  gap: 2.5rem;
  justify-content: center;
  margin-bottom: 2.5rem;
  animation: fadeIn 1s ease-out 0.4s both;
}

.control-group {
  text-align: center;
}

.control-group h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
}

.gen-btn {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.gen-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.gen-btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.gen-btn:hover::before {
  opacity: 1;
}

.gen-btn:active {
  transform: translateY(0);
}

.gen-btn.active {
  border-color: var(--accent);
  background: var(--surface-hover);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* ── Output ────────────────────────────────────── */
.output-section {
  animation: fadeIn 1s ease-out 0.6s both;
  position: relative;
}

.output-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  min-height: 140px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.output-box.has-content {
  border-color: rgba(201, 169, 110, 0.3);
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.3);
}

#output-text {
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.8;
  white-space: pre-wrap;
  transition: opacity 0.3s ease;
}

.output-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.output-active {
  color: var(--text) !important;
  font-style: normal !important;
}

/* ── Copy button ───────────────────────────────── */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  margin-top: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  opacity: 0;
  pointer-events: none;
}

.copy-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-btn.copied {
  color: #7ecf8a;
  border-color: #7ecf8a;
}

.copy-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ── Footer ────────────────────────────────────── */
footer {
  padding: 2rem 1rem;
  text-align: center;
  width: 100%;
}

footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.5;
  letter-spacing: 0.08em;
}

footer a {
  color: #39ff14;
  text-decoration: none;
  transition: opacity var(--transition);
}

footer a:hover {
  opacity: 0.75;
}

/* ── Animations ────────────────────────────────── */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes textReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 480px) {
  main {
    padding: 3rem 1.25rem 2rem;
  }

  .controls {
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
  }

  .gen-btn {
    padding: 0.55rem 1.3rem;
  }
}