/* Layout: paper page with wide side margins; animated name left, brush-stroke filters right; tall-tile gallery */
:root {
  --paper: #f3f1e6;
  --ink: #2b2723;
  --muted: #7d776c;
  --red: #b3141c;
  --blue: #1f5fd6;
  --blue-soft: #a9bde3;
  --lavender: #b0bad8;
  --slot: #e5e2d4;
  --edge: clamp(16px, 7vw, 120px);
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 system-ui, -apple-system, sans-serif; }
/* Page background: halftone texture behind everything. --bg-strength: 0 = plain paper, 1 = full strength. */
:root { --bg-strength: .28; }
body::before { content: ""; position: fixed; inset: -3%; z-index: -1; pointer-events: none;
  background: url("images/background.jpg") center / cover no-repeat; opacity: var(--bg-strength);
  transform: translate3d(var(--bgx, 0%), var(--bgy, 0%), 0); will-change: transform; } /* bg-motion.js drifts it with the mouse */
a { color: inherit; }
[hidden] { display: none !important; }

.top { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; align-items: center;
  padding: 32px var(--edge) 28px; }
.logo { display: block; width: 300px; max-width: 100%; line-height: 0; transform-origin: 20% 50%; transition: transform .45s cubic-bezier(.3,.7,.2,1); }
.logo:hover, .logo:focus-visible { transform: scale(1.07); }
.logo:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
.back { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.back:hover { color: var(--ink); }

/* Filters with an animated brush stroke behind the selected one */
.filters { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.filters button { position: relative; font: inherit; font-size: 0.95rem; letter-spacing: .02em; background: none; border: 0;
  color: var(--muted); padding: 6px 14px; cursor: pointer; transition: color .3s; }
.filters button span:not(.stroke-art) { position: relative; z-index: 1; }
.filters button:hover, .filters button[aria-pressed="true"] { color: var(--ink); }
.filters button:focus-visible, .tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Gallery: tall tiles, zoomed in, ease out on hover */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 40vw), 1fr)); gap: 14px; padding: 0 var(--edge); }
.tile { position: relative; display: block; text-decoration: none;
  box-shadow: 0 0 0 1px rgba(43,39,35,.07), 0 2px 5px rgba(43,39,35,.14), 0 8px 18px rgba(43,39,35,.12);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease; }
@media (hover: hover) {
  .tile:hover, .tile:focus-visible { transform: scale(1.04); z-index: 2;
    box-shadow: 0 0 0 1px rgba(43,39,35,.07), 0 6px 12px rgba(43,39,35,.18), 0 20px 38px rgba(43,39,35,.22); }
}
.thumb { aspect-ratio: 2 / 3; background: hsl(var(--hue, 0) 14% 86%); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.2); transition: transform .5s ease; }
.tile:hover .thumb img, .tile:focus-visible .thumb img { transform: scale(1.02); }
.thumb { position: relative; }
.thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.tile:hover .thumb video { opacity: 1; }
.label { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px; color: #fff; display: flex; flex-direction: column;
  background: linear-gradient(transparent, rgba(20,16,12,.7)); opacity: 0; transition: opacity .25s; }
.label b { font-weight: 500; font-size: 0.95rem; line-height: 1.3; }
.label small { text-transform: uppercase; letter-spacing: .08em; font-size: 0.7rem; opacity: .85; }
.tile:hover .label, .tile:focus-visible .label { opacity: 1; }
@media (hover: none) { .label { opacity: 1; } }
.foot { padding: 48px var(--edge) 56px; font-size: 0.9rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .thumb img, .label, .logo, .tile { transition: none; }
  .tile:hover, .tile:focus-visible { transform: none; }
}

/* Project page */
figure { margin: 0; position: relative; background: var(--slot); aspect-ratio: 1; overflow: hidden; max-width: 100%; }
figure img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
figure span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.75rem; color: var(--muted); padding: 8px; text-align: center; }
.project { max-width: 1100px; margin: 0 auto; padding: 0 var(--edge) 64px; }
.project .text { max-width: 640px; margin: 32px 0; }
.project h1 { font-size: 1.8rem; font-weight: 600; margin: 0 0 12px; line-height: 1.2; text-wrap: balance; }
.project h2 { font-size: 1.1rem; margin: 0 0 8px; }
.project .meta { color: var(--muted); margin: 0 0 4px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .08em; }
.next { margin-top: 48px; }
.project .main { background: none; aspect-ratio: auto; display: flex; justify-content: center; overflow: visible; }
.project .main img { position: static; width: auto; height: auto; max-width: 100%; max-height: 85vh; object-fit: contain; }
.project .main span { display: none; }
.project .main.empty { background: var(--slot); aspect-ratio: 16 / 9; }
.project .main.empty span { display: grid; }
.project .main video { display: block; width: 100%; max-height: 85vh; background: #000; }
.pieces { display: grid; gap: 24px; justify-items: center; }
.pieces img { max-width: 100%; max-height: 85vh; height: auto; display: block; }
.project .main img, .project .main video, .project .main iframe, .pieces img {
  box-shadow: 0 0 0 1px rgba(43,39,35,.07), 0 3px 8px rgba(43,39,35,.14), 0 14px 32px rgba(43,39,35,.16); }

/* About: photo left, bio right; stacks on phones */
.about { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: clamp(24px, 5vw, 72px); align-items: center;
  padding: 72px var(--edge) 0; max-width: calc(1100px + 2 * var(--edge)); }
.portrait { aspect-ratio: 1; border-radius: 50%; background: var(--slot);
  box-shadow: 0 0 0 1px rgba(43,39,35,.07), 0 3px 8px rgba(43,39,35,.14), 0 14px 32px rgba(43,39,35,.16); }
.portrait span { display: none; line-height: 1.5; }
.portrait.empty span { display: grid; }
.about.no-photo { grid-template-columns: 1fr; }
.bio { min-width: 0; max-width: 34em; }
.bio h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; margin: 0 0 20px; font-weight: 600; text-wrap: balance; }
.bio p { margin: 0 0 14px; }
.bio a { text-decoration-color: #d9505a; text-decoration-thickness: 3px; text-underline-offset: 3px; }
@media (max-width: 640px) { .about { grid-template-columns: 1fr; padding-top: 40px; } .portrait { max-width: 320px; } }
@media (max-width: 480px) { .filters { gap: 0; } .filters button { padding: 6px 9px; font-size: 0.9rem; } .logo { width: 210px; } }

/* "Hi, I'm Hal." brush highlight: draws on after the panel settles */
.hl { position: relative; display: inline-block; }
.hl-text { position: relative; z-index: 1; }

/* Hand-drawn accents: two-frame sprites that boil (swap drawings) on a loop */
@keyframes boil { 0%, 49.9% { background-position: 0% 0; } 50%, 100% { background-position: 100% 0; } }
.logo-art { display: block; width: 100%; aspect-ratio: 394 / 284;
  background: url("images/accents/logo.png") 0 0 / 200% 100% no-repeat; animation: boil .34s infinite; }
.stroke-art { position: absolute; pointer-events: none;
  background: url("images/accents/stroke.png") 0 0 / 200% 100% no-repeat; animation: boil .34s infinite;
  clip-path: inset(0 100% 0 0); transition: clip-path .25s ease-in; }

/* Filter highlight paints on left to right */
.filters .stroke-art { left: -4px; right: -4px; top: 50%; height: 30px; transform: translateY(-48%); }
.filters button[aria-pressed="true"] .stroke-art { clip-path: inset(0 0 0 0); transition: clip-path .55s cubic-bezier(.3,.7,.2,1) .1s; }

/* "Hi, I'm Hal." highlight paints on after the panel settles */
.hl .stroke-art { left: -0.15em; right: -0.15em; bottom: calc(-0.12em - 10px); height: 0.42em; z-index: 0; transition: none; }
.about.on .hl .stroke-art { clip-path: inset(0 0 0 0); transition: clip-path 1.1s cubic-bezier(.3,.7,.2,1) .6s; }

/* Name (top left, links home): 10-frame Moho boil */
.name { margin: 0; line-height: 0; }
.name-art { display: block; width: 100%; aspect-ratio: 720 / 195;
  background: url("images/accents/name.png") 0 0 / 1000% 100% no-repeat; animation: boil10 1.66s steps(10) infinite; }
@keyframes boil10 { to { background-position: 111.111% 0; } }

@media (prefers-reduced-motion: reduce) {
  .logo-art, .stroke-art, .name-art { animation: none; }
  .stroke-art, .filters button[aria-pressed="true"] .stroke-art, .about.on .hl .stroke-art { transition: none; }
}

/* Embedded video (Vimeo / YouTube) on project pages */
.project .main.embed { width: 100%; }
.project .main.embed iframe, .project .main.embed video { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; background: #000; }

/* Reading panels: a soft paper box behind text so it stays readable over the background texture.
   Make --panel more or less see-through by changing the last number (1 = solid paper). */
:root { --panel: rgba(243, 241, 230, .92);
  --panel-edge: 0 0 0 1px rgba(43,39,35,.07), 0 3px 8px rgba(43,39,35,.10), 0 12px 28px rgba(43,39,35,.10); }
.bio, .project .text, .foot a, .back, .next a {
  background: var(--panel); box-shadow: var(--panel-edge); border-radius: 3px;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.bio { padding: 28px 32px; }
.project .text { padding: 22px 28px; }
.foot a, .back, .next a { display: inline-block; padding: 6px 12px; }
@media (max-width: 480px) { .bio { padding: 20px 18px; } .project .text { padding: 18px; } }

/* Brush highlights in red: same drawing as stroke.png, recolored (images/accents/stroke-red.png).
   Plain background image rather than a CSS mask, so it also works when previewing from file://. */
.hl .stroke-art, .filters .stroke-art { background-image: url("images/accents/stroke-red.png"); }

/* Hover: a red hand-drawn line draws itself around the tile (just outside its edge) */
.tile .draw { position: absolute; inset: -7px; width: calc(100% + 14px); height: calc(100% + 14px);
  overflow: visible; pointer-events: none; z-index: 3; }
.tile .draw path { fill: none; stroke: #d9505a; stroke-width: 3px; stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .25s ease-in; }
@media (hover: hover) {
  .tile:hover .draw path, .tile:focus-visible .draw path { stroke-dashoffset: 0; transition: stroke-dashoffset .6s cubic-bezier(.3,.7,.2,1); }
}
@media (prefers-reduced-motion: reduce) { .tile .draw path { transition: none !important; } }
