#lightbox-caption:empty {
  display: none;
}

/* Tumma teema */
:root {
  --paper: #121212;
  --ink: #ffffff;
  --line: rgba(255, 255, 255, .35);
}

/* Kuvan omat mittasuhteet määrittävät suurennusnäkymän kehyksen. */
#lightbox {
  width: fit-content;
  max-width: min(92vw, 1350px);
  max-height: 92vh;
}

#lightbox-image {
  width: auto;
  height: auto;
  max-width: min(calc(92vw - 72px), 1280px);
  max-height: calc(88vh - 68px);
}

#lightbox-caption {
  font-weight: 510;
}

#lightbox {
  border: 0;
}

#lightbox-image {
  cursor: pointer;
}

#lightbox-image:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 6px;
}

#lightbox .previous,
#lightbox .next {
  width: 30px;
  height: 30px;
  font-size: 1.2rem;
}

/* Kevyt etusivun saapumisanimaatio. */
@keyframes fade-in-from-top {
  from { opacity: 0; transform: translateY(-24px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-copy,
.portrait-wrap {
  animation: fade-in-from-top 700ms cubic-bezier(.2, .75, .25, 1) both;
}

.portrait-wrap {
  animation-delay: 120ms;
}

.portrait-wrap img {
  mix-blend-mode: normal;
}

/* Keskitetty etusivun sisältö ja tiiviimpi osioiden rytmi. */
.site-header {
  background: var(--paper);
  backdrop-filter: none;
}

.section {
  min-height: 0;
  padding-top: clamp(48px, 6vw, 84px);
  padding-bottom: clamp(48px, 6vw, 84px);
}

.hero {
  min-height: 0;
  display: block;
  padding-top: clamp(48px, 5vw, 72px);
  padding-bottom: clamp(36px, 4vw, 56px);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 540px) clamp(190px, 22vw, 244px);
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 32px);
  max-width: 850px;
  min-height: 0;
  margin: 0 auto;
}

.hero-copy {
  justify-self: end;
  text-align: right;
}

.hero h1 {
  font-size: clamp(5.3rem, 11.5vw, 8.9rem);
  margin-top: -.15em;
  margin-bottom: 1.6rem;
  line-height: .84;
}

.hero-copy p {
  margin-left: auto;
  font-size: clamp(.85rem, 1vw, 1rem);
}

.hero .portrait-wrap {
  width: 100%;
  height: clamp(360px, 52vh, 425px);
  min-height: 0;
  align-self: center;
}

.menu-toggle {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .hero-copy,
  .portrait-wrap {
    animation: none;
  }
}

@media (max-width: 760px) {
  .site-header {
    justify-content: space-between;
    padding: 0 16px;
  }

  .menu-toggle {
    display: grid;
    width: 34px;
    height: 34px;
    padding: 8px 5px;
    border: 0;
    background: transparent;
    cursor: pointer;
    align-content: center;
    gap: 5px;
  }

  .menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--red);
    transition: transform .2s ease, opacity .2s ease;
  }

  .site-header nav {
    position: absolute;
    top: 60px;
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 20px 20px;
    background: var(--paper);
    border-bottom: 1px solid var(--red);
  }

  .site-header.menu-open nav {
    display: flex;
  }

  .site-header nav a {
    padding: 11px 0;
    font-size: 1rem;
  }

  .site-header nav span {
    display: none;
  }

  .site-header.menu-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .site-header.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
  .site-header.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .hero {
    min-height: calc(100vh - 60px);
    padding-top: 44px;
  }

  .hero-inner {
    display: block;
    min-height: 0;
  }

  .hero-copy {
    text-align: left;
  }

  .hero h1 {
    margin-top: 0;
    margin-bottom: 1.35rem;
    line-height: .88;
  }

  .section:not(.hero) {
    padding-top: 48px;
    padding-bottom: 48px;
  }

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

  .software-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero .portrait-wrap {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 2 / 3;
    margin-top: 6px;
  }

  #lightbox {
    max-width: calc(100vw - 28px);
    padding: 18px 28px 24px;
  }

  #lightbox-image {
    max-width: calc(100vw - 84px);
    max-height: calc(86vh - 56px);
  }
}
