/* Layout and type. Colours live in theme.css. No italics anywhere. */
*, *::before, *::after { box-sizing: border-box; min-width: 0; }
*, em, i, cite, address, blockquote, dfn, var { font-style: normal !important; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 "Inter Tight", Arial, sans-serif; overflow-x: clip; }
img { max-width: 100%; display: block; }
a { color: inherit; }
b, strong { font-weight: 700; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

.pad { padding-left: max(5vw, 16px, env(safe-area-inset-left, 0px)); padding-right: max(5vw, 16px, env(safe-area-inset-right, 0px)); }
.wrap { max-width: 1240px; margin-inline: auto; }

.skip { position: fixed; left: 12px; top: 12px; z-index: 5; background: var(--bg); padding: 10px 14px; transform: translateY(-200%); }
.skip:focus { transform: none; }

/* Missing-content labels */
.missing { display: inline-block; background: var(--missing); color: var(--on-missing); font-weight: 800; font-size: .8em; letter-spacing: 0; line-height: 1.3; padding: .15em .5em; border-radius: 3px; vertical-align: .1em; white-space: nowrap; }
.missing-block { display: grid; place-items: center; text-align: center; background: repeating-linear-gradient(45deg, var(--missing) 0 14px, color-mix(in srgb, var(--missing) 82%, #fff) 14px 28px); color: var(--on-missing); font-weight: 800; padding: 24px; }
h1 .missing, .name .missing { font-size: .42em; vertical-align: middle; }

/* Header */
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-block: 20px; font-size: 15px; }
.brand { font-weight: 800; text-decoration: none; }
.nav { display: flex; gap: 22px; flex-wrap: wrap; }
.nav a { text-decoration: none; }
.nav a:hover { color: var(--primary); }
.nav a[aria-current] { font-weight: 700; box-shadow: inset 0 -3px var(--primary); }

/* Home */
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 32px 48px; align-items: end; padding-block: clamp(32px, 6vw, 88px) clamp(40px, 6vw, 80px); }
.name { font-weight: 900; font-size: clamp(56px, 11vw, 150px); line-height: .88; letter-spacing: -.055em; margin: 0; }
.intro { font-size: clamp(17px, 1.6vw, 21px); line-height: 1.45; margin: 0; }
.intro b { font-weight: 800; }
.work { background: var(--primary); color: var(--on-primary); padding-block: clamp(36px, 5vw, 72px); }
.work-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: clamp(24px, 3vw, 40px); }
.work-head h2 { font-weight: 900; font-size: clamp(36px, 5vw, 64px); letter-spacing: -.045em; line-height: 1; margin: 0; }
.work-head span { font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 24px; }
.tile { text-decoration: none; display: block; }
.tile .im { aspect-ratio: 4 / 3; overflow: hidden; background: #fff; }
.tile .im img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.tile .im.fit img { object-fit: contain; padding: 6%; }
.tile:hover .im img { transform: scale(1.04); }
.tile .cat { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 700; margin: 14px 0 4px; }
.tile .cat span { font-weight: 400; white-space: nowrap; }
.tile h3 { margin: 0; font-weight: 900; font-size: clamp(21px, 1.9vw, 26px); line-height: 1.05; letter-spacing: -.03em; }
.tile:hover h3 { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; }

/* Project page */
.head .wrap { padding-block: clamp(28px, 5vw, 64px) clamp(24px, 3vw, 40px); }
.back { font-size: 15px; font-weight: 700; text-decoration: none; display: inline-block; margin-bottom: 22px; }
.back:hover { color: var(--primary); }
.kicker { font-size: 16px; margin: 0 0 10px; }
.kicker b { font-weight: 800; color: var(--primary); margin-right: 12px; }
h1 { font-weight: 900; font-size: clamp(44px, 8vw, 112px); line-height: .92; letter-spacing: -.05em; margin: 0; max-width: 14ch; }
.hook { font-size: clamp(19px, 2vw, 24px); line-height: 1.35; margin: 18px 0 0; max-width: 40ch; }
.cover { max-width: 1240px; margin-inline: auto; aspect-ratio: 16 / 8; background: #f3f3f3; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover.fit img { object-fit: contain; padding: 3%; }
.main { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); padding-block: clamp(32px, 5vw, 64px); align-items: start; }
.card { background: var(--primary); color: var(--on-primary); padding: 26px 26px 24px; position: sticky; top: 20px; }
.card h2 { font-weight: 900; font-size: 22px; letter-spacing: -.02em; margin: 0 0 14px; line-height: 1.1; }
.card dl { margin: 0; }
.card .row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid color-mix(in srgb, var(--on-primary) 40%, transparent); font-size: 15px; line-height: 1.4; }
.card dt { font-weight: 800; }
.card dd { margin: 0; }
.result { margin-top: 16px; background: var(--accent); color: var(--on-accent); padding: 14px 16px; }
.result b { display: block; font-weight: 900; font-size: clamp(22px, 2.2vw, 28px); letter-spacing: -.03em; line-height: 1.05; margin-bottom: 4px; }
.result span { font-size: 14px; line-height: 1.35; display: block; }
.body p { margin: 0 0 22px; max-width: 62ch; }
.body p:first-child { font-size: clamp(19px, 1.8vw, 22px); line-height: 1.5; }
.body p:first-child b { font-weight: 800; }
.body .note { font-size: 14px; color: var(--muted); border-left: 3px solid var(--rule); padding-left: 14px; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.links a { font-size: 15px; font-weight: 700; text-decoration: none; border: 2px solid var(--ink); padding: 8px 14px; }
.links a:hover { background: var(--ink); color: var(--bg); }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 24px; padding-block: 0 clamp(48px, 7vw, 96px); }
.gallery figure { margin: 0; }
.gallery .im { background: #f3f3f3; aspect-ratio: 4 / 3; overflow: hidden; }
.gallery img { width: 100%; height: 100%; object-fit: contain; }
.gallery figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }
.next { background: var(--primary); color: var(--on-primary); padding-block: clamp(32px, 5vw, 64px); }
.next a { text-decoration: none; display: block; }
.next span { font-size: 15px; font-weight: 700; }
.next strong { display: block; font-weight: 900; font-size: clamp(34px, 6vw, 80px); letter-spacing: -.05em; line-height: .95; margin-top: 8px; }
.next a:hover strong { text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 8px; }

/* About */
.about .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: clamp(28px, 5vw, 72px); padding-block: clamp(28px, 5vw, 64px); align-items: start; }
.portrait { aspect-ratio: 4 / 5; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.about-text p { margin: 0 0 20px; max-width: 62ch; }
.about-text p:first-of-type { font-size: clamp(19px, 1.8vw, 22px); line-height: 1.5; }
.resume { background: var(--primary); color: var(--on-primary); padding-block: clamp(36px, 5vw, 72px); }
.resume-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 28px; }
.resume-head h2 { font-weight: 900; font-size: clamp(36px, 5vw, 64px); letter-spacing: -.045em; line-height: 1; margin: 0; }
.btn { display: inline-block; font-weight: 800; font-size: 16px; text-decoration: none; background: var(--on-primary); color: var(--primary); padding: 12px 20px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 56px; }
.cols h3 { font-weight: 900; font-size: 24px; letter-spacing: -.02em; margin: 0 0 4px; padding-bottom: 10px; border-bottom: 2px solid var(--on-primary); }
.entry { padding: 16px 0; border-bottom: 1px solid color-mix(in srgb, var(--on-primary) 40%, transparent); }
.entry .top { display: flex; justify-content: space-between; gap: 16px; }
.entry h4 { margin: 0; font-weight: 800; font-size: 18px; line-height: 1.3; }
.entry .top > h4 { flex: 1; }
.entry .dates { white-space: nowrap; font-size: 15px; flex: none; }
.entry .org { margin: 2px 0 6px; font-size: 16px; }
.entry p { margin: 0; font-size: 15px; line-height: 1.5; }

/* Footer */
.site-footer { padding-block: 40px 32px; }
.site-footer .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 40px; align-items: end; }
.site-footer h2 { font-weight: 900; font-size: clamp(28px, 3.4vw, 44px); letter-spacing: -.04em; line-height: 1; margin: 0 0 14px; }
.contact { display: flex; flex-wrap: wrap; gap: 10px 28px; font-size: 16px; margin: 0; }
.contact a { font-weight: 700; }
.small { font-size: 14px; color: var(--muted); margin: 18px 0 0; }
.palettes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.palettes b { margin-right: 4px; }
.palettes button { display: inline-flex; align-items: center; gap: 8px; font: 600 14px "Inter Tight", sans-serif; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 5px 12px 5px 5px; min-height: 38px; cursor: pointer; }
.palettes button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 800; }
.palettes i { display: inline-block; width: 26px; height: 26px; border-radius: 50%; }

@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .hero .wrap, .main, .about .wrap, .cols, .site-footer .wrap { grid-template-columns: 1fr; }
  .card { position: static; }
  .cover { aspect-ratio: 4 / 3; }
  .portrait { max-width: 360px; }
}
@media (max-width: 560px) {
  .grid, .gallery { grid-template-columns: 1fr; }
  .site-header .wrap { flex-wrap: wrap; row-gap: 10px; }
  .nav { gap: 16px; font-size: 15px; }
  .card .row { grid-template-columns: 1fr; gap: 2px; }
  .entry .top { flex-direction: column; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
