/* ========== RICCO HIRING SYSTEM — STYLE ========== */
/* Palette per Visual Designer Blueprint:
   #E8D9C3 bej cald · #F5EFE5 crem · #4A7B4F verde · #3A2D1F maro · #B5563A cărămidă
*/

:root {
  --bg: #FAF7F2;
  --bg-card: #FFFFFF;
  --bg-soft: #F5EFE5;
  --bg-warm: #E8D9C3;
  --primary: #4A7B4F;
  --primary-dark: #3A6240;
  --primary-light: #6B9A6F;
  --text: #3A2D1F;
  --text-soft: #5A4A3A;
  --text-mute: #8A7A6A;
  --border: #E5DDD0;
  --border-soft: #F0E8D8;
  --accent: #B5563A;
  --code-bg: #F5EFE5;
  --shadow: 0 1px 3px rgba(58, 45, 31, 0.06), 0 4px 12px rgba(58, 45, 31, 0.04);
  --shadow-lg: 0 4px 12px rgba(58, 45, 31, 0.08), 0 12px 32px rgba(58, 45, 31, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1280px;
  --content-width: 760px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'Roboto Mono', Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1612;
    --bg-card: #241E18;
    --bg-soft: #2A2218;
    --bg-warm: #2E2519;
    --primary: #6B9A6F;
    --primary-dark: #4A7B4F;
    --primary-light: #8FB593;
    --text: #F5EFE5;
    --text-soft: #D4CABE;
    --text-mute: #A89886;
    --border: #3A3024;
    --border-soft: #2E2519;
    --code-bg: #1A1612;
  }
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem);
}

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

a:hover { color: var(--primary-dark); text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ========== LANDING ========== */

.landing {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 50%, var(--bg) 100%);
  min-height: 100vh;
}

.hero {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 6vw, 4rem);
  background:
    radial-gradient(ellipse at top, rgba(74, 123, 79, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-warm) 0%, transparent 100%);
}

.badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: var(--primary);
  color: white;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.hero h1 .dot { color: var(--primary); }

.lede {
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  color: var(--text-soft);
  max-width: 720px;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.sublede {
  font-size: 0.95rem;
  color: var(--text-mute);
  max-width: 720px;
  margin-bottom: 2.5rem;
}

.cta-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none !important;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 123, 79, 0.3);
}

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

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

/* ========== STATS ========== */

.stats {
  padding: 3rem 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 2rem;
  text-align: center;
}

.stat-num {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* ========== SECTIONS ========== */

section { padding: clamp(3rem, 6vw, 5rem) 0; }

section h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.section-lede {
  font-size: 1.1rem;
  color: var(--text-soft);
  margin-bottom: 3rem;
  max-width: 720px;
}

/* ========== QUICKSTART ========== */

.quickstart { background: var(--bg); }

.path {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 2rem;
}

.path li {
  display: flex;
  gap: 1.5rem;
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.path li:hover {
  border-color: var(--primary);
  transform: translateX(4px);
}

.path-num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.path h3 {
  font-size: 1.15rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.path p {
  color: var(--text-soft);
  font-size: 0.95rem;
}

/* ========== LAYERS ========== */

.layers { background: var(--bg-soft); }

.layer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.layer-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
  position: relative;
}

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

.layer-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--bg-warm);
  color: var(--text);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.layer-1 .layer-tag { background: #FFE5C8; color: #8C5A1F; }
.layer-2 .layer-tag { background: #E8D9F5; color: #5A3A8A; }
.layer-3 .layer-tag { background: #D4E8E0; color: #2A6B4A; }
.layer-4 .layer-tag { background: #FFE0CC; color: #B5563A; }
.layer-5 .layer-tag { background: var(--primary); color: white; }

.layer-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.layer-card > p {
  color: var(--text-soft);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.layer-files {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.layer-files a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  border: 1px solid transparent;
}

.layer-files a:hover {
  background: var(--bg-soft);
  color: var(--primary);
  text-decoration: none;
  border-color: var(--border-soft);
}

.model-tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  background: var(--bg-warm);
  color: var(--text-soft);
  border-radius: 100px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.layer-cta {
  display: inline-block;
  margin-top: 1rem;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ========== PRINCIPLES ========== */

.principles { background: var(--bg); }

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

.rule {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  align-items: flex-start;
}

.rule-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.rule div:last-child {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.rule strong { color: var(--text); }

/* ========== PERSONAS ========== */

.personas { background: var(--bg-soft); }

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

.persona {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.persona::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
}

.persona-1::before { background: #4A7B4F; }
.persona-2::before { background: #B5563A; }
.persona-3::before { background: #8B5A8C; }

.persona-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.persona h3 {
  font-size: 1.3rem;
  margin-bottom: 0.25rem;
}

.persona-meta {
  font-size: 0.85rem;
  color: var(--text-mute);
  font-style: italic;
  margin-bottom: 1rem;
}

.persona ul {
  list-style: none;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.persona ul li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.persona ul li:last-child { border-bottom: none; }

/* ========== CAMPAIGNS ========== */

.campaigns { background: var(--bg); }

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

.campaign {
  background: var(--bg-card);
  padding: 1.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
}

.campaign-1 { border-left-color: #4A7B4F; }
.campaign-2 { border-left-color: #C5A23A; }
.campaign-3 { border-left-color: #4A6B9A; }

.campaign h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.campaign-target {
  font-size: 0.85rem;
  color: var(--text-mute);
  margin-bottom: 1rem;
  font-weight: 500;
}

.campaign-msg {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 1rem;
  font-style: italic;
}

.campaign-budget {
  font-size: 0.85rem;
  color: var(--text-soft);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ========== SEARCH ========== */

.search-section { background: var(--bg-warm); }

.search-input {
  width: 100%;
  max-width: 720px;
  padding: 1rem 1.25rem;
  font-size: 1.05rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(74, 123, 79, 0.15);
}

.search-results {
  margin-top: 1.5rem;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-result {
  background: var(--bg-card);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}

.search-result:hover {
  border-color: var(--primary);
  transform: translateX(4px);
}

.search-result a {
  color: var(--text);
  font-weight: 600;
}

.search-result-snippet {
  font-size: 0.85rem;
  color: var(--text-mute);
  margin-top: 0.25rem;
}

mark {
  background: #FFE5A0;
  color: var(--text);
  padding: 0.1rem 0.2rem;
  border-radius: 3px;
}

/* ========== FOOTER ========== */

.footer {
  background: var(--text);
  color: var(--bg-warm);
  padding: 3rem 0 2rem;
  margin-top: 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer h4 {
  color: white;
  font-size: 1rem;
  margin-bottom: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.footer p {
  font-size: 0.9rem;
  opacity: 0.8;
  line-height: 1.6;
}

.footer ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer a {
  color: var(--bg-warm);
  font-size: 0.9rem;
  opacity: 0.8;
}

.footer a:hover { opacity: 1; color: white; }

.footer-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem !important;
  opacity: 0.6;
}

/* ========== VIEWER PAGE ========== */

.viewer-page { background: var(--bg); }

.viewer-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: 60px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

@media (prefers-color-scheme: dark) {
  .viewer-header { background: rgba(36, 30, 24, 0.95); }
}

.viewer-header-inner {
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text-soft);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.back-btn:hover {
  background: var(--primary);
  color: white;
  text-decoration: none;
}

.viewer-title {
  flex: 1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.viewer-brand {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

.viewer-sep { color: var(--text-mute); }

.viewer-file {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-toggle {
  background: var(--bg-soft);
  border: none;
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s ease;
}

.sidebar-toggle:hover { background: var(--primary); color: white; }

.viewer-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 60px);
  max-width: var(--max-width);
  margin: 0 auto;
}

.viewer-sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  padding: 1.5rem 0;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.sidebar-search {
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.filter-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}

.filter-input:focus {
  outline: none;
  border-color: var(--primary);
}

.sidebar-nav { padding: 0 0.5rem; }

.sidebar-nav details {
  margin-bottom: 0.25rem;
}

.sidebar-nav summary {
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  border-radius: var(--radius-sm);
  list-style: none;
  user-select: none;
  transition: background 0.15s ease;
}

.sidebar-nav summary::-webkit-details-marker { display: none; }

.sidebar-nav summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 0.75rem;
  transition: transform 0.15s ease;
  color: var(--text-mute);
}

.sidebar-nav details[open] summary::before {
  transform: rotate(90deg);
}

.sidebar-nav summary:hover { background: var(--bg-soft); }

.sidebar-nav ul {
  list-style: none;
  margin: 0.25rem 0 0.5rem 0;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border);
}

.sidebar-nav ul a {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  transition: all 0.1s ease;
}

.sidebar-nav ul a:hover {
  background: var(--bg-soft);
  color: var(--primary);
  text-decoration: none;
}

.sidebar-nav ul a.active {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.viewer-main {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 2rem;
  padding: 2rem clamp(1rem, 3vw, 2.5rem);
  min-width: 0;
}

.markdown-body {
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

.toc-panel {
  position: sticky;
  top: 80px;
  height: max-content;
  font-size: 0.85rem;
  padding: 1rem;
  border-left: 1px solid var(--border);
}

.toc-panel h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-bottom: 0.75rem;
}

.toc-panel a {
  display: block;
  padding: 0.3rem 0;
  color: var(--text-soft);
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
  margin-left: -0.75rem;
  transition: all 0.15s ease;
  font-size: 0.85rem;
  line-height: 1.4;
}

.toc-panel a:hover, .toc-panel a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  text-decoration: none;
}

.toc-panel a.toc-h3 { padding-left: 1.5rem; font-size: 0.8rem; opacity: 0.85; }
.toc-panel a.toc-h4 { padding-left: 2.25rem; font-size: 0.75rem; opacity: 0.7; }

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 1rem;
  color: var(--text-mute);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(74, 123, 79, 0.3);
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 50;
}

.scroll-top.visible { display: flex; }

.scroll-top:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* ========== MARKDOWN BODY ========== */

.markdown-body {
  color: var(--text);
  line-height: 1.7;
  font-size: 1rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
  scroll-margin-top: 80px;
}

.markdown-body h1 {
  font-size: 2.25rem;
  margin: 0 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary);
  letter-spacing: -0.02em;
}

.markdown-body h2 {
  font-size: 1.75rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.markdown-body h3 { font-size: 1.4rem; margin: 2rem 0 0.85rem; color: var(--primary-dark); }
.markdown-body h4 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
.markdown-body h5 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }

.markdown-body p { margin: 0 0 1rem; }

.markdown-body strong { color: var(--text); font-weight: 700; }

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 1rem 1.5rem;
  padding-left: 0.5rem;
}

.markdown-body li { margin-bottom: 0.4rem; }

.markdown-body li > ul,
.markdown-body li > ol {
  margin-top: 0.4rem;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent);
  border: 1px solid var(--border-soft);
}

.markdown-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.markdown-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: inherit;
}

.markdown-body blockquote {
  border-left: 4px solid var(--primary);
  padding: 0.75rem 1.25rem;
  margin: 1.25rem 0;
  background: var(--bg-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
}

.markdown-body blockquote p:last-child { margin-bottom: 0; }
.markdown-body blockquote strong { color: var(--text); }

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
  white-space: normal;
}

.markdown-body table thead {
  background: var(--bg-soft);
}

.markdown-body table th,
.markdown-body table td {
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.markdown-body table th {
  font-weight: 700;
  color: var(--text);
}

.markdown-body table tbody tr:nth-child(even) {
  background: var(--bg-soft);
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.markdown-body a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: rgba(74, 123, 79, 0.3);
  text-underline-offset: 3px;
  transition: all 0.15s ease;
}

.markdown-body a:hover {
  color: var(--primary-dark);
  text-decoration-color: var(--primary-dark);
}

.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
}

/* Task lists */
.markdown-body ul li input[type="checkbox"] {
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* Emoji headers (✅ ❌ etc.) */
.markdown-body h2:has(> :first-child:is(span)) { gap: 0.5rem; display: flex; align-items: center; }

/* ========== RESPONSIVE ========== */

@media (max-width: 1024px) {
  .viewer-main { grid-template-columns: 1fr; }
  .toc-panel { display: none; }
}

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

  .viewer-sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 50;
    box-shadow: var(--shadow-lg);
  }

  .viewer-sidebar.open { transform: translateX(0); }

  .viewer-title { font-size: 0.85rem; }
  .viewer-brand { display: none; }
  .viewer-sep { display: none; }

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

  .cta-row { flex-direction: column; }
  .cta-row .btn { width: 100%; justify-content: center; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
  .stat-num { font-size: 2rem; }

  .markdown-body table {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 2rem; }
  .lede { font-size: 1.05rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .markdown-body h1 { font-size: 1.6rem; }
  .markdown-body h2 { font-size: 1.35rem; }
  .markdown-body h3 { font-size: 1.15rem; }
}

/* ========== PRINT ========== */

@media print {
  .viewer-header,
  .viewer-sidebar,
  .toc-panel,
  .scroll-top,
  .sidebar-toggle { display: none !important; }

  .viewer-layout { display: block; }
  .viewer-main { display: block; padding: 0; }
  .markdown-body { max-width: 100%; }
}
