:root {
  --canvas: #f6f4ee;
  --ink: #1b1a17;
  --mute: #5d584e;
  --pad: clamp(1.25rem, 4vw, 4rem);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --strip: clamp(7rem, 17vw, 17rem); /* width of the paint strip */
  --gap: clamp(2rem, 4vw, 4rem);
  --pigments: linear-gradient(90deg, #5b3f8a, #a394d6, #e6b088); /* violet, lilac, peach: the colours of the paint strip */
  /* A painting hangs on the page. The light comes from the upper right, as in the studio photos. */
  --hang: 0 1px 1px rgb(40 30 50 / .16), -.75rem 1.25rem 2.5rem -.75rem rgb(40 30 50 / .32);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; scrollbar-color: #c4beb1 transparent; }
html:has(dialog[open]) { overflow: hidden; }
::selection { background: #d8c4f0; color: var(--ink); }

/* The page is a primed canvas: threads that go over and under, lit from the upper right.
   canvas.webp is canvas.svg rendered by Chrome at 2x. Safari does not draw the SVG filter correctly, so the page uses the image. */
body, .viewer {
  color: var(--ink);
  font: 300 1.25rem/1.5 "Cormorant Garamond", "Iowan Old Style", Palatino, Georgia, serif;
  background: url(canvas.webp) 0 0 / 320px var(--canvas);
}

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

.label {
  font: 500 .6875rem/1.6 ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--mute);
}
/* A link gets an underline in the three colours of the paint strip. */
.label a, .readings .name {
  padding-bottom: .4em;
  background: var(--pigments) 0 100% / 0 2px no-repeat;
  transition: background-size .7s var(--ease), color .5s;
}
.label a:hover, .label a:focus-visible { background-size: 100% 2px; color: var(--ink); }
.label a { padding-top: .9em; } /* a taller area to tap or click: the text alone is 18 px high */

/* ---------- Signature and paint strip ---------- */

/* signature.svg draws itself in 3.7 s. */
.sig { max-width: none; mix-blend-mode: multiply; opacity: .92; }

/* A strip of thick paint with hard edges. On the coming soon page it changes with the painting. */
.strip { position: relative; overflow: hidden; }
.strip img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; opacity: 0; transition: opacity 1.4s ease; }
.strip img.on { opacity: 1; }

/* ---------- Address: one line, four readings ----------
   rachel@aversano.art is the email. "rachel" and "aversano" are the name.
   "@aversano.art" is the Instagram name. "aversano.art" is the website.
   The line shows each reading in turn, two times. The pointer selects one reading. */

.address { display: grid; justify-items: start; gap: .8rem; font-style: normal; }
.word { font-style: italic; font-size: var(--word, clamp(1.6rem, 2.5vw, 2.4rem)); line-height: 1.3; white-space: nowrap; }
.word span { transition: opacity .5s; }
.word .at, .word .art { opacity: .4; }
.word .r { animation: read-r 12s var(--start, 4s) 2; }
.word .at { animation: read-at 12s var(--start, 4s) 2; }
.word .art { animation: read-art 12s var(--start, 4s) 2; }
@keyframes read-r { 0%, 48%, 100% { opacity: 1; } 52%, 98% { opacity: .4; } }
@keyframes read-at { 0%, 23%, 77%, 100% { opacity: .4; } 27%, 73% { opacity: 1; } }
@keyframes read-art { 0%, 23%, 100% { opacity: .4; } 27%, 98% { opacity: 1; } }

.readings { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; padding: 0; list-style: none; }
.readings::before { content: ""; flex-basis: 100%; order: 1; } /* line break: the name first, the three links below */
.readings li:not(.name) { order: 2; }
.readings :is(.name, a) { animation: reading 12s calc(var(--start, 4s) + var(--i) * 3s) 2; }
/* The line shows its readings two times, then stays on the name. A page can hold the start until the line is in view (class "wait"). */
.address.wait :is(.word span, .readings .name, .readings a) { animation-play-state: paused; }
.readings .copied { color: var(--ink); }
.readings .name, .address:has(.word:is(:hover, :focus-visible)) .mail a { color: var(--ink); background-size: 100% 2px; }
@keyframes reading { 0%, 27%, 100% { color: var(--mute); background-size: 0 2px; } 2%, 23% { color: var(--ink); background-size: 100% 2px; } }

/* The pointer selects a reading. */
.address:has(a:hover, a:focus-visible) :is(.word span, .readings .name, .readings a) { animation: none; }
.address:has(a:hover, a:focus-visible) .name:not(:hover) { color: var(--mute); background-size: 0 2px; }
.address:has(:is(.word, .mail a):is(:hover, :focus-visible)) .word span { opacity: 1; }
.address:has(.ig a:is(:hover, :focus-visible)) .word span { opacity: 1; }
.address:has(.ig a:is(:hover, :focus-visible)) .word .r { opacity: .4; }
.address:has(.web a:is(:hover, :focus-visible)) .word :is(.r, .at) { opacity: .4; }
.address:has(.web a:is(:hover, :focus-visible)) .word .art { opacity: 1; }

/* ---------- Coming soon page ----------
   A clean sheet: the painting, the text against a thin rule, and one strip of thick paint.
   On a narrow screen the strip is a band above the painting.
   The strip is a generated impasto texture in the colours of the painting on show. */

.soon { min-height: 100svh; display: grid; padding: var(--pad); }
.soon main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(15rem, 22vw, 20rem) var(--strip);
  gap: var(--gap);
}
/* The stage has the shape of the widest painting. Each painting sits in the centre of it. */
.stage {
  place-self: center;
  display: grid;
  grid-template: 100% / 100%;
  place-items: center;
  width: 100%;
  max-width: calc((100svh - 2 * var(--pad)) * 1.346); /* the stage never grows taller than the screen */
  aspect-ratio: 1416 / 1052;
}
.stage img { opacity: 0; transition: opacity 1.4s ease; }
.stage img.on { opacity: 1; }
.stage img { grid-area: 1 / 1; width: auto; max-height: 100%; box-shadow: var(--hang); }

/* The text hangs from a rule, at the bottom of its column. */
.plate { display: flex; flex-direction: column; align-items: flex-end; gap: clamp(1.25rem, 2.4vw, 2rem); text-align: right; }
.plate::before { content: ""; flex: 1; min-height: 3rem; width: 1px; background: var(--ink); }
.plate .sig { width: 100%; }
.plate .address { justify-items: end; }
.plate .readings { justify-content: flex-end; }
.status em { display: block; font-size: clamp(2rem, 3.2vw, 3rem); line-height: 1.1; }
/* One mark for each painting. */
.ticks { display: flex; gap: .25rem; margin-inline: -.25rem; }
.ticks button { position: relative; width: 2rem; height: 1.5rem; padding: 0; border: 0; background: none; cursor: pointer; }
.ticks button::before {
  content: "";
  position: absolute;
  inset: 50% .25rem auto;
  height: 2px;
  background: var(--ink);
  opacity: .25;
  transition: opacity .5s;
}
.ticks button:hover::before { opacity: .6; }
.ticks button[aria-pressed="true"]::before { opacity: 1; }

@media (max-width: 900px) {
  .soon main { grid-template-columns: 1fr; align-content: start; gap: 1.75rem; }
  .plate { align-items: flex-start; text-align: left; }
  .plate::before { display: none; }
  .plate .sig { width: min(70%, 16rem); }
  .plate .address { justify-items: start; }
  .plate .readings { justify-content: flex-start; }
  .soon .strip { order: -1; height: 14svh; } /* a band above the painting */
}

/* ---------- Main page ---------- */

.top {
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem calc(var(--pad) + var(--strip) + var(--gap)) 1.5rem var(--pad); /* the header stops at the rule */
}
.top img { height: 3rem; width: auto; }
.top nav { display: flex; gap: clamp(1.25rem, 3vw, 2.75rem); }
.top nav a { color: var(--ink); }

/* The name hangs from a thin rule, next to a tall strip of thick paint. */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template: 1fr / minmax(0, 1fr) var(--strip);
  gap: var(--gap);
  padding: var(--pad);
}
.hero .name { display: flex; flex-direction: column; align-items: flex-end; gap: 2rem; padding-top: 4.5rem; text-align: right; }
.hero .name::before, .hero .name::after { content: ""; flex: 1; }
.hero .name::before { min-height: 3rem; width: 1px; background: var(--ink); }
.hero h1 { width: min(100%, max(46rem, 42vw)); }
.hero .sig { width: 100%; }
.hero .label { color: var(--ink); }
/* The name in type, for the visitor who cannot read the signature. It arrives when the signature is almost drawn. */
.who { display: grid; justify-items: end; gap: .3rem; animation: arrive 1.2s 2.6s both; }
.who em { font-size: clamp(1.5rem, 2.2vw, 2rem); line-height: 1.3; }
/* The strip goes on in one stroke, from the top down. */
.hero .strip { animation: lay 1.1s var(--ease) .2s both; }
@keyframes lay { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes arrive { from { opacity: 0; } }
.cue { position: absolute; bottom: var(--pad); left: var(--pad); }
.cue::after {
  content: "";
  display: block;
  width: 1px;
  height: 3rem;
  margin: .75rem auto 0;
  background: currentColor;
  transform-origin: top;
  animation: drip 2.6s ease-in-out 3; /* three times, then the line stays */
}
@keyframes drip { 0% { scale: 1 0; } 55% { scale: 1 1; opacity: 1; } 100% { scale: 1 1; opacity: 0; } }

section, .contact { padding: clamp(5rem, 12vw, 10rem) var(--pad); }
#works { padding-bottom: clamp(2.5rem, 6vw, 5rem); } /* the works and the text about them belong together */
section > *, .contact > * { width: 100%; max-width: 96rem; margin-inline: auto; } /* one left edge on wide screens */

/* The title of the works, at the size of the address at the foot of the page. */
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 1rem 2rem; }
.head a { color: var(--ink); }
.display { font-style: italic; font-weight: 300; font-size: clamp(3rem, 9vw, 6rem); line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; }

/* Gallery: a large hang on 12 columns. Each of the first three works has its own row. The pattern repeats every 5 works. */
.gallery {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(4rem, 9vw, 8rem) clamp(1rem, 2vw, 2rem);
  align-items: center;
  max-width: 96rem;
  margin: clamp(3rem, 6vw, 5rem) auto 0;
}
.gallery figure:nth-child(5n+1) { grid-column: 1 / span 9; }
.gallery figure:nth-child(5n+2) { grid-column: 7 / span 6; }
.gallery figure:nth-child(5n+3) { grid-column: 2 / span 8; }
.gallery figure:nth-child(5n+4) { grid-column: 8 / span 5; }
.gallery figure:nth-child(5n)   { grid-column: 1 / span 6; }

figure a { display: block; }
figure img { width: 100%; box-shadow: var(--hang); transition: translate 1s var(--ease), box-shadow 1s var(--ease); }
/* The painting comes off the wall a little. */
figure a:hover img, figure a:focus-visible img {
  translate: .2rem -.35rem;
  box-shadow: 0 1px 1px rgb(40 30 50 / .16), -1.25rem 2rem 3.5rem -.9rem rgb(40 30 50 / .34);
}
figcaption, .viewer .caption { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1.25rem; margin-top: 1.5rem; }
figcaption em { font-size: 1.4rem; }
/* The way from a painting to Rachel: one email link in each caption. The viewer copies the caption, so it has the link too. */
.ask:not(:only-child) { margin-left: auto; } /* at the right when a title stands before it */
.ask a { color: var(--ink); }

/* Works rise into view on scroll. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .gallery figure { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
  }
}
@keyframes rise { from { opacity: 0; translate: 0 4vh; } }

.row { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(0, 3fr); gap: 1.25rem var(--pad); max-width: 96rem; margin: 0 auto; }
.row + .row { margin-top: clamp(4rem, 8vw, 7rem); }
.row h2 { padding-top: .6em; }
/* The bio, and a round photo of Rachel at its right. She looks toward the text. */
.me { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--gap); }
.bio { font-size: 1.5rem; font-weight: 400; line-height: 1.45; max-width: 29em; text-wrap: pretty; }
.portrait { flex: none; width: clamp(9rem, 14vw, 13rem); border-radius: 50%; outline: 1px solid rgb(27 26 23 / .16); outline-offset: -1px; } /* the line holds the circle where the sky is as light as the page */
.shows { max-width: 44rem; padding: 0; list-style: none; }
.shows li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0 2rem;
  padding: .9rem 0;
  border-top: 1px solid rgb(27 26 23 / .16);
  font-size: 1.5rem;
  font-weight: 400;
}
.shows li:last-child { border-bottom: 1px solid rgb(27 26 23 / .16); }

.contact { display: grid; justify-items: start; gap: 2.5rem; }
.contact .address { --word: clamp(2rem, 7.2vw, 5.5rem); --start: 1.2s; gap: 1.1rem; }
.foot { display: flex; align-items: center; gap: 1.25rem; margin-top: clamp(3rem, 8vw, 6rem); }
.foot img { height: 3.5rem; width: auto; }

@media (max-width: 900px) {
  .top { padding-right: var(--pad); }
  .hero { grid-template: auto 1fr / 1fr; padding-top: 6rem; padding-bottom: calc(var(--pad) + 6rem); gap: 1.75rem; } /* the strip stops above the cue */
  .hero .name { align-items: center; justify-content: center; padding: 0 0 1rem; text-align: center; }
  .who { justify-items: center; }
  .hero .name::before, .hero .name::after { display: none; }
  .me { flex-direction: column-reverse; } /* the photo stands above the text */
}
@media (max-width: 700px) {
  .gallery figure:nth-child(n) { grid-column: 1 / -1; }
  .gallery figure:nth-child(even) { margin-left: 22%; }
  .row { grid-template-columns: 1fr; }
  .row h2 { padding-top: 0; }
  .bio, .shows li { font-size: 1.3rem; }
}

/* ---------- Viewer: one work on the wall, large ---------- */

.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; padding: 4rem var(--pad) 1.5rem; }
.viewer[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; gap: 1rem; }
.viewer::backdrop { background: var(--canvas); }
.viewer img { max-height: 100%; width: auto; object-fit: contain; view-transition-name: work; }
.viewer .caption { margin: 0; justify-content: center; }
.viewer .ask { margin-left: 0; }
.viewer button { position: absolute; top: 1.25rem; padding: .5rem; border: 0; background: none; cursor: pointer; transition: color .3s; }
.viewer button:hover { color: var(--ink); }
.viewer .prev { left: var(--pad); }
.viewer .next { left: calc(var(--pad) + 4.5rem); }
.viewer .close { right: var(--pad); }
::view-transition-group(work) { animation-duration: .6s; animation-timing-function: var(--ease); }

/* Reduced motion: nothing moves or plays. Colour and opacity changes stay, because they answer a hover or a click. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, ::before, ::after { animation: none !important; }
  figure img { transition: none; }
  .label a, .readings .name { transition-property: color; }
}
