/* ------------------------------------------------------------------
   LÉO — Dark Gallery
   Palette lifted from the paintings themselves: the snow-fleck navy of
   the night portraits, the mossy green of the jaguar piece, and the
   small teal accent from the beaded necklace.
   ------------------------------------------------------------------ */

:root {
  --bg:        #0E1620;
  --bg-2:      #131E2A;
  --surface:   #1B2A38;
  --line:      rgba(242, 237, 228, 0.10);
  --ink:       #F2EDE4;
  --ink-dim:   rgba(242, 237, 228, 0.62);
  --ink-faint: rgba(242, 237, 228, 0.38);
  --accent:    #8FD8CC;
  --accent-2:  #C98A6B;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand:  "Caveat", "Segoe Script", cursive;

  --gutter: clamp(1rem, 4vw, 3.5rem);
  --maxw: 1500px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* A faint grain over the whole page so flat areas don't read as plastic —
   it echoes the canvas texture in the paintings. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }

/* The rule above outranks the UA's [hidden] { display: none }, so restate it —
   otherwise hiding the still behind the time-lapse leaves both on screen. */
[hidden] { display: none !important; }

a { color: inherit; }

::selection { background: var(--accent); color: #0E1620; }

/* --------------------------------------------------------------- header --- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem var(--gutter);
  background: rgba(14, 22, 32, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transform: translateY(-100%);
  transition: transform 0.5s var(--ease), border-color 0.5s var(--ease);
}
.topbar.is-visible { transform: translateY(0); border-bottom-color: var(--line); }

.topbar__mark {
  font-weight: 700;
  letter-spacing: 0.34em;
  font-size: 0.95rem;
  text-decoration: none;
}

.topbar__nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2.25rem);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.topbar__nav a {
  text-decoration: none;
  color: var(--ink-dim);
  transition: color 0.3s var(--ease);
}
.topbar__nav a:hover { color: var(--accent); }

/* ----------------------------------------------------------------- hero --- */

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  transform: scale(1.06);
  animation: drift 24s var(--ease) forwards;
}
@keyframes drift { to { transform: scale(1); } }

/* Two scrims: one to seat the type, one to melt the image into the page. */
.hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(14,22,32,0.72) 0%, rgba(14,22,32,0.18) 34%, rgba(14,22,32,0.86) 78%, var(--bg) 100%),
    linear-gradient(90deg, rgba(14,22,32,0.66) 0%, rgba(14,22,32,0) 58%);
}

.hero__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(3.5rem, 10vh, 7rem);
}

.hero__mark {
  font-size: clamp(4.5rem, 17vw, 12rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 0.9;
  margin: 0;
}
.hero__mark span { display: inline-block; }

.hero__tagline {
  font-family: var(--hand);
  font-size: clamp(1.35rem, 3.4vw, 2.1rem);
  color: var(--accent);
  margin: 0.4rem 0 0;
  line-height: 1.3;
}

.hero__blurb {
  max-width: 34ch;
  margin: 1.6rem 0 0;
  color: var(--ink-dim);
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
}

.hero__scroll {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 2.6rem;
  font-size: 0.74rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 0.3s var(--ease);
}
.hero__scroll:hover { color: var(--accent); }
.hero__scroll i {
  display: block;
  width: 46px;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  animation: pull 2.6s var(--ease) infinite;
}
@keyframes pull {
  0%, 100% { transform: scaleX(0.35); opacity: 0.5; }
  50%      { transform: scaleX(1);    opacity: 1; }
}

/* -------------------------------------------------------------- sections -- */

.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(4rem, 11vh, 8rem) var(--gutter);
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(2rem, 5vh, 3.25rem);
}

.section__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
  margin: 0;
  font-variation-settings: "SOFT" 0, "WONK" 1;
}

.section__count {
  font-size: 0.74rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* --------------------------------------------------------------- filters -- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.5rem 1.05rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.chip:hover { color: var(--ink); border-color: rgba(143, 216, 204, 0.45); }
.chip[aria-pressed="true"] {
  color: #0E1620;
  background: var(--accent);
  border-color: var(--accent);
}

/* --------------------------------------------------------------- gallery -- */

/* CSS columns keep the native portrait ratios intact without cropping —
   which matters here, every piece is a full composition. */
.gallery {
  columns: 4 300px;
  column-gap: clamp(0.9rem, 2vw, 1.75rem);
}

/* The card is a plain wrapper: the artwork and the time-lapse badge are two
   separate buttons inside it, opening two different views. */
.card {
  position: relative;
  display: block;
  width: 100%;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 0 clamp(0.9rem, 2vw, 1.75rem);
  break-inside: avoid;
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.card.is-in { opacity: 1; transform: none; }

.card__main {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card img {
  width: 100%;
  height: auto;
  transition: transform 1.1s var(--ease), filter 0.6s var(--ease);
  filter: saturate(0.94);
}
.card:hover img,
.card:focus-within img { transform: scale(1.045); filter: saturate(1.06); }

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(242, 237, 228, 0.06);
  border-radius: 3px;
  pointer-events: none;
  transition: box-shadow 0.4s var(--ease);
}
.card:hover::after,
.card:focus-within::after { box-shadow: inset 0 0 0 1px rgba(143, 216, 204, 0.55); }

.card__main:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

.card__meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 3.5rem 1.1rem 1rem;
  background: linear-gradient(180deg, rgba(14,22,32,0) 0%, rgba(14,22,32,0.88) 65%);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}
.card:hover .card__meta,
.card:focus-within .card__meta { opacity: 1; transform: none; }

.card__title {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.25;
  margin: 0;
}
.card__year {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin: 0.35rem 0 0;
}

/* Its own button: opens the artwork *and* the time-lapse, side by side.
   Clicking the artwork itself opens the piece on its own. */
.card__play {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 2;
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem 0.4rem 0.55rem;
  border: 0;
  border-radius: 999px;
  background: rgba(14, 22, 32, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(143, 216, 204, 0.45);
  color: var(--accent);
  font-family: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.card__play:hover {
  background: var(--accent);
  color: #0E1620;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.card__play:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card__play svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  stroke: none;
}

.gallery__empty {
  color: var(--ink-faint);
  font-family: var(--serif);
  font-size: 1.15rem;
  padding: 3rem 0;
}

/* ---------------------------------------------------------------- footer -- */

.footer {
  border-top: 1px solid var(--line);
  padding: clamp(2.5rem, 7vh, 4.5rem) var(--gutter);
  text-align: center;
}

.footer__fine {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* -------------------------------------------------------------- lightbox -- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: rgba(6, 10, 15, 0.97);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s var(--ease);
}
.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox__bar {
  position: relative;
  z-index: 3;               /* stays above the media, always clickable */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem clamp(0.75rem, 2.5vw, 2rem);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* Padding is deliberately tight — the media should own the screen. The nav
   arrows float over the edges rather than reserving gutters of their own. */
.lightbox__stage {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: clamp(0.6rem, 1.6vw, 1.5rem);
  padding: 0 clamp(0.75rem, 2.5vw, 2.5rem);
  min-height: 0;
}

.lightbox__hint {
  margin-left: auto;
  margin-right: 0.75rem;
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  opacity: 0.75;
}
@media (max-width: 520px) { .lightbox__hint { display: none; } }

.lightbox__pane {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 0.5rem;
  margin: 0;
  min-width: 0;
  min-height: 0;
}

.lightbox__pane figcaption {
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* Both are stretched grid items rather than max-height:100% ones —
   percentage heights don't resolve reliably inside a grid area, and
   `scale-down` gives us contain-without-upscaling for free. */
.lightbox__stage img,
.lightbox__stage video {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: scale-down;
  border-radius: 2px;
  filter: drop-shadow(0 30px 70px rgba(0, 0, 0, 0.6));
  animation: pop 0.5s var(--ease);
}

/* The still keeps its own caption row empty so both panes line up. */
.lightbox__stage:not(.has-video) .lightbox__pane { grid-template-rows: 1fr; }
@keyframes pop {
  from { opacity: 0; transform: scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.lightbox__caption {
  padding: 0.9rem clamp(0.75rem, 2.5vw, 2rem) 1.4rem;
  text-align: center;
}
.lightbox__caption h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.15rem, 3vw, 1.7rem);
  margin: 0;
}
.lightbox__caption p {
  margin: 0.35rem 0 0;
  color: var(--ink-dim);
  font-size: 0.9rem;
}
.iconbtn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(242, 237, 228, 0.04);
  color: var(--ink);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.iconbtn:hover { background: rgba(143, 216, 204, 0.14); border-color: var(--accent); }
.iconbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.iconbtn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}
.lightbox__nav--prev { left: clamp(0.5rem, 2vw, 1.75rem); }
.lightbox__nav--next { right: clamp(0.5rem, 2vw, 1.75rem); }

/* --------------------------------------------------------------- utility -- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.is-locked { overflow: hidden; }

@media (max-width: 640px) {
  .topbar__nav { gap: 1rem; font-size: 0.72rem; }
  .gallery { columns: 2 150px; }
  .lightbox__stage { padding: 0 0.75rem; }
  .lightbox__nav { top: auto; bottom: -3.75rem; transform: none; }

  /* No room for two panes side by side — stack still over time-lapse. */
  .lightbox__stage.has-video {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-auto-rows: 1fr;
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .card { opacity: 1; transform: none; }
}
