/* =====================================================================
   Overlays — projects / objects / about over the home shell
   ===================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--header-pad) var(--frame) 80px;
  background: rgba(244, 241, 234, .65);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.overlay.is-active {
  display: flex;
}

/* Archive overlay only — smooth fade in/out (other overlays snap). */
.overlay--archive {
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow) var(--ease);
}
.overlay--archive.is-active {
  opacity: 1;
  pointer-events: auto;
}

.overlay__inner {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
}

/* About — center the body vertically.
   Match the bottom padding to the top (--header-pad) so the centered blurb
   lands on the true viewport center, aligned with the symmetric home images
   (inset: 10vh) rather than ~40px low from the asymmetric default padding.
   On a phone the text is taller than the screen and scrolls, and the
   contact line is fixed on top of it — so reserve the footer's own height
   (measured in main.js) whenever that's the larger of the two. Two classes
   to outrank the narrow-screen `.overlay` rule at the end of this file,
   which would otherwise reset the bottom padding to 60px. */
.overlay.overlay--about {
  padding-bottom: max(var(--header-pad), calc(var(--footer-h, 88px) + 24px));
}
.overlay--about .overlay__inner {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Blur the home shell behind any active overlay */
body.has-overlay .home__clock,
body.has-overlay .home__screensaver {
  filter: blur(24px) saturate(1.05);
  pointer-events: none;
}

/* Archive overlay only — animate the home blur in/out.
   The body.archive-active class is held throughout the open->close cycle
   by JS so the transition declaration is present in both directions. */
body.archive-active .home__clock,
body.archive-active .home__screensaver {
  transition:
    opacity   var(--t-slow) var(--ease),
    transform var(--t-slow) var(--ease),
    filter    var(--t-slow) var(--ease);
}

body.has-overlay .home {
  cursor: pointer;
}

@media (max-width: 720px) {
  .overlay {
    padding: var(--header-pad) var(--frame-sm) 60px;
  }

  /* No fixed contact bar to clear on a phone — the lines scroll along at
     the end of the text — so About keeps the standard bottom padding and
     stacks its contact block under the blurb. */
  .overlay.overlay--about {
    padding-bottom: 60px;
  }
  .overlay--about .overlay__inner {
    flex-direction: column;
  }
}
