/* Homepage: hand-drawn calculus on graph paper.
   Rules (os/strategy/research/soft-launch/design-system.md): one grid for the whole page; drawings
   are transparent pencil over it; every label and equation is live text in Mahal Hand (Yomogi);
   graphite for labels, forest for equations, green only for the answer. */

@font-face {
  /* Yomogi (OFL), made proportional and cut to Latin, Greek and math: fonts/src/make_hand.py */
  font-family: "Mahal Hand";
  src: url("/fonts/mahal-hand.woff") format("woff");
  font-display: swap;
}

:root {
  --grid: 24px;
  --paper: #F9FAF9;
  --line: #E2EAE4;
  --line-major: #D2DED5;
  --forest: #225734;
  --green: #95C13E;
  --green-ink: #6f9a2a;
  --pale: #EFF6DF;
  --charcoal: #1A201C;
  --graphite: #3F4541;
  --hand-ink: #2B302D;      /* labels: darker than body graphite, since the grain lightens them */
  --hand-green: #5C8A1C;
  --muted: #59625C;
  --hand: "Mahal Hand", cursive;
  --head: "Montserrat", system-ui, sans-serif;
  --body: "Roboto", system-ui, sans-serif;
  --wrap: calc(var(--grid) * 50); /* 1200px */
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--grid) * 2); }

body {
  margin: 0;
  color: var(--charcoal);
  font: 400 17px/1.6 var(--body);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--line-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-major) 1px, transparent 1px),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size:
    calc(var(--grid) * 5) calc(var(--grid) * 5), calc(var(--grid) * 5) calc(var(--grid) * 5),
    var(--grid) var(--grid), var(--grid) var(--grid);
  background-position: center top;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--forest); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 calc(var(--grid) * 2);
}

/* ---------- Type ---------- */

h1, h2, h3 { font-family: var(--head); font-weight: 700; color: var(--forest); margin: 0; }
h1 { font-size: clamp(40px, 5.4vw, 66px); line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-size: clamp(30px, 3.4vw, 42px); line-height: 1.12; letter-spacing: -0.01em; margin-bottom: var(--grid); }
h3 { font-size: 24px; line-height: 1.2; margin: 6px 0 10px; }

.lead { font-size: 20px; line-height: 1.55; color: var(--graphite); max-width: 36em; margin: 0 0 calc(var(--grid) * 1.5); }
/* one-sentence leads that should sit on one line on desktop */
.lead--wide { max-width: none; }

.eyebrow {
  font: 700 13px/1 var(--head);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green-ink);
  margin: 0 0 12px;
}

.built {
  display: inline-block;
  margin: 0 0 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--pale);
  color: var(--forest);
  font: 600 13px/1.5 var(--head);
}

/* ---------- Handwriting ---------- */

.hand {
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1.2;
  color: var(--hand-ink);
  -webkit-text-stroke: 0.35px currentColor;
  white-space: nowrap;
  font-variant-ligatures: none;
  filter: url(#pencil);
  /* a halo of paper so labels read over pencil lines */
  text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 6px var(--paper);
}
.hand.small { font-size: 19px; }
.hand.green { color: var(--hand-green); }
.hand.forest { color: var(--forest); }
.hand sub, .hand sup { font-size: 0.65em; line-height: 0; }

/* ---------- Figures: a transparent drawing with live-text labels ---------- */

.fig { position: relative; margin: 0; }
.fig img { width: 100%; }
.fig .art { position: relative; }
.fig > .hand, .fig .art > .hand { position: absolute; transform-origin: left center; }
.fig .eq { position: static; display: block; margin-top: 8px; font-size: 26px; text-align: center; white-space: normal; }
/* Cards line up: every drawing is a 3:2 canvas and every equation exactly one line */
.card .fig .art img { aspect-ratio: 3 / 2; }
.card .fig .eq { font-size: 21px; height: 1.5em; line-height: 1.5em; white-space: nowrap; margin-top: 4px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 14px 26px;
  border: 0;
  border-radius: 6px;
  background: var(--forest);
  color: #fff;
  font: 700 15px/1 var(--head);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn:hover, .btn:focus-visible { background: #1a4428; transform: translateY(-1px); }
.btn:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.btn .ext { width: 0.95em; height: 0.95em; margin-left: 6px; vertical-align: -0.1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn--small { padding: 10px 18px; font-size: 14px; }

/* ---------- Nav ---------- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(var(--grid) * 4);
}
.nav__brand {
  display: flex; align-items: center; gap: 10px;
  font: 700 19px/1 var(--head);
  color: var(--forest);
  text-decoration: none;
}
.nav__links { display: flex; align-items: center; gap: 28px; }
.nav__links a { font: 600 15px/1 var(--head); color: var(--graphite); text-decoration: none; }
.nav__links a:hover { color: var(--forest); }
.nav__links a.nav__cta { color: #fff; font-size: 14px; }

/* ---------- Sections ---------- */

.hero {
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: calc(var(--grid) * 2);
  align-items: center;
  padding-top: calc(var(--grid) * 1.5);
  padding-bottom: calc(var(--grid) * 1.5);
}
.hero h1 { margin-bottom: calc(var(--grid) * 1); }
.fig--hero { max-width: calc(var(--grid) * 21); justify-self: end; width: 100%; }
.fig--hero .eq { margin-top: var(--grid); }

.panel { padding-top: calc(var(--grid) * 2.5); padding-bottom: calc(var(--grid) * 1.5); }

.split {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: calc(var(--grid) * 3);
  align-items: end;
}
.split--fig { grid-template-columns: 4fr 6fr; gap: calc(var(--grid) * 2); align-items: center; }
.hero > *, .split > *, .cards > * { min-width: 0; }

/* Install box */
.install { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin-top: calc(var(--grid) * 0.5); }
.install__gh { display: inline-flex; align-items: center; white-space: nowrap; color: var(--forest); font: 500 15px/1 var(--head); }
.install__gh .ext { width: 0.95em; height: 0.95em; margin-left: 5px; }
.cmd {
  display: flex; align-items: center; gap: 10px;
  max-width: 100%;
  padding: 8px 8px 8px 14px;
  border: 1.5px solid var(--forest);
  border-radius: 6px;
  background: var(--paper);
}
.cmd code { font: 13.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--charcoal); overflow-x: auto; white-space: nowrap; }
.cmd__copy {
  flex: none;
  padding: 6px 10px;
  border: 0; border-radius: 4px;
  background: var(--pale); color: var(--forest);
  font: 700 12px/1 var(--head); letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer;
}
.cmd__copy:hover { background: #e2efc7; }

/* The report, taped to the paper */
.report { max-width: calc(var(--grid) * 38); margin: calc(var(--grid) * 1.5) 0 0; }

/* The phone version of the report */
.report__mobile { display: none; font-size: 14px; line-height: 1.45; }
.report__mobile p { margin: 0; }
.rm__kicker { font: 700 11px/1.2 var(--head); letter-spacing: 0.08em; text-transform: uppercase; color: var(--forest); }
.rm__title { font: 700 19px/1.25 var(--head); color: var(--forest); margin: 4px 0 10px !important; padding-bottom: 10px; border-bottom: 2px solid var(--forest); }
.rm__ask { display: inline-block; margin-bottom: 12px !important; padding: 4px 10px; border: 1.5px solid var(--forest); border-radius: 999px; font: 600 12.5px/1.3 var(--body); color: var(--forest); }
.report__mobile ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.report__mobile li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--line-major); border-radius: 10px; }
.report__mobile li b { font: 700 15px/1.25 var(--head); color: var(--forest); }
.report__mobile li p { grid-column: 1 / -1; color: var(--graphite); }
.report__mobile li em { font-style: normal; font-weight: 500; color: var(--forest); }
.pill { padding: 3px 9px; border-radius: 999px; background: var(--forest); color: #fff; font: 700 12px/1.3 var(--head); white-space: nowrap; }
.pill--dark { background: var(--charcoal); }
.pill--pale { background: var(--pale); color: var(--forest); }
.report__sheet {
  position: relative;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line-major);
  box-shadow: 0 1px 2px rgba(26, 32, 28, 0.06), 0 10px 30px rgba(26, 32, 28, 0.08);
  transform: rotate(-0.6deg);
}
.report__sheet::before, .report__sheet::after {
  content: "";
  position: absolute; top: -14px;
  width: 120px; height: 30px;
  background: rgba(239, 246, 223, 0.85);
  border: 1px solid rgba(149, 193, 62, 0.25);
}
.report__sheet::before { left: 8%; transform: rotate(-4deg); }
.report__sheet::after { right: 8%; transform: rotate(3deg); }
.ring {
  position: absolute;
  border: 2.5px solid var(--green);
  border-radius: 50%;
  transform: rotate(-4deg);
  box-shadow: 1px 1px 0 rgba(149, 193, 62, 0.5);
}
.report figcaption { display: flex; justify-content: space-between; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.report figcaption .hand { font-size: 18px; }
.report__note { margin-left: auto; margin-right: 4%; }

/* Pillars */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(var(--grid) * 2);
  margin-top: calc(var(--grid) * 2);
}
.card .fig { margin-bottom: calc(var(--grid) * 1.5); }
.card p:not(.eyebrow):not(.built) { margin: 0; color: var(--graphite); font-size: 16px; }
.cards__more { margin: calc(var(--grid) * 1.5) 0 0; font: 600 18px/1 var(--head); }
.cards__more a { color: var(--forest); }

/* Hard and game-changing: a band of slightly greener paper, the grid still showing through */
.band { margin-top: calc(var(--grid) * 2); background: rgba(149, 193, 62, 0.09); box-shadow: inset 0 1px 0 var(--line-major), inset 0 -1px 0 var(--line-major); }
.band .panel { padding-top: calc(var(--grid) * 2); padding-bottom: calc(var(--grid) * 2.5); }
.band .eyebrow { margin-bottom: 10px; }
.ticks { list-style: none; padding: 0; margin: 0 0 calc(var(--grid) * 1.5); }
.ticks li { position: relative; padding-left: 34px; margin-bottom: 12px; font-size: 18px; color: var(--graphite); }
.ticks li::before {
  content: "✓";
  position: absolute; left: 4px; top: -3px;
  font: 24px/1.2 var(--hand);
  color: var(--green-ink);
}
.help { display: flex; align-items: center; gap: 18px; font: 600 18px/1 var(--head); color: var(--forest); margin: 0; }

/* Footer */
.foot {
  display: flex; justify-content: space-between; align-items: center;
  height: calc(var(--grid) * 4);
  margin-top: 0;
  font-size: 14px; color: var(--muted);
}
.foot nav { display: flex; gap: 20px; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--forest); }

/* ---------- About ---------- */

.fig--field { margin: var(--grid) auto 0; }   /* .fig resets margin, so re-center the wrap */
.fig--field .art img { display: block; width: 100%; height: auto; }
.about__intro { padding-bottom: 0; }
.about__intro h1 { font-size: clamp(36px, 4.6vw, 56px); margin-bottom: 16px; }
.about__intro .lead { max-width: 40em; }
.cards--text { padding-top: calc(var(--grid) * 2); }
.cards--text .card h3 { margin-bottom: 10px; }
/* About: why "Mahalanobis" (the name story under the three claims) */
.about__name .lead { max-width: 46em; }
.fig--whiten { margin: calc(var(--grid) * 0.5) 0 calc(var(--grid) * 1.5); }
.fig--whiten .art img { display: block; width: 100%; height: auto; }
.about__name .cards { margin: calc(var(--grid) * 0.5) 0 calc(var(--grid) * 1.5); }
.about__name .card h3 { margin-bottom: 10px; }
.about__bridge { margin-bottom: 0; }
.about__close { margin-bottom: 0; }
@media (max-width: 640px) {
  .fig--whiten .hand { font-size: 13px; }
  .fig--whiten .hand.small { font-size: 12px; }
  .fig--whiten .eq { font-size: 18px; }
}
.cta { text-align: center; }
.cta h2 { margin-bottom: 12px; }
.cta .lead { margin: 0 auto calc(var(--grid) * 1.25); max-width: 30em; }
.cta__alt { margin: 18px 0 0; color: var(--muted); font-size: 16px; }
.cta__alt a { color: var(--forest); font-weight: 500; text-decoration: none; }
.cta__alt a:hover { text-decoration: underline; }

/* ---------- Sign in ---------- */

.login { display: grid; place-items: center; align-content: center; gap: 18px; min-height: calc(100vh - var(--grid) * 10); min-height: calc(100svh - var(--grid) * 10); }
.login__card {
  width: 100%; max-width: calc(var(--grid) * 18);
  padding: calc(var(--grid) * 1.5) calc(var(--grid) * 1.5) var(--grid);
  border: 1.5px solid var(--line-major); border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 12px 40px rgba(26, 32, 28, 0.08);
}
.login__card h1 { font-size: 30px; margin: 0 0 20px; }
.login__or { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.login__or::before, .login__or::after { content: ""; flex: 1; height: 1.5px; background: var(--line-major); }
.btn--outline { background: none; border: 1.5px solid var(--forest); color: var(--forest); padding: 12.5px 26px; }
.btn--outline:hover, .btn--outline:focus-visible { background: var(--pale); }
.login__wide { width: 100%; }
.login__alt { margin: 18px 0 0; text-align: center; font-size: 15px; }
.login__alt a, .login__help a { color: var(--forest); font-weight: 500; text-decoration: none; }
.login__alt a:hover, .login__help a:hover { text-decoration: underline; }
.login__help { margin: 0; color: var(--muted); font-size: 15px; }
.nav__links a[aria-current="page"] { color: var(--forest); }

/* ---------- Contact overlay ---------- */

.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; }
.overlay[hidden] { display: none; }
.overlay__backdrop { position: absolute; inset: 0; background: rgba(26, 32, 28, 0.45); }
.dialog {
  position: relative;
  width: 100%; max-width: 480px;
  max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 36px 32px 30px;
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 20px 60px rgba(26, 32, 28, 0.3);
  animation: rise 0.25s ease;
}
.dialog__close {
  position: absolute; top: 10px; right: 12px;
  border: 0; background: none;
  font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer;
}
.form h2 { font-size: 28px; margin-bottom: 8px; }
.form__intro { margin: 0 0 20px; color: var(--graphite); font-size: 15px; }
.form label { display: block; margin-bottom: 14px; }
.form label span { display: block; margin-bottom: 5px; font: 600 12px/1 var(--head); letter-spacing: 0.08em; text-transform: uppercase; color: var(--forest); }
.form label em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 400; }
.form input, .form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line-major); border-radius: 6px;
  background: #fff;
  font: 16px/1.4 var(--body); color: var(--charcoal);
}
.form textarea { resize: vertical; }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--forest); }
.form__error { min-height: 1.2em; margin: 0 0 8px; color: #b3261e; font-size: 14px; }
.form__submit { width: 100%; }
.form__submit:disabled { opacity: 0.6; cursor: default; }
.form__submit:disabled { cursor: progress; }
.dialog .eyebrow { margin-bottom: 6px; }
.form h2 + label { margin-top: 20px; }
.sent h2:focus { outline: none; }
.sent .form__intro b { color: var(--forest); font-weight: 500; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Narrow screens ---------- */

@media (max-width: 960px) {
  .hero, .split, .split--fig { grid-template-columns: 1fr; }
  .split { gap: var(--grid); }
  .fig--hero { justify-self: center; }
  .cards { grid-template-columns: 1fr; max-width: calc(var(--grid) * 25); }
  .split--fig .fig { order: 2; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav__links a:not(.nav__cta) { display: none; }
  .hero { padding-top: var(--grid); gap: calc(var(--grid) * 1.5); }
  .panel { padding-top: calc(var(--grid) * 2.5); }
  .lead { font-size: 18px; }
  .hand { font-size: 17px; }
  .hand.small { font-size: 16px; }
  .fig .eq { font-size: 20px; }
  .card .fig .eq { font-size: 19px; }
  /* phones swap the screenshot for the same report in HTML */
  .report__sheet:not(.report__mobile) { display: none; }
  .report__mobile { display: block; padding: 22px 16px 8px; }
  .report__sheet::before, .report__sheet::after { width: 70px; height: 20px; top: -10px; }
  .help { flex-direction: column; align-items: flex-start; }
  .cmd code { white-space: normal; overflow-wrap: anywhere; }
  .foot { flex-direction: column; justify-content: center; gap: 8px; }
}

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

/* ---------- Research ---------- */

.research h1, .post h1 { font-size: clamp(34px, 4.2vw, 50px); margin: 10px 0 14px; }
.research .lead { max-width: 36em; }
.posts { list-style: none; padding: 0; margin: calc(var(--grid) * 1.5) 0 0; display: grid; gap: calc(var(--grid) * 1.5); max-width: 44em; }
.post-item h2 { font-size: 26px; line-height: 1.2; margin: 4px 0 8px; }
.post-item h2 a { color: var(--forest); text-decoration: none; }
.post-item h2 a:hover { text-decoration: underline; }
.post-item p { margin: 0; color: var(--graphite); font-size: 17px; line-height: 1.5; }
.post-meta { margin: 0; font: 500 13px/1.4 var(--head); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.post-meta b { font-weight: 600; color: var(--forest); }
/* The index in two columns: posts (with the newsletter card after the newest) on the left, the AOT
   Library card (components/LibraryCard.astro) on the right, staying in view. One column on a phone. */
.research__cols { display: grid; grid-template-columns: minmax(0, 44em) minmax(0, 340px); justify-content: space-between; gap: calc(var(--grid) * 2); align-items: start; margin-top: calc(var(--grid) * 1.5); }
.research__main > .posts:first-child { margin-top: 0; }
.aot-ctas.aot-ctas--one { grid-template-columns: 1fr; } /* beats .aot-ctas, which comes later */
.research__side.aot-ctas { position: sticky; top: var(--grid); padding: calc(var(--grid) * 1.25); }
.research__side .aot-try h2 { font-size: 22px; line-height: 1.2; }
@media (max-width: 960px) {
  .research__cols { grid-template-columns: minmax(0, 1fr); }
  .research__side.aot-ctas { position: static; }
}
.research__feed { margin: var(--grid) 0 0; font-size: 14px; }
.research__feed a { color: var(--muted); }

.post > * { max-width: 44em; }
.post header { margin-bottom: calc(var(--grid) * 1.5); }
.post .eyebrow a { color: inherit; text-decoration: none; }
.post .summary { margin: 0 0 14px; font-size: 20px; line-height: 1.5; color: var(--graphite); }

.prose { font-size: 18px; line-height: 1.65; color: var(--charcoal); }
.prose h2 { font-size: 27px; margin: calc(var(--grid) * 1.5) 0 12px; }
.prose h3 { font-size: 21px; margin: 28px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: 0.35em; }
.prose a { color: var(--forest); }
.prose strong { color: var(--forest); }
.prose blockquote { margin: 0 0 1.2em; padding: 2px 0 2px 18px; border-left: 3px solid var(--green); color: var(--graphite); }
.prose code { font: 0.88em/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: rgba(34, 87, 52, 0.07); padding: 0.1em 0.35em; border-radius: 4px; }
.prose pre { margin: 0 0 1.4em; padding: 16px 18px; border: 1.5px solid var(--line-major); border-radius: 8px; overflow-x: auto; font-size: 14px; line-height: 1.55; background: #fff !important; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.table-wrap { overflow-x: auto; margin: 0 0 1.4em; }
.prose table { border-collapse: collapse; width: 100%; font-size: 16px; line-height: 1.4; }
.post .prose table { background: #fff; }   /* research posts: tables sit on white, not the grid (Jason, 2026-10-25) */
.prose th { font: 600 12.5px/1.3 var(--head); letter-spacing: 0.05em; text-transform: uppercase; color: var(--forest); text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--forest); }
.prose td { padding: 9px 12px; border-bottom: 1px solid var(--line-major); vertical-align: top; }
.prose tr:last-child td { border-bottom: 1.5px solid var(--line-major); }
.prose th[align="right"], .prose td[align="right"] { font-variant-numeric: tabular-nums; }
.chart { margin: var(--grid) 0 calc(var(--grid) * 1.5); }
.chart svg { display: block; width: 100%; height: auto; }
.chart figcaption { margin-top: 8px; white-space: normal; line-height: 1.35; }
.katex-display { margin: 1.2em 0; overflow-x: auto; overflow-y: hidden; }
.katex { font-size: 1.05em; }

/* "Keep reading": the posts either side of this one, above the Sources */
.prose .keep-reading { margin: calc(var(--grid) * 2) 0; }
.prose .keep-reading h2 { margin: 0 0 12px; }
.keep-reading__cards { display: grid; gap: calc(var(--grid) * .75); }
.read-card { display: grid; grid-template-columns: calc(var(--grid) * 7) 1fr; grid-template-rows: auto auto 1fr; column-gap: calc(var(--grid) * 1.25); row-gap: 6px; align-items: start; padding: var(--grid) calc(var(--grid) * 1.25); border: 1.5px solid var(--line-major); border-radius: 10px; background: #fff; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.read-card:hover { border-color: var(--forest); box-shadow: 0 4px 14px rgba(34, 87, 52, .12); }
.read-card__thumb { grid-row: 1 / 4; width: 100%; height: auto; }
.read-card > span { grid-column: 2; }
@media (max-width: 640px) { .read-card { grid-template-columns: 1fr; } .read-card__thumb { grid-row: auto; width: calc(var(--grid) * 6); } .read-card > span { grid-column: 1; } }
.prose a { overflow-wrap: anywhere; } /* long source URLs wrap instead of running off a phone screen */
.read-card__label { font: 600 12px/1.2 var(--head); letter-spacing: .08em; text-transform: uppercase; color: var(--green-ink); }
.read-card__title { font: 700 20px/1.25 var(--head); color: var(--forest); }
.read-card:hover .read-card__title { text-decoration: underline; }
.read-card__summary { font-size: 15px; line-height: 1.5; color: var(--graphite); }

.signup { max-width: 44em; margin-top: calc(var(--grid) * 2); padding: var(--grid) calc(var(--grid) * 1.25); border: 1.5px solid var(--line-major); border-radius: 10px; background: var(--paper); }
.signup h2 { font-size: 22px; margin: 0 0 6px; }
.signup p { margin: 0 0 14px; color: var(--graphite); font-size: 16px; }
.signup form { display: flex; gap: 10px; flex-wrap: wrap; }
.signup input { flex: 1 1 220px; padding: 11px 12px; border: 1.5px solid var(--line-major); border-radius: 6px; background: #fff; font: 16px/1.4 var(--body); color: var(--charcoal); }
.signup input:focus { outline: none; border-color: var(--forest); }
.signup .msg { margin: 10px 0 0; min-height: 1.2em; font-size: 14px; color: var(--forest); }
/* Pencil figures inside a post: the drawing, live labels centered on their anchors, a hand caption */
.prose .fig { margin: var(--grid) 0 calc(var(--grid) * 2); }
.prose .fig .art img { display: block; width: 100%; height: auto; }
.fig .art > .hand.c { transform: translate(-50%, -50%); text-align: center; white-space: nowrap; }
.prose .fig figcaption { margin-top: 10px; white-space: normal; line-height: 1.35; }
.prose .fig .hand.small { font-size: 15px; }
@media (max-width: 640px) {
  .prose .fig .hand.small { font-size: 10px; }
  .prose .fig .hand { font-size: 13px; }
}

/* Post figure at the top of a post, and its thumbnail on the index */
.fig--post { margin: 0 0 calc(var(--grid) * 1.5); }
.fig--post .art img { display: block; width: 100%; height: auto; }
.fig--post figcaption, .prose .fig figcaption { position: static; display: block; margin-top: 10px; white-space: normal; line-height: 1.35; }
.fig--post .hand.small { font-size: 15px; }
.post-item { display: grid; grid-template-columns: 1fr auto; gap: 8px calc(var(--grid) * 1.25); align-items: start; }
.post-item__thumb { display: block; width: calc(var(--grid) * 9); margin-top: 6px; }
.post-item__thumb img { display: block; width: 100%; height: auto; }

/* The speedbump: a subscribe card partway down a post. Only shown (and the rest of the post only
   blurred) while <html> carries "gated", which Site.astro sets before paint unless the reader has
   already subscribed or waved it off. No JS, no gate. */
.speedbump { display: none; position: relative; z-index: 1; margin: calc(var(--grid) * 1.5) 0 calc(var(--grid) * 2); padding: calc(var(--grid) * 1.25) calc(var(--grid) * 1.5); border: 1.5px solid var(--line-major); border-radius: 10px; background: #EEF4E4; box-shadow: 0 8px 28px rgba(34, 87, 52, 0.10); text-align: center; }
html.gated .speedbump { display: block; }
.speedbump h2 { font-size: 24px; margin: 0 0 6px; }
.speedbump p { margin: 0 0 16px; color: var(--graphite); font-size: 16px; line-height: 1.5; }
.speedbump form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; max-width: 30em; margin: 0 auto; }
.speedbump input { flex: 1 1 200px; padding: 11px 12px; border: 1.5px solid var(--line-major); border-radius: 6px; background: #fff; font: 16px/1.4 var(--body); color: var(--charcoal); }
.speedbump input:focus { outline: none; border-color: var(--forest); }
.speedbump .msg { margin: 10px 0 0; min-height: 1.2em; font-size: 14px; color: var(--forest); }
.speedbump__skip { display: inline-block; margin-top: 6px; border: 0; background: none; padding: 4px; font: 500 13px/1.4 var(--body); color: var(--muted); cursor: pointer; }
.speedbump__skip:hover { color: var(--forest); text-decoration: underline; }
.post__gated { transition: filter 0.5s ease; }
html.gated .post__gated { filter: blur(7px); max-height: 32em; overflow: hidden; pointer-events: none; user-select: none; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
html.gated .keep-reading, html.gated .post .signup { display: none; }
@media (max-width: 640px) {
  .fig--post .hand.small { font-size: 10px; }
  .post-item { grid-template-columns: 1fr; }
  .post-item__thumb { width: calc(var(--grid) * 6); order: -1; }
  .speedbump { padding: var(--grid); }
}

/* ---------- Optimizations (/aot/optimizations/) ---------- */

.opt-intro { max-width: 44em; color: var(--graphite); font-size: 17px; line-height: 1.6; }
.opt-intro p { margin: 0 0 1em; }
.opt-intro a, .opt a { color: var(--forest); }
.opt-filter { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: end; max-width: 44em; margin: var(--grid) 0 0; padding: 14px 16px; border: 1.5px solid var(--line-major); border-radius: 10px; background: #fff; }
.opt-filter label { display: grid; gap: 4px; font: 600 12px/1.3 var(--head); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.opt-filter select { min-width: 11em; padding: 7px 8px; border: 1.5px solid var(--line-major); border-radius: 6px; background: var(--paper); font: 15px/1.3 var(--body); color: var(--charcoal); }
.opt-count { margin: 0 0 6px auto; font-size: 14px; color: var(--muted); }
.opt-list { list-style: none; padding: 0; margin: calc(var(--grid) * 1.25) 0 0; display: grid; gap: calc(var(--grid) * 1.1); max-width: 44em; }
.opt-item h2 { font-size: 21px; line-height: 1.25; margin: 4px 0 6px; }
.opt-item h2 a { color: var(--forest); text-decoration: none; }
.opt-item h2 a:hover { text-decoration: underline; }
.opt-item > p:not(.post-meta):not(.opt-chips) { margin: 0 0 8px; color: var(--graphite); font-size: 16px; line-height: 1.5; }
.opt-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.chip { display: inline-block; padding: 2px 9px; border: 1.5px solid var(--line-major); border-radius: 999px; font: 500 12.5px/1.5 var(--body); color: var(--graphite); text-decoration: none; background: #fff; }
a.chip:hover { border-color: var(--forest); color: var(--forest); }
.chip--lever { background: var(--pale); border-color: #D7E7B8; }
.chip--domain { border-color: var(--forest); color: var(--forest); }
.opt-evidence { font-size: 13px; color: var(--muted); margin-left: 4px; }
.opt-tag { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: 4px; background: var(--forest); color: #fff; font: 600 11px/1.6 var(--head); letter-spacing: 0.05em; text-transform: uppercase; vertical-align: 2px; }
.opt-tag--soft { background: var(--line); color: var(--graphite); }
.opt-section { font-size: 22px; margin: calc(var(--grid) * 1.75) 0 0; }
.opt-browse { display: grid; grid-template-columns: repeat(auto-fit, minmax(16em, 1fr)); gap: var(--grid); max-width: 44em; margin-top: calc(var(--grid) * 2); padding-top: var(--grid); border-top: 1.5px solid var(--line-major); }
.opt-browse h2 { font-size: 18px; margin: 0 0 8px; }
.opt-browse ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 15px; }
.opt-browse span { color: var(--muted); font-size: 13px; }
.opt-entry header .opt-chips { margin-top: 12px; }
.opt-entry .summary { font-size: 20px; line-height: 1.5; color: var(--graphite); }
.opt-why, .opt-note, .opt-outline { color: var(--muted); font-size: 16px; }
.opt-evidence-list { list-style: none; padding: 0 !important; }
.opt-evidence-list li { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--green); background: #fff; border-radius: 0 8px 8px 0; }
.opt-evidence-list li.is-contradicts { border-left-color: #B5533C; }
.opt-evidence-list li.is-mixed { border-left-color: #C9A227; }
.opt-evidence-list p { margin: 0 0 4px !important; font-size: 16px; line-height: 1.5; }
.opt-ev-task { font-weight: 500; color: var(--charcoal); }
.opt-ev-source { font-size: 14px !important; color: var(--muted); }
.opt-ev-locator { font-style: italic; }
@media (max-width: 640px) {
  .opt-filter select { min-width: 0; width: 100%; }
  .opt-filter label { flex: 1 1 100%; }
  .opt-count { margin-left: 0; }
}
/* "Try it on your agent": a prompt to paste into a coding agent */
.try { max-width: 44em; margin: var(--grid) 0 calc(var(--grid) * 1.25); padding: 18px 20px; border: 1.5px solid var(--line-major); border-radius: 10px; background: #EEF4E4; }
.try h2 { font-size: 20px; margin: 0 0 4px; }
.try p { margin: 0 0 12px; color: var(--graphite); font-size: 15.5px; line-height: 1.5; }
.try__box { position: relative; }
.try__prompt { margin: 0; padding: 12px 14px; padding-right: 130px; border: 1.5px solid var(--line-major); border-radius: 8px; background: #fff; font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--charcoal); white-space: pre-wrap; word-break: break-word; }
.try__copy { position: absolute; top: 8px; right: 8px; }
/* The prompt shows two lines and an ellipsis; Copy prompt copies all of it. The line under the
   heading stays on one line. */
.try p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.try__box { padding: 12px 14px; padding-right: 156px; border: 1.5px solid var(--line-major); border-radius: 8px; background: #fff; }
.try__prompt { padding: 0; border: 0; border-radius: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
@media (max-width: 640px) {
  .try__prompt { padding-right: 14px; }
  .try__box { padding-right: 14px; }
  .try__copy { position: static; margin-top: 8px; }
}

/* ---------- Agent Optimization Library (/aot/optimizations/) ----------
   Its own header, a left rail of numbered categories, and each page on a solid panel: the grid
   stays in the margins and faintly behind the rail, never behind text. Type runs a size smaller
   than the rest of the site for density. */

.lib-body { font-size: 15px; }
.lib-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 56px; padding: 0 24px;
  background: rgba(249, 250, 249, 0.96); border-bottom: 1px solid var(--line-major);
}
.lib-brand { white-space: nowrap; } /* the site's own brand (.nav__brand), linking home */
.lib-head__links { display: flex; align-items: center; gap: 18px; min-width: 0; }
.lib-follow {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  padding: 6px 12px; border: 1px solid var(--line-major); border-radius: 999px; background: #fff;
  font: 500 13px/1.2 var(--body); color: var(--charcoal); text-decoration: none;
}
.lib-follow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-follow:hover { border-color: var(--forest); color: var(--forest); }

.lib { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 20px; max-width: 1440px; margin: 0 auto; padding: 0 24px; }
.lib-rail {
  position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow-y: auto;
  padding: 20px 10px 40px 0; font-size: 14px;
}
.lib-rail .lib-rail__mobile > summary { display: none; }
.lib-rail__list { list-style: none; margin: 0; padding: 0; }
.lib-rail__label { margin: 22px 8px 6px; font: 600 11px/1 var(--head); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.lib-rail a { display: flex; align-items: baseline; gap: 6px; padding: 6px 8px; border-radius: 6px; color: var(--charcoal); text-decoration: none; line-height: 1.3; background: rgba(249, 250, 249, 0.9); }
.lib-rail a:hover { color: var(--forest); background: #fff; }
.lib-rail a[aria-current="page"] { background: var(--pale); color: var(--forest); font-weight: 500; }
.lib-rail__top { font: 600 14px/1.3 var(--head); }
.lib-count { margin-left: auto; padding-left: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lib-rail__top span { margin-left: auto; font: 400 12px/1 var(--body); color: var(--muted); }
.lib-rail li > details > summary { display: flex; align-items: center; list-style: none; cursor: pointer; border-radius: 6px; }
.lib-rail summary::-webkit-details-marker { display: none; }
.lib-rail li > details > summary a { flex: 1; padding-left: 2px; background: none; font-weight: 500; }
.lib-rail li > details > summary .lib-count { padding-right: 8px; }
.lib-caret { flex: none; width: 18px; height: 26px; display: grid; place-items: center; }
.lib-caret::before { content: ""; width: 0; height: 0; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.15s; }
.lib-rail li > details[open] > summary .lib-caret::before { transform: rotate(90deg); }
.lib-rail li > details > ol { list-style: none; margin: 2px 0 6px 18px; padding: 0 0 0 6px; border-left: 1px solid var(--line-major); }
.lib-rail li > details > ol a { font-size: 13.5px; color: var(--graphite); }
.lib-rail li > details > ol a.is-empty { color: var(--muted); }
.lib-num { flex: none; margin-right: 6px; font: 600 0.86em/1 var(--head); color: var(--green-ink); font-variant-numeric: tabular-nums; }
.lib-rail .lib-num { min-width: 1.6em; margin-right: 0; }
.lib-rail__plain a { font-size: 13px; color: var(--muted); }

.lib-main { min-width: 0; padding: 20px 0 32px; }
.lib-page {
  padding: 32px 40px 40px; border: 1px solid var(--line-major); border-radius: 12px; background: #fff;
  box-shadow: 0 1px 2px rgba(26, 32, 28, 0.04);
}
.lib-page h1 { font-size: 32px; line-height: 1.15; letter-spacing: -0.015em; margin: 4px 0 10px; }
.lib-page h1 .lib-num { font-size: 0.7em; vertical-align: 0.15em; }
.lib-page .lead { font-size: 17px; line-height: 1.5; max-width: 42em; margin: 0 0 18px; }
.lib-crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.lib-crumbs a { color: var(--muted); text-decoration: none; }
.lib-crumbs a:hover { color: var(--forest); }
.lib-crumbs__id { margin-left: auto; font: 600 12px/1 var(--head); letter-spacing: 0.06em; color: var(--muted); }
.lib-page .opt-intro { max-width: 44em; font-size: 15px; line-height: 1.6; }
.lib-page .try { max-width: none; padding: 14px 16px; margin: 18px 0; }
.lib-page .opt-list + .try, .lib-page .opt-seealso + .try, .lib-page .opt-group + .try { margin-top: 28px; margin-bottom: 0; }
.lib-page .try h2 { font-size: 16px; }
.lib-page .try p { font-size: 14px; margin-bottom: 10px; }
.lib-page .try__prompt { font-size: 12.5px; }
.lib-page .signup { max-width: none; padding: 18px 20px; }
.lib-page .signup h2 { font-size: 18px; }
.lib-page .signup p { font-size: 14.5px; }

/* Filters */
.lib-page .opt-filter { display: grid; gap: 12px; max-width: none; margin: 24px 0 0; padding: 14px; border: 1px solid var(--line-major); border-radius: 10px; background: var(--paper); }
.opt-filter__search { position: relative; display: block; color: var(--muted); }
.opt-filter__search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
.opt-filter__search input { width: 100%; padding: 10px 12px 10px 36px; border: 1px solid var(--line-major); border-radius: 8px; background: #fff; font: 15px/1.3 var(--body); color: var(--charcoal); }
.opt-filter__search input:focus, .lib-page .opt-filter select:focus { outline: none; border-color: var(--forest); }
.opt-filter__row { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 18px; }
.lib-page .opt-filter label:not(.opt-filter__search), .opt-tags legend { display: grid; gap: 4px; font: 600 11px/1.3 var(--head); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.lib-page .opt-filter select { min-width: 10em; padding: 7px 8px; border: 1px solid var(--line-major); border-radius: 6px; background: #fff; font: 14px/1.3 var(--body); color: var(--charcoal); }
.opt-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: 0; }
.opt-tags legend { float: left; width: 100%; margin-bottom: 4px; padding: 0; }
.tag { padding: 6px 12px; border: 1px solid var(--line-major); border-radius: 999px; background: #fff; font: 500 13.5px/1.2 var(--body); color: var(--charcoal); cursor: pointer; }
.tag span { margin-left: 2px; color: var(--muted); font-size: 12px; }
.tag:hover { border-color: var(--forest); }
.tag[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: #fff; }
.tag[aria-pressed="true"] span { color: rgba(255, 255, 255, 0.75); }
.lib-page .opt-count { margin: 0; font-size: 13px; color: var(--muted); }
.opt-empty { margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.opt-empty button { padding: 0; border: 0; background: none; color: var(--forest); font: inherit; text-decoration: underline; cursor: pointer; }

/* Rows */
.lib-page .opt-list { display: block; max-width: none; margin: 14px 0 0; border-top: 1px solid var(--line-major); }
.lib-page .opt-item { display: grid; grid-template-columns: 3.6em minmax(0, 1fr) 250px; gap: 6px 20px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.lib-page .opt-list--outline .opt-item { grid-template-columns: 2.4em minmax(0, 1fr) 250px; }
/* The number sits quietly in a left gutter: just "ii." under its sub-category heading. */
.opt-item__num { padding-top: 2px; font: 500 12.5px/1.5 var(--head); color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.lib-page .opt-item[hidden] { display: none; }
.lib-page .opt-item h2 { margin: 0 0 4px; font: 600 16px/1.3 var(--head); letter-spacing: 0; }
.lib-page .opt-item h2 a { color: var(--charcoal); }
.lib-page .opt-item h2 a:hover { color: var(--forest); }
.lib-page .opt-item__main p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--graphite); }
.opt-item__meta { display: grid; align-content: start; gap: 6px; }
.opt-item__cat { display: flex; align-items: baseline; font-size: 12.5px; color: var(--graphite); text-decoration: none; }
.opt-item__cat:hover { color: var(--forest); }
.opt-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.badge { padding: 1px 7px; border-radius: 4px; font: 500 11.5px/1.6 var(--body); white-space: nowrap; }
.badge--improves { background: var(--pale); color: #3E6B12; }
.badge--degrades { background: #FBECEA; color: #9A3324; }
.badge--mixed { background: #FBF3DE; color: #7A5A0B; }
.opt-item__facts { margin: 0; font-size: 12px; color: var(--muted); }
.opt-tag--dev { background: #FBF3DE; color: #7A5A0B; margin-left: 8px; vertical-align: 1px; }
.opt-group { margin-top: 28px; }
.opt-group h2 { margin: 0; font-size: 19px; }
.opt-group h2 a { color: var(--forest); text-decoration: none; display: inline-flex; align-items: baseline; }
.opt-group h2 a:hover { text-decoration: underline; }
.opt-none { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.opt-group__summary { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.opt-seealso { margin: 24px 0 0; }
.opt-seealso--small { margin-top: 12px; }
.opt-seealso--small h3 { margin: 0; font: 600 12px/1.3 var(--head); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.lib-page .opt-seealso--small .opt-list { margin-top: 6px; }
.opt-alsofits a { color: var(--graphite); text-decoration: none; display: inline-flex; align-items: baseline; }
.opt-alsofits a:hover { color: var(--forest); text-decoration: underline; }
.opt-alsofits { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.lib-crumbs [aria-current="page"] { color: var(--charcoal); }
.lib-page .opt-section { font-size: 19px; margin-top: 28px; }
/* The overview in outline form: family, sub-category, entries. */
.opt-outline-list { margin-top: 8px; }
.opt-family { margin-top: 28px; }
.opt-family[hidden], .opt-sub[hidden] { display: none; }
.opt-family > h2 { margin: 0; padding-bottom: 8px; border-bottom: 1.5px solid var(--forest); font-size: 19px; }
.opt-family > h2 a, .opt-sub > h3 a { display: inline-flex; align-items: baseline; color: var(--forest); text-decoration: none; }
.opt-family > h2 a:hover, .opt-sub > h3 a:hover { text-decoration: underline; }
.opt-sub { margin-top: 14px; }
.opt-sub > h3 { margin: 0; font: 600 14px/1.3 var(--head); }
.opt-sub > h3 a { color: var(--graphite); }
.lib-page .opt-sub .opt-list { margin-top: 6px; }

/* An entry's page */
.lib-page.post > * { max-width: 46em; }
.lib-page.post header { margin-bottom: 16px; }
.lib-page .post-meta { font-size: 12px; }
.lib-page.post .summary { font-size: 17px; margin-bottom: 10px; }
.lib-page .prose { font-size: 15.5px; line-height: 1.65; }
.lib-page .prose h2 { font-size: 21px; margin: 28px 0 10px; }
.lib-page .opt-why, .lib-page .opt-note, .lib-page .opt-outline { font-size: 14px; }

@media (max-width: 860px) {
  .lib { grid-template-columns: 1fr; gap: 0; padding: 0 16px; }
  .lib-rail { position: static; max-height: none; padding: 12px 0 0; }
  .lib-rail .lib-rail__mobile > summary { display: block; padding: 10px 12px; border: 1px solid var(--line-major); border-radius: 8px; background: #fff; font: 600 14px/1.2 var(--head); color: var(--forest); cursor: pointer; }
  .lib-rail__mobile[open] > summary { margin-bottom: 8px; }
  .lib-main { padding-top: 12px; }
  .lib-page { padding: 22px 18px 28px; }
  .lib-page h1 { font-size: 26px; }
  .lib-page .opt-item, .lib-page .opt-list--outline .opt-item { grid-template-columns: 2.4em minmax(0, 1fr); }
  .lib-page .opt-item__meta { grid-column: 2; }
  .lib-head { padding: 0 16px; }
  .lib-follow span { max-width: 44vw; }
}
@media (max-width: 520px) {
  .lib-follow span { display: none; }
}

/* ---------- AOT (the product page, /aot/) ---------- */

.aot-hero { padding-top: calc(var(--grid) * 1.5); padding-bottom: calc(var(--grid) * 1.5); }
.aot-hero__copy { max-width: 36em; }
.aot-hero h1 { font-size: clamp(38px, 4.2vw, 54px); margin-bottom: 16px; }
.aot-hero .lead { margin-bottom: 0; }
/* The two ways in, side by side: two columns on one light panel */
.aot-ctas {
  display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--grid) * 2);
  padding: calc(var(--grid) * 1.5) calc(var(--grid) * 2);
  border-radius: 14px; background: rgba(149, 193, 62, 0.1); box-shadow: inset 0 0 0 1.5px var(--line-major);
}
.aot-try { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.aot-try h2 { font-size: 24px; margin: 0; }
.aot-try p { margin: 0; color: var(--graphite); font-size: 16px; line-height: 1.55; max-width: 30em; }
.aot-try__act { margin-top: 6px; }
/* pseudocode inside a drawing: live text, so it stays crisp */
.fig__code {
  position: absolute; margin: 0;
  font: 500 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--graphite); white-space: pre; tab-size: 4;
}
.fig__code b { font-weight: 500; color: var(--green-ink); }
.aot-how > .lead { margin-bottom: calc(var(--grid) * 2); }
.aot-step {
  display: grid; grid-template-columns: 6fr 5fr; gap: calc(var(--grid) * 2.5); align-items: center;
  padding: calc(var(--grid) * 2) 0;
  border-top: 1.5px solid var(--line-major);
}
.aot-step--flip .fig { order: 2; }
.aot-step > * { min-width: 0; }
.aot-step__num { margin: 0 0 4px; font-size: 64px; line-height: 1; filter: none; }
.aot-step h3 { font-size: 30px; margin-bottom: 12px; }
.aot-step__need { font-size: 19px; line-height: 1.5; color: var(--charcoal); margin: 0 0 18px; }
.aot-step p:not(.eyebrow):not(.built):not(.aot-step__need):not(.aot-step__num) { color: var(--graphite); font-size: 16px; margin: 0 0 12px; }
.aot-step__link a { color: var(--forest); font-weight: 500; }
.aot-close .eyebrow { line-height: 1.4; }
.aot-close .lead { max-width: 52em; }

/* The architecture diagram: five boxes in a 3x2 grid, arrows in the gaps, inside "your infrastructure" */
.aot-arch > .lead { margin-bottom: calc(var(--grid) * 1.5); }
.arch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 44px 1fr 44px 1fr;
  grid-template-rows: auto 40px auto;
  gap: 12px 0;
  padding: 44px 24px 24px;
  border: 1.5px solid var(--line-major); border-radius: 18px;
}
.arch__title { position: absolute; top: 14px; left: 24px; margin: 0; font: 700 12px/1 var(--head); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.arch__box {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
  min-height: 112px; padding: 18px 20px; text-align: center;
  border-radius: 14px; background: #E8EFEA; color: var(--forest);
}
.arch__box b { font: 700 21px/1.2 var(--head); }
.arch__box span { font-size: 15px; color: var(--muted); }
.arch__box em { font: 600 13.5px/1.3 var(--head); font-style: normal; color: var(--forest); margin-top: 2px; }
.arch__box--engine { background: var(--pale); border: 1.5px solid var(--green); }
.arch__box--plugin { background: var(--forest); color: #fff; }
.arch__box--plugin span { color: var(--green); }
.arch__box--plugin em { color: #fff; }
.arch__agents { grid-area: 1 / 1; } .arch__a1 { grid-area: 1 / 2; } .arch__obs { grid-area: 1 / 3; } .arch__a2 { grid-area: 1 / 4; } .arch__engine { grid-area: 1 / 5; }
.arch__a6 { grid-area: 2 / 1; } .arch__cicd { grid-area: 3 / 1; } .arch__a5 { grid-area: 3 / 2; } .arch__claude { grid-area: 3 / 3; } .arch__a3 { grid-area: 3 / 4; } .arch__a4 { grid-area: 2 / 5; } .arch__plugin { grid-area: 3 / 5; }
/* arrows: a bar with a triangle head, pointing right, left or up */
.arch__arrow { position: relative; }
.arch__arrow::before { content: ""; position: absolute; background: var(--green); }
.arch__arrow::after { content: ""; position: absolute; width: 0; height: 0; border: 10px solid transparent; }
.arch__a1::before, .arch__a2::before { left: 8px; right: 14px; top: 50%; height: 10px; transform: translateY(-50%); }
.arch__a1::after, .arch__a2::after { right: 2px; top: 50%; transform: translateY(-50%); border-left: 14px solid var(--green); border-right: 0; }
.arch__arrow--left::before { left: 14px; right: 8px; top: 50%; height: 10px; transform: translateY(-50%); }
.arch__arrow--left::after { left: 2px; top: 50%; transform: translateY(-50%); border-right: 14px solid var(--green); border-left: 0; }
.arch__arrow--up::before { left: 50%; top: 12px; bottom: 4px; width: 10px; transform: translateX(-50%); }
.arch__arrow--up::after { left: 50%; top: 0; transform: translateX(-50%); border-bottom: 14px solid var(--green); border-top: 0; }
.arch__principles { margin-top: calc(var(--grid) * 1.5); padding-bottom: 10px; border-bottom: 1.5px solid var(--line-major); }
.arch__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(var(--grid) * 1.5); }
.arch__list li { padding-left: 18px; border-left: 5px solid var(--green); font-size: 16px; line-height: 1.5; color: var(--graphite); }
.arch__list b { display: block; margin-bottom: 4px; font: 700 15px/1.3 var(--head); letter-spacing: 0.04em; text-transform: uppercase; color: var(--forest); }
@media (max-width: 860px) {
  .arch { display: flex; flex-direction: column; gap: 10px; padding-top: 48px; }
  .arch__arrow, .arch__arrow--left, .arch__arrow--up { display: none; }
  .arch__engine { order: 3; } .arch__plugin { order: 4; } .arch__claude { order: 5; } .arch__cicd { order: 6; }
  .arch__box { min-height: 0; }
  .arch__box:not(:first-of-type)::before { content: "↓"; display: block; margin-bottom: 4px; color: var(--green); font: 700 20px/1 var(--head); }
  .arch__list { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .aot-step, .aot-ctas { grid-template-columns: 1fr; gap: var(--grid); }
  .aot-ctas { padding: var(--grid) calc(var(--grid) * 1.25); gap: calc(var(--grid) * 1.25); }
  .aot-step--flip .fig { order: 0; }
  .aot-step .fig { margin-bottom: 8px; }
  .fig--aot-hero .hand { font-size: 16px; }
  .fig--aot-hero .hand.small { font-size: 13px; }
  .fig__code { font-size: 10px; }
}
@media (max-width: 640px) {
  .fig--aot .hand { font-size: 14px; }
  .fig--aot .hand.small { font-size: 13px; }
  .fig--aot .eq { font-size: 17px; }
  .fig--aot-hero .hand { font-size: 12px; }
  .fig--aot-hero .hand.small { font-size: 10px; }
  .fig__code { font-size: 6.5px; }
  .aot-step h3 { font-size: 24px; }
  .aot-step__num { font-size: 48px; }
}

/* The library's fill-in-the-blank search: one sentence, each blank a dimension every entry carries.
   A blank that's been filled in turns pale green; in the list, the dimensions it matched are marked
   the same way (.is-hit). */
.lib-page .madlib { display: block; padding: 16px 18px 12px; background: #fff; }
.madlib__line { margin: 0; font: 400 18px/2.15 var(--body); color: var(--charcoal); }
.lib-page .madlib select, .lib-page .madlib input {
  min-width: 0; max-width: 100%; margin: 0 1px; padding: 0 18px 0 4px; border: 0; border-bottom: 2px solid var(--green); border-radius: 3px 3px 0 0;
  background: transparent no-repeat right 4px center / 10px 6px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23225734' stroke-width='1.6'/%3E%3C/svg%3E");
  font: 600 18px/1.5 var(--body); color: var(--forest); cursor: pointer; appearance: none; -webkit-appearance: none;
}
.lib-page .madlib input { padding: 0 4px; background-image: none; cursor: text; min-width: 5em; }
.madlib input::placeholder { color: var(--forest); opacity: 0.55; }
.madlib input::-webkit-search-cancel-button { display: none; }
.lib-page .madlib select:hover, .lib-page .madlib input:hover { background-color: var(--pale); }
.lib-page .madlib select:focus-visible, .lib-page .madlib input:focus { outline: none; border-bottom-color: var(--forest); background-color: var(--pale); }
.lib-page .madlib .is-set { background-color: var(--pale); border-bottom-color: var(--forest); }
.madlib__ruler { position: absolute; visibility: hidden; white-space: pre; font: 600 18px/1.5 var(--body); }
.lib-page .madlib .opt-count { display: flex; gap: 12px; align-items: baseline; margin-top: 6px; }
.madlib__reset, .opt-empty button { padding: 0; border: 0; background: none; font: inherit; color: var(--forest); text-decoration: underline; cursor: pointer; }
.opt-item__facts span { border-radius: 3px; }
.opt-item .is-hit { background: var(--pale); color: var(--forest); box-shadow: 0 0 0 2px var(--pale); font-weight: 600; }
.opt-item .badge.is-hit { box-shadow: 0 0 0 1.5px var(--green); }
@media (max-width: 640px) {
  .madlib__line, .lib-page .madlib select, .lib-page .madlib input, .madlib__ruler { font-size: 16px; }
}
.madlib__end { white-space: nowrap; }

/* On the overview the prompt is a one-line strip and the search is an open sentence on the page,
   not a second card: the strip is a tool, the sentence is how you read the library. */
.lib-page .try--strip { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; margin: 14px 0 0; padding: 8px 8px 8px 14px; border: 1px solid var(--line-major); border-radius: 8px; background: var(--paper); }
.lib-page .try--strip h2 { margin: 0; font-size: 13px; white-space: nowrap; }
.lib-page .try--strip .try__box { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0; border: 0; background: none; }
.lib-page .try--strip .try__prompt { flex: 1; min-width: 0; padding: 0; border: 0; background: none; font-size: 12px; color: var(--muted); display: block; -webkit-line-clamp: unset; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-page .try--strip .try__copy { position: static; flex: none; }
.lib-page .madlib { margin: 36px 0 0; padding: 22px 0 0; border: 0; border-top: 1px solid var(--line-major); border-radius: 0; background: none; }
.madlib__label { margin: 0 0 4px; font: 600 11px/1.3 var(--head); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.lib-page .madlib .madlib__line { font-size: 22px; line-height: 2; }
.lib-page .madlib select, .lib-page .madlib input, .lib-page .madlib .madlib__ruler { font-size: 22px; }
.lib-page .madlib .opt-count { margin-top: 10px; }
@media (max-width: 640px) {
  .lib-page .try--strip { grid-template-columns: 1fr; gap: 6px; padding: 10px 12px; }
  .lib-page .madlib .madlib__line, .lib-page .madlib select, .lib-page .madlib input, .lib-page .madlib .madlib__ruler { font-size: 18px; }
}

/* The overview's intro: the copy on the left, the coding-agent prompt as a narrow card on the right. */
.lib-intro { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px; align-items: start; }
.lib-page .try--side { align-self: end; margin: 0; padding: 16px; display: grid; gap: 10px; }
.lib-page .try--side h2 { margin: 0; font-size: 15px; }
.lib-page .try--side p { margin: 0; font-size: 13px; line-height: 1.45; white-space: normal; }
.lib-page .try--side .try__box { display: grid; gap: 10px; padding: 12px; }
.lib-page .try--side .try__prompt { font-size: 11.5px; line-height: 1.5; -webkit-line-clamp: 7; line-clamp: 7; }
.lib-page .try--side .try__copy { position: static; width: 100%; }
@media (max-width: 1000px) {
  .lib-intro { grid-template-columns: 1fr; gap: 0; }
  .lib-page .try--side { margin-top: 16px; }
}

/* The library's numbers, under the intro: counted from the entries at build time. */
.lib-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 22px 0 0; border-top: 1px solid var(--line-major); border-left: 1px solid var(--line-major); }
.lib-stats > div { display: flex; flex-direction: column; padding: 12px 14px; border-right: 1px solid var(--line-major); border-bottom: 1px solid var(--line-major); }
.lib-stats dt { order: 2; font: 600 11px/1.3 var(--head); letter-spacing: 0.08em; text-transform: uppercase; color: var(--forest); }
.lib-stats dd { order: 1; margin: 0 0 4px; font: 700 30px/1 var(--head); letter-spacing: -0.02em; color: var(--forest); }
.lib-stats dd.lib-stats__note { order: 3; margin: 3px 0 0; font: 400 12px/1.35 var(--body); letter-spacing: 0; color: var(--muted); }
.lib-stats > div[title] { cursor: help; }
@media (max-width: 640px) {
  .lib-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lib-stats dd { font-size: 26px; }
}

/* The search gets the page's focus: a Forest panel, white sentence, Velocity Green blanks. */
.lib-page .madlib { margin: 32px 0 0; padding: 22px 28px 18px; border: 0; border-radius: 12px; background: var(--forest); color: #fff; box-shadow: 0 12px 32px rgba(34, 87, 52, 0.22); }
.lib-page .madlib .madlib__label { margin: 0 0 6px; font: 700 13px/1.3 var(--head); letter-spacing: 0.1em; color: var(--green); }
.lib-page .madlib .madlib__line { color: #fff; }
.lib-page .madlib select, .lib-page .madlib input {
  color: #fff; border-bottom-color: var(--green);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2395C13E' stroke-width='1.8'/%3E%3C/svg%3E");
}
.lib-page .madlib input { background-image: none; }
.lib-page .madlib option { color: var(--charcoal); background: #fff; }
.lib-page .madlib input::placeholder { color: #fff; opacity: 0.5; }
.lib-page .madlib select:hover, .lib-page .madlib input:hover,
.lib-page .madlib select:focus-visible, .lib-page .madlib input:focus { background-color: rgba(255, 255, 255, 0.1); border-bottom-color: #fff; }
.lib-page .madlib .is-set { background-color: rgba(149, 193, 62, 0.22); border-bottom-color: var(--green); }
.lib-page .madlib .opt-count { color: rgba(255, 255, 255, 0.75); }
.lib-page .madlib .madlib__reset { color: #fff; }
.lib-page .madlib + .opt-outline-list { margin-top: 28px; }
@media (max-width: 640px) {
  .lib-page .madlib { padding: 18px 16px 14px; }
}

/* The coding-agent prompt as a small card in the library's left rail */
.lib-rail .try--rail { max-width: none; margin: 18px 0 0; padding: 12px; border-radius: 10px; background: #EEF4E4; border: 1.5px solid var(--line-major); display: grid; gap: 8px; }
.lib-rail .try--rail h2 { margin: 0; font-size: 13.5px; line-height: 1.25; color: var(--forest); }
.lib-rail .try--rail p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--graphite); white-space: normal; }
.lib-rail .try--rail .try__box { padding: 0; border: 0; background: none; display: grid; gap: 8px; }
.lib-rail .try--rail .try__prompt { padding: 8px 10px 0; border: 0; border-bottom: 8px solid #fff; box-shadow: 0 0 0 1px var(--line-major); border-radius: 6px; background: #fff; font-size: 11.5px; line-height: 1.5; color: var(--graphite); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.lib-rail .try--rail .try__copy { position: static; width: 100%; }

/* ---------- The exit overlay (library pages: ExitOverlay.astro) ---------- */
dialog.exit { padding: 0; border: 0; background: none; max-width: calc(100vw - 32px); width: 560px; overflow: visible; }
dialog.exit::backdrop { background: rgba(26, 32, 28, 0.55); }
.exit__card { position: relative; padding: 40px 44px 30px; background: var(--paper); border: 1.5px solid var(--line-major); border-radius: 12px; box-shadow: 0 24px 60px rgba(26, 32, 28, 0.28); }
.exit__x { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.exit__x:hover, .exit__x:focus-visible { background: var(--pale); color: var(--forest); }
.exit .exit__hand { margin: 0 0 4px; font: 400 17px/1.2 var(--hand); color: var(--hand-green); }
.exit h2 { margin: 0 0 12px; font: 700 28px/1.2 var(--head); color: var(--charcoal); letter-spacing: -0.01em; }
.exit p { margin: 0 0 18px; font-size: 16px; line-height: 1.55; color: var(--graphite); }
.exit form { display: flex; gap: 10px; flex-wrap: wrap; }
.exit input { flex: 1 1 220px; min-width: 0; padding: 13px 14px; border: 1.5px solid var(--line-major); border-radius: 6px; background: #fff; font: 16px/1.3 var(--body); color: var(--charcoal); }
.exit input:focus { outline: none; border-color: var(--forest); }
.exit .msg { margin: 8px 0 0; min-height: 1.4em; font-size: 14px; color: var(--forest); }
.exit__foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.exit__no { margin-left: auto; min-height: 44px; padding: 0 4px; border: 0; background: none; font: 400 14px var(--body); color: var(--forest); text-decoration: underline; cursor: pointer; }
.exit__done svg { display: block; margin-bottom: 14px; }
.exit__done .btn { margin-top: 4px; }
dialog.exit[open] .exit__card { animation: exit-in 0.22s ease-out; }
dialog.exit[open]::backdrop { animation: exit-fade 0.22s ease-out; }
@keyframes exit-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes exit-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog.exit[open] .exit__card, dialog.exit[open]::backdrop { animation: none; } }
@media (max-width: 560px) { .exit__card { padding: 34px 22px 22px; } .exit h2 { font-size: 24px; } }
