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

:root {
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Primary (near-black) drives buttons/actions/headings. Accent orange is
     used sparingly — links, small eyebrow labels, focus rings — not as a
     fill color, so it stays a genuine accent rather than competing with
     primary actions. */
  --primary: #0a0a0a;
  --accent: #f97316;
  --accent-soft: #fff1e6;

  --bg: #faf9f7;
  --surface: #ffffff;
  --border: #e7e5e4;
  --text: #1c1917;
  --muted: #78716c;
  --danger: #dc2626;
  --danger-soft: #fee2e2;

  --success-bg: #dcfce7;
  --success-text: #166534;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;

  --sidebar-width: 232px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

code, .mono { font-family: var(--font-mono); }

h1, h2, h3 { font-weight: 800; letter-spacing: -0.01em; margin-top: 0; }

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Sidebar layout — light, not filled — main content is offset via
   --sidebar-width, no wrapper div needed around existing page markup. */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  color: var(--text);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 0 0.5rem 1.5rem;
  letter-spacing: -0.01em;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.sidebar-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
}
.sidebar-nav a:hover { background: var(--bg); color: var(--text); }
.sidebar-nav a.active { background: var(--bg); color: var(--primary); }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1rem; }
.sidebar-blog {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0 0.75rem 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}
.sidebar-logout:hover { background: var(--bg); color: var(--text); }

main {
  margin-left: var(--sidebar-width);
  max-width: 860px;
  padding: 2.5rem 3rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.button, button, input[type="submit"] {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  transition: opacity 0.15s ease;
}
.button:hover, button:hover, input[type="submit"]:hover { opacity: 0.82; }

.button-pill { border-radius: 999px; width: 100%; text-align: center; }

.button-danger { background: var(--surface); color: var(--danger); border: 1px solid var(--danger-soft); }
.button-danger:hover { background: var(--danger-soft); opacity: 1; }

.post-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.post-table th {
  text-align: left;
  padding: 0.85rem 1.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.post-table td {
  text-align: left;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.post-table tr:last-child td { border-bottom: none; }
.post-table a { color: var(--text); font-weight: 700; text-decoration: none; }
.post-table a:hover { color: var(--accent); }

.badge {
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-published { background: var(--success-bg); color: var(--success-text); }
.badge-draft { background: var(--warning-bg); color: var(--warning-text); }
.badge-selected { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

.post-form, .auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  background: var(--surface);
  padding: 1.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.inline-form { margin-top: 1rem; }
.form-actions { display: flex; gap: 0.6rem; align-items: center; }

label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.88rem; font-weight: 600; color: var(--muted); }
input, textarea, select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem; display: flex; flex-direction: column; gap: 1rem; }
legend { font-weight: 700; padding: 0 0.4rem; }

.error { color: var(--danger); font-weight: 600; }
.notice {
  color: var(--success-text);
  background: var(--success-bg);
  padding: 0.85rem 1.1rem;
  border-radius: 10px;
  word-break: break-all;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.notice-info {
  color: var(--warning-text);
  background: var(--warning-bg);
  padding: 0.85rem 1.1rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem;
}
.blog-card-active { border-color: var(--primary); }
.blog-card h2 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.blog-card code { background: var(--bg); padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.85rem; }
.blog-card a { color: var(--accent); font-weight: 600; text-decoration: none; }
.blog-card a:hover { text-decoration: underline; }
.blog-card .form-actions { margin-top: 1rem; gap: 0.5rem; }
.blog-card form { display: inline-block; }
.blog-card button { border-radius: 999px; }

/* Split-screen auth pages: form on the left, marketing panel on the right —
   collapses to just the form under ~900px. */
.auth-page {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-form { width: 380px; border: none; padding: 0; background: transparent; }
.auth-brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 800; margin-bottom: 2rem; }
.auth-form h1 { margin: 0 0 0.4rem; font-size: 1.7rem; color: var(--primary); }
.auth-subtitle { margin: 0 0 0.5rem; color: var(--muted); }
.auth-form p a { color: var(--accent); font-weight: 700; text-decoration: none; }
.auth-form p a:hover { text-decoration: underline; }

.auth-panel {
  flex: 1;
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
}
.auth-panel-eyebrow {
  color: var(--accent);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.auth-panel h2 { font-size: 2.4rem; line-height: 1.15; margin: 0 0 1rem; max-width: 20ch; }
.auth-panel p { color: #d6d3d1; font-size: 1.05rem; max-width: 38ch; line-height: 1.5; }

@media (max-width: 900px) {
  .auth-panel { display: none; }
}

.emb-meta { color: var(--muted); font-size: 0.88rem; }

.page-intro { color: var(--muted); margin-top: -0.5rem; margin-bottom: 1.75rem; }
.page-intro a { color: var(--accent); font-weight: 600; text-decoration: none; }
.page-intro a:hover { text-decoration: underline; }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tab-btn {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.code-panel {
  background: var(--primary);
  border-radius: 12px;
  padding: 1rem 1.5rem 1.5rem;
  margin: 1rem 0 1.5rem;
}
.code-panel-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}
.code-panel pre {
  margin: 0;
  color: #f5f5f4;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}
.code-panel .copy-btn {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.code-panel .copy-btn:hover { background: rgba(255, 255, 255, 0.22); opacity: 1; }

.platform-picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.platform-picker .post-form { border: none; padding: 0; margin-top: 1rem; }

.platform-switch {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.platform-switch label { flex-direction: column; }
.platform-switch select { width: auto; min-width: 220px; }

.step-list { display: flex; flex-direction: column; gap: 1.75rem; margin: 1.5rem 0 2rem; }
.step { display: flex; gap: 1rem; align-items: flex-start; }
.step-num {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.9rem;
}
.step-body { flex: 1; min-width: 0; }
.step-body h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.step-body .code-panel { margin: 0.6rem 0 0.5rem; }

.variant-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.variant-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}
.variant-card h3 { margin: 0 0 0.4rem; font-size: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.variant-card .code-panel { margin: 0.75rem 0 0; }
