:root {
  --accent: #4f9c72;
  --accent-strong: #3a7d59;
  --ink: #111;
  --muted: #646464;
  --paper: #fff;
  --soft: #f7f7f5;
  --header-height: 5.3rem;

  color-scheme: light;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-synthesis: none;
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: var(--header-height);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.75;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 20;
  padding: 0.65rem 1rem;
  background: var(--ink);
  color: var(--paper);
}

.skip-link:focus {
  top: 0.75rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 0.75rem clamp(1.5rem, 3vw, 3rem);
  background: rgb(255 255 255 / 97%);
}

.brand {
  display: flex;
  align-items: center;
}

.brand img {
  display: block;
  width: clamp(13rem, 22vw, 19.5rem);
  height: auto;
}

nav {
  display: flex;
  align-self: stretch;
  align-items: stretch;
  gap: clamp(2rem, 5vw, 4.5rem);
}

nav a {
  position: relative;
  display: grid;
  align-items: center;
  min-width: 4rem;
  text-align: center;
  text-decoration: none;
  font-size: 1.08rem;
  font-weight: 500;
}

nav a::after {
  position: absolute;
  right: 0;
  bottom: -0.75rem;
  left: 0;
  height: 2px;
  background: var(--accent);
  content: "";
  opacity: 0;
  transform: scaleX(0.4);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

nav a:hover::after,
nav a:focus-visible::after,
nav a[aria-current="true"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.hero {
  min-height: clamp(31rem, calc(100svh - var(--header-height)), 49rem);
  background: url("/assets/images/hero.jpg") center 42% / cover no-repeat;
}

.section-inner {
  width: min(1065px, calc(100% - 3rem));
  margin: 0 auto;
}

.vita {
  padding: clamp(4rem, 8vw, 7.5rem) 0;
}

.vita-layout {
  display: grid;
  grid-template-columns: minmax(13rem, 18rem) minmax(0, 1fr);
  gap: clamp(3rem, 8vw, 8rem);
}

h1,
h2 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(3.6rem, 6vw, 5.4rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 0.95;
}

.cv-list {
  display: grid;
  gap: 1.45rem;
  margin-top: 3rem;
}

.cv-list a {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  font-weight: 650;
}

.cv-list a:hover,
.cv-list a:focus-visible {
  color: var(--accent-strong);
}

.cv-list svg {
  width: 2.25rem;
  height: 2.25rem;
  fill: currentcolor;
}

.biography {
  color: var(--muted);
  font-size: 1.02rem;
}

.biography p {
  margin: 0 0 1.2rem;
}

.gallery {
  min-height: 42rem;
  padding: clamp(4rem, 8vw, 7.5rem) 0;
  border-top: 1px solid #e8e8e8;
  background: var(--paper);
}

.gallery-heading {
  display: grid;
  grid-template-columns: 1fr minmax(8rem, 14rem);
  align-items: end;
  gap: 2rem;
  margin-bottom: clamp(3rem, 6vw, 5.25rem);
}

.gallery-heading span {
  display: block;
  height: 2px;
  margin-bottom: 0.7rem;
  background: var(--ink);
}

.gallery-shell {
  position: relative;
}

.gallery-track {
  display: grid;
  grid-auto-columns: 100%;
  grid-auto-flow: column;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-behavior: smooth;
  scroll-snap-type: inline mandatory;
  scrollbar-width: none;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-item {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 7;
  background: #171717;
  scroll-snap-align: start;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.gallery-item:hover img,
.gallery-item:focus-visible img {
  transform: scale(1.015);
}

/* An overlay ring: the track clips anything outside the item, and the zoomed
   image would paint over an inset outline. */
.gallery-item:focus-visible {
  outline: none;
}

/* A border rather than only a shadow, because forced-colors mode drops shadows. */
.gallery-item:focus-visible::after {
  position: absolute;
  z-index: 1;
  border: 4px solid var(--accent-strong);
  box-shadow: inset 0 0 0 2px white;
  content: "";
  inset: 0;
  pointer-events: none;
}

.play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 4.5rem;
  height: 4.5rem;
  place-items: center;
  border: 2px solid rgb(255 255 255 / 90%);
  border-radius: 50%;
  background: rgb(0 0 0 / 35%);
  color: white;
  font-size: 1.35rem;
  transform: translate(-50%, -50%);
}

.gallery-button {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 90%);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 1.35rem;
  transform: translateY(-50%);
}

.gallery-button:not([aria-disabled="true"]):hover,
.gallery-button:focus-visible {
  background: var(--accent-strong);
  color: white;
}

.gallery-button[aria-disabled="true"] {
  cursor: default;
  opacity: 0.35;
}

.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  white-space: nowrap;
}

.gallery-button.previous {
  left: 1rem;
}

.gallery-button.next {
  right: 1rem;
}

footer {
  display: flex;
  min-height: 8.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem clamp(1.5rem, 3vw, 3rem);
  font-size: 0.95rem;
}

footer p {
  margin: 0;
}

footer a {
  text-decoration-color: transparent;
  text-underline-offset: 0.25rem;
}

footer a:hover,
footer a:focus-visible {
  text-decoration-color: var(--accent);
}

.legal {
  min-height: calc(100svh - var(--header-height));
  padding: clamp(4rem, 8vw, 7.5rem) 1.5rem;
  background: var(--soft);
}

.legal article {
  width: min(52rem, 100%);
  margin: 0 auto;
}

.legal h1 {
  margin-bottom: clamp(3rem, 6vw, 5rem);
}

.legal section {
  margin-bottom: 2.5rem;
}

.legal h2 {
  margin-bottom: 0.65rem;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.35;
}

.legal p {
  margin: 0;
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin-top: 1rem;
  font-weight: 650;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.25rem;
}

@media (width <= 760px) {
  :root {
    --header-height: 4.5rem;
  }

  body {
    line-height: 1.65;
  }

  .site-header {
    gap: 1rem;
    padding: 0.6rem 1rem;
  }

  .brand img {
    width: min(12rem, 54vw);
  }

  nav {
    gap: 0.8rem;
  }

  nav a {
    min-width: auto;
    font-size: 0.92rem;
  }

  .hero {
    min-height: min(71svh, 38rem);
    background-position: 52% center;
  }

  .section-inner {
    width: min(100% - 2rem, 39rem);
  }

  .vita-layout {
    grid-template-columns: 1fr;
    gap: 3.25rem;
  }

  .cv-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin-top: 2rem;
  }

  .cv-list a {
    display: grid;
    justify-items: center;
    gap: 0.4rem;
    text-align: center;
    font-size: 0.9rem;
  }

  .gallery-heading {
    grid-template-columns: 1fr 5rem;
  }

  .gallery-item {
    aspect-ratio: 4 / 3;
  }

  .gallery-button {
    width: 2.7rem;
    height: 2.7rem;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
