.gallery-page { background: var(--cream); }
.gallery-page .main-nav .is-current { color: var(--gold); }

.gallery-viewer-page {
  padding: clamp(52px, 6vw, 92px) clamp(20px, 5vw, 78px) clamp(64px, 7vw, 104px);
  background: linear-gradient(135deg, var(--cream) 0%, #f7f2e9 70%, #eee3d1 100%);
}

.gallery-viewer-intro, .gallery-viewer { width: min(1380px, 100%); margin-inline: auto; }
.gallery-viewer-intro { margin-bottom: clamp(36px, 5vw, 60px); }
.gallery-viewer-eyebrow { margin: 0 0 22px; display: flex; align-items: center; gap: 16px; font-size: .76rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.gallery-viewer-eyebrow span { width: 54px; height: 2px; background: var(--gold); }
.gallery-viewer-intro h1 { margin: 0 0 18px; font: 400 clamp(3.3rem, 6vw, 6.4rem)/.95 Georgia, "Times New Roman", serif; letter-spacing: -.045em; }
.gallery-viewer-intro > p:last-child { max-width: 650px; margin: 0; color: var(--graphite); font-size: 1rem; line-height: 1.65; }

.gallery-viewer-stage { height: clamp(480px, 64vw, 760px); margin: 0; position: relative; overflow: hidden; border: 1px solid rgba(31, 29, 26, .28); background: var(--black); }
.gallery-viewer-stage > img { width: 100%; height: 100%; display: block; object-fit: contain; }
.gallery-viewer-stage figcaption { position: absolute; left: 20px; bottom: 18px; padding: 10px 13px; color: var(--white); background: rgba(31, 29, 26, .84); font-size: .65rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.gallery-viewer-stage figcaption span { margin-left: 12px; color: var(--gold-light); }
.gallery-viewer-arrow { width: 48px; height: 48px; position: absolute; top: 50%; display: grid; place-items: center; transform: translateY(-50%); border: 1px solid rgba(255, 253, 248, .52); color: var(--white); background: rgba(31, 29, 26, .72); font-size: 1.2rem; cursor: pointer; }
.gallery-viewer-arrow:hover, .gallery-viewer-arrow:focus-visible { color: var(--black); background: var(--gold-light); outline: none; }
.gallery-viewer-previous { left: 18px; }
.gallery-viewer-next { right: 18px; }

.gallery-viewer-thumbnails { margin-top: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.gallery-viewer-thumbnail { height: 105px; padding: 0; overflow: hidden; border: 2px solid transparent; background: var(--black); cursor: pointer; opacity: .62; }
.gallery-viewer-thumbnail:hover, .gallery-viewer-thumbnail:focus-visible, .gallery-viewer-thumbnail.is-active { border-color: var(--gold); outline: none; opacity: 1; }
.gallery-viewer-thumbnail img { width: 100%; height: 100%; display: block; object-fit: cover; }

.gallery-page [hidden] { display: none !important; }
.gallery-page-message { width: min(1380px, 100%); margin: 0 auto 24px; color: var(--graphite); line-height: 1.6; }
.gallery-page-message:not(:empty) { padding: 16px 20px; border-left: 3px solid var(--gold); background: rgba(255,253,248,.6); }
.gallery-viewer-stage:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.gallery-viewer-thumbnail { position: relative; height: 130px; }
.gallery-viewer-thumbnail span { position: absolute; bottom: 0; left: 0; right: 0; padding: 8px 10px; background: rgba(31,29,26,.85); color: var(--white); text-align: left; font-size: .72rem; overflow-wrap: anywhere; }
.gallery-viewer-arrow:disabled { opacity: .4; cursor: default; }
.gallery-photo-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.gallery-photo-controls:empty { margin: 0; }
.gallery-photo-controls button { padding: 10px 14px; min-height: 40px; border: 1px solid #c8beb0; color: var(--black); background: var(--white); font: 700 .7rem Arial, sans-serif; cursor: pointer; }
.gallery-photo-controls button[aria-pressed=true] { color: var(--white); background: var(--black); }
.gallery-space-flow { width: min(1380px, 100%); margin: 36px auto 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: stretch; }
.gallery-space-details, .gallery-enquiry-card { padding: clamp(24px, 3vw, 38px); border: 1px solid rgba(31,29,26,.18); border-top: 3px solid var(--gold); background: rgba(255,253,248,.6); }
.gallery-space-flow h2 { margin: 0 0 18px; font: 400 clamp(1.9rem, 3vw, 2.8rem)/1.1 Georgia, serif; letter-spacing: -.02em; overflow-wrap: anywhere; }
.gallery-availability { display: inline-block; margin: 0 0 20px; padding: 8px 10px; color: var(--wood); background: #f1e5cc; font: 800 .64rem Arial, sans-serif; text-transform: uppercase; letter-spacing: .07em; }
.gallery-availability.available { color: #315d43; background: #dcebdc; }
.gallery-availability.unavailable { color: #5c5953; background: #e9e5de; }
#gallery-space-description { white-space: pre-line; overflow-wrap: anywhere; color: var(--graphite); line-height: 1.7; }
.gallery-space-details { display: flex; flex-direction: column; min-width: 0; }
.gallery-space-details .gallery-availability { align-self: flex-start; }
.gallery-elevation { margin: 26px 0 0; padding-top: 22px; border-top: 1px solid rgba(31,29,26,.15); display: flex; flex-direction: column; flex: 1; gap: 14px; min-height: 320px; }
.gallery-elevation figcaption { font: 800 .65rem Arial, sans-serif; text-transform: uppercase; letter-spacing: .08em; }
.gallery-elevation-frame { position: relative; flex: 1; min-height: 290px; border: 1px solid #d6c9b5; background: var(--white); display: grid; place-items: center; }
.gallery-elevation-frame img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; padding: 16px; object-fit: contain; }
.gallery-elevation-frame p { padding: 32px; text-align: center; color: var(--graphite); font-size: .85rem; line-height: 1.6; }
.gallery-artwork-upload { display: grid; gap: 8px; }
.gallery-artwork-upload input[type=file] { padding: 10px; border: 1px dashed var(--gold); background: rgba(241,229,204,.3); font-size: .8rem; cursor: pointer; }
.gallery-artwork-upload input::file-selector-button { margin-right: 12px; padding: 10px 12px; border: 0; background: var(--black); color: var(--white); font: 700 .68rem Arial, sans-serif; cursor: pointer; }
#gallery-upload-help, #gallery-upload-message { margin: 0; color: var(--graphite); font-size: .72rem; line-height: 1.5; }
#gallery-upload-message:empty { display: none; }
#gallery-artwork-preview { display: flex; align-items: center; gap: 16px; }
#gallery-artwork-preview img { width: 90px; height: 76px; object-fit: contain; border: 1px solid #d6c9b5; background: var(--white); }
#gallery-artwork-remove { padding: 10px 0; background: none; border: 0; text-decoration: underline; color: var(--wood); cursor: pointer; }
#gallery-enquiry-space { color: var(--wood); font-size: .85rem; line-height: 1.5; margin-bottom: 25px; }
#gallery-artist-fields { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 18px; }
.gallery-enquiry-card label { display: grid; gap: 8px; }
.gallery-enquiry-card label > span { font: 800 .64rem Arial, sans-serif; letter-spacing: .05em; text-transform: uppercase; }
.gallery-enquiry-card input, .gallery-enquiry-card textarea { width: 100%; min-width: 0; padding: 12px; min-height: 46px; border: 1px solid #c8beb0; background: var(--white); border-radius: 0; color: var(--black); font: inherit; }
.gallery-enquiry-card textarea { resize: vertical; }
.gallery-field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gallery-form-note { margin: 20px 0; color: var(--graphite); font-size: .75rem; line-height: 1.6; }
.gallery-submit { width: 100%; min-height: 52px; padding: 14px; border: 1px solid var(--black); color: var(--white); background: var(--black); font: 800 .7rem Arial, sans-serif; text-transform: uppercase; letter-spacing: .09em; cursor: pointer; }
.gallery-submit:disabled { opacity: .55; cursor: default; }
.gallery-form-message:empty { display: none; }
.gallery-form-message { border-left: 3px solid var(--gold); background: var(--cream-deep); padding: 14px; font-size: .8rem; line-height: 1.6; overflow-wrap: anywhere; }
.gallery-enquiry-card :focus-visible, .gallery-photo-controls :focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
@media (max-width: 980px) { .gallery-space-flow { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .gallery-field-pair { grid-template-columns: 1fr; } }

@media (max-width: 700px) {
  .gallery-viewer-page { padding-inline: 18px; }
  .gallery-viewer-stage { height: 430px; }
  .gallery-viewer-arrow { width: 42px; height: 42px; }
  .gallery-viewer-thumbnails { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-viewer-thumbnail { height: 90px; }
}

/* Painting collection and individual image sets. */
.gallery-painting-collection { max-width:1380px; margin:0 auto 48px; }
.gallery-painting-collection:has(.gallery-viewer-thumbnails:empty) { display:none; }
.gallery-viewer-thumbnails { grid-template-columns:repeat(auto-fill,minmax(min(100%,240px),1fr)); gap:24px; }
.gallery-viewer-thumbnail { height:auto; display:flex; flex-direction:column; opacity:1; background:var(--white); border:1px solid #d5cbbb; text-align:left; }
.gallery-viewer-thumbnail img { height:260px; object-fit:contain; padding:18px; background:#eae3d8; }
.gallery-viewer-thumbnail .painting-card-info { position:static; padding:18px; background:var(--white); color:var(--black); display:grid; gap:10px; }
.painting-card-info strong { font:400 1.5rem/1.2 Georgia,serif; }
.painting-card-info small { font:400 .75rem Arial,sans-serif; color:var(--wood); }
.gallery-viewer-thumbnail.is-active { outline:2px solid var(--gold); outline-offset:3px; }
.gallery-viewer { scroll-margin-top:24px; }
.gallery-viewer-stage { height:clamp(360px,52vw,650px); background:#eae3d8; }
.gallery-viewer-stage > img { padding:clamp(16px,3vw,42px); }
.gallery-photo-controls .painting-photo-thumb { width:76px; height:76px; padding:4px; background:var(--white); }
.painting-photo-thumb img { width:100%; height:100%; object-fit:contain; }
.gallery-photo-controls button[aria-pressed=true] { border:2px solid var(--gold); }
.painting-dimensions { font-size:.85rem; color:var(--wood); margin:0 0 14px; }
@media(max-width:600px){.gallery-viewer-thumbnails{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.gallery-viewer-thumbnail img{height:170px;padding:10px}.gallery-viewer-thumbnail .painting-card-info{padding:12px}.painting-card-info strong{font-size:1.1rem}}

.gallery-artist-invitation { padding:16px 0; border-bottom:1px solid #d5cbbb; line-height:1.7; color:var(--wood); }
.gallery-artist-invitation a { color:var(--black); text-decoration:underline; text-underline-offset:4px; }

.gallery-elevation-frame.is-automatic { border:0; background:transparent; }
.gallery-elevation-frame.is-automatic img { padding:0; }
