/* =========================================================
   neantir — quiet art-book theme
   paper, hairlines, the plates carry the page
   ========================================================= */

:root {
  --paper: #fbfaf7;              /* warm paper white */
  --paper-2: #f3f1ec;            /* deeper ivory */
  --ink: #1e2126;                /* reads black, isn't */
  --text: #2c3037;
  --muted: #6a707a;
  --faint: #9aa1ab;
  --line: rgba(30, 33, 38, 0.14);
  --line-soft: rgba(30, 33, 38, 0.07);

  /* the book's arc: winter silver -> open sea -> pool turquoise */
  --silver: #aebac3;
  --sea: #5f84a0;
  --deep: #33526b;
  --pool: #64a8a2;
  --grad: linear-gradient(100deg, var(--silver), var(--sea) 48%, var(--pool));

  --maxw: 1200px;
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --plate: min(58vh, 82vw, 600px);

  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  font-weight: 400;
  background: var(--paper);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--deep); color: var(--paper); }

.mono {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

:focus-visible { outline: 1.5px solid var(--sea); outline-offset: 3px; }

.skip-link {
  position: fixed; top: -60px; left: 1rem; z-index: 300;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 1rem; }

/* hide the native cursor only when the custom one is running */
html.has-cursor, html.has-cursor a, html.has-cursor button { cursor: none; }

/* ---------- fixed layers ---------- */
.grain {
  position: fixed; inset: 0; z-index: 250; pointer-events: none;
  opacity: 0.045; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* custom cursor */
.cursor { position: fixed; top: 0; left: 0; z-index: 280; pointer-events: none; mix-blend-mode: difference; }
.cursor__dot, .cursor__ring {
  position: absolute; top: 0; left: 0; border-radius: 50%;
  transform: translate(-50%, -50%);
}
.cursor__dot { width: 5px; height: 5px; background: #fff; }
.cursor__ring {
  width: 28px; height: 28px; border: 1px solid #fff;
  display: flex; align-items: center; justify-content: center;
  transition: width 0.25s ease, height 0.25s ease;
}
.cursor__label {
  font-family: var(--mono); font-size: 0.5rem; letter-spacing: 0.16em;
  color: #fff; opacity: 0; transition: opacity 0.2s ease;
}
.cursor.is-hover .cursor__ring { width: 42px; height: 42px; }
.cursor.is-view .cursor__ring { width: 60px; height: 60px; }
.cursor.is-view .cursor__label { opacity: 1; }
.cursor.is-view .cursor__dot { opacity: 0; }

/* ---------- masthead ---------- */
.masthead {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: baseline; justify-content: flex-end;
  gap: 1rem; padding: 1.1rem var(--gutter) 1.6rem;
  background: linear-gradient(to bottom, var(--paper) 42%, rgba(251, 250, 247, 0));
  pointer-events: none;
}
.masthead a { pointer-events: auto; }
.masthead__links { display: flex; align-items: baseline; gap: 1.5rem; }
.masthead__links a {
  color: var(--muted); display: inline-flex; align-items: baseline; gap: 0.3em;
  white-space: nowrap; transition: color 0.2s ease;
}
.masthead__links a:hover { color: var(--ink); }
.masthead__links .ext { width: 8px; height: 8px; opacity: 0.55; align-self: center; }

/* ---------- series (repeat one block per portfolio) ---------- */
.series__viewport { position: relative; }

.series__head { padding: 4.6rem var(--gutter) 1.2rem; }
.series__index { color: var(--faint); }
.series__title {
  font-style: italic; font-weight: 300; color: var(--ink);
  font-size: clamp(2.1rem, 4.5vw, 3.1rem); line-height: 1.1;
  margin: 0.35rem 0 0.45rem;
}
.series__note { color: var(--muted); }

.series__track {
  display: flex; align-items: center; gap: clamp(1.5rem, 4vw, 3.5rem);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 0.8rem max(var(--gutter), calc(50vw - var(--plate) / 2)) 1.2rem;
  scrollbar-width: none;
}
.series__track::-webkit-scrollbar { display: none; }

.plate { flex: none; width: var(--plate); scroll-snap-align: center; }
.series__track .plate:nth-child(even):not(.plate--end) { margin-top: 6vh; }
.plate__link { display: block; position: relative; }
.plate__link img {
  width: 100%; height: auto; aspect-ratio: 1 / 1; background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: 0 1px 2px rgba(30, 33, 38, 0.05), 0 18px 44px -24px rgba(30, 33, 38, 0.28);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.5s ease;
}
.plate__link:hover img {
  transform: translateY(-5px);
  box-shadow: 0 1px 2px rgba(30, 33, 38, 0.05), 0 28px 56px -26px rgba(30, 33, 38, 0.36);
}
.plate__cap {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 0.85rem; color: var(--faint);
}
.plate__num::after {
  content: ""; display: inline-block; width: 1.6em; height: 1px;
  background: var(--line); margin-left: 0.9em; vertical-align: middle;
}

/* the plate nearest centre carries full weight */
.gallery-ready .plate { transition: opacity 0.45s ease, transform 0.45s ease; }
.gallery-ready .plate:not(.is-active) { opacity: 0.42; transform: scale(0.97); }

.plate--end {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; text-align: center; border: 1px solid var(--line-soft);
  aspect-ratio: 1 / 1; background: var(--paper-2);
}
.plate__fin { font-style: italic; font-weight: 300; font-size: clamp(2.4rem, 6vw, 3.6rem); color: var(--ink); }
.plate__edition { color: var(--faint); max-width: 20em; }

.series__meta {
  display: flex; align-items: center; gap: 1.4rem;
  max-width: var(--maxw); margin: 0 auto;
  padding: 0.4rem var(--gutter) 1.2rem; color: var(--faint);
}
.series__progress { flex: 1; height: 1px; background: var(--line-soft); position: relative; }
.series__progress span {
  position: absolute; inset: 0; transform: scaleX(0); transform-origin: left;
  background: var(--grad); display: block;
}
.series__counter { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* sticky leaf-through mode (fine pointer + hover + wide + motion allowed) */
html.gallery-sticky .series__viewport {
  position: sticky; top: 0; height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
  padding-top: 4rem; /* keep plates clear of the absolute series head */
}
html.gallery-sticky .series__head {
  position: absolute; top: clamp(3.4rem, 8vh, 5rem);
  left: var(--gutter); right: var(--gutter); z-index: 2;
  padding: 0; pointer-events: none;
}
html.gallery-sticky .series__track {
  overflow: visible; scroll-snap-type: none; will-change: transform;
}

/* ---------- interlude ---------- */
.interlude {
  padding: clamp(7rem, 16vw, 13rem) var(--gutter);
  text-align: center;
}
.interlude__line {
  max-width: 800px; margin: 0 auto;
  font-style: italic; font-weight: 300; color: var(--ink);
  font-size: clamp(1.4rem, 3.2vw, 2.2rem); line-height: 1.45;
}

/* ---------- colophon ---------- */
.colophon {
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 var(--gutter) clamp(6rem, 12vw, 9rem);
}
.colophon__label { color: var(--faint); display: inline-block; margin-bottom: 2.2rem; }
.colophon__label::after {
  content: ""; display: inline-block; width: 2.2em; height: 1px;
  background: var(--line); margin-left: 1em; vertical-align: middle;
}
.colophon__grid {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: clamp(2rem, 6vw, 5rem); align-items: start;
}
.colophon__text p {
  font-size: clamp(1.1rem, 1.8vw, 1.35rem); color: var(--muted); max-width: 46ch;
}
.colophon__text p + p { margin-top: 1.2rem; }
.colophon__id { display: flex; align-items: center; gap: 1rem; margin-top: 2.4rem; }
.colophon__mark {
  width: 56px; height: 56px; border-radius: 50%; flex: none;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.colophon__mark svg { width: 44px; height: auto; }
.colophon__name { display: block; font-style: italic; font-size: 1.25rem; color: var(--ink); line-height: 1.2; }
.colophon__role { display: block; color: var(--faint); margin-top: 0.25rem; }

.colophon__links { list-style: none; border-top: 1px solid var(--line); }
.colophon__links li { border-bottom: 1px solid var(--line); }
.colophon__links a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 1.25rem 0.2rem; transition: padding 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.colophon__links a:hover { padding-left: 0.8rem; }
.colophon__links .mono { color: var(--faint); }
.colophon__handle {
  font-style: italic; font-size: 1.15rem; color: var(--ink);
  display: inline-flex; align-items: center; gap: 0.5em;
}
.colophon__handle .ext { width: 9px; height: 9px; opacity: 0.5; }

/* ---------- footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto;
  padding: 1.5rem var(--gutter) 1.8rem;
  color: var(--faint); border-top: 1px solid var(--line-soft);
}

/* ---------- lightbox ---------- */
.lightbox {
  border: 0; padding: 0; background: transparent;
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  display: none; align-items: center; justify-content: center;
  color: var(--ink);
}
.lightbox[open] { display: flex; }
.lightbox::backdrop { background: rgba(251, 250, 247, 0.94); backdrop-filter: blur(10px); }
.lightbox__stage { max-width: min(88vw, 1100px); }
.lightbox__stage img {
  max-height: 82dvh; max-width: 100%; width: auto; margin: 0 auto;
  background: #fff; border: 1px solid var(--line-soft);
  box-shadow: 0 30px 80px -30px rgba(30, 33, 38, 0.35);
  opacity: 1; transition: opacity 0.25s ease;
}
.lightbox__stage img.is-loading { opacity: 0.25; }
.lightbox__cap {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 1rem; color: var(--muted);
}
.lightbox button {
  position: absolute; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink);
  cursor: pointer; transition: border-color 0.25s ease, transform 0.25s ease;
}
.lightbox button:hover { border-color: var(--ink); transform: scale(1.05); }
.lightbox__close { top: 1.2rem; right: 1.2rem; }
.lightbox__arrow--prev { left: 1.2rem; top: 50%; margin-top: -26px; }
.lightbox__arrow--next { right: 1.2rem; top: 50%; margin-top: -26px; }

/* ---------- motion primitives ---------- */
html.js [data-reveal] {
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
html.js [data-reveal].in-view { opacity: 1; transform: none; }

.split-word { display: inline-block; overflow: hidden; vertical-align: top; }
.split-word > span {
  display: inline-block; transform: translateY(112%);
  transition: transform 0.75s cubic-bezier(0.2, 0.85, 0.2, 1);
}
.split-word.in > span { transform: translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .colophon__grid { grid-template-columns: 1fr; }
  .footer { justify-content: center; text-align: center; }
  .series__track .plate:nth-child(even):not(.plate--end) { margin-top: 3.5vh; }
}
@media (max-width: 560px) {
  .mono { letter-spacing: 0.08em; }
  .masthead { padding-top: 0.9rem; }
  .masthead__links { gap: 0.7rem; font-size: 0.6rem; }
  .series__head { padding-top: 4rem; }
  .lightbox__arrow--prev { left: 0.5rem; }
  .lightbox__arrow--next { right: 0.5rem; }
  .lightbox button { width: 44px; height: 44px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html.js [data-reveal], .split-word > span { opacity: 1 !important; transform: none !important; }
  .grain, .cursor { display: none !important; }
  .gallery-ready .plate:not(.is-active) { opacity: 1; transform: none; }
}
