*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:#1e2a3a; --fg:#e8ecf1; --muted:#8fa3ba;
  --border:#32445c; --active:#d4a24c; --card:#243347;
  --nav-bg:#17212e;
}
body { font-family: Georgia, serif; background: var(--bg); color: var(--fg); line-height: 1.55; min-height: 100vh; }

/* Top nav (every page) */
.top-nav { background: var(--nav-bg); border-bottom: 1px solid var(--border); padding: 12px 24px; display: flex; align-items: center; gap: 24px; position: sticky; top: 0; z-index: 50; flex-wrap: wrap; }
.top-nav .nav-ws { color: var(--muted); text-decoration: none; font-size: 18px; padding: 4px 8px; }
.top-nav .nav-ws:hover { color: var(--active); }
.top-nav .nav-brand { color: var(--active); text-decoration: none; font-weight: 600; font-size: 17px; letter-spacing: 0.02em; }
.top-nav .nav-links { display: flex; gap: 20px; margin-left: auto; }
.top-nav .nav-links a { color: var(--muted); text-decoration: none; font-size: 14px; padding: 4px 2px; border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s; }
.top-nav .nav-links a:hover { color: var(--fg); }
.top-nav .nav-links a.active { color: var(--active); border-bottom-color: var(--active); }

.page { max-width: 1150px; margin: 0 auto; padding: 28px 28px 60px; }
header.page-header { border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 18px; display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
h1 { font-size: 30px; font-weight: 600; letter-spacing: 0.01em; }
.subtitle { color: var(--muted); font-style: italic; font-size: 15px; flex: 1; min-width: 240px; }
.back { color: var(--active); text-decoration: none; font-size: 14px; }
.back:hover { text-decoration: underline; }
.intro { color: var(--muted); max-width: 760px; margin-bottom: 32px; font-size: 15px; }
.hint { color: var(--muted); font-size: 12px; margin-bottom: 18px; font-style: italic; }

/* Section heads on landing / all-works */
h2.section { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; margin: 18px 0 10px; }
h2.section:first-of-type { margin-top: 0; }
h2.section .count { color: var(--muted); font-size: 12px; font-style: italic; text-transform: none; letter-spacing: normal; font-weight: normal; margin-left: 8px; }
h3.continent { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; margin: 18px 0 10px; }
h3.continent:first-child { margin-top: 0; }
h3.era { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; margin: 36px 0 14px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
h3.era:first-of-type { margin-top: 4px; }

/* Text card grid — used on landing for region/artist/museum cards */
.card-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 10px; }
.card { display: block; background: var(--card); border: 1px solid var(--border); padding: 16px 18px; text-decoration: none; color: inherit; transition: border-color 0.15s, transform 0.15s; }
.card:hover { border-color: var(--active); transform: translateY(-1px); }
.card .t { font-size: 16px; font-weight: 600; color: var(--active); margin-bottom: 4px; }
.card .d { font-size: 13px; color: var(--muted); line-height: 1.5; }
.card-more { display: flex; align-items: center; justify-content: center; font-style: italic; color: var(--muted); }
.card-more:hover .t { color: var(--active); }
.card-more .t { color: var(--fg); }

/* Work grid — used in regions/artists/all-works for actual artwork cards */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.work { background: var(--card); border: 1px solid var(--border); overflow: hidden; display: flex; flex-direction: column; }
.work img { width: 100%; height: 240px; object-fit: cover; background: #111; display: block; cursor: zoom-in; transition: opacity 0.15s; }
.work img:hover { opacity: 0.88; }
.work .body { padding: 14px 16px 18px; }
.work .region-badge { display: inline-block; background: var(--bg); color: var(--muted); font-size: 10px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.08em; text-decoration: none; transition: color 0.15s, border-color 0.15s; }
.work a.region-badge:hover { color: var(--active); border-color: var(--active); }
.work .work-artist { font-size: 13px; color: var(--muted); font-style: italic; margin-bottom: 6px; }
.work .work-artist a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--border); padding-bottom: 1px; transition: color 0.15s, border-color 0.15s; }
.work .work-artist a:hover { color: var(--active); border-bottom-color: var(--active); }
.work .t { font-size: 17px; color: var(--active); margin-bottom: 4px; font-weight: 600; }
.work .meta { font-size: 12px; color: var(--muted); font-style: italic; margin-bottom: 8px; }
.work .d { font-size: 14px; color: var(--fg); line-height: 1.55; }

/* Artist view */
.artist-section { margin-bottom: 48px; scroll-margin-top: 80px; }
.artist-name { font-size: 22px; color: var(--active); border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 20px; font-weight: 600; }
.artist-count { color: var(--muted); font-size: 13px; font-weight: normal; font-style: italic; margin-left: 10px; }
.artist-toc { columns: 3; column-gap: 24px; font-size: 14px; margin-bottom: 40px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.artist-toc a { color: var(--fg); text-decoration: none; display: block; padding: 4px 0; }
.artist-toc a:hover { color: var(--active); }
.artist-toc a .c { color: var(--muted); font-size: 12px; margin-left: 6px; font-style: italic; }
@media (max-width: 700px) { .artist-toc { columns: 2; } }
@media (max-width: 420px) { .artist-toc { columns: 1; } }

/* Region prev/next footer */
.region-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 60px; padding-top: 24px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.region-footer a { color: var(--fg); text-decoration: none; font-size: 14px; padding: 10px 14px; border: 1px solid var(--border); background: var(--card); transition: border-color 0.15s; }
.region-footer a:hover { border-color: var(--active); color: var(--active); }
.region-footer .arrow { color: var(--muted); margin: 0 6px; }

/* All-works filter + sort */
.filter-controls { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-controls:last-of-type { margin-bottom: 24px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.load-more-wrap { text-align: center; margin: 30px 0 0; }
.load-more-btn { background: var(--card); border: 1px solid var(--border); color: var(--active); padding: 12px 28px; font-size: 14px; font-family: Georgia, serif; cursor: pointer; letter-spacing: 0.03em; transition: border-color 0.15s, color 0.15s; }
.load-more-btn:hover { border-color: var(--active); }
.load-more-btn[hidden] { display: none; }
.era-chip { background: var(--card); border: 1px solid var(--border); color: var(--muted); padding: 6px 11px; font-size: 12px; cursor: pointer; font-family: Georgia, serif; transition: border-color 0.15s, color 0.15s; }
.era-chip:hover { color: var(--fg); }
.era-chip.active { border-color: var(--active); color: var(--active); }
.era-chip .c { color: inherit; opacity: 0.7; font-size: 11px; margin-left: 4px; font-style: italic; }
.sort-toggle { display: inline-flex; border: 1px solid var(--border); align-self: flex-start; }
.sort-toggle button { background: transparent; border: none; color: var(--muted); padding: 6px 14px; font-size: 13px; cursor: pointer; font-family: Georgia, serif; }
.sort-toggle button.active { background: var(--card); color: var(--active); }
.sort-toggle button:first-child { border-right: 1px solid var(--border); }

/* Timeline */
.tl-era { margin-bottom: 64px; scroll-margin-top: 80px; }
.tl-era-title { font-size: 26px; color: var(--active); border-bottom: 2px solid var(--border); padding-bottom: 10px; margin-bottom: 24px; font-weight: 600; display: flex; align-items: baseline; gap: 14px; }
.tl-era-title .tl-era-count { color: var(--muted); font-size: 13px; font-style: italic; font-weight: normal; }
.work.tl-entry .tl-year { background: var(--nav-bg); color: var(--active); font-family: Georgia, serif; font-size: 15px; font-weight: 600; padding: 8px 14px; border-bottom: 1px solid var(--border); letter-spacing: 0.03em; }

/* Home-page single search (posts to all.html?q=) */
.home-search { margin: 0 0 22px; }
.home-search input { width: 100%; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); color: var(--fg); font-size: 15px; font-family: Georgia, serif; }
.home-search input::placeholder { color: var(--muted); font-style: italic; }
.home-search input:focus { outline: none; border-color: var(--active); }

/* All-works search */
.all-search { margin-bottom: 16px; }
.all-search input { width: 100%; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); color: var(--fg); font-size: 15px; font-family: Georgia, serif; }
.all-search input::placeholder { color: var(--muted); font-style: italic; }
.all-search input:focus { outline: none; border-color: var(--active); }
.all-search .result-count { margin-top: 8px; color: var(--muted); font-size: 13px; font-style: italic; }
.no-results { text-align: center; padding: 60px 20px; color: var(--muted); font-style: italic; display: none; }

/* Page footer (attribution) */
.page-footer { margin-top: 80px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; text-align: center; font-style: italic; }
.page-footer a { color: var(--active); text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }

/* Region tile grid (landing hero) — compact: 5 per row, small image, text-forward */
.region-tiles { display: grid; gap: 10px; grid-template-columns: repeat(5, 1fr); margin: 0 0 22px; }
.region-tile { position: relative; display: block; aspect-ratio: 5 / 3; overflow: hidden; border: 1px solid var(--border); background: var(--card); text-decoration: none; color: inherit; transition: border-color 0.18s, transform 0.18s; }
.region-tile:hover, .region-tile:focus-visible { border-color: var(--active); transform: translateY(-2px); outline: none; }
.region-tile .tile-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(0.55) saturate(0.9); transition: filter 0.25s, transform 0.5s ease; }
.region-tile:hover .tile-img, .region-tile:focus-visible .tile-img { filter: brightness(0.9) saturate(1.05); transform: scale(1.05); }
.region-tile .tile-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 10px 12px 12px; background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.55) 45%, rgba(0,0,0,0.2) 75%, transparent 100%); }
.region-tile .tile-count { position: absolute; top: 8px; right: 10px; color: rgba(255,255,255,0.92); font-size: 11px; font-style: italic; letter-spacing: 0.02em; background: rgba(0,0,0,0.55); padding: 2px 8px; border-radius: 10px; text-shadow: 0 1px 2px rgba(0,0,0,0.8); backdrop-filter: blur(2px); }
.region-tile .tile-title { color: var(--active); font-size: 17px; font-weight: 600; letter-spacing: 0.01em; margin-bottom: 2px; text-shadow: 0 1px 4px rgba(0,0,0,0.8); line-height: 1.15; }
.region-tile .tile-blurb { color: rgba(255,255,255,0.94); font-size: 12px; line-height: 1.35; text-shadow: 0 1px 3px rgba(0,0,0,0.85); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 1100px) { .region-tiles { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 860px)  { .region-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .region-tiles { grid-template-columns: repeat(2, 1fr); gap: 8px; } .region-tile { aspect-ratio: 16 / 10; } .region-tile .tile-title { font-size: 15px; } }

/* Artists section on landing — search + region tabs + compact chip grid */
.artists-panel { margin-top: 6px; }
.artists-controls { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 10px; }
.artists-search { flex: 1 1 260px; min-width: 200px; padding: 8px 12px; background: var(--card); border: 1px solid var(--border); color: var(--fg); font-size: 13px; font-family: Georgia, serif; }
.artists-search:focus { outline: none; border-color: var(--active); }
.artists-search::placeholder { color: var(--muted); font-style: italic; }
.artists-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.artists-tab { background: var(--card); border: 1px solid var(--border); color: var(--muted); padding: 5px 9px; font-size: 11px; cursor: pointer; font-family: Georgia, serif; letter-spacing: 0.03em; transition: border-color 0.15s, color 0.15s; }
.artists-tab:hover { color: var(--fg); }
.artists-tab.active { border-color: var(--active); color: var(--active); }
.artists-tab .c { font-style: italic; opacity: 0.7; margin-left: 4px; font-size: 10px; }
.artists-chip-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); max-height: 300px; overflow-y: auto; padding: 4px 2px; border: 1px solid var(--border); background: rgba(0,0,0,0.15); }
.artists-chip-grid::-webkit-scrollbar { width: 8px; }
.artists-chip-grid::-webkit-scrollbar-track { background: transparent; }
.artists-chip-grid::-webkit-scrollbar-thumb { background: var(--border); }
.artists-chip-grid::-webkit-scrollbar-thumb:hover { background: var(--active); }
.artist-chip { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 6px 10px; background: var(--card); border: 1px solid transparent; text-decoration: none; color: var(--fg); font-size: 13px; transition: border-color 0.12s, color 0.12s; }
.artist-chip:hover { border-color: var(--active); color: var(--active); }
.artist-chip .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artist-chip .c { color: var(--muted); font-size: 11px; font-style: italic; flex-shrink: 0; }
.artists-empty { padding: 24px; text-align: center; color: var(--muted); font-style: italic; font-size: 13px; display: none; }
.artists-empty.on { display: block; }
.artists-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--muted); font-style: italic; }
.artists-footer a { color: var(--active); text-decoration: none; }
.artists-footer a:hover { text-decoration: underline; }

/* Lightbox */
#lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.94); z-index: 100; }
#lightbox[hidden] { display: none; }
#lightbox .lb-scroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; }
#lightbox .lb-scroll-inner { min-height: 100%; box-sizing: border-box; padding: 40px 72px; display: flex; justify-content: center; align-items: center; }
#lightbox figure { max-width: 1100px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px; margin: 0; }
#lightbox .lb-img { max-width: 100%; max-height: 76vh; object-fit: contain; background: #111; }
#lightbox .lb-cap { color: var(--fg); font-size: 14px; line-height: 1.6; max-width: 760px; text-align: center; font-family: Georgia, serif; padding: 0 12px; }
#lightbox .lb-cap .lb-t { color: var(--active); font-size: 17px; font-weight: 600; display: block; margin-bottom: 4px; }
#lightbox .lb-cap .lb-m { color: var(--muted); font-style: italic; display: block; margin-bottom: 8px; font-size: 13px; }
#lightbox button { position: fixed; background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.25); color: #fff; width: 44px; height: 44px; cursor: pointer; font-size: 22px; line-height: 1; font-family: Georgia, serif; z-index: 101; }
#lightbox button:hover { background: rgba(255,255,255,0.12); border-color: var(--active); }
#lightbox .lb-close { top: 20px; right: 20px; }
#lightbox .lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
#lightbox .lb-next { right: 20px; top: 50%; transform: translateY(-50%); }
#lightbox .lb-count { position: fixed; top: 28px; left: 28px; color: var(--muted); font-size: 13px; font-style: italic; z-index: 101; }
#lightbox .lb-src { display: inline-block; margin-top: 10px; color: var(--muted); text-decoration: none; font-size: 12px; border-bottom: 1px solid var(--border); padding-bottom: 2px; }
#lightbox .lb-src:hover { color: var(--active); border-bottom-color: var(--active); }
@media (max-width: 640px) {
  #lightbox .lb-scroll-inner { padding: 76px 16px 60px; }
  #lightbox .lb-prev, #lightbox .lb-next { top: auto; bottom: 16px; transform: none; }
  #lightbox .lb-prev { left: 16px; }
  #lightbox .lb-next { right: 16px; }
}
