/* One stylesheet, two colour schemes, one accent (Pacific blue: link
   underlines and row hover only). The OS preference picks the default;
   the ☾ button writes data-theme on <html>, which wins over it. */

:root {
  --bg: #fcfcfb;
  --text: #292824;
  --muted: #75736c;
  --rule: #e6e4df;
  --accent: #2b6c8c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171716;
    --text: #e6e4df;
    --muted: #8f8d86;
    --rule: #2c2b29;
    --accent: #74b4d4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171716;
  --text: #e6e4df;
  --muted: #8f8d86;
  --rule: #2c2b29;
  --accent: #74b4d4;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  max-width: 600px;
  padding: 48px 16px 64px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 56px; }
header .name { font-weight: 500; text-decoration: none; }
header nav { display: flex; gap: 16px; align-items: center; font-size: 13px; }
header nav a { text-decoration: none; color: var(--muted); }
header nav a:hover { color: var(--text); }
#theme { display: flex; background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; }
#theme:hover { color: var(--text); }
header nav a, #theme { display: flex; align-items: center; }
.icon { width: 15px; height: 15px; }

/* Moon in light mode, sun in dark mode. Same three conditions as the
   colour tokens above, so the icon always matches the colours on screen. */
.sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .moon { display: none; }
  :root:not([data-theme="light"]) .sun { display: block; }
}
:root[data-theme="dark"] .moon { display: none; }
:root[data-theme="dark"] .sun { display: block; }

section { margin-bottom: 48px; }
h2 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }

ul { list-style: none; margin: 0; padding: 0; }

/* Philosophies: Karri-style chevron list, explanation in muted text. */
.notes li { position: relative; padding-left: 18px; margin-bottom: 10px; }
.notes li::before, .rows details ul li::before { content: "›"; position: absolute; left: 0; color: var(--muted); }
.notes span { display: block; color: var(--muted); }

/* Expandable rows: name + role on the left, years on the right. */
.rows > li { border-top: 1px solid var(--rule); }
.rows > li:last-child { border-bottom: 1px solid var(--rule); }
.rows + p { margin-top: 16px; }
summary { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary em { font-style: normal; color: var(--muted); margin-left: 6px; }
summary time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
summary:hover em, summary:hover time { color: var(--accent); }
details[open] summary { font-weight: 500; }
details > :not(summary) { margin-left: 0; }
details > ul, details > p:last-child { margin-bottom: 16px; }
details ul li { position: relative; padding-left: 18px; }

footer { color: var(--muted); font-size: 13px; }

@media (max-width: 480px) {
  body { padding-top: 32px; }
  header { margin-bottom: 40px; }
  summary em { display: block; margin-left: 0; }
}

/* Writing list on the home page: year in a left column, then each title
   with its date underneath. */
.writing .year { display: grid; grid-template-columns: 96px 1fr; gap: 0 16px; margin-bottom: 16px; }
.writing h3 { font-size: 14px; font-weight: 400; color: var(--muted); margin: 0; line-height: 1.5; font-variant-numeric: tabular-nums; }
.posts li { margin-bottom: 14px; line-height: 1.5; }
.posts a { text-decoration: none; }
.posts a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.posts time { display: block; color: var(--muted); font-size: 11px; }
@media (max-width: 480px) { .writing .year { grid-template-columns: 48px 1fr; } }

/* Post pages. Lists get their markers back, since the global reset removes them. */
.post { margin-bottom: 48px; }
/* Headings step down like Linear's: title, then H1 to H4 in the body. */
.post h1, .post h2, .post h3, .post h4, .post h5, .post h6 { font-weight: 600; line-height: 1.3; margin: 28px 0 8px; }
.post .title { font-size: 24px; margin: 0; }
.post .title + .muted { font-size: 12px; margin-bottom: 24px; }
.post h1 { font-size: 20px; }
.post h2 { font-size: 17px; }
.post h3 { font-size: 15px; }
.post h4, .post h5, .post h6 { font-size: 14px; }
.post ul, .post ol { margin: 0 0 12px; padding-left: 20px; }
.post ul { list-style: disc; }
.post ol { list-style: decimal; }
.post blockquote { margin: 0 0 12px; padding-left: 16px; border-left: 2px solid var(--rule); color: var(--muted); }
.post code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
.post pre { margin: 0 0 12px; padding: 12px 16px; overflow-x: auto; border: 1px solid var(--rule); border-radius: 4px; }
.post img { max-width: 100%; height: auto; }
.post hr { border: 0; border-top: 1px solid var(--rule); margin: 32px 0; }

/* Photography: on the home page, four square frames; on /photography/, every
   photo uncropped, in rows that line up like justified text: each photo's
   share of a row is its width/height (--r, set by the build), so a row's
   photos come out the same height. The ::after spacer keeps the last row
   from stretching. Both stay grey until hovered (screens that can't hover
   get colour). Clicking a photo opens the large copy. */
.strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }
.grid { display: flex; flex-wrap: wrap; gap: 16px 8px; }
.grid li { flex: calc(var(--r) * 100) 1 calc(var(--r) * 160px); min-width: 0; }
.grid::after { content: ""; flex-grow: 1000000; }
.strip a, .grid a { display: block; }
.strip img, .grid img { display: block; width: 100%; height: auto; filter: grayscale(1); transition: filter 0.3s; }
.strip img { aspect-ratio: 1; object-fit: cover; }
.strip a:hover img, .grid a:hover img, .strip a:focus-visible img, .grid a:focus-visible img { filter: none; }
@media (hover: none) { .strip img, .grid img { filter: none; } }
.photography > p { display: flex; justify-content: space-between; gap: 16px; }
.photography > p a { white-space: nowrap; }
.grid p { font-size: 12px; line-height: 1.4; margin: 4px 0 0; }
@media (max-width: 480px) { .grid li { flex-basis: calc(var(--r) * 110px); } }

/* Lightbox (index.html's last script): the photo as large as fits, its
   caption bottom left, × top right. Dark in both themes, so the photo is
   the only thing lit; these colours don't follow the tokens on purpose. */
.lightbox { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 56px 16px; border: 0; background: #111110; color: #e6e4df; }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: #111110; }
.lightbox img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox p { position: absolute; left: 16px; bottom: 16px; margin: 0; font-size: 13px; color: #a8a6a0; }
.lightbox button { position: absolute; top: 6px; right: 6px; display: flex; padding: 10px; background: none; border: 0; color: inherit; cursor: pointer; }
.lightbox button svg { width: 22px; height: 22px; }
html:has(.lightbox[open]) { overflow: hidden; }
@media (min-width: 768px) {
  .lightbox { padding: 64px 72px; }
  .lightbox p { left: 24px; bottom: 20px; }
  .lightbox button { top: 14px; right: 14px; }
}
