@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #f0ebe3;
  --surface: #ffffff;
  --border: #e2ddd5;
  --text: #1a1a2e;
  --text-muted: #5a5a72;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #00b06f;
  --green-hover: #009a5f;
  --red: #ef4444;
  --code-bg: #1e1e2e;
  --code-text: #cdd6f4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 0 rgba(0,0,0,0.08);
  --shadow-md: 0 4px 0 rgba(0,0,0,0.06);
  --shadow-lg: 0 6px 0 rgba(0,0,0,0.05);
  --card-colors: #3b82f6, #8b5cf6, #f59e0b, #ef4444, #10b981, #ec4899;
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(circle, #d5cfc7 1px, transparent 1px);
  background-size: 24px 24px;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 3px solid var(--border);
  padding: 0 1.25rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-links a {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.nav-links a:hover {
  color: var(--text);
  background: var(--bg);
  transform: translateY(-1px);
}

/* ── Main ── */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
  width: 100%;
  flex: 1;
}

/* ── Footer ── */
footer {
  background: var(--surface);
  border-top: 3px solid var(--border);
  padding: 1.5rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Hero ── */
.hero {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1rem 0;
}
.hero h1 {
  font-family: 'Fredoka', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ── Generator Form ── */
.generator {
  margin-bottom: 3rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--surface);
  padding: 1.75rem;
  border-radius: var(--radius);
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
}

label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1rem;
}

textarea {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
textarea::placeholder {
  color: #a0a0b0;
}

button[type="submit"] {
  font-family: 'Fredoka', sans-serif;
  background: var(--green);
  color: #fff;
  border: none;
  border-bottom: 4px solid #008a55;
  border-radius: var(--radius-sm);
  padding: 0.85rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.1s;
  letter-spacing: 0.01em;
}
button[type="submit"]:hover {
  background: var(--green-hover);
  transform: translateY(-1px);
  border-bottom-width: 5px;
}
button[type="submit"]:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

/* ── Loading indicator ── */
.htmx-indicator {
  display: none;
  padding: 1.25rem 0;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
}
.htmx-indicator::before {
  content: '⚡ ';
}
.htmx-request .htmx-indicator,
.htmx-request ~ .htmx-indicator { display: block; }

/* ── Try these examples ── */
.examples {
  margin-top: 1.25rem;
  font-size: 0.9rem;
}
.examples p {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}
.examples ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.examples a {
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0;
  display: inline-block;
  transition: color 0.15s;
}
.examples a::before {
  content: '→ ';
  opacity: 0;
  transition: opacity 0.15s;
}
.examples a:hover {
  color: var(--accent);
}
.examples a:hover::before {
  opacity: 1;
}

/* ── Result card ── */
.result-card {
  margin-top: 1.5rem;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.3s ease-out;
}

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

.result-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}

.badge {
  font-family: 'Fredoka', sans-serif;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.placement {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.copy-btn {
  margin-left: auto;
  font-family: 'Fredoka', sans-serif;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}
.copy-btn.copied {
  color: var(--green);
  border-color: var(--green);
  background: rgba(0, 176, 111, 0.08);
}

pre {
  background: var(--code-bg);
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

code {
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  color: var(--code-text);
}

.explanation {
  padding: 1.25rem;
  background: var(--surface);
  border-top: 2px solid var(--border);
}
.explanation h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.explanation p {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: pre-wrap;
  line-height: 1.6;
}

.result-error {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(239, 68, 68, 0.08);
  border: 2px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-weight: 500;
}

/* ── Category cards grid ── */
.categories-grid {
  margin-bottom: 3rem;
}
.categories-grid h2 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}

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

.card {
  display: block;
  background: var(--surface);
  border: 3px solid var(--border);
  border-left-width: 5px;
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all 0.2s;
  position: relative;
}
.card:nth-child(1) { border-left-color: #3b82f6; }
.card:nth-child(2) { border-left-color: #8b5cf6; }
.card:nth-child(3) { border-left-color: #f59e0b; }
.card:nth-child(4) { border-left-color: #ef4444; }
.card:nth-child(5) { border-left-color: #10b981; }
.card:nth-child(6) { border-left-color: #ec4899; }

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 0 rgba(0,0,0,0.04);
  color: var(--text);
}
.card h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ── How it works ── */
.how-it-works, .faq {
  margin-bottom: 3rem;
}
.how-it-works h2, .faq h2 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}
.how-it-works ol {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  counter-reset: steps;
}
.how-it-works li {
  counter-increment: steps;
  color: var(--text-muted);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem 1rem 3.5rem;
  position: relative;
  box-shadow: var(--shadow);
}
.how-it-works li::before {
  content: counter(steps);
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  background: var(--accent);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.how-it-works strong { color: var(--text); }

/* ── FAQ ── */
details {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.15s;
}
details:hover {
  border-color: #c5c0b8;
}
summary {
  font-family: 'Fredoka', sans-serif;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.15s;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.2s;
  font-size: 0.85rem;
}
details[open] summary::before {
  transform: rotate(90deg);
}
details[open] summary {
  border-bottom: 2px solid var(--border);
  color: var(--accent);
}
details p {
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.back-link {
  margin-top: 2rem;
  font-size: 0.9rem;
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  body {
    background-size: 20px 20px;
  }
  .hero h1 {
    font-size: 1.8rem;
  }
  .hero p { font-size: 1rem; }
  main { padding: 1.5rem 1rem; }
  form { padding: 1.25rem; }
  .nav-links { display: none; }
  .how-it-works li {
    padding-left: 3rem;
  }
  .how-it-works li::before {
    width: 1.6rem;
    height: 1.6rem;
    font-size: 1rem;
    left: 0.75rem;
  }
}
