/* Huret Billon — landing page styles.
 *
 * Walking Skeleton (plan 01-01): clean static, vertically-scrolling stacked
 * layout. This is also the reduced-motion fallback that plan 01-02 preserves
 * when it layers the parallax on top. No parallax here.
 *
 * The brand logo asset (assets/logo.svg) is a white wordmark. It and the contact
 * text sit directly on the photograph (no box/scrim); soft drop/text shadows keep
 * them legible over brighter areas (editorial, letter-spaced wordmark aesthetic).
 */

:root {
  --ink: #141414;
  --paper: #f4f4f2;
  /* Image intrinsic aspect ratio (height / width) of assets/background.jpg
   * (2053 / 1400). Used to size the background to its true proportions so the
   * page scrolls through the whole photo, top to bottom. */
  --img-aspect: 1.46643;
  --max-content: 520px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* No horizontal scrollbar at any width. */
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: "Titillium Web", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--paper);
  background-color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* Full-width B&W background photo spanning the full page height.
 * Positioned behind the content; the document is made tall below so the page
 * scrolls vertically through the image.
 *
 * `assets/background.*` is the real atelier photograph (_source/ATELIER.png),
 * desaturated and web-optimized (grayscale, 1400px wide): WebP ~64KB (served to
 * browsers that support it) with a JPEG ~118KB fallback. */
#bg {
  /* Fixed to the viewport; the JS translates it up as you scroll (BG_PACE = 1,
   * i.e. it scrolls through at the natural page pace). Sized to the image's true
   * aspect ratio and shown whole (no crop) so scrolling reaches the bottom of
   * the photo exactly at the end of the page. */
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: calc(100vw * var(--img-aspect));
  /* WebP with JPEG fallback. First line is the ultimate fallback for browsers
   * that don't support image-set(); the prefixed and standard image-set() lines
   * let modern browsers pick WebP (smaller) and fall back to JPEG otherwise. */
  background-image: url("assets/background.jpg");
  background-image: -webkit-image-set(
    url("assets/background.webp") type("image/webp"),
    url("assets/background.jpg") type("image/jpeg")
  );
  background-image: image-set(
    url("assets/background.webp") type("image/webp"),
    url("assets/background.jpg") type("image/jpeg")
  );
  background-size: 100% 100%;
  background-position: center top;
  background-repeat: no-repeat;
  /* Moving layer — hint the compositor. */
  will-change: transform;
}

/* Tall, vertically-scrolling document: content is spaced across a page that is
 * taller than the viewport so the visitor scrolls down through the photo. */
.page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Scroll length = full image height (so you scroll to the end of the photo),
   * with a floor so short images on tall viewports still have room to scroll. */
  min-height: max(calc(100vw * var(--img-aspect)), 200vh);
  padding: 0 1.25rem 12vh;
  gap: 70vh; /* logo starts centered, contact settles lower down */
  text-align: center;
}

/* Logo directly over the photo (no box, no shadow). Under motion it STARTS
 * vertically centered and reaches the top margin only at the end of the image
 * scroll (JS drives the drift by scroll progress). The margin (~50vh minus
 * roughly half the logo height) places the untransformed logo at the vertical
 * center of viewport 1. */
#logo {
  display: block;
  width: min(88vw, 640px);
  height: auto;
  margin-top: calc(50vh - 80px); /* start vertically centered in viewport 1 */
  /* Moving layer — hint the compositor. */
  will-change: transform;
}

/* Contact block: both links grouped, letter-spaced, directly on the photo.
 * Under motion it starts below the fold and scrolls up (no fade), settling at
 * the vertical center of the screen at the end of the image scroll. */
#contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: min(90vw, var(--max-content));
  /* No box, no shadow — links sit directly on the photo. */
  /* Moving layer — hint the compositor. */
  will-change: transform;
}

.contact-link {
  color: var(--paper);
  font-size: clamp(1rem, 1rem + 0.8vw, 1.35rem);
  letter-spacing: 0.08em;
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 244, 242, 0.5);
  padding-bottom: 2px;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.contact-link:hover,
.contact-link:focus-visible {
  border-bottom-color: var(--paper);
  opacity: 0.9;
}

.contact-link:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 4px;
}

/* Mobile / portrait viewports (narrower than the photo's own aspect ratio):
 * at full width the photo is shorter than the screen, so there is nothing to
 * scroll through. Zoom it in (cover, cropped to the central column) and span the
 * scrollable height so scrolling moves through the whole image. The threshold
 * 682/1000 is the photo's width/height ratio — below it the image would be
 * shorter than the viewport. */
@media (max-aspect-ratio: 682 / 1000) {
  #bg {
    /* 150vh = a moderate zoom: enough to cover the screen while showing more of
     * the photo than a full-viewport-height crop would.
     *
     * iOS Safari coverage fix: `vh` is the LARGE viewport (address bar retracted),
     * so when the address bar is visible the fixed background can fall short and a
     * gap appears at the bottom of the scroll. The `dvh` (dynamic viewport height)
     * line below tracks the currently-visible viewport — matching the
     * `window.innerHeight` the parallax JS reads each frame — so coverage holds as
     * the address bar collapses/expands. The `vh` declaration stays first as the
     * fallback for browsers without `dvh` support (older Safari/Firefox). */
    height: 150vh;
    height: 150dvh;
    background-size: cover;
    background-position: center center;
  }

  /* Scroll length matches the background height so the fixed bg always covers
   * the viewport from top to bottom of the scroll. Same vh-then-dvh pattern so the
   * document's scroll length tracks the dynamic viewport in lockstep with #bg. */
  .page {
    min-height: 150vh;
    min-height: 150dvh;
  }
}

/* Reduced-motion fallback: the JS applies NO transforms when the visitor
 * prefers reduced motion, so CSS restores the clean static stacked layout from
 * plan 01-01 here. Neutralize transform-dependent positioning, force contact
 * fully visible and statically laid out, and clear the compositor hints. */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }

  /* Background returns to an absolute layer at true aspect that scrolls with the
   * document (no fixed-viewport parallax container, no stretch). */
  #bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100vw * var(--img-aspect));
    will-change: auto;
  }

  /* Logo returns to its near-the-top static placement (plan 01-01). */
  #logo {
    margin-top: 8vh;
    will-change: auto;
  }

  /* Contact is fully legible and statically laid out — no fade, no transform. */
  #contact {
    opacity: 1;
    will-change: auto;
  }
}
