:root {
  --bg: #f6f5f2;
  --fg: #111;
  --muted: #777;
  --line: #d9d7d2;
  --ph: #dcdad5;
  --pad: clamp(1.25rem, 4vw, 3rem);
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e0e0e; --fg: #eee; --muted: #888; --line: #2a2a2a; --ph: #1d1d1d; }
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 1rem/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

.site-header { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1rem var(--pad); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.site-header nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.brand { font-weight: 600; }

main, .site-footer { padding-inline: var(--pad); }
.hero { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; }
.hero h1 { margin: 0; max-width: 14ch; font-size: clamp(2.5rem, 9vw, 7rem); line-height: 1; letter-spacing: -.04em; font-weight: 600; }
.year { margin: 2rem 0 0; color: var(--muted); font-size: .8rem; letter-spacing: .08em; }

.block { padding-block: clamp(3rem, 8vw, 6rem); border-top: 1px solid var(--line); }
.block h2 { margin: 0 0 2rem; font-size: .8rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.block h2 small { color: var(--muted); font-size: inherit; margin-left: .75rem; }
.num { color: var(--muted); margin-right: .75rem; }
.prose { max-width: 38rem; font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.5; }
.prose p { margin: 0 0 1.25em; }

.grid { columns: 3 20rem; column-gap: 1.5rem; }
.grid figure { break-inside: avoid; margin-bottom: 1.5rem; }
figure { margin: 0; }
.ph, figure img { display: block; width: 100%; height: auto; aspect-ratio: auto; background: var(--ph); border: 0; padding: 0; cursor: zoom-in; }
figcaption { margin-top: .5rem; color: var(--muted); font-size: .75rem; letter-spacing: .04em; }

.posts { list-style: none; margin: 0; padding: 0; max-width: 48rem; }
.posts a { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); font-size: 1.15rem; }
.posts a:hover { text-decoration: none; padding-left: .5rem; transition: padding .2s; }
.posts time { color: var(--muted); font-size: .8rem; }

.site-footer { position: sticky; bottom: 0; z-index: 10; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 1rem; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); color: var(--muted); font-size: .8rem; }
.site-footer a { margin-left: 1.25rem; }

dialog { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; border: 0; padding: var(--pad); background: var(--bg); color: var(--fg); }
dialog[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
dialog::backdrop { background: var(--bg); }
dialog .stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
dialog .stage img, dialog .stage .ph { max-width: 100%; max-height: 100%; width: auto; height: auto; }
dialog .stage .ph { width: min(100%, 60rem); aspect-ratio: 3 / 2; cursor: default; }
dialog .cap { margin: 0; color: var(--muted); font-size: .8rem; }
.close { position: absolute; top: .75rem; right: var(--pad); background: none; border: 0; color: inherit; font-size: 2rem; line-height: 1; cursor: pointer; }

.site-footer .social { display: inline-flex; vertical-align: middle; }
.site-footer .social:hover { color: var(--fg); text-decoration: none; }

.prose a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.prose a:hover { text-decoration-thickness: 2px; }

/* Thoughts article pages */
.article { max-width: 42rem; padding-block: clamp(3rem, 8vw, 6rem); }
.article .back { margin: 0 0 3rem; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.article h1 { margin: 0 0 1rem; font-size: clamp(2rem, 6vw, 3.75rem); line-height: 1.05; letter-spacing: -.03em; font-weight: 600; }
.article .meta { margin: 0 0 3rem; color: var(--muted); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.article .prose { max-width: none; }
.article .source { margin: 3rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.article .source a { text-decoration: underline; text-underline-offset: 3px; }
.article figure { margin: 0 0 2.5rem; }
.article figure img { display: block; width: 100%; height: auto; cursor: default; }
.article .more { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; margin-top: 3rem; }
.article .more figure { margin: 0; }
.prose ul { margin: 0 0 1.25em; padding-left: 1.25em; }
.prose li { margin-bottom: .6em; }
.prose .refs-title { margin-bottom: .5em; color: var(--muted); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }

/* Side projects */
.projects { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1.5rem; }
.projects a { display: flex; flex-direction: column; gap: .75rem; height: 100%; padding: 1.5rem; border: 1px solid var(--line); transition: border-color .2s; }
.projects a:hover { border-color: var(--fg); text-decoration: none; }
.p-title { font-size: clamp(1.25rem, 2.5vw, 1.6rem); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.p-title .arrow { display: inline-block; transition: transform .2s; }
.projects a:hover .arrow { transform: translate(2px, -2px); }
.p-desc { font-size: 1rem; line-height: 1.5; }
.p-url { margin-top: auto; color: var(--muted); font-size: .75rem; letter-spacing: .04em; }

/* Hero background: a random, faded, vignetted film photo (see js/main.js) */
.hero { position: relative; isolation: isolate; }
.hero-bg {
  position: absolute; z-index: -1; top: 0; bottom: 0; left: calc(-1 * var(--pad)); right: calc(-1 * var(--pad));
  background-position: center; background-size: cover; background-repeat: no-repeat;
  opacity: 0; pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 75% 75% at 50% 45%, #000 25%, transparent 100%);
          mask-image: radial-gradient(ellipse 75% 75% at 50% 45%, #000 25%, transparent 100%);
  transition: opacity 1.4s ease;
}
.hero-bg.is-ready { opacity: .22; }
.hero .year { color: var(--fg); }
@media (prefers-reduced-motion: reduce) { .hero-bg { transition: none; } }
