:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-tool: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --radius: 8px;
  --max-w: 960px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Fira Code", "Consolas", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --bg-alt: #1e293b;
    --bg-tool: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
  }
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

a {
  color: var(--primary);
}

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem;
}

.nav-brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--primary);
  font-size: 1.125rem;
}

.nav-links a {
  margin-left: 1rem;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.nav-links a.active {
  color: var(--primary);
  font-weight: 600;
}

/* Hero */
.hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--text-muted);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Portal Grid */
.portal-grid-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem;
}

.portal-search {
  margin-bottom: 1rem;
}

.portal-search-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.portal-search input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 0.95rem;
}

.portal-search input:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}

.portal-search-meta {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

.portal-card {
  display: block;
  padding: 1.5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

.portal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.portal-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.portal-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.portal-card-cta {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

/* Tool Section */
.tool-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 768px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }
}

.tool-pane label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.tool-pane textarea {
  width: 100%;
  min-height: 300px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  background: var(--bg-tool);
  color: var(--text);
  resize: vertical;
}

.tool-pane textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}

.tool-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 1.75rem;
}

@media (max-width: 768px) {
  .tool-actions {
    flex-direction: row;
    flex-wrap: wrap;
    padding-top: 0;
  }
}

/* Buttons */
button {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
  transition: background 0.15s;
}

button:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.error {
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Content Sections */
.content-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
}

.content-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.steps {
  padding-left: 1.25rem;
}

.steps li {
  margin-bottom: 1rem;
  padding-left: 0.5rem;
}

.steps li strong {
  display: block;
}

.steps li p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.features-list {
  list-style: none;
}

.features-list li {
  padding: 0.5rem 0 0.5rem 1.5rem;
  position: relative;
}

.features-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

/* FAQ */
.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.faq summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
}

.faq details[open] summary {
  border-bottom: 1px solid var(--border);
}

.faq details p {
  padding: 1rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* Related */
.related {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
}

.related h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

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

.related-card {
  display: block;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}

.related-card:hover {
  border-color: var(--primary);
}

.related-card strong {
  display: block;
  margin-bottom: 0.25rem;
}

.related-card span {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* CTA Banner */
.cta-banner {
  max-width: var(--max-w);
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.cta-inner {
  display: block;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
  border-radius: 12px;
  text-decoration: none;
  color: #fff;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cta-inner:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(30, 64, 175, 0.3);
}

.cta-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.cta-title {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.375rem;
}

.cta-desc {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.cta-button {
  display: inline-block;
  padding: 0.625rem 1.5rem;
  background: #fff;
  color: #1e40af;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.9rem;
}

@media (prefers-color-scheme: dark) {
  .cta-inner {
    background: linear-gradient(135deg, #1e3a8a 0%, #5b21b6 100%);
  }
}

/* Ad Slot */
.ad-slot {
  max-width: var(--max-w);
  margin: 1rem auto;
  padding: 0 1rem;
  min-height: 90px;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-inner nav a {
  margin-left: 1.5rem;
  text-decoration: none;
  color: var(--text-muted);
}

.footer-inner nav a:hover {
  color: var(--text);
}

@media (max-width: 768px) {
  .footer-inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .footer-inner nav a {
    margin: 0 0.75rem;
  }
}
