/* ================================================================
   ALPHON GALLERY — museum styling
   Plaster walls, framed works, wall labels.
   ================================================================ */

:root {
  --wall: #f4f1ea;          /* warm gallery plaster */
  --wall-deep: #ece7dc;
  --ink: #1c1a17;           /* label ink */
  --muted: #8d8578;
  --hairline: #d9d2c3;
  --brass: #a8894f;         /* accents, plaques */
  --frame: #211e1a;         /* frame wood */
  --mat: #fdfcf9;           /* mat board */
  --room-dark: rgba(21, 19, 16, 0.96);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--wall);
  background-image:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(ellipse 140% 90% at 50% 115%, rgba(83, 71, 50, 0.10), transparent 60%);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::selection { background: var(--brass); color: #fff; }

/* ----------------------------------------------------------------
   Masthead
   ---------------------------------------------------------------- */

.masthead {
  text-align: center;
  padding: 3.2rem 1.5rem 3.4rem;
}

.masthead-top {
  display: flex;
  justify-content: flex-end;
  max-width: 1200px;
  margin: 0 auto 3.6rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--hairline);
}

.masthead-side {
  font-size: 0.66rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}

.wordmark {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(3.4rem, 9vw, 6.4rem);
  letter-spacing: 0.34em;
  text-indent: 0.34em; /* re-centers letterspaced text */
  line-height: 1;
}

.tagline {
  margin-top: 1.1rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--muted);
}

.chain-line {
  margin-top: 1.6rem;
  font-size: 0.66rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--brass);
}

/* ----------------------------------------------------------------
   Wings navigation
   ---------------------------------------------------------------- */

.wings-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.9rem 1rem;
  /* Solid (no backdrop-filter): a blurred sticky bar repaints every
     scroll frame and is a major source of scroll jank. */
  background: var(--wall);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.wings-nav button {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  transition: color 0.25s ease, background 0.25s ease;
}

.wings-nav button:hover { color: var(--ink); }

.wings-nav button[aria-pressed="true"] {
  color: var(--ink);
  background: rgba(28, 26, 23, 0.06);
}

.wings-nav .count {
  color: var(--brass);
  margin-left: 0.45em;
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------
   Demo banner
   ---------------------------------------------------------------- */

.demo-banner {
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1.02rem;
  color: var(--muted);
  padding: 1.1rem 1.5rem 0;
}

/* ----------------------------------------------------------------
   Wings (chain sections)
   ---------------------------------------------------------------- */

main { max-width: 1280px; margin: 0 auto; padding: 0 2rem; }

.wing { padding: 4.6rem 0 2.4rem; }

.wing-head {
  display: flex;
  align-items: baseline;
  gap: 1.6rem;
  margin-bottom: 3.2rem;
}

.wing-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  letter-spacing: 0.06em;
}

.wing-rule { flex: 1; height: 1px; background: var(--hairline); }

.wing-note {
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.wing-status {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--muted);
  text-align: center;
  padding: 2.5rem 0 3.5rem;
}

.wing-status .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 0.7em;
  vertical-align: -2px;
  border: 1px solid var(--hairline);
  border-top-color: var(--brass);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------
   Works grid — framed pieces on the wall
   ---------------------------------------------------------------- */

.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 4.2rem 3rem;
  padding-bottom: 2.5rem;
}

.work {
  position: relative;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.work.on-view { opacity: 1; transform: none; }

.work-frame {
  appearance: none;
  border: none;
  cursor: pointer;
  display: block;
  width: 100%;
  padding: 16px;                       /* the mat */
  background: var(--mat);
  border: 9px solid var(--frame);      /* the frame */
  outline: 1px solid rgba(168, 137, 79, 0.85); /* brass fillet */
  outline-offset: -12px;
  box-shadow:
    0 1px 2px rgba(28, 24, 18, 0.18),
    0 22px 34px -22px rgba(28, 24, 18, 0.45);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.work-frame:hover,
.work-frame:focus-visible {
  transform: translateY(-5px);
  box-shadow:
    0 2px 3px rgba(28, 24, 18, 0.16),
    0 32px 46px -24px rgba(28, 24, 18, 0.5);
}

.work-frame:focus-visible { outline-color: var(--brass); }

.work-art {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  /* mat colour so non-square art is matted, not floated on grey */
  background: var(--mat);
}

.work-art img,
.work-art iframe,
.work-art video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Show the whole artwork (never crop); non-square pieces get matted. */
.work-art img,
.work-art video { object-fit: contain; }
.work-art iframe { pointer-events: none; }

.art-unavailable {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mat);
  color: var(--muted);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* Pixel-art inscriptions: scale with hard edges, never smoothed. */
.work-art img.pixelated,
.lightbox-art img.pixelated { image-rendering: pixelated; }

.work-label { text-align: center; padding-top: 1.15rem; }

.work-no {
  font-size: 0.6rem;
  letter-spacing: 0.26em;
  color: var(--brass);
  margin-bottom: 0.45rem;
}

.work-title {
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.work-collection {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1.02rem;
  color: var(--muted);
  margin-top: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----------------------------------------------------------------
   Lightbox — the viewing room
   ---------------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--room-dark);
  animation: room-lights 0.35s ease;
}

/* The hidden attribute must beat the display:flex above,
   or the overlay can never be dismissed. */
.lightbox[hidden] { display: none; }

@keyframes room-lights { from { opacity: 0; } }

.lightbox-figure {
  max-width: min(92vw, 1100px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  padding: 2rem;
}

.lightbox-art {
  position: relative;
  background: var(--mat);
  padding: 18px;
  border: 10px solid var(--frame);
  outline: 1px solid rgba(168, 137, 79, 0.85);
  outline-offset: -13px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.8);
}

.lightbox-art { min-width: 260px; min-height: 200px; }

.lightbox-art img,
.lightbox-art iframe,
.lightbox-art video {
  display: block;
  max-width: min(78vw, 760px);
  max-height: 62vh;
  border: none;
}

.lightbox-art iframe {
  width: min(78vw, 640px);
  height: min(62vh, 640px);
  background: #fff;
}

.lightbox-label {
  text-align: center;
  color: #cfc8ba;
  max-width: 620px;
}

.lightbox-label .work-no { color: var(--brass); }

.lightbox-label .lb-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: 1.7rem;
  letter-spacing: 0.04em;
  color: #f2eee4;
}

.lightbox-label .lb-collection {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1.1rem;
  margin-top: 0.3rem;
}

.lightbox-label .lb-meta {
  font-size: 0.64rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: 1rem;
  color: #8d8578;
}

.lightbox-label .lb-link {
  display: inline-block;
  margin-top: 1.1rem;
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass);
  text-decoration: none;
  border-bottom: 1px solid rgba(168, 137, 79, 0.45);
  padding-bottom: 3px;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.lightbox-label .lb-link:hover { color: #e8d5ab; border-color: #e8d5ab; }

.lightbox-close,
.lightbox-arrow {
  position: fixed;
  z-index: 101;
  appearance: none;
  background: transparent;
  border: 1px solid rgba(242, 238, 228, 0.22);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  color: #cfc8ba;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.lightbox-close:hover,
.lightbox-arrow:hover { color: #fff; border-color: rgba(242, 238, 228, 0.6); }

.lightbox-close { top: 1.4rem; right: 1.6rem; font-size: 1.5rem; }
.lightbox-prev { left: 1.6rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1.6rem; top: 50%; transform: translateY(-50%); }

/* ----------------------------------------------------------------
   Curator mode
   ---------------------------------------------------------------- */

.curator-hide {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 5;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--mat);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(28, 24, 18, 0.18);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.curator-hide:hover {
  color: #a03123;
  border-color: #a03123;
  transform: scale(1.1);
}

.curator-bar {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: var(--ink);
  color: var(--wall);
  border-radius: 999px;
  padding: 0.65rem 1.4rem;
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.55);
}

.curator-bar button {
  appearance: none;
  background: none;
  border: none;
  padding: 0 0 2px;
  color: var(--brass);
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  border-bottom: 1px solid rgba(168, 137, 79, 0.5);
  transition: color 0.2s ease;
}

.curator-bar button:hover { color: #e8d5ab; }

/* ----------------------------------------------------------------
   Colophon
   ---------------------------------------------------------------- */

.colophon { text-align: center; padding: 4.5rem 1.5rem 3.5rem; }

.colophon-rule {
  width: 44px;
  height: 1px;
  background: var(--brass);
  margin: 0 auto 1.8rem;
}

.colophon-name {
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.colophon-social { margin-top: 1.3rem; }

.colophon-social a {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.64rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  transition: color 0.25s ease;
}

.colophon-social a:hover { color: var(--brass); }

.colophon-social svg {
  width: 13px;
  height: 13px;
  display: block;
}

.colophon-note {
  margin-top: 0.9rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: 0.98rem;
  color: var(--muted);
}

/* ----------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------- */

@media (max-width: 720px) {
  main { padding: 0 1.25rem; }
  .works-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 3rem 1.6rem; }
  .wing-head { flex-wrap: wrap; gap: 0.8rem 1.2rem; }
  .wing-note { display: none; }
  .lightbox-prev { left: 0.6rem; }
  .lightbox-next { right: 0.6rem; }
  .lightbox-arrow { width: 40px; height: 40px; }
}

/* Narrow phones: the wordmark's 3.4rem floor + wide tracking can overrun
   ~320-380px screens, so lower the floor and tracking here and tighten the
   masthead. Below 480px the grid is a single column anyway. */
@media (max-width: 480px) {
  .masthead { padding: 2.2rem 1.1rem 2.6rem; }
  .masthead-top { margin-bottom: 2.4rem; }
  .wordmark {
    font-size: clamp(2.5rem, 13vw, 3.4rem);
    letter-spacing: 0.2em;
    text-indent: 0.2em;
  }
  .tagline { font-size: 1.1rem; }
  main { padding: 0 1rem; }
  .works-grid { gap: 2.8rem 1.4rem; }
  .lightbox-close { top: 1rem; right: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .work { transition: none; opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
