/* tutorial.css — tutorial pages and the tutorials index.
   Loads after menu.css and overrides.css; inherits --font-serif from there.
   Palette matches archive.css: #111 ink, #555 secondary, #888 muted,
   rgba(0,0,0,0.1) rules. Light only, like the rest of the site. */

:root {
  --tut-ink: #111;
  --tut-second: #555;
  --tut-muted: #888;
  --tut-rule: rgba(0, 0, 0, 0.1);
  --tut-hair: rgba(0, 0, 0, 0.08);
  --tut-wash: #f7f7f6;
  --tut-wash-deep: #eeeeec;
  --tut-link-wash: rgba(0, 0, 0, 0.055);
  --tut-measure: 42rem;
  --tut-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
}

/* ------------------------------------------------------------ page frame */
/* An article, not a grid: one centred measure rather than the archive's
   1280px field, which left the text stranded against the left edge. */
.tutorial-page {
  max-width: calc(var(--tut-measure) + 3rem);
  margin: 0 auto;
  padding: 6rem 1.5rem 4rem;
  font-family: var(--font-serif, "Sorts Mill Goudy", Georgia, serif);
  color: var(--tut-ink);
}

.tut-eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tut-muted);
  margin: 0 0 1.5rem;
}
.tut-eyebrow a { color: var(--tut-muted); text-decoration: none; }
.tut-eyebrow a:hover { color: var(--tut-ink); }
.tut-eyebrow span { margin: 0 0.5rem; }

.tutorial-page > h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.08;
  margin: 0 0 1.25rem;
  max-width: 20ch;
}

.tut-standfirst {
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--tut-second);
  max-width: var(--tut-measure);
  margin: 0 0 1.75rem;
}

.tut-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin: 0 0 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--tut-rule);
}
.tut-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tut-second);
  border: 1px solid var(--tut-rule);
  /* square corners, and a fixed box so a wrapped row of them stays even */
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0 0.7em;
  line-height: 1;
}
.tut-tag--plain { border-color: transparent; color: var(--tut-muted); }

/* the year, set solid — the one hard fact on a card, and a property of the
   individual workshop rather than of the course group above it */
.tut-year {
  display: inline-flex;
  align-items: center;
  background: var(--tut-ink);
  color: #fff;
  font-size: 0.82rem;
  line-height: 1;
  letter-spacing: 0.05em;
  border: 1px solid var(--tut-ink);
  min-height: 1.7rem;
  padding: 0 0.75em;
  margin-right: 0.15rem;
}

/* provenance: one sentence placing the workshop — when, which course, which
   programme. A sentence rather than a row of chips: it is read once, at the
   top, and then never again. */
.tut-origin {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--tut-muted);
  max-width: var(--tut-measure);
  margin: -1.75rem 0 3rem;
}
.tut-origin strong { font-weight: 400; color: var(--tut-ink); }
.tut-origin time { color: var(--tut-ink); }

/* ------------------------------------------------------------------- toc */
.tut-toc {
  max-width: var(--tut-measure);
  margin: 0 0 3.5rem;
}
.tut-toc h2 {
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tut-muted);
  margin: 0 0 0.9rem;
}
.tut-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 2.5rem;
}
.tut-toc li {
  break-inside: avoid;
  margin: 0 0 0.5rem;
  font-size: 0.98rem;
  line-height: 1.35;
}
.tut-toc a {
  display: flex;
  gap: 0.7rem;
  color: var(--tut-second);
  text-decoration: none;
  transition: color 0.2s var(--tut-ease);
}
.tut-toc a:hover { color: var(--tut-ink); }
/* step marker in its own column so labels align whether or not a section
   is numbered — Notion mixes "1." and "A." and leaves some unmarked */
.tut-toc__n {
  flex: none;
  width: 1.4em;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--tut-muted);
  padding-top: 0.14em;
}
.tut-toc__t {
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--tut-ease);
}
.tut-toc a:hover .tut-toc__t { border-bottom-color: var(--tut-rule); }
.tut-toc li:has(> a > .tut-toc__t:only-child) { padding-left: 2.1em; }

/* ------------------------------------------------------------------ body */
.tut-body {
  max-width: var(--tut-measure);
  font-size: 1.125rem;      /* ~66 characters per line at 42rem */
  line-height: 1.72;
}
.tut-body > p { margin: 0 0 1.3em; text-wrap: pretty; }
/* These pages are link-dense, so a link has to read as a link while scanning
   without turning a paragraph into a barcode: a pale wash and a solid rule at
   rest, the full invert only under the cursor. */
.tut-body a {
  color: var(--tut-ink);
  background: var(--tut-link-wash);
  box-shadow: 0 1px 0 0 var(--tut-ink);
  text-decoration: none;
  padding: 0.05em 0.15em;
  margin: 0 -0.05em;
  /* the box follows each line of a link that wraps */
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background-color 0.15s var(--tut-ease),
              color 0.15s var(--tut-ease);
}
.tut-body a:hover,
.tut-body a:focus-visible {
  background: var(--tut-ink);
  color: #fff;
  box-shadow: 0 1px 0 0 var(--tut-ink);
}
/* links that are already a box of their own opt out of the treatment */
.tut-body .tut-dl a,
.tut-videos a {
  background: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}
.tut-videos a { text-decoration: underline; text-underline-offset: 0.18em; }

.tut-body h2 {
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 4rem 0 1.1rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--tut-rule);
  scroll-margin-top: 5rem;
}
.tut-body > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.tut-body h3 {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.3;
  text-wrap: balance;
  margin: 2.5rem 0 0.75rem;
  scroll-margin-top: 5rem;
}

.tut-body ul, .tut-body ol { margin: 0 0 1.3em; padding-left: 1.4em; }
.tut-body li { margin: 0 0 0.55em; text-wrap: pretty; }
.tut-body li::marker { color: var(--tut-muted); }

/* downloadable attachment (.py, .zip) */
.tut-dl { margin: 1.5rem 0; }
.tut-dl a {
  display: inline-block;
  font-family: var(--font-mono) !important;
  font-size: 0.85rem;
  padding: 0.6em 1em 0.6em 2.2em;
  border: 1px solid var(--tut-rule);
  text-decoration: none;
  color: var(--tut-ink);
  position: relative;
  transition: border-color 0.2s var(--tut-ease);
}
.tut-dl a::before {
  content: "↓";
  position: absolute;
  left: 1em;
  color: var(--tut-muted);
}
.tut-dl a:hover { border-color: var(--tut-ink); }

.tut-rule {
  border: 0;
  border-top: 1px solid var(--tut-rule);
  margin: 3rem 0;
}

/* checklist — static, readers can't tick it, so don't fake a control */
.tut-check { list-style: none; padding-left: 0; }
.tut-check li { padding-left: 1.7em; position: relative; }
.tut-check li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 0.8em;
  height: 0.8em;
  border: 1px solid var(--tut-muted);
}

/* ------------------------------------------------------------------ code */
/* overrides.css:15 sets the serif on
   `body *:not(.fa):not(.fas)…:not([class*="dashicons"])` with !important —
   specificity 0-9-1. A plain `.tut-code code` (0-1-1) loses to it, so the
   monospace rules hang off #tut on <main>: one id (1-0-1) clears it. */
#tut pre,
#tut code,
#tut kbd,
#tut samp {
  font-family: var(--font-mono) !important;
}

.tut-body code,
.tut-note code,
.tut-toggle code,
.tut-table code {
  font-size: 0.85em;
  background: var(--tut-wash-deep);
  border: 1px solid var(--tut-rule);
  border-radius: 3px;
  padding: 0.12em 0.4em;
  word-break: break-word;
}
/* a code span inside a link is part of the link, so it inverts with it */
.tut-body a:hover code,
.tut-body a:focus-visible code {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.tut-code {
  position: relative;
  margin: 1.5rem 0;
  background: var(--tut-wash);
  border: 1px solid var(--tut-hair);
  border-left: 2px solid var(--tut-ink);
}
.tut-code pre {
  margin: 0;
  padding: 1rem 1.1rem;
  padding-right: 3.4rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
}
.tut-code code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}
#tut .tut-code__lang {
  position: absolute;
  top: 0;
  right: 0;
  font-family: var(--font-serif, Georgia, serif) !important;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tut-muted);
  padding: 0.35em 0.7em;
}

/* copy button — injected by tutorial.js, so it never appears without JS */
.tut-code__bar {
  position: sticky;
  top: 4.75rem;            /* clears the fixed site menu */
  height: 0;
  z-index: 2;
  text-align: right;
}
.tut-copy {
  position: relative;
  top: 0.4rem;
  right: 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--tut-muted);
  background: var(--tut-wash);
  border: 1px solid var(--tut-rule);
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s var(--tut-ease), color 0.2s var(--tut-ease),
              border-color 0.2s var(--tut-ease);
}
.tut-copy svg { display: block; }
.tut-code:hover .tut-copy,
.tut-copy:focus-visible { opacity: 1; }
.tut-copy:hover { color: var(--tut-ink); border-color: var(--tut-ink); }
.tut-copy.is-done { opacity: 1; color: var(--tut-ink); border-color: var(--tut-ink); }
.tut-copy.is-fail { color: var(--tut-ink); }
.tut-copy.is-fail { opacity: 1; }
/* touch devices have no hover — keep it permanently visible there */
@media (hover: none) { .tut-copy { opacity: 1; } }
/* the language label would collide with the button */
.tut-code:hover .tut-code__lang { opacity: 0; }
#tut .tut-code__lang { transition: opacity 0.2s var(--tut-ease); }

/* --------------------------------------------------------------- callouts */
/* No pastel fills — the site is austere black-and-white serif. Tone is
   carried by the ground, the left rule and the emoji, never by colour. */
.tut-note {
  display: flex;
  gap: 0.85rem;
  margin: 1.75rem 0;
  padding: 0.9rem 1.1rem;
  background: var(--tut-wash);
  border-left: 2px solid var(--tut-rule);
}
.tut-note__icon { font-size: 1rem; line-height: 1.65; flex: none; }
.tut-note__body { min-width: 0; flex: 1; }
.tut-note__body > :first-child { margin-top: 0; }
.tut-note__body > :last-child { margin-bottom: 0; }
.tut-note__body > p { margin: 0 0 0.7em; }

/* the rule weight is the whole hierarchy: hairline aside -> read this -> stop */
.tut-note--tip   { border-left-color: var(--tut-rule); }
.tut-note--note  { border-left-color: var(--tut-rule); }
.tut-note--os    { border-left-color: var(--tut-muted); }
.tut-note--warn  { border-left-width: 3px; border-left-color: var(--tut-ink); }
.tut-note--stop  {
  border-left-width: 4px;
  border-left-color: var(--tut-ink);
  background: var(--tut-wash-deep);
}
/* editorial note added on republication, not part of the original material */
.tut-note--stale {
  border-left-width: 3px;
  border-left-color: var(--tut-ink);
  background: var(--tut-wash);
  padding: 1rem 1.2rem;
  margin: 0 0 3rem;
  max-width: var(--tut-measure);
  font-size: 0.95rem;
}
.tut-note--stale .tut-note__body p { margin: 0; line-height: 1.6; }
.tut-note--stop .tut-note__body { font-weight: 500; }

/* ---------------------------------------------------------------- toggles */
.tut-toggle {
  margin: 1.25rem 0;
  border-top: 1px solid var(--tut-rule);
}
.tut-toggle > summary {
  cursor: pointer;
  padding: 0.7rem 1.5rem 0.7rem 0;
  position: relative;
  list-style: none;
  color: var(--tut-second);
  transition: color 0.2s var(--tut-ease);
}
.tut-toggle > summary::-webkit-details-marker { display: none; }
.tut-toggle > summary:hover { color: var(--tut-ink); }
.tut-toggle > summary::after {
  content: "+";
  position: absolute;
  right: 0.2rem;
  top: 0.6rem;
  font-size: 1.1rem;
  color: var(--tut-muted);
}
.tut-toggle[open] > summary::after { content: "–"; }
.tut-toggle__body { padding: 0 0 1.25rem; }
.tut-toggle__body > :first-child { margin-top: 0; }

/* toggle used as a section heading (the Appendices) */
.tut-toggle--section { border-top-width: 1px; margin-top: 2.5rem; }
.tut-toggle--section > summary { padding-top: 1.4rem; }
.tut-toggle--section > summary h2 {
  display: inline;
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--tut-ink);
}
.tut-toggle--section > summary::after { top: 1.5rem; }

/* --------------------------------------------------------------- figures */
.tut-fig { margin: 2rem 0; }
.tut-fig img,
.tut-fig video {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border: 1px solid var(--tut-hair);
}
.tut-fig figcaption {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--tut-muted);
  margin-top: 0.6rem;
}
.tut-fig figcaption a { color: inherit; }

/* ---------------------------------------------------------------- tables */
.tut-table { margin: 1.75rem 0; overflow-x: auto; }
.tut-table table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.tut-table th, .tut-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 1rem 0.7rem 0;
  border-bottom: 1px solid var(--tut-rule);
  line-height: 1.5;
}
.tut-table th {
  font-weight: 400;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tut-muted);
  border-bottom-color: var(--tut-ink);
}

/* ------------------------------------------------------------ link cards */
.tut-linkcard, .tut-pagelink { margin: 1.5rem 0; }
/* These sit inside callouts as often as on the page, so the card needs its own
   paper ground to lift off the callout's grey — and it inverts on hover like
   every other link in the body, rather than nudging one border a shade darker. */
.tut-body .tut-linkcard a,
.tut-body .tut-pagelink a {
  display: flex;
  align-items: baseline;
  gap: 0.75em;
  padding: 0.8rem 1.05rem;
  background: #fff;
  border: 1px solid var(--tut-rule);
  box-shadow: none;
  text-decoration: none;
  color: var(--tut-ink);
  word-break: break-word;
  transition: background-color 0.2s var(--tut-ease),
              border-color 0.2s var(--tut-ease),
              color 0.2s var(--tut-ease);
}
/* the arrow is the affordance the old border-only hover never gave */
.tut-body .tut-linkcard a::after,
.tut-body .tut-pagelink a::after {
  content: "→";
  margin-left: auto;
  color: var(--tut-muted);
  transition: transform 0.2s var(--tut-ease), color 0.2s var(--tut-ease);
}
.tut-body .tut-linkcard a:hover,
.tut-body .tut-pagelink a:hover,
.tut-body .tut-linkcard a:focus-visible,
.tut-body .tut-pagelink a:focus-visible {
  background: var(--tut-ink);
  border-color: var(--tut-ink);
  color: #fff;
}
.tut-body .tut-linkcard a:hover::after,
.tut-body .tut-pagelink a:hover::after,
.tut-body .tut-linkcard a:focus-visible::after,
.tut-body .tut-pagelink a:focus-visible::after {
  color: #fff;
  transform: translateX(0.25em);
}
.tut-body .tut-linkcard a { font-size: 0.9rem; color: var(--tut-second); }
.tut-body .tut-linkcard a:hover { color: #fff; }

/* ------------------------------------------------------- prev / next pair */
.tut-seq {
  display: flex;
  gap: 1.5rem;
  max-width: var(--tut-measure);
  margin: 4rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--tut-rule);
}
.tut-seq a {
  flex: 1;
  text-decoration: none;
  color: var(--tut-ink);
  font-size: 1.05rem;
  line-height: 1.3;
  transition: opacity 0.2s var(--tut-ease);
}
.tut-seq a:hover { opacity: 0.6; }
.tut-seq a span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tut-muted);
  margin-bottom: 0.4rem;
}
.tut-seq__next { text-align: right; }

/* ---------------------------------------------------------------- footer */
/* Same rules as archive.css:138-148. Repeated rather than pulling in the
   whole of archive.css, which carries the .proj-grid the constellation
   binds to. Keep the two in sync if the footer ever changes. */
.site-footer {
  border-top: 1px solid var(--tut-rule);
  padding: 2rem 1.5rem;
  text-align: center;
  font-family: var(--font-serif, "Sorts Mill Goudy", Georgia, serif);
  font-size: 0.85rem;
  color: var(--tut-muted);
}
.site-footer p { margin: 0.25rem 0; }
.site-footer a {
  color: var(--tut-second);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-footer a:hover { border-color: var(--tut-second); }

/* ============================================================ index page */
.tutorials-index {
  max-width: 1180px;
  margin: 0 auto;
  padding: 6rem 1.5rem 4rem;
}
.tutorials-index > h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
}
.tutorials-index > .tut-standfirst { max-width: 44rem; margin-bottom: 4rem; }

/* deliberately NOT .proj-grid — constellation.js binds to the first
   .proj-grid it finds and would treat these as archive cards */
.tut-grid {
  display: grid;
  /* auto-fit, not auto-fill: a course with two sessions fills its row
     instead of leaving an empty third track */
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 3.5rem 2.5rem;
}
.tut-card { display: flex; flex-direction: column; }

.tut-card__media {
  display: block;
  margin: 0 0 1.25rem;
  overflow: hidden;
  background: var(--tut-wash);
  border: 1px solid var(--tut-hair);
  aspect-ratio: 16 / 10;
}
.tut-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--tut-ease);
}
.tut-card:hover .tut-card__media img { transform: scale(1.04); }
.tut-card__media--none { aspect-ratio: 16 / 10; }

.tut-card__text { display: flex; flex-direction: column; flex: 1; }
/* a one-line record of the teaching this page documents */
.tut-ledger {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--tut-muted);
  margin: -2.5rem 0 4rem;
}

.tut-card__when {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.8rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tut-muted);
  margin: 0.7rem 0 0;
}
.tut-card__series { color: var(--tut-ink); }
.tut-card__title {
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 1.22;
  text-wrap: balance;
  margin: 0 0 0.6rem;
}
.tut-card__title a {
  color: var(--tut-ink);
  text-decoration: none;
  transition: opacity 0.2s var(--tut-ease);
}
.tut-card:hover .tut-card__title a { opacity: 0.6; }
.tut-card__sum {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--tut-second);
  text-wrap: pretty;
  margin: 0 0 1.15rem;
}
.tut-card .tut-meta {
  align-items: center;
  margin: auto 0 0;
  padding: 0;
  border: 0;
}

/* ----------------------------------------------------------- responsive */
@media (max-width: 768px) {
  .tut-toc ol { columns: 1; }
}
@media (max-width: 600px) {
  .tutorial-page, .tutorials-index { padding: 5rem 1rem 3rem; }
  .tut-standfirst { font-size: 1.1rem; }
  .tut-body { font-size: 1rem; }
  .tut-body h2 { font-size: 1.4rem; margin-top: 2.5rem; }
  .tut-toggle--section > summary h2 { font-size: 1.4rem; }
  .tut-seq { flex-direction: column; gap: 1.75rem; }
  .tut-seq__next { text-align: left; }
  .tut-grid { grid-template-columns: 1fr; gap: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tut-toc a, .tut-card__title a, .tut-seq a,
  .tut-linkcard a, .tut-pagelink a, .tut-toggle > summary { transition: none; }
  .tut-body .tut-linkcard a:hover::after,
  .tut-body .tut-pagelink a:hover::after { transform: none; }
}

/* ------------------------------------------------------------- video */
/* Anthropic's own Claude Code 101 series, embedded from
   youtube-nocookie.com with loading="lazy": a reader who never scrolls
   this far never touches a Google server. */
.tut-videos {
  max-width: var(--tut-measure);
  margin: 2.5rem 0 3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--tut-rule);
}
.tut-videos__head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tut-muted);
  margin: 0 0 1.1rem;
}
.tut-videos__head a { color: var(--tut-ink); }
/* one per row: a 16:9 player at half the measure is too small to read a
   terminal in, which is the whole point of these */
.tut-videos__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
.tut-video { margin: 0; }
/* the ratio box keeps the iframe from collapsing before it loads */
.tut-video__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  background: var(--tut-ink);
  border: 1px solid var(--tut-hair);
}
.tut-video__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.tut-video figcaption {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--tut-second);
  margin: 0.6rem 0 0;
}
