/* ==========================================================================
   layout.css — page shell, header, footer, sections
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--sp-4);
}
@media (min-width: 48rem) {
  .wrap { padding-inline: var(--sp-6); }
}

/* header ------------------------------------------------------------------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: var(--rule) solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

.bar__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-height: 2.75rem;
}

.bar__prompt {
  color: var(--fg-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar__prompt a { color: var(--fg-dim); }
.bar__prompt .caret { color: var(--accent); }

.bar__nav {
  margin-left: auto;
  display: flex;
  gap: var(--sp-4);
}
.bar__nav a { color: var(--fg-dim); }
.bar__nav a:hover { color: var(--accent); }
.bar__nav a[aria-current="page"] {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

/* With JS, the page links live in the menu and the bar carries the two
   controls instead. Without JS the links stay put — they are then the only
   navigation on the page, so they must never be hidden unconditionally. */
.js .bar__nav { display: none; }

.bar__tools {
  display: none;
  margin-left: auto;
  gap: var(--sp-4);
}
.js .bar__tools { display: flex; }

.bar__tools button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--fg-dim);
  cursor: pointer;
}
.bar__tools button:hover { color: var(--accent); }

/* the kbd chip inherits its box from base.css; it just needs to track the
   button's hover state so the pair reads as one control */
.bar__tools kbd {
  margin-right: 0.15em;
  color: var(--fg-mute);
}
.bar__tools button:hover kbd {
  color: var(--accent);
  border-color: var(--accent);
}

/* main --------------------------------------------------------------------- */
main { flex: 1 0 auto; }

.section {
  padding-block: var(--sp-7);
  border-bottom: var(--rule) solid var(--border);
}
.section:last-of-type { border-bottom: 0; }

.section__head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.section__title {
  font-family: var(--font-mono);
  font-size: var(--step-1);
  color: var(--fg-dim);
  font-weight: 700;
}
.section__title::before {
  content: "## ";
  color: var(--fg-mute);
}

.section__more {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  white-space: nowrap;
}

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--sp-4); }

.lede {
  font-size: var(--step-1);
  color: var(--fg-dim);
}

/* footer ------------------------------------------------------------------- */
.foot {
  border-top: var(--rule) solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--fg-mute);
  padding-block: var(--sp-5);
  margin-top: var(--sp-7);
}

.foot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
  align-items: center;
}
.foot__meta { margin-left: auto; }
.foot a { color: var(--fg-dim); }
.foot a:hover { color: var(--accent); }
