/* Two brands, matching the course covers: belderbos.dev (paper, ink, rust)
   and pythonagenticai.com (ink, lime, cyan, purple). */

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font: 400 17px/1.65 "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--ink);
}

.belderbos {
  --bg: #F6F3EE;
  --ink: #1B2633;
  --muted: #5E6571;
  --accent: #B9502E;
  --accent-soft: #F3D9CE;
  --on-accent: #FFFFFF;
  --line: #DDD6CB;
  --card: rgba(255, 255, 255, 0.7);
  --panel: #1E2A38;
  --panel-text: #F5F2EE;
  --panel-muted: #8E9AA8;
  --prompt: #E8916F;
  --ok: #7FC48A;
  --diagram-fill: #F3D9CE;
  --diagram-border: #B9502E;
  --diagram-text: #1B2633;
  --diagram-line: #5E6571;
  background:
    radial-gradient(circle at 92% 0, #F3D9CE 0, transparent 420px),
    radial-gradient(#DDD6CB 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bg);
}

.pythonagenticai {
  --bg: #0C111D;
  --ink: #F4F1EA;
  --muted: #A1A8B5;
  --accent: #D8FF5F;
  --accent-soft: rgba(216, 255, 95, 0.12);
  --on-accent: #0C111D;
  --line: rgba(255, 255, 255, 0.1);
  --card: rgba(255, 255, 255, 0.04);
  --panel: #151C2C;
  --panel-text: #E6EAF2;
  --panel-muted: #7B808B;
  --prompt: #D8FF5F;
  --ok: #D8FF5F;
  --diagram-fill: #151C2C;
  --diagram-border: #D8FF5F;
  --diagram-text: #F4F1EA;
  --diagram-line: #A1A8B5;
  background:
    radial-gradient(circle at 85% 0, rgba(116, 87, 255, 0.3) 0, transparent 480px),
    radial-gradient(circle at 10% 100%, rgba(85, 221, 235, 0.12) 0, transparent 420px),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px) 0 0 / 40px 40px,
    var(--bg);
  background-attachment: fixed;
}

a { color: var(--accent); text-underline-offset: 3px; }

/* Layout */

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 980px; margin: 0 auto; padding: 20px 16px;
}
.brand { font-weight: 700; font-size: 18px; text-decoration: none; color: var(--ink); }
.belderbos .brand { border-left: 6px solid var(--accent); padding-left: 12px; }
.pythonagenticai .brand { background: var(--accent); color: var(--on-accent); padding: 6px 12px; }
.top nav { display: flex; align-items: center; gap: 18px; font-size: 15px; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--ink); }
.link-button {
  background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer;
}
.link-button:hover { color: var(--ink); }

main { max-width: 980px; margin: 0 auto; padding: 24px 16px 96px; }
.narrow { max-width: 520px; }
.legal { display: flex; justify-content: center; gap: 18px; padding: 0 16px 32px; font-size: 14px; }
.legal a { color: var(--muted); text-decoration: none; }
.legal a:hover { color: var(--ink); }
.reading { max-width: 760px; }

/* Type */

h1, h2, h3 { line-height: 1.2; margin: 1.6em 0 0.5em; }
h1 { font-size: clamp(32px, 6vw, 48px); margin-top: 0.2em; }
.belderbos h1 { font-family: "Lora", serif; font-weight: 600; letter-spacing: -0.01em; }
.pythonagenticai h1 { font-weight: 800; letter-spacing: -0.035em; }
h1 em { color: var(--accent); }
.belderbos h1 em { font-style: italic; }
.pythonagenticai h1 em { font-style: normal; }

.kicker {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
}
.kicker .tag {
  letter-spacing: 0.06em; padding: 3px 10px; border-radius: 999px; border: 1.5px solid currentColor;
  /* Overlaps the line box so a tagged kicker is as tall as a plain one. */
  line-height: 1.2; margin-block: -6px;
}
.pythonagenticai .kicker .tag { background: var(--accent); color: var(--on-accent); }
.lede { color: var(--muted); font-size: 19px; margin-top: 0; }
.muted { color: var(--muted); }

/* Buttons and forms */

.button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border: 0; border-radius: 10px; cursor: pointer;
  font: 600 16px "Inter", sans-serif; text-decoration: none;
  background: var(--accent); color: var(--on-accent);
}
.button:hover { filter: brightness(1.08); }
.button.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }

input[type="email"], input[type="text"] {
  width: 100%; padding: 12px 14px; margin: 6px 0 16px;
  font: inherit; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 10px;
}
input[type="email"]:focus, input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { font-weight: 600; font-size: 15px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px;
}
.belderbos .card { box-shadow: 0 20px 40px -28px rgba(27, 38, 51, 0.35); }

/* Course grid on the dashboard */

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 8px 0 28px;
  background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.stats div { background: var(--card); padding: 16px 20px; }
.stats dt { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 4px 0 0; font: 600 26px "JetBrains Mono", monospace; color: var(--ink); }

.newsletter { margin-bottom: 18px; }
.newsletter p { margin: 0 0 14px; }
.newsletter-actions { display: flex; align-items: center; gap: 18px; }
.courses { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .courses { grid-template-columns: 1fr; } }
.course-card { display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
.course-card h2 { margin: 8px 0 14px; font-size: 22px; }
.course-card h2 a { color: inherit; text-decoration: none; }
.course-card h2 a:hover { color: var(--accent); }
.course-card .up-next { margin: auto 0 10px; font-size: 14px; color: var(--muted); }
.course-card .up-next strong { color: var(--ink); font-weight: 600; }
.course-card .button { justify-content: center; white-space: nowrap; }
/* Each card wears its course's brand, whatever page it sits on. */
.course-card.belderbos { background: rgba(255, 255, 255, 0.75); }
.course-card.pythonagenticai {
  background:
    radial-gradient(circle at 100% 0, rgba(116, 87, 255, 0.35) 0, transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--bg);
  border-color: transparent;
  box-shadow: 0 24px 48px -28px rgba(12, 17, 29, 0.7);
}

.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: var(--accent); }
.progress-label { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.progress-label strong { color: var(--ink); }
.facts { list-style: none; margin: 14px 0 22px; padding: 14px 0 0; border-top: 1px dashed var(--line); font-size: 14px; color: var(--muted); }
.facts li { padding: 2px 0; }
.facts li::before { content: "▸ "; color: var(--accent); }

@media (max-width: 560px) {
  .stats dd { font-size: 20px; }
  .stats div { padding: 12px 14px; }
}

/* The dark panel every cover carries */

.panel {
  background: var(--panel); color: var(--panel-text); border-radius: 16px; overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(12, 17, 29, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  margin: 24px 0;
}
.panel .bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; background: rgba(255, 255, 255, 0.04); }
.panel .bar i { width: 11px; height: 11px; border-radius: 50%; background: #3A4656; }
.panel .bar i:nth-child(1) { background: #E0675A; }
.panel .bar i:nth-child(2) { background: #E2B54F; }
.panel .bar i:nth-child(3) { background: #6CBF77; }
.panel .bar b { margin-left: auto; font: 500 13px "JetBrains Mono", monospace; color: var(--panel-muted); }
.panel .body { padding: 20px 22px 24px; }
.panel a { color: var(--panel-text); }

/* Weeks as the state machine from the Signoff cover */

.states { list-style: none; margin: 0; padding: 22px 22px 26px; }
.state {
  display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 4px 14px; padding: 8px 0;
  font: 600 16px "JetBrains Mono", monospace;
}
.state + .state { border-top: 2px dotted rgba(255, 255, 255, 0.12); }
.state .dot { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--panel-muted); flex: none; }
.state.open .dot { background: var(--ok); border-color: var(--ok); }
.state.next .dot { background: var(--prompt); border-color: var(--prompt); box-shadow: 0 0 0 6px color-mix(in srgb, var(--prompt) 25%, transparent); }
.state.locked { color: var(--panel-muted); }
.state a { text-decoration: none; }
.state a:hover { text-decoration: underline; }
.state em { font: 500 13px "Inter", sans-serif; font-style: normal; color: var(--panel-muted); white-space: nowrap; }

/* Pace picker */

.pace { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 18px; }
.pace label {
  font: 500 14px "JetBrains Mono", monospace; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  background: rgba(255, 255, 255, 0.07); border: 1.5px solid transparent;
}
.pace input { position: absolute; opacity: 0; }
.pace label:has(input:checked) { border-color: var(--prompt); color: var(--prompt); }
.pace label:has(input:focus-visible) { outline: 2px solid var(--prompt); }

/* Lesson list on a module page */

.lessons { list-style: none; counter-reset: lesson; margin: 0; padding: 0; }
.lessons li { counter-increment: lesson; border-bottom: 1px solid var(--line); }
.lessons a {
  display: flex; gap: 14px; padding: 14px 4px; text-decoration: none; color: var(--ink); font-weight: 500;
}
.lessons a::before { content: counter(lesson, decimal-leading-zero); font: 500 14px "JetBrains Mono", monospace; color: var(--accent); padding-top: 2px; }
.lessons a:hover { color: var(--accent); }
.lessons li.done a { color: var(--muted); }
.lessons li.done a::after { content: "✓"; margin-left: auto; color: var(--ok); font-weight: 700; }
.belderbos .lessons li.done a::after { color: #3F8F4E; }
.lesson-meta { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.mark-done { display: flex; align-items: center; gap: 14px; margin-top: 48px; }
.done-label { font-weight: 600; color: var(--muted); }
.notice { padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); }

.feedback { position: fixed; right: 16px; bottom: 16px; z-index: 10; max-width: calc(100vw - 32px); }
.feedback summary {
  list-style: none; margin-left: auto; width: max-content; cursor: pointer;
  padding: 10px 16px; border-radius: 999px; font: 600 15px "Inter", sans-serif;
  background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.feedback summary::-webkit-details-marker { display: none; }
.feedback form {
  display: grid; gap: 10px; width: 340px; max-width: 100%; margin-bottom: 10px; padding: 16px;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
}
.feedback[open] { display: flex; flex-direction: column-reverse; }
.feedback textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; resize: vertical;
}
.feedback textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Lesson body */

.lesson { overflow-wrap: break-word; }
.lesson img { max-width: 100%; height: auto; border-radius: 8px; }
.lesson table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; font-size: 15px; }
.lesson th, .lesson td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.lesson blockquote { margin: 1.4em 0; padding: 4px 18px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.lesson details { margin: 1.2em 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.lesson summary { cursor: pointer; font-weight: 600; }
.lesson pre.mermaid {
  display: flex; justify-content: center; margin: 1.6em 0; padding: 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  overflow-x: auto; color: transparent;
}
.lesson pre.mermaid[data-processed] { color: inherit; }
.lesson pre.mermaid svg { max-height: 480px; }
.lesson ul.contains-task-list { list-style: none; padding-left: 4px; }
.lesson .task-list-item { position: relative; padding-left: 26px; }
.lesson .task-list-item-checkbox { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; position: absolute; left: 0; top: 0.4em; }
.lesson hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

code { font: 500 0.88em "JetBrains Mono", monospace; }
:not(pre) > code { background: var(--accent-soft); padding: 2px 6px; border-radius: 5px; }
pre.highlight {
  background: var(--panel); color: var(--panel-text); border-radius: 12px;
  padding: 18px 20px; overflow-x: auto; line-height: 1.6; font-size: 15px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}
pre.highlight code { background: none; padding: 0; font-size: 1em; }
.code-block { position: relative; }
.code-block .copy {
  position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: 6px; cursor: pointer;
  font: 500 12px "JetBrains Mono", monospace; color: var(--panel-muted);
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0; transition: opacity 0.15s;
}
.code-block:hover .copy, .code-block .copy:focus-visible { opacity: 1; }
.code-block .copy:hover { color: var(--panel-text); }
@media (hover: none) { .code-block .copy { opacity: 1; } }

/* Pygments tokens in the cover palette */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .ch, .highlight .cs { color: var(--panel-muted); font-style: italic; }
.highlight .k, .highlight .kn, .highlight .kd, .highlight .kc, .highlight .kr, .highlight .ow { color: #C9A7FF; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sd, .highlight .sa, .highlight .si, .highlight .se { color: #55DDEB; }
.highlight .nf, .highlight .fm, .highlight .nc { color: var(--prompt); }
.highlight .mi, .highlight .mf, .highlight .m { color: #E2B54F; }
.highlight .nb, .highlight .bp, .highlight .nd { color: #7FC48A; }
.highlight .gp { color: var(--prompt); }
.highlight .go { color: var(--panel-muted); }

.pager {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 15px;
}
.pager a { text-decoration: none; font-weight: 600; }
.breadcrumb { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--muted); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .state { grid-template-columns: 14px 1fr; font-size: 15px; }
  .state em { grid-column: 2; }
}

.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.print-page + .print-page { margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--line); }

@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .top, .no-print, .pager, .mark-done, .feedback, .lesson-meta, .code-block .copy { display: none !important; }
  main { max-width: none; padding: 0; }
  a { color: inherit; }
  pre.highlight { white-space: pre-wrap; box-shadow: none; border: 1px solid #ccc; background: #f6f6f6; color: #000; }
  .highlight * { color: #000 !important; }
  .print-page { border: 0; margin: 0; padding: 0; }
  .print-page + .print-page { break-before: page; }
  .lesson pre.mermaid, .lesson img, table { break-inside: avoid; }
}

/* Course certificate: always light, like a printed page, whatever the site theme. */
.cert-controls { margin-bottom: 32px; }
.cert-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.certificate {
  --cert-ink: #1B2633; --cert-muted: #5E6571; --cert-accent: #B9502E; --cert-line: #DDD6CB;
  position: relative; background: #F6F3EE; color: var(--cert-ink);
  border: 1px solid var(--cert-line); padding: 56px 64px 40px; font-family: "Inter", sans-serif;
  min-height: 0; aspect-ratio: 297 / 210; display: flex; flex-direction: column;
}
.certificate::before { content: ""; position: absolute; top: 0; left: 64px; width: 120px; height: 4px; background: var(--cert-accent); }
.cert-brand { font-family: "JetBrains Mono", monospace; font-weight: 600; font-size: 18px; }
.cert-brand span { color: var(--cert-accent); }
.cert-kicker { text-transform: uppercase; letter-spacing: 0.25em; font-size: 12px; color: var(--cert-muted); margin: 28px 0 8px; }
.cert-kicker.small { font-weight: 600; letter-spacing: 0.15em; margin-top: 20px; }
.cert-name { font-family: "Lora", serif; font-size: clamp(28px, 5vw, 44px); margin: 0; overflow-wrap: anywhere; }
.cert-line { font-family: "Lora", serif; font-size: clamp(16px, 2.2vw, 20px); margin: 8px 0 0; }
.cert-line strong { color: var(--cert-accent); }
.cert-modules { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 32px; font-size: 13px; }
.cert-modules li { padding: 6px 0; border-top: 1px solid var(--cert-line); break-inside: avoid; }
.cert-footer { margin-top: auto; padding-top: 24px; display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 16px; align-items: end; font-size: 14px; }
.cert-signatures { display: flex; justify-content: flex-end; gap: 32px; }
.cert-footer span { display: block; font-size: 12px; color: var(--cert-muted); }
.cert-signature { min-width: 180px; text-align: right; color: var(--cert-muted); font-size: 12px; }
.cert-signature strong { display: block; font-family: "Lora", serif; font-weight: 400; font-size: 22px; color: var(--cert-ink); border-bottom: 1px solid var(--cert-muted); padding-bottom: 4px; margin-bottom: 4px; }
/* pythonagenticai.com: dark ink, lime accent, the site's purple glow. */
.certificate.pythonagenticai {
  --cert-ink: #F4F1EA; --cert-muted: #A1A8B5; --cert-accent: #D8FF5F; --cert-line: rgba(255, 255, 255, 0.14);
  background: radial-gradient(circle at 90% 0, rgba(116, 87, 255, 0.35) 0, transparent 55%), #0C111D;
  border-color: #0C111D;
}
.certificate.pythonagenticai .cert-name { font-family: "Inter", sans-serif; font-weight: 800; letter-spacing: -0.035em; }
.certificate.pythonagenticai .cert-line { font-family: "Inter", sans-serif; }
.certificate.pythonagenticai .cert-line strong { color: var(--cert-accent); }
.certificate.pythonagenticai .cert-signature strong { font-family: "Inter", sans-serif; font-weight: 700; font-size: 18px; }
@media (max-width: 640px) {
  .certificate { aspect-ratio: auto; padding: 40px 24px 24px; }
  .certificate::before { left: 24px; }
  .cert-modules { columns: 1; }
  .cert-footer { grid-template-columns: 1fr; }
  .cert-signatures { justify-content: flex-start; flex-wrap: wrap; }
  .cert-signature { text-align: left; }
}
@media print {
  .certificate { border: 0; width: 297mm; height: 210mm; aspect-ratio: auto; padding: 18mm 20mm 14mm; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .certificate::before { left: 20mm; }
  .legal { display: none !important; }
}

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.tips summary { cursor: pointer; font-weight: 600; }
.tips[open] summary { margin-bottom: 12px; }
