:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #16181b;
  --muted: #5c636b;
  --line: #e2e4e7;
  --accent: #0b5cad;
  --accent-text: #ffffff;
  --todo-bg: #fff1b8;
  --todo-text: #5a4300;
  --radius: 6px;
  --wrap: 1040px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416;
    --surface: #1a1d20;
    --text: #e8eaed;
    --muted: #9aa1a9;
    --line: #2c3035;
    --accent: #6aa9ec;
    --accent-text: #0d1117;
    --todo-bg: #4a3b00;
    --todo-text: #ffe28a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0 0 0.5rem; }
h2 { font-size: 1.35rem; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.1rem; margin: 1.75rem 0 0.5rem; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 2rem; padding-bottom: 4rem; }

/* header and footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 0.9rem; padding-bottom: 0.9rem; }
.site-name { font-weight: 650; color: var(--text); text-decoration: none; }
.site-header nav { display: flex; gap: 1.25rem; }
.site-header nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--text); }
.site-header nav a[aria-current] { box-shadow: 0 2px 0 var(--accent); }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; padding-top: 1.5rem; padding-bottom: 2rem; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }

/* text */
.prose { max-width: 70ch; }
.prose figure { margin: 1.5rem 0; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 1rem; max-width: 60ch; }
figcaption { font-size: 0.875rem; color: var(--muted); margin-top: 0.4rem; }
mark.todo { background: var(--todo-bg); color: var(--todo-text); padding: 0 0.25em; border-radius: 3px; font-size: 0.95em; }
.back { margin-top: 3rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.45rem 0.75rem 0.45rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }

/* home */
.intro { display: grid; gap: 2rem; align-items: center; margin-bottom: 1rem; }
.intro-photo { border-radius: var(--radius); width: 100%; max-width: 360px; aspect-ratio: 4 / 5; object-fit: cover; }
.now { font-size: 0.95rem; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 0.75rem; max-width: 60ch; }
.now-label { font-weight: 650; color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }
.button { display: inline-block; padding: 0.55rem 1rem; border-radius: var(--radius); background: var(--accent); color: var(--accent-text); text-decoration: none; font-weight: 600; font-size: 0.95rem; border: 1px solid var(--accent); }
.button.secondary { background: transparent; color: var(--accent); }
@media (min-width: 760px) {
  .intro { grid-template-columns: 1fr 320px; }
}

/* project cards */
.cards { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); text-decoration: none; }
.card:hover { border-color: var(--accent); }
.card img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.card-body { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.9rem 1rem 1.1rem; }
.card-meta { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 0; }
.card-meta a { color: inherit; }
.card-title { font-weight: 650; font-size: 1.05rem; }
.card-text { font-size: 0.95rem; color: var(--muted); }

/* project page */
.project-header { margin-bottom: 1.5rem; }
.hero { margin: 0 0 2rem; }
.hero img { border-radius: var(--radius); width: 100%; max-height: 640px; object-fit: cover; }
.project-layout { display: grid; gap: 2rem; }
.spec { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; align-self: start; font-size: 0.92rem; }
.spec div + div { margin-top: 0.75rem; }
.spec dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.spec dd { margin: 0.1rem 0 0; }
.project-layout .prose h2:first-child { margin-top: 0; }
@media (min-width: 900px) {
  .project-layout { grid-template-columns: 260px 1fr; }
  .spec { position: sticky; top: 1rem; }
}
.gallery { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.gallery figure { margin: 0; }
.video { margin: 0 0 1.5rem; }
.video video { display: block; width: 100%; height: auto; max-height: 640px; background: #000; border-radius: var(--radius); }
.gallery img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: var(--radius); background: var(--surface); }

/* notes */
.note-cards { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.note-card { display: flex; flex-direction: column; gap: 0.2rem; color: var(--text); text-decoration: none; }
.note-card img { aspect-ratio: 1 / 1.414; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 0.4rem; }
.note-card:hover img { border-color: var(--accent); }
.note-pages { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.note-pages img { border: 1px solid var(--line); border-radius: 4px; }
.note-pages a:hover img { border-color: var(--accent); }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 10; background: rgba(10, 12, 14, 0.94); display: flex; flex-direction: column; color: #e8eaed; }
.lb[hidden] { display: none; }
.lb-stage { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; touch-action: pan-x pan-y pinch-zoom; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.lb.zoomed .lb-stage { align-items: flex-start; justify-content: flex-start; }
.lb.zoomed .lb-stage img { max-width: none; max-height: none; cursor: zoom-out; margin: auto; }
.lb-bar { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 16px; font-size: 0.9rem; }
.lb-caption { flex: 1; }
.lb button { background: #2a2f35; color: #e8eaed; border: 0; border-radius: var(--radius); padding: 0.45rem 0.8rem; font: inherit; cursor: pointer; }
.lb button:hover { background: #3a4048; }

/* grid children may shrink below their content width on small screens */
.project-layout > *, .intro > *, .cards > *, .gallery > *, .note-cards > *, .note-pages > * { min-width: 0; }
.prose, .spec, h1 { overflow-wrap: break-word; }
