/* Design tokens — from Figma "Agata portfolio", frame "Main — Gallery" (16:226) */
:root {
  --c-bg: #faf8f0;
  --c-ink: #000;
  --c-lead: #535353;
  --c-muted: #878787;

  --f-sans: "DM Sans", system-ui, sans-serif;
  --f-serif: "Newsreader", Georgia, serif;

  --gutter: 56px;          /* page side padding */
  --col-gap: 20px;         /* gap between the 1/3 and 2/3 columns */
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--f-sans);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

p, h1, figure { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

/* Two-column grid: narrow left (429/1329) + wide right (880/1329) */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 429fr) minmax(0, 880fr);
  column-gap: var(--col-gap);
}

/* Navigation */
.nav {
  padding: 36px var(--gutter);
  min-height: 119px;
  align-items: start;
  text-transform: uppercase;
  line-height: 1.05;
}
.nav__name { font-weight: 700; font-size: 21px; }
.nav__role { font-size: 17px; letter-spacing: 0.05em; }

/* Intro */
.page { container-type: inline-size; }

/* Heading fills the content width: the longer line ("coming soon")
   measures 5.474em, so width / 5.474 ≈ width × 0.182.
   It is sticky for the whole page; everything after it scrolls over it. */
.page__title {
  position: sticky;
  top: 119px; /* = nav height, so it never moves */
  z-index: 0;
  padding: 0 var(--gutter);
  font-family: var(--f-serif);
  font-weight: 400;
  font-variation-settings: "opsz" 72;
  font-size: calc((100cqi - 2 * var(--gutter)) * 0.182);
  white-space: nowrap;
  line-height: 0.99;
  letter-spacing: -0.019em;
}
/* One opaque sheet holding everything after the heading, so it covers the
   heading as it scrolls over (a single sheet leaves no sub-pixel seams).
   Spacing inside is padding, not margin, so nothing collapses out of it. */
.page__sheet { position: relative; z-index: 1; background: var(--c-bg); }

.intro { padding: 64px var(--gutter) 0; }
.intro__lead {
  margin-left: 10px; /* optically aligned with the serif "W" */
  color: var(--c-lead);
  font-size: 25px;
  line-height: 1.09;
  letter-spacing: -0.04em;
}

/* Gallery */
.gallery {
  padding: 15px var(--gutter) 0;
  row-gap: 38px;
  align-items: start;
}
.art--small  { grid-column: 1; }
.art--large  { grid-column: 2; }
.art--medium { grid-column: 2; width: 62.7%; } /* 552 / 880 */

.art__caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--c-muted);
  font-size: 14px;
  line-height: 1.45;
  white-space: nowrap;
}
.art__title { font-weight: 500; }

/* Caption reveal — hidden until the caption is 40% up the viewport,
   then the parts appear one by one, title first (trigger in script.js) */
.js .art__caption > span {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
.js .art__caption.is-inview > span { opacity: 1; transform: none; }
.art__caption > span:nth-child(2) { transition-delay: 0.18s; }
.art__caption > span:nth-child(3) { transition-delay: 0.36s; }
.art__caption > span:nth-child(4) { transition-delay: 0.54s; }

@media (prefers-reduced-motion: reduce) {
  .js .art__caption > span { opacity: 1; transform: none; transition: none; }
}

/* "to be continued…" — endless scatter, filled by script.js */
.continued {
  padding: 73px 7px 0;
  overflow-x: clip;
}
.continued__field {
  position: relative;
  font-size: 32px;
  line-height: 0.99;
  white-space: nowrap;
}
.continued__chunk { position: relative; height: 198px; }
.continued__item { position: absolute; margin: 0; }
.continued__sentinel { height: 1px; }

/* Each word fades in when it rises 40% up the viewport, with a random
   delay per word (set in script.js) — same timing as the captions */
.js .continued__item {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
.js .continued__item.is-inview { opacity: 1; transform: none; }

@keyframes fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .js .continued__item { opacity: 1; transform: none; transition: none; }
}

/* Colophon — pinned to the bottom of the viewport */
body { padding-bottom: 80px; }
.colophon {
  position: fixed;
  inset: auto 0 0;
  z-index: 1;
  grid-template-columns: minmax(0, 429fr) minmax(0, 440fr) minmax(0, 440fr);
  align-items: end;
  padding: 24px var(--gutter) 40px;
  background: var(--c-bg);
  font-size: 12px;
}
.colophon__mail { justify-self: end; }

/* Intro animation — the name fades in first, then the rest one by one */
@keyframes intro-in {
  from { opacity: 0; transform: translateY(10px); }
}
.nav__name,
.nav__role,
.page__title,
.intro__lead,
.art,
.continued,
.colophon {
  animation: intro-in 1.2s cubic-bezier(0.25, 0.6, 0.3, 1) both;
}
.nav__name   { animation-name: fade-in; animation-duration: 1.6s; animation-delay: 0.2s; }
.nav__role   { animation-delay: 1.1s; }
.page__title { animation-delay: 1.4s; }
.intro__lead { animation-delay: 1.8s; }
.art--small  { animation-delay: 2.1s; }
.art--large  { animation-delay: 2.3s; }
.art--medium { animation-delay: 2.5s; }
.continued,
.colophon    { animation-delay: 2.8s; }

@media (prefers-reduced-motion: reduce) {
  .nav__name, .nav__role, .page__title, .intro__lead,
  .art, .continued, .colophon { animation: none; }
}

/* Tablet */
@media (max-width: 1024px) {
  :root { --gutter: 32px; }
  .art__caption { flex-wrap: wrap; white-space: normal; }
}

/* Phone */
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .nav { min-height: 0; padding-block: 24px; gap: 4px; }
  .nav__name { font-size: 18px; }
  .nav__role { font-size: 14px; }
  .page__title { top: 0; padding-top: 24px; }
  .intro { padding-top: 24px; }
  .intro__lead { margin-left: 0; font-size: 20px; }
  .intro__lead br { display: none; }
  .gallery { padding-top: 32px; row-gap: 32px; }
  .continued { padding-top: 48px; }
  .continued__field { font-size: 24px; }
  .continued__chunk { height: 160px; }
  .art--small, .art--large, .art--medium { grid-column: 1; width: 100%; }
  .art__caption { column-gap: 12px; }
  body { padding-bottom: 96px; }
  .colophon { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 12px var(--gutter) 16px; }
  .colophon__mail { justify-self: start; }
}
