/* Evan Sherman — site styles */
:root {
  --ink: #111;
  --muted: #9a9a9a;
  --link: #0006ff;
  --side: 230px;          /* left column */
  --edge: 32px;           /* page margin */
  --cell: 200px;          /* thumbnail box */
  --gap: 25px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: "Figtree", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
.center { text-align: center; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Left column: handwritten name, the three links, and on work pages the list of works */
.site-header {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--side);
  padding: 30px 0 30px var(--edge);
  overflow-y: auto;
}
.site-header .logo { display: inline-block; margin-bottom: 18px; }
.site-nav {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  font-size: 16px;
}
.site-nav a { transition: color .2s; }
.site-nav a:hover, .site-nav a.current { color: var(--muted); }
.site-header .work-list { margin-top: 48px; font-size: 14px; }

/* Year list (home page) */
.years {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  margin-top: 40px;
  font-size: 15px;
  color: var(--muted);
}
.years a { transition: color .2s; }
.years a:hover, .years a.current { color: var(--ink); }
.cell[hidden] { display: none; }

main { margin-left: var(--side); padding: 30px var(--edge) 80px 0; }

/* Home: thumbnails, each fitted whole inside the same box */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--cell), 1fr));
  gap: var(--gap);
  align-items: center;
  justify-items: center;
}
.cell { width: var(--cell); height: var(--cell); display: flex; align-items: center; justify-content: center; }
.cell img, .cell video { max-width: var(--cell); max-height: var(--cell); width: auto; height: auto; object-fit: contain; }
.cell:hover img, .cell:hover video { opacity: .75; }
/* the work's title appears just under its photo while the mouse is over it */
.thumb { position: relative; display: block; }
.cell-title {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  padding-top: 5px; white-space: nowrap; font-size: 12px; line-height: 1.2; color: var(--muted);
  opacity: 0; transition: opacity .2s;
}
.cell:hover .cell-title, .cell:focus-visible .cell-title { opacity: 1; }
@media (hover: none) { .cell-title { display: none; } }

/* List of works */
.work-list h2 { font-size: 1em; font-weight: 700; margin: 0 0 6px; }
.work-list ul { list-style: none; margin: 0 0 22px; padding: 0; }
.work-list li { font-style: italic; }
.work-list a:hover, .work-list a.current { color: var(--muted); }
.gallery-list .work-list { font-size: 18px; }
.gallery-list .work-list h2 { font-size: 28px; margin-bottom: 10px; }

/* Work pages */
.work-body { max-width: 860px; font-style: italic; }
.work-body p { margin: 0; }
.work-body .slideshow, .work-body .video, .work-body .single, .work-body .loop-video { margin: 0 0 40px; font-style: normal; }

/* Previous / Next work, under the caption */
.work-nav { max-width: 860px; margin-top: 56px; display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.work-nav a { transition: color .2s; }
.work-nav a:hover { color: var(--ink); }

/* Slideshows */
.slideshow { position: relative; }
.slide { display: flex; align-items: center; justify-content: center; margin-bottom: 16px; cursor: zoom-in; }
.slide img { max-height: 78vh; width: auto; object-fit: contain; }
/* only the photo showing takes up space, so the arrows and count hug it */
.js .slides { position: relative; }
.js .slide { position: absolute; top: 0; left: 0; width: 100%; margin: 0; opacity: 0; visibility: hidden; transition: opacity .4s ease; }
.js .slide.active { position: relative; opacity: 1; visibility: visible; }
/* small arrows just outside the photo's left and right edges, level with its middle
   (the count below takes 34px); slideshow.js keeps them next to whichever photo is showing */
.js .slideshow { padding: 0 30px; }
.slideshow .nav {
  display: none; position: absolute; top: calc((100% - 34px) / 2); transform: translateY(-50%); z-index: 2;
  width: 26px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer;
  align-items: center; justify-content: center; color: #c4c4c4;
  transition: color .2s;
}
.js .slideshow .nav { display: flex; }
.slideshow .nav:hover { color: var(--ink); }
.slideshow .prev { left: 0; }
.slideshow .next { right: 0; }
.slideshow .count { display: none; height: 34px; padding-top: 10px; font-size: 12px; color: #b5b5b5; letter-spacing: .04em; text-align: center; font-style: normal; }
.js .slideshow .count { display: block; }
.single { display: block; width: fit-content; max-width: 100%; cursor: zoom-in; }
/* a work with one photo: same height limit as a slideshow, and never stretched */
.single img { max-height: 78vh; width: auto; object-fit: contain; }

/* Viewer for an enlarged photo */
.lightbox {
  position: fixed; inset: 0; z-index: 20; display: none;
  align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .97);
}
.lightbox.open { display: flex; }
.lightbox img { max-width: calc(100vw - 160px); max-height: calc(100vh - 110px); width: auto; height: auto; object-fit: contain; }
.lightbox button { position: absolute; border: 0; background: none; padding: 10px; cursor: pointer; color: var(--ink); }
.lightbox button:hover { color: var(--muted); }
.lb-close { top: 14px; right: 18px; font-size: 34px; line-height: 1; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox.single-image .lb-prev, .lightbox.single-image .lb-next { display: none; }
.lb-count { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; font-size: 14px; color: var(--muted); }
.lightbox-open { overflow: hidden; }

/* Eight Octopi Day: the painting shows a little smaller */
.work-An-Eight-Octopi-Day .slide img, .work-An-Eight-Octopi-Day .single img { max-height: 62vh; }

/* Embedded videos */
.video { position: relative; aspect-ratio: 16 / 9; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Text pages */
.text-page { max-width: 760px; }
.text-page.about .center { color: #666; font-size: 20px; margin: 40px auto 64px; }
.text-page.about .about-photo { margin: 0 auto; width: 100%; max-width: 440px; }
.text-page hr { border: 0; border-top: 1px solid #ddd; margin: 8px 0 24px; }
.contact-info { margin: 54px 0 44px; }   /* first line level with About in the left column */
.contact-info p { margin: 0 0 4px; }
.contact-info a { color: var(--link); }
.contact-info a:hover { text-decoration: underline; }
.cv p { margin-bottom: 1.2em; }
.not-found { margin-top: 54px; }
.not-found a { color: var(--link); }

/* Phones and small tablets: the left column becomes a header */
@media (max-width: 760px) {
  :root { --edge: 16px; --gap: 12px; }
  .site-header { position: static; width: auto; padding: 22px var(--edge) 8px; overflow: visible; }
  .site-header .logo { margin-bottom: 12px; }
  .site-nav { flex-direction: row; flex-wrap: wrap; gap: 4px 22px; }
  .site-header .work-list { display: none; }
  .years { flex-direction: row; flex-wrap: wrap; gap: 4px 18px; margin-top: 14px; }
  .lightbox img { max-width: 100vw; max-height: calc(100vh - 120px); }
  .lb-prev { left: 4px; } .lb-next { right: 4px; }
  main { margin-left: 0; padding: 20px var(--edge) 60px; }
  :root { --cell: calc((100vw - 2 * var(--edge) - var(--gap)) / 2); }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .cell { width: 100%; height: auto; aspect-ratio: 1; }
  .text-page.about .center { font-size: 18px; margin: 28px auto 40px; }
  /* Cargo's blank spacer lines leave big holes on a small screen */
  .text-page.about br:has(+ .about-photo), .text-page.about .about-photo + br + br,
  .text-page.about > div > div:first-child { display: none; }
  .work-body > br + br { display: none; }
  .work-body .slideshow, .work-body .video, .work-body .single, .work-body .loop-video { margin-bottom: 24px; }
  .work-nav { margin-top: 40px; }
  .contact-info, .not-found { margin-top: 0; }
}

/* Intro: just the video; on entering, the white of the sparks blows out until the
   whole frame is white like the page around it, then the grid shows through. No zoom. */
.intro {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; cursor: pointer; overflow: hidden; outline: none;
}
.no-intro .intro { display: none; }
.intro-frame { width: min(38vh, 60vw); aspect-ratio: 1; }
.intro-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.intro::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.intro.flaring { cursor: default; }
/* White washes over the video: the sparks (already near white) disappear into it first, and the
   purple tint stays, just paling to lavender, instead of being pushed into a bright blue. */
.intro-frame { position: relative; }
.intro-frame::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.intro.flaring .intro-frame::after { animation: wash 1.5s cubic-bezier(.5, 0, .8, .5) forwards; }
@keyframes wash { to { opacity: 1; } }
.intro.flaring::after { opacity: 1; transition: opacity .35s ease 1.35s; }
@media (prefers-reduced-motion: reduce) {
  .intro.flaring .intro-frame::after { animation: none; opacity: 1; }
  .intro.flaring::after { transition: opacity .4s ease; }
}
/* small grey "Enter" just under the video; it fades as the white comes in */
.intro-enter {
  position: absolute; top: 100%; left: 0; right: 0; padding-top: 14px; text-align: center;
  font-size: 12px; letter-spacing: .08em; color: var(--muted); transition: opacity .4s ease;
}
.intro.flaring .intro-enter { opacity: 0; }
.intro.leaving { opacity: 0; transition: opacity .7s ease; pointer-events: none; }
.intro-open { overflow: hidden; }

/* AVIF photos come wrapped in <picture>; let the <img> inside lay out as before */
picture { display: contents; }
