:root {
  --mist: #e4e9e2;
  --pine: #14261c;
  --moss: #557a4a;
  --sun: #f0a53a;

  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --text: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: clamp(1.25rem, 4vw, 3.5rem);
}

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

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

body {
  margin: 0;
  background: var(--mist);
  color: var(--pine);
  font-family: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: var(--sun);
  color: var(--pine);
}

/* ---------- layout ---------- */

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: end;
  gap: var(--pad);
  padding: var(--pad);
}

.who {
  grid-column: 1;
  grid-row: 1;
  padding-bottom: clamp(0.5rem, 4vh, 3rem);
}

.grove {
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
}

/* ---------- text ---------- */

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(2.75rem, 6.2vw, 6.25rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.who__role {
  margin: clamp(1.25rem, 3vh, 2rem) 0 0;
  font-size: clamp(1rem, 1.25vw, 1.1875rem);
  color: var(--moss);
}

.who__mail {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: clamp(1.125rem, 1.6vw, 1.5rem);
  font-weight: 500;
  color: var(--pine);
  text-decoration: none;
  background: linear-gradient(var(--sun), var(--sun)) 0 100% / 100% 2px no-repeat;
  padding-bottom: 0.2em;
  transition: background-size 0.45s var(--ease-out);
  overflow-wrap: anywhere;
}

.who__mail:hover,
.who__mail:focus-visible {
  background-size: 100% 100%;
}

.who__mail:focus-visible,
.grove:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 6px;
}

/* ---------- the grove: photo cut into trunks ---------- */

.grove {
  position: relative;
  display: block;
  width: 100%;
  min-height: 60vh;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.grove__sun {
  position: absolute;
  top: 1%;
  left: 5%;
  width: 40%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--sun);
  transform: translate3d(var(--sx, 0px), var(--sy, 0px), 0);
  will-change: transform;
}

.grove__strips {
  position: absolute;
  inset: 0;
  display: block;
}

.strip {
  --gap: clamp(3px, 0.45vw, 7px);
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--x) * 1%);
  width: calc(var(--w) * 1%);
  overflow: hidden;
  clip-path: inset(calc(var(--t) * 1%) var(--gap) calc(var(--b) * 1%) var(--gap));
  transition: clip-path 1.25s var(--ease-out);
  transition-delay: calc(var(--i) * 60ms);
}

/* the same photo inside every strip, sized to the whole composition */
.strip i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(-100% * var(--x) / var(--w));
  width: calc(10000% / var(--w));
  background: #2a3d2c url("assets/daniel-bubak.webp") 47% 22% / cover no-repeat;
  transform: translate3d(var(--dx, 0px), var(--dy, 0px), 0) scale(1.1);
  will-change: transform;
}

/* before the photo is ready: trunks have not grown yet */
.js .grove:not(.is-ready) .strip {
  clip-path: inset(100% var(--gap) calc(var(--b) * 1%) var(--gap));
}

.js .grove:not(.is-ready) .grove__sun,
.js .who {
  opacity: 0;
}

.grove__sun {
  transition: opacity 1.2s ease 0.3s;
}

.js .who {
  transform: translate3d(0, 0.75rem, 0);
  transition: opacity 0.9s ease 0.75s, transform 1.1s var(--ease-out) 0.75s;
}

.js .is-loaded .who {
  opacity: 1;
  transform: none;
}

/* after the intro, reactions should be quick */
.grove.is-settled .strip {
  transition-duration: 0.7s;
  transition-delay: calc(var(--i) * 18ms);
}

/* resolved: trunks close into the whole photo */
.grove.is-open .strip {
  clip-path: inset(0 0 0 0);
}

/* ---------- small screens ---------- */

@media (max-width: 800px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 1.75rem;
  }

  .grove {
    grid-column: 1;
    grid-row: 1;
    min-height: 52vh;
    min-height: 52dvh;
  }

  .who {
    grid-column: 1;
    grid-row: 2;
    padding-bottom: 0.75rem;
  }

  h1 {
    font-size: clamp(2.5rem, 13vw, 4rem);
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .strip,
  .grove__sun,
  .js .who,
  .who__mail {
    transition: none !important;
  }

  .js .who {
    transform: none;
  }
}
