/* Henry Ivry - personal site. Same quiet-typographic system as the CV:
   Literata for the name, Inter for body, the hand-drawn mark and subtitle
   carrying the personality. */

@font-face {
  font-family: "Literata";
  font-weight: 500;
  font-display: swap;
  src: url("fonts/literata-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-weight: 500;
  font-display: swap;
  src: url("fonts/inter-latin-500-normal.woff2") format("woff2");
}

:root {
  --ink: #111827;
  --body: #374151;
  --quiet: #6b7280;
  --faint: #9ca3af;
  --hairline: #e5e7eb;
}

* {
  box-sizing: border-box;
}

html {
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: #fff;
  color: var(--body);
  font-size: 17px;
  line-height: 1.65;
}

html {
  scroll-behavior: smooth;
}

main {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 64px 0;
}

.lockup {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 44px;
}

#mark {
  width: 78px;
  display: block;
  flex-shrink: 0;
}

#mark img,
#mark canvas {
  width: 78px;
  height: auto;
  display: block;
}

/* set synchronously in <head> when the trace will run: keeps the static
   mark from flashing fully-drawn before the canvas takes over */
.anim #mark-img {
  visibility: hidden;
}

/* the finishing gesture: once drawn, the hand waves - a gentle rock around
   the wrist that settles into a slight leftward lean */
#mark canvas {
  transform-origin: 55% 92%;
}

#mark .wave {
  animation: wave 0.9s cubic-bezier(0.34, 1.4, 0.64, 1) 0.15s forwards;
}

@keyframes wave {
  0% { transform: rotate(0deg); }
  55% { transform: rotate(-8deg); }
  100% { transform: rotate(-3deg); }
}

/* at rest the hand keeps its lean; hovering earns you another little wave */
#mark .rest {
  transform: rotate(-3deg);
  transition: transform 0.4s cubic-bezier(0.34, 1.8, 0.64, 1);
}

#mark:hover .rest {
  transform: rotate(-10deg);
}

h1 {
  font-family: "Literata", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.1;
}

.subtitle {
  width: min(280px, 100%);
  height: auto;
  aspect-ratio: 1200 / 137; /* reserve the box before the image decodes */
  display: block;
}

.intro p {
  max-width: 56ch;
  margin: 0 0 20px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 36px;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.links a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 1px;
  transition: border-color 0.2s ease;
}

.links a:hover {
  border-color: var(--ink);
}

.links li + li::before {
  content: "\00b7";
  color: var(--faint);
  margin-right: 14px;
}

/* on narrow screens the dots wrap badly - stack instead */
@media (max-width: 540px) {
  .links {
    flex-direction: column;
    gap: 12px;
  }
  .links li + li::before {
    content: none;
  }
  /* the scroll arrow hides behind mobile browser chrome - a quiet divider
     marks the fold instead */
  .down {
    display: none;
  }
  .hero::after {
    content: "";
    position: absolute;
    bottom: 18px;
    left: 50%;
    margin-left: -24px;
    width: 48px;
    border-bottom: 1px solid var(--hairline);
  }
}

/* the mark is a link (coffee!) - keep it quiet */
#mark {
  text-decoration: none;
  color: inherit;
}

/* scroll cue: rises in late, then bobs gently */
.down {
  position: absolute;
  bottom: 26px;
  left: 0;
  right: 0;
  width: fit-content;
  margin: 0 auto;
  padding: 8px 14px;
  color: var(--faint);
  text-decoration: none;
  font-size: 20px;
}

.anim .down {
  opacity: 0;
  transform: translateY(8px);
}

.anim.ready .down {
  animation:
    rise 0.7s ease 1s forwards,
    bob 2.4s ease-in-out 3s infinite;
}

.down:hover {
  color: var(--quiet);
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* the second act: product / engineering / music */
.more {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 36px;
  padding: 64px 0;
  position: relative;
}

.listen {
  margin-top: 10px !important;
  color: var(--quiet);
}

.more h2 {
  font-size: 15px;
  font-weight: 500;
  color: var(--quiet);
  margin: 0 0 8px;
}

.more p {
  margin: 0;
  max-width: 56ch;
}

.more a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  transition: border-color 0.2s ease;
}

.more a:hover {
  border-color: var(--ink);
}

/* footer lives inside the second viewport - no extra scroll for a copyright */
footer {
  position: absolute;
  bottom: 22px;
  left: 0;
  font-size: 13px;
  color: var(--faint);
}

/* Entrance: hidden only when the animation will run (.anim, set in head),
   and released once fonts are ready (.ready) - so the rise happens once,
   already in the right typeface, instead of paint -> font-swap bounce */
.rise {
  opacity: 1;
}

.anim .rise {
  opacity: 0;
  transform: translateY(8px);
}

.anim.ready .rise {
  animation: rise 0.7s ease forwards;
}
.rise.d1 { animation-delay: 0s; }
.rise.d2 { animation-delay: 0.15s; }
.rise.d3 { animation-delay: 0.35s; }
.rise.d4 { animation-delay: 0.5s; }
.rise.d5 { animation-delay: 0.65s; }

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .rise,
  .down {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
