/* The public site's whole design, from the approved final mockup (Designs/redesign/9-final) with Roger's
   changes in docs/REDESIGN-BUILD.md. The editor's canvas loads this same file, so:
   - every rule is scoped under the .site wrapper, and
   - layout follows the wrapper's width through container queries, never the window's, so the canvas can
     show Phone, Tablet, and Desktop at any window size. Phone is the base; 700px and 1100px step up.
   Rules this file keeps:
   - The logo is only ever an <img> of /logo.png or the small logo, whole, on a white disc. No filter,
     blend, opacity, mask, clip, or transform touches it or its ancestors, apart from today's one spin.
   - Nothing colors a header photo unless the page turns an effect on. The only thing over a full-width
     photo by default is a neutral black shade behind the words, so they stay readable. */

/* ---------- Tokens: light, then dark (the visitor's system, or a forced theme in the canvas) ---------- */
:root, .site[data-theme="light"] {
  /* The logo's colors, for accents only */
  --red: #b5312f;
  --blue: #2a5d84;
  --yellow: #e9b02a;
  --yellow-lit: #f0c04a;

  /* The stage: the dark header and footer, the same in both themes */
  --stage: #0c0f13;
  --stage-2: #13181f;
  --stage-3: #1b222b;
  --stage-line: #2a323d;
  --on-stage: #f4f2ee;
  --on-stage-2: #c5cbd2;
  --on-stage-3: #9aa3ae;
  --shade: 8, 9, 11;

  /* The reading surface */
  --paper: #f6f4ef;
  --paper-2: #ece8df;
  --card: #ffffff;
  --line: #dcd7cc;
  --ink: #15181c;
  --ink-2: #414952;
  --ink-3: #5a626c;
  --link: #1b587c;
  --link-hover: #b5312f;
  --blue-ink: #2a5d84;
  --note-bg: #e9eff4;
  --note-line: #d0dbe5;
  --code-bg: #efece5;
  --head-edge: transparent;

  /* The logo always sits on a white disc, in both themes */
  --disc: #ffffff;

  --cond: 'Open Sans Condensed', 'Arial Narrow', sans-serif;
  --sans: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Sizes. The bar and badge grow with the wrapper (see the container queries below). */
  --max: 1200px;
  --gutter: clamp(16px, 4cqi, 56px);
  --gl: max(var(--gutter), env(safe-area-inset-left, 0px));
  --gr: max(var(--gutter), env(safe-area-inset-right, 0px));
  --bar-h: 56px;
  --corner: 6px;
  /* The Home badge: whole pixels with even margins, so the logo lands on exact pixels */
  --badge: 88px;
  --badge-logo: 66px;

  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111519;
    --paper-2: #181d23;
    --card: #1a2028;
    --line: #2a323c;
    --ink: #ecebe7;
    --ink-2: #c0c7cf;
    --ink-3: #9ca5af;
    --link: #8bbce3;
    --link-hover: #f2998f;
    --blue-ink: #8bbce3;
    --note-bg: #16212b;
    --note-line: #273a4b;
    --code-bg: #1a2028;
    --head-edge: #232a33;
    color-scheme: dark;
  }
}
:root[data-theme="dark"], .site[data-theme="dark"] {
  --paper: #111519;
  --paper-2: #181d23;
  --card: #1a2028;
  --line: #2a323c;
  --ink: #ecebe7;
  --ink-2: #c0c7cf;
  --ink-3: #9ca5af;
  --link: #8bbce3;
  --link-hover: #f2998f;
  --blue-ink: #8bbce3;
  --note-bg: #16212b;
  --note-line: #273a4b;
  --code-bg: #1a2028;
  --head-edge: #232a33;
  color-scheme: dark;
}
@container site (min-width: 700px) {
  .site > * { --bar-h: 64px; --badge: 100px; --badge-logo: 76px; }
}
@container site (min-width: 1100px) {
  .site > * { --badge: 112px; --badge-logo: 84px; }
}

/* ---------- The page around the site: dark beyond the top and bottom edges, like the header and footer ---------- */
html:has(> body > .site) { background: var(--stage); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body:has(> .site) { margin: 0; background: var(--paper); }

/* ---------- Base ---------- */
.site {
  container: site / inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font: 400 16.5px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
.site *, .site *::before, .site *::after { box-sizing: border-box; }
.site img { max-width: 100%; height: auto; }
.site a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
.site a:hover { color: var(--link-hover); }
.site :focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 4px; }
.site h1, .site h2, .site h3 { line-height: 1.05; }
.site b, .site strong { font-weight: 600; }
.site time { font-variant-numeric: tabular-nums; }
.site [id] { scroll-margin-top: calc(var(--bar-h) + 16px); }
.site .arrow { font-weight: 400; }

.site .skip-link {
  position: absolute;
  z-index: 100;
  top: 8px;
  left: var(--gl);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--yellow);
  color: #15181c;
  font: 600 15px/1.2 var(--sans);
  text-decoration: none;
  transform: translateY(-300%);
}
.site .skip-link:focus { transform: none; color: #15181c; }

/* The original logo on a white disc. Only whole-pixel sizes; nothing filters, tints, or crops it. */
.site .disc {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--disc);
}
.site .disc img { display: block; width: 30px; height: 30px; max-width: none; }

/* ---------- Buttons ---------- */
.site .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45em;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font: 600 16px/1.2 var(--sans);
  text-align: center;
  text-decoration: none;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.site .btn:hover { transform: translateY(-1px); }
.site .btn-primary { background: var(--yellow); color: #15181c; }
.site .btn-primary:hover { background: var(--yellow-lit); color: #15181c; }
.site .btn-ghost-light { color: #ffffff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .85); }
.site .btn-ghost-light:hover { color: #ffffff; box-shadow: inset 0 0 0 1.5px var(--yellow-lit); }
.site .btn-ghost { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.site .btn-ghost:hover { color: var(--link-hover); box-shadow: inset 0 0 0 1.5px var(--link-hover); }

/* ---------- Profile icons (Home and the footer) ---------- */
.site .profiles { display: flex; flex-wrap: wrap; gap: 2px; margin: 0; padding: 0; list-style: none; }
.site .profile {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink-2);
  transition: background-color .15s ease, color .15s ease;
}
.site .profile:hover { color: var(--link-hover); background: var(--paper-2); }
.site .profile .icon { display: block; width: 20px; height: 20px; }

/* ---------- Getting home on a phone: the logo alone, on a soft blur, stays at the top ---------- */
.site .float-home {
  position: sticky;
  z-index: 60;
  top: max(8px, env(safe-area-inset-top, 0px));
  align-self: flex-start;
  display: block;
  width: 40px;
  height: 0;
  margin-left: var(--gl);
}
.site .float-home .disc { position: relative; box-shadow: 0 0 0 1px rgba(12, 15, 19, .08), 0 3px 12px rgba(12, 15, 19, .3); }
/* A slightly larger target than the disc, and the blur behind it */
.site .float-home .disc::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; }
.site .float-home::before {
  content: "";
  position: absolute;
  left: -14px;
  top: -14px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--paper) 55%, transparent) 55%, transparent);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  -webkit-mask: radial-gradient(closest-side, #000 55%, transparent);
  mask: radial-gradient(closest-side, #000 55%, transparent);
  pointer-events: none;
}
.site .float-home:hover .disc img { animation: rp-spin .9s ease-in-out; }

/* ---------- The bar: on a phone it sits in the header and scrolls away; wider, it stays ---------- */
.site .bar {
  position: relative;
  z-index: 50;
  flex: none;
  height: var(--bar-h);
  margin-top: env(safe-area-inset-top, 0px);
  margin-bottom: calc(-1 * var(--bar-h));
  color: #ffffff;
}
.site .bar-inner, .site .page-main, .site .foot-inner {
  width: 100%;
  max-width: calc(var(--max) + var(--gl) + var(--gr));
  margin-inline: auto;
  padding-left: var(--gl);
  padding-right: var(--gr);
}
.site .bar-inner { height: 100%; display: flex; align-items: center; gap: 12px; }
.site .bar-home { display: none; align-items: center; gap: 12px; min-height: 44px; color: inherit; text-decoration: none; }
.site .bar-home:hover { color: inherit; }
.site .bar-home:hover .disc img { animation: rp-spin .9s ease-in-out; }
.site .bar-name { font: 700 24px/1 var(--cond); letter-spacing: .01em; white-space: nowrap; text-shadow: 0 1px 8px rgba(0, 0, 0, .35); }
.site .bar-nav { display: flex; margin-left: auto; margin-right: -9px; }
.site .bar-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 9px;
  color: #ffffff;
  font: 600 15px/1 var(--sans);
  text-decoration: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .4);
}
.site .bar-nav a:hover { color: #ffffff; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .3em; }
.site .bar-nav a[aria-current]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  border-radius: 50%;
  background: var(--yellow-lit);
}
@container site (min-width: 700px) {
  .site .float-home { display: none; }
  .site .bar {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    background-color: var(--stage);
    box-shadow: 0 1px 0 var(--stage-line), 0 calc(-1 * env(safe-area-inset-top, 0px)) 0 0 var(--stage);
  }
  .site .bar-home { display: inline-flex; }
  .site .bar-nav { margin-right: -10px; }
  .site .bar-nav a { padding: 0 10px; }
}
/* Where the browser can tie it to scrolling, the bar is clear over the header and turns solid as the
   header leaves; on Home its logo waits until then, since the big badge is in view. Elsewhere it is
   simply solid. */
@supports (animation-timeline: view()) {
  .site { timeline-scope: --page-head; }
  .site .page-head { view-timeline: --page-head block; view-timeline-inset: var(--bar-h) 0px; }
  @container site (min-width: 700px) {
    .site .bar { animation: rp-bar-solid linear both; animation-timeline: --page-head; animation-range: exit 82% exit 100%; }
    .site[data-page="home"] .bar-home { animation: rp-bar-home linear both; animation-timeline: --page-head; animation-range: exit 82% exit 100%; }
  }
}
@keyframes rp-bar-solid {
  from { background-color: transparent; box-shadow: none; }
  to { background-color: var(--stage); box-shadow: 0 1px 0 var(--stage-line), 0 calc(-1 * env(safe-area-inset-top, 0px)) 0 0 var(--stage); }
}
@keyframes rp-bar-home {
  from { opacity: 0; visibility: hidden; }
  to { opacity: 1; visibility: visible; }
}

/* ---------- The header: full width, beside the title, or no photo ---------- */
.site .page-head {
  --side-l: max(var(--gl), (100% - var(--max)) / 2);
  --side-r: max(var(--gr), (100% - var(--max)) / 2);
  --head-gap: clamp(32px, 5cqi, 80px);
  --beside-w: clamp(260px, 34cqi, 460px);
  --head-h: 380px;
  position: relative;
  isolation: isolate;
  flex: none;
  display: grid;
  grid-template-columns: [full-start] var(--side-l) [main-start] minmax(0, 1fr) [gap-start] var(--head-gap) [photo-start] minmax(0, var(--beside-w)) [main-end] var(--side-r) [full-end];
  background: var(--stage);
  color: #ffffff;
  box-shadow: 0 1px 0 var(--head-edge);
}
.site .page-head-photo {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  background-color: var(--stage-3);
  background-position: 50% 50%;
  background-repeat: no-repeat;
  background-size: cover;
}
.site .page-head-photo::before, .site .page-head-photo::after { content: ""; display: none; position: absolute; inset: 0; pointer-events: none; }
.site .page-head-text { position: relative; z-index: 2; min-width: 0; }

/* Full width: the photo across the top, the words over its shaded lower edge */
.site .page-head[data-layout="full"] { grid-template-rows: minmax(var(--head-h), auto); }
.site .page-head[data-layout="full"] .page-head-photo { grid-column: full; grid-row: 1; }
.site .page-head[data-layout="full"] .page-head-text { grid-column: main; grid-row: 1; align-self: end; padding: calc(var(--bar-h) + 40px) 0 30px; }
/* A neutral shade for legibility only: black, no color, and lighter where nothing sits over the photo.
   The photo's own shade darkens its top (under the bar) and bottom; a second one rises behind the words,
   however many lines they take, and fades out above them. */
.site .page-head[data-layout="full"] .page-head-photo::after {
  display: block;
  z-index: 2;
  background:
    linear-gradient(0deg, rgba(var(--shade), .6) 0%, rgba(var(--shade), .3) 30%, rgba(var(--shade), 0) 55%),
    linear-gradient(180deg, rgba(var(--shade), .55) 0%, rgba(var(--shade), 0) 26%);
}
.site:not([data-page="home"]) .page-head[data-layout="full"] .page-head-text::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: calc(-1 * max(var(--gl), (100cqi - var(--max)) / 2));
  right: calc(-1 * max(var(--gr), (100cqi - var(--max)) / 2));
  background: linear-gradient(0deg, rgba(var(--shade), .64) 0%, rgba(var(--shade), .56) calc(100% - var(--bar-h) - 40px), rgba(var(--shade), 0) 100%);
  pointer-events: none;
}

/* Beside the title: the dark band with the photo framed next to the words; on a phone, above them */
.site .page-head[data-layout="beside"] { padding: calc(var(--bar-h) + 8px) 0 36px; }
.site .page-head[data-layout="beside"] .page-head-photo {
  grid-column: main;
  grid-row: 1;
  max-height: 420px;
  margin-bottom: 22px;
  aspect-ratio: var(--ar, 4 / 3);
  border-radius: var(--corner);
  box-shadow: 0 22px 56px rgba(0, 0, 0, .5);
}
.site .page-head[data-layout="beside"] .page-head-text { grid-column: main; grid-row: 2; }

/* No photo: the dark band alone */
.site .page-head[data-layout="none"] { padding: calc(var(--bar-h) + 28px) 0 36px; }
.site .page-head[data-layout="none"] .page-head-text { grid-column: main; grid-row: 1; }

@container site (min-width: 700px) {
  .site .page-head { --head-h: 420px; }
  .site .page-head[data-layout="full"] .page-head-text { padding-bottom: clamp(36px, 4.4cqi, 60px); }
  .site .page-head[data-layout="beside"] {
    align-items: center;
    padding: calc(var(--bar-h) + clamp(24px, 3.4cqi, 48px)) 0 clamp(36px, 4.6cqi, 64px);
  }
  .site .page-head[data-layout="beside"] .page-head-photo { grid-column: photo-start / main-end; grid-row: 1; max-height: 460px; margin-bottom: 0; }
  .site .page-head[data-layout="beside"] .page-head-text { grid-column: main-start / gap-start; grid-row: 1; }
  .site .page-head[data-layout="none"] { padding: calc(var(--bar-h) + clamp(28px, 4cqi, 56px)) 0 clamp(36px, 4.6cqi, 60px); }
}

/* Effects: optional, per page, on the photo only */
.site .page-head[data-tint="red"] { --tint: var(--red); }
.site .page-head[data-tint="blue"] { --tint: var(--blue); }
.site .page-head[data-tint="yellow"] { --tint: var(--yellow); }
/* Grain: the old site's own texture over the photo, as the old header had it */
.site .page-head[data-effect="grain"] .page-head-photo::before { display: block; z-index: 1; background: url('/templates/rp/noise.png'); opacity: .7; }
/* Tint: the photo's light and shade, in one of the logo's colors */
.site .page-head[data-effect="tint"] .page-head-photo::before { display: block; z-index: 1; background: var(--tint, var(--blue)); mix-blend-mode: color; opacity: .82; }
/* Darken: for a bright photo under white words */
.site .page-head[data-effect="darken"] .page-head-photo::before { display: block; z-index: 1; background: rgba(0, 0, 0, .46); }

/* The words in the header */
.site .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 12px;
  margin: 0 0 6px;
  font: 600 14.5px/1.3 var(--sans);
  color: var(--on-stage-2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6), 0 0 14px rgba(0, 0, 0, .5);
}
.site .post-meta > * { display: inline-flex; align-items: center; min-height: 44px; }
.site .post-meta > * + *::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  margin-right: 12px;
  border-radius: 50%;
  background: var(--on-stage-3);
}
.site .post-meta a { color: var(--yellow-lit); text-decoration: none; }
.site .post-meta a:hover { color: var(--yellow-lit); text-decoration: underline; }
.site .page-title {
  margin: 0;
  font: 700 clamp(34px, 10cqi, 42px)/1.04 var(--cond);
  letter-spacing: 0;
  text-wrap: balance;
  overflow-wrap: break-word;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .3);
}
@container site (min-width: 700px) {
  .site .page-title { font-size: clamp(40px, 5.2cqi, 64px); }
}

/* ---------- Home: the onstage header, the badge, the introduction, and the blog ---------- */
.site[data-page="home"] .page-head { --head-h: 560px; }
/* Same centering as the old header (cover, center). The old band was shorter, so wide
   screens scale the site photo up to keep that slice: logos and the speaker, not the ceiling. */
.site[data-page="home"] :where(.page-head-photo) { background-position: center center; }
/* Room for the badge under the buttons. As specific as the full-width header's own padding, so it wins. */
.site[data-page="home"] .page-head .page-head-text { padding-bottom: calc(var(--badge) / 2 + 14px); }
.site[data-page="home"] .page-head[data-layout="full"] .page-head-photo::after {
  background:
    linear-gradient(0deg, rgba(var(--shade), .94) 0%, rgba(var(--shade), .86) 44%, rgba(var(--shade), .5) 58%, rgba(var(--shade), 0) 72%),
    linear-gradient(180deg, rgba(var(--shade), .6) 0%, rgba(var(--shade), 0) 22%);
}
.site[data-page="home"] .page-head[data-layout="beside"],
.site[data-page="home"] .page-head[data-layout="none"] { padding-bottom: calc(var(--badge) / 2 + 24px); }
.site[data-page="home"] .page-title {
  font-size: min(14.6cqi, 60px);
  line-height: .92;
  white-space: nowrap;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .35);
}
.site .hero-line {
  margin: 18px 0 0;
  max-width: 25em;
  font: 400 17.5px/1.4 var(--sans);
  color: #e9ecef;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .35);
}
.site .hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.site .hero-actions .btn { min-height: 46px; padding: 0 14px; font-size: 14.5px; gap: .35em; }
@container site (min-width: 700px) {
  .site[data-page="home"] :where(.page-head-photo) { background-position: center center; }
  .site[data-page="home"] .page-head[data-layout="full"] .page-head-photo::after {
    background:
      linear-gradient(90deg, rgba(var(--shade), .82) 0%, rgba(var(--shade), .7) 46%, rgba(var(--shade), .2) 64%, rgba(var(--shade), 0) 74%),
      linear-gradient(0deg, rgba(var(--shade), .75) 0%, rgba(var(--shade), .3) 40%, rgba(var(--shade), 0) 60%),
      linear-gradient(180deg, rgba(var(--shade), .55) 0%, rgba(var(--shade), 0) 22%);
  }
  .site[data-page="home"] .page-head .page-head-text { padding-bottom: calc(var(--badge) / 2 + 18px); }
  .site[data-page="home"] .page-title { font-size: clamp(56px, 7.8cqi, 112px); }
  .site[data-page="home"] .page-head[data-layout="beside"] .page-title { font-size: clamp(48px, 6.2cqi, 96px); }
  .site .hero-line { margin-top: 20px; font-size: clamp(17.5px, 1.55cqi, 22px); }
  .site .hero-actions { gap: 10px; }
  .site .hero-actions .btn { min-height: 48px; padding: 0 22px; font-size: 16px; gap: .45em; }
  /* Until the wide layout, the photo is a short centered band, as the old header was
     (250px from 660px, 400px from 900px). The words sit under it. A tall frame
     cannot show that slice without cutting the speaker off. */
  .site[data-page="home"] .page-head[data-site-photo] { --home-photo-h: clamp(260px, 38cqi, 400px); }
  .site[data-page="home"] .page-head[data-site-photo] .page-head-photo {
    height: var(--home-photo-h);
    align-self: start;
    background-size: cover;
    background-position: center center;
  }
  .site[data-page="home"] .page-head[data-site-photo] .page-head-text { padding-top: calc(var(--home-photo-h) - 16px); }
  .site[data-page="home"] .page-head[data-site-photo] .page-head-photo::after {
    background:
      linear-gradient(0deg, rgba(var(--shade), 1), rgba(var(--shade), 0) 28%),
      linear-gradient(180deg, rgba(var(--shade), .55) 0%, rgba(var(--shade), 0) 22%);
  }
}
@container site (min-width: 1100px) {
  .site[data-page="home"] :where(.page-head-photo) { background-position: center center; }
  /* The old large header was 500px and centered. This one is 560px, so scale to that slice. */
  .site[data-page="home"] .page-head[data-site-photo] .page-head-photo {
    height: auto;
    align-self: stretch;
    background-size: max(100%, calc(100% * var(--head-h) / 500px)) auto;
    background-position: center center;
  }
  .site[data-page="home"] .page-head[data-site-photo] .page-head-text { padding-top: calc(var(--bar-h) + 40px); }
  .site[data-page="home"] .page-head[data-site-photo] .page-head-photo::after {
    background:
      linear-gradient(90deg, rgba(var(--shade), .9) 0%, rgba(var(--shade), .78) 30%, rgba(var(--shade), .4) 50%, rgba(var(--shade), 0) 64%),
      linear-gradient(0deg, rgba(var(--shade), .7) 0%, rgba(var(--shade), 0) 36%),
      linear-gradient(180deg, rgba(var(--shade), .55) 0%, rgba(var(--shade), 0) 24%);
  }
  /* Beside the badge, not over it, the buttons keep the full-width header's own spacing here. */
  .site[data-page="home"] .page-head .page-head-text { padding-bottom: clamp(36px, 4.4cqi, 60px); }
}

/* The default stage photo has the speaker at the right and low in the frame. On phones,
   covering the whole header puts his body behind the words, and moving the background
   vertically has no effect (the image already fits its height). Frame the photo above
   the words, cropping the empty ceiling. Custom photos retain their chosen positioning. */
@container site (max-width: 699px) {
  .site[data-page="home"] .page-head[data-site-photo] { --home-photo-h: clamp(340px, 90cqi, 480px); }
  .site[data-page="home"] .page-head[data-site-photo] .page-head-photo {
    height: var(--home-photo-h);
    align-self: start;
    background-size: auto calc(100% + 100px);
    background-position: 72% 100%;
  }
  .site[data-page="home"] .page-head[data-site-photo] .page-head-text { padding-top: calc(var(--home-photo-h) - 40px); }
  .site[data-page="home"] .page-head[data-site-photo] .page-head-photo::after {
    background:
      linear-gradient(0deg, rgba(var(--shade), 1), rgba(var(--shade), 0) 22%),
      linear-gradient(180deg, rgba(var(--shade), .72), rgba(var(--shade), .5) 48px, rgba(var(--shade), 0) 100px);
  }
}

/* The badge: today's place, on the header's bottom edge */
.site .seam { position: relative; z-index: 6; flex: none; height: 0; display: flex; justify-content: center; }
.site .badge {
  position: absolute;
  top: calc(var(--badge) / -2);
  display: grid;
  place-items: center;
  width: var(--badge);
  height: var(--badge);
  border-radius: 50%;
  background: var(--disc);
  box-shadow: 0 0 0 1px rgba(12, 15, 19, .06), 0 14px 34px -10px rgba(12, 15, 19, .55);
}
.site .badge img { display: block; width: var(--badge-logo); height: var(--badge-logo); max-width: none; animation: rp-spin 1s ease-in-out; }
.site .badge:hover img, .site .badge:active img { animation: rp-spin-again 1s ease-in-out; }
@keyframes rp-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rp-spin-again { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.site[data-page="home"] .page-main { padding-top: calc(var(--badge) / 2 + 22px); }
.site .home-intro { max-width: 40em; font-size: 17px; line-height: 1.6; overflow-wrap: break-word; }
.site .home-intro p { margin: 0 0 14px; }
/* The original Home page's HTML block, until its words move into Markdown */
.site .home-intro .inside > br:first-child, .site .home-intro > br { display: none; }
.site .home-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 18px 0 0; }
.site .home-links .btn { min-height: 44px; padding: 0 18px; font-size: 15px; }
/* The icons get a row of their own, their glyphs lined up with the buttons' edge */
.site .home-links .profiles { flex-basis: 100%; margin-left: -12px; }
.site .blog { padding-top: 44px; }
.site .blog-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 18px; margin-bottom: 12px; }
.site .section-title { margin: 0; font: 700 30px/1.1 var(--cond); letter-spacing: .005em; }
.site .section-intro { margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink-3); }
/* The introduction and the blog share the main column at every width, with Roger's selected projects
   down its right side: a slim column of discs below 1100px, a sidebar like a post's from there. */
.site .blog { max-width: 880px; }
.site[data-page="home"] .page-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: start;
}
.site[data-page="home"] .page-main > * { grid-column: 1; }
.site[data-page="home"] .page-main > .home-side { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; padding-top: 0; border-top: 0; }
@container site (min-width: 700px) {
  .site[data-page="home"] .page-main { column-gap: 28px; }
}
@container site (min-width: 1100px) {
  .site[data-page="home"] .page-main { grid-template-columns: minmax(0, 680px) minmax(0, 320px); justify-content: space-between; column-gap: 64px; }
}

/* ---------- The blog (Home and topic pages): each post's title, date, topics, and first paragraph ---------- */
.site .post-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.site .post-list li { border-bottom: 1px solid var(--line); }
.site .post-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 0;
  align-items: start;
  padding: 22px 0;
}
.site .post-entry-title { grid-column: 1; margin: 0; font: 300 26px/1.12 var(--cond); letter-spacing: 0; }
.site .post-entry-title a { color: var(--link); text-decoration: none; }
.site .post-entry-title a:hover { color: var(--link-hover); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .14em; }
.site .post-entry-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 6px; font-size: 13.5px; line-height: 1.4; color: var(--ink-3); }
.site .post-entry-meta a { color: inherit; text-decoration: none; }
.site .post-entry-meta a:hover { color: var(--link-hover); text-decoration: underline; }
.site .post-entry-excerpt { grid-column: 1 / -1; margin-top: 10px; font-size: 16.5px; line-height: 1.6; color: var(--ink-2); overflow-wrap: break-word; }
.site .post-entry-excerpt p { margin: 0 0 .6em; }
.site .post-entry-excerpt > :last-child { margin-bottom: 0; }
.site .post-entry-photo { grid-column: 2; grid-row: 1 / span 2; }
/* Each entry's photo sits beside it from 700px; on Home, from 1100px, since below that the column of
   project photos is beside the blog. */
.site .post-entry-photo { display: none; }
.site .post-entry .thumb { width: 150px; height: 100px; border-radius: 5px; }
.site .topic { white-space: nowrap; }
.site .topic::before {
  content: "";
  display: inline-block;
  width: .6em;
  height: .6em;
  margin-right: .45em;
  border-radius: 50%;
  background: var(--yellow);
  vertical-align: .02em;
}
.site .topic[data-color="blue"]::before { background: var(--blue-ink); }
.site .topic[data-color="red"]::before { background: var(--red); }
.site[data-page="topic"] .post-list { max-width: 880px; }
@container site (min-width: 700px) {
  .site .post-entry { padding: 28px 0; }
  .site .post-entry-title { font-size: 31px; }
  .site .post-entry-excerpt { grid-column: 1; font-size: 17px; }
  .site:not([data-page="home"]) .post-entry { column-gap: 32px; }
  .site:not([data-page="home"]) .post-entry-photo { display: block; grid-row: 1 / span 3; padding-top: 4px; }
}

/* ---------- The page below the header ---------- */
.site .page-main {
  flex: 1 0 auto;
  padding-top: clamp(32px, 4.6cqi, 60px);
  padding-bottom: clamp(56px, 7cqi, 96px);
}
.site .post { min-width: 0; max-width: 720px; }
.site[data-page="post"] .page-main { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 40px; align-items: start; }
.site .post-aside { min-width: 0; max-width: 720px; padding-top: 32px; border-top: 2px solid var(--ink); }
@container site (min-width: 1100px) {
  .site[data-page="post"] .page-main { grid-template-columns: minmax(0, 680px) minmax(0, 320px); justify-content: space-between; column-gap: 64px; }
  .site .post-aside { padding-top: 0; border-top: 0; }
}

/* The text of a post or page */
.site .post-content { font-size: 18px; line-height: 1.7; overflow-wrap: break-word; }
.site .post-content > :first-child { margin-top: 0; }
.site .post-content p { margin: 0 0 1.25em; }
.site .post-content h1 { margin: 1.4em 0 .5em; font: 700 40px/1.05 var(--cond); }
.site .post-content h2 { margin: 1.6em 0 .55em; font: 700 32px/1.1 var(--cond); }
.site .post-content h3 { margin: 1.5em 0 .5em; font: 700 25px/1.15 var(--cond); }
.site .post-content h4 { margin: 1.4em 0 .4em; font: 700 19px/1.3 var(--sans); }
.site .post-content ul, .site .post-content ol { margin: 0 0 1.25em; padding-left: 1.3em; }
.site .post-content li { margin-bottom: .35em; }
.site .post-content hr { margin: 2em 0; border: 0; border-top: 1px solid var(--line); }
.site .post-content blockquote { margin: 0 0 1.25em; padding-left: 1em; border-left: 3px solid var(--line); color: var(--ink-2); }
.site .post-content table { margin: 0 0 1.25em; border-collapse: collapse; font-size: .9em; }
.site .post-content th, .site .post-content td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.site .post-content p > img, .site .post-content > img { border-radius: var(--corner); }
.site .post-content iframe { display: block; max-width: 100%; margin: 0 0 1.25em; border: 0; border-radius: var(--corner); }
.site .post-content iframe[src*="youtube"] { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.site .post-content code { font: 400 .86em/1.5 var(--mono); padding: .08em .3em; border-radius: 4px; background: var(--code-bg); }
.site .post-content pre {
  margin: 0 0 1.25em;
  padding: 16px 18px;
  overflow-x: auto;
  border-radius: var(--corner);
  background: var(--code-bg);
  box-shadow: inset 0 0 0 1px var(--line);
  font: 400 13px/1.55 var(--mono);
  margin-inline: calc(-1 * var(--gl)) calc(-1 * var(--gr));
  border-radius: 0;
}
.site .post-content pre code { padding: 0; background: none; font-size: inherit; }
.site .post-content .highlight { margin: 0 0 1.25em; }
.site .post-content .highlight pre { margin-block: 0; }
@container site (min-width: 700px) {
  .site .post-content { font-size: 19px; line-height: 1.72; }
  .site .post-content pre { margin-inline: 0; border-radius: var(--corner); font-size: 14px; }
}
.site[data-page="notfound"] .page-head { --head-h: 240px; }
.site[data-page="notfound"] .post-content h1 { font-size: clamp(40px, 7cqi, 64px); }

/* Code colors in dark mode (the light ones are in content.css) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site:not([data-theme="light"]) .post-content :is(.pl-c) { color: #8b949e; }
  :root:not([data-theme="light"]) .site:not([data-theme="light"]) .post-content :is(.pl-c1, .pl-mh) { color: #79c0ff; }
  :root:not([data-theme="light"]) .site:not([data-theme="light"]) .post-content :is(.pl-e, .pl-en) { color: #d2a8ff; }
  :root:not([data-theme="light"]) .site:not([data-theme="light"]) .post-content :is(.pl-smi, .pl-mb, .pl-mi) { color: #c9d1d9; }
  :root:not([data-theme="light"]) .site:not([data-theme="light"]) .post-content :is(.pl-k) { color: #ff7b72; }
  :root:not([data-theme="light"]) .site:not([data-theme="light"]) .post-content :is(.pl-s, .pl-pds, .pl-sr) { color: #a5d6ff; }
  :root:not([data-theme="light"]) .site:not([data-theme="light"]) .post-content :is(.pl-ent, .pl-cce) { color: #7ee787; }
  :root:not([data-theme="light"]) .site:not([data-theme="light"]) .post-content .pl-mi1 { color: #aff5b4; background-color: #033a16; }
  :root:not([data-theme="light"]) .site:not([data-theme="light"]) .post-content .pl-md { color: #ffdcd7; background-color: #67060c; }
}
:is(:root[data-theme="dark"] .site:not([data-theme="light"]), .site[data-theme="dark"]) .post-content :is(.pl-c) { color: #8b949e; }
:is(:root[data-theme="dark"] .site:not([data-theme="light"]), .site[data-theme="dark"]) .post-content :is(.pl-c1, .pl-mh) { color: #79c0ff; }
:is(:root[data-theme="dark"] .site:not([data-theme="light"]), .site[data-theme="dark"]) .post-content :is(.pl-e, .pl-en) { color: #d2a8ff; }
:is(:root[data-theme="dark"] .site:not([data-theme="light"]), .site[data-theme="dark"]) .post-content :is(.pl-smi, .pl-mb, .pl-mi) { color: #c9d1d9; }
:is(:root[data-theme="dark"] .site:not([data-theme="light"]), .site[data-theme="dark"]) .post-content :is(.pl-k) { color: #ff7b72; }
:is(:root[data-theme="dark"] .site:not([data-theme="light"]), .site[data-theme="dark"]) .post-content :is(.pl-s, .pl-pds, .pl-sr) { color: #a5d6ff; }
:is(:root[data-theme="dark"] .site:not([data-theme="light"]), .site[data-theme="dark"]) .post-content :is(.pl-ent, .pl-cce) { color: #7ee787; }
:is(:root[data-theme="dark"] .site:not([data-theme="light"]), .site[data-theme="dark"]) .post-content .pl-mi1 { color: #aff5b4; background-color: #033a16; }
:is(:root[data-theme="dark"] .site:not([data-theme="light"]), .site[data-theme="dark"]) .post-content .pl-md { color: #ffdcd7; background-color: #67060c; }

/* ---------- A post's notes (the approved panel: blue-gray, a link-blue left edge) ---------- */
.site .post-notes {
  margin: 0 0 36px;
  padding: 4px 22px 4px 20px;
  background: var(--note-bg);
  border-left: 5px solid var(--link);
  border-radius: 0 var(--corner) var(--corner) 0;
  font-size: 16px;
  line-height: 1.55;
}
.site .post-note { padding: 12px 0 10px; }
.site .post-note + .post-note { border-top: 1px solid var(--note-line); }
.site .post-note-head { margin: 0 0 6px; font: 600 13.5px/1.3 var(--sans); color: var(--ink-3); }
.site .post-note-label { color: var(--link); letter-spacing: .1em; text-transform: uppercase; }
.site .post-note-label::after { content: "\00b7"; margin: 0 .45em; letter-spacing: 0; color: var(--ink-3); }
.site .post-note-body p { margin: 0 0 .5em; }
.site .post-note-body pre { overflow-x: auto; }
.site .post-note-newer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--note-line);
}
.site .post-note-head + .post-note-newer { margin-top: 2px; padding-top: 0; border-top: 0; }
.site .post-note-newer > span { color: var(--link); font-weight: 600; }
.site .post-note-newer a { font-weight: 600; }
.site .post-note-newer small { font-size: 13.5px; color: var(--ink-3); white-space: nowrap; }

/* ---------- Older and newer, ending every post ---------- */
.site .pager { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 44px; padding-top: 32px; border-top: 1px solid var(--line); }
.site .pager a {
  display: block;
  padding: 14px 18px 16px;
  border-radius: var(--corner);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  text-decoration: none;
}
.site .pager a:hover { box-shadow: inset 0 0 0 1.5px var(--link); }
.site .pager-newer { grid-row: 1; }
.site .pager-label { display: block; margin-bottom: 4px; font: 600 12.5px/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.site .pager-title { display: block; font: 700 22px/1.15 var(--cond); color: var(--link); }
.site .pager-date { display: block; margin-top: 4px; font-size: 13.5px; color: var(--ink-3); }
/* Each card leads with its post's photo, as link cards do (theme/content.css): a small square beside the
   words on phones, and from 700px across the top. A post without one shows the logo on a blank tile. */
.site .pager a { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 16px; align-content: center; min-height: 96px; padding: 0 16px 0 0; overflow: hidden; }
.site .pager a > :not(.pager-photo) { grid-column: 2; }
.site .pager-photo { grid-row: 1 / span 3; align-self: stretch; width: 96px; height: 100%; min-height: 96px; object-fit: cover; }
.site .pager-blank { display: grid; place-items: center; background: var(--paper-2); }
.site .pager-label { margin-top: 14px; }
.site .pager-date { margin-bottom: 14px; }
@container site (min-width: 700px) {
  .site .pager { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .site .pager-older { grid-column: 1; grid-row: 1; }
  .site .pager-newer { grid-column: 2; text-align: right; }
  .site .pager a { display: block; align-content: normal; min-height: 0; padding: 0 18px 16px; }
  .site .pager-photo { display: block; width: calc(100% + 36px); max-width: none; height: auto; min-height: 0; aspect-ratio: 16 / 9; margin: 0 -18px 14px; }
  .site .pager-blank { display: grid; }
  .site .pager-label { margin-top: 0; }
  .site .pager-date { margin-bottom: 0; }
}

/* ---------- Beside a post: its series, then related posts ---------- */
.site .post-aside > * + * { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.site .aside-title, .site .post-series-name { margin: 0 0 8px; font: 700 28px/1.1 var(--cond); letter-spacing: .005em; color: var(--ink); }
.site .post-series ol { position: relative; margin: 0; padding: 0; list-style: none; }
.site .post-series ol::before { content: ""; position: absolute; left: 9px; top: 22px; bottom: 22px; width: 2px; background: var(--line); }
.site .post-series li {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  column-gap: 14px;
  align-items: start;
  min-height: 44px;
  padding: 8px 0;
}
.site .post-series li::before {
  content: "";
  grid-column: 1;
  grid-row: 1 / span 2;
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 3px var(--blue-ink);
}
.site .post-series li > a, .site .post-series li > span { grid-column: 2; grid-row: 1; font: 600 15.5px/1.4 var(--sans); }
.site .post-series li > a { text-decoration: none; }
.site .post-series li > a::after { content: ""; position: absolute; inset: 0; }
.site .post-series li > a:hover { text-decoration: underline; }
.site .post-series li > span { color: var(--ink); }
.site .post-series small { grid-column: 2; grid-row: 2; font-size: 13.5px; color: var(--ink-3); }
.site .post-series li[aria-current]::before { background: var(--red); box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px rgba(181, 49, 47, .35); }

.site :is(.related, .projects) ol { margin: 0; padding: 0; list-style: none; }
.site :is(.related, .projects) a:not(.more-link) {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 60px;
  padding: 7px 0;
  color: var(--ink);
  text-decoration: none;
}
.site :is(.related, .projects) .thumb { width: 72px; height: 48px; border-radius: 4px; }
.site :is(.related, .projects) .related-text { display: grid; gap: 1px; min-width: 0; }
.site .related-title { font: 600 15px/1.35 var(--sans); color: var(--link); }
.site :is(.related, .projects) a:hover .related-title { color: var(--link-hover); text-decoration: underline; }
.site .related time { font-size: 13px; color: var(--ink-3); }

/* Selected projects: below 1100px only their photos show, in a slim column (the heading, names, and link
   stay for screen readers, and a name shows on pointing); from there, a list under a dark rule with each
   project's photo, name, and line. */
.site .projects .thumb { width: 60px; height: 40px; border-radius: 4px; }
.site .projects ol { display: grid; gap: 12px; }
.site .projects a:not(.more-link) { display: block; min-height: 0; padding: 0; }
.site .projects :is(.aside-title, .related-text, .more-link) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.site .project-line { font-size: 13.5px; line-height: 1.4; color: var(--ink-3); }
@container site (min-width: 700px) {
  .site .projects .thumb { width: 72px; height: 48px; }
  .site .projects ol { gap: 16px; }
}
@container site (min-width: 1100px) {
  .site .post-entry { column-gap: 32px; }
  .site .post-entry-photo { display: block; grid-row: 1 / span 3; padding-top: 4px; }
  .site .projects ol { display: block; padding: 0; border-top: 2px solid var(--ink); }
  .site .projects li { border-bottom: 1px solid var(--line); }
  .site .projects a:not(.more-link) { display: grid; grid-template-columns: 72px minmax(0, 1fr); min-height: 68px; padding: 10px 0; }
  .site .projects :is(.aside-title, .related-text, .more-link) { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; }
}
.site .more-link { display: inline-flex; align-items: center; gap: .4em; min-height: 44px; margin-top: 4px; font: 600 15px/1.2 var(--sans); text-decoration: none; }
.site .more-link:hover { text-decoration: underline; }

/* ---------- Contact: one card, each place a row. The last row has no line under it. ---------- */
.site .contact-card {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 28px 24px 8px;
  border-radius: var(--corner);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
}
.site .contact-id { display: flex; align-items: center; gap: 14px; min-height: 44px; color: var(--ink); text-decoration: none; }
.site .contact-id:hover { color: var(--ink); }
.site .contact-name { font: 700 22px/1 var(--cond); }
.site .contact-line { margin: 14px 0 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.site .contact-places { margin: 22px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.site .contact-places a {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  column-gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.site .contact-places li:last-child a { border-bottom: 0; }
.site .contact-places a:hover { color: var(--ink); }
.site .contact-places a:hover .contact-handle,
.site .contact-places a:hover .contact-go { color: var(--link-hover); }
.site .contact-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink-2);
}
.site .contact-mark .icon { width: 18px; height: 18px; }
.site .contact-mark img { display: block; width: 30px; height: 30px; }
.site .contact-who { display: grid; gap: 1px; min-width: 0; }
.site .contact-service { font-size: 13.5px; line-height: 1.3; color: var(--ink-3); }
.site .contact-handle { font: 600 17px/1.35 var(--sans); overflow-wrap: anywhere; }
.site .contact-go { color: var(--ink-3); }
@container site (min-width: 700px) {
  .site .contact-card { padding: 36px 40px 12px; }
}

/* ---------- The footer: modest ---------- */
.site .site-foot { flex: none; background: var(--stage-2); color: var(--on-stage); border-top: 1px solid var(--stage-line); }
.site .foot-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding-top: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}
.site .foot-id { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; margin-right: auto; color: var(--on-stage); text-decoration: none; font: 700 21px/1 var(--cond); }
.site .foot-id:hover { color: var(--on-stage); }
.site .foot-id:hover .disc img { animation: rp-spin .9s ease-in-out; }
.site .site-foot .profiles { margin-right: -12px; }
.site .site-foot .profile { color: var(--on-stage-2); }
.site .site-foot .profile:hover { color: var(--yellow-lit); background: var(--stage-3); }
.site .foot-note { flex-basis: 100%; margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--on-stage-3); }

@media (prefers-reduced-motion: reduce) {
  .site *, .site *::before, .site *::after { transition: none !important; }
  .site .badge img, .site .badge:hover img, .site .badge:active img,
  .site .bar-home:hover .disc img, .site .float-home:hover .disc img, .site .foot-id:hover .disc img { animation: none; }
}
