/* Mikhail Magaril: site styles.
   Desktop (1100px and wider) reproduces the original 2018 layout, measured
   from the live site. Narrower screens get a stacked, phone-friendly layout. */

html { overflow-y: scroll; }
body {
  margin: 0;
  color: #000;
  background: #fff;
  font-family: Times, "Times New Roman", serif;
  animation: fadein 1.5s;
}
@keyframes fadein { from { opacity: .5; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { body { animation: none; } }
img { border: 0; }
a:focus-visible, button:focus-visible { outline: 2px solid #999; outline-offset: 2px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  width: 1090px;
  height: 106px;
  margin: 34px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.logo { display: block; margin-left: 2px; line-height: 0; }
.logo img { width: 144px; height: 36px; }
.site-nav { display: flex; gap: 50px; }
.site-nav a {
  font: 15px/20px "Playfair Display", Georgia, "Times New Roman", Times, serif;
  letter-spacing: 1px;
  color: #000;
  text-decoration: none;
  transition: color .45s;
}
.site-nav a:hover { color: #999; }
.site-nav .nav-contact { display: none; } /* desktop uses the side tab */

.contact-tab {
  position: fixed;
  z-index: 8000;
  top: 180px;
  right: 70px;
  width: 25px;
  height: 140px;
  background: url(/assets/contact-tab.jpg) no-repeat;
  transition: background .5s;
}
.contact-tab:hover { background-image: url(/assets/contact-tab-hover.jpg); }

/* ---------- Gallery pages (painting series, sculptures, works on paper) ---------- */
.gallery {
  width: 1090px;
  height: 630px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: 630px;
}
.gallery.with-series { grid-template-columns: 231px 231px 622px; }
.gallery.no-series { grid-template-columns: 461px 622px; }
.series-col { grid-column: 1; grid-row: 1; }
.with-series .thumbs-col { grid-column: 2; grid-row: 1; }
.with-series .viewer { grid-column: 3; grid-row: 1; }
.no-series .thumbs-col { grid-column: 1; grid-row: 1; }
.no-series .viewer { grid-column: 2; grid-row: 1; }

.series-col, .thumbs-col { border-left: 1px solid #999; }
.col-label {
  margin: 0;
  font: 12px/15px Verdana, Geneva, sans-serif;
  color: #000;
}

.series-col { padding: 16px 0 0 40px; }
.series-col .col-label { margin-bottom: 61px; }
.series-list { list-style: none; margin: 0; padding: 0; }
.series-list li { margin: 0 0 40px; font-size: 10px; line-height: 18.5px; }
.series-list a {
  font-family: Times, "Times New Roman", serif;
  font-size: 10px;
  letter-spacing: 1px;
  color: #000;
  text-decoration: none;
  transition: color .45s;
}
.series-list a:hover { color: #999; }

.thumbs-col .col-label { width: 150px; margin: 0 auto 25px; }
.thumbs {
  width: 150px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 57px 57px;
  column-gap: 21px;
  row-gap: 15px;
  align-items: start;
}
.thumbs.thumbs-many { grid-template-columns: repeat(3, 40px); column-gap: 10px; row-gap: 14px; }
.no-series .thumbs { grid-template-columns: 66px 66px; column-gap: 18px; row-gap: 30px; }
.thumb { display: block; line-height: 0; }
.thumb img { width: 100%; height: auto; }

.viewer {
  position: relative;
  overflow: hidden;
  border-left: 1px solid #999;
  border-right: 1px solid #999;
  height: 630px;
}
.slides { margin: 0; }
.slide { margin: 0; }
.slide-frame { width: 620px; height: 600px; }
.slide-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.slide figcaption {
  margin-left: 70px;
  padding-top: 10px;
  font: 12px/15px Verdana, Geneva, sans-serif;
  color: #000;
}
.arrow {
  position: absolute;
  z-index: 1;
  top: 50%;
  width: 60px;
  height: 60px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #333;
  font: 16px/60px "Times New Roman", Times, serif;
  text-align: center;
  opacity: .7;
  cursor: pointer;
  transform: translateY(-50%);
  transition: opacity .3s;
}
.arrow:hover { opacity: 1; }
.arrow.prev { left: 3px; }
.arrow.next { right: 3px; }

/* Without JavaScript every work is shown one after another. */
html:not(.js) .viewer { height: auto; overflow: visible; }
html:not(.js) .gallery { height: auto; grid-template-rows: auto; }
html:not(.js) .arrow { display: none; }
/* With JavaScript: one work at a time, sliding like the original. */
.js .slides { display: flex; height: 100%; transition: transform .8s; will-change: transform; }
.js .slide { flex: 0 0 100%; min-width: 0; }

/* ---------- Home ---------- */
.home {
  width: 1300px;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}
.home-portrait { flex: 0 0 37%; }
.home-portrait img { display: block; width: 80%; height: auto; margin: 75px 0 0 30px; }
.home-tiles {
  flex: 0 0 62%;
  padding: 140px 0 0 50px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(3, 210px);
  column-gap: 50px;
  row-gap: 40px;
  align-content: start;
}
.tile { position: relative; display: block; width: 210px; height: 280px; text-decoration: none; }
.tile-label {
  display: block;
  font: 20px/27px "Playfair Display", Georgia, "Times New Roman", Times, serif;
  letter-spacing: 1px;
  color: #000;
  transition: color .5s;
}
.tile:hover .tile-label { color: #999; }
.tile-pictures { position: absolute; top: 40px; left: 0; width: 210px; }
.tile-pictures img { position: absolute; top: 0; left: 0; width: 100%; height: auto; transition: opacity .5s ease-in-out; }
.tile:hover .tile-over { opacity: 0; }

/* ---------- Artist's books ---------- */
.books { width: 1094px; margin: 0 auto; padding-top: 80px; }
.book {
  display: grid;
  grid-template-columns: 547px 547px;
  align-items: start;
  border-bottom: 1px solid #ccc;
  padding-bottom: 70px;
  margin-bottom: 70px;
}
.book-main { grid-column: 1; }
.book-video { grid-column: 2; padding: 130px 20px 0; }
.book-text { grid-column: 1 / -1; width: 766px; margin-left: 8px; }
.book-title {
  margin: 0 0 0 8px;
  padding-bottom: 25px;
  font: 24px/32px "Playfair Display", Georgia, "Times New Roman", Times, serif;
  font-weight: normal;
  letter-spacing: 2px;
}
.book-details {
  list-style: none;
  margin: 4px 0 0 10px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  column-gap: 35px;
}
.book-details li {
  font: 14px/25px "Playfair Display", Georgia, "Times New Roman", Times, serif;
  letter-spacing: 1px;
}
.book-pages { margin-top: 39px; display: flex; flex-wrap: wrap; }
.book-page { display: block; width: 100px; height: 90px; margin-right: 11px; line-height: 0; }
.book-page img { width: 100px; height: 90px; }
.book-text p {
  margin: 18px 0;
  padding-right: 50px;
  border-right: 1px solid #ccc;
  font-size: 18px;
  line-height: 28px;
}

.youtube {
  position: relative;
  overflow: hidden;
  padding-top: 56.25%;
  background: #000;
  cursor: pointer;
}
.youtube img { position: absolute; left: 0; top: -16.82%; width: 100%; opacity: .7; }
.youtube iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.play-button {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 90px;
  height: 60px;
  border: 0;
  border-radius: 6px;
  background: #333;
  box-shadow: 0 0 30px rgba(0, 0, 0, .6);
  opacity: .8;
  transform: translate(-50%, -50%);
  cursor: pointer;
}
.play-button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border-style: solid;
  border-width: 15px 0 15px 26px;
  border-color: transparent transparent transparent #fff;
  transform: translate(-40%, -50%);
}

/* Full-screen viewer for book pages. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .85);
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; text-align: center; }
.lightbox img {
  display: block;
  max-width: calc(100vw - 140px);
  max-height: calc(100vh - 90px);
  padding: 10px;
  background: #fff;
  box-sizing: border-box;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .5);
}
.lightbox figcaption { margin-top: 10px; color: #fff; font: 13px Verdana, Geneva, sans-serif; }
.lightbox button {
  position: absolute;
  border: 0;
  background: none;
  color: #fff;
  font: 44px/1 Georgia, serif;
  opacity: .8;
  cursor: pointer;
  padding: 10px 16px;
}
.lightbox button:hover { opacity: 1; }
.lb-close { top: 8px; right: 12px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }
body.lb-open { overflow: hidden; }

/* ---------- Biography ---------- */
.bio { width: 1000px; margin: 0 auto; display: flex; align-items: flex-start; }
.bio-image { flex: 0 0 290px; padding: 0 20px; }
.bio-image img { display: block; width: 90%; height: auto; margin-top: 150px; }
.bio-text { flex: 0 0 600px; border-left: 1px solid #999; padding-left: 50px; }
.bio-text p {
  margin: 0 0 28px;
  padding: 0 20px;
  font: 18px/28px "Crimson Text", Georgia, "Times New Roman", Times, serif;
}
.bio-text p:first-of-type { margin-top: 18px; }

/* ---------- Contact ---------- */
.contact-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: no-repeat center / cover;
}
.contact-box { position: absolute; top: 30%; left: 43.8%; font-size: 16px; }
.contact-heading { margin: 16px 0; font: inherit; }
.contact-box p { margin: 16px 0; }
.contact-box a { color: inherit; text-decoration: none; }
.contact-box a:hover { text-decoration: underline; }

/* ---------- 404 ---------- */
.not-found { width: 1090px; margin: 40px auto; font-size: 16px; }
.not-found h1 { font: 24px "Playfair Display", Georgia, serif; letter-spacing: 2px; }
.not-found a { color: #000; }

/* =================== Tablets and phones =================== */
@media (max-width: 1099px) {
  .site-header {
    width: auto;
    height: auto;
    margin: 18px 16px 22px;
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }
  .logo { margin: 0; }
  .site-nav { flex-wrap: wrap; justify-content: center; gap: 6px 22px; }
  .site-nav a { font-size: 16px; line-height: 26px; }
  .site-nav .nav-contact { display: inline; }
  .site-nav a[aria-current="page"] { color: #999; }
  .contact-tab { display: none; }

  .gallery, .gallery.with-series, .gallery.no-series,
  html:not(.js) .gallery {
    display: block;
    width: auto;
    max-width: 660px;
    height: auto;
    margin: 0 auto 48px;
    padding: 0 14px;
  }
  .series-col { border: 0; padding: 0 0 16px; text-align: center; }
  .series-col .col-label { display: none; }
  .series-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
  .series-list li { margin: 0; font-size: 14px; line-height: 24px; }
  .series-list a { font-size: 13px; }
  .series-list a[aria-current="page"] { color: #999; }

  .viewer { border: 0; height: auto; }
  .slide-frame { width: 100%; height: auto; aspect-ratio: 620 / 600; }
  .slide figcaption { margin: 0; padding: 10px 2px 0; font-size: 13px; line-height: 1.45; min-height: 2.9em; }
  .arrow { top: calc(50% - 22px); width: 44px; height: 44px; font-size: 18px; line-height: 44px; opacity: .8; }

  .thumbs-col { border: 0; margin-top: 18px; }
  .thumbs-col .col-label { display: none; }
  .thumbs, .thumbs.thumbs-many, .no-series .thumbs {
    width: auto;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 10px;
  }

  .home { display: block; width: auto; padding: 20px 16px 40px; }
  .home-portrait img { width: 100%; max-width: 360px; margin: 0 auto; }
  .home-tiles {
    padding: 28px 0 0;
    max-width: 520px;
    margin: 0 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px 20px;
  }
  .tile { width: auto; height: auto; }
  .tile-label { font-size: 18px; line-height: 26px; }
  .tile-pictures { position: static; width: auto; margin-top: 8px; }
  .tile-pictures img { position: static; display: block; }
  .tile-under { display: none !important; }

  .books { width: auto; max-width: 660px; padding: 8px 14px 0; }
  .book { display: block; padding-bottom: 40px; margin-bottom: 40px; }
  .book-title { margin: 0; padding-bottom: 8px; font-size: 22px; line-height: 30px; }
  .book-details { margin: 0; column-gap: 22px; }
  .book-pages {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 6px;
  }
  .book-page, .book-page img { width: 100%; height: auto; margin: 0; }
  .book-video { padding: 22px 0 0; }
  .book-text { width: auto; margin: 6px 0 0; }
  .book-text p { padding-right: 0; border-right: 0; font-size: 17px; line-height: 27px; }

  .lightbox img { max-width: 100vw; max-height: calc(100vh - 110px); padding: 6px; }
  .lb-prev, .lb-next { top: auto; bottom: 6px; transform: none; }
  .lightbox figure { margin-bottom: 40px; }

  .bio { display: block; width: auto; max-width: 660px; padding: 0 16px 40px; }
  .bio-image { padding: 0; }
  .bio-image img { width: 60%; max-width: 260px; margin: 6px auto 8px; }
  .bio-text { border-left: 0; padding-left: 0; }
  .bio-text p { padding: 0; font-size: 18px; }

  .contact-box {
    position: relative;
    top: auto;
    left: auto;
    width: fit-content;
    margin: 14vh auto 0;
    padding: 4px 18px;
    text-align: center;
    background: rgba(255, 255, 255, .85);
  }

  .not-found { width: auto; margin: 30px 16px; }
}
