/* ==========================================================================
   mashanovoselsky.art
   A gallery wall, not a webpage: plaster ground, hung work, printed labels.
   ========================================================================== */

:root {
  /* Palette */
  --plaster:     #e9e7e2;  /* the wall */
  --plaster-lit: #f2f0ec;  /* wall where the light falls */
  --vellum:      #f7f6f3;  /* card and panel stock */
  --payne:       #232b36;  /* text: payne's grey, never pure black */
  --pencil:      #767e8a;  /* secondary text */
  --ultramarine: #2b4c9b;  /* the single pigment: links, focus, current state */
  --vitrine:     #14181f;  /* the viewer, lights down */
  --hair:        rgba(35, 43, 54, 0.16);
  --hair-soft:   rgba(35, 43, 54, 0.08);

  /* Type */
  --display: "Bodoni Moda", "Didot", "Times New Roman", serif;
  --body: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* Rhythm */
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --measure: 1240px;
  --shadow-hung:
    0 1px 2px rgba(20, 24, 31, 0.18),
    0 18px 40px -22px rgba(20, 24, 31, 0.55);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--plaster);
  color: var(--payne);
  font-family: var(--body);
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

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

button { font: inherit; color: inherit; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--payne);
  color: var(--vellum);
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip:focus { left: 0; }

/* --------------------------------------------------------------- masthead */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem var(--gutter);
  background: color-mix(in srgb, var(--plaster) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--hair-soft);
}

.masthead__name { display: flex; align-items: baseline; gap: 0.85rem; flex-wrap: wrap; }

.masthead__title {
  font-family: var(--display);
  font-size: clamp(1.15rem, 1rem + 1vw, 1.6rem);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.masthead__tagline,
.masthead__nav a,
.label__meta,
.label__count,
.section-head__note,
.crumb,
.pager__dir,
.album-card__meta,
.album__meta {
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--pencil);
}

.masthead__nav { display: flex; gap: 1.25rem; }
.masthead__nav a { padding-bottom: 2px; border-bottom: 1px solid transparent; }
.masthead__nav a:hover { color: var(--payne); }
.masthead__nav a[aria-current="page"] {
  color: var(--payne);
  border-bottom-color: var(--ultramarine);
}

/* ------------------------------------------------------- the wall (hero) */

.wall {
  padding: clamp(1.75rem, 5vw, 4rem) var(--gutter) clamp(1rem, 3vw, 2rem);
  background:
    radial-gradient(120% 80% at 50% 0%, var(--plaster-lit) 0%, var(--plaster) 62%);
}

.wall__stage {
  position: relative;
  max-width: var(--measure);
  margin: 0 auto;
  height: clamp(340px, 58vh, 620px);
}

.wall__slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.85s ease;
}
.wall__slide.is-current { opacity: 1; visibility: visible; }

.wall__link {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
  min-width: 0;
}

.wall__slide img {
  max-height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  box-shadow: var(--shadow-hung);
  background: var(--vellum);
}

/* The wall label: the one element the whole design is built around. */
.plaque {
  flex: 0 0 auto;
  width: min(230px, 34vw);
  padding-left: 1rem;
  border-left: 1px solid var(--hair);
  align-self: flex-end;
  margin-bottom: 0.35rem;
}

.label__title {
  margin: 0 0 0.3rem;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.25;
  font-weight: 400;
}

.label__year {
  font-style: normal;
  font-family: var(--body);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--pencil);
  margin-left: 0.5rem;
  white-space: nowrap;
}

.label__meta { margin: 0 0 0.35rem; line-height: 1.5; }

.label__from {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--pencil);
}
.label__from a { border-bottom: 1px solid var(--hair); color: var(--payne); }
.label__from a:hover { border-bottom-color: var(--ultramarine); color: var(--ultramarine); }

.wall__controls {
  max-width: var(--measure);
  margin: clamp(1rem, 3vw, 1.75rem) auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.wall__nav {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  color: var(--pencil);
  font-size: 1rem;
  line-height: 1;
  border-radius: 2px;
}
.wall__nav:hover { color: var(--ultramarine); }

/* Ticks read like the edges of frames along a wall. */
.wall__ticks { display: flex; align-items: center; gap: 0.55rem; }

.wall__tick {
  width: 1px;
  height: 14px;
  padding: 0;
  border: 0;
  background: var(--hair);
  cursor: pointer;
  transition: height 0.25s ease, background-color 0.25s ease;
}
.wall__tick:hover { background: var(--pencil); }
.wall__tick.is-current { height: 24px; background: var(--ultramarine); }

/* ------------------------------------------------------------ section head */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--hair);
}

.section-head__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.7rem, 1.2rem + 2.4vw, 3rem);
  line-height: 1.05;
  margin: 0;
  letter-spacing: -0.01em;
}

.section-head__note { margin: 0; }

/* ------------------------------------------------------------ album index */

.index, .album, .about {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4.5rem) var(--gutter);
}

.albums {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: clamp(1.5rem, 3.5vw, 2.75rem) clamp(1.25rem, 2.5vw, 2rem);
}

.album-card__frame {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--vellum);
  box-shadow: var(--shadow-hung);
  margin-bottom: 0.9rem;
}

.album-card__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.album-card a:hover .album-card__frame img { transform: scale(1.035); }

.album-card__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.35rem;
  line-height: 1.2;
  margin: 0 0 0.35rem;
  display: inline;
  background-image: linear-gradient(var(--ultramarine), var(--ultramarine));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s ease;
}
.album-card a:hover .album-card__title { background-size: 100% 1px; }

.album-card__meta {
  margin: 0.55rem 0 0;
  display: flex;
  gap: 0.85rem;
}

.album-card__note {
  margin: 0.5rem 0 0;
  color: var(--pencil);
  font-size: 0.875rem;
  line-height: 1.55;
}

/* ------------------------------------------------------------- album page */

.crumb { margin: 0 0 1rem; }
.crumb a { border-bottom: 1px solid var(--hair); }
.crumb a:hover { color: var(--ultramarine); border-bottom-color: var(--ultramarine); }

.album__head {
  max-width: 62ch;
  margin-bottom: clamp(2rem, 5vw, 3.25rem);
}

.album__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 1.3rem + 3.4vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 0.75rem;
}

.album__meta { display: flex; gap: 1.1rem; margin: 0 0 1.1rem; }

.album__note { color: var(--payne); line-height: 1.7; }

/* Justified rows: every work keeps its true proportions, rows fill the width. */
.works {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.25rem, 2.5vw, 2.25rem);
}
.works::after { content: ""; flex-grow: 999999; }

.work {
  margin: 0;
  flex: var(--ar, 1) 1 calc(var(--ar, 1) * 230px);
  min-width: min(100%, 210px);
}

.work__open {
  display: block;
  width: 100%;
  aspect-ratio: var(--ar, 1);
  padding: 0;
  border: 0;
  background: var(--vellum);
  cursor: zoom-in;
  box-shadow: var(--shadow-hung);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.work__open img { width: 100%; height: 100%; object-fit: cover; }
.work__open:hover { transform: translateY(-3px); }

.plaque--tile {
  width: auto;
  padding: 0.75rem 0 0 0.7rem;
  border-left: 1px solid var(--hair);
  margin: 0.9rem 0 0;
}
.plaque--tile .label__title { font-size: 0.95rem; }

.album__pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(3rem, 8vw, 5rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--hair);
}
.pager__link { display: grid; gap: 0.2rem; }
.pager__link--next { text-align: right; }
.pager__name { font-family: var(--display); font-size: 1.15rem; }
.pager__link:hover .pager__name { color: var(--ultramarine); }

/* ------------------------------------------------------------------ about */

.about__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
}
@media (min-width: 760px) {
  .about__body { grid-template-columns: 320px minmax(0, 1fr); }
}

.about__portrait img { box-shadow: var(--shadow-hung); width: 100%; }

.about__text { max-width: 62ch; line-height: 1.75; }
.about__contact { margin-top: 2rem; }
.about__contact a { border-bottom: 1px solid var(--ultramarine); }

/* ------------------------------------------------------------------ empty */

.empty { color: var(--pencil); }
.empty--page { max-width: var(--measure); margin: 0 auto; padding: clamp(3rem, 10vw, 7rem) var(--gutter); }
.empty__action a { color: var(--ultramarine); border-bottom: 1px solid var(--ultramarine); }

/* --------------------------------------------------------------- colophon */

.colophon {
  border-top: 1px solid var(--hair);
  padding: clamp(1.75rem, 4vw, 2.5rem) var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 1.5rem;
  max-width: var(--measure);
  margin: 0 auto;
}
.colophon__name { font-family: var(--display); margin: 0; font-size: 1.05rem; }
.colophon__links { margin: 0; display: flex; gap: 1.25rem; }
.colophon__links a {
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pencil);
}
.colophon__links a:hover { color: var(--ultramarine); }
.colophon__fine {
  margin: 0;
  flex-basis: 100%;
  font-size: 0.6875rem;
  color: var(--pencil);
}

/* ----------------------------------------------------------- the viewer */

.viewer {
  position: fixed;
  inset: 0;
  /* Dynamic viewport height: on phones, inset:0 measures the tall viewport
     and the image ends up under the browser chrome. */
  height: 100dvh;
  z-index: 90;
  background: var(--vitrine);
  color: var(--vellum);
  display: grid;
  /* minmax(0, 1fr), not 1fr. A bare 1fr means minmax(auto, 1fr), whose auto
     minimum stops the row shrinking below the image's natural height, so
     tall work overflows the screen. */
  grid-template-rows: minmax(0, 1fr) auto;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.viewer.is-open { opacity: 1; }

/* An author `display` value beats the browser's [hidden] rule, so the
   viewer must be hidden explicitly or it covers the page invisibly and
   swallows every click. The pointer-events line is a second safeguard. */
.viewer[hidden] { display: none !important; }
.viewer:not(.is-open) { pointer-events: none; }
.viewer.is-open { pointer-events: auto; }

.viewer__stage {
  display: grid;
  place-items: center;
  padding: clamp(2.75rem, 6vw, 4rem) clamp(1rem, 6vw, 5rem) 0.5rem;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.viewer__image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  cursor: zoom-in;
  transition: opacity 0.25s ease;
}
.viewer__image.is-loading { opacity: 0.15; }

/* Click the work to inspect it at full size, then drag or scroll around. */
.viewer__stage.is-zoomed {
  overflow: auto;
  place-items: center start;
  cursor: grab;
}
.viewer__stage.is-zoomed .viewer__image {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.viewer__label {
  padding: 1rem clamp(1rem, 6vw, 5rem) clamp(1.5rem, 4vw, 2.5rem);
  border-top: 1px solid rgba(247, 246, 243, 0.14);
  max-width: 70ch;
  /* A long description must never squeeze the artwork off the screen. */
  max-height: 32vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.viewer__label .label__title { color: var(--vellum); }
.viewer__label .label__meta,
.viewer__label .label__count { color: rgba(247, 246, 243, 0.6); }
.label__text {
  margin: 0.6rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: rgba(247, 246, 243, 0.86);
}
.label__count { margin: 0.9rem 0 0; }

.viewer__btn {
  position: absolute;
  background: none;
  border: 0;
  cursor: pointer;
  color: rgba(247, 246, 243, 0.72);
  padding: 0.5rem 0.75rem;
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.viewer__btn:hover { color: var(--vellum); }
.viewer__btn--close { top: 0.75rem; right: 0.75rem; }
.viewer__btn--play  { top: 0.75rem; left: 0.75rem; }
.viewer__btn--prev, .viewer__btn--next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  padding: 1rem;
}
.viewer__btn--prev { left: 0.25rem; }
.viewer__btn--next { right: 0.25rem; }

body.viewer-open { overflow: hidden; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 760px) {
  .wall__stage { height: auto; min-height: 0; }
  .wall__slide {
    position: absolute;
    flex-direction: column;
    align-items: stretch;
  }
  .wall__slide.is-current { position: relative; }
  .wall__link { height: auto; }
  .wall__slide img { max-height: 56vh; }
  .plaque {
    width: auto;
    padding: 0.85rem 0 0 0.75rem;
    margin-bottom: 0;
  }
  .masthead { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .work { flex: 1 1 100%; min-width: 0; }
  .viewer__btn--prev, .viewer__btn--next { top: auto; bottom: 0.25rem; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .masthead__nav, .wall__controls, .viewer, .colophon__links { display: none; }
  body { background: #fff; }
}

/* Short screens: give the work the room instead of the furniture. */
@media (max-height: 620px) {
  .viewer__stage { padding: 2.5rem 3rem 0.25rem; }
  .viewer__label {
    max-height: 26vh;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
  }
  .label__text { display: none; }
  .viewer__btn--prev, .viewer__btn--next { padding: 0.5rem; }
}
