/* ============================================================
   Intro to Vibe Coding — site styles
   World: a git diff on graph paper. Green/red mean something.
   Type: Bricolage Grotesque (display) + Atkinson Hyperlegible
   (body, designed for beginner legibility) + Spline Sans Mono.
   ============================================================ */

:root {
  --paper: #F2F6F0;
  --paper-2: #E4EEE1;
  --ink: #1C2B20;
  --ink-soft: #4A5B4E;
  --green: #237A50;
  --green-deep: #185C3B;
  --green-wash: #DFEEDF;
  --red: #B3402F;
  --red-wash: #F9E4DC;
  --hl: #FFE86B;
  --hl-wash: #FFF6D6;
  --line: #C7D6C4;
  --code-bg: #16241B;
  --code-ink: #D9EFDD;
  --grid: rgba(35, 122, 80, 0.09);
  --radius: 10px;
  --measure: 68ch;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", "Avenir Next", Verdana, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

::selection { background: var(--hl); color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- graph paper (chrome only — reading stays calm) ---------- */

.gridbg {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ---------- topbar ---------- */

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--green);
  color: #fff;
  padding: 0.6em 1em;
  border-radius: 0 0 8px 0;
  z-index: 10;
}
.skip:focus { left: 0; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.brand {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
}

.brand-mark {
  width: 0.85em;
  height: 0.85em;
  border-radius: 3px;
  background: var(--green);
  box-shadow: inset 0 0 0 3px var(--green), inset 0 0 0 5px var(--hl);
  flex: none;
}

.topnav { display: flex; gap: 1.4rem; }

.topnav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
}
.topnav a:hover { color: var(--green-deep); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- hero (home) ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
  padding: clamp(3rem, 8vw, 6rem) clamp(1rem, 4vw, 2.5rem);
  max-width: 70rem;
  margin: 0 auto;
}

/* keep the terminal's long lines from stretching the grid tracks */
.hero-copy, .hero-term { min-width: 0; }

.hero h1 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: clamp(2.5rem, 6vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin-bottom: 1.1rem;
  text-wrap: balance;
}

.lede { font-size: 1.18rem; color: var(--ink-soft); max-width: 34em; }

.cta-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.6rem; }

.btn {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  padding: 0.75em 1.5em;
  border-radius: 8px;
  transition: background-color 120ms ease;
}
.btn:hover { background: var(--green-deep); }

.btn-ghost {
  background: transparent;
  color: var(--green-deep);
  box-shadow: inset 0 0 0 2px var(--green);
}
.btn-ghost:hover { background: var(--green-wash); }

.micro { margin-top: 1.1rem; font-size: 0.92rem; color: var(--ink-soft); }

/* the hero's git log — one blink, then it holds still */

.hero-term {
  background: var(--code-bg);
  border-radius: 14px;
  box-shadow: 6px 6px 0 var(--line);
  overflow: hidden;
}

.term-bar {
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.82rem;
  color: #9fc4a8;
  padding: 0.65em 1.2em;
  border-bottom: 1px solid rgba(217, 239, 221, 0.18);
}
.term-bar::before { content: "$ "; color: var(--hl); }

.hero-term pre {
  font-family: "Spline Sans Mono", monospace;
  color: var(--code-ink);
  font-size: clamp(0.78rem, 1.6vw, 0.92rem);
  line-height: 1.9;
  padding: 1.1em 1.2em 1.3em;
  overflow-x: auto;
}

.cursor { animation: blink 1.2s steps(1) infinite; color: var(--hl); }

@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
  .btn { transition: none; }
}

/* ---------- level head (challenge pages) ---------- */

.level-head {
  display: flex;
  align-items: flex-start;
  gap: clamp(1.2rem, 4vw, 2.5rem);
  padding: clamp(2.2rem, 6vw, 4rem) clamp(1rem, 4vw, 2.5rem) clamp(1.8rem, 4vw, 2.8rem);
  border-bottom: 1px solid var(--line);
  max-width: 70rem;
  margin: 0 auto;
  width: 100%;
}

.level-num {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: clamp(3.4rem, 9vw, 5.6rem);
  line-height: 0.9;
  color: var(--paper);
  -webkit-text-stroke: 2.5px var(--green);
  letter-spacing: -0.02em;
  flex: none;
  user-select: none;
}

@supports not (-webkit-text-stroke: 2px black) {
  .level-num { color: var(--paper-2); }
}

.level-chips { display: flex; gap: 0.5rem; margin-bottom: 0.7rem; flex-wrap: wrap; }

.chip {
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green-deep);
  border: 1.5px solid var(--green);
  border-radius: 999px;
  padding: 0.15em 0.8em;
  background: rgba(255, 255, 255, 0.55);
}

.level-head h1 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: clamp(1.9rem, 4.5vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.mission { margin-top: 0.8rem; max-width: 56ch; color: var(--ink-soft); font-size: 1.05rem; }
.mission strong { color: var(--ink); }

/* ---------- reading column ---------- */

.prose {
  max-width: calc(var(--measure) + 2 * clamp(1rem, 4vw, 2.5rem));
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2.5rem) 3rem;
}

.prose > * + * { margin-top: 1.1em; }

.prose h2 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-top: 2.2em;
}

.prose h3 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  margin-top: 1.8em;
}

.prose p { max-width: var(--measure); }

.prose a {
  color: var(--green-deep);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.prose a:hover { background: var(--hl); color: var(--ink); }

.prose strong { font-weight: 700; }

.prose hr {
  border: 0;
  border-top: 1px dashed var(--line);
  margin-block: 2.2em;
}

/* inline code */
.prose code {
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.86em;
  background: var(--paper-2);
  border-radius: 5px;
  padding: 0.12em 0.4em;
}

/* prompt / command blocks — the terminal card */
.prose pre {
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--radius);
  padding: 1em 1.3em;
  overflow-x: auto;
  box-shadow: 4px 4px 0 var(--line);
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: 0.92rem;
  line-height: 1.75;
}

/* diff colors — the course's whole visual idea */
.prose code.language-diff .add { color: #8FE8B0; display: block; }
.prose code.language-diff .del { color: #FFA694; display: block; }

/* blockquotes — highlighter margin */
.prose blockquote {
  border-left: 5px solid var(--hl);
  background: var(--hl-wash);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.9em 1.2em;
  color: var(--ink);
}
.prose blockquote p + p { margin-top: 0.6em; }

/* ---------- sections ---------- */

.sec { margin-top: 1.6em; }
.sec > h2 { margin-top: 2.4em; }

.sec-story {
  background: var(--paper-2);
  border-radius: var(--radius);
  padding: 1.4em 1.6em;
}
.sec-story > h2 { margin-top: 0.2em; }

.sec-help {
  background: var(--red-wash);
  border-radius: var(--radius);
  padding: 1.4em 1.6em;
}
.sec-help > h2 { margin-top: 0.2em; }

.sec-pass > ul { list-style: none; padding-left: 0; }
.sec-pass li { padding-left: 0; }

/* checkboxes (task lists) — replace the bullet, don't stack with it */
.prose li:has(> span.cb) { list-style: none; margin-left: -1.15em; }

.cb {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid var(--green);
  border-radius: 4px;
  margin-right: 0.55em;
  transform: translateY(0.14em);
  background: #fff;
}

/* ---------- lists ---------- */

.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-block: 0.35em; }
.prose li::marker { color: var(--green); font-weight: 700; }
.prose li > ul, .prose li > ol { margin-top: 0.35em; }

/* ---------- tables (jargon translators) ---------- */

.tw { overflow-x: auto; }

.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

.prose th {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  text-align: left;
  border-bottom: 2.5px solid var(--ink);
  padding: 0.5em 0.7em;
}

.prose td {
  border-bottom: 1px solid var(--line);
  padding: 0.55em 0.7em;
  vertical-align: top;
}

.prose tbody tr:nth-child(even) td { background: rgba(228, 238, 225, 0.5); }

/* ---------- the course map (level select) ---------- */

.levels {
  list-style: none;
  padding: 0;
  margin-block: 1.4em 2em;
  border-top: 2px solid var(--ink);
}

.levels li { border-bottom: 1px solid var(--line); }

.levels a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.8rem);
  padding: 1.05rem 0.6rem;
  text-decoration: none;
  color: var(--ink);
  transition: background-color 120ms ease;
}
.levels a:hover { background: var(--paper-2); }

.lvl-num {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--line);
  letter-spacing: -0.02em;
  transition: color 120ms ease;
  min-width: 2.2ch;
}
.levels a:hover .lvl-num { color: var(--green); }

.lvl-main { display: grid; gap: 0.15rem; }

.lvl-title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 1.18rem;
}

.lvl-skill { color: var(--ink-soft); font-size: 0.95rem; }

.lvl-time {
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.8rem;
  color: var(--green-deep);
  border: 1.5px solid var(--green);
  border-radius: 999px;
  padding: 0.2em 0.85em;
  white-space: nowrap;
}

/* ---------- FAQ ---------- */

.faq { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  padding-block: 0.8em;
  list-style-position: outside;
}
.faq summary:hover { color: var(--green-deep); }
.faq-a { padding-bottom: 1em; color: var(--ink-soft); max-width: var(--measure); }

/* ---------- next card & pager ---------- */

.next-card {
  border: 2px solid var(--green);
  background: var(--green-wash);
  border-radius: var(--radius);
  padding: 1em 1.3em;
  margin-top: 2em;
}
.next-card p { margin: 0; }

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
  border-top: 2px solid var(--ink);
  padding-top: 1.2rem;
}

.pager a {
  text-decoration: none;
  color: var(--ink);
  display: grid;
  gap: 0.15rem;
  padding: 0.6rem;
  border-radius: 8px;
}
.pager a:hover { background: var(--paper-2); }
.pager .next { text-align: right; justify-items: end; }

.pager span {
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.pager strong { font-family: "Bricolage Grotesque", sans-serif; font-size: 1.05rem; }
.pager a:hover strong { color: var(--green-deep); }

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  padding: 1.6rem clamp(1rem, 4vw, 2.5rem);
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.foot p + p { margin-top: 0.2em; }

/* ---------- small screens ---------- */

@media (max-width: 780px) {
  .hero { grid-template-columns: 1fr; padding-top: 2.5rem; }
  .levels a { grid-template-columns: auto 1fr; }
  .lvl-time { grid-column: 2; justify-self: start; }
  .level-head { flex-direction: column; gap: 0.8rem; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; justify-items: start; }
}

/* ---------- print (cheat sheets especially) ---------- */

@media print {
  .topbar, .pager, .foot, .skip, .cursor, .cta-row { display: none; }
  body { background: #fff; font-size: 11pt; }
  .hero-term, .prose pre { box-shadow: none; }
  .sec, .faq, .levels li { break-inside: avoid; }
}
