@font-face {
  font-family: "SiteHeadline";
  src: url("/assets/font-display-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "SiteDisplay";
  src: url("/assets/font-body.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "SiteBold";
  src: url("/assets/font-body-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "SiteDisplay";
  src: url("/assets/font-body-black.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "SiteMedium";
  src: url("/assets/font-body-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
:root {
  --font-display: "SiteHeadline", sans-serif;
  --font-bold: "SiteBold", sans-serif;
  --font-body: "SiteDisplay", sans-serif;
  --font-medium: "SiteMedium", sans-serif;
}
[data-theme="dark"] {
  --bg: #2E3440; --bg-elevated: #3B4252; --border: #4C566A;
  --text: #E5E9F0; --text-muted: #D8DEE9; --text-bright: #ECEFF4;
  --accent: #88C0D0; --accent-dim: #5E81AC;
}
[data-theme="light"] {
  --bg: #ECEFF4; --bg-elevated: #E5E9F0; --border: #D8DEE9;
  --text: #2E3440; --text-muted: #4C566A; --text-bright: #2E3440;
  --accent: #5E81AC; --accent-dim: #81A1C1;
}
* { box-sizing: border-box; }
html, body { overscroll-behavior-y: contain; }
body { margin: 0; font-family: var(--font-body), system-ui, sans-serif; background: var(--bg); color: var(--text); }

/* gallery.html */
header { display: flex; align-items: center; gap: 0.6rem; padding: 2rem 1.5rem 1.5rem; }
header h1 { margin: 0; flex: 1; font-family: var(--font-display); font-size: 1.625rem; font-weight: 500; color: var(--text-bright); letter-spacing: 0.02em; }
header button { background: none; border: none; border-radius: 6px; color: var(--text-muted); padding: 0.45rem 0.55rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
header button svg { display: block; }
.search-box { display: none; flex: 1; align-items: center; gap: 0.25rem; }
.search-box input { flex: 1; min-width: 0; padding: 0.45rem 0.65rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: var(--font-body); font-size: 0.9375rem; }
header.search-open h1, header.search-open [data-search-toggle] { display: none; }
header.search-open .search-box { display: flex; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-width, 150px), 1fr)); gap: 1.5rem; padding: 0 1.5rem 3rem; }
.book-card { color: inherit; text-decoration: none; display: block; }
.book-card-cover { position: relative; width: 100%; padding-bottom: 135%; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; margin-bottom: 0.5rem; }
.book-card-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.book-card-cover-initials { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.3125rem; color: var(--text-muted); font-weight: 700; letter-spacing: 0.05em; }
.book-meta-title { font-family: var(--font-medium); font-size: 0.8125rem; color: var(--text-muted); font-weight: 500; margin-top: 0.5rem; }
.book-meta-artist { font-size: 0.75rem; color: var(--text-muted); }
.load-more-sentinel { grid-column: 1 / -1; text-align: center; padding: 1rem 0; color: var(--text-muted); text-decoration: none; font-size: 0.875rem; opacity: 0.6; }
footer.site-footer { padding: 1rem 3rem 1.5rem; display: flex; gap: 1.5rem; flex-wrap: wrap; opacity: 0.6; }
footer.site-footer a { font-size: 0.875rem; color: var(--text-muted); text-decoration: none; }
footer.site-footer span { font-size: 0.875rem; color: var(--text-muted); }
@media (min-width: 768px) {
  header { padding: 2rem 2.5rem 1.5rem; }
  .gallery { padding: 0 2.5rem 3rem; }
}

/* book.html */
.back-link { font-size: 0.875rem; color: var(--text-muted); text-decoration: none; }
.book-page { display: flex; flex-direction: column; }
.book-meta-pane { padding: 1.5rem 1.5rem 1rem; }
.book-meta-pane h1 { margin: 1.25rem 0 0.25rem; font-family: var(--font-display); font-size: 1.375rem; font-weight: 500; color: var(--text-bright); line-height: 1.3; }
.book-meta-pane a.artist-link { font-size: 0.9375rem; color: var(--accent); text-decoration: none; display: block; margin-bottom: 1rem; }
.book-meta-lines { margin-bottom: 1.25rem; font-size: 0.875rem; color: var(--text); line-height: 1.7; }
.section-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 500; }
.book-meta-pane p { margin: 0.4rem 0 0; font-size: 0.875rem; color: var(--text); line-height: 1.65; white-space: pre-wrap; }
.book-meta-section { margin-bottom: 1.25rem; }
.book-links { margin-top: 0.4rem; display: flex; flex-direction: column; gap: 0.3rem; }
.book-links a { font-size: 0.875rem; color: var(--accent); }
.book-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; }
.book-tags span { font-size: 0.75rem; padding: 2px 8px; border-radius: 10px; background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.book-images-pane { padding: 0; }
.book-image-trigger { display: block; width: 100%; padding: 0; margin: 0; background: none; border: none; cursor: zoom-in; }
.book-image-trigger img { display: block; width: 100%; height: auto; }
.book-nav { display: flex; justify-content: space-between; padding: 0.75rem 1.5rem 2rem; }
.book-nav a { background: none; border: none; padding: 0.5rem 0; cursor: pointer; color: var(--text-muted); font-family: var(--font-body); font-size: 0.875rem; opacity: 0.6; text-decoration: none; }

/* Phase 6 resident-gallery overlay: book detail rides above the live gallery */
#book-overlay { position: fixed; inset: 0; z-index: 50; overflow-y: auto; overscroll-behavior-y: contain; background: var(--bg); -webkit-overflow-scrolling: touch; }
#book-overlay[hidden] { display: none; }
/* offscreen pre-build area: attached (so layout + hero decode run) but never seen */
#warm-staging { position: absolute; top: 0; left: -100000px; width: 100vw; pointer-events: none; visibility: hidden; }

/* artist.html / page.html */
.content-page { padding: 2rem 1.5rem 3rem; }
.content-page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.content-page-header button { background: none; border: none; border-radius: 6px; color: var(--text-muted); padding: 0.45rem 0.55rem; cursor: pointer; display: flex; align-items: center; }
.content-page-title { margin: 0 0 0.5rem; font-family: var(--font-display); font-size: 1.875rem; font-weight: 500; color: var(--text-bright); }
.artist-meta { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.artist-meta span { font-size: 0.9375rem; color: var(--text-muted); }
.artist-meta a { font-size: 0.9375rem; color: var(--accent); text-decoration: none; }
.artist-bio { max-width: 600px; font-size: 0.9375rem; color: var(--text); line-height: 1.7; white-space: pre-wrap; margin: 0 0 2.5rem; }
.artist-books { display: flex; flex-wrap: wrap; gap: 1.75rem; margin-bottom: 2rem; }
.artist-book-card { width: 140px; flex-shrink: 0; color: inherit; text-decoration: none; display: block; }
.artist-book-cover { width: 140px; height: 190px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; margin-bottom: 0.5rem; border: 1px solid var(--border); }
.artist-book-cover picture, .artist-book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.artist-book-cover-initials { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 1.3125rem; color: var(--text-muted); font-weight: 700; }
.artist-book-title { font-family: var(--font-bold); font-size: 0.8125rem; color: var(--text); font-weight: 700; line-height: 1.3; margin-bottom: 2px; }
.artist-book-year { font-size: 0.75rem; color: var(--text-muted); }
@media (min-width: 768px) {
  .content-page { padding: 2.5rem 3rem 3rem; }
}

/* page.html markdown body */
.page-body { max-width: 640px; font-size: 0.9375rem; color: var(--text); line-height: 1.7; }
.page-body p { margin: 0 0 1rem; }
.page-body h2 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 500; color: var(--text-bright); margin: 2rem 0 0.5rem; }
.page-body h3 { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 500; color: var(--text-bright); margin: 1.5rem 0 0.4rem; }
.page-body a { color: var(--accent); text-decoration: none; }
.page-body a:hover { text-decoration: underline; }
.page-body ul, .page-body ol { padding-left: 1.5rem; margin: 0 0 1rem; }
.page-body li { margin-bottom: 0.25rem; }
.page-body code { font-family: monospace; font-size: 0.875em; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 3px; padding: 0.1em 0.35em; }
.page-body pre { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 4px; padding: 1rem 1.25rem; overflow-x: auto; margin: 0 0 1rem; }
.page-body pre code { background: none; border: none; padding: 0; font-size: 0.875rem; }
.page-body blockquote { margin: 0 0 1rem; padding: 0.5rem 1rem; border-left: 3px solid var(--border); color: var(--text-muted); }
.page-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

@media (min-width: 768px) {
  .book-page { flex-direction: row; }
  .book-meta-pane {
    width: 28%; min-width: 240px; max-width: 360px; flex-shrink: 0;
    padding: 2rem 2rem 3rem; position: sticky; top: 0; align-self: flex-start;
    max-height: 100vh; overflow-y: auto;
    scrollbar-width: none;
  }
  .book-meta-pane::-webkit-scrollbar { display: none; }
  .book-images-pane { flex: 1; padding: 0; max-width: var(--img-col-width, 900px); }
}
