/* Codex Course — core design system
 * Cool & technical. Off-white paper, graphite ink, single cyan accent.
 * Mono-forward. Editorial but engineer-first.
 */

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

:root {
  /* palette — cool neutrals, single cyan accent */
  --paper: oklch(0.985 0.003 240);
  --paper-2: oklch(0.965 0.005 240);
  --paper-3: oklch(0.94 0.007 240);
  --ink: oklch(0.22 0.012 250);
  --ink-2: oklch(0.38 0.01 250);
  --ink-3: oklch(0.55 0.008 250);
  --ink-4: oklch(0.7 0.006 250);
  --rule: oklch(0.9 0.008 240);
  --rule-2: oklch(0.82 0.012 240);

  /* accents */
  --cyan: oklch(0.72 0.14 210);
  --cyan-ink: oklch(0.52 0.15 215);
  --cyan-deep: oklch(0.4 0.13 220);
  --cyan-wash: oklch(0.94 0.035 215);

  --ok: oklch(0.62 0.14 155);
  --warn: oklch(0.72 0.15 75);
  --bad: oklch(0.6 0.18 25);
  --info: var(--cyan-ink);

  --shadow-sm: 0 1px 0 rgba(18,24,40,.04), 0 1px 2px rgba(18,24,40,.06);
  --shadow-md: 0 2px 4px rgba(18,24,40,.05), 0 8px 24px rgba(18,24,40,.08);
  --shadow-lg: 0 4px 8px rgba(18,24,40,.06), 0 24px 48px rgba(18,24,40,.12);

  --mono: 'JetBrains Mono', 'IBM Plex Mono', 'SF Mono', Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  /* no serif — the entire voice is mono */

  --radius: 8px;
  --radius-lg: 14px;
  --radius-sm: 5px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* TYPE: mono headlines, sans body. Bold, flat tracking, no italics except for emphasis. */
h1, h2, h3, h4 {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}
h1 {
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); letter-spacing: -0.025em; }
h3 { font-size: 1.15rem; letter-spacing: -0.015em; }
p { margin: 0; text-wrap: pretty; }
code, pre, kbd { font-family: var(--mono); }
kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--rule-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--paper);
  font-size: 0.82em;
  color: var(--ink-2);
}

a { color: var(--cyan-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a.brand, a.brand:hover { text-decoration: none; }

/* utilities */
.mono { font-family: var(--mono); }
.sans { font-family: var(--sans); }
.muted { color: var(--ink-3); }
.small { font-size: 0.86rem; }
.tiny {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.rule { height: 1px; background: var(--rule); border: 0; margin: 2rem 0; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 2;
}
.narrow { max-width: 720px; }

/* subtle dot-grid on page bg, engineering feel, very faint */
body.grid::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  background-image: radial-gradient(circle at 1px 1px, var(--ink-4) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  opacity: 0.08;
  mask-image: radial-gradient(ellipse 100% 80% at 50% 30%, black, transparent 75%);
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--rule-2);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  box-shadow: var(--shadow-sm);
  background: var(--paper-2);
  border-color: var(--ink-3);
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn.primary:hover { background: oklch(0.3 0.015 250); border-color: oklch(0.3 0.015 250); }
.btn.cyan {
  background: var(--cyan-ink);
  border-color: var(--cyan-deep);
  color: white;
}
.btn.cyan:hover { background: var(--cyan-deep); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--paper-3); }
.btn.sm { padding: 6px 12px; font-size: 0.75rem; }
.btn.lg { padding: 14px 22px; font-size: 0.92rem; border-radius: 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--rule-2);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.chip.cyan { background: var(--cyan-wash); border-color: color-mix(in oklch, var(--cyan) 40%, var(--rule-2)); color: var(--cyan-deep); }
.chip.ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* cards */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card.flush { padding: 0; overflow: hidden; }
.card-title {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}

/* inputs */
textarea, input[type="text"], select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--ink);
  resize: vertical;
  line-height: 1.55;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--cyan-ink);
  box-shadow: 0 0 0 3px var(--cyan-wash);
}

/* top nav bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklch, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 32px;
}
/* ------- back to catalogue ------- */
.topbar-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: 0.78rem; font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  padding: 5px 10px 5px 8px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--paper);
  letter-spacing: -0.005em;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
  flex-shrink: 0;
}
.topbar-back .tb-arrow { font-size: 0.95rem; line-height: 1; transition: transform .25s cubic-bezier(.2,.7,.2,1); }
.topbar-back:hover {
  color: var(--ink);
  border-color: var(--ink-3);
  background: var(--paper-3);
  text-decoration: none;
}
.topbar-back:hover .tb-arrow { transform: translateX(-2px); }
.topbar-back:focus-visible { outline: 2px solid var(--cyan-ink); outline-offset: 2px; }
@media (max-width: 560px) {
  .topbar-back .tb-back-label { display: none; }
  .topbar-back { padding: 5px 9px; }
}

.brand {
  display: inline-flex; align-items: center; gap: 11px;
  font-family: var(--mono); font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  position: relative;
  padding: 2px 4px 2px 2px;
  border-radius: 6px;
  transition: background .25s ease;
}
.brand:hover { background: color-mix(in oklch, var(--cyan-wash) 65%, transparent); }
.brand:focus-visible { outline: 2px solid var(--cyan-ink); outline-offset: 3px; }

/* ------- THE MARK — caret / prompt glyph, geometric & solid ------- */
.brand .mark {
  position: relative;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  flex-shrink: 0;
  background: var(--ink);
  border-radius: 7px;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), background .25s;
  overflow: hidden;
}
.brand .mark::before {
  /* top scanline highlight */
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, color-mix(in oklch, var(--cyan) 18%, transparent) 0%, transparent 45%);
  pointer-events: none;
}
.brand .mark svg { display: block; position: relative; z-index: 1; }
.brand:hover .mark {
  background: oklch(0.14 0.02 250);
  transform: translateY(-1px);
}

/* on-load: caret glyph draws itself in */
.brand .mk-caret {
  stroke: var(--cyan);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 28;
  stroke-dashoffset: 28;
  animation: caretDraw .55s cubic-bezier(.5,.05,.2,1) .15s forwards;
}
.brand .mk-bar {
  stroke: var(--cyan);
  stroke-width: 2.4;
  stroke-linecap: round;
  opacity: 0;
  animation: caretBar .3s ease .6s forwards, barBlink 1.3s ease-in-out 1.1s infinite;
}
@keyframes caretDraw { to { stroke-dashoffset: 0; } }
@keyframes caretBar { to { opacity: 1; } }
@keyframes barBlink { 0%, 60%, 100% { opacity: 1; } 65%, 95% { opacity: 0.25; } }

/* ------- THE WORDMARK ------- */
.brand-word {
  display: inline-flex; flex-direction: column; gap: 1px;
  line-height: 1;
}
.brand-lockup {
  display: inline-flex; align-items: center; gap: 9px;
  line-height: 1;
}
.brand-word-1 {
  font-family: var(--mono); font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
  letter-spacing: -0.02em;
  transition: color .25s;
}
.brand-divider {
  display: inline-block;
  width: 1px; height: 13px;
  background: linear-gradient(to bottom,
    transparent,
    color-mix(in oklch, var(--cyan-ink) 70%, transparent) 25%,
    color-mix(in oklch, var(--cyan-ink) 70%, transparent) 75%,
    transparent);
  transition: height .3s cubic-bezier(.2,.7,.2,1);
}
.brand:hover .brand-divider { height: 17px; }
.brand-word-2 {
  display: inline-flex; gap: 1px;
  font-family: var(--mono); font-weight: 600; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .2em;
  color: var(--cyan-ink);
}
.brand-word-2 > span {
  display: inline-block;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), color .25s;
}
.brand:hover .brand-word-2 > span { color: var(--ink); }
.brand:hover .brand-word-2 > span:nth-child(1) { transition-delay: 0ms;  transform: translateY(-1.5px); }
.brand:hover .brand-word-2 > span:nth-child(2) { transition-delay: 25ms; transform: translateY(-1.5px); }
.brand:hover .brand-word-2 > span:nth-child(3) { transition-delay: 50ms; transform: translateY(-1.5px); }
.brand:hover .brand-word-2 > span:nth-child(4) { transition-delay: 75ms; transform: translateY(-1.5px); }
.brand:hover .brand-word-2 > span:nth-child(5) { transition-delay: 100ms; transform: translateY(-1.5px); }
.brand:hover .brand-word-2 > span:nth-child(6) { transition-delay: 125ms; transform: translateY(-1.5px); }

.brand-tagline {
  font-family: var(--mono); font-style: italic; font-weight: 400;
  font-size: .66rem;
  color: var(--ink-3);
  letter-spacing: 0;
  max-height: 0; opacity: 0;
  overflow: hidden;
  transition: max-height .35s cubic-bezier(.2,.7,.2,1), opacity .25s ease .05s;
  white-space: nowrap;
}
.brand:hover .brand-tagline { max-height: 14px; opacity: .85; }

@media (max-width: 640px) {
  .brand-tagline, .brand-divider { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .brand .mark *, .brand-word-2 > span, .brand-divider, .brand-tagline { animation: none !important; transition: none !important; }
  .brand .mk-caret { stroke-dashoffset: 0; }
  .brand .mk-bar { opacity: 1; }
}

.topbar nav {
  margin-left: auto;
  display: flex; align-items: center; gap: 18px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.82rem;
}
.topbar nav a { color: var(--ink-2); }
.topbar nav a:hover { color: var(--ink); text-decoration: none; }

.xp-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 6px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
}
.xp-pill .spark {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 3px;
  background: var(--cyan);
}

/* lesson prose */
.prose {
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 680px;
}
.prose > * + * { margin-top: 1.15em; }
.prose h2 { margin-top: 2.5rem; color: var(--ink); font-family: var(--mono); }
.prose h3 { margin-top: 2rem; color: var(--ink); font-family: var(--mono); }
.prose p strong { color: var(--ink); font-weight: 600; }
.prose code:not(pre code) {
  background: var(--paper-3);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--cyan-deep);
  border: 1px solid var(--rule);
}
.prose blockquote {
  border-left: 3px solid var(--cyan);
  padding: 8px 0 8px 18px;
  margin: 0;
  color: var(--ink-2);
  font-family: var(--mono);
  font-style: italic;
  font-size: 0.95em;
}
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: 0.4em 0; }

/* terminal-style code block — the signature component */
pre.code, .terminal {
  background: oklch(0.17 0.015 250);
  color: oklch(0.92 0.012 240);
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.65;
  border: 1px solid oklch(0.28 0.02 250);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  position: relative;
}
.terminal {
  padding: 0;
}
.terminal-chrome {
  padding: 10px 14px;
  background: oklch(0.14 0.015 250);
  border-bottom: 1px solid oklch(0.24 0.02 250);
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: .7rem;
  color: oklch(0.6 0.01 240);
  letter-spacing: .06em;
}
.terminal-chrome .dots {
  display: inline-flex; gap: 5px;
}
.terminal-chrome .dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: oklch(0.4 0.02 250);
}
.terminal-chrome .title { margin-left: auto; font-weight: 500; }
.terminal-body {
  padding: 14px 18px 16px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: oklch(0.92 0.012 240);
  white-space: pre-wrap;
  word-break: break-word;
}

/* syntax tokens */
pre.code .tok-k, .terminal-body .tok-k { color: oklch(0.8 0.11 280); }  /* keyword - violet */
pre.code .tok-s, .terminal-body .tok-s { color: oklch(0.85 0.1 150); }  /* string - green */
pre.code .tok-c, .terminal-body .tok-c { color: oklch(0.55 0.01 240); font-style: italic; }  /* comment */
pre.code .tok-n, .terminal-body .tok-n { color: oklch(0.82 0.08 220); } /* number/name - cyan */
pre.code .tok-p, .terminal-body .tok-p { color: oklch(0.82 0.12 70); }  /* prompt $ */
pre.code .tok-o, .terminal-body .tok-o { color: oklch(0.9 0.1 60); }    /* ok */
pre.code .tok-e, .terminal-body .tok-e { color: oklch(0.78 0.17 25); }  /* error */
pre.code .tok-m, .terminal-body .tok-m { color: oklch(0.7 0.01 240); }  /* muted */

.terminal-body .prompt {
  color: oklch(0.82 0.15 210);
  font-weight: 600;
  user-select: none;
}
.terminal-body .cursor {
  display: inline-block;
  width: 8px; height: 1.1em;
  background: oklch(0.82 0.15 210);
  vertical-align: -2px;
  animation: termBlink 1s step-end infinite;
  margin-left: 1px;
}
@keyframes termBlink { 50% { opacity: 0; } }

/* selection */
::selection { background: var(--cyan); color: oklch(0.2 0.03 220); }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--rule-2); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* focus */
:focus-visible {
  outline: 2px solid var(--cyan-ink);
  outline-offset: 2px;
}

/* section eyebrow */
.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}
.eyebrow.cyan { color: var(--cyan-ink); }

/* grid utilities */
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
@media (max-width:780px){ .grid-3 { grid-template-columns: 1fr; } }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
@media (max-width:640px){ .grid-2 { grid-template-columns: 1fr; } }

/* callout */
.callout {
  display: flex; gap: 14px;
  padding: 16px 18px;
  border: 1px solid color-mix(in oklch, var(--cyan) 30%, var(--rule));
  background: color-mix(in oklch, var(--cyan-wash) 50%, var(--paper));
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius);
  margin: 20px 0;
  font-size: 0.95rem;
  color: var(--ink-2);
}
.callout .icon {
  font-family: var(--mono);
  color: var(--cyan-ink);
  font-weight: 700;
  flex-shrink: 0;
}
.callout b { color: var(--ink); }

/* pull quote */
.pull-quote {
  font-family: var(--mono);
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  line-height: 1.4;
  color: var(--ink);
  padding: 18px 24px;
  border-top: 1px solid var(--rule-2);
  border-bottom: 1px solid var(--rule-2);
  margin: 28px 0;
  font-weight: 500;
  letter-spacing: -0.01em;
  position: relative;
}
.pull-quote::before {
  content: '▸';
  position: absolute; left: 0; top: 50%; transform: translate(-18px,-50%);
  color: var(--cyan-ink);
  font-size: 0.9em;
}
