:root {
  --bg: #fbfbfa;
  --fg: #1a1a19;
  --muted: #6e6e69;
  --line: #e4e4e0;
  --thumb: #efefec;
  --link: #1a1a19;
  --max: 760px;
  --wide: 1680px;
  --gutter: clamp(20px, 4vw, 56px);
  color-scheme: light;
}

/* Dark: chosen by time of day (script in <head>) or the toggle; without JS, follow the system */
:root[data-theme="dark"] {
  --bg: #111110;
  --fg: #ebebe8;
  --muted: #96968f;
  --line: #272725;
  --thumb: #1c1c1b;
  --link: #ebebe8;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #111110;
    --fg: #ebebe8;
    --muted: #96968f;
    --line: #272725;
    --thumb: #1c1c1b;
    --link: #ebebe8;
    color-scheme: dark;
  }
}


* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

img { display: block; max-width: 100%; height: auto; }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; margin: 0; }
h1 { font-size: 1.75rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.wrap.wide { max-width: var(--wide); padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.dot { margin: 0 0.5em; color: var(--muted); }

/* header / footer */
.site-header { display: flex; align-items: baseline; justify-content: space-between; padding-top: 28px; padding-bottom: 28px; }
.site-header .name { font-weight: 600; text-decoration: none; }
.site-header nav { display: flex; align-items: center; gap: 20px; }
.theme-toggle { display: inline-flex; padding: 4px; margin: -4px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 50%; }
.theme-toggle:hover { color: var(--fg); }
.site-header nav a { text-decoration: none; color: var(--muted); }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--fg); }

.site-footer { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; margin-top: 96px; padding-top: 24px; padding-bottom: 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
.site-footer .links { display: flex; gap: 20px; }
.site-footer a { color: var(--muted); }

/* home */
section { margin-top: 56px; }
.intro { margin-top: 32px; }
.intro h1 { margin-bottom: 12px; }
.lede { font-size: 1.2rem; line-height: 1.5; max-width: 36em; }
.label { font-size: 0.8rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 20px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 48px 28px; }
.card { text-decoration: none; display: block; }
.card .thumb { aspect-ratio: 4 / 3; background: var(--thumb); overflow: hidden; border-radius: 4px; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.2s; }
.card:hover .thumb img { opacity: 0.85; }
.card-head { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; }
.card p { margin: 2px 0 0; font-size: 0.925rem; }

.rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(460px, 100%), 1fr)); column-gap: 40px; }
.rows li { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 0.95rem; }
.mini-thumb { width: 96px; aspect-ratio: 4 / 3; background: var(--thumb); border-radius: 3px; overflow: hidden; }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-head { display: flex; justify-content: space-between; gap: 12px; }
.mini-head h3 { font-size: 0.95rem; font-weight: 500; }
.rows p { margin: 2px 0 0; }
.mini-links { font-size: 0.9rem; }

/* project */
.project .back { display: inline-block; margin: 8px 0 32px; text-decoration: none; font-size: 0.9rem; }
.project h1 { font-size: 2rem; }
.project .meta { margin: 10px 0 24px; font-size: 0.925rem; }
.project .cover { margin: 32px 0; }
.only-wide { display: none; }
.p-media .gallery { margin-top: 24px; }
.project .next { grid-column: 1 / -1; }
@media (min-width: 1100px) {
  .project { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: clamp(40px, 5vw, 96px); align-items: start; }
  .only-narrow { display: none; }
  .only-wide { display: block; }
  .p-media { padding-top: 64px; }
  .p-media .cover { margin-top: 0; }
  .p-media .video { margin: 24px 0 0; }
}
figure { margin: 0; }
figure img { border-radius: 4px; background: var(--thumb); max-height: 85vh; width: auto; }
.prose h2 { font-size: 1rem; margin: 2em 0 0.5em; }
.prose { max-width: 40em; }
.facts { display: grid; grid-template-columns: 6em 1fr; gap: 8px 16px; margin: 40px 0; padding-top: 24px; border-top: 1px solid var(--line); font-size: 0.95rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.gallery { display: grid; gap: 24px; margin-top: 40px; }
.video { margin: 40px 0; }
.embed { position: relative; aspect-ratio: 16 / 9; background: var(--thumb); border-radius: 4px; overflow: hidden; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
figcaption { margin-top: 10px; color: var(--muted); font-size: 0.925rem; }
.next { margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); }

/* cv */
.cv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-top: 32px; }
.cv-head p { margin: 4px 0 0; }
.cv-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.cv .lang { margin: 0; font-size: 0.875rem; }
.cv .lang a { color: var(--muted); }
.cv .lang [aria-current] { font-weight: 500; }
.cv .contact { font-size: 0.925rem; }
.cv .contact a { color: var(--muted); }
.button { display: inline-block; white-space: nowrap; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-size: 0.9rem; }
.button:hover { border-color: var(--fg); }
.cv section { margin-top: 44px; }
.entry { display: grid; grid-template-columns: 9.5em 1fr; gap: 16px; margin-bottom: 22px; }
.entry .when { font-size: 0.9rem; padding-top: 1px; white-space: nowrap; }
.entry p { margin: 0; }
.entry p + p { margin-top: 6px; }
.entry ul { margin: 6px 0 0; padding-left: 1.1em; }
.entry li { margin: 2px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

@media (max-width: 640px) {
  .grid { gap: 36px; }
  .rows li { grid-template-columns: 72px 1fr; gap: 12px; }
  .mini-thumb { width: 72px; }
  .entry { grid-template-columns: 1fr; gap: 2px; }
  .two { grid-template-columns: 1fr; }
  .cv-head { flex-direction: column; }
  .cv-actions { flex-direction: row; align-items: center; gap: 16px; }
  .project h1 { font-size: 1.6rem; }
}

/* print (also used for the PDF) */
@page { size: A4; margin: 16mm 16mm 14mm; }
@media print {
  :root, :root[data-theme] { --bg: #fff; --fg: #000; --muted: #555; --line: #ddd; color-scheme: light; }
  body { font-size: 10pt; line-height: 1.45; background: #fff; font-family: "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif; }
  .site-header, .site-footer, .screen-only, .cv-projects { display: none; }
  .wrap { max-width: none; padding: 0; }
  a { text-decoration: none; }
  .cv-head { margin-top: 0; }
  .cv section { margin-top: 18pt; break-inside: auto; }
  .entry { break-inside: avoid; margin-bottom: 10pt; grid-template-columns: 10em 1fr; }
  .label { margin-bottom: 8pt; }
}
