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

:root {
  --bg-color: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --error: #ef4444;
  --success: #22c55e;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --header-bg: rgba(255, 255, 255, 0.95);
  --footer-bg: #0f172a;
  --footer-text: #cbd5e1;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #020617;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --bg-surface: #0f172a;
    --bg-surface-hover: #1e293b;
    --border-color: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: #172554;
    --header-bg: rgba(15, 23, 42, 0.95);
  }
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.brand-logo svg {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

header {
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.5rem;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 1.25rem;
    box-shadow: var(--shadow-md);
  }
  .nav-links.active {
    display: flex;
  }
  .menu-toggle {
    display: block;
  }
}

main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

h1 { font-size: 2.5rem; font-weight: 800; margin-top: 0; margin-bottom: 1.5rem; }
h2 { font-size: 1.875rem; margin-top: 3rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p { margin-bottom: 1.5rem; color: var(--text-secondary); font-size: 1.0625rem; }
ul, ol { margin-bottom: 1.5rem; padding-left: 1.5rem; color: var(--text-secondary); font-size: 1.0625rem; }
li { margin-bottom: 0.5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background-color: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 1rem;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

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

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* Tool Layout */
.tool-workspace {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 3rem;
}

@media (min-width: 992px) {
  .tool-workspace {
    flex-direction: row;
    align-items: stretch;
  }
  .tool-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
}

.tool-panel {
  background-color: var(--bg-surface);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.tool-panel label {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  align-items: center;
}

.tool-header-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

textarea {
  width: 100%;
  flex-grow: 1;
  min-height: 250px;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  background-color: var(--bg-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  resize: vertical;
  line-height: 1.5;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.error-msg {
  color: #b91c1c;
  background-color: #fef2f2;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid #f87171;
  margin-top: 1rem;
  display: none;
  font-weight: 500;
  font-size: 0.95rem;
}

@media (prefers-color-scheme: dark) {
  .error-msg {
    color: #fca5a5;
    background-color: rgba(127, 29, 29, 0.3);
    border-color: #991b1b;
  }
}

/* Article Styling */
.article-content {
  max-width: 800px;
  margin: 0 auto;
}

.article-content h2 {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin: 2rem 0;
}

pre {
  background-color: #0f172a;
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  border: 1px solid #1e293b;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--bg-surface-hover);
  color: var(--primary);
  border: 1px solid var(--border-color);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

pre code {
  background-color: transparent;
  color: inherit;
  border: none;
  padding: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
}

th, td {
  border: 1px solid var(--border-color);
  padding: 1rem;
  text-align: left;
}

th {
  background-color: var(--bg-surface-hover);
  font-weight: 600;
  color: var(--text-primary);
}

tr:nth-child(even) {
  background-color: var(--bg-color);
}

/* FAQ */
.faq-section {
  margin-top: 4rem;
}

.faq-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.faq-item h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.faq-item p:last-child {
  margin-bottom: 0;
}

/* Cards */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-hover);
}

.card h3 {
  margin-top: 0;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.card h3 a {
  color: var(--text-primary);
}

.card h3 a:hover {
  color: var(--primary);
  text-decoration: none;
}

.card p {
  flex-grow: 1;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.card-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  align-items: center;
}

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

.breadcrumb span.separator {
  color: var(--border-color);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 5rem 1.5rem;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg-color) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: 4rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  margin-bottom: 1.5rem;
}

.hero p {
  font-size: 1.25rem;
  max-width: 800px;
  margin: 0 auto 2.5rem;
  color: var(--text-secondary);
}

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

/* Footer */
footer {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  padding: 4rem 1.5rem 2rem;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 3rem;
}

.footer-brand .brand-logo {
  color: #ffffff;
}

.footer-brand p {
  margin-top: 1.5rem;
  color: var(--footer-text);
  font-size: 0.95rem;
}

.footer-section h4 {
  color: #ffffff;
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  margin-top: 0;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section li {
  margin-bottom: 0.75rem;
}

.footer-section a {
  color: var(--footer-text);
  text-decoration: none;
  font-size: 0.95rem;
}

.footer-section a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.footer-bottom {
  max-width: 1200px;
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid #1e293b;
  text-align: center;
  font-size: 0.9rem;
  color: #94a3b8;
}

/* Layout helpers */
.toc {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 2rem 0;
}
.toc h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}
.toc ul {
  margin-bottom: 0;
  list-style-type: none;
  padding-left: 0;
}
.toc li {
  margin-bottom: 0.5rem;
}
.toc a {
  color: var(--text-secondary);
}
.toc a:hover {
  color: var(--primary);
}
