:root {
  color-scheme: light;
  --paper: oklch(97.6% .007 285);
  --ink: oklch(26% .022 285);
  --muted: oklch(48% .018 285);
  --link: oklch(42% .115 280);
  --line: oklch(84% .018 285);
  --wash: oklch(92.5% .028 285);
  font-family: "Times New Roman", Times, serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
main { width: 100%; max-width: 1500px; height: 100svh; min-height: 0; display: flex; flex-direction: column; margin: 0 auto; padding: 22px 30px max(18px,env(safe-area-inset-bottom)); }
a { color: var(--link); text-underline-offset: 3px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled, select:disabled, input:disabled { opacity: .5; cursor: wait; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, canvas:focus-visible, summary:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
[hidden] { display: none !important; }
.masthead { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; flex-shrink: 0; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.page-title { margin: 0; font-size: clamp(27px,2.5vw,36px); font-weight: normal; line-height: 1; letter-spacing: -.045em; }
.page-title span { color: var(--link); }
.page-title a { color: inherit; text-decoration: none; }
.places { position: relative; z-index: 6; }
.places summary { list-style: none; cursor: pointer; color: var(--link); text-decoration: underline; text-underline-offset: 4px; font-size: 16px; padding: 6px 0; white-space: nowrap; }
.places summary::-webkit-details-marker { display: none; }
#location-list { position: absolute; top: calc(100% + 14px); left: 0; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; width: 780px; max-width: calc(100vw - 60px); max-height: calc(100svh - 110px); overflow: auto; background: var(--paper); border: 1px solid var(--line); padding: 6px; }
#location-list button { position: relative; isolation: isolate; display: grid; place-items: center; aspect-ratio: 24/17; min-width: 0; border: 0; border-radius: 0; background: oklch(24% .023 154); color: oklch(98% .008 285); padding: 16px; text-align: center; }
#location-list canvas { position: absolute; inset: 0; z-index: -2; object-fit: cover; }
#location-list button::before { content: ""; position: absolute; inset: 0; z-index: -1; background: oklch(16% .025 285 / .28); }
#location-list button:hover::before { background: oklch(16% .025 285 / .12); }
#location-list button[aria-current]::after { content: ""; position: absolute; inset: 5px; border: 1px solid oklch(98% .008 285 / .8); pointer-events: none; }
#location-list button:focus-visible { outline-offset: -3px; outline-color: oklch(98% .008 285); }
.location-name { font-size: 18px; line-height: 1.15; text-wrap: balance; text-shadow: 0 1px 3px oklch(12% .02 285), 0 0 14px oklch(12% .02 285); }
.study { display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 36px; align-items: stretch; flex: 1; min-height: 0; }
.render { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.collection-heading { flex-shrink: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 10px; font-size: 19px; line-height: 1.2; }
#painting-count { font: 11px "Courier New",monospace; color: var(--muted); white-space: nowrap; }
.paintings { margin-bottom: 14px; flex-shrink: 0; }
.painting-links { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.painting-links button, .link-button, .view-switch button { padding: 4px 0; border: 0; border-radius: 0; background: none; color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.painting-links button { font-size: 14px; padding: 4px 7px; margin-left: -7px; }
.painting-links button[aria-pressed="true"] { background: var(--wash); color: var(--ink); text-decoration: none; cursor: default; }
.painting-links button[aria-pressed="true"]::before { content: "[ "; }
.painting-links button[aria-pressed="true"]::after { content: " ]"; }
.stage { position: relative; width: 100%; height: auto; flex: 1; min-height: 0; background: oklch(24% .023 154); overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; outline-offset: -4px !important; }
.stage[data-view="depth"] canvas { cursor: grab; touch-action: pan-y; }
.stage[data-view="depth"] canvas:active, .stage[data-view="inside"] canvas:active { cursor: grabbing; }
#fullscreen { position: absolute; top: 11px; right: 13px; padding: 5px; border: 0; background: transparent; color: oklch(82% .012 285); font: 13px monospace; }
#fullscreen:hover { color: var(--paper); }
.loading { position: absolute; inset: 0; background: oklch(24% .023 154); color: oklch(84% .02 135); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; font: 12px monospace; text-align: center; padding: 25px; }
#retry { border: 1px solid currentColor; color: inherit; background: transparent; padding: 5px 10px; }
.controls { flex-shrink: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; margin-top: 14px; font-size: 13px; }
.view-switch { display: flex; gap: 7px; align-items: center; }
.view-switch button[aria-pressed="true"] { color: var(--ink); text-decoration: none; cursor: default; }
.view-switch span { color: var(--muted); }
.controls label { display: flex; align-items: center; gap: 7px; }
.controls select { font-size: 13px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); padding: 3px 16px 3px 3px; max-width: 135px; }
#enter-inside { color: var(--ink); }
input[type="range"] { width: 73px; height: 22px; margin: 0; cursor: pointer; accent-color: var(--link); }
#reset { margin-left: auto; }
.canvas-hint { flex-shrink: 0; color: var(--muted); font-size: 12px; margin: 12px 0 0; min-height: 1.2em; }
aside { padding-top: 1px; display: flex; flex-direction: column; min-height: 0; }
.artist { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
#painting-title { font-size: 29px; line-height: 1.08; letter-spacing: -.025em; font-weight: normal; margin: 0 0 14px; text-wrap: pretty; }
.metadata { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.description { font-size: 15px; line-height: 1.45; margin: 18px 0 0; max-width: 36ch; }
figure { margin: 18px 0 0; display: flex; flex-direction: column; flex: 1; min-height: 0; }
#compare { flex: 1; min-height: 0; border: 0; padding: 0; background: none; display: block; width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#original { display: block; width: 100%; height: 100%; max-height: none; object-fit: contain; object-position: left top; pointer-events: none; }
figcaption { flex-shrink: 0; font-size: 12px; line-height: 1.4; margin-top: 8px; }
#painting-permalink { display: block; margin-top: 5px; }
.stage:fullscreen { width: 100%; height: 100%; }
.stage:fullscreen canvas { width: 100vw; height: 100vh; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -100px; left: 18px; z-index: 10; background: var(--paper); padding: 8px; }
.skip-link:focus { top: 8px; }
body.immersed { overflow: hidden; }
.immersed .stage { position: fixed; inset: 0; z-index: 100; width: 100vw; height: 100dvh; min-height: 0; max-height: none; aspect-ratio: auto; }
.stage[data-view="inside"] canvas { touch-action: none; cursor: grab; }
.immersed #fullscreen { display: none; }
.inside-ui { position: absolute; inset: 0; pointer-events: none; color: #eeeade; font: 13px "Courier New",monospace; }
.inside-top { position: absolute; top: 0; left: 0; right: 0; padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; gap: 20px; background: linear-gradient(#151b27cc,transparent); }
.inside-ui button, .inside-ui select { pointer-events: auto; color: inherit; border: 0; border-radius: 0; background: transparent; font: inherit; }
.inside-ui button { padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; }
.inside-ui button:focus-visible, .inside-ui select:focus-visible { outline-color: #eeeade; }
.inside-top span { opacity: .8; }
.inside-bottom { position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 28px 24px 19px; background: linear-gradient(transparent,#151b27e6); }
.inside-bottom p { font-size: 11px; line-height: 1.5; margin: 0; }
.inside-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 22px; }
#inside-density { width: 74px; accent-color: #c8c4dc; }
.inside-controls label { display: flex; align-items: center; gap: 7px; }
.inside-ui select { border-bottom: 1px solid #87909b; padding: 3px; }
.inside-ui option { color: var(--ink); background: var(--paper); }
@media (min-width:1400px) { .study { grid-template-columns: minmax(0,1fr) 310px; gap: 42px; } }
@media (max-width:1000px) { main { padding: 18px 22px; } .study { grid-template-columns: minmax(0,1fr) 240px; gap: 26px; } #painting-title { font-size: 25px; } .controls { gap: 8px 14px; } input[type="range"] { width: 55px; } }
@media (max-height:650px) and (min-width:701px) {
  main { padding-top: 16px; padding-bottom: 14px; }
  .masthead { padding-bottom: 10px; margin-bottom: 12px; }
  .page-title { font-size: 27px; }
  .artist { margin-bottom: 8px; font-size: 12px; }
  #painting-title { font-size: 23px; margin-bottom: 10px; }
  .description { font-size: 13px; line-height: 1.35; margin-top: 12px; }
  figure { margin-top: 12px; }
  .controls { margin-top: 10px; }
  .canvas-hint { margin-top: 8px; }
}
@media (max-width:700px) {
  main { padding: 12px 16px max(12px,env(safe-area-inset-bottom)); }
  .masthead { gap: 14px; padding-bottom: 10px; margin-bottom: 12px; }
  .page-title { font-size: clamp(21px,5.6vw,28px); letter-spacing: -.04em; }
  .places summary { font-size: 14px; }
  #location-list { grid-template-columns: repeat(2,minmax(0,1fr)); width: 450px; max-width: calc(100vw - 32px); max-height: calc(100svh - 80px); height: min(560px,calc(100svh - 80px)); grid-template-rows: repeat(4,minmax(0,1fr)); }
  #location-list button { aspect-ratio: auto; }
  .location-name { font-size: 16px; }
  .study { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) auto; gap: 14px; }
  .collection-heading { font-size: 16px; margin-bottom: 5px; }
  .painting-links { gap: 2px 12px; }
  .painting-links button { font-size: 12px; padding-top: 3px; padding-bottom: 3px; }
  .paintings { margin-bottom: 9px; }
  .controls { gap: 5px 12px; font-size: 12px; margin-top: 8px; }
  .controls label { gap: 5px; }
  .controls select { font-size: 12px; padding-right: 3px; max-width: 105px; }
  input[type="range"] { width: 50px; height: 22px; }
  .canvas-hint { font-size: 11px; margin-top: 7px; }
  aside { display: grid; grid-template-columns: minmax(0,1fr) 110px; gap: 0 18px; align-items: start; }
  .artist, #painting-title, .metadata, .description { grid-column: 1; }
  .artist { font-size: 11px; margin-bottom: 5px; }
  #painting-title { font-size: 19px; margin-bottom: 6px; }
  .metadata { font-size: 10px; line-height: 1.35; }
  .description { font-size: 12px; line-height: 1.3; margin-top: 8px; }
  aside figure { grid-column: 2; grid-row: 1/6; align-self: stretch; margin: 0; }
  #original { max-height: 155px; }
  figcaption { font-size: 10px; line-height: 1.25; margin-top: 6px; }
  .inside-top { padding: max(12px,env(safe-area-inset-top)) 16px 12px; }
  .inside-top span { font-size: 11px; max-width: 55%; text-align: right; }
  .inside-bottom { flex-wrap: wrap; padding: 22px 16px max(12px,env(safe-area-inset-bottom)); gap: 8px 12px; }
  .inside-controls { font-size: 12px; gap: 8px 14px; }
  .inside-bottom p { width: 100%; }
  #inside-density { width: 58px; }
}
@media (min-width:560px) and (max-width:700px) and (max-height:500px) {
  .study { grid-template-columns: minmax(0,1fr) 190px; grid-template-rows: minmax(0,1fr); gap: 20px; }
  aside { display: flex; flex-direction: column; min-height: 0; }
  aside figure { margin: 8px 0 0; }
  #original { max-height: none; }
  #painting-title { font-size: 18px; }
  .description { font-size: 11px; line-height: 1.3; }
  figcaption { font-size: 10px; }
}
@media (max-width:360px) { .masthead { gap: 8px; } .page-title { font-size: 20px; } aside { grid-template-columns: minmax(0,1fr) 95px; gap: 0 14px; } #painting-title { font-size: 18px; } .controls { gap: 4px 10px; } }
@media (pointer:coarse) { .escape-help { display: none; } }
/* A three-panel source needs the phone's full width to stay readable. */
@media (max-width:700px) and (min-height:501px) {
  #gallery-view[data-panels="3"] aside { grid-template-columns: minmax(0,1fr); }
  #gallery-view[data-panels="3"] .description { max-width: none; }
  #gallery-view[data-panels="3"] aside figure { grid-column: 1; grid-row: auto; margin-top: 10px; }
  #gallery-view[data-panels="3"] #compare { flex: none; }
  #gallery-view[data-panels="3"] #original { height: auto; max-height: none; }
  #gallery-view[data-panels="3"] figcaption { display: flex; justify-content: space-between; gap: 10px; }
  #gallery-view[data-panels="3"] #painting-permalink { margin-top: 0; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* Both pages use the available frame; the source image always stays complete. */
.home { max-width: 1440px; }
.home-masthead { display: flex; flex-shrink: 0; align-items: baseline; justify-content: space-between; gap: 24px; }
.home-name { font-size: 23px; font-weight: normal; letter-spacing: -.035em; margin: 0; }
.home-name span { color: var(--link); }
.home-masthead > a { font-size: 14px; }
.home-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0,.88fr) minmax(0,1.12fr); align-items: center; gap: clamp(36px,7vw,105px); padding: clamp(20px,4vh,48px) clamp(4px,2vw,30px) 12px; }
.home-story { max-width: 440px; }
.home-story p { max-width: 36ch; font-size: 17px; line-height: 1.5; margin: 0 0 18px; }
.home-story p:nth-of-type(3) { color: var(--link); }
#home-title { font: inherit; margin-bottom: 18px; }
.home-enter { display: inline-block; margin-top: 8px; padding: 8px 0; font-size: 17px; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.home-art { height: 100%; max-height: 100%; margin: 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
#home-original { display: block; flex: 0 1 auto; width: 100%; height: auto; max-height: calc(100% - 42px); min-height: 0; object-fit: contain; }
.home-art figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3px 18px; margin-top: 12px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.home-art figcaption a { color: var(--muted); }
@media (max-width:900px) and (min-width:701px) { .home-layout { gap: 36px; grid-template-columns: minmax(0,1fr) minmax(0,1fr); } .home-story p { font-size: 16px; margin-bottom: 14px; } }
@media (max-width:700px) {
  .home-name { font-size: 21px; }
  .home-masthead > a { font-size: 13px; }
  .home-layout { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); align-items: stretch; gap: 16px; padding: 24px 0 0; }
  .home-story p { font-size: 14px; line-height: 1.35; max-width: 48ch; margin-bottom: 10px; }
  #home-title { margin-bottom: 12px; }
  .home-enter { margin-top: 0; padding: 6px 0; font-size: 15px; }
  .home-art figcaption { display: block; margin-top: 8px; font-size: 10px; }
  .home-art figcaption a { display: block; margin-top: 2px; }
}
@media (max-height:600px) {
  .home-story p { font-size: 14px; line-height: 1.35; margin-bottom: 10px; }
  .home-layout { padding-top: 16px; }
  .home-enter { margin-top: 0; font-size: 15px; }
}
@media (max-height:500px) and (max-width:700px) {
  .home-layout { grid-template-columns: minmax(0,1fr) minmax(0,1fr); grid-template-rows: minmax(0,1fr); align-items: center; gap: 24px; padding-top: 16px; }
  .home-story p { font-size: 13px; line-height: 1.3; margin-bottom: 8px; }
  #home-title { margin-bottom: 8px; }
  .home-name { font-size: 19px; }
}
