/* ============================================================
   DIEGO COUTO — Photographer
   Archival index / catalogue-plate aesthetic
   ============================================================ */

:root {
  --paper: #efece5;
  --paper-deep: #e7e3da;
  --panel: #e3dfd6;
  --ink: #1c1a16;
  --ink-soft: #55524b;
  --ink-faint: #8a867d;
  --line: rgba(28, 26, 22, 0.18);

  --serif: "Tinos", "Times New Roman", serif;
  --mono: "Courier Prime", "Courier New", monospace;

  --gutter: clamp(1.25rem, 4vw, 4rem);
  --img-filter: none;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

.mono {
  font-family: var(--mono);
}

.serif {
  font-family: var(--serif);
}

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

a {
  color: inherit;
}

/* ---------- film grain over everything ---------- */

.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 100;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E");
  animation: grain-shift 1.2s steps(4) infinite;
}

@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-1.5%, 1%); }
  50%  { transform: translate(1%, -1.5%); }
  75%  { transform: translate(-1%, -1%); }
  100% { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(1.5rem, 3vw, 2.5rem) var(--gutter) 0;
}

.wordmark {
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 0.65em;
  white-space: nowrap;
}

.wordmark__name {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  letter-spacing: 0.16em;
}

.site-nav {
  display: flex;
  gap: 1.75em;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  position: relative;
  padding-bottom: 2px;
  transition: color 0.25s ease;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.lang-switch {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  display: flex;
  gap: 0.5em;
  align-items: baseline;
}

.lang-switch button {
  font: inherit;
  letter-spacing: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-faint);
  padding: 0.2em 0.1em;
  transition: color 0.2s ease;
}

.lang-switch button:hover {
  color: var(--ink);
}

.lang-switch button.is-active {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================================
   INTRO
   ============================================================ */

.intro {
  padding: clamp(4rem, 10vw, 8rem) var(--gutter) clamp(3rem, 7vw, 5.5rem);
  max-width: 46rem;
}

.intro__line {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  line-height: 1.35;
}

.intro__note {
  margin-top: 1.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.rule {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0 var(--gutter);
}

/* ============================================================
   INDEX ENTRIES — asymmetric archival grid
   ============================================================ */

.index {
  padding: clamp(3rem, 6vw, 5rem) var(--gutter);
  display: flex;
  flex-direction: column;
  gap: clamp(6rem, 12vw, 11rem);
}

.entry {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: clamp(1rem, 2.5vw, 2.5rem);
  align-items: start;
}

.entry__code {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-bottom: 1.4rem;
}

.entry__title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.entry__year {
  font-weight: 400;
  color: var(--ink-soft);
}

.entry__desc {
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 26ch;
}

.entry__meta {
  margin-top: clamp(2.5rem, 6vw, 5rem);
  font-size: 0.68rem;
  line-height: 1.7;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.entry__meta span {
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.entry__fig {
  position: relative;
}

.entry__fig figcaption {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: 0.6rem;
}

.entry__fig img {
  width: 100%;
  filter: var(--img-filter);
  cursor: zoom-in;
  transition: filter 0.45s ease, transform 0.45s ease;
}

.entry__fig img:hover {
  filter: brightness(1.04);
}

/* --- pattern A: text left, two images right, second offset down --- */

.entry--a .entry__text   { grid-column: 1 / span 3; }
.entry--a .entry__fig--1 { grid-column: 4 / span 4; }
.entry--a .entry__fig--2 { grid-column: 9 / span 4; margin-top: clamp(4rem, 10vw, 9rem); }

/* --- pattern B: image left, text center, tall image right --- */

.entry--b .entry__fig--1 { grid-column: 1 / span 4; margin-top: clamp(2rem, 5vw, 4rem); }
.entry--b .entry__text   { grid-column: 6 / span 3; }
.entry--b .entry__fig--2 { grid-column: 9 / span 4; }

/* --- pattern C: text left, three images stepped --- */

.entry--c .entry__text   { grid-column: 1 / span 3; }
.entry--c .entry__fig--1 { grid-column: 4 / span 3; }
.entry--c .entry__fig--2 { grid-column: 7 / span 3; margin-top: clamp(3rem, 8vw, 7rem); }
.entry--c .entry__fig--3 { grid-column: 10 / span 3; margin-top: clamp(1.5rem, 4vw, 3.5rem); }

/* ============================================================
   PLATES — catalogue spread panels
   ============================================================ */

.plate {
  margin: 0 calc(var(--gutter) * -0.35);
}

.plate__panel {
  position: relative;
  background: var(--panel);
  background-image: radial-gradient(rgba(28, 26, 22, 0.05) 1px, transparent 1px);
  background-size: 4px 4px;
  padding: clamp(3.5rem, 9vw, 8rem) clamp(2rem, 10vw, 10rem);
  display: flex;
  justify-content: center;
}

.plate__caption {
  position: absolute;
  top: clamp(1rem, 2.5vw, 1.75rem);
  left: clamp(1.25rem, 3vw, 2.25rem);
  font-size: 0.62rem;
  line-height: 1.8;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.plate__panel img {
  width: min(100%, 900px);
  filter: var(--img-filter);
  cursor: zoom-in;
  box-shadow: 0 24px 60px -30px rgba(28, 26, 22, 0.35);
  transition: filter 0.45s ease;
}

.plate__panel img:hover {
  filter: brightness(1.04);
}

/* ============================================================
   ABOUT
   ============================================================ */

.about {
  padding: clamp(4rem, 9vw, 7rem) var(--gutter);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: clamp(1rem, 2.5vw, 2.5rem);
  row-gap: 3rem;
  align-items: start;
}

.about__label {
  grid-column: 1 / span 2;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.about__portrait {
  grid-column: 3 / span 3;
}

.about__portrait figcaption {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: 0.6rem;
  font-family: var(--mono);
}

.about__portrait img {
  filter: var(--img-filter);
}

.about__body {
  grid-column: 7 / span 5;
}

.about__lede {
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  line-height: 1.4;
  margin-bottom: 1.75rem;
}

.about__body > p.mono {
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 52ch;
}

.about__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 3rem;
  font-size: 0.72rem;
  line-height: 2;
  color: var(--ink-soft);
}

.about__col-title {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-bottom: 0.75rem;
}

.about__cols ul {
  list-style: none;
}

/* ============================================================
   CONTACT
   ============================================================ */

.contact {
  padding: clamp(5rem, 12vw, 9rem) var(--gutter);
  text-align: center;
}

.contact__label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 2.5rem;
}

.contact__pitch {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.contact__email {
  display: inline-block;
  font-size: clamp(1.7rem, 5vw, 3.4rem);
  font-style: italic;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.15em;
  transition: border-color 0.3s ease;
}

.contact__email:hover {
  border-color: var(--ink);
}

.contact__links {
  margin-top: 2.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  justify-content: center;
  gap: 1.25em;
  color: var(--ink-soft);
}

.contact__links a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}

.contact__links a:hover {
  border-color: var(--ink-soft);
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--line);
  margin: 0 var(--gutter);
  padding: 1.5rem 0 2.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(239, 236, 229, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 5vw, 4rem);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__fig {
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.lightbox__fig img {
  max-height: 78vh;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: var(--img-filter);
  box-shadow: 0 30px 80px -35px rgba(28, 26, 22, 0.4);
}

.lightbox__fig figcaption {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.lightbox__close {
  position: absolute;
  top: clamp(1.25rem, 3vw, 2.25rem);
  right: var(--gutter);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
}

/* ============================================================
   REVEAL ON SCROLL
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .entry,
  .about {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
  }

  .entry__text {
    max-width: 34rem;
  }

  .entry__desc {
    max-width: 40ch;
  }

  .entry__meta {
    margin-top: 1.5rem;
  }

  .entry--a .entry__fig--2,
  .entry--b .entry__fig--1,
  .entry--c .entry__fig--2,
  .entry--c .entry__fig--3 {
    margin-top: 0;
  }

  .entry__fig {
    width: 100%;
  }

  .entry__fig:nth-of-type(even) {
    align-self: flex-end;
    width: 78%;
  }

  .about__portrait {
    max-width: 20rem;
  }

  .plate {
    margin: 0;
  }
}

@media (max-width: 640px) {
  .site-header {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .wordmark {
    white-space: normal;
    flex-wrap: wrap;
    gap: 0.4em;
  }

  .wordmark__name {
    font-size: 1.15rem;
    letter-spacing: 0.12em;
  }

  .site-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .about__cols {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.4rem;
  }
}

/* ============================================================
   SCATTERED HERO (archive page)
   ============================================================ */

.scatter {
  position: relative;
  min-height: clamp(32rem, 86vh, 58rem);
  margin: 0 var(--gutter);
}

.scatter__ph {
  position: absolute;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1),
              transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible .scatter__ph {
  opacity: 1;
  transform: none;
}

.scatter__ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scatter__ph--1 { width: clamp(150px, 15%, 250px); top: 4%;  left: 42%; aspect-ratio: 4 / 3; transition-delay: 0.1s; }
.scatter__ph--2 { width: clamp(90px, 9%, 150px);   top: 9%;  right: 11%; aspect-ratio: 3 / 4; transition-delay: 0.25s; }
.scatter__ph--3 { width: clamp(84px, 8%, 140px);   top: 30%; left: 8%;  aspect-ratio: 3 / 4; transition-delay: 0.4s; }
.scatter__ph--4 { width: clamp(105px, 11%, 180px); bottom: 4%; left: 22%; aspect-ratio: 3 / 4; transition-delay: 0.55s; }
.scatter__ph--5 { width: clamp(115px, 12%, 190px); bottom: 8%; right: 14%; aspect-ratio: 3 / 4; transition-delay: 0.7s; }

.scatter__ph img {
  animation: drift 7s ease-in-out infinite alternate;
}

.scatter__ph--2 img { animation-delay: 1.2s; animation-duration: 8s; }
.scatter__ph--3 img { animation-delay: 2.4s; animation-duration: 6.5s; }
.scatter__ph--4 img { animation-delay: 0.8s; animation-duration: 7.5s; }
.scatter__ph--5 img { animation-delay: 1.8s; animation-duration: 8.5s; }

@keyframes drift {
  from { transform: translateY(-4px); }
  to   { transform: translateY(4px); }
}

@media (prefers-reduced-motion: reduce) {
  .scatter__ph img { animation: none; }
}

.scatter__center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.scatter__title {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.scatter__count {
  margin-top: 1.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

@media (max-width: 700px) {
  .scatter { min-height: 24rem; }
  .scatter__ph--1 { width: 34%; left: 33%; top: 4%; }
  .scatter__ph--2 { width: 20%; right: 6%; top: 58%; }
  .scatter__ph--3 { width: 18%; left: 6%; top: 60%; }
  .scatter__ph--4,
  .scatter__ph--5 { display: none; }
}

/* ============================================================
   FILTERS
   ============================================================ */

.filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding: clamp(2rem, 5vw, 3.5rem) var(--gutter);
}

.filter {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-faint);
  padding: 0.3em 0.1em;
  transition: color 0.25s ease;
}

.filter sup {
  font-size: 0.58rem;
  letter-spacing: 0.05em;
  margin-left: 0.35em;
}

.filter:hover {
  color: var(--ink);
}

.filter.is-active {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ============================================================
   ARCHIVE GRID
   ============================================================ */

.archive {
  padding: 0 var(--gutter) clamp(4rem, 8vw, 6rem);
  display: flex;
  align-items: flex-start;
  gap: clamp(1.25rem, 2.5vw, 2.25rem);
}

.archive__col {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 760px) { .archive { gap: 1rem; } }

.archive__item {
  margin-bottom: clamp(1.75rem, 3.5vw, 3rem);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.archive__item.is-visible {
  opacity: 1;
  transform: none;
}

.archive__item figcaption {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: 0.45rem;
}

.archive__item img {
  width: 100%;
  cursor: zoom-in;
  transition: filter 0.4s ease, transform 0.4s ease;
}

.archive__item img:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
}

/* ============================================================
   LIGHTBOX NAV + CURRENT NAV LINK + INDEX CTA
   ============================================================ */

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: 1rem;
  z-index: 2;
}

.lightbox__nav--prev { left: clamp(0.5rem, 2.5vw, 2.5rem); }
.lightbox__nav--next { right: clamp(0.5rem, 2.5vw, 2.5rem); }

.lightbox__nav:hover {
  color: var(--ink-faint);
}

.site-nav a.is-current {
  color: var(--ink);
}

.site-nav a.is-current::after {
  transform: scaleX(1);
}

.index__cta {
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.index__cta a {
  text-decoration: none;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.index__cta a:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* ============================================================
   FLOATING TALK BUTTON
   ============================================================ */

.talk {
  position: fixed;
  right: clamp(1rem, 3vw, 2.25rem);
  bottom: clamp(1rem, 3vw, 2.25rem);
  z-index: 150;
  background: var(--paper);
  border: 1px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.85em 1.4em;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.talk:hover {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-2px);
}

/* ============================================================
   HOME SCROLL CHOREOGRAPHY
   staggered child reveals + JS parallax drift
   ============================================================ */

/* entries, intro and about reveal their children in sequence */
.intro.reveal,
.entry.reveal,
.about.reveal {
  opacity: 1;
  transform: none;
}

.intro.reveal > *,
.entry.reveal > *,
.about.reveal > * {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.intro.reveal.is-visible > *,
.entry.reveal.is-visible > *,
.about.reveal.is-visible > * {
  opacity: 1;
  transform: none;
}

.intro.reveal.is-visible > *:nth-child(2) { transition-delay: 0.2s; }

.entry.reveal.is-visible .entry__text   { transition-delay: 0s; }
.entry.reveal.is-visible .entry__fig--1 { transition-delay: 0.18s; }
.entry.reveal.is-visible .entry__fig--2 { transition-delay: 0.34s; }
.entry.reveal.is-visible .entry__fig--3 { transition-delay: 0.5s; }

.about.reveal.is-visible .about__label    { transition-delay: 0s; }
.about.reveal.is-visible .about__portrait { transition-delay: 0.15s; }
.about.reveal.is-visible .about__body     { transition-delay: 0.3s; }

/* parallax images drift smoothly between frames */
.entry__fig img,
.plate__panel img,
.about__portrait img {
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .intro.reveal > *,
  .entry.reveal > *,
  .about.reveal > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
