/* Victoria Contreras — gallery wall */

:root {
  --plaster: #E6E5E1;
  --plaster-deep: #DCDBD6;
  --ink: #1C2127;
  --graphite: #5B5F63;
  --night: #22282F;
  --night-text: #E9E8E4;
  --night-muted: #A9ADB1;
  --oxblood: #7A1B28;
  --oxblood-deep: #5F1520;

  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --measure: 34rem;

  /* pixels per real centimetre: the whole collection shares one scale */
  --k: min(3.3px, calc((100vw - 2 * var(--gutter)) / 158));

  --canvas-shadow:
    0 1px 1px rgba(28, 33, 39, .18),
    0 22px 34px -20px rgba(28, 33, 39, .55);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--plaster);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--oxblood);
  outline-offset: 4px;
}

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

html.viewer-open { overflow: hidden; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem;
  background: var(--ink); color: var(--plaster);
  padding: .6rem 1rem; z-index: 10; text-decoration: none;
}
.skip:focus { top: 1rem; }

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

.masthead {
  position: absolute; inset: 0 0 auto 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 1.6rem var(--gutter);
}

.wordmark {
  display: inline-flex; flex-direction: column; align-items: center;
  text-decoration: none; line-height: 1;
}
.wordmark-name {
  font-family: var(--serif); font-weight: 500;
  font-size: 1.55rem; letter-spacing: .24em; text-transform: uppercase;
  margin-right: -.24em;
}
.wordmark-sub {
  font-size: .58rem; letter-spacing: .42em; text-transform: uppercase;
  margin-top: .45rem; margin-right: -.42em; color: var(--graphite);
}

.masthead ul {
  display: flex; gap: clamp(1rem, 2.6vw, 2.4rem);
  list-style: none; margin: 0; padding: 0;
}
.masthead nav a {
  font-size: .9rem; text-decoration: none;
  padding-block: .3rem;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .35s ease;
}
.masthead nav a:hover { background-size: 100% 1px; }

.masthead nav { margin-left: auto; }

.lang {
  display: flex; align-items: center; gap: .15rem;
  padding-left: clamp(.9rem, 1.8vw, 1.6rem);
  border-left: 1px solid rgba(28, 33, 39, .2);
}
.lang button {
  background: none; border: 0; cursor: pointer;
  min-width: 2.1rem; min-height: 2.1rem; padding: 0 .3rem;
  font-size: .78rem; letter-spacing: .06em;
  color: var(--graphite);
  text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: .45em;
  transition: color .25s, text-decoration-color .25s;
}
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { color: var(--ink); text-decoration-color: currentColor; }

@media (max-width: 620px) {
  /* Wordmark and languages share the top row; the sections sit beneath. */
  .masthead { flex-wrap: wrap; row-gap: .6rem; padding-top: 1.1rem; }
  .wordmark { align-items: flex-start; }
  .lang { order: 2; margin-left: auto; border-left: 0; padding-left: 0; margin-right: -.5rem; }
  .masthead nav { order: 3; flex-basis: 100%; margin-left: 0; }
  .masthead ul { justify-content: space-between; gap: .5rem; }
}

/* ---------- Hero: a single work, lit ---------- */

.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(to right, #DAD9D4, var(--plaster) 45%);
  min-height: max(100svh, 40rem);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  padding: 8rem var(--gutter) 5rem;
}

.hero-light {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 30% 26% at 70% 0%, rgba(255, 254, 250, 1), rgba(255, 254, 250, 0) 100%),
    radial-gradient(ellipse 34% 62% at 70% 42%, rgba(255, 253, 247, .95), rgba(255, 253, 247, 0) 72%),
    radial-gradient(ellipse 70% 80% at 70% 50%, rgba(255, 252, 244, .4), rgba(255, 252, 244, 0) 78%);
}

.hero-text { position: relative; z-index: 1; }

.hero-name {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(3.4rem, 8.4vw, 8.75rem);
  line-height: .92; letter-spacing: -.01em;
  margin: 0 0 1.75rem;
}
.hero-lede {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.25rem, 1.8vw, 1.6rem);
  line-height: 1.35; color: var(--graphite);
  margin: 0; max-width: 23rem;
}

.hero-work { position: relative; z-index: 1; margin: 0; }
.hero-hang { width: 100%; aspect-ratio: 3480 / 1866; }

/* The light comes up once, when the painting has loaded. */
.js .hero-light { opacity: 0; }
.js .hero-hang img { filter: brightness(.42) saturate(.55); }
.js .hero-text, .js .hero-work .placard { opacity: 0; }

.js .hero.is-lit .hero-light { opacity: 1; transition: opacity 2.2s cubic-bezier(.3, 0, .2, 1); }
.js .hero.is-lit .hero-hang img { filter: none; transition: filter 2.2s cubic-bezier(.3, 0, .2, 1); }
.js .hero.is-lit .hero-text { opacity: 1; transition: opacity 1.4s ease .9s; }
.js .hero.is-lit .hero-work .placard { opacity: 1; transition: opacity 1.2s ease 1.6s; }

@media (prefers-reduced-motion: reduce) {
  .js .hero-light, .js .hero-text, .js .hero-work .placard { opacity: 1; transition: none !important; }
  .js .hero-hang img { filter: none; transition: none !important; }
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    align-content: center;
    padding-top: 9rem;
    min-height: auto;
  }
  .hero-light {
    background:
      radial-gradient(ellipse 60% 22% at 50% 0%, rgba(255, 254, 250, 1), rgba(255, 254, 250, 0) 100%),
      radial-gradient(ellipse 80% 45% at 50% 62%, rgba(255, 253, 247, .9), rgba(255, 253, 247, 0) 72%);
  }
}
@media (max-width: 620px) {
  .hero { padding-top: 9.5rem; }
}

/* ---------- Hung work (shared by hero and collection) ---------- */

.hang {
  display: block; position: relative;
  padding: 0; border: 0; background: var(--plaster-deep);
  cursor: zoom-in;
  box-shadow: var(--canvas-shadow);
}
.hang img {
  width: 100%; height: 100%; object-fit: cover;
}

.placard {
  display: flex; flex-direction: column;
  margin-top: 1.1rem;
  font-size: .8rem; line-height: 1.45; color: var(--graphite);
}
.placard-title {
  font-family: var(--serif); font-style: italic;
  font-size: 1.15rem; line-height: 1.25; color: var(--ink);
  margin-bottom: .15rem;
}
.placard-untitled { font-style: normal; }

/* ---------- Section titles ---------- */

.section-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.2rem, 4.4vw, 3.6rem);
  line-height: 1.02; letter-spacing: -.005em;
  margin: 0 0 2rem;
}

/* ---------- Artist ---------- */

.artist {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2.5rem, 7vw, 7rem);
  align-items: start;
  padding: clamp(5rem, 10vw, 9rem) var(--gutter);
  border-top: 1px solid rgba(28, 33, 39, .12);
}

.artist-text {
  max-width: var(--measure);
  justify-self: end;
  font-family: var(--serif);
  font-size: 1.28rem; line-height: 1.62;
}
.artist-text p { margin: 0 0 1.1em; }
.statement-lead {
  font-size: clamp(1.55rem, 2.3vw, 1.95rem);
  line-height: 1.38;
}
.pull {
  margin: 2.2rem 0 2.4rem;
  padding-left: 1.4rem;
  border-left: 2px solid var(--oxblood);
}
.pull p {
  font-style: italic;
  font-size: clamp(1.45rem, 2.1vw, 1.8rem);
  line-height: 1.35; margin: 0;
}
.signature {
  font-style: italic; font-size: 1.5rem;
  margin-top: 2rem !important;
}

.artist-media {
  margin: 0;
  position: sticky; top: 3rem;
  max-width: 30rem;
}
.texture {
  width: 100%; height: auto; aspect-ratio: 4 / 3;
  background: var(--plaster-deep);
  box-shadow: var(--canvas-shadow);
}
.artist-media figcaption {
  margin-top: 1rem; font-size: .8rem; color: var(--graphite);
}

@media (max-width: 860px) {
  .artist { grid-template-columns: 1fr; }
  .artist-text { justify-self: start; font-size: 1.2rem; }
  .artist-media { position: relative; top: auto; order: -1; }
}

/* ---------- Collection ---------- */

.collection {
  padding: clamp(4rem, 8vw, 7rem) 0 clamp(4rem, 8vw, 6rem);
  border-top: 1px solid rgba(28, 33, 39, .12);
}

/* Intro on the left, a floor guide to the rooms on the right. */
.collection-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
  gap: 3rem clamp(3rem, 8vw, 8rem);
  align-items: end;
  padding: 0 var(--gutter);
}

/* A ruler drawn at the same scale as the hang. */
.ruler { display: flex; align-items: flex-start; gap: 1rem; color: var(--graphite); }
.ruler-caption { font-size: .75rem; line-height: 1; padding-top: .1rem; }
.ruler-body { display: block; width: calc(100 * var(--k)); }
.ruler-bar {
  display: block; height: 9px;
  border-top: 1px solid currentColor;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 1px 9px no-repeat,
    linear-gradient(currentColor, currentColor) 50% 0 / 1px 6px no-repeat,
    linear-gradient(currentColor, currentColor) 100% 0 / 1px 9px no-repeat;
}
.ruler-labels {
  display: flex; justify-content: space-between;
  margin-top: .35rem; font-size: .72rem; font-variant-numeric: tabular-nums;
}
.ruler-labels span:first-child { transform: translateX(-.2em); }
.ruler-labels span:last-child { transform: translateX(.6em); }

.rooms-nav ul { list-style: none; margin: 0; padding: 0; }
.rooms-nav li { border-top: 1px solid rgba(28, 33, 39, .16); }
.rooms-nav li:last-child { border-bottom: 1px solid rgba(28, 33, 39, .16); }
.rooms-nav a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .8rem 0;
  text-decoration: none;
}
.rooms-name {
  font-family: var(--serif); font-style: italic;
  font-size: 1.4rem; line-height: 1.2;
  transition: transform .3s ease;
}
.rooms-count { font-size: .78rem; color: var(--graphite); font-variant-numeric: tabular-nums; }
.rooms-nav a:hover .rooms-name { transform: translateX(.35rem); }
@media (prefers-reduced-motion: reduce) { .rooms-name { transition: none; } }

@media (max-width: 860px) {
  .collection-head { grid-template-columns: 1fr; }
}

.room {
  padding: clamp(5rem, 9vw, 8rem) 0 0;
  scroll-margin-top: 1rem;
}
.room-head {
  display: flex; align-items: baseline; gap: 1.25rem;
  padding: 0 var(--gutter) 1.1rem;
  margin: 0 var(--gutter) clamp(3rem, 6vw, 5rem);
  padding-inline: 0;
  border-bottom: 1px solid rgba(28, 33, 39, .16);
}
.room-name {
  font-family: var(--serif); font-weight: 400; font-style: italic;
  font-size: clamp(1.9rem, 3vw, 2.6rem); line-height: 1.1;
  margin: 0;
}
.room-count { font-size: .8rem; color: var(--graphite); font-variant-numeric: tabular-nums; }

/* The wall: works sit on a shared centre line, as they would be hung. */
.wall {
  display: flex; flex-wrap: wrap;
  justify-content: center; align-items: center;
  column-gap: clamp(2.5rem, 6vw, 6.5rem);
  row-gap: clamp(3.5rem, 7vw, 6rem);
  padding: 0 var(--gutter);
  list-style: none; margin: 0;
}

.work {
  width: calc(var(--wcm) * var(--k));
  max-width: 100%;
  margin: 0;
}
.work .hang { width: 100%; aspect-ratio: var(--ar); }
.work .hang img { transition: opacity .6s ease; }
.work .hang img[data-loading] { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .work .hang img { transition: none; } }

/* Narrow works still need room for their label. */
.work .placard { min-width: 9.5rem; }

/* ---------- Visit ---------- */

.visit {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
  padding: clamp(5rem, 9vw, 8rem) var(--gutter);
  background: var(--night); color: var(--night-text);
}
.visit-media { margin: 0; }
.visit-media img { width: 100%; height: auto; }
.visit-text { max-width: 26rem; }
.visit .section-title { color: var(--night-text); }
.visit address {
  font-style: normal; font-family: var(--serif);
  font-size: 1.5rem; line-height: 1.4;
  margin-bottom: 1.5rem;
}
.visit p { color: var(--night-muted); margin: 0 0 2rem; }
.hours { margin: 0 0 1.75rem; font-size: .92rem; }
.hours div {
  display: flex; justify-content: space-between; gap: 1.5rem;
  padding: .55rem 0; border-top: 1px solid rgba(233, 232, 228, .14);
}
.hours div:last-child { border-bottom: 1px solid rgba(233, 232, 228, .14); }
.hours dt { color: var(--night-muted); }
.hours dd { margin: 0; font-variant-numeric: tabular-nums; }
.visit .actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0; }
.visit :focus-visible { outline-color: var(--night-text); }

@media (max-width: 860px) {
  .visit { grid-template-columns: 1fr; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.9rem;
  padding: .75rem 1.35rem;
  font-family: var(--sans); font-size: .9rem; font-weight: 500;
  letter-spacing: .01em;
  text-decoration: none;
  border-radius: 2px;
  border: 1px solid transparent;
  transition: background-color .25s, border-color .25s, color .25s;
}
.btn-primary { background: var(--oxblood); color: #F7F1EE; }
.btn-primary:hover { background: var(--oxblood-deep); }
.btn-quiet { border-color: rgba(233, 232, 228, .38); color: var(--night-text); }
.btn-quiet:hover { border-color: var(--night-text); }

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

.colophon {
  padding: clamp(5rem, 10vw, 9rem) var(--gutter) 2.5rem;
  text-align: center;
}
.follow-lede {
  font-family: var(--serif); font-style: italic;
  font-size: 1.35rem; color: var(--graphite); margin: 0 0 .75rem;
}
.follow {
  display: inline-block;
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2rem, 7.2vw, 6.25rem);
  line-height: 1.05; letter-spacing: -.01em;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .5s ease, color .3s;
}
.follow:hover { background-size: 100% 1px; color: var(--oxblood); }
.small {
  font-size: .78rem; color: var(--graphite);
  margin: clamp(4rem, 8vw, 6rem) 0 0;
}

/* ---------- Viewer ---------- */

.viewer {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  overscroll-behavior: contain;
  margin: 0; padding: 0; border: 0;
  background: var(--night); color: var(--night-text);
}
.viewer::backdrop { background: rgba(20, 24, 28, .6); }
.viewer[open] { animation: viewer-in .35s ease; }
@keyframes viewer-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .viewer[open] { animation: none; } }

.viewer-inner {
  position: relative; height: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) 22rem;
}
.viewer-stage {
  display: grid; place-items: center;
  padding: clamp(1.5rem, 5vw, 4.5rem);
  min-height: 0;
}
.viewer-stage img {
  max-width: 100%;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .7);
}

.viewer-label {
  display: flex; flex-direction: column;
  padding: 5.5rem 2.5rem 2.5rem 0;
  overflow-y: auto;
}
.viewer-title {
  font-family: var(--serif); font-weight: 400; font-style: italic;
  font-size: 2.2rem; line-height: 1.1; margin: 0 0 1.5rem;
}
.viewer-title.is-untitled { font-style: normal; }
.viewer-facts { margin: 0 0 1.5rem; font-size: .9rem; }
.viewer-facts div { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding: .55rem 0; border-top: 1px solid rgba(233, 232, 228, .14); }
.viewer-facts div:last-child { border-bottom: 1px solid rgba(233, 232, 228, .14); }
.viewer-facts dt { color: var(--night-muted); }
.viewer-facts dd { margin: 0; }
.viewer-note {
  font-family: var(--serif); font-size: 1.2rem; line-height: 1.5;
  margin: 0 0 2rem;
}
.viewer-note:empty { display: none; }
.viewer-enquire { margin-bottom: 2rem; }
.viewer-hint { font-size: .8rem; color: var(--night-muted); margin: .75rem 0 0; }

.viewer-nav {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.viewer-btn, .viewer-close {
  background: none; border: 0; padding: .6rem 0; cursor: pointer;
  font-size: .9rem; color: var(--night-text);
  text-decoration: underline; text-decoration-color: rgba(233, 232, 228, .35);
  text-underline-offset: .3em;
}
.viewer-btn:hover, .viewer-close:hover { text-decoration-color: currentColor; }
.viewer-count { font-size: .8rem; color: var(--night-muted); font-variant-numeric: tabular-nums; }
.viewer-close { position: absolute; top: 1.5rem; right: 2.5rem; }
.viewer :focus-visible { outline-color: var(--night-text); }

@media (max-width: 860px) {
  .viewer { overflow-y: auto; }
  .viewer-inner { grid-template-columns: 1fr; grid-template-rows: auto auto; height: auto; min-height: 100%; }
  .viewer-stage { padding: 4rem 1.25rem 1.5rem; min-height: auto; }
  .viewer-label { padding: 0 1.25rem 1.75rem; overflow: visible; }
  .viewer-title { font-size: 1.8rem; }
  .viewer-close { top: 1rem; right: 1.25rem; }
}

/* ---------- Touch: comfortable targets ---------- */

@media (pointer: coarse) {
  .masthead nav a { display: inline-flex; align-items: center; min-height: 44px; padding-block: 0; }
  .lang button { min-width: 44px; min-height: 44px; }
  .viewer-btn, .viewer-close { min-height: 44px; }
  .rooms-nav a { min-height: 48px; }
}

/* ---------- Phone held sideways: short and wide ---------- */

@media (orientation: landscape) and (max-height: 540px) {
  .masthead { flex-direction: row; padding-top: 1rem; gap: 1rem; }
  .masthead nav { margin-left: auto; }
  .lang { border-left: 1px solid rgba(28, 33, 39, .2); padding-left: .9rem; margin-top: 0; }

  .hero {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-content: center;
    min-height: 100svh;
    padding: 5.5rem var(--gutter) 2rem;
    gap: 2rem;
  }
  .hero-name { font-size: clamp(2.4rem, 7vw, 3.6rem); margin-bottom: 1rem; }
  .hero-lede { font-size: 1.1rem; }
  .hero-work .placard { margin-top: .6rem; }

  /* Viewer: painting beside its details instead of above them. */
  .viewer-inner { grid-template-columns: minmax(0, 1fr) 17rem; grid-template-rows: none; height: 100%; min-height: 0; }
  .viewer-stage { padding: 1rem 1rem 1rem 1.25rem; min-height: 0; }
  .viewer-label { padding: 3.5rem 1.25rem 1rem 0; overflow-y: auto; }
  .viewer-title { font-size: 1.5rem; margin-bottom: 1rem; }
  .viewer-close { top: .5rem; right: 1.25rem; }
}
