@font-face {
  font-family: Inter;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

/* Theme changes affect color only, so reading positions stay stable. */
:root {
  color-scheme: light;
  --desk: #e8e4dc;
  --paper: #f5f2eb;
  --ink: #292923;
  --muted: #68655d;
  --line: #c9c3b6;
  --accent: #91402c;
  --wash: #ece7dd;
  --grain: .035;
  --serif: Georgia, 'Songti SC', 'Noto Serif CJK SC', serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --desk: #191a17;
  --paper: #242520;
  --ink: #f5f2e9;
  --muted: #e0ddd4;
  --line: #66685d;
  --accent: #f0b494;
  --wash: #30322b;
  --grain: .008;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --desk: #191a17;
    --paper: #242520;
    --ink: #f5f2e9;
    --muted: #e0ddd4;
    --line: #66685d;
    --accent: #f0b494;
    --wash: #30322b;
    --grain: .008;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 28px; }
body { margin: 0; padding: 32px 24px; background: var(--desk); color: var(--ink); font: 15px/1.8 var(--sans); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
img { display: block; max-width: 100%; }
a, button { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
::selection { background: var(--accent); color: var(--paper); }
.paper { position: relative; isolation: isolate; width: 100%; max-width: 920px; margin: auto; padding: 0 56px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 12px 45px #00000006; }
.paper::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: var(--grain); background-size: 180px 180px; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.84' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23808080' filter='url(%23n)' opacity='.7' d='M0 0h180v180H0z'/%3E%3C/svg%3E"); }
.skip-link { position: fixed; top: 10px; left: 20px; z-index: 10; transform: translateY(-160%); background: var(--ink); color: var(--paper); padding: 8px 15px; }
.skip-link:focus { transform: none; }

/* Masthead */
.site-header { min-height: 88px; display: flex; align-items: center; gap: 28px; border-bottom: 1px solid var(--line); }
.brand { font: italic 36px/1 var(--serif); letter-spacing: -3px; }
.brand span { color: var(--accent); }
.main-nav { display: flex; gap: 26px; margin-left: auto; color: var(--muted); font-size: 13px; }
.main-nav a { display: inline-flex; align-items: center; min-height: 44px; }
.main-nav a:hover, .main-nav a[aria-current], a.section-aside:hover { color: var(--accent); }
.main-nav a[aria-current] { text-decoration: underline; text-underline-offset: 6px; }
.theme-switch { display: flex; gap: 2px; border: 1px solid var(--line); padding: 3px; }
.theme-switch button { min-width: 44px; min-height: 44px; padding: 4px 9px; border: 0; background: transparent; font-size: 12px; color: var(--muted); }
.theme-switch button[aria-pressed=true] { background: var(--ink); color: var(--paper); }
.theme-switch button:hover:not([aria-pressed=true]) { background: var(--wash); }

/* A brief introduction, followed immediately by the work. */
.intro { padding: 40px 0 0; }
.eyebrow { font-size: 12px; letter-spacing: 1.2px; font-weight: 550; color: var(--accent); }
.eyebrow > span { margin-left: 10px; letter-spacing: 0; color: var(--muted); font-weight: 400; }
.intro h1 { font: normal clamp(50px, 7vw, 70px)/1.15 var(--serif); letter-spacing: -3px; margin: 12px 0 18px; }
.name-period { color: var(--accent); }
.intro-title { font: 600 24px/1.6 var(--serif); letter-spacing: .3px; }
.intro-copy { font-size: 16px; max-width: 40em; margin-top: 12px; color: var(--muted); line-height: 1.9; }
.intro-bottom { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.intro-bottom a, .more-work a, .email-link, .post-permalink { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 5px; }
.intro-bottom a, .more-work a, .email-link { color: var(--ink); }
.intro-bottom a:hover, .more-work a:hover, .email-link:hover, .post-permalink:hover { color: var(--accent); text-decoration-color: var(--accent); }
.edition { font-size: 12px; white-space: nowrap; }

/* Text-led project and contribution lists. */
.section { margin-top: 36px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; padding-bottom: 13px; border-bottom: 1px solid var(--ink); }
.section-heading h2 { font-size: 16px; font-weight: 550; letter-spacing: .5px; }
.section-number { font: italic 15px var(--serif); color: var(--accent); margin-right: 14px; letter-spacing: 0; }
.section-aside { font-size: 13px; color: var(--muted); }
.project { display: grid; grid-template-rows: auto 1fr; grid-template-columns: 148px minmax(0, 1fr) 18px; gap: 8px 24px; align-items: start; padding: 24px 0; border-bottom: 1px solid var(--line); }
.project-art { grid-column: 1; grid-row: 1 / 3; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border: 1px solid var(--line); }
.project-name { grid-column: 2; grid-row: 1; }
.project-description { grid-column: 2; grid-row: 2; }
.project > .arrow { grid-column: 3; grid-row: 1; }
.project.featured { grid-template-columns: 280px minmax(0, 1fr) 18px; }
:root[data-theme=dark] .project-art { filter: brightness(.82); }
.art-credit { margin-top: 10px; font-size: 12px; color: var(--muted); }
.project h3 { font-size: 17px; font-weight: 550; letter-spacing: -.4px; line-height: 1.6; }
.project-kind { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; }
.project-description p { font-size: 15px; line-height: 1.9; }
.project-status { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); }
.featured h3 { color: var(--accent); }
.arrow { font-size: 17px; color: var(--muted); transition: transform .18s; }
.project:hover h3, .contribution:hover strong, .note-link:hover h3 { color: var(--accent); }
.project:hover .arrow, .contribution:hover .arrow, .note-link:hover .arrow { color: var(--accent); transform: translate(2px, -2px); }
.more-work { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.all-projects { margin-left: auto; }
.contributions { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.contribution { display: grid; grid-template-columns: minmax(0, 1fr) 18px; gap: 3px 12px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.contribution strong { font-size: 14px; font-weight: 550; }
.contribution > span:not(.arrow) { grid-column: 1; grid-row: 2; font-size: 13px; color: var(--muted); }
.contribution .arrow { grid-column: 2; grid-row: 1/3; align-self: center; }
.note-link { display: grid; grid-template-columns: 94px minmax(0, 1fr) 18px; gap: 20px; align-items: baseline; padding: 18px 0; border-bottom: 1px solid var(--line); }
.note-link time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.note-link h3 { font-size: 14px; font-weight: 450; }

/* Contact stays close to the work, without another hero. */
.contact { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 30px 0; margin-top: 28px; border-top: 1px solid var(--line); }
.contact h2 { font: 500 19px/1.8 var(--serif); }
.email-link { display: inline-block; font-size: 14px; margin-top: 5px; overflow-wrap: anywhere; }
.copy-control { text-align: right; position: relative; flex-shrink: 0; }
.copy-control button { border: 1px solid var(--line); background: transparent; font-size: 13px; min-height: 44px; padding: 8px 14px; }
.copy-control button:hover { background: var(--wash); }
#copyStatus { position: absolute; right: 0; top: 100%; white-space: nowrap; color: var(--accent); font-size: 13px; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 20px; border-top: 1px solid var(--line); padding: 20px 0 24px; color: var(--muted); font-size: 13px; }
.footer-social { display: flex; gap: 20px; }
.footer-social a { display: inline-block; padding: 5px 0; }
.footer-legal { display: flex; gap: 2px 18px; flex-wrap: wrap; flex-basis: 100%; font-size: 12px; }
.footer-legal a { padding: 4px 0; }
.site-footer a:hover { color: var(--accent); }

/* The notebook shares the paper and typography. */
.thoughts-page { padding-top: 32px; }
.notes-hero { padding-bottom: 28px; }
.back-link { font-size: 13px; color: var(--muted); display: inline-block; padding: 6px 0; margin-bottom: 22px; }
.notes-hero h1 { font: 500 40px/1.4 var(--serif); margin: 12px 0; }
.notes-hero > p:last-child { font-size: 14px; color: var(--muted); }
.timeline { min-height: 260px; }
.year h2 { font: italic 18px var(--serif); color: var(--accent); border-top: 1px solid var(--ink); padding: 20px 0; }
.post { display: grid; grid-template-columns: 94px minmax(0, 1fr); gap: 24px; padding: 28px 0 36px; scroll-margin-top: 30px; }
.post + .post { border-top: 1px solid var(--line); }
.post-permalink { align-self: start; font-size: 13px; color: var(--muted); padding: 3px 0; }
.post .txt { font-size: 16px; line-height: 2; color: var(--ink); }
.post .txt h3 { font: 600 21px/1.7 var(--serif); margin-bottom: 16px; }
.post .txt p + p { margin-top: 16px; }
.post .txt a { text-decoration: underline; text-underline-offset: 4px; }
.pics { display: grid; gap: 10px; grid-column: 2; }
.pics.n1 { grid-template-columns: 1fr; }
.pics.n2 { grid-template-columns: repeat(2, 1fr); }
.pics.n3 { grid-template-columns: repeat(3, 1fr); }
.pics button { border: 0; padding: 0; background: none; }
.pics img { width: 100%; max-height: 500px; object-fit: cover; }
.lightbox { border: 1px solid var(--line); padding: 0; background: var(--paper); max-width: 94vw; max-height: 94vh; }
.lightbox::backdrop { background: #000d; }
.lightbox img { max-width: 90vw; max-height: 85vh; object-fit: contain; }
.lightbox button { position: absolute; right: 10px; top: 10px; padding: 8px 14px; min-height: 44px; background: var(--paper); border: 1px solid var(--line); z-index: 1; }
.empty { padding: 35px 0; color: var(--muted); }

/* A wider portfolio sheet: one lead project, then two supporting works. */
.project-action { display: none; }
@media (min-width: 761px) {
  .portfolio-paper { max-width: 1080px; padding-inline: 52px; }
  .portfolio-paper .intro { display: grid; grid-template-columns: 1.05fr 1fr; gap: 0 40px; padding-top: 36px; }
  .portfolio-paper .intro .eyebrow { grid-column: 1 / -1; }
  .portfolio-paper .intro h1 { grid-column: 1; margin-bottom: 8px; }
  .portfolio-paper .intro-title { grid-column: 1; font-size: 23px; }
  .portfolio-paper .intro-copy { grid-column: 2; grid-row: 2 / 4; align-self: center; margin: 0; max-width: 28em; text-wrap: pretty; }
  .portfolio-paper .intro-bottom { grid-column: 1 / -1; margin-top: 26px; }
  .portfolio-paper #work { margin-top: 32px; }
  #work .section-heading h2 { font-size: 20px; }
  .project-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 36px; }
  .project-gallery .project { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; gap: 16px 14px; padding: 28px 0; }
  .project-gallery .project-art { grid-column: 1 / -1; grid-row: 1; aspect-ratio: 2 / 1; }
  .project-gallery .project-name { grid-column: 1; grid-row: 2; }
  .project-gallery .project h3 { font-size: 24px; letter-spacing: -.7px; line-height: 1.4; }
  .project-gallery .project-kind { font-size: 14px; margin-top: 5px; }
  .project-gallery .project-description { grid-column: 1 / -1; grid-row: 3; display: flex; flex-direction: column; align-items: flex-start; height: 100%; }
  .project-gallery .project-description p { font-size: 16px; line-height: 1.8; }
  .project-gallery .project-status { margin: 12px 0 18px; }
  .project-gallery .project > .arrow { display: none; }
  .project-gallery .project-action { display: inline-block; margin-top: auto; padding: 4px 0; font-size: 14px; color: var(--accent); border-bottom: 1px solid var(--line); }
  .project:hover .project-action { border-color: var(--accent); }
  .project-gallery .featured { grid-column: 1 / -1; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 32px; padding: 28px 0 32px; }
  .project-gallery .featured .project-art { grid-column: 1; grid-row: 1 / 3; aspect-ratio: 3 / 2; }
  .project-gallery .featured .project-name { grid-column: 2; grid-row: 1; padding-top: 18px; }
  .project-gallery .featured h3 { font: 400 42px/1.15 var(--serif); letter-spacing: -1px; }
  .project-gallery .featured .project-description { grid-column: 2; grid-row: 2; height: auto; }
  .portfolio-paper .more-work { margin-top: 18px; }
}
@media (min-width: 761px) and (max-width: 940px) {
  .portfolio-paper { padding-inline: 32px; }
  .portfolio-paper .intro { column-gap: 24px; }
  .portfolio-paper .intro h1 { font-size: 58px; }
  .project-gallery { column-gap: 26px; }
  .project-gallery .featured { column-gap: 22px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .project-gallery .featured .project-name { padding-top: 0; }
  .project-gallery .featured h3 { font-size: 34px; }
}

@media (max-width: 760px) {
  body { padding: 16px; }
  .paper { padding: 0 30px; }
  .site-header { gap: 22px; }
  .main-nav { gap: 20px; }
  .intro { padding-top: 32px; }
  .edition { display: none; }
  .project, .project.featured { grid-template-columns: 130px minmax(0, 1fr) 18px; gap: 8px 18px; }
  .contributions { column-gap: 24px; }
}
@media (max-width: 540px) {
  body { padding: 0; }
  .paper { border: 0; padding: 0 22px; box-shadow: none; min-height: 100svh; }
  .site-header { display: grid; grid-template-columns: 1fr auto; min-height: 0; gap: 0 16px; padding-top: 12px; }
  .brand { font-size: 32px; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; margin: 6px 0 0; justify-content: space-between; gap: 20px; font-size: 14px; }
  .main-nav a { justify-content: center; min-width: 44px; }
  .theme-switch { grid-column: 2; grid-row: 1; gap: 0; padding: 2px; }
  .theme-switch button { min-height: 44px; min-width: 50px; padding: 4px 8px; font-size: 13px; }
  .intro { padding-top: 26px; }
  .eyebrow { letter-spacing: .3px; font-size: 12px; }
  .eyebrow > span { margin-left: 4px; }
  .intro h1 { font-size: clamp(48px, 13vw, 60px); letter-spacing: -2px; margin-top: 16px; }
  .intro-title { font-size: 22px; }
  .intro-copy { font-size: 16px; line-height: 1.85; }
  .intro-bottom { margin-top: 22px; line-height: 1.9; }
  .section { margin-top: 30px; }
  .section-heading { padding-bottom: 12px; gap: 4px 12px; }
  .section-heading h2 { font-size: 15px; }
  .section-aside { font-size: 13px; }
  .project, .project.featured { grid-template-columns: 86px minmax(0, 1fr) 18px; gap: 14px 12px; padding: 22px 0; }
  .project-name { align-self: center; }
  .project h3 { font-size: 18px; line-height: 1.5; overflow-wrap: anywhere; }
  .project-kind { margin-top: 4px; font-size: 13px; }
  .project-art { grid-column: 1; grid-row: 1; aspect-ratio: 1; height: auto; }
  .project-description { grid-column: 1 / -1; grid-row: 2; }
  .project-description p { font-size: 16px; line-height: 1.8; }
  .project > .arrow { align-self: center; }
  .project.featured .project-art { grid-column: 1 / -1; grid-row: 1; aspect-ratio: 2 / 1; }
  .project.featured .project-name { grid-column: 1 / 3; grid-row: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .project.featured > .arrow { grid-row: 2; }
  .project.featured .project-description { grid-row: 3; }
  .project-status { font-size: 13px; margin-top: 10px; }
  .note-link h3 { font-size: 16px; font-weight: 500; }
  .contribution strong { font-size: 16px; }
  .footer-legal { font-size: 12px; }
  .more-work { gap: 6px; }
  .all-projects { margin-left: 0; flex-basis: 100%; }
  .contributions { grid-template-columns: 1fr; }
  .contribution { padding: 14px 0; }
  .note-link { grid-template-columns: minmax(0, 1fr) 18px; gap: 4px 12px; padding: 17px 0; }
  .note-link time { grid-column: 1/-1; }
  .contact { display: block; margin-top: 26px; padding: 24px 0 30px; }
  .contact h2 { font-size: 18px; }
  .copy-control { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 18px; text-align: left; }
  #copyStatus { position: static; white-space: normal; }
  .footer-legal { flex-direction: column; gap: 0; }
  .notes-hero h1 { font-size: 36px; }
  .post { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .pics { grid-column: 1; }
}
@media (max-width: 360px) {
  .paper { padding-inline: 18px; }
  .site-header { gap: 10px; }
  .main-nav { gap: 10px; }
  .eyebrow > span { display: block; margin: 3px 0 0; }
  .section-number { margin-right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  :root { color-scheme: light; }
  body { padding: 0; background: white; }
  .paper { max-width: none; box-shadow: none; border: 0; --paper: white; --ink: #222; --muted: #555; --line: #ccc; --accent: #733522; }
  .paper::before, .theme-switch, .copy-control, .skip-link { display: none; }
  .project, .contribution, .post { break-inside: avoid; }
}
