/* nksaunders.space — hand-written, no framework. */

@font-face { font-family: "Charis"; src: url("/assets/fonts/charis-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Charis"; src: url("/assets/fonts/charis-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Charis"; src: url("/assets/fonts/charis-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Charis"; src: url("/assets/fonts/charis-bolditalic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/assets/fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root[data-theme="night"] {
  --bg: #10141C;
  --ink: #ECE8E0;
  --soft: #C4C2BC;
  --muted: #9C9EA4;
  --rule: #2A303C;
  --panel: #1A202B;
  --accent: #E3B060;
  --on-accent: #10141C;
  --plate: #D3CEC4;
  --points: #9C9EA4;
  color-scheme: dark;
}
:root, [data-theme="day"] {
  --bg: #FBFAF7;
  --ink: #1E1E1E;
  --soft: #3E3E3E;
  --muted: #5E5E5E;
  --rule: #DCD9D2;
  --panel: #EEECE7;
  --accent: #8A2B2B;
  --on-accent: #FFFFFF;
  --plate: #EEECE7;
  --points: #6E6E6E;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Charis", Charter, "Bitstream Charter", Georgia, serif;
  font-feature-settings: "ss01" 1; /* single-story a and g */
  font-size: 19px;
  line-height: 1.6;
  transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.code, .wordmark, .eyebrow, .sp-tabs, .sp-plot text {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.wrap { max-width: 1120px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }
@media (max-width: 600px) { .wrap { padding-left: 16px; padding-right: 16px; } body { font-size: 18px; } }

/* Top bar */
/* The top of the page has exactly two layouts, switching at 960px:
   wide = one-row bar, text beside a large photo, 54px headline;
   narrow = two-row bar, small photo above, 32px headline.
   Sizes inside each layout are fixed so nothing reflows as the width changes. */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 24px; padding-bottom: 24px; }
.wordmark { font-size: 14px; letter-spacing: .02em; text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 26px; }
.nav { display: flex; gap: 24px; font-size: 17px; }
.nav a { color: var(--soft); text-decoration: none; }
.nav a:hover { color: var(--accent); }
.theme-toggle {
  width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--rule);
  background: transparent; color: var(--ink); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle svg, .sp-shuffle svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="night"] .icon-moon, [data-theme="day"] .icon-sun { display: none; }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 260px; column-gap: 64px; align-items: center; padding-top: 64px; padding-bottom: 72px; }
.hero-text { min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.eyebrow { margin: 0; font-size: 16px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
h1 { margin: 0; font-size: 54px; line-height: 1.1; font-weight: 400; letter-spacing: -.015em; }
.lede { margin: 0; font-size: 20px; color: var(--soft); max-width: 640px; }
.buttons { display: flex; flex-wrap: wrap; gap: 12px; font-size: 16px; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--rule); text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn-primary:hover { color: var(--on-accent); filter: brightness(1.08); }
.headshot { width: 260px; }
.headshot img { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--rule); object-fit: cover; }

@media (max-width: 959px) {
  .topbar { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "mark toggle" "nav nav"; row-gap: 14px; padding-bottom: 8px; }
  .topbar-right { display: contents; }
  .wordmark { grid-area: mark; }
  .theme-toggle { grid-area: toggle; }
  .nav { grid-area: nav; gap: 20px; font-size: 16px; }
  .hero { grid-template-columns: minmax(0, 1fr); row-gap: 24px; padding-top: 32px; padding-bottom: 56px; }
  .headshot { order: -1; width: 112px; }
  .hero-text { gap: 20px; }
  .eyebrow { font-size: 13px; letter-spacing: .06em; }
  h1 { font-size: 32px; }
  .lede { font-size: 18px; }
  .buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 150px)); }
  .btn { justify-content: center; padding: 0 12px; }
}

/* Section labels */
.label { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.label-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.label-aside { font-size: 15px; color: var(--muted); }
.label-aside a { color: var(--accent); }
.col-main > .label, .col-side > .label { border-bottom: 1px solid var(--rule); padding-bottom: 8px; }

/* Research */
.band { border-top: 1px solid var(--rule); }
.band > .wrap { padding-top: 72px; padding-bottom: 24px; display: flex; flex-direction: column; gap: 36px; }
.research-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 36px; }
.research-card { display: flex; flex-direction: column; gap: 12px; }
.research-card figure { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.plate { aspect-ratio: 1.37 / 1; background: var(--plate); border-radius: 14px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.plate img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
/* Figures with a night version swap with the theme */
.plate .fig-night, [data-theme="night"] .plate .fig-day { display: none; }
[data-theme="night"] .plate .fig-night { display: block; }
.research-card h3 { margin: 0; font-size: 23px; font-weight: 400; }
.research-card p { margin: 0; font-size: 17px; color: var(--soft); }
.more { font-size: 16px; color: var(--accent); }

/* Two-column rows: matched widths across rows */
.split { display: flex; flex-wrap: wrap; gap: 64px; padding-top: 56px; padding-bottom: 16px; }
.split + .split { padding-bottom: 72px; }
.col-main { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.col-side { flex: 0 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1000px) { .col-side { flex-basis: 100%; } }

/* Publications */
.pubs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; font-size: 17px; }
.pubs li { padding-left: 22px; position: relative; }
.pubs a { color: var(--accent); }
.star { position: absolute; left: 0; top: 0; }

/* Mentoring and software */
.mentoring { display: grid; grid-template-columns: 110px minmax(0, 1fr); column-gap: 14px; row-gap: 12px; margin: 0; font-size: 17px; }
.mentoring dt { color: var(--muted); }
.mentoring dd { margin: 0; }
.mentoring dd span { font-size: 15px; color: var(--muted); }
.mentoring .outputs a { color: var(--accent); }
.software { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 17px; }
.software .code { font-size: 15px; color: var(--accent); }

/* System Spotlight */
.spotlight { border: 1px solid var(--rule); border-radius: 14px; background: var(--panel); padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.sp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; min-height: 58px; }
.sp-name { font-size: 24px; line-height: 1.2; }
.sp-desc { font-size: 15px; color: var(--muted); }
.sp-shuffle { width: 44px; height: 44px; flex: 0 0 44px; margin: -8px -10px 0 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.sp-shuffle:hover { color: var(--accent); }
.sp-tabs { display: flex; flex-wrap: nowrap; gap: 6px; font-size: 13px; }
.sp-legend { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; white-space: pre-wrap; }
.sp-tab { min-height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer; font: inherit; border: 1px solid var(--rule); background: transparent; color: var(--soft); }
.sp-tab[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sp-plot { height: 220px; }
.sp-plot svg { display: block; width: 100%; height: 220px; overflow: visible; }
.sp-plot .axis { stroke: var(--rule); stroke-width: 1; fill: none; }
.sp-plot .ref { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 3 4; }
.sp-plot .pts { fill: var(--points); fill-opacity: .75; }
.sp-plot .err { stroke: var(--points); stroke-opacity: .45; stroke-width: 1; }
.sp-plot .model { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.sp-plot text { fill: var(--muted); font-size: 11px; }
.sp-empty { height: 220px; margin: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 15px; color: var(--muted); border: 1px dashed var(--rule); border-radius: 8px; padding: 0 24px; }
.sp-caption { height: 64px; display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--muted); }
.sp-caption svg { flex: 0 0 64px; }
.sp-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; border-top: 1px solid var(--rule); padding-top: 10px; }
.sp-foot a { color: var(--accent); }
.sp-foot span { font-size: 12px; color: var(--muted); }
.sp-lambda { font-size: 16px; color: var(--ink); }
.sp-disclaimer { margin: -4px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); font-style: italic; }
.sp-note { margin: 0; font-size: 12px; color: var(--muted); font-style: italic; }

/* Footer */
.footer { border-top: 1px solid var(--rule); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 24px; padding-bottom: 24px; font-size: 15px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { body { transition: none; } }

/* ---------- Off-sky page ---------- */
.page-head { display: flex; flex-direction: column; gap: 20px; padding-top: 64px; padding-bottom: 24px; }
@media (max-width: 959px) { .page-head { padding-top: 32px; } }
.os-section { display: flex; flex-direction: column; gap: 20px; padding-top: 48px; }
.offsky > section:last-of-type { padding-bottom: 72px; }
.os-section > .label { border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.os-text { margin: 0; max-width: 680px; color: var(--soft); }
.sublabel { margin: 12px 0 0; font-size: 21px; font-weight: 400; }
.offsky figure { margin: 0; }
.offsky img { display: block; width: 100%; height: auto; }

.ph { background: var(--panel); border: 1px solid var(--rule); display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; color: var(--muted); font-size: 15px; }
.ph-square { aspect-ratio: 1; }
.ph-wide { aspect-ratio: 2.4 / 1; }

.pets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; max-width: 720px; }
.pet img, .pet .ph { aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.pet figcaption { display: flex; flex-direction: column; margin-top: 10px; font-size: 17px; }
.pet figcaption span { font-size: 15px; color: var(--muted); }

.kitchen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kitchen img { aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.kitchen .ph { border-radius: 6px; }
.kitchen figure { position: relative; overflow: hidden; border-radius: 6px; outline-offset: 3px; }
.kitchen figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 28px 12px 10px;
  font-size: 15px; line-height: 1.3; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,0));
  opacity: 0; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease; pointer-events: none;
}
.kitchen figure:hover figcaption, .kitchen figure:focus-visible figcaption { opacity: 1; transform: none; }
/* Touch screens can't hover, so show the labels there all the time. */
@media (hover: none) { .kitchen figcaption { opacity: 1; transform: none; font-size: 13px; padding: 20px 8px 6px; } }
@media (prefers-reduced-motion: reduce) { .kitchen figcaption { transition: none; } }
@media (max-width: 600px) { .kitchen { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.favorites { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; max-width: 760px; }
@media (max-width: 600px) { .favorites { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; } }
.favorites li { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.poster { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; border: 1px solid var(--rule); margin-bottom: 8px; background: var(--panel); color: transparent; overflow: hidden; }
.poster-card { background: var(--panel); display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 10px; font-size: 15px; line-height: 1.2; }
.poster-card small { color: var(--muted); font-size: 13px; }
.fav-title { font-size: 16px; line-height: 1.3; }
.fav-meta { font-size: 14px; color: var(--muted); }
@media (max-width: 600px) { .fav-title { font-size: 14px; } .fav-meta { font-size: 12px; } .poster-card { font-size: 12px; padding: 6px; } }

.decades { display: flex; flex-direction: column; max-width: 820px; border-top: 1px solid var(--rule); }
.decades details { border-bottom: 1px solid var(--rule); }
.decades summary { display: flex; align-items: baseline; gap: 14px; min-height: 48px; padding: 10px 0; cursor: pointer; list-style: none; }
.decades summary::-webkit-details-marker { display: none; }
.decades summary::before { content: "+"; width: 14px; color: var(--accent); font-family: "IBM Plex Mono", ui-monospace, monospace; }
.decades details[open] summary::before { content: "−"; }
.decades .dec { font-size: 19px; }
.decades ol { margin: 0 0 16px; padding-left: 56px; display: flex; flex-direction: column; gap: 4px; font-size: 17px; }
.decades li::marker { color: var(--muted); font-size: 15px; }
/* "So bad it's good": a quiet extra under the decades, easy to miss on purpose */
.bonus { max-width: 820px; margin-top: 14px; }
.bonus summary { display: inline-block; cursor: pointer; list-style: none; font-size: 14px; font-style: italic; color: var(--muted); opacity: .7; padding: 4px 0; transition: opacity .2s, color .2s; }
.bonus summary::-webkit-details-marker { display: none; }
.bonus summary:hover, .bonus summary:focus-visible, .bonus[open] summary { opacity: 1; color: var(--accent); }
.bonus ol { margin: 8px 0 0; padding-left: 56px; display: flex; flex-direction: column; gap: 4px; font-size: 16px; }
.bonus li::marker { color: var(--muted); font-size: 14px; }
.cage { position: relative; display: inline-block; margin-left: 6px; padding: 0 4px; color: var(--muted); cursor: default; outline: none; }
.cage-pop { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 6px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; opacity: 0; transition: opacity .18s, transform .18s; z-index: 5; }
.cage-pop img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 3px solid var(--panel); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.cage-pop span { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11px; white-space: nowrap; color: var(--ink); background: var(--panel); border: 1px solid var(--rule); border-radius: 999px; padding: 2px 8px; }
.cage:hover .cage-pop, .cage:focus .cage-pop { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .cage-pop { transition: none; } }
.credit { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.credit a { color: var(--accent); }
.wide img, .wide .ph { border-radius: 8px; }
.wide img { aspect-ratio: 2.4 / 1; object-fit: cover; }
