/* ===== Variables ===== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.65; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ===== Header / Nav ===== */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.logo span { color: var(--text); }
nav ul {
  display: flex;
  gap: 0.2rem;
  align-items: center;
}
nav ul li a {
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
nav ul li a:hover,
nav ul li a.active {
  color: var(--primary);
  background: #eef2ff;
  text-decoration: none;
}
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.3s;
}

/* ===== Homepage Hero ===== */
.hero {
  text-align: center;
  padding: 5rem 1.5rem 3rem;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  line-height: 1.2;
}
.hero h1 span { color: var(--primary); }
.hero p {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 2.5rem;
}

/* ===== Generator Cards Grid (Homepage) ===== */
.generators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}
.generator-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: all 0.2s;
  display: block;
  color: var(--text);
  box-shadow: var(--shadow);
}
.generator-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.generator-card .icon {
  font-size: 2.75rem;
  margin-bottom: 1rem;
  display: block;
  line-height: 1;
}
.generator-card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.generator-card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ===== Main Content ===== */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}
.page-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
h1 {
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}
.intro {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ===== Tool Card ===== */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

/* ===== Form Elements ===== */
.form-group { margin-bottom: 1.25rem; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}
input[type="number"],
input[type="text"],
textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
textarea {
  resize: vertical;
  min-height: 130px;
  font-family: inherit;
  line-height: 1.6;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  line-height: 1;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eef2ff;
}
.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* ===== Result Box ===== */
.result-box {
  margin-top: 1.75rem;
  padding: 2rem;
  background: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 100%);
  border: 1.5px solid #c7d2fe;
  border-radius: var(--radius);
  text-align: center;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
}
.result-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.result-value {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  word-break: break-word;
}
.result-value.animate { animation: pop 0.25s ease; }
@keyframes pop {
  0% { transform: scale(0.75); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}
.result-placeholder {
  color: var(--muted);
  font-size: 1rem;
  font-style: italic;
}

/* ===== Color Generator ===== */
.color-preview {
  width: 100%;
  height: 160px;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  transition: background-color 0.3s ease;
  border: 1.5px solid var(--border);
  background: #6366f1;
}
.color-codes {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
}
.color-code-block { text-align: center; }
.color-code-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}
.color-code-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
}

/* ===== Team Generator ===== */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.team-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.team-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.team-card ul li {
  padding: 0.3rem 0;
  font-size: 0.925rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.team-card ul li:last-child { border-bottom: none; }

/* ===== Error state ===== */
.error-msg {
  color: #ef4444;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 0.5rem;
}

/* ===== FAQ ===== */
.faq { margin: 3rem 0 2rem; }
.faq > h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}
.faq-item {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  overflow: hidden;
  background: var(--surface);
}
.faq-question {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 1rem 1.25rem;
  font-size: 0.975rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  gap: 1rem;
  transition: background 0.15s;
}
.faq-question:hover { background: var(--bg); }
.faq-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  transition: transform 0.2s;
  line-height: 1;
}
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-answer {
  display: none;
  padding: 0 1.25rem 1rem;
  color: var(--muted);
  line-height: 1.75;
  font-size: 0.95rem;
}
.faq-item.open .faq-answer { display: block; }

/* ===== Related Links ===== */
.related { margin-top: 2.5rem; }
.related h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 0.75rem;
}
.related-link {
  display: block;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  text-align: center;
  transition: all 0.2s;
  color: var(--text);
}
.related-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eef2ff;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Stacked related sections: reduce gap between consecutive ones */
.related + .related { margin-top: 1.25rem; }

/* ===== Footer ===== */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
}
.footer-inner { max-width: 900px; margin: 0 auto; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1rem;
}
.footer-links a {
  color: var(--muted);
  font-size: 0.875rem;
}
.footer-links a:hover { color: var(--primary); }
.footer-copy {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ===== Responsive ===== */
@media (max-width: 700px) {
  .nav-toggle { display: flex; }
  nav ul {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    gap: 0.2rem;
    box-shadow: var(--shadow-md);
  }
  nav ul.open { display: flex; }
  nav ul li a { display: block; padding: 0.6rem 0.75rem; }
  .form-row { grid-template-columns: 1fr; }
  .hero { padding: 3rem 1.5rem 2rem; }
  main { padding: 2rem 1.25rem 3rem; }
  .tool-card { padding: 1.5rem; }
  .result-box { padding: 1.5rem; }
}
