/* Secondary pages share the homepage palette, not its viewport-fit scaling. */
html:has(main.article-page, main.projects-page, main.not-found) {
  --background: #eeeade;
  --foreground: #233e91;
  --muted: #344879;
  --soft: #233e91;
  --subtle: #59617c;
  --line: #a5a4a8;
  --article-accent: #a04413;
  font-size: 16px;
  background: var(--background);
}
body:has(main.article-page, main.projects-page, main.not-found) { background: var(--background); isolation: isolate; font-size-adjust: none; letter-spacing: normal; }
.article-page { width: min(100% - 64px, 720px); }
.article-nav { padding-top: 36px; font: 375 14px/1.5 'Geist Mono', monospace; }
.article-nav a { color: var(--foreground); }
.article-header { padding: 64px 0 40px; }
.article-sidebar, .article-media-stage { display: contents; }
.article-title { display: flex; align-items: baseline; gap: .25em; font-size: clamp(72px, 7.97194vw, 125px); }
.article-header h1 { font: 700 1em/.90 Inter, sans-serif; letter-spacing: -.04em; max-width: none; font-size-adjust: none; }
.article-snoopy { display: block; width: 1.35em; height: 1.35em; min-width: 0; object-fit: contain; flex: 0 1 auto; }
.article-deck { margin: 24px 0 0; color: var(--foreground); font: 375 18px/1.5 'Geist Mono', monospace; }
.article-meta { margin-top: 16px; gap: 24px; }
.article-meta a { color: var(--article-accent); font: 375 14px/1.5 'Geist Mono', monospace; text-underline-offset: 3px; }
.article-page .article-example, .article-media-stage > .article-chart-switcher { max-width: 720px; margin-inline: auto; }
.article-example { padding-block: 28px; }
.article-body { padding-block: 48px 64px; }
.article-body section { max-width: 720px; margin-inline: auto; }
.article-body section + section { margin-top: 52px; }
.article-body h2 { font: 700 26px/1.25 Inter, sans-serif; letter-spacing: -.025em; font-size-adjust: none; color: var(--foreground); }
.article-body p { font-size: 17px; line-height: 1.75; color: var(--foreground); }
.article-body a { color: var(--article-accent); text-underline-offset: 3px; }
.article-body blockquote { max-width: none; border-left-color: var(--article-accent); }
.article-body blockquote p { color: var(--article-accent); font-size: 18px; }
.article-example figcaption, .article-dashboard figcaption, .article-chart-panel figcaption { font: 375 12px/1.6 'Geist Mono', monospace; color: var(--subtle); }
.article-chart-tabs { gap: 20px; }
.article-chart-tabs label { font: 375 13px/1.4 'Geist Mono', monospace; }
.article-chart-panel img, .article-diagram img { background: transparent; }
.article-log { font-family: 'Geist Mono', monospace; font-weight: 375; }
.article-page a:focus-visible { outline: 2px solid var(--article-accent); outline-offset: 4px; }
@media (max-width: 600px) {
  .article-page { width: calc(100% - 40px); }
  .article-nav { padding-top: 24px; }
  .article-header { padding: 40px 0 28px; }
  .article-title { font-size: min(94px, 18vw); }
  .article-header h1 { font-size: inherit; }
  .article-deck { margin-top: 20px; font-size: 16px; }
  .article-meta a { min-height: 44px; display: inline-flex; align-items: center; }
  .article-body { padding-block: 32px 40px; }
  .article-body h2 { font-size: 23px; }
  .article-body p { font-size: 16px; line-height: 1.7; }
  .article-body section + section { margin-top: 40px; }
}

.projects-page { width: min(100% - 64px, 720px); padding-bottom: 64px; }
.projects-header { padding: 36px 0 48px; }
.projects-header .text-arrow-link { margin-bottom: 64px; color: var(--foreground); font: 375 14px/1.5 'Geist Mono', monospace; }
.projects-title-line { display: flex; align-items: center; gap: .25em; }
.projects-header h1 { max-width: none; font: 700 clamp(72px, 7.97194vw, 125px)/.90 Inter, sans-serif; font-size-adjust: none; letter-spacing: -.04em; }
.projects-snoopy { width: 1.1em; height: .78em; object-fit: contain; flex: none; }
.projects-year-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
.projects-year-group + .projects-year-group { margin-top: 3.5rem; }
.projects-year-group > .section-heading { margin: 0; align-items: start; }
.projects-year-group > .section-heading h2 { font: 700 22px/1.3 Inter, sans-serif; color: var(--article-accent); letter-spacing: -.02em; }
.projects-row { gap: 20px; padding-block: 24px; }
.projects-entry h2 { font: 700 16px/1.4 'Geist Mono', monospace; letter-spacing: normal; }
.projects-entry p { margin-top: 6px; font: 375 13px/1.6 'Geist Mono', monospace; color: var(--muted); }
.projects-links { font: 375 13px/1.5 'Geist Mono', monospace; color: var(--article-accent); }
.projects-page a { text-underline-offset: 3px; }
.projects-page a:focus-visible { outline: 2px solid var(--article-accent); outline-offset: 4px; }
@media (max-width: 600px) {
  .projects-page { width: calc(100% - 40px); padding-bottom: 36px; }
  .projects-header { padding: 24px 0 32px; }
  .projects-header .text-arrow-link { margin-bottom: 40px; }
  .projects-header h1 { font-size: clamp(70px, 24vw, 94px); }
  .projects-year-group { grid-template-columns: 1fr; gap: 24px; }
  .projects-row { gap: 16px; padding-block: 20px; }
  .projects-links a { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (max-width: 760px) {
  .article-page, .projects-page { padding-bottom: calc(36px + env(safe-area-inset-bottom)); }
  .article-nav, .projects-header { padding-top: calc(24px + env(safe-area-inset-top)); }
}

/* Desktop reading layouts echo the homepage's wide, two-column composition. */
@media (min-width: 1100px) {
  .article-page, .projects-page { width: min(88%, 1440px); }
  .article-page { --reading-gap: clamp(48px, 6vw, 100px); --sidebar-width: calc((min(88vw, 1440px) - var(--reading-gap)) * .45); --reading-left: max(6vw, calc((100vw - 1440px) / 2)); }
  .article-nav { position: fixed; top: 36px; left: var(--reading-left); width: var(--sidebar-width); padding: 0; margin: 0; z-index: 1; }
  .article-page > article { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); column-gap: var(--reading-gap); align-items: start; padding-top: 121px; }
  .article-header { position: fixed; top: 89px; left: var(--reading-left); width: var(--sidebar-width); max-height: calc(100dvh - 113px); overflow-y: auto; padding: 0 0 36px; }
  .article-title { font-size: clamp(64px, 6vw, 100px); }
  .article-deck { max-width: 28ch; margin-top: 32px; }
  .article-meta { margin-top: 28px; }
  .article-media-stage > .article-example,
  .article-media-stage > .article-chart-switcher { grid-column: 2; grid-row: 1; width: 100%; max-width: none; margin: 0; padding-top: 0; border-top: 0; }
  .article-body { grid-column: 2; grid-row: 2; min-width: 0; padding-top: 40px; }
  .article-body section { max-width: none; }
  .article-chart-tabs { flex-wrap: wrap; gap: 12px 20px; }
  .logit-hero > a, .logit-hero figcaption { width: min(100%, 520px); }
  .projects-header { padding-bottom: 64px; }
  .projects-header .text-arrow-link { margin-bottom: 48px; }
  .projects-year-group { gap: 32px; }
  .projects-year-group + .projects-year-group { margin-top: 64px; }
  .projects-row { grid-template-columns: minmax(220px, 1fr) minmax(0, 1.8fr) 80px; gap: 32px; padding-block: 24px; align-items: baseline; }
  .projects-entry { display: contents; }
  .projects-entry h2 { grid-column: 1; font-family: Inter, sans-serif; font-weight: 600; }
  .projects-entry p { grid-column: 2; margin: 0; font-size: 15px; }
  .projects-links { grid-column: 3; grid-row: 1; justify-content: end; }
}

@media (min-width: 1100px) and (min-height: 650px) {
  .article-sidebar { position: fixed; top: 89px; left: var(--reading-left); width: var(--sidebar-width); height: calc(100dvh - 113px); display: flex; flex-direction: column; }
  .article-sidebar .article-header { position: static; width: auto; max-height: none; flex-shrink: 0; overflow: visible; padding-bottom: 0; }
  .article-body { grid-row: 1; padding-top: 0; }
  .article-media-stage { display: block; margin-top: 28px; min-height: 0; flex: 1; overflow: auto; scrollbar-width: thin; }
  .article-media-stage > [hidden] { display: none !important; }
  .article-media-stage > figure, .article-media-stage > fieldset { margin: 0; padding: 0; border: 0; max-width: none; }
  .article-media-stage img { width: 100%; height: auto; max-height: min(36dvh, 360px); object-fit: contain; object-position: left top; }
  .article-media-stage .logit-hero img { aspect-ratio: auto; }
  .article-media-stage .logit-hero > a, .article-media-stage .logit-hero figcaption { width: 100%; }
  .article-media-stage .article-chart-tabs { gap: 8px 16px; margin-bottom: 16px; }
  .article-media-stage .article-chart-tabs label { font-size: 12px; min-height: 32px; }
  .article-media-stage .article-example img { background: transparent; }
}
.article-media-stage {
  --media-swap-dur: 150ms;
  --media-swap-distance: 4px;
  --media-swap-blur: 2px;
  transform: translateY(0);
  filter: blur(0);
  opacity: 1;
  transition: transform var(--media-swap-dur) ease-in-out, filter var(--media-swap-dur) ease-in-out, opacity var(--media-swap-dur) ease-in-out;
}
.article-media-stage.is-exit { transform: translateY(calc(-1 * var(--media-swap-distance))); filter: blur(var(--media-swap-blur)); opacity: 0; }
.article-media-stage.is-enter-start { transform: translateY(var(--media-swap-distance)); filter: blur(var(--media-swap-blur)); opacity: 0; transition: none; }
@media (prefers-reduced-motion: reduce) {
  .article-media-stage { transition: none !important; transform: none !important; filter: none !important; opacity: 1 !important; }
}

.not-found { width: min(88%, 800px); min-height: 100dvh; margin-inline: auto; padding-block: clamp(24px, 6dvh, 64px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: clamp(24px, 5vw, 64px); }
.not-found h1 { margin: 0; font: 700 clamp(48px, 5.1vw, 76px)/.98 Inter, sans-serif; letter-spacing: -.04em; }
.not-found .text-arrow-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 24px; color: var(--foreground); font: 375 14px/1.5 'Geist Mono', monospace; text-underline-offset: 3px; }
.not-found a:focus-visible { outline: 2px solid var(--article-accent); outline-offset: 4px; }
.not-found-snoopy { display: block; width: 100%; height: auto; max-height: min(50dvh, 360px); object-fit: contain; }
@media (max-width: 760px) {
  .not-found { width: calc(100% - 48px); grid-template-columns: minmax(0, 1fr); align-content: center; gap: 24px; padding-block: calc(24px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-bottom)); text-align: center; }
  .not-found h1 { font-size: clamp(40px, 10vw, 52px); }
  .not-found-snoopy { width: min(100%, 260px); max-height: 36dvh; justify-self: center; }
}
