/* Homepage scroll story — mobile and tablet only (≤ 900px).
   Desktop keeps the single locked hero screen; everything here is hidden above 900px.
   Default styles are the finished state (no JS, reduced motion); js/home.js adds the motion. */

main.home {
  flex: none;
}

.home-more,
.hero__scroll {
  display: none;
}

@media (max-width: 900px) {
  body.page-home {
    height: auto;
    overflow: visible;
  }

  /* ---------- Hero: fills the screen and stays put while the story slides over it ---------- */

  .home .hero {
    position: sticky;
    top: var(--nav-h);
    height: calc(100vh - var(--nav-h));
    height: calc(100svh - var(--nav-h));
    align-items: center;
    z-index: 0;
    will-change: opacity;
  }

  .home .hero__text-wrap {
    padding: 0 24px;
  }

  .hero__scroll {
    position: absolute;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-text-dim);
    transition: opacity 0.4s ease;
  }

  .hero__scroll::after {
    content: '';
    width: 1px;
    height: 36px;
    background: linear-gradient(var(--color-text), transparent);
    transform-origin: top;
    animation: home-scroll-line 1.8s ease-in-out infinite;
  }

  .hero__scroll.is-hidden {
    opacity: 0;
  }

  @keyframes home-scroll-line {
    0%   { transform: scaleY(0); opacity: 1; }
    60%  { transform: scaleY(1); opacity: 1; }
    100% { transform: scaleY(1); opacity: 0; }
  }

  /* ---------- The story ---------- */

  /* The story's top 35% of a screen fades from transparent to solid, so the hero sinks into
     it gradually instead of being cut by a hard edge (and nothing covers the hero at load) */
  .home-more {
    display: block;
    position: relative;
    z-index: 1;
    background: linear-gradient(to bottom, transparent 0, var(--color-bg) 35vh);
    padding: 30vh 24px 24px;
  }

  .home-section + .home-section {
    margin-top: 120px;
  }

  .home-statement {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text);
  }

  .home-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-dim);
    margin-bottom: 16px;
  }

  /* 20px of text, padded to a 44px-tall tap area; margins cancel the padding visually */
  .home-link {
    display: inline-block;
    padding: 12px 0;
    margin: 12px 0 -12px;
    font-size: 16px;
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: var(--color-link-underline);
  }

  .home-note {
    margin-left: 10px;
    font-size: 14px;
    color: var(--color-text-dim);
  }

  /* Products: names in outline that fill solid as you scroll */
  .home-product + .home-product {
    margin-top: 30vh;
  }

  .home-product__name {
    margin: 0;
    font-size: 64px; /* replaced by home.js so the name spans the full width */
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .home-product__name a {
    --fill: 100%;
    position: relative;
    display: inline-block;
    color: transparent;
    -webkit-text-stroke: 2px var(--color-text);
  }

  .home-product__name a::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    color: var(--color-text);
    -webkit-text-stroke: 2px var(--color-text);
    /* Feathered fill edge: solid up to the fill point, fading out over the next 20% */
    --edge: calc(var(--fill) * 1.2);
    -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--edge) - 20%), transparent var(--edge));
    mask-image: linear-gradient(90deg, #000 calc(var(--edge) - 20%), transparent var(--edge));
  }

  .home-product__line {
    margin-top: 20px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text-dim);
  }

  /* How we build */
  .home-how__lead {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text-dim);
  }

  .home-how__lead + .home-how__lead {
    margin-top: 20px;
  }

  .home-how__lead strong {
    color: var(--color-text);
  }

  .home-standards {
    list-style: none;
    margin: 40px 0 0;
    padding: 0;
    counter-reset: std;
    border-top: 1px solid var(--color-divider);
  }

  .home-standards li {
    counter-increment: std;
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--color-divider);
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
  }

  .home-standards li::before {
    content: counter(std, decimal-leading-zero);
    min-width: 24px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--color-text-dim);
  }

  /* Closing */
  .home-contact {
    padding-bottom: 48px;
  }

  .home-contact__title {
    font-size: 64px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--color-text);
  }

  .home-contact__email {
    display: inline-block;
    padding: 10px 0; /* 44px-tall tap area */
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 5px;
    text-decoration-color: var(--color-link-underline);
  }

  /* "Copied" message: the same white box as the desktop Contact page tooltip,
     shown above the address because there's no cursor to follow on touch screens */
  .home-contact__mail {
    position: relative;
    display: inline-block;
    margin-top: 18px;
  }

  .home-contact__status {
    position: absolute;
    left: 0;
    bottom: 100%; /* sits 10px above the text: the link's top padding */
    background: var(--color-tooltip-bg);
    color: var(--color-tooltip-text);
    font-size: 14px;
    font-weight: 700;
    padding: 10px 20px;
    white-space: nowrap;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0s 0.2s;
  }

  .home-contact__status.is-visible {
    visibility: visible;
    transition: none;
  }

  /* Fade-up reveal (only once home.js has armed the element) */
  [data-reveal].is-armed {
    opacity: 0;
    transform: translateY(24px);
  }

  [data-reveal].is-in {
    opacity: 1;
    transform: none;
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .hero__scroll::after {
    animation: none;
  }
}
