/* Painted imagery and scroll motion (see assets/js/paint.js).
   Loaded after refresh.css on index, about and thesis. */

/* ---------------------------------------------------------------- art */

.art {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--paper-deep);
  aspect-ratio: var(--ratio, 16 / 7);
}
.art img {
  position: absolute;
  inset: -6% 0;
  width: 100%;
  height: 112%;
  object-fit: cover;
  transform: translate3d(0, var(--py, 0px), 0) scale(var(--zoom, 1));
  transition: transform 1600ms cubic-bezier(0.2, 0.75, 0.1, 1);
}
.art::after {
  /* a paper-toned vignette ties the painting to the page */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(244, 241, 233, 0) 55%, rgba(244, 241, 233, 0.35) 100%);
  pointer-events: none;
}
.paint-motion .art { clip-path: inset(0 0 100% 0); transition: clip-path 1300ms cubic-bezier(0.7, 0, 0.2, 1); }
.paint-motion .art img { --zoom: 1.14; }
.paint-motion .art.is-in { clip-path: inset(0); }
.paint-motion .art.is-in img { --zoom: 1; }
.art--tall { --ratio: 4 / 5; }
.art--band { --ratio: 21 / 8; }

/* ------------------------------------------------------- philosophy strip */

.strip {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  border-top: 1px solid var(--rule-strong);
  border-left: 1px solid var(--rule);
  margin-top: clamp(28px, 4vw, 48px);
}
.strip--3 { --cols: 3; }
.strip__cell {
  position: relative;
  min-height: clamp(220px, 22vw, 300px);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
  isolation: isolate;
  background: var(--paper);
}
.strip__art { position: absolute; inset: 0; z-index: -1; }
.strip__art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% 60%;
  /* the subject sits right; the left stays calm for the text */
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 34%, rgba(0, 0, 0, 0.6) 58%, #000 82%);
  mask-image: linear-gradient(90deg, transparent 0%, transparent 34%, rgba(0, 0, 0, 0.6) 58%, #000 82%);
  transition: opacity 700ms ease, transform 1100ms cubic-bezier(0.2, 0.75, 0.1, 1);
}
.strip__full { opacity: 0; }
.strip__cell:hover .strip__full, .strip__cell:focus-within .strip__full { opacity: 0.55; }
.strip__cell:hover .strip__art img, .strip__cell:focus-within .strip__art img { transform: scale(1.04); }
.strip__text {
  position: relative;
  max-width: 30ch;
  padding: clamp(22px, 2.6vw, 34px);
}
.strip__tag {
  font-family: var(--face-display);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
}
.strip__title {
  margin: 12px 0 10px;
  font-family: var(--face-text);
  font-stretch: normal;
  font-weight: 400;
  font-size: clamp(1.5rem, 1.1rem + 1.1vw, 2.1rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.strip__body {
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.paint-motion .strip__cell { transition: transform 900ms cubic-bezier(0.2, 0.8, 0.1, 1) calc(var(--i) * 90ms); }
.paint-motion .strip:not(.is-in) .strip__cell { transform: translateY(26px); }

/* ---------------------------------------------------------------- pin */

.pin { position: relative; height: calc(var(--n) * 78vh + 22vh); }
.pin__stage {
  position: sticky;
  top: 90px;
  height: calc(100vh - 110px);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
}
.pin__list { list-style: none; display: grid; gap: 6px; border-top: 1px solid var(--rule-strong); }
.pin__item { padding: 16px 0 16px 18px; border-bottom: 1px solid var(--rule); position: relative; }
.pin__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  bottom: -1px;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 500ms cubic-bezier(0.2, 0.75, 0.1, 1);
}
.pin__item.is-active::before { transform: scaleY(1); }
.pin__num { font-family: var(--face-display); font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pin__item.is-active .pin__num { color: var(--red); }
.pin__title { margin: 6px 0 0; font-size: clamp(1.15rem, 0.95rem + 0.7vw, 1.55rem); line-height: 1.2; color: var(--muted); transition: color 400ms ease; }
.pin__item.is-active .pin__title { color: var(--ink); }
.pin__body {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  color: var(--ink-soft);
  max-width: 46ch;
  transition: grid-template-rows 500ms cubic-bezier(0.2, 0.75, 0.1, 1), margin 500ms ease;
}
.paint-motion .pin__body { max-height: 0; margin-top: 0; transition: max-height 500ms cubic-bezier(0.2, 0.75, 0.1, 1), margin 500ms ease; }
.paint-motion .pin__item.is-active .pin__body { max-height: 12em; margin-top: 10px; }
.pin__inline { display: none; margin: 14px 0 0; }
.pin__inline img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.pin__art { position: relative; height: min(64vh, 560px); overflow: hidden; background: var(--paper-deep); }
.pin__frame { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 600ms cubic-bezier(0.4, 0, 0.2, 1); }
.pin__frame img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); transition: transform 2400ms cubic-bezier(0.2, 0.75, 0.1, 1); }
.pin__frame.is-active { opacity: 1; }
.pin__frame.is-active img { transform: scale(1); }
.pin__count {
  position: absolute;
  right: 14px;
  bottom: 12px;
  padding: 4px 10px;
  background: rgba(46, 43, 41, 0.78);
  color: var(--paper);
  font-family: var(--face-display);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

/* without motion, or on small screens: a plain stacked list with inline paintings */
html:not(.paint-motion) .pin { height: auto; }
html:not(.paint-motion) .pin__stage { position: static; height: auto; grid-template-columns: 1fr; }
html:not(.paint-motion) .pin__art { display: none; }
html:not(.paint-motion) .pin__inline { display: block; }
html:not(.paint-motion) .pin__title { color: var(--ink); }

/* ------------------------------------------------------- written statement */

.write__w {
  color: transparent;
  background:
    linear-gradient(var(--ink-warm, #3a3532), var(--ink-warm, #3a3532)) left / var(--f, 0%) 100% no-repeat,
    linear-gradient(#b8b0a8, #b8b0a8);
  -webkit-background-clip: text;
  background-clip: text;
}

/* -------------------------------------------------------------- figures */

.draw { width: 100%; height: auto; overflow: visible; }
.draw .ink { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.draw .hot { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.draw .dot { fill: var(--accent); }
.draw .node { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.draw [pathLength] { stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--p, 0) * var(--k, 1)); }
.draw .grow { transform-box: fill-box; transform-origin: center; transform: scale(calc(min(1, var(--p, 0) * 2.2))); }
.draw .grow-late { transform-box: fill-box; transform-origin: center; transform: scale(calc(max(0, min(1, var(--p, 0) * 2.4 - 1.1)))); }

/* -------------------------------------------------------------- credits */

.credits { margin: clamp(32px, 4vw, 56px) 0 0; font-size: 0.8125rem; color: var(--muted); }
.credits summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; font-family: var(--face-display); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.6875rem; }
.credits ul { list-style: none; display: grid; gap: 6px; margin-top: 8px; }
.credits a { text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .strip, .strip--3 { --cols: 1; }
  .pin { height: auto; }
  .pin__stage { position: static; height: auto; grid-template-columns: 1fr; }
  .pin__art { display: none; }
  .pin__inline { display: block; }
  .paint-motion .pin__body { max-height: none; margin-top: 10px; }
  .pin__title { color: var(--ink); }
  .art--band { --ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  .art, .art img, .strip__art img, .pin__frame, .pin__frame img, .strip__cell { transition: none !important; }
}

/* ------------------------------------------------- page placements */

.about-art { margin-top: clamp(32px, 4vw, 56px); }
.how-head { display: grid; gap: 14px; max-width: 56ch; margin-bottom: clamp(28px, 4vw, 48px); }
.how-head h2 { margin: 0; }

/* the ITI Group band carries a faint painting of the Sea Link behind it */
.group { isolation: isolate; }
.group__paint { position: absolute; inset: 0; margin: 0; z-index: -1; pointer-events: none; }
.group__paint img { width: 100%; height: 100%; object-fit: cover; opacity: 0.16; filter: grayscale(0.4); }
