/* ---------- HERO: full-width photo with moving film grain ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  height: calc(100svh - var(--top-h, 64px));
  min-height: 420px;
  background: #ebe8e2;   /* shows through the photo a little, so blacks turn soft grey */
}
.hero-photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: var(--focus, 50% 30%);
  /* washed-out black and white, like a faded print */
  filter: grayscale(1) contrast(.82) brightness(1.14);
  opacity: 0; transition: opacity 1.4s ease;
}
.hero.ready .hero-photo { opacity: .86; }

/* fades into the page colour at the bottom, so the text on the photo stays readable */
.hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 55%; z-index: 1;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--paper) 55%, transparent) 55%, color-mix(in srgb, var(--paper) 86%, transparent));
  pointer-events: none;
}

/* the grain: one noise tile made in hero.js, jumped around ~3 times a second */
.hero-grain {
  position: absolute; inset: -60%; z-index: 2; pointer-events: none;
  background-image: var(--grain);
  background-size: 180px 180px;
  opacity: .28;   /* grain strength: higher = stronger */
  mix-blend-mode: overlay;
  animation: grain 3.2s steps(1) infinite;   /* speed: higher = slower */
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-6%, -9%); }
  20%  { transform: translate(-14%, 4%); }
  30%  { transform: translate(7%, -21%); }
  40%  { transform: translate(-4%, 22%); }
  50%  { transform: translate(-13%, 9%); }
  60%  { transform: translate(14%, 0); }
  70%  { transform: translate(0, 13%); }
  80%  { transform: translate(3%, 31%); }
  90%  { transform: translate(-9%, 8%); }
}

/* intro sentence, location and social links, bottom-left on the photo */
.hero-text {
  position: absolute; z-index: 3; left: var(--gutter); right: calc(var(--gutter) + 40px); bottom: 24px;
}
.hero-text .intro-line {
  margin: 0; text-align: left; max-width: 22ch;
  font-size: clamp(1.35rem, 2.3vw, 2rem); line-height: 1.2;
}
.hero-text .intro-sub { margin-top: 8px; color: var(--ink); font-size: .8rem; }
/* about page: name and bio on the photo */
.hero-about h1 {
  margin: 0 0 14px; font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.1;
}
.hero-about .bio { margin: 0; max-width: 46ch; }
.hero.no-photo .bio { margin-inline: auto; }

.hero-links { display: flex; gap: 16px; margin-top: 18px; }
.hero-links a { display: block; line-height: 0; }
.hero-links svg { display: block; transition: transform .2s; }
.hero-links a:hover svg { transform: translateY(-2px); }
.hero-links a, .hero-down { color: var(--ink); transition: color .2s; }
.hero-links a:hover, .hero-down:hover { color: var(--accent); }
.hero-down { position: absolute; z-index: 3; right: var(--gutter); bottom: 20px; font-size: .9rem; }

/* no hero photo yet: just the text, centred, like a plain intro */
.hero.no-photo { height: auto; min-height: 0; background: none; padding: clamp(72px, 14vh, 150px) var(--gutter) 0; text-align: center; }
.hero.no-photo::after, .hero.no-photo .hero-grain, .hero.no-photo .hero-down { display: none; }
.hero.no-photo .hero-text { position: static; }
.hero.no-photo .intro-line { margin: 0 auto; text-align: center; }
.hero.no-photo .hero-links { justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  .hero-grain { animation: none; }
  .hero-photo { transition: none; }
}
@media print { .hero { display: none; } }
