/* ---------------------------------------------------------------
   LLM Inference | For You : theme
   An original hand-drawn "notebook" theme inspired by the look and
   feel of Lena Voita's "NLP Course | For You": sketchy borders,
   handwritten headings, a warm paper background and a green/blue
   annotation palette. Body text is set in a readable humanist sans
   so long derivations stay easy on the eyes; the handwriting is
   reserved for headings, labels and margin notes, like a well-kept
   lecture notebook. All code here is written for this project.
   --------------------------------------------------------------- */

:root {
  --paper: #fbf7ec;
  --ink: #2b2a26;
  --ink-soft: #57544c;
  --green: #7aa22a;        /* "central token" green  */
  --green-dark: #5d8120;
  --green-soft: #f0f5e0;
  --blue: #4a6fa5;         /* "context / system" blue */
  --blue-soft: #ecf2f9;
  --red: #c95a4a;          /* warnings, flaws        */
  --red-soft: #faeeec;
  --amber: #d9a441;        /* have-fun, highlights   */
  --amber-soft: #fbf0dd;
  --grey: #8a8478;
  --card: #fffdf6;
  --line: #33312cb8;
  --line-soft: #33312c40;
  --shadow: rgba(76, 66, 44, 0.16);
  --hand: "Patrick Hand", "Segoe Print", cursive;
  --body-font: "Nunito Sans", "Segoe UI", Verdana, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 20% 10%, #00000005 0, transparent 40%),
    radial-gradient(circle at 80% 90%, #00000006 0, transparent 40%);
  color: var(--ink);
  font-family: var(--body-font);
  font-size: 17.5px;
  line-height: 1.72;
}

::selection { background: #dcecae; }

h1, h2, h3, h4, .hand {
  font-family: var(--hand);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.2px;
}

/* prose links (cards and navs restyle themselves below) */
a { color: var(--blue); text-decoration-color: #4a6fa566; text-underline-offset: 3px; }
a:hover { color: var(--green-dark); }

/* ---------------- layout ---------------- */

.page { max-width: 900px; margin: 0 auto; padding: 0 22px 80px; }

/* thin reading-progress pencil line, filled by site.js */
.progress {
  position: fixed; top: 0; left: 0; z-index: 50;
  height: 4px; width: 0;
  background: linear-gradient(90deg, var(--green), var(--green-dark));
  border-radius: 0 3px 3px 0;
}

.site-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 26px 4px 10px;
}
.site-title { font-family: var(--hand); font-size: 30px; text-decoration: none; color: var(--ink); }
.site-title .for-you { color: var(--green-dark); font-size: 22px; }
.site-nav a {
  font-family: var(--hand); font-size: 19px;
  color: var(--blue); text-decoration: none; margin-left: 16px;
}
.site-nav a:hover { color: var(--green-dark); text-decoration: underline wavy; }

/* sketchy box */
.sketch {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  box-shadow: 3px 4px 0 var(--shadow);
  padding: 22px 26px;
  margin: 26px 0;
}
.sketch.dashed { border-style: dashed; }

/* ---------------- landing ---------------- */

.hero { text-align: center; margin: 34px 0 10px; }
.hero h1 { font-size: 52px; margin: 0 0 6px; }
.hero h1 .accent { color: var(--green-dark); }
.hero p.sub { color: var(--ink-soft); font-size: 19px; margin: 0 auto; max-width: 640px; }
.hero .doodle { margin: 18px auto 0; max-width: 420px; }
.hero .doodle svg { width: 100%; height: auto; }

.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 34px 0; }
.trio .sketch { margin: 0; padding: 18px 20px; }
.trio h3 { margin: 0 0 6px; font-size: 24px; }
.trio p { margin: 0; font-size: 15.5px; color: var(--ink-soft); }
@media (max-width: 760px) { .trio { grid-template-columns: 1fr; } }

.section-title {
  font-size: 34px; margin: 60px 0 4px;
  display: inline-block; position: relative;
}
.section-title::after {
  content: ""; display: block; height: 10px; margin-top: -6px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="120" height="10" viewBox="0 0 120 10"><path d="M2 7 Q 20 2 40 6 T 78 5 T 118 6" fill="none" stroke="%237aa22a" stroke-width="2.4" stroke-linecap="round"/></svg>') repeat-x;
  background-size: 120px 10px;
}

.map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 20px; }
@media (max-width: 760px) { .map-grid { grid-template-columns: 1fr; } }
.lect-card {
  display: block; text-decoration: none; color: inherit;
  transition: transform .14s ease, box-shadow .14s ease;
}
.lect-card:hover {
  transform: rotate(-0.6deg) translateY(-2px) scale(1.01);
  box-shadow: 4px 6px 0 var(--shadow);
}
.lect-card h3 { margin: 0 0 8px; font-size: 23px; color: var(--green-dark); }
.lect-card .num {
  display: inline-block; min-width: 34px; text-align: center;
  font-family: var(--hand); font-size: 20px;
  border: 2px solid var(--line); border-radius: 50% 46% 52% 48% / 48% 52% 46% 50%;
  margin-right: 8px; color: var(--ink); background: var(--card);
}
.lect-card ul { margin: 6px 0 0; padding-left: 20px; font-size: 15px; color: var(--ink-soft); }
.lect-card li { margin: 2px 0; }
.lect-card .tags { margin-top: 10px; font-size: 14px; color: var(--grey); font-family: var(--hand); letter-spacing: 0.4px; }
.lect-card .tags span { margin-right: 12px; }

/* ---------------- lecture page ---------------- */

.lecture-head { margin: 20px 0 4px; }
.lecture-head .crumb { font-family: var(--hand); color: var(--grey); font-size: 17px; }
.lecture-head h1 { font-size: 44px; margin: 4px 0 10px; line-height: 1.15; }
.lecture-head .main-q {
  font-family: var(--hand); font-size: 24px; color: var(--green-dark); line-height: 1.4;
}

/* "In this lecture" box, generated by site.js from the h2 sections */
.toc { padding: 16px 24px; font-size: 15.5px; }
.toc .toc-title { font-family: var(--hand); font-size: 21px; color: var(--green-dark); margin: 0 0 6px; }
.toc ol { margin: 0; padding-left: 22px; columns: 2; column-gap: 36px; }
.toc li { margin: 3px 0; break-inside: avoid; color: var(--ink-soft); }
.toc a { color: var(--blue); text-decoration: none; }
.toc a:hover { color: var(--green-dark); text-decoration: underline wavy; }
@media (max-width: 700px) { .toc ol { columns: 1; } }

h2.sec {
  font-size: 30px; margin: 56px 0 10px;
  display: inline-block; scroll-margin-top: 24px;
}
h2.sec::after {
  content: ""; display: block; height: 9px; margin-top: -5px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="120" height="9" viewBox="0 0 120 9"><path d="M2 6 Q 22 1 42 5.5 T 80 4.5 T 118 5.5" fill="none" stroke="%234a6fa5" stroke-width="2.2" stroke-linecap="round" opacity="0.75"/></svg>') repeat-x;
  background-size: 120px 9px;
}
h3.sub { font-size: 23px; margin: 34px 0 6px; }

/* callouts */
.callout { position: relative; padding-left: 30px; }
.callout::before {
  content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 4.5px;
  border-radius: 4px; transform: rotate(0.6deg);
}
.callout .who {
  font-family: var(--hand); font-size: 21px; display: block; margin-bottom: 2px;
}
.callout.main-idea { background: var(--green-soft); }
.callout.main-idea::before { background: var(--green); }
.callout.main-idea .who { color: var(--green-dark); }
.callout.how { background: var(--blue-soft); }
.callout.how::before { background: var(--blue); }
.callout.how .who { color: var(--blue); }
.callout.note { background: #faf6e9; }
.callout.note::before { background: var(--grey); }
.callout.note .who { color: var(--grey); }
.callout.important { background: var(--amber-soft); }
.callout.important::before { background: var(--amber); }
.callout.important .who { color: #a97c22; }
.callout.warn { background: var(--red-soft); }
.callout.warn::before { background: var(--red); }
.callout.warn .who { color: var(--red); }

/* TA aside, the human voice of the course */
.aside {
  display: flex; gap: 14px; align-items: flex-start;
  background: #f6f0e0; border: 2px dashed var(--line);
  border-radius: 18px 60px 20px 58px / 52px 18px 56px 20px;
  padding: 16px 20px; margin: 26px 0;
}
.aside .face {
  flex: 0 0 46px; height: 46px; border-radius: 50%;
  border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--hand); font-size: 21px; background: var(--card);
  transform: rotate(-4deg);
}
.aside p { margin: 0; }
.aside .who { font-family: var(--hand); color: var(--green-dark); font-size: 19px; }

/* think-first question */
details.think {
  background: var(--blue-soft); border: 2px solid var(--line);
  border-radius: 15px 225px 15px 255px / 255px 15px 225px 15px;
  box-shadow: 3px 4px 0 var(--shadow);
  padding: 4px 22px; margin: 24px 0;
  transition: box-shadow .14s ease;
}
details.think:hover { box-shadow: 4px 6px 0 var(--shadow); }
details.think > summary {
  cursor: pointer; list-style: none; padding: 14px 0;
  font-family: var(--hand); font-size: 22px; color: var(--blue);
  line-height: 1.4;
  display: flex; gap: 12px; align-items: baseline;
}
details.think > summary::-webkit-details-marker { display: none; }
details.think > summary .qbadge {
  flex: 0 0 34px; height: 34px; border-radius: 50% 46% 52% 48% / 48% 52% 46% 50%;
  border: 2.4px solid var(--blue); color: var(--blue); background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; font-size: 21px;
  transform: rotate(3deg);
}
details.think > summary .hint {
  font-family: var(--body-font); font-style: italic;
  font-size: 14.5px; color: var(--grey);
}
details.think[open] > summary { border-bottom: 2px dashed var(--line); }
details.think .answer-head {
  font-family: var(--hand); font-size: 20px; color: var(--green-dark); margin: 12px 0 4px;
}

/* research card */
.research-card { border-color: var(--blue); }
.rc-start { font-size: 16px; color: var(--ink-soft); }

/* figures */
figure.sketch { padding: 24px 20px; text-align: center; margin-left: 0; margin-right: 0; }
figure.sketch svg { max-width: 100%; height: auto; }
figcaption, .figcap {
  font-family: var(--hand); color: var(--ink-soft);
  font-size: 18px; margin-top: 12px; text-align: center;
}
svg text { font-family: "Patrick Hand", "Nunito Sans", cursive; }

/* math colors, matching the SVG palette */
.c-green { color: var(--green-dark); }
.c-blue { color: var(--blue); }
.c-red { color: var(--red); }
.c-grey { color: var(--grey); }

/* long display equations scroll instead of overflowing on small screens */
mjx-container[display="true"] { display: block; overflow-x: auto; overflow-y: hidden; max-width: 100%; padding: 2px 0; }

/* Keep long inline formulas from widening the parallelism lecture on phones. */
@media (max-width: 700px) {
  .lecture-parallelism mjx-container:not([display="true"]) {
    display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden;
    vertical-align: middle;
  }
  .lecture-parallelism details.think > summary > span {
    min-width: 0; overflow-wrap: anywhere;
  }
}

/* tables */
table.nb {
  border-collapse: collapse; margin: 22px auto; background: var(--card);
  border: 2px solid var(--line); box-shadow: 2px 3px 0 var(--shadow);
}
table.nb th, table.nb td { border: 1px solid var(--line-soft); padding: 8px 16px; font-size: 16px; }
table.nb th { font-family: var(--hand); font-size: 17.5px; background: var(--green-soft); }
table.nb tr:nth-child(odd) td { background: #faf6ea; }

/* code */
code { font-family: var(--mono); font-size: 15px; background: #f0ecdd; padding: 1px 6px; border-radius: 6px; }
pre {
  background: #2e2c27; color: #f4f0e2; border-radius: 12px 30px 14px 28px / 26px 14px 28px 14px;
  box-shadow: 3px 4px 0 var(--shadow);
  padding: 16px 20px; overflow-x: auto; font-size: 14.5px; line-height: 1.55;
}
pre code { background: none; color: inherit; padding: 0; }

/* playground controls */
select {
  font-family: var(--body-font); font-size: 15.5px; color: var(--ink);
  background: var(--card); border: 2px solid var(--line-soft);
  border-radius: 10px 14px 10px 14px; padding: 3px 8px;
}
input[type="range"] { accent-color: var(--green-dark); }
button, input[type="button"] {
  font-family: var(--hand); font-size: 17px; color: var(--ink); cursor: pointer;
  background: var(--card); border: 2px solid var(--line);
  border-radius: 225px 15px 255px 15px / 15px 255px 15px 225px;
  padding: 4px 16px; box-shadow: 2px 3px 0 var(--shadow);
}
button:hover, input[type="button"]:hover { color: var(--green-dark); }

/* nav between lectures */
.lect-nav { display: flex; justify-content: space-between; margin-top: 70px; gap: 14px; flex-wrap: wrap; }
.lect-nav a {
  font-family: var(--hand); font-size: 20px; color: var(--blue);
  text-decoration: none; border: 2px solid var(--line); background: var(--card);
  border-radius: 225px 15px 255px 15px / 15px 255px 15px 225px;
  padding: 10px 22px; box-shadow: 2px 3px 0 var(--shadow);
  transition: transform .14s ease, box-shadow .14s ease;
}
.lect-nav a:hover {
  color: var(--green-dark);
  transform: translateY(-2px) rotate(-0.4deg);
  box-shadow: 3px 5px 0 var(--shadow);
}

.footer { margin-top: 80px; color: var(--grey); font-size: 14.5px; text-align: center; }

mark.hl { background: #f6e7b2; padding: 0 4px; border-radius: 6px 12px 6px 12px; }

/* small screens */
@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .hero h1 { font-size: 38px; }
  .lecture-head h1 { font-size: 33px; }
  h2.sec { font-size: 26px; }
  .sketch { padding: 18px 18px; }
  .callout { padding-left: 26px; }
}
