:root {
  /* Half of a crossfade: the visible image fades out, the new src swaps in
     (already warmed by prefetchImg, so effectively instant), then it fades
     back in. app.js reads this value so JS timing can't drift from the CSS.
     Keep the unit in ms — app.js parses the number directly. */
  --fade: 180ms;
  /* Desktop: the column holding the name and the links, and the column of
     work beside it, centred together in the window so the links sit close to
     the images rather than out at the window's edge. The work column grows
     with a wide window, so landscapes keep their size on a large screen.
     js/app.js mirrors these in SIZES_SERIES; change one, change the other. */
  --side: 15rem;
  --work: max(58rem, 64vw);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

.hp {
  position: absolute;
  left: -9999px;
}

.skip-nav {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 0.5rem 1rem;
  background: #222;
  color: #fff;
  font-size: 0.85rem;
  text-decoration: none;
}

.skip-nav:focus { left: 0; }

:focus-visible {
  outline: 2px solid #222;
  outline-offset: 2px;
}

/* The series view is a tabindex="-1" landing spot, not a control: app.js moves
   focus here when a series opens so a keyboard or screen-reader user lands in
   the new content instead of back at the top of the document. Nothing can Tab
   to it, so the ring marks no reachable target — it just draws a 1400px box
   around the whole view, which is what a visitor sees on any deep link, since
   Chrome treats programmatic focus with no prior interaction as keyboard
   focus. Controls inside it keep their rings. */
.series-view:focus,
.series-view:focus-visible { outline: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #fff;
  color: #222;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ---- Masthead: the name and the links ----
   The name sits at the top left with the links beneath it, set apart from
   the work so the images have a space of their own. Above 900px the two form
   a column that stays in place beside the work, the pair centred in the
   window (see the media query below); narrower screens stack them at the
   top, left-aligned, with a wide margin before the work. */
header {
  padding: 2.5rem 2rem 1rem;
}

header h1 {
  font-size: 1.32rem;
  font-weight: 400;
  letter-spacing: 0.2em;
}

/* The name is the way home, so it reads as the name, never as a link. */
header h1 a {
  color: inherit;
  text-decoration: none;
}

/* Wraps rather than overflows: the links plus their letter-spacing exceed a
   320px viewport, which is what body { overflow-x: hidden } used to mask.
   Wrapping keeps it contained regardless of how many links or how long a
   name the header carries. */
nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.75rem;
  padding: 0 2rem 3.5rem;
  font-size: 0.88rem;
  letter-spacing: 0.12em;
}

nav a {
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}

nav a:hover, nav a.active { color: #008555; }

nav a.ig { display: inline-flex; align-items: center; }
/* Deliberately quieter than the text links: the contact page is the way in.
   #949494 is about as light as it can go and still meet the 3:1 contrast a
   meaningful icon needs on white. */
nav a.ig svg { width: 13px; height: 13px; fill: #949494; transition: fill 0.2s; }
nav a.ig:hover svg { fill: #00A86B; }

/* A category's own series, listed under it while it is open. Built by
   app.js; shown in the desktop column only, since on a phone the category
   page itself is the list. */
nav .subnav { display: none; }

/* The page is a grid of two columns, centred: the masthead down the first,
   sticky so it stays put as the page scrolls, and main above the footer in
   the second. Everything else in <body> is positioned or hidden, so takes no
   cell. */
@media (width > 900px) {
  body {
    display: grid;
    grid-template-columns: var(--side) minmax(0, var(--work));
    grid-template-rows: 1fr auto;
    justify-content: center;
    min-height: 100vh;
    padding: 0 3rem;
  }

  .masthead {
    grid-area: 1 / 1 / 3 / 2;
    align-self: start;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    padding: 3rem 1.5rem 2rem 0;
  }

  header { padding: 0; }

  nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 2.75rem 0 0;
    font-size: 0.82rem;
  }

  nav .subnav:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin: -0.1rem 0 0.2rem 0.9rem;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
  }

  nav a.ig { margin-top: 0.4rem; }

  /* Every view sits to the right of the column, starting level with the name. */
  main {
    grid-area: 1 / 2;
    min-width: 0;
    padding-top: 3rem;
  }

  footer { grid-area: 2 / 2; }
}

/* ---- More series: the rest of a category, beneath the open series ----
   One cover at a time down the page, each centred with its name beneath and
   a fine rule above, so the series read as separate bodies of work rather
   than one wall of paintings. On desktop the first rule sits just above the
   bottom of the window, a hint that the page goes on. */
.more-series-list {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 3rem;
}

.more-series-item {
  border-top: 1px solid #e6e6e6;
  padding: 5rem 0;
}

/* Beside a series the thumbnail rail takes the right of the row, so the open
   work is centred left of it. Keeping the same space clear on the right here
   puts each cover on the same centre line as the work above. */
@media (width > 900px) {
  .more-series { padding-right: calc(80px + 2.5rem); }
}

@media (600px < width <= 900px) {
  .more-series { padding-right: calc(60px + 1.5rem); }
}

/* Series tiles and thumbnails are real <button>s so Enter/Space, focus order,
   and AT role come from the platform instead of a tabindex/keydown shim.
   These strip the UA button chrome without touching the semantics. */
.series-tile,
.thumb-rail .thumb {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  display: block;
  cursor: pointer;
}

/* The tile is exactly as wide as its cover: the long side of a portrait at
   about half the window's height, a landscape at most 34rem across. --ratio
   is the work's width over its height, set by app.js. */
.series-tile {
  width: min(100%, 34rem, 52vh * var(--ratio, 1));
  margin: 0 auto;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.series-tile.loaded { opacity: 1; }

/* <span> so it's valid inside the <button> tile; block so it can take a size.
   The frame carries the border and clips the hover zoom, so the edge stays
   put. */
.series-tile .tile-img {
  display: block;
  aspect-ratio: var(--ratio, 1);
  overflow: hidden;
  background: #f5f5f5;
  border: 2px solid #e0e0e0;
}

.series-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

/* View fade-in */
.fade-view {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.fade-view.in { opacity: 1; }

.series-tile:hover img { transform: scale(1.04); }

/* The text under the images is a touch smaller than the links and a shade
   lighter than the name, so the work leads. */
.series-label {
  display: block;
  padding: 1rem 0 0;
  text-align: center;
}

.series-label span {
  color: #555;
  font-size: 0.76rem;
  font-weight: 300;
  letter-spacing: 0.12em;
}

/* ---- Home slideshow ---- */
.home {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 3rem;
}

.home-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home-slide .img-wrap {
  width: 100%;
  height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-slide img {
  max-width: 100%;
  max-height: 72vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border: 2px solid #e0e0e0;
}

/* The hero is a single static work, so it is visible from first paint — no
   JavaScript involved. These are the crossfade states the slideshow drove; they
   pair with the commented-out markup in index.html and slideshow in js/app.js.
.home-slide img { opacity: 0; transition: opacity var(--fade) ease; }
.home-slide img.visible { opacity: 1; }
.home-slide img.fading { opacity: 0; } */

.home-nav {
  position: absolute;
  top: 40%;
  background: none;
  border: none;
  color: #767676;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s;
  user-select: none;
}

.home-nav:hover { color: #008555; }
.home-prev { left: 0.5rem; }
.home-next { right: 0.5rem; }

/* ---- Series Detail View ---- */
.series-view {
  display: none;
  height: calc(100vh - 160px);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.series-view.visible { display: flex; gap: 1.5rem; }
.series-view.in { opacity: 1; }


/* Main image area */
.main-image {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: calc(100vh - 280px);
}

.main-image img {
  max-width: 100%;
  max-height: calc(100vh - 280px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border: 2px solid #e0e0e0;
  transition: opacity var(--fade) ease;
}

.main-image img.swapping { opacity: 0; }

/* The desktop series view, beside the masthead column. The artwork is drawn
   at about 79% of the pane's height (80% of the space, enlarged 15%, trimmed
   14.5%), so it reads large without filling the window edge to edge, and
   sits vertically centred in the pane. It may span the work column, which
   the page's own margins keep clear of the window's edge. Caption type is
   20% smaller here, a touch smaller than the links beside it. */
@media (width > 600px) {
  .main-image-info .title { font-size: calc(0.95rem * 0.8); }
  .main-image-info .meta { font-size: calc(0.8rem * 0.8); }
}

@media (width > 900px) {
  .series-view { height: calc(100vh - 6rem); padding: 0; }
  .series-view.visible { gap: 2.5rem; }
  .main-image { min-height: 0; }
  .main-image img {
    max-width: 100%;
    max-height: calc((100vh - 10rem) * 0.8 * 1.15 * 0.9 * 0.95);
  }
}

/* Mobile carousel (built in JS, shown only at <=600px; see media query) */
.carousel { display: none; }
/* Home thumbnail footer is mobile-only (desktop home stays a clean hero) */
#home-thumb-rail { display: none; }

.main-image-info {
  text-align: center;
  padding-top: 1rem;
}

.main-image-info .title {
  font-size: 0.95rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: #555;
}

.main-image-info .meta {
  font-size: 0.8rem;
  color: #767676;
  margin-top: 0.25rem;
  letter-spacing: 0.03em;
  line-height: 1.45;
  white-space: pre-line;
}

/* Thumbnail rail (right side, vertical) */
.thumb-rail {
  width: 80px;
  flex-shrink: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0;
  scrollbar-width: none;
}

.thumb-rail::-webkit-scrollbar { display: none; }

.thumb-rail .thumb {
  width: 100%;
  aspect-ratio: 1;
  cursor: pointer;
  overflow: hidden;
  opacity: 0.4;
  transition: opacity 0.25s;
  flex-shrink: 0;
}

.thumb-rail .thumb:hover { opacity: 0.75; }
.thumb-rail .thumb.active { opacity: 1; }

.thumb-rail .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---- About ---- */
.about {
  display: none;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
  line-height: 1.8;
  font-size: 0.95rem;
  color: #444;
}

.about.visible { display: block; }
.about p { max-width: 600px; margin-left: auto; margin-right: auto; }
.about p + p { margin-top: 1rem; }

.cv {
  margin-top: 2.5rem;
  padding-left: calc((100% - 600px) / 2);
}

.cv h3 {
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: #333;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.cv ul {
  list-style: none;
  font-size: 0.88rem;
  color: #555;
  line-height: 1.8;
}

.cv .cv-year {
  display: inline-block;
  width: 4.5rem;
  flex-shrink: 0;
  color: #767676;
}

.cv li {
  display: flex;
}

.cv a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #ddd;
  transition: border-color 0.2s;
}

.cv a:hover { border-color: #008555; }

/* ---- Blog ---- */
.blog {
  display: none;
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

.blog.visible { display: block; }

.blog-posts { list-style: none; }
.blog-posts p { font-size: 0.95rem; color: #444; }

.blog-post {
  padding: 1.5rem 0;
  border-bottom: 1px solid #eee;
}

.blog-post:first-child { padding-top: 0; }

.blog-post .post-title {
  font-size: 0.95rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: #333;
}

.blog-post .post-title a {
  color: inherit;
  text-decoration: none;
}

.blog-post .post-title a:hover { color: #008555; }

.blog-post .post-date {
  font-size: 0.8rem;
  color: #999;
  margin-top: 0.25rem;
  letter-spacing: 0.03em;
}

.blog-post .post-excerpt {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
  line-height: 1.6;
}

/* ---- Contact ---- */
.contact {
  display: none;
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

.contact.visible { display: block; }

.contact-intro {
  text-align: center;
  margin-bottom: 1.25rem;
}

/* The two invitations on the page, the form's and the mailing list's, read
   as one voice: same size, same colour, both centred. */
.contact-intro,
.mailing-list p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #444;
}

.contact form { display: flex; flex-direction: column; gap: 1rem; }

.contact input,
.contact textarea,
.ml-row input {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #ddd;
  background: #fafafa;
  color: #222;
  outline: none;
  transition: border-color 0.2s;
}

.contact input:focus,
.contact textarea:focus,
.ml-row input:focus { border-color: #999; }

.contact textarea { resize: vertical; min-height: 120px; }

.contact button,
.ml-row button {
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  padding: 0.75rem 1.3rem;
  border: 1px solid #222;
  background: #222;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.contact button { align-self: flex-start; }

.contact button:hover,
.ml-row button:hover { background: #fff; color: #222; }

.contact .or-email {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
  font-size: 0.85rem;
  color: #767676;
}

.contact .email-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: #222;
  text-decoration: none;
  border-bottom: 1px solid #ccc;
  padding-bottom: 1px;
  transition: border-color 0.2s;
}

.contact .email-link:hover { border-color: #222; }

.contact .form-sent {
  font-size: 0.9rem;
  color: #444;
  line-height: 1.6;
}

.mailing-list {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #eee;
}

.mailing-list p {
  text-align: center;
  margin-bottom: 0.75rem;
}

.ml-row {
  display: flex;
  gap: 0.5rem;
}

.ml-row input { flex: 1; }

.ml-msg {
  font-size: 0.82rem;
  margin-top: 0.5rem;
  color: #767676;
}

.ml-msg.error { color: #c44; }
.ml-msg.success { color: #008555; }

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 3rem 2rem;
  font-size: 0.7rem;
  color: #767676;
  letter-spacing: 0.05em;
}

footer a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #d6d6d6;
  padding-bottom: 1px;
}

footer a:hover { color: #222; border-bottom-color: #222; }

/* ---- Privacy modal ----
   The policy is a dialog rather than its own page: a standalone route would
   need its own stylesheet and its own SRI hashes (integrity.py only rewrites
   index.html), so it drifted out of the site's type and colour the moment the
   stylesheet moved. Living in the shell it is styled by the same rules as
   everything else, for free. The footer link keeps a real /privacy href —
   app.js intercepts the click, and the rewrite resolves it for anyone who
   opens it in a new tab. */
.legal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1500;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgb(255 255 255 / 92%);
}

.legal-overlay.open { display: flex; }

.legal-modal {
  position: relative;
  width: min(100%, 34rem);
  max-height: 100%;
  overflow-y: auto;
  padding: 2.5rem;
  background: #fff;
  border: 1px solid #e6e6e6;
  color: #444;
  font-size: 0.82rem;
  line-height: 1.75;
}

.legal-modal h2 {
  margin: 0 0 1.25rem;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #767676;
}

.legal-modal p + p { margin-top: 0.9rem; }

.legal-modal a {
  color: #222;
  text-decoration: none;
  border-bottom: 1px solid #d6d6d6;
}

.legal-modal a:hover { border-bottom-color: #222; }

.legal-close {
  position: absolute;
  top: 0.9rem;
  right: 1rem;
  border: none;
  background: none;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  color: #767676;
  cursor: pointer;
}

.legal-close:hover { color: #222; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .thumb-rail { width: 60px; }
}

@media (max-width: 600px) {
  header { padding: 2rem 1.5rem 0.75rem; }
  header h1 { font-size: 1.21rem; }
  nav { gap: 0.6rem 1.2rem; font-size: 0.7rem; padding: 0 1.5rem 2.5rem; }
  .more-series { margin-top: 3rem; }
  .more-series-item { padding: 3.5rem 0; }

  /* Home shows the same single work on mobile as on desktop, so the hero stays
     visible here — only the page padding tightens. */
  .home { padding: 0 1rem; }
  .home-slide .img-wrap { height: auto; }

  /* Home as a swipe carousel with a thumbnail footer — see the commented-out
     markup in index.html and slideshow in js/app.js. Uncomment all three to
     bring it back for an artist with more work to show.
  .home-nav { display: none; }
  .home-slide .img-wrap { display: none; }
  #home-thumb-rail { display: flex; margin-top: 1.5rem; } */

  .series-view.visible {
    flex-direction: column;
    height: auto;
    gap: 1rem;
    padding: 0 1rem;
  }
  /* Remove the desktop min-height so the image isn't framed by empty space. */
  .main-image { min-height: auto; }

  /* Swap the single crossfading image for a native scroll-snap carousel. */
  #main-img { display: none; }
  .carousel {
    display: flex;
    width: 100%;
    /* Fixed height, deliberately. Sizing the box to each artwork's own ratio
       does remove the empty space under a landscape, but it moves the layout
       mid-gesture: the height animates while the scroll is still settling, the
       snap loses its footing, and paging through a series stops feeling like
       one surface. A steady box that each painting slides into is worth more
       than a tight one that shifts under your thumb. */
    height: 60vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .carousel::-webkit-scrollbar { display: none; }
  .carousel .slide {
    flex: 0 0 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 0 1rem;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .carousel .slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 2px solid #e0e0e0;
    opacity: 1; /* override .home-slide img { opacity: 0 } from the crossfade */
  }
  .thumb-rail {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 3px;
    padding: 0;
  }
  .thumb-rail .thumb {
    width: 52px;
    aspect-ratio: 1;
  }
  /* Centre the strip under the carousel. Auto margins rather than
     justify-content: center, which pushes the first thumbnails past the left
     edge, out of reach, once a long series overflows and has to scroll; auto
     margins centre when there's room and collapse to nothing when there isn't. */
  .thumb-rail .thumb:first-child { margin-left: auto; }
  .thumb-rail .thumb:last-child { margin-right: auto; }
}

/* ---- Form states ---- */
button:disabled { opacity: 0.5; cursor: default; }

.form-error {
  font-size: 0.85rem;
  color: #c44;
  margin-top: 0.75rem;
  line-height: 1.6;
}

/* ---- Degraded state (app.js failed) ---- */
/* Every view starts hidden and only JS reveals it, so a broken app.js would
   otherwise render a blank page. boot.js sets .js-failed on <html> when app.js
   fails to load, parse, or finish its synchronous init; these rules fall back
   to the same reveal-everything state as css/noscript.css. The home hero has a
   real src in the HTML, and About/Contact are full content, so the degraded
   page is still usable. */
.js-failed .fade-view,
.js-failed .about,
.js-failed .contact {
  opacity: 1 !important;
  display: block !important;
}

.js-failed .home { display: block !important; }
/* The hero is a single static work now, so it paints without help. This stays
   as a belt-and-braces guard for whoever uncomments the crossfade slideshow. */
.js-failed .home-slide img { opacity: 1 !important; }
/* The contact form needs app.js to send, so the address takes its place */
.js-failed .email-fallback { display: block !important; }
/* Nothing can open or close the dialog, so it stops being one and becomes a
   section at the foot of the page. Without this the policy is unreachable:
   the footer link resolves to this same document. */
.js-failed .legal-overlay {
  display: block !important;
  position: static;
  padding: 0 2rem 3rem;
  background: none;
}

@media (width > 900px) {
  .js-failed .legal-overlay { grid-column: 2; }
}

.js-failed .legal-modal { width: auto; margin: 0 auto; }
.js-failed .legal-close { display: none; }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
