/*
  Homepage (src/index.njk): the selected-works stage, the statement and the
  index. The index itself is styled in site.css. Script: src/assets/js/home.js.
*/

.home main.full-bleed {
  display: block;
  overflow-x: clip;
}

/* ---------------------------------------------------------------- selected works
   One project at a time, edge to edge. A new one wipes in from the side it
   comes from while the image settles from a slight zoom. */

.hv {
  --hv-interval: 6.5s;
}

.hv-stage {
  position: relative;
  height: calc(100vh - var(--head-h) - 150px);
  height: calc(100svh - var(--head-h) - 150px);
  min-height: 400px;
  overflow: hidden;
  background: var(--panel);
}

.hv-slide {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  visibility: hidden;
  clip-path: inset(0);
}

.hv-slide.is-on {
  z-index: 3;
  visibility: visible;
}

.hv-slide.is-leaving {
  z-index: 2;
  visibility: visible;
}

.hv-slide.enter-r {
  clip-path: inset(0 0 0 100%);
}

.hv-slide.enter-l {
  clip-path: inset(0 100% 0 0);
}

.hv-slide.is-moving {
  transition: clip-path 1.05s cubic-bezier(0.76, 0, 0.24, 1);
}

.hv-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.07);
  transition: transform 2.2s var(--ease);
}

.hv-slide.is-on img {
  transform: scale(1);
}

/* the stage's two halves are the previous / next buttons */
.hv-half {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 5;
  width: 50%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hv-half--prev {
  left: 0;
}

.hv-half--next {
  right: 0;
}

.hv-half:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: -12px;
}

/* the cursor: a small black disc that says which way a click goes */
.hv-cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  width: 0;
  height: 0;
  pointer-events: none;
}

.hv-cursor span {
  position: absolute;
  left: -38px;
  top: -38px;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font: 400 13px/1 var(--font-sans);
  letter-spacing: 0.01em;
  transform: scale(0);
  transition: transform 0.3s var(--ease);
}

.hv-stage.has-cursor .hv-cursor span {
  transform: scale(1);
}

.hv-stage.has-cursor .hv-half {
  cursor: none;
}

.hv-stage.has-cursor.is-pressed .hv-cursor span {
  transform: scale(0.86);
}

/* the bar under the stage */
.hv-bar {
  display: grid;
  grid-template-columns: var(--lab) minmax(0, 1fr);
  gap: 24px;
  min-height: 150px;
  padding: 22px var(--gut) 0;
}

.hv-meta {
  display: grid;
  align-content: start;
  gap: 8px;
}

.hv-count {
  margin: 0;
  font: var(--display) 28px/1 var(--font-sans);
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.hv-of {
  color: var(--ink-3);
}

.hv-dash {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.hv-dash[hidden] {
  display: none;
}

.hv-dash button {
  width: 24px;
  padding: 8px 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.hv-dash i {
  position: relative;
  display: block;
  height: 1px;
  overflow: hidden;
  background: var(--ink-3);
}

.hv-dash i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
}

.hv-dash [aria-current] i {
  height: 2px;
  margin-top: -0.5px;
}

.hv-dash button:hover i {
  background: var(--ink-2);
}

.hv.is-live .hv-dash [aria-current] i::after {
  animation: hv-fill var(--hv-interval) linear forwards;
}

.hv.is-paused .hv-dash [aria-current] i::after,
.hv.is-hidden .hv-dash [aria-current] i::after,
.hv.is-away .hv-dash [aria-current] i::after,
.hv:has(:focus-visible) .hv-dash [aria-current] i::after {
  animation-play-state: paused;
}

.hv.is-static .hv-dash [aria-current] i::after {
  animation: none;
  transform: scaleX(1);
}

@keyframes hv-fill {
  to {
    transform: scaleX(1);
  }
}

.hv-caps {
  display: grid;
}

.hv-cap {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title side"
    "sum side";
  align-content: start;
  gap: 8px 48px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}

.hv-cap.is-on {
  opacity: 1;
  visibility: visible;
}

.hv-title {
  grid-area: title;
  margin: 0;
  font: var(--display) clamp(34px, 4vw, 64px)/0.95 var(--font-sans);
  letter-spacing: -0.06em;
}

.hv-title a {
  color: inherit;
  text-decoration: none;
}

.hv-sum {
  grid-area: sum;
  max-width: 38em;
  margin: 2px 0 0;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink-2);
}

.hv-side {
  grid-area: side;
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 12px;
  max-width: 22em;
  padding-top: 8px;
  text-align: right;
}

.hv-cap.is-on .hv-title {
  animation: hv-rise 0.7s var(--ease) both;
}

.hv-cap.is-on .hv-sum,
.hv-cap.is-on .hv-side {
  animation: hv-rise 0.7s 0.08s var(--ease) both;
}

@keyframes hv-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (max-width: 900px) {
  .hv-stage {
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .hv-bar {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
    padding-top: 16px;
  }

  .hv-meta {
    display: flex;
    align-items: baseline;
    gap: 14px;
  }

  .hv-meta .lbl {
    display: none;
  }

  .hv-count {
    font-size: 20px;
  }

  .hv-dash {
    margin: 0 0 0 auto;
  }

  .hv-cap {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "sum"
      "side";
  }

  .hv-side {
    justify-items: start;
    text-align: left;
    padding-top: 4px;
  }
}

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

.hi {
  display: grid;
  grid-template-columns: var(--lab) minmax(0, 1fr);
  gap: 24px;
  padding: clamp(88px, 10vw, 160px) var(--gut) clamp(88px, 10vw, 150px);
}

.hi-tag {
  padding-top: 0.75em;
}

.hi-statement {
  max-width: 21em;
  margin: 0;
  font: 400 clamp(22px, 2.3vw, 34px)/1.3 var(--font-sans);
  letter-spacing: -0.02em;
  text-wrap: pretty;
}

.hi-statement a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--ink-3);
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.2s;
}

.hi-statement a:hover {
  text-decoration-color: var(--ink);
}

.hi-facts {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin: clamp(44px, 5vw, 72px) 0 0;
}

.hi-facts dt {
  margin-bottom: 8px;
}

.hi-facts dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .hi {
    grid-template-columns: minmax(0, 1fr);
  }

  .hi-facts {
    grid-column: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .hi-facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------- index */

.hx {
  padding: 0 var(--gut) clamp(96px, 12vw, 180px);
}

@media (prefers-reduced-motion: reduce) {
  .hv-slide img,
  .hv-cap,
  .hv-cursor span {
    transition: none;
  }

  .hv-cap.is-on .hv-title,
  .hv-cap.is-on .hv-sum,
  .hv-cap.is-on .hv-side {
    animation: none;
  }
}
