/* Lab notes — cards, archive and single note pages */

/* ---------- Note cards (index-card look from the original Open questions grid) ---------- */
.notes {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--col-gap);
  margin-top: 48px;
  list-style: none;
}

.note-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 300px;
  padding: 20px 24px 24px;
  border: 1px solid var(--rule);
  transition: border-color .2s ease;
}

.note-card:hover,
.note-card:focus-visible { border-color: var(--ink); outline: none; }

.note-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 15px;
  line-height: 20px;
  color: var(--muted);
}

.note-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  margin-top: 40px;
  font-size: 28px;
  font-weight: 400;
  line-height: 33px;
  letter-spacing: -0.02em;
}

.note-card__subtitle {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin-top: auto;
  padding-top: 24px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
  line-height: 22px;
  letter-spacing: 0.014em;
  color: var(--ink-soft);
}

.notes__empty {
  grid-column: 1 / -1;
  padding: 24px 0;
  font-size: 18px;
  color: var(--muted);
}

.lab-more {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 32px;
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
  border-bottom: 1px solid currentColor;
}

.lab-more span { display: inline-block; transition: transform .2s ease; }
.lab-more:hover span { transform: translateX(4px); }

/* ---------- Archive page ---------- */
.lab-head { padding: 64px 0 0; }

.lab-head__title {
  margin-top: 40px;
  font-size: 96px;
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.lab-head__lede {
  max-width: 760px;
  margin-top: 24px;
  font-size: 26px;
  line-height: 33px;
  letter-spacing: -0.015em;
  color: #8a8a8a;
}

.lab-archive {
  margin-top: 56px;
  padding-top: var(--section-pad);
  border-top: 1px solid var(--rule);
}

.lab-archive .notes { margin-top: 0; }

/* ---------- Single note: header ---------- */
.note-head { padding: 56px 0 0; }

.note-back {
  font-size: 18px;
  line-height: 24px;
  color: var(--muted);
}

.note-back:hover { color: var(--ink); }

.note-title {
  max-width: 1120px;
  margin-top: 48px;
  font-size: 72px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
}

.note-subtitle {
  max-width: 900px;
  margin-top: 22px;
  font-size: 30px;
  line-height: 37px;
  letter-spacing: -0.015em;
  color: #8a8a8a;
}

/* ---------- Single note: sidebar + full-width text column ---------- */
.note-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: var(--col-gap);
  margin-top: 64px;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
}

.note-aside {
  grid-column: 1;
  align-self: start;
  position: sticky;
  top: 24px;
  padding-right: 32px;
}

.note-aside__label {
  font-size: 15px;
  line-height: 20px;
  color: var(--muted);
}

.note-facts div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
  line-height: 20px;
}

.note-facts div:first-child { padding-top: 0; }
.note-facts dt { color: var(--muted); }
.note-facts dd { text-align: right; }

.note-toc { margin-top: 40px; }

.note-toc ol {
  margin-top: 12px;
  list-style: none;
  border-left: 1px solid var(--rule);
}

.note-toc a {
  display: block;
  margin-left: -1px;
  padding: 6px 0 6px 16px;
  border-left: 1px solid transparent;
  font-size: 16px;
  line-height: 22px;
  color: var(--muted);
  transition: color .2s ease, border-color .2s ease;
}

.note-toc a:hover { color: var(--ink); }
.note-toc a.is-active { color: var(--ink); border-left-color: var(--ink); }

/* Body: every block fills the text column (columns 2–3) */
.note-body {
  grid-column: 2 / 4;
  min-width: 0;
}

.note-body > * { margin-bottom: 26px; }
.note-body > :last-child { margin-bottom: 0; }

.note-body p,
.note-body li {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 19px;
  line-height: 32px;
  letter-spacing: 0.004em;
  color: var(--ink-soft);
}

.note-body a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.note-body strong { font-weight: 600; color: var(--ink); }

.note-body h2 {
  margin-top: 64px;
  margin-bottom: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 36px;
  font-weight: 400;
  line-height: 42px;
  letter-spacing: -0.02em;
  scroll-margin-top: 24px;
}

.note-body > h2:first-child { margin-top: 0; }

.note-body h3 {
  margin-top: 36px;
  margin-bottom: 12px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 21px;
  font-weight: 600;
  line-height: 29px;
  letter-spacing: 0.009em;
}

.note-body blockquote {
  margin: 48px 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--ink);
}

.note-body blockquote p {
  font-family: "Inter Tight", "Inter", system-ui, sans-serif;
  font-size: 40px;
  line-height: 47px;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.note-body cite {
  display: block;
  margin-top: 14px;
  font-size: 15px;
  font-style: normal;
  color: var(--muted);
}

.note-body ul,
.note-body ol { list-style: none; }

.note-body ul li,
.note-body ol li {
  position: relative;
  padding: 10px 0 10px 40px;
  border-top: 1px solid var(--rule);
}

.note-body ul li:last-child,
.note-body ol li:last-child { border-bottom: 1px solid var(--rule); }

.note-body ul li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--muted);
}

.note-body ol { counter-reset: note-list; }
.note-body ol li { counter-increment: note-list; }
.note-body ol li::before {
  content: counter(note-list, decimal-leading-zero);
  position: absolute;
  left: 0;
  font-size: 15px;
  color: var(--muted);
}

.note-body code {
  padding: 1px 5px;
  background: #f0efe9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .86em;
}

.note-body pre {
  overflow-x: auto;
  padding: 24px 28px;
  background: #f3f2ee;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 22px;
  color: var(--ink);
}

.note-body pre code { padding: 0; background: none; font-size: inherit; }

/* Figures in the four on-brand formats, all aligned to the text column */
.note-fig { margin: 40px 0 44px; }

.note-fig__grid { display: grid; gap: 24px; }
.note-fig--pair .note-fig__grid { grid-template-columns: 1fr 1fr; }
.note-fig--trio .note-fig__grid { grid-template-columns: repeat(3, 1fr); }

.note-fig__media { position: relative; overflow: hidden; }
.note-fig__media img { display: block; width: 100%; height: 100%; object-fit: cover; }

.note-fig--wide .note-fig__media { aspect-ratio: 1306 / 413; }
.note-fig--pair .note-fig__media,
.note-fig--trio .note-fig__media { aspect-ratio: 422 / 481; }

/* Inline keeps the image's natural proportions (charts, diagrams, screenshots) */
.note-fig--inline .note-fig__media img { height: auto; object-fit: contain; }
.note-fig--inline .note-fig__media.ph { aspect-ratio: 16 / 10; }

.note-fig figcaption {
  margin-top: 12px;
  font-size: 15px;
  line-height: 21px;
  color: var(--muted);
}

.note-more { margin-top: 101px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .notes { grid-template-columns: 1fr 1fr; }
  .lab-head__title { font-size: 68px; }
  .note-title { font-size: 54px; }
  .note-subtitle { font-size: 24px; line-height: 31px; }
  .note-layout { grid-template-columns: 1fr; row-gap: 40px; }
  .note-aside { grid-column: auto; position: static; padding-right: 0; }
  .note-toc { display: none; }
  .note-body { grid-column: auto; }
}

@media (max-width: 760px) {
  .notes { grid-template-columns: 1fr; }
  .note-card { min-height: 0; }
  .note-card__title { margin-top: 24px; }
  .note-fig--trio .note-fig__grid { grid-template-columns: 1fr; }
  .note-fig--wide .note-fig__media { aspect-ratio: 16 / 9; }
}

@media (max-width: 640px) {
  .lab-head { padding-top: 32px; }
  .lab-head__title { font-size: 46px; }
  .lab-head__lede { font-size: 20px; line-height: 27px; }
  .note-head { padding-top: 32px; }
  .note-title { margin-top: 32px; font-size: 38px; line-height: 1.05; }
  .note-subtitle { font-size: 20px; line-height: 27px; }
  .note-body p, .note-body li { font-size: 17px; line-height: 28px; }
  .note-body h2 { margin-top: 48px; font-size: 28px; line-height: 34px; }
  .note-body blockquote p { font-size: 28px; line-height: 34px; }
  .note-card__title { font-size: 24px; line-height: 29px; }
  .note-fig--pair .note-fig__grid { gap: 12px; }
}
