﻿/* ================================================================
   Code DR AI — Ultimate Vibe Coding Guide · shared styles
   Dark, editorial, long-form reading. Matches the main site's DNA.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400&display=swap');

:root {
  --vc-bg:          #07080F;
  --vc-bg-soft:     #0C0E1B;
  --vc-bg-elev:     #12142A;
  --vc-bg-raised:   #181B36;

  --vc-border:      color-mix(in oklch, #fff 10%, transparent);
  --vc-border-soft: color-mix(in oklch, #fff 6%, transparent);

  --vc-fg:          #E8EAF4;
  --vc-fg-soft:     #BEC1D8;
  --vc-fg-muted:    #8A8DA8;
  --vc-fg-faint:    #5A5D78;

  --vc-primary:     #6366F1; /* indigo */
  --vc-primary-2:   #818CF8;
  --vc-purple:      #A78BFA;
  --vc-mint:        #34D399;
  --vc-amber:       #FBBF24;
  --vc-red:         #F87171;
  --vc-cyan:        #22D3EE;

  --vc-max:         880px;   /* reading width */
  --vc-max-wide:    1180px;  /* toc / cover */

  --vc-serif:       'Fraunces', 'Iowan Old Style', Georgia, serif;
  --vc-sans:        'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --vc-mono:        'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--vc-bg);
  color: var(--vc-fg);
  font-family: var(--vc-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Ambient cosmic gradient — very subtle */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 1200px 800px at 15% -10%, color-mix(in oklch, var(--vc-primary) 18%, transparent), transparent 60%),
    radial-gradient(ellipse 1000px 700px at 95% 110%, color-mix(in oklch, var(--vc-purple) 14%, transparent), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed; inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 3px 3px;
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 0;
  opacity: 0.6;
}

main, header, footer, section { position: relative; z-index: 1; }

a { color: var(--vc-primary-2); text-decoration: none; }
a:hover { color: var(--vc-fg); }

::selection { background: color-mix(in oklch, var(--vc-primary) 50%, transparent); color: #fff; }

/* ── Container ─────────────────────────────────────────── */
.vc-wrap { max-width: var(--vc-max); margin: 0 auto; padding: 0 28px; }
.vc-wrap-wide { max-width: var(--vc-max-wide); margin: 0 auto; padding: 0 32px; }

/* ── Header ────────────────────────────────────────────── */
.vc-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklch, var(--vc-bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--vc-border);
}
.vc-header-inner {
  max-width: var(--vc-max-wide);
  margin: 0 auto;
  padding: 14px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
}
.vc-brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: -0.02em;
  font-size: 16px;
  color: var(--vc-fg);
  text-decoration: none;
}
/* Keeps "Code DR AI" one unit (flex gap was splitting it). */
.vc-brand-wordmark { white-space: nowrap; }
.vc-brand-mark {
  width: 28px; height: 28px; border-radius: 0;
  background: transparent;
  display: block;
  box-shadow: none;
}
.vc-brand-dr { color: var(--vc-primary-2); }
.vc-brand-sub {
  color: var(--vc-fg-muted); font-weight: 400; font-size: 13px; margin-left: 4px;
  padding-left: 12px; border-left: 1px solid var(--vc-border);
}

.vc-header-nav { display: flex; align-items: center; gap: 20px; }
.vc-header-nav a {
  font-size: 13px; font-weight: 500; color: var(--vc-fg-muted);
  transition: color 0.15s;
}
.vc-header-nav a:hover { color: var(--vc-fg); }

.vc-header-progress {
  position: absolute; bottom: -1px; left: 0; height: 2px;
  background: linear-gradient(90deg, var(--vc-primary), var(--vc-purple));
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 12px var(--vc-primary);
}

/* ── Buttons ───────────────────────────────────────────── */
.vc-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px;
  font-family: var(--vc-sans); font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  line-height: 1;
}
.vc-btn:active { transform: translateY(1px); }
.vc-btn-primary {
  background: var(--vc-primary);
  color: #fff;
  box-shadow: 0 8px 24px -10px var(--vc-primary), inset 0 1px 0 rgba(255,255,255,0.18);
}
.vc-btn-primary:hover { background: var(--vc-primary-2); color: #fff; }
.vc-btn-ghost {
  background: transparent;
  color: var(--vc-fg);
  border-color: var(--vc-border);
}
.vc-btn-ghost:hover { background: var(--vc-bg-elev); border-color: var(--vc-fg-muted); color: var(--vc-fg); }
.vc-btn-lg { padding: 14px 22px; font-size: 15px; border-radius: 12px; }

/* ── Type ──────────────────────────────────────────────── */
.vc-eyebrow {
  font-family: var(--vc-mono);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--vc-primary-2);
}

.vc-h1 {
  font-family: var(--vc-serif);
  font-size: clamp(36px, 6vw, 68px);
  line-height: 1.03;
  letter-spacing: -0.025em;
  font-weight: 500;
  margin: 0;
  text-wrap: balance;
  color: var(--vc-fg);
}
.vc-h1 em { color: var(--vc-primary-2); font-style: italic; }

.vc-dek {
  font-family: var(--vc-serif);
  font-size: clamp(18px, 2.2vw, 22px);
  font-weight: 400; font-style: italic;
  line-height: 1.45;
  color: var(--vc-fg-soft);
  max-width: 640px;
  text-wrap: balance;
}

/* ── Footer ────────────────────────────────────────────── */
.vc-footer {
  border-top: 1px solid var(--vc-border);
  padding: 44px 0 34px;
  margin-top: 80px;
  background: color-mix(in oklch, var(--vc-bg-soft) 60%, transparent);
  color: var(--vc-fg-muted);
  font-size: 13px;
}
.vc-footer-inner {
  max-width: var(--vc-max-wide);
  margin: 0 auto;
  padding: 0 32px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px; flex-wrap: wrap;
}
.vc-footer a { color: var(--vc-fg-muted); }
.vc-footer a:hover { color: var(--vc-fg); }
.vc-footer-buy {
  color: var(--vc-primary-2) !important;
  font-weight: 600;
}
.vc-footer-buy:hover { color: var(--vc-fg) !important; }
.vc-footer-meta { font-family: var(--vc-mono); font-size: 12px; color: var(--vc-fg-faint); }

/* ── Gate dialog ───────────────────────────────────────── */
.vc-gate-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in oklch, var(--vc-bg) 80%, black);
  backdrop-filter: blur(20px);
  display: grid; place-items: center;
  padding: 24px;
}
.vc-gate {
  width: 100%; max-width: 440px;
  background: var(--vc-bg-elev);
  border: 1px solid var(--vc-border);
  border-radius: 18px;
  padding: 34px 32px;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.6);
  animation: vc-gate-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes vc-gate-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.vc-gate h2 {
  font-family: var(--vc-serif);
  font-size: 26px; font-weight: 500; letter-spacing: -0.02em;
  margin: 12px 0 8px;
  color: var(--vc-fg);
}
.vc-gate p { margin: 0 0 20px; color: var(--vc-fg-muted); font-size: 14px; line-height: 1.55; }

.vc-field { margin-bottom: 12px; }
.vc-field label {
  display: block; margin-bottom: 6px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--vc-fg-muted);
}
.vc-field input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--vc-border);
  background: var(--vc-bg);
  color: var(--vc-fg);
  font-family: var(--vc-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.vc-field input:focus { border-color: var(--vc-primary); background: var(--vc-bg-soft); }
.vc-field input::placeholder { color: var(--vc-fg-faint); }

.vc-gate-error {
  font-size: 12px; color: var(--vc-red);
  margin: 6px 0 0;
  min-height: 16px;
}

.vc-gate-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--vc-border);
  font-size: 12px; color: var(--vc-fg-faint);
  line-height: 1.5;
}

/* Divider between stages inside gate */
.vc-gate-stage + .vc-gate-stage { display: none; }
.vc-gate[data-stage="2"] .vc-gate-stage[data-idx="1"] { display: none; }
.vc-gate[data-stage="2"] .vc-gate-stage[data-idx="2"] { display: block; }

/* ── Utilities ─────────────────────────────────────────── */
.vc-mono { font-family: var(--vc-mono); }
.vc-muted { color: var(--vc-fg-muted); }
.vc-faint { color: var(--vc-fg-faint); }
.vc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Skill Pack exam bar (injected by guide-shell.js) ── */
.vc-exam-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35; /* below .vc-header (40) and .vc-gate-backdrop (100) */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in oklch, var(--vc-bg-elev) 92%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-top: 1px solid var(--vc-border);
  box-shadow: 0 -12px 32px -18px rgba(0, 0, 0, 0.55);
}
.vc-exam-bar[hidden] { display: none; }
.vc-exam-bar-link {
  display: block;
  max-width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--vc-fg);
  text-decoration: none;
}
.vc-exam-bar-link:hover { color: var(--vc-fg); }
.vc-exam-bar-price {
  color: var(--vc-primary-2);
  white-space: nowrap;
}
body.has-exam-bar {
  padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .vc-header-nav { display: none; }
  .vc-wrap, .vc-wrap-wide { padding: 0 22px; }
  .vc-exam-bar {
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .vc-exam-bar-link { font-size: 12px; }
  body.has-exam-bar {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }
}
/* ── Markdown tables (chapter bodies) ──────────────────── */
.tbl-wrap { overflow-x: auto; margin: 22px 0; border: 1px solid var(--vc-line, rgba(255,255,255,0.08)); border-radius: 10px; }
.tbl-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.tbl-wrap th, .tbl-wrap td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--vc-line, rgba(255,255,255,0.08)); white-space: nowrap; }
.tbl-wrap td:first-child, .tbl-wrap th:first-child { padding-left: 16px; }
.tbl-wrap th { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--vc-fg-muted); background: rgba(255,255,255,0.03); }
.tbl-wrap tbody tr:last-child td { border-bottom: none; }
.tbl-wrap tbody tr:hover td { background: rgba(255,255,255,0.02); }
.tbl-wrap td { color: var(--vc-fg-soft, inherit); }
.tbl-wrap td strong { color: var(--vc-fg); }
@media (max-width: 720px) {
  .tbl-wrap th, .tbl-wrap td { white-space: normal; min-width: 120px; }
}
