/* ==========================================================
   GARRETT NELSON — THE FULL ARCHIVE
   Swiss skeleton, wild wall. 700+ works, nothing curated out.
   ========================================================== */

:root {
  --ink: #111111;
  --grey: #767676;
  --hairline: #e3e3e3;
  --bg: #ffffff;
  --red: #d91f16;
  --pad: clamp(1rem, 3vw, 3.5rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
::selection { background: var(--red); color: var(--bg); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.mono {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 0.625rem;
  letter-spacing: 0.08em;
}

/* ---------- opening splash ---------- */
#splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  cursor: pointer;
}

#splash img {
  max-height: 88vh;
  max-width: 94vw;
  width: auto;
  box-shadow: 0 30px 80px rgba(17, 17, 17, 0.18);
}

#splash .mono {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--grey);
  letter-spacing: 0.14em;
  white-space: nowrap;
}

/* ---------- ambient WebGL ---------- */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ---------- scroll progress hairline ---------- */
#progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  background: var(--red);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 30;
}

/* ---------- header ---------- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem var(--pad);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
header .works-count { color: var(--red); }
header a:hover { color: var(--grey); }

header .switch { display: flex; gap: 1.5rem; }
header .switch a[aria-current="page"] {
  color: var(--red);
  border-bottom: 1px solid var(--red);
}

@media (max-width: 640px) {
  header .works-count { display: none; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: 12rem var(--pad) 7rem;
  max-width: 1800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(3rem, 11vw, 11rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.92;
}

.hero .line { display: block; overflow: hidden; }
.hero .line-inner { display: block; }

.hero .meta {
  margin-top: 2.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey);
}
.hero .meta .red { color: var(--red); }

/* ---------- year sections ---------- */
.year {
  position: relative;
  padding: 6rem 0 4rem;
}

.year .numeral {
  position: absolute;
  top: 0;
  right: -0.05em;
  font-size: clamp(8rem, 30vw, 34rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 1px rgba(17, 17, 17, 0.13);
  pointer-events: none;
  user-select: none;
  z-index: -1;
  white-space: nowrap;
}

.year:nth-of-type(even) .numeral {
  right: auto;
  left: -0.05em;
}

.year .year-head {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0 var(--pad);
  margin-bottom: 3rem;
}

.year .year-head h2 {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.year .year-head .tab {
  background: var(--red);
  color: #fff;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
}

.year .year-head .rule {
  flex: 1;
  height: 1px;
  background: var(--ink);
}

/* ---------- the wall ---------- */
.wall {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(0.9rem, 2vw, 2.2rem);
  padding: 0 var(--pad);
  align-items: start;
}

.wall figure { position: relative; }

.wall button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: none;
  cursor: zoom-in;
}

.wall img {
  width: 100%;
  background: #f4f4f2;
  transition: transform 0.35s cubic-bezier(0.2, 0.6, 0.2, 1), box-shadow 0.35s ease;
}

.wall button:hover img {
  transform: scale(1.025) rotate(0deg) !important;
  box-shadow: 0 14px 40px rgba(17, 17, 17, 0.18);
  z-index: 5;
  position: relative;
}

.wall figcaption {
  margin-top: 0.45rem;
  color: var(--grey);
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
}

.wall figcaption .idx { color: var(--red); }
.wall figcaption .t {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* span classes assigned by generator (seeded) */
.s2 { grid-column: span 2; }
.s3 { grid-column: span 3; }
.s4 { grid-column: span 4; }
.s6 { grid-column: span 6; }
.s8 { grid-column: span 6; }

@media (max-width: 1024px) {
  .s2, .s3 { grid-column: span 4; }
  .s4 { grid-column: span 6; }
  .s6, .s8 { grid-column: span 8; }
}

@media (max-width: 640px) {
  .s2, .s3, .s4 { grid-column: span 6; }
  .s6, .s8 { grid-column: span 12; }
}

/* ---------- curated (Selected) — editorial pace ---------- */
.sel {
  max-width: 1500px;
  margin: 0 auto;
  padding: 2rem var(--pad) 4rem;
}

.sel figure {
  margin-bottom: clamp(6rem, 14vh, 11rem);
}

/* four alternating placements — wide left, mid right, tall center, wide right */
.sel .p0 { width: min(100%, 68%); }
.sel .p1 { width: min(100%, 52%); margin-left: auto; }
.sel .p2 { width: min(100%, 44%); margin-left: 18%; }
.sel .p3 { width: min(100%, 60%); margin-left: auto; margin-right: 6%; }

@media (max-width: 820px) {
  .sel .p0, .sel .p1, .sel .p2, .sel .p3 {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}

.sel button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: none;
  cursor: zoom-in;
}

.sel img {
  width: 100%;
  background: #f4f4f2;
}

.sel figcaption {
  margin-top: 0.7rem;
  color: var(--grey);
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

.sel figcaption .t { color: var(--ink); }
.sel figcaption .n { color: var(--grey); }

.sel .closer { margin-top: clamp(8rem, 20vh, 16rem); }

/* ---------- series head (Anacronica) ---------- */
.series-head {
  margin: clamp(4rem, 10vh, 8rem) 0 0;
  border-top: 2px solid var(--ink);
  padding-top: 1.25rem;
}

.series-head h2 {
  font-size: clamp(2.5rem, 7vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 0.95;
}

.series-head .red { color: var(--red); }

/* ---------- contact page ---------- */
.contact-hero { min-height: 70vh; }

.contact-email {
  display: inline-block;
  margin-top: 2.5rem;
  font-size: clamp(1.5rem, 5vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  border-bottom: 3px solid var(--red);
}

.contact-email:hover { color: var(--red); }

/* ---------- pairs ---------- */
.sel .pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.25rem, 3vw, 3rem);
  align-items: start;
  margin-bottom: clamp(6rem, 14vh, 11rem);
}

.sel .pair figure { margin-bottom: 0; }

@media (max-width: 680px) {
  .sel .pair { grid-template-columns: 1fr; gap: 3rem; }
}

/* ---------- flip-through galleries ---------- */
.gal {
  margin: clamp(6rem, 14vh, 11rem) calc(-1 * var(--pad));
}

.gal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 2rem;
  padding: 0 var(--pad) 1.25rem;
  border-top: 2px solid var(--ink);
  padding-top: 1rem;
  margin: 0 var(--pad);
}

.gal-title {
  font-size: clamp(1.1rem, 2.2vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  flex-basis: 100%;
}

.gal-head .red { color: var(--red); }
.gal-note { color: var(--grey); }

.gal-arrows { margin-left: auto; display: flex; gap: 0.4rem; }
.gal-arrows button {
  border: 1px solid var(--ink);
  background: none;
  font: inherit;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
}
.gal-arrows button:hover { background: var(--ink); color: var(--bg); }

.strip {
  display: flex;
  gap: clamp(1rem, 2vw, 2rem);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 1.5rem var(--pad) 2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
}

.strip button {
  flex: 0 0 auto;
  border: 0;
  padding: 0;
  background: none;
  cursor: zoom-in;
  scroll-snap-align: start;
}

.strip img {
  height: min(58vh, 560px);
  width: auto;
  /* aspect ratio is sacred: wide images are capped just under the
     viewport and letterboxed (object-fit) — never squished, and the
     white gap between views stays visible */
  max-width: 88vw;
  object-fit: contain;
  display: block;
}

.gal.book .strip img {
  height: min(64vh, 620px);
  box-shadow: 0 10px 30px rgba(17, 17, 17, 0.12);
}

@media (max-width: 640px) {
  .strip img {
    height: min(42vh, 400px);
  }
  .gal.book .strip img {
    height: min(50vh, 460px);
  }
}

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--hairline); margin-top: 6rem; }
footer .inner {
  padding: 3rem var(--pad) 4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 3rem;
  justify-content: space-between;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey);
}
footer a:hover { color: var(--ink); }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  background: var(--bg);
}
.lightbox.open { display: flex; }

.lightbox .bar {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 1.1rem var(--pad) 0;
}
.lightbox .count {
  margin-right: auto;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--grey);
}
.lightbox .stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem var(--pad);
}
.lightbox .stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
.lightbox .cap {
  padding: 0 var(--pad) 1.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--grey);
  min-height: 2.6rem;
}
.lightbox button {
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 0.4rem 0.7rem;
}
.lightbox button:hover { color: var(--grey); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wall img { transition: none; }
  #progress { display: none; }
}
