/* ============================================================
   WAYNE PEARCE PAINTING — The NYC Collection
   Palette: ivory gallery wall, ink charcoal, taxi-cab yellow
   Type:    Cormorant Garamond (display) / Archivo (utility)
   ============================================================ */

:root {
  --ivory:      #F4F1E9;
  --ivory-deep: #ECE8DC;
  --ink:        #2A2723;
  --ink-soft:   #6B665C;
  --taxi:       #E3A61B;
  --hudson:     #37455C;
  --card:       rgba(248, 246, 238, 0.82);
  --line:       rgba(42, 39, 35, 0.12);
  --shadow:     0 18px 50px -12px rgba(42, 39, 35, 0.28);
  --serif:  "Cormorant Garamond", Georgia, serif;
  --sans:   "Archivo", "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;           /* the canvas pans; the page never scrolls */
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--taxi); color: var(--ink); }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ============ PRELOADER ============ */

.loader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--ivory);
  display: grid; place-items: center;
  transition: opacity 900ms ease 200ms, visibility 0s 1200ms;
}
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader__inner { text-align: center; }
.loader__eyebrow {
  font-size: 11px; letter-spacing: 0.34em; color: var(--ink-soft);
  animation: rise 900ms ease both;
}
.loader__title {
  font-family: var(--serif); font-weight: 500; font-style: italic;
  font-size: clamp(34px, 6vw, 64px); line-height: 1.1;
  margin: 18px 0 26px;
  animation: rise 900ms ease 150ms both;
}
.loader__count {
  font-size: 12px; letter-spacing: 0.18em; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  animation: rise 900ms ease 300ms both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ============ NAV ============ */

.nav {
  position: fixed; z-index: 40;
  top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 34px;
  padding: 16px 26px;
  background: var(--ivory-deep);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 10px 30px -18px rgba(42,39,35,.35);
  white-space: nowrap;
}
.nav__brand {
  font-weight: 600; font-size: 17px; letter-spacing: 0.06em;
}
.nav__brand::after {
  content: "PAINTING";
  display: block; font-size: 8px; font-weight: 500;
  letter-spacing: 0.42em; color: var(--ink-soft); margin-top: 1px;
}
.nav__links { display: flex; gap: 22px; }
.nav__links a {
  font-size: 12.5px; font-weight: 500; letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding-bottom: 2px;
  background: linear-gradient(var(--taxi), var(--taxi)) bottom left / 0 2px no-repeat;
  transition: color 200ms ease, background-size 260ms ease;
}
.nav__links a:hover, .nav__links a.is-active {
  color: var(--ink);
  background-size: 100% 2px;
}
.nav__burger { display: none; }

/* ============ CLOCK WIDGET ============ */

.clock {
  position: fixed; z-index: 40;
  top: 18px; right: 18px;
  display: flex; align-items: center; gap: 8px;
  padding: 13px 14px;
  background: var(--ivory-deep);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12.5px;
  box-shadow: 0 10px 30px -18px rgba(42,39,35,.35);
}
.clock__city { font-weight: 600; }
.clock__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--taxi);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }
.clock__label { color: var(--ink-soft); }
.clock__time { font-weight: 600; font-variant-numeric: tabular-nums; }
.clock__more { color: var(--ink-soft); letter-spacing: 0.1em; padding: 0 2px; }
.clock__more:hover { color: var(--ink); }
.clock__panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 250px; padding: 16px;
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 12px; line-height: 1.6; color: var(--ink-soft);
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}
.clock__panel a { display: inline-block; margin-top: 8px; color: var(--hudson); font-weight: 500; }
.clock.is-open .clock__panel { opacity: 1; transform: none; pointer-events: auto; }

/* ============ INFINITE CANVAS ============ */

.stage {
  position: fixed; inset: 0; z-index: 10;
  cursor: grab;
  touch-action: none;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.stage.is-dragging { cursor: grabbing; }

.stage__quote {
  position: absolute; inset: 0; z-index: 0;
  display: grid; place-content: center; text-align: center;
  padding: 0 24px;
}
.stage__quote p {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(26px, 3.6vw, 44px); line-height: 1.25;
  color: var(--ink);
}
.stage__quote span {
  display: block; margin-top: 14px;
  font-family: var(--serif); font-style: italic;
  font-size: 17px; color: var(--ink-soft);
}

.stage__world { position: absolute; inset: 0; z-index: 1; }

.tile {
  position: absolute; top: 0; left: 0;
  border-radius: 5px;
  overflow: hidden;
  background: var(--ivory-deep);
  box-shadow: 0 12px 34px -14px rgba(42, 39, 35, 0.38);
  will-change: transform;
  opacity: 0;
  transition: opacity 700ms ease, box-shadow 300ms ease;
}
.tile.is-in { opacity: 1; }
.tile img, .tile video {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none; -webkit-user-drag: none;
}
.tile:hover { box-shadow: 0 22px 50px -16px rgba(42, 39, 35, 0.5); cursor: pointer; }
.stage.is-dragging .tile { cursor: grabbing; }

.tile__tag {
  position: absolute; left: 10px; bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 6px 10px;
  background: var(--card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 4px;
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.07em;
  color: var(--ink);
  opacity: 0; transform: translateY(6px);
  transition: opacity 240ms ease, transform 240ms ease;
  pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile:hover .tile__tag { opacity: 1; transform: none; }

.tile__live {
  position: absolute; top: 10px; right: 10px;
  display: flex; align-items: center; gap: 5px;
  padding: 5px 8px;
  background: rgba(42, 39, 35, 0.55);
  backdrop-filter: blur(6px);
  border-radius: 4px;
  font-size: 8.5px; font-weight: 600; letter-spacing: 0.22em; color: var(--ivory);
  pointer-events: none;
}
.tile__live::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--taxi);
  animation: pulse 2.2s ease-in-out infinite;
}

/* ============ FOOTNOTES + HINT ============ */

.footnote {
  position: fixed; bottom: 18px; z-index: 30;
  font-size: 10px; letter-spacing: 0.22em; color: var(--ink-soft);
}
.footnote--left { left: 22px; }
.footnote--right { right: 22px; }

.hint {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 30;
  display: flex; align-items: center; gap: 8px;
  font-size: 10.5px; letter-spacing: 0.26em; color: var(--ink-soft);
  transition: opacity 700ms ease;
}
.hint__glyph { font-size: 14px; animation: sway 2.6s ease-in-out infinite; }
@keyframes sway {
  0%, 100% { transform: translateX(-5px); }
  50%      { transform: translateX(5px); }
}
.hint.is-hidden { opacity: 0; }

/* ============ OVERLAY PANELS ============ */

.overlay { position: fixed; inset: 0; z-index: 60; }
.overlay__scrim {
  position: absolute; inset: 0;
  background: rgba(244, 241, 233, 0.4);
  backdrop-filter: blur(16px) saturate(1.05);
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
  opacity: 0; transition: opacity 420ms ease;
}
.overlay.is-open .overlay__scrim { opacity: 1; }

.panel {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -46%);
  width: min(760px, 93vw); max-height: 86vh;
  overflow-y: auto; overflow-x: hidden;
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 26px clamp(22px, 6vw, 72px) 60px;
  opacity: 0;
  transition: opacity 420ms ease, transform 420ms cubic-bezier(.22,.7,.3,1);
}
.overlay.is-open .panel { opacity: 1; transform: translate(-50%, -50%); }

.panel__close {
  position: sticky; top: 0; float: right; margin-right: -40px;
  font-size: 14px; color: var(--ink-soft); padding: 8px;
}
.panel__close:hover { color: var(--ink); }

.panel__meta {
  display: flex; justify-content: space-between;
  font-size: 10px; letter-spacing: 0.18em; color: var(--ink-soft);
  margin-bottom: 40px;
}
.panel__meta-right { text-align: right; line-height: 1.7; }

.panel__body h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(38px, 6vw, 58px); line-height: 1.06;
  text-align: center; letter-spacing: 0.01em;
  color: var(--ink);
  margin: 10px 0 34px;
}
.panel__body hr {
  border: 0; border-top: 1px dotted rgba(42,39,35,0.35);
  margin: 34px 0;
}
.panel__body h2 {
  font-size: 13px; font-weight: 600; letter-spacing: 0.2em;
  color: var(--ink); text-transform: uppercase;
  margin: 34px 0 14px;
}
.panel__body p {
  font-size: 15px; line-height: 1.75; color: #47433B;
  margin-bottom: 16px;
}
.panel__body p em { font-family: var(--serif); font-size: 17px; }
.panel__body .sig {
  font-family: var(--serif); font-style: italic; font-size: 22px;
  margin-top: 28px;
}
.panel__cta {
  display: inline-block; margin-top: 10px;
  padding: 12px 22px;
  border: 1px solid var(--ink); border-radius: 4px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em;
  transition: background 200ms ease, color 200ms ease;
}
.panel__cta:hover { background: var(--ink); color: var(--ivory); }

/* collection index inside panel */
.works { list-style: none; margin-top: 6px; }
.works li { border-bottom: 1px dotted rgba(42,39,35,0.25); }
.works button, .works a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  width: 100%; padding: 13px 2px;
  text-align: left;
  transition: padding-left 220ms ease;
}
.works button:hover, .works a:hover { padding-left: 12px; }
.works .works__title {
  font-family: var(--serif); font-size: 21px; font-weight: 500;
}
.works button:hover .works__title,
.works a:hover .works__title { color: var(--hudson); }
.works .works__loc {
  font-size: 10px; letter-spacing: 0.18em; color: var(--ink-soft);
  white-space: nowrap;
}
.works .works__live { color: var(--taxi); font-weight: 600; }

/* ============ LIGHTBOX ============ */

.lightbox { position: fixed; inset: 0; z-index: 70; }
.lightbox__scrim {
  position: absolute; inset: 0;
  background: rgba(42, 39, 35, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0; transition: opacity 360ms ease;
}
.lightbox.is-open .lightbox__scrim { opacity: 1; }
.lightbox__fig {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -47%) scale(0.98);
  width: min(880px, 92vw);
  opacity: 0;
  transition: opacity 360ms ease, transform 360ms cubic-bezier(.22,.7,.3,1);
}
.lightbox.is-open .lightbox__fig { opacity: 1; transform: translate(-50%, -50%); }
.lightbox__media {
  border-radius: 6px; overflow: hidden;
  background: var(--ivory-deep);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,0.5);
  transition: opacity 160ms ease, transform 160ms ease;
}
.lightbox__media.is-leaving-left  { opacity: 0; transform: translateX(-18px); }
.lightbox__media.is-leaving-right { opacity: 0; transform: translateX(18px); }
.lightbox__media img, .lightbox__media video {
  display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain;
}

.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 2;
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  color: var(--ink); font-size: 18px;
  box-shadow: 0 10px 28px -12px rgba(0,0,0,0.4);
  transition: background 200ms ease, transform 200ms ease;
}
.lightbox__nav:hover { background: var(--ivory); transform: translateY(-50%) scale(1.07); }
.lightbox__nav--prev { left: max(18px, calc(50% - min(440px, 46vw) - 76px)); }
.lightbox__nav--next { right: max(18px, calc(50% - min(440px, 46vw) - 76px)); }

.lightbox__count {
  font-size: 11px; letter-spacing: 0.18em; color: var(--taxi);
  font-variant-numeric: tabular-nums; font-weight: 600;
}
.lightbox__fig figcaption {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  padding: 16px 4px 0; color: var(--ivory);
}
.lightbox__title { font-family: var(--serif); font-size: 24px; }
.lightbox__sub { font-size: 11px; letter-spacing: 0.16em; opacity: 0.75; }
.lightbox__cta {
  margin-left: auto;
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em;
  color: var(--taxi);
}
.lightbox__cta:hover { color: var(--ivory); }
.lightbox__close {
  position: absolute; top: -38px; right: 0;
  color: var(--ivory); font-size: 15px; opacity: 0.8;
}
.lightbox__close:hover { opacity: 1; }

[hidden] { display: none !important; }

/* ============ MOBILE ============ */

@media (max-width: 900px) {
  .nav {
    top: 12px; left: 12px; right: 12px; transform: none;
    justify-content: space-between; gap: 12px;
    padding: 13px 18px;
  }
  .nav__links {
    position: fixed; inset: 0; z-index: -1;
    flex-direction: column; align-items: center; justify-content: center; gap: 30px;
    background: var(--card);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    opacity: 0; pointer-events: none;
    transition: opacity 300ms ease;
  }
  .nav__links a { font-size: 17px; letter-spacing: 0.14em; }
  .nav.is-open .nav__links { opacity: 1; pointer-events: auto; }
  .nav__burger {
    display: grid; gap: 5px; padding: 6px;
  }
  .nav__burger span {
    display: block; width: 20px; height: 2px; background: var(--ink);
    transition: transform 250ms ease;
  }
  .nav.is-open .nav__burger span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .nav.is-open .nav__burger span:last-child  { transform: translateY(-3.5px) rotate(-45deg); }

  .lightbox__nav { width: 42px; height: 42px; font-size: 15px; top: auto; bottom: -64px; transform: none; }
  .lightbox__nav:hover { transform: scale(1.07); }
  .lightbox__nav--prev { left: 4px; }
  .lightbox__nav--next { right: 4px; }

  .clock { top: auto; bottom: 52px; right: 12px; font-size: 11px; padding: 10px 12px; }
  .clock__label { display: none; }
  .clock__panel { top: auto; bottom: calc(100% + 10px); }
  .footnote--right, .footnote--left { display: none; }
  .panel__close { margin-right: -8px; }
}

/* ============ REDUCED MOTION ============ */

@media (prefers-reduced-motion: reduce) {
  .hint__glyph, .clock__dot, .tile__live::before { animation: none; }
  .loader { transition-duration: 1ms; }
  .tile { transition-duration: 1ms; }
}
