/* Homepage phone viewport and full-screen orange edges. */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
html { background-color: var(--bg); }
.phone-edge { display: none; }
@media (max-width: 760px) {
  html.phone-home, html.phone-home body { overscroll-behavior-y: none; }
  /* Give the mobile wordmark space above the folder, with a small overlap. */
  .work-section .work-section__bg {
    position: relative;
    inset: auto;
    display: block;
    order: -1;
    width: 100%;
    font-size: clamp(6rem, 34vw, 16rem);
    text-align: center;
    opacity: 0.13;
    z-index: 0;
  }
  .work-section__caption {
    order: -2;
    font-size: clamp(0.7rem, 3.1vw, 0.875rem);
    margin: 0;
  }
  .work-section .folder { margin-top: clamp(-2.75rem, -8vw, -1.75rem); }
  /* On phones, the section boundary controls the header independently of
     the shorter GSAP word-reveal pin. Desktop keeps its existing behavior. */
  html.phone-home.nav-tucked .nav { transform: none; }
  html.phone-home.phone-orange-section .nav { transform: translateY(calc(-100% - 130px)); }
  .hero {
    --phone-hero-height: max(calc(100lvh + var(--safe-top) + var(--safe-bottom)), var(--phone-screen-height, 0px));
    --phone-hero-inset: clamp(4rem, 10vh, 7rem);
    /* Keep the section tall enough to hide the marquee, but center the text
       in the visible viewport. Put the extra section height below the fold. */
    --phone-below-fold: max(0px, calc(var(--phone-hero-height) - var(--phone-visible-height, 100svh)));
    padding-top: calc(var(--phone-hero-inset) + var(--safe-top));
    padding-bottom: calc(var(--phone-hero-inset) + var(--safe-bottom) + var(--phone-below-fold));
    min-height: calc(100vh + var(--safe-top) + var(--safe-bottom));
    min-height: var(--phone-hero-height);
  }
  .hero .hero__scroll {
    top: calc(var(--phone-first-height, 100svh) - 70px);
    bottom: auto;
  }
  /* Opaque edge samples let Safari match the orange section, then reset to
     the page theme after leaving it. The navbar keeps its existing blur. */
  .phone-edge {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    z-index: 52;
    pointer-events: none;
    background-color: var(--bg);
  }
  .phone-edge--top { top: 0; height: max(12px, var(--safe-top)); }
  .phone-edge--bottom { bottom: 0; height: max(12px, var(--safe-bottom)); }
}
