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

/* Variables */
:root {
  --bg: #0b0f14;
  --bg-raised: #131920;
  --bg-surface: #1a2029;
  --bg-surface-hover: #1f2733;
  --border: #262e38;
  --border-subtle: #1e2530;
  --text: #c9d1d9;
  --text-muted: #768390;
  --accent: #4c9aff;
  --accent-subtle: rgba(76, 154, 255, 0.08);
  --accent-border: rgba(76, 154, 255, 0.25);
  --heading: #ecf2f8;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  --max-width: 920px;
  --radius: 8px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Nav */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 20, 0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 3.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-brand {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--heading);
  text-decoration: none;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  white-space: nowrap;
}

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

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.3125rem 0.625rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-surface);
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-subtle);
}

/* Nav actions (copy all, etc.) — pushed to the right */
.nav-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.copy-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

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

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

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-bottom: 0.625rem;
}

.hero .subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 1.25rem;
  line-height: 1.5;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  justify-content: center;
}

.tag {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

/* Page header — inner pages */
.page-header {
  padding: 2.5rem 0 0;
}

.page-header h1 {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0;
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-top: 0.375rem;
  line-height: 1.5;
}

/* Main content */
main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  width: 100%;
}

/* Content wrapper (positions copy button) */
.content-wrapper {
  position: relative;
}

/* Copy button — top right of content */
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  opacity: 0.6;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-subtle);
  opacity: 1;
}

/* Article / markdown content */
.content {
  font-size: 0.9375rem;
}

.content h1 {
  display: none;
}

.content h2 {
  font-size: 1.3125rem;
  font-weight: 650;
  color: var(--heading);
  letter-spacing: -0.02em;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.content h2:first-child {
  margin-top: 1.5rem;
}

.content h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--heading);
  margin: 1.75rem 0 0.5rem;
}

.content h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.25rem 0 0.375rem;
}

.content p {
  margin: 0 0 0.875rem;
}

.content strong {
  color: var(--heading);
  font-weight: 600;
}

.content em {
  color: var(--text-muted);
}

.content a {
  color: var(--accent);
  text-decoration: none;
}

.content a:hover {
  text-decoration: underline;
}

/* Hide markdown horizontal rules — h2 borders provide section separation */
.content hr {
  display: none;
}

/* Lists */
.content ul,
.content ol {
  margin: 0 0 0.875rem;
  padding-left: 1.375rem;
}

.content li {
  margin-bottom: 0.25rem;
}

.content li > ul,
.content li > ol {
  margin-top: 0.25rem;
  margin-bottom: 0;
}

/* Tables */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.content thead {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.content tbody {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.content thead th {
  text-align: left;
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.content tbody td {
  padding: 0.4375rem 0.625rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.content tbody tr:hover {
  background: var(--bg-surface);
}

/* Code */
.content code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.125em 0.3em;
  color: var(--heading);
}

.content pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  overflow-x: auto;
  margin: 0.75rem 0 1.25rem;
}

.content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text);
}

/* Blockquotes */
.content blockquote {
  border-left: 2px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 0.75rem 0 1.25rem;
  color: var(--text-muted);
  background: var(--bg-raised);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9375rem;
}

/* Footer */
footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 1.5rem;
  text-align: center;
}

footer p {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* Login */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  width: 100%;
  max-width: 300px;
  padding: 2rem;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login-input {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  padding: 0.625rem 0.875rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.login-input:focus {
  border-color: var(--accent);
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-button {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.625rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.login-button:hover {
  opacity: 0.85;
}

.login-error {
  font-size: 0.8125rem;
  color: #f85149;
  text-align: center;
  margin: 0;
}

.login-rate-limit {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

/* Responsive */
@media (max-width: 640px) {
  .nav-inner {
    height: auto;
    flex-wrap: wrap;
    padding: 0.625rem 1rem;
    gap: 0.5rem;
  }

  .nav-brand {
    font-size: 0.875rem;
  }

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

  .nav-links a {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .hero {
    padding: 2.5rem 0 1rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero .subtitle {
    font-size: 0.9375rem;
  }

  .page-header h1 {
    font-size: 1.375rem;
  }

  main {
    padding: 0 1rem 3rem;
  }

  .content {
    font-size: 0.875rem;
  }

  .content h2 {
    font-size: 1.125rem;
  }

  .content table {
    font-size: 0.75rem;
  }

  .content thead th,
  .content tbody td {
    padding: 0.3125rem 0.5rem;
  }
}
