/* Resources: list page + single-resource template (v2) */

/*
  .content (style.css) is a 2-column grid (1fr 340px) built for pages
  with a sidebar. Resource pages have no aside and behaved unpredictably
  under that grid (auto-placed items, inconsistent shrink-to-fit widths),
  so they opt out of it entirely with .content--single.
*/
.content.content--single {
  display: block;
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding-block: 24px 48px;
}

/* Topic filter reuses the portfolio's segmented control for consistency */
.resources-filter {
  margin: 24px 0 0;
}
.resource-card.is-hidden {
  display: none;
}

.resource-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.resource-card--soon {
  opacity: 0.65;
}
.resource-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.resource-card__type {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.resource-card__title {
  font-size: 1.25rem;
  margin: 0;
}
.resource-card__title a {
  color: var(--text);
}
.resource-card__title a:hover {
  color: var(--accent);
}
.resource-card code {
  background: var(--secondary-bg);
  padding: 0.1em 0.4em;
  border-radius: 6px;
  font-size: 0.9em;
}

.pill--free {
  background: var(--accent-elements);
  color: var(--accent);
  font-weight: 600;
  margin-left: 0;
}
.pill--soon {
  background: var(--secondary-bg);
  color: var(--muted);
  margin-left: 0;
}
.link-ghost--disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ---- Single resource page ---- */

.resource-hero {
  max-width: 760px;
}
.resource-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.resource-section {
  max-width: 760px;
  margin: 0;
  padding-block: 32px;
  border-top: 1px solid var(--border);
}
.resource-section:first-of-type {
  border-top: 0;
  padding-top: 8px;
}
.resource-section h2 {
  font-size: 1.4rem;
  margin-bottom: 12px;
}
.resource-section ul {
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.code-block {
  position: relative;
  background: #171717;
  color: #f2f0e9;
  border-radius: var(--radius-sm);
  padding: 18px 18px 16px;
  margin: 16px 0;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}
.code-block pre {
  margin: 0;
  white-space: pre;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
.code-block__label {
  position: absolute;
  top: 10px;
  left: 18px;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b9b6ac;
}
.code-block__copy {
  position: absolute;
  top: 10px;
  right: 10px;
  appearance: none;
  border: 1px solid #4a4948;
  background: #3a3938;
  color: #f2f0e9;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
}
.code-block__copy:hover {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.code-block pre {
  padding-top: 22px;
}

.pending-note {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  color: var(--muted);
  background: var(--secondary-bg);
}

.resource-download {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.resource-download .price {
  font-size: 0.95rem;
  color: var(--muted);
}
.resource-download .btn-pill:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
  filter: none;
}

.resource-author {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.resource-author img {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  object-fit: cover;
}

.resource-next {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

/* ---- Hook flow diagram ---- */

.hook-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0 24px;
  --i: 0;
}
.hook-flow__node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.9rem;
  font-weight: 600;
}
.hook-flow__node svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--muted);
}
.hook-flow__arrow {
  color: var(--muted);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.hook-flow__branch {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hook-flow__node--ok {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
  color: var(--ok);
}
.hook-flow__node--ok svg {
  color: var(--ok);
}
.hook-flow__node--block {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
  color: var(--warn);
}
.hook-flow__node--block svg {
  color: var(--warn);
}
@media (max-width: 640px) {
  .hook-flow {
    flex-direction: column;
    align-items: stretch;
  }
  .hook-flow__arrow {
    transform: rotate(90deg);
    align-self: center;
  }
}

/* ---- Hook cards (the five checks) ---- */

.hook-cards {
  display: grid;
  gap: 16px;
  margin: 20px 0;
}
.hook-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  background: var(--card);
}
.hook-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.hook-card__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-elements);
  color: var(--accent);
  flex-shrink: 0;
}
.hook-card__icon svg {
  width: 18px;
  height: 18px;
}
.hook-card h3 {
  margin: 0;
  font-size: 1.05rem;
}
.hook-card p {
  color: var(--muted);
  margin: 0 0 14px;
}

.hook-example {
  border-radius: 10px;
  background: #171717;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.82rem;
  overflow: hidden;
}
.hook-example__line {
  padding: 9px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.5;
  border-left: 3px solid transparent;
}
.hook-example__line--cmd {
  color: #f2f0e9;
}
.hook-example__line--cmd::before {
  content: "$";
  color: #6b6864;
  flex-shrink: 0;
}
.hook-example__line--block {
  color: #f2a88f;
  background: color-mix(in srgb, #d97757 12%, transparent);
  border-left-color: #d97757;
}
.hook-example__line--ok {
  color: #a8d9bb;
  background: color-mix(in srgb, #5d866c 14%, transparent);
  border-left-color: #5d866c;
}

/* ---- Live tester ---- */

.hook-tester {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 22px;
  background: var(--card);
  margin: 20px 0;
}
.hook-tester__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 640px) {
  .hook-tester__fields {
    grid-template-columns: 1fr;
  }
}
.hook-tester__field label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.hook-tester__field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
}
.hook-tester__field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.hook-tester__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.hook-tester__chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--secondary-bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
.hook-tester__chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.hook-tester__result {
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.9rem;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: transform 0.15s ease;
}
.hook-tester__result[hidden] {
  display: none;
}
.hook-tester__result svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}
.hook-tester__result--block {
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.hook-tester__result--ok {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
}
.hook-tester__result--empty {
  background: var(--secondary-bg);
  color: var(--muted);
  border: 1px solid var(--border);
}
@keyframes hookShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
.hook-tester__result--shake {
  animation: hookShake 0.4s ease;
}
@media (prefers-reduced-motion: reduce) {
  .hook-tester__result--shake {
    animation: none;
  }
}

/*
  Tool chip. The category filter says what a resource is about; this says
  what it needs to be useful. Claude Code pieces carry the accent so they
  are findable at a glance without a filter tab of their own.

  Deliberately a word, not a logo: another company's mark on a card of
  ours would imply an endorsement that does not exist.
*/
.resource-card__tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.resource-card__tool::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}
.resource-card__tool.tool--claude {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}
.resource-card__tool.tool--claude::before {
  opacity: 1;
  box-shadow: 0 0 6px currentColor;
}

/* The top row now carries three things, so it wraps rather than squeezes. */
.resource-card__top {
  flex-wrap: wrap;
  row-gap: 6px;
}

/* ==================================================================
   Courses
   ------------------------------------------------------------------
   The index is a shelf of course cards; opening one gives a
   curriculum on the left and the selected step on the right. A single
   long numbered list stopped working the moment a track had more than
   a handful of steps - and these will have many.
   ================================================================== */

.resources-intro {
  max-width: 66ch;
  margin: 0 0 clamp(26px, 4vw, 40px);
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

/* ---- The shelf --------------------------------------------------- */

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(16px, 2.4vw, 24px);
  padding-bottom: clamp(40px, 6vw, 72px);
}

.course-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: clamp(22px, 3vw, 30px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--card-text);
  text-decoration: none;
  transition: box-shadow 0.25s ease, transform 0.25s ease,
    border-color 0.25s ease;
}
.course-card:hover,
.course-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
}

.course-card__num {
  font-family: "Clash Grotesk", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 0.85;
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--accent) 42%, transparent);
}
.course-card__title {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  line-height: 1.15;
}
.course-card__blurb {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
}
.course-card .resource-card__tool {
  justify-self: start;
}

.course-card__foot {
  margin-top: 6px;
  display: grid;
  gap: 7px;
}
/* How much of the course actually exists yet, stated rather than implied. */
.course-bar {
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  overflow: hidden;
}
.course-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.course-card__meta {
  font-size: 0.8rem;
  color: var(--muted);
}
.course-card__cta {
  margin-top: 4px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
}

/* ---- Course page ------------------------------------------------- */

.course-back {
  display: inline-block;
  margin-bottom: clamp(18px, 3vw, 28px);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.course-back:hover {
  color: var(--accent);
}

.course-head {
  display: flex;
  align-items: flex-start;
  gap: clamp(14px, 2.4vw, 24px);
  padding-bottom: clamp(22px, 3.4vw, 34px);
  margin-bottom: clamp(22px, 3.4vw, 34px);
  border-bottom: 1px solid var(--border);
}
.course-head__num {
  flex-shrink: 0;
  font-family: "Clash Grotesk", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 0.82;
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--accent) 42%, transparent);
}
.course-head__title {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  line-height: 1.1;
}
.course-head__blurb {
  margin: 0 0 12px;
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.6;
}

.course-layout {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
  padding-bottom: clamp(48px, 7vw, 90px);
}

.course-curriculum {
  position: sticky;
  top: calc(var(--header-h) + 24px);
}
.course-curriculum__head {
  margin: 0 0 10px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.lesson-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
.lesson-link {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
.lesson-link:hover {
  background: color-mix(in srgb, var(--text) 4%, transparent);
}
.lesson-link[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.lesson-link__n {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}
/* A step with a resource behind it is the one you can act on today. */
.lesson-link.is-ready .lesson-link__n {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.lesson-link:not(.is-ready) .lesson-link__t {
  color: color-mix(in srgb, var(--text) 70%, transparent);
}

/* ---- The detail pane --------------------------------------------- */

.course-detail {
  min-width: 0;
}
.lesson-panel {
  min-width: 0;
  padding: clamp(20px, 3vw, 32px);
  border-radius: var(--radius, 18px);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
}
/*
  Without JS every panel stays visible, so the page is still the full
  curriculum with all its text. The script adds .is-enhanced before it
  hides anything.
*/
.course-layout:not(.is-enhanced) .lesson-panel + .lesson-panel {
  margin-top: 14px;
}
.lesson-panel__kicker {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.lesson-panel__title {
  margin: 0 0 12px;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  line-height: 1.2;
}
.lesson-panel__desc {
  margin: 0;
  max-width: 66ch;
  color: var(--muted);
  line-height: 1.65;
}

.lesson-panel__empty {
  margin: 0 0 10px;
}
.lesson-panel__emptynote {
  margin: 0;
  max-width: 58ch;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}
.track-step__soon {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px dashed var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .course-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .course-curriculum {
    position: static;
  }
}
@media (max-width: 560px) {
  .course-head {
    flex-direction: column;
    gap: 10px;
  }
}

/*
  A course page has no hero, so nothing is standing between the fixed
  header and the first line of content - the back link was landing
  underneath it.
*/
.content--course {
  padding-top: calc(var(--header-h) + clamp(2.5rem, 5vw, 4rem));
}

/*
  The panel holds the resource itself now, not a link to it, so it needs to
  read as an article: a lead-in, then the piece. The heading and description
  sit above a rule, and everything below is the resource as written.
*/
.lesson-panel__desc {
  padding-bottom: clamp(18px, 2.6vw, 26px);
  border-bottom: 1px solid var(--border);
}
.lesson-panel__lang {
  margin: 14px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
/* The article's own first section shouldn't add a second rule under that. */
.lesson-panel .resource-section:first-of-type {
  border-top: 0;
  padding-top: clamp(18px, 2.6vw, 26px);
}
.lesson-panel__empty {
  margin: clamp(18px, 2.6vw, 26px) 0 10px;
}
.lesson-panel__emptynote {
  margin: 0;
  max-width: 58ch;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

/*
  .resource-section caps at 760px, which is right for prose - a longer
  measure is harder to read, not easier. Code is the exception: it does
  not reflow, so a narrow column just means more horizontal scrolling
  through a script someone is trying to read. Inside a lesson panel the
  code blocks and diagrams take the full pane.
*/
.lesson-panel .resource-section > .code-block,
.lesson-panel .resource-section > .hook-flow {
  max-width: none;
  width: 100%;
}
.lesson-panel .resource-section {
  max-width: none;
}
/* The prose inside them keeps its measure, though. */
.lesson-panel .resource-section > p,
.lesson-panel .resource-section > ul,
.lesson-panel .resource-section > ol {
  max-width: 74ch;
}

/* ---- Get-the-files bar -------------------------------------------
   The download used to be one large pill in a section near the bottom.
   Someone who already knows what this resource is should not have to
   read the whole article to reach the file - so the same bar sits at
   the top too, and it is deliberately quiet: a small solid button, the
   other files as plain links beside it. It is a download, not the
   point of the page.
*/
.resource-getbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 clamp(22px, 3vw, 32px);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.resource-section .resource-getbar {
  margin-bottom: 0;
}

.getbar__main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-fg, #fff);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: filter 0.18s ease;
}
.getbar__main::before {
  content: "↓";
  font-weight: 700;
}
.getbar__main:hover {
  filter: brightness(1.07);
}

.getbar__file {
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
  transition: color 0.18s ease, border-color 0.18s ease;
}
.getbar__file:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.getbar__note {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 560px) {
  .getbar__note {
    margin-left: 0;
  }
}

/* ==================================================================
   Claude Code Hooks resource
   ------------------------------------------------------------------
   This page is also inlined into a course lesson panel, which is
   already a two-column layout. So the sticky split below is scoped to
   .content--single (the standalone page) - inside a lesson panel the
   class is gone and everything falls back to one column.
   ================================================================== */

/* ---- The flow diagram under the hero ---- */

.flowline {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 6px;
}
.flowline__step {
  flex: 1 1 130px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.flowline__step b {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.flowline__step span {
  display: block;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text);
}
.flowline__step code {
  font-size: 0.84em;
}
.flowline__step--hook {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.flowline__step--deny {
  border-color: color-mix(in srgb, #e5484d 50%, var(--border));
  background: color-mix(in srgb, #e5484d 10%, transparent);
}
.flowline__arrow {
  align-self: center;
  color: color-mix(in srgb, var(--accent) 75%, transparent);
  font-size: 1.1rem;
  flex: 0 0 auto;
}
@media (max-width: 720px) {
  .flowline {
    flex-direction: column;
  }
  .flowline__arrow {
    transform: rotate(90deg);
    align-self: flex-start;
    margin-left: 18px;
  }
}

/* ---- Prose left / sticky diagram right (standalone page only) ---- */

.content--single .hooks-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  gap: clamp(20px, 3vw, 44px);
  align-items: start;
}
.content--single .hooks-split__aside {
  position: sticky;
  top: calc(var(--header-h) + 18px);
}
.hooks-split__step {
  padding: 18px 0 22px;
  border-top: 1px solid var(--border);
}
.hooks-split__step:first-child {
  border-top: 0;
}
.hooks-split__step h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.hooks-split__step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
@media (max-width: 900px) {
  .content--single .hooks-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .content--single .hooks-split__aside {
    position: static;
  }
}

/* The stack the sticky panel shows: one row per stage, lit as you scroll */
.anatomy {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
}
.anatomy__row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  opacity: 0.4;
  transition: opacity 0.25s ease, background-color 0.25s ease;
}
.anatomy__row:first-child {
  border-top: 0;
}
.anatomy__row.is-on {
  opacity: 1;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.anatomy__k {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 3px;
}
.anatomy__v {
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
}
.anatomy__v small {
  display: block;
  margin-top: 4px;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---- Lifecycle timeline ---- */

.life {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px;
}
.life__node {
  flex: 0 0 auto;
  min-width: 118px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text);
}
.life__node small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
}
.life__node--evt {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
}
.life__node--end {
  border-style: dashed;
}

/* ---- The "Claude wants to" simulator ---- */

.sim {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  padding: clamp(14px, 2.4vw, 22px);
}
.sim__legend {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.sim__opts {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.sim__opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  color: var(--text);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
.sim__opt:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.sim__opt input {
  accent-color: var(--accent);
  flex-shrink: 0;
}
.sim__opt:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.sim__tape {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}
.sim__line {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  font-size: 0.85rem;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(6px);
  animation: simIn 0.32s ease forwards;
}
@keyframes simIn {
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sim__line {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
.sim__who {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 3px;
}
.sim__what {
  min-width: 0;
  color: var(--text);
  word-break: break-word;
}
.sim__what code {
  font-size: 0.86em;
}
.sim__line--deny {
  border-color: color-mix(in srgb, #e5484d 50%, var(--border));
  background: color-mix(in srgb, #e5484d 10%, transparent);
}
.sim__line--deny .sim__who {
  color: #e5484d;
}
.sim__line--allow {
  border-color: color-mix(in srgb, var(--ok, #30a46c) 45%, var(--border));
  background: color-mix(in srgb, var(--ok, #30a46c) 10%, transparent);
}
@media (max-width: 560px) {
  .sim__line {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}

/* ---- Category grid ---- */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.cat {
  padding: 14px 16px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.cat b {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.cat p {
  margin: 0 0 8px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
}
.cat span {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  color: var(--muted);
}

/* ---- Two-up comparison ---- */

.vs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}
.vs__col {
  padding: 16px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.vs__col h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}
.vs__col > p {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}
.vs__col ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--text);
}

/* ---- Callout ---- */

.callout {
  margin: 16px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.callout p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
}
.callout p + p {
  margin-top: 8px;
}

/* ---- Event reference table ---- */

.evt-wrap {
  overflow-x: auto;
}
.evt {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.evt th,
.evt td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.evt th {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.evt td:first-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent);
  white-space: nowrap;
}
.evt td:last-child {
  color: var(--muted);
}

.verified {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

details.more {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
details.more > summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
details.more[open] > summary {
  margin-bottom: 10px;
}
details.more p {
  margin: 0 0 8px;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--muted);
}
.evt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.evt-chips code {
  font-size: 0.76rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--text);
}

/* The anatomy walkthrough is two columns, so it needs more than the
   760px measure the prose sections use. Only on the standalone page -
   inside a lesson panel it is single-column anyway. */
.content--single .resource-section--wide {
  max-width: 1040px;
}

/*
  A long unbroken path in inline code (".claude/commands/frontend/component.md")
  has nowhere to break, so on a phone it pushed the whole page sideways.
  Block code is exempt: it lives in a scrollable .code-block and should keep
  its formatting rather than reflow.
*/
.resource-section code,
.lesson-panel code,
.evt code,
.cat span code {
  overflow-wrap: anywhere;
}
.code-block code {
  overflow-wrap: normal;
}
