:root {
  --kh-ink: #121212;
  --kh-paper: #e4e2dd;
  --kh-card: #f3f2ee;
  --kh-signal: #c92516;
  --kh-muted: #5c5a55;
  --kh-line: #2a2925;
  --kh-soft: #9a968c;
  --kh-on-ink: #f3f2ee;
  --kh-rule: #c9c6bf;
  --kh-step: 120ms;
  --kh-ease: cubic-bezier(.2, 0, 0, 1);
  /* The room the hero keeps for the cookie bar: the bar is 77px tall at 768 and up, 92px at 600, 148px on a phone. */
  --kh-cookie-reserve: 92px;
  --kh-display: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif;
  --kh-sans: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
}
html { scroll-padding-top: 72px; }
/* The body takes the darkest band so no light canvas shows past the footer; every light band sets its own ground. */
body { font-family: var(--kh-sans); color: var(--kh-ink); line-height: 1.5; font-size: 17px; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--kh-ink); outline-offset: 3px; }

/* Nav: the same ink bar as the home page. */
.kh-hero { position: relative; min-height: calc(100vh - 69px); min-height: calc(100svh - 69px); display: grid; align-content: end; isolation: isolate; color: #fff; }
.kh-hero-pic { position: absolute; inset: 0; z-index: -2; margin: 0; }
.kh-hero-pic img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; display: block; }
.kh-hero-scrim { position: absolute; inset: 0; z-index: -1; background: linear-gradient(to right, rgba(10,10,10,.45) 0%, rgba(10,10,10,.4) 50%, rgba(10,10,10,0) 72%), linear-gradient(to top, rgba(10,10,10,.82) 0%, rgba(10,10,10,.45) 45%, rgba(10,10,10,0) 80%); }
@media (max-width: 600px) {
  .kh-hero-scrim { background: linear-gradient(to top, rgba(10,10,10,.85) 0%, rgba(10,10,10,.7) 45%, rgba(10,10,10,.6) 62%, rgba(10,10,10,0) 82%); }
}
.kh-hero-in { padding: 56px 24px 48px; max-width: 1280px; width: 100%; margin: 0 auto; display: grid; gap: 18px; }
.kh-tag { display: inline-grid; gap: 2px; justify-self: start; margin: 0; background: var(--kh-card); color: var(--kh-ink); padding: 10px 14px 10px 16px; border-left: 4px solid var(--kh-signal); font-size: 14px; line-height: 1.35; }
.kh-tag b { font-family: var(--kh-display); font-size: 20px; text-transform: uppercase; letter-spacing: .02em; font-weight: 800; }
.kh-tag span { color: var(--kh-muted); }
.kh-tag b, .kh-tag span { text-wrap: pretty; }
.kh-hero h1 { font-size: clamp(3rem, 9vw, 7.6rem); max-width: 14ch; text-shadow: 0 2px 18px rgba(0,0,0,.35); }
.kh-sub { font-size: clamp(1.05rem, 1.6vw, 1.3rem); max-width: 52ch; margin: 0; color: #ece9e2; }
.kh-hero-cta { margin: 6px 0 0; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.kh-hero-cta .kh-call { color: #fff; }
/* The text sits on the foot of the photo, so a line parsed late pushes the lines above it up. On a slow connection the browser
   paints before the button row arrives; the block stays hidden until it has, so nothing in it moves once seen. */
.kh-hero-in:not(:has(> .kh-hero-cta)) { visibility: hidden; }

/* Load sequence. The photo starts at .01, not 0, so the browser counts it as painted on the first frame. */
@keyframes kh-fade-in { from { opacity: .01; } to { opacity: 1; } }
@keyframes kh-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.kh-hero-pic { animation: kh-fade-in 900ms ease-out both; }
.kh-seq > * { opacity: 0; animation: kh-rise 520ms var(--kh-ease) forwards; animation-delay: calc(300ms + var(--i, 0) * var(--kh-step)); }

/* Scroll reveals: hidden only once the head script marks the page kh-js, so the content shows with JavaScript off. */
.kh-js .kh-reveal { opacity: 0; transform: translateY(18px); transition: opacity 560ms var(--kh-ease), transform 560ms var(--kh-ease); }
.kh-js .kh-fade { opacity: 0; transition: opacity 560ms ease-out; }
.kh-js .kh-reveal.kh-in, .kh-js .kh-fade.kh-in { opacity: 1; transform: none; }
html:not(.kh-js) img[data-srcset] { display: none !important; }

/* Shared band parts. */
.kh-link { font-weight: 600; color: inherit; text-decoration: underline; text-decoration-color: var(--kh-signal); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.kh-head { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px 64px; align-items: end; margin-bottom: 48px; }
.kh-head h2 { font-size: clamp(2.6rem, 6vw, 5.4rem); }
.kh-head p { margin: 0; max-width: 46ch; font-size: clamp(1.1rem, 1.5vw, 1.3rem); line-height: 1.4; }

/* Photos: each frame holds its box; the loader drops the picture in when it nears the screen. */
.kh-pic { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; margin: 0 0 8px; background: #cfccc5; }
.kh-pic picture { display: contents; }
.kh-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kh-done { background: var(--kh-paper); padding: 88px 0 96px; }
.kh-gal { display: flex; gap: 12px; margin: 0; padding: 0; list-style: none; }
.kh-gal figure { margin: 0; }
.kh-gal .kh-pic { aspect-ratio: var(--kh-ar); }
.kh-gal figcaption { font-size: 14px; color: var(--kh-muted); }
/* The finished gallery on every project page (Task 26D): finished photos first, the lead (a wide photo the hero does not
   show, class kh-lead) the full band wide, the rest two across, the befores last at the same size. Each tile keeps its
   photo's shape through --kh-ar; an odd tile at the end of a run sits at half width. One across at 600px and under.
   The data pages' befores list (.kh-bef) takes the same grid. Build rows keep the justified row above. */
.kh-done .kh-gal, .kh-bef { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 16px; align-items: start; }
.kh-done .kh-gal .kh-lead { grid-column: 1 / -1; }
.kh-done .kh-gal .kh-pic, .kh-bef .kh-pic { margin-bottom: 10px; }
.kh-done .kh-gal figcaption, .kh-bef figcaption { font-size: 15px; line-height: 1.45; max-width: 60ch; }
.kh-ledger { display: grid; grid-template-columns: minmax(9rem, auto) minmax(0, 1fr); margin: 0; border-bottom: 1px solid var(--kh-line); }
.kh-ledger dt, .kh-ledger dd { margin: 0; padding: 14px 0; border-top: 1px solid var(--kh-line); }
.kh-ledger dt { padding-right: 24px; color: var(--kh-soft); font-weight: 600; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; line-height: 1.6; }
.kh-ledger dd { font-size: 17px; max-width: 52ch; }
.kh-say-by { display: grid; gap: 10px; margin: 56px 0 0; }
.kh-say-by blockquote { margin: 0; }
.kh-say-by blockquote p { margin: 0; font-size: clamp(1.15rem, 1.6vw, 1.4rem); line-height: 1.45; max-width: 52ch; }
.kh-say-by > p a { color: inherit; }
.kh-more { background: var(--kh-paper); padding: 88px 0 96px; }
.kh-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px 28px; }
.kh-card { position: relative; display: grid; gap: 6px; align-content: start; transition: transform .18s var(--kh-ease); }
.kh-card h3 a { color: inherit; text-decoration: none; }
.kh-card h3 a::after { content: ''; position: absolute; inset: 0; }
.kh-pic-tag { position: absolute; left: 0; bottom: 0; display: flex; align-items: baseline; gap: 8px; margin: 0; padding: 7px 12px 6px; background: var(--kh-ink); color: #f3f2ee; font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.kh-go { justify-self: start; margin-top: 4px; font-weight: 600; text-decoration: underline; text-decoration-color: var(--kh-signal); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.kh-card:has(a:hover) { transform: translateY(-2px); }
.kh-card:has(a:hover) .kh-go { text-decoration-thickness: 3px; }
.kh-card:has(a:active) { transform: translateY(0); transition-duration: 80ms; }
.kh-all { margin: 48px 0 0; }
.kh-all a { display: inline-flex; align-items: center; min-height: 44px; font-size: 18px; }

/* The schedule on the ink band, signed by Ben. */
.kh-sched { background: var(--kh-ink); color: var(--kh-on-ink); padding: 88px 0 96px; border-bottom: 1px solid var(--kh-line); }
.kh-sched-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px 64px; align-items: end; }
.kh-sched-text .kh-lead { font-size: clamp(1.15rem, 1.6vw, 1.35rem); line-height: 1.4; }
.kh-sched-text p + p { color: #c9c6be; }
.kh-sched-cta { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 24px; margin-top: 28px !important; }
.kh-sign { display: grid; gap: 2px; margin: 32px 0 0 !important; padding-top: 20px; border-top: 1px solid var(--kh-line); }
.kh-sign span { color: var(--kh-soft); font-weight: 600; }
.kh-foot-list a { display: inline-flex; align-items: center; min-height: 32px; color: #e4e1da; text-decoration: none; }
.kh-foot-bottom a, .kh-foot-bottom button { color: var(--kh-soft); text-decoration: none; font: inherit; display: inline-flex; align-items: center; min-height: 28px; }
/* While the bar is up on a first visit, the hero lifts its button clear of it (Codex, 2026-10-25: at 390 the bar covered the button). */
html.kh-cookie-open .kh-hero-in { padding-bottom: calc(48px + var(--kh-cookie-reserve)); }
@media (max-width: 1023px) {
  .kh-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  :root { --kh-cookie-reserve: 148px; }
  .kh-js .kh-nav-links a { min-height: 52px; padding: 0; border-top: 1px solid var(--kh-line); font-size: 17px; }
  .kh-hero { min-height: calc(100svh - 65px); }
  .kh-hero-in { padding: 40px 16px 32px; gap: 14px; }
  html.kh-cookie-open .kh-hero-in { padding-bottom: calc(32px + var(--kh-cookie-reserve)); }
  .kh-hero h1 { font-size: clamp(3rem, 15vw, 4.4rem); }
  .kh-tag { font-size: 13px; }
  .kh-head { margin-bottom: 32px; }
  .kh-gal { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 12px; }
  .kh-done .kh-gal, .kh-bef { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .kh-ledger { grid-template-columns: minmax(0, 1fr); }
  .kh-ledger dt { padding: 14px 0 0; }
  .kh-ledger dd { padding-top: 2px; border-top: 0; }
  .kh-say-by { margin-top: 44px; }
  /* Cards turn into ledger rows, as on the projects page: the photo left, the job right. */
  .kh-cards { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .kh-card { grid-template-columns: 42% minmax(0, 1fr); column-gap: 14px; }
  .kh-pic-tag { padding: 5px 8px 4px; font-size: 12px; }
}
/* Between the phone menu and the full bar, the nav drops its quote button; the hero and the closing band carry it. */

/* Pages from a data file (Task 18). The build row's month under each photo is .kh-build figcaption b in
   project-standard.css. Each row the template writes carries --kh-row, the sum of its photos' shapes, so a row stops
   growing once it is 560px tall: one upright in a build row or in the short form's one row never fills the band.
   The hand-written rows carry no --kh-row and keep their width. */
.kh-gal[style*="--kh-row"] { max-width: calc(var(--kh-row) * var(--kh-cap, 560px)); }
/* A finished gallery of more than three photos' worth of shape runs in two rows or more, so its tiles stay large. */
.kh-gal + .kh-gal { margin-top: 12px; }

/* The befores: a list after the finished gallery, on the same paper band, in the gallery's two-across grid (above). */
.kh-befores { background: var(--kh-paper); padding: 0 0 96px; }
.kh-done:has(+ .kh-befores) { padding-bottom: 56px; }
.kh-bef-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 24px; margin-bottom: 24px; padding-top: 40px; border-top: 1px solid var(--kh-rule); }
.kh-bef-head h2 { font-size: clamp(1.6rem, 2.4vw, 2.2rem); }
.kh-bef-head p { margin: 0; color: var(--kh-muted); }
.kh-bef { list-style: none; margin: 0; padding: 0; }
.kh-bef figure { margin: 0; }
.kh-bef .kh-pic { aspect-ratio: var(--kh-ar); }
.kh-bef figcaption { color: var(--kh-muted); }
.kh-bef-date { display: block; margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--kh-ink); }
@media (max-width: 600px) {
  /* The hero's inline object-position crops the wide photo; the phone cut is already framed around hero.phone. */
  .kh-hero-pic img[style] { object-position: 50% 50% !important; }
  .kh-gal + .kh-gal { margin-top: 16px; }
  .kh-befores { padding-bottom: 64px; }
  .kh-done:has(+ .kh-befores) { padding-bottom: 40px; }
  .kh-bef-head { padding-top: 32px; }
}

/* Reduced motion stays last so it wins every cascade. */
@media (prefers-reduced-motion: reduce) {
  .kh-nav-links a { transition: none; }
  .kh-hero-pic { animation: none; }
  .kh-seq > * { animation: none; opacity: 1; }
  .kh-btn, .kh-card { transition: none; }
  .kh-btn:hover, .kh-card:has(a:hover) { transform: none; }
}
