/* ─────────────────────────────────────────────────────────────────────
   kuberscan.com, Anthropic-docs-inspired palette
   ───────────────────────────────────────────────────────────────────── */

:root {
  --bg: #faf9f5;
  --surface: #ffffff;
  --surface-soft: #f3f1ec;
  --text: #181818;
  --text-soft: #2d2d2d;
  --text-muted: #6e6e6e;
  --text-faint: #8a8a8a;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --accent: #cc785c;
  --accent-hover: #b6664a;
  --accent-soft: rgba(204, 120, 92, 0.12);
  --success: #2c7a3a;
  --error: #b3413a;
  --warning: #a16500;
  --code-bg: #f3f1ec;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --content-width: 760px;
  --wide-width: 1080px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, 'SF Pro Text', BlinkMacSystemFont,
               'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── Layout primitives ─────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow { max-width: var(--content-width); }

main { flex: 1 0 auto; }

/* ── Top nav ───────────────────────────────────────────────────────── */

.nav {
  background: rgba(250, 249, 245, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
  color: var(--text);
}
.nav-brand:hover { color: var(--text); text-decoration: none; }

.nav-brand .dot { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 6px;
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: var(--text-soft);
  font-size: 14.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease, color 0.12s ease;
}

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

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

/* ── Mobile nav toggle ─────────────────────────────────────────────── */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: var(--text-soft);
  padding: 4px 8px;
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    right: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    flex-direction: column;
    align-items: stretch;
    box-shadow: var(--shadow-md);
    min-width: 180px;
  }
  .nav-links.is-open { display: flex; }
}

/* ── Hero ──────────────────────────────────────────────────────────── */

.hero {
  padding: 100px 0 80px;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.08;
  margin-bottom: 18px;
  color: var(--text);
}

.hero p.subtitle {
  font-size: clamp(16px, 2vw, 19px);
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 36px;
  line-height: 1.55;
}

.cta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease, transform 0.1s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-soft); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-soft); text-decoration: none; }

.btn-danger {
  background: transparent;
  color: var(--error);
  border-color: rgba(179, 65, 58, 0.4);
}
.btn-danger:hover { background: rgba(179, 65, 58, 0.08); text-decoration: none; }

/* ── Section primitives ────────────────────────────────────────────── */

section { padding: 60px 0; }

section.surface { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 24px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: clamp(24px, 3.5vw, 32px);
  font-weight: 700;
  letter-spacing: -0.7px;
}

.section-head .see-all {
  font-size: 14.5px;
  font-weight: 600;
}

/* ── Cards ─────────────────────────────────────────────────────────── */

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

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

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

.card h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 8px;
  color: var(--text);
}

.card p {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.card .meta {
  margin-top: auto;
  padding-top: 16px;
  font-size: 12.5px;
  color: var(--text-faint);
  letter-spacing: 0.2px;
}

a.card { color: inherit; }

/* ── Prose (markdown-rendered content) ─────────────────────────────── */

.prose {
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--text-soft);
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--text);
  letter-spacing: -0.4px;
  margin: 2.2em 0 0.6em;
  line-height: 1.25;
}
.prose h1 { font-size: 2em; margin-top: 0; }
.prose h2 { font-size: 1.55em; padding-top: 0.4em; border-top: 1px solid var(--border); }
.prose h3 { font-size: 1.25em; }
.prose h4 { font-size: 1.05em; }

.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table {
  margin-bottom: 1.1em;
}

.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: 0.3em; }

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.2em 1em;
  color: var(--text-muted);
  background: var(--surface-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.prose code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  color: var(--text);
}

.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-size: 13.5px;
}
.prose pre code { background: none; padding: 0; }

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1em 0;
  border: 1px solid var(--border);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.prose th, .prose td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.prose th { background: var(--surface-soft); font-weight: 600; }

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

.prose a { font-weight: 500; }

/* ── Flash messages ────────────────────────────────────────────────── */

.flash-stack {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  min-width: 260px;
}
.flash.success { border-left: 4px solid var(--success); }
.flash.error   { border-left: 4px solid var(--error); }
.flash.info    { border-left: 4px solid var(--accent); }

/* ── Forms ─────────────────────────────────────────────────────────── */

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(204, 120, 92, 0.16);
}

textarea { resize: vertical; min-height: 160px; }

.form-row + .form-row { margin-top: 18px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 24px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; cursor: pointer; }

.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* ── Tables ────────────────────────────────────────────────────────── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table th, .data-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
}

.data-table th {
  background: var(--surface-soft);
  font-weight: 600;
  color: var(--text-soft);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(0,0,0,0.015); }

.row-actions { display: flex; gap: 6px; }
.row-actions form { display: inline; }

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}
.badge-published { background: rgba(44, 122, 58, 0.14); color: var(--success); }
.badge-draft     { background: rgba(0, 0, 0, 0.06);     color: var(--text-muted); }

/* ── Article header / list ─────────────────────────────────────────── */

.article-header {
  padding: 60px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.article-header h1 {
  font-size: clamp(28px, 4.5vw, 42px);
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1.15;
  margin-bottom: 12px;
}

.article-header .meta {
  color: var(--text-muted);
  font-size: 14px;
}

.article-summary {
  font-size: 17px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.55;
}

.article-list { list-style: none; }
.article-list li + li { margin-top: 18px; }

.article-item {
  display: block;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
}
.article-item:hover { color: inherit; text-decoration: none; }
.article-item:hover h3 { color: var(--accent); }
.article-item h3 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
  transition: color 0.12s ease;
}
.article-item .summary {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 6px;
}
.article-item .meta {
  font-size: 12.5px;
  color: var(--text-faint);
  letter-spacing: 0.2px;
}

/* ── Footer ────────────────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 13.5px;
  margin-top: 80px;
}

footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

footer .footer-links {
  display: flex;
  gap: 20px;
}
footer .footer-links a { color: var(--text-muted); }
footer .footer-links a:hover { color: var(--text); text-decoration: none; }

/* ── Misc ──────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state h3 { color: var(--text); margin-bottom: 8px; font-size: 20px; }

.kbd {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 2px 6px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ── Admin sub-nav tabs ────────────────────────────────────────────── */

.admin-nav {
  display: flex;
  gap: 4px;
  margin: 0 auto 32px;
  padding: 0 24px;
  max-width: var(--content-width);
  border-bottom: 1px solid var(--border);
}

.admin-nav a {
  display: inline-block;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
  letter-spacing: 0.1px;
}

.admin-nav a:hover {
  color: var(--text);
  text-decoration: none;
  border-bottom-color: var(--border-strong);
}

.admin-nav a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Plugin cards (public list) ────────────────────────────────────── */

.plugin-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  color: inherit;
}

.plugin-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: inherit;
}

.plugin-card .plugin-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.plugin-card .plugin-icon--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
  color: var(--accent);
  background: var(--accent-soft);
}

.plugin-card .plugin-body { min-width: 0; }

.plugin-card h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 4px;
  color: var(--text);
}

.plugin-card p {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

.plugin-card .plugin-arrow {
  font-size: 18px;
  color: var(--text-faint);
  transition: transform 0.15s ease, color 0.15s ease;
}

.plugin-card:hover .plugin-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.plugin-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Page editor: "Import from GitHub" button row ─────────────────── */

.editor-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* SimpleMDE overrides for our palette */
.EasyMDEContainer .editor-toolbar { border-color: var(--border-strong); }
.EasyMDEContainer .CodeMirror {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
}
.EasyMDEContainer .editor-toolbar a {
  color: var(--text-soft) !important;
}
.EasyMDEContainer .editor-preview {
  background: var(--surface);
  color: var(--text);
}
