/* Home story — mobile only. See story.js. Its own file (linked with a ?v=
   token) rather than style.css, so the experiment can't be held back by
   style.css's 24h cache, and comes out cleanly if it doesn't stay. */

.home-story { display: none; }

@media (max-width: 768px) {
  .story-mode .home-story { display: block; }

  /* ── Header: a white wordmark on the first picture that docks into a bar ──
     At the top there's no header — only the white wordmark on the opening
     picture, scrolling with it. When it reaches the top it shrinks to the
     left of a thin white bar, turning black, and the menu fades in on the
     right; the bar then stays. Driven by story.js (dockLogo), which sizes
     and positions the logo and sets --dock (0 → 1) on the header. Only while
     the home story is showing: story-mode survives into a product view,
     hence :has(). The story starts at the very top, so the JS-set padding
     under the header (app.js:fixContentPadding) is cancelled. */
  body.story-mode #shop-page .content { padding-top: 0 !important; }
  body.story-mode:has(#shop-page.active) header {
    --dock: 0;
    position: fixed; height: 40px; padding: 0 14px; flex-wrap: nowrap; gap: 0;
    justify-content: flex-end; align-items: stretch;
    background: rgba(255, 255, 255, var(--dock));
  }
  /* Out of the flow; story.js sets its width and transform. Hidden until it
     hands over from the page copy (.st-logo) at the top of the screen. */
  body.story-mode:has(#shop-page.active) .header-logo {
    position: fixed; left: 0; top: 0; margin: 0; width: 300px; height: auto;
    display: block; transform-origin: 0 0; will-change: transform; z-index: 101; visibility: hidden;
  }
  body.story-mode:has(#shop-page.active) header.docking .header-logo { visibility: visible; }
  body.story-mode:has(#shop-page.active) .header-logo img { width: 100%; height: auto; }
  /* White on the picture, black in the bar: the two crossfade with --dock. */
  .header-logo .logo-white { display: none; }
  body.story-mode:has(#shop-page.active) .header-logo img { opacity: var(--dock); }
  body.story-mode:has(#shop-page.active) .header-logo .logo-white { display: block; position: absolute; left: 0; top: 0; opacity: calc(1 - var(--dock)); }
  /* Menu: each item is the full bar height (an easy tap), with its text set
     on the bottom so the letters sit on the same line as the bottom of the
     logo (story.js: logo 18px tall, centred in the 40px bar → bottom at 29;
     9.5px of padding puts the text baseline there — measured). On 320px
     phones the logo is 16px (bottom at 28) and the text drops to match. */
  body.story-mode:has(#shop-page.active) nav {
    width: auto; height: 100%; gap: min(18px, 2.8vw); padding: 0; margin-left: auto; align-items: stretch;
    opacity: var(--dock); pointer-events: none;
  }
  body.story-mode:has(#shop-page.active) header.docked nav { pointer-events: auto; }
  body.story-mode:has(#shop-page.active) nav a,
  body.story-mode:has(#shop-page.active) nav .nav-lang-btn {
    display: flex !important; align-items: flex-end !important; padding: 0 0 9.5px !important; line-height: 1 !important;
    font-size: min(10.5px, 2.55vw) !important; letter-spacing: 0.1em !important; }
  body.story-mode:has(#shop-page.active) nav .nav-lang-btn { gap: 5px !important; }
  @media (max-width: 359px) {
    body.story-mode:has(#shop-page.active) nav a,
    body.story-mode:has(#shop-page.active) nav .nav-lang-btn { padding-bottom: 10.5px !important; }
  }

  /* ── Frames ───────────────────────────────────────────────────────────────
     Full-width pictures, each at its own shape (the width/height attributes
     reserve the space before it loads), stacked with no space between. */
  .st-frame { position: relative; margin: 0; background: #e6e6e8; }
  /* The white wordmark while it's on the picture; story.js sets its place
     and size, and hides it once the header's copy takes over. */
  .st-frame img.st-logo { position: absolute; height: auto; pointer-events: none; }
  .st-frame img { display: block; width: 100%; height: auto; }
  .st-pic-link { display: block; }
  /* The opening picture fills exactly one screen, cropped at the sides, so
     the next one sits right below the bottom edge. svh = the screen with the
     browser's toolbars showing, i.e. what's visible on arrival (vh first as
     a fallback for older browsers). */
  .st-hero { height: 100vh; height: 100svh; }
  .st-hero .st-pic-link { height: 100%; }
  .st-hero img { height: 100%; object-fit: cover; object-position: 50% 50%; }

  /* ── Text on the pictures ─────────────────────────────────────────────────
     Sized in vw so it holds its place on the picture on every phone, the way
     Josh's mock-ups set it. White by default; .st-dark for a light ground. */
  .st-label, .st-note, .st-motto {
    position: absolute; margin: 0; color: #fff; pointer-events: none;
    font-family: var(--font); font-weight: 300; -webkit-font-smoothing: antialiased; }
  .st-dark .st-label { color: var(--black); }
  /* A label that is a link (BODYSUITS / SEPARATES / DETAILS): the target is
     the whole lower-left corner round the word, not just the letters, so a
     thumb aimed at it doesn't land on the model and open her piece instead.
     Anchored to the frame's corner; the padding puts the word exactly where
     the other labels sit (left 4.2vw, bottom 4.6vw). ~ 170 x 70 px. */
  a.st-label-link { pointer-events: auto; text-decoration: none; left: 0; bottom: 0;
    padding: 40px 52px 4.6vw 4.2vw; }
  /* The pieces in the picture, lower right, lowercase like the desktop hero's
     (.st-style), tight in the corner. Not links: taps fall through to the picture's own link. */
  .st-items { position: absolute; right: 2vw; bottom: 2vw; max-width: 60vw;
    text-align: right; pointer-events: none;
    color: #fff; font-family: var(--font); font-weight: 300; font-size: max(8px, 2.2vw); letter-spacing: 0.03em;
    line-height: 1.2; text-transform: lowercase; -webkit-font-smoothing: antialiased; }
  .st-price { margin-left: 0.7em; white-space: nowrap; }
  .st-price:empty { margin: 0; }
  .st-dark .st-items { color: var(--black); }
  /* Category, lower left (after The Attico's). */
  .st-label { left: 4.2vw; bottom: 4.6vw; font-size: max(13px, 4vw); letter-spacing: 0.03em; text-transform: uppercase; line-height: 1; }
  /* Statement, two short paragraphs centred low on the picture. */
  .st-note { left: 0; right: 0; bottom: 8%; padding: 0 6vw; text-align: center;
    font-size: max(10px, 2.9vw); line-height: 1.32; letter-spacing: 0.01em; }
  .st-note p { margin: 0 auto; max-width: 31em; text-wrap: balance; }
  .st-note p + p { margin-top: 1.3em; }
  /* The tagline, in the exact centre of the last picture: lowercase, no period
     (as in the desktop header — the source keeps the canonical case). */
  .st-motto { left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; white-space: nowrap; font-style: italic;
    font-size: max(11.5px, 3.35vw); letter-spacing: 0.01em; text-transform: lowercase; }

  .st-end { padding: 44px 24px 40px; text-align: center; }
  /* Same type as the labels on the pictures (.st-label). */
  .st-end-label { display: block; font-family: var(--font); font-weight: 300; font-size: max(13px, 4vw);
    letter-spacing: 0.03em; line-height: 1; text-transform: uppercase; color: var(--black); }


  /* After the story: the whole collection at a glance, three across.
     COLLECTION in the nav still shows it one piece at a time. */
  .story-mode .product-grid { grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 0 2px; }
  .story-mode .product-info { padding: 8px 4px 18px; }
  .story-mode .product-name { font-size: 8.5px; letter-spacing: 0.03em; margin-bottom: 2px; }
  .story-mode .product-price { font-size: 8.5px; letter-spacing: 0.05em; }
  .story-mode .product-card .flip-dots { display: none !important; }
  .story-mode .sold-out-label { font-size: 7px; letter-spacing: 0.15em; }
}

/* ── Desktop (11-09): the horizontal opening picture + docking logo ────────
   The same handover as the phone (story.js dockLogo), into the ordinary
   desktop header: at the top only the white logo shows, on the picture; as it
   reaches the top it shrinks to the header's 22px logo at the left, turning
   black, while the tagline and the menu fade in (--dock 0 → 1). The bar stays
   clear until the picture has passed under it, then turns white (.solid). Below the picture, the collection as before. */
@media (min-width: 769px) {
  .story-mode .home-story { display: block; }
  body.story-mode #shop-page .content { padding-top: 0 !important; }
  /* Clear over the picture; a block of white once the collection is under it. */
  body.story-mode:has(#shop-page.active) header { --dock: 0; background: transparent; }
  body.story-mode:has(#shop-page.active) header.solid { background: var(--white); }
  body.story-mode:has(#shop-page.active) .header-logo {
    position: fixed; left: 0; top: 0; margin: 0; width: 300px; height: auto;
    display: block; transform-origin: 0 0; will-change: transform; z-index: 101; visibility: hidden;
  }
  body.story-mode:has(#shop-page.active) header.docking .header-logo { visibility: visible; }
  body.story-mode:has(#shop-page.active) .header-logo img { width: 100%; height: auto; opacity: var(--dock); }
  .header-logo .logo-white { display: none; }
  body.story-mode:has(#shop-page.active) .header-logo .logo-white { display: block; position: absolute; left: 0; top: 0; opacity: calc(1 - var(--dock)); }
  body.story-mode:has(#shop-page.active) .header-tagline,
  body.story-mode:has(#shop-page.active) nav { opacity: var(--dock); }
  /* The logo is out of the header's flow here, so keep the menu on the right. */
  body.story-mode:has(#shop-page.active) nav { pointer-events: none; margin-left: auto; }
  body.story-mode:has(#shop-page.active) header.docked nav { pointer-events: auto; }

  .st-frame { position: relative; margin: 0; background: #e6e6e8; }
  .st-frame img { display: block; width: 100%; height: auto; }
  .st-frame img.st-logo { position: absolute; height: auto; pointer-events: none; }
  .st-pic-link { display: block; }

  /* The opening carousel (11-19): the slides are stacked on one 16:9 box and
     crossfade; only the one showing takes clicks. Thin chevrons at the sides. */
  .st-carousel { aspect-ratio: 16 / 9; overflow: hidden; }
  .st-carousel .st-slide { position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease; pointer-events: none; }
  .st-carousel .st-slide.on { opacity: 1; pointer-events: auto; }
  .st-carousel .st-slide img { width: 100%; height: 100%; object-fit: cover; }
  .st-carousel .st-pic-link { height: 100%; }
  .st-carousel .st-logo { z-index: 1; }
  /* The style in the picture, lower left, in lowercase (Josh, 11-19). The padding
     makes the corner the tap target, as on the phone's labels. */
  .st-style { position: absolute; left: 0; bottom: 0; z-index: 1; padding: 40px 48px 26px 24px;
    font-family: var(--font); font-weight: 300; font-size: 12px; letter-spacing: 0.05em;
    line-height: 1; text-transform: lowercase; color: var(--black); text-decoration: none; }
  .st-chev { position: absolute; top: 50%; z-index: 2; transform: translateY(-50%);
    width: 56px; height: 120px; padding: 0; border: 0; background: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; color: var(--black); opacity: 0.55;
    transition: opacity 0.2s ease; }
  .st-chev:hover, .st-chev:focus-visible { opacity: 1; }
  .st-chev svg { width: 14px; height: 40px; fill: none; stroke: currentColor; stroke-width: 0.75;
    vector-effect: non-scaling-stroke; }
  .st-prev { left: 16px; }
  .st-next { right: 16px; }
  .st-next svg { transform: scaleX(-1); }
  .st-carousel.next-light .st-next { color: var(--white); opacity: 0.8; }
  /* On a slide with skin under the menu (5528), the menu turns white (the tagline stays grey, Josh 11-19) while the
     bar is still clear. The language toggle's inline colours are built on
     these variables, so redefining them here turns it white too. */
  body.story-mode:has(#shop-page.active) header nav,
  body.story-mode:has(#shop-page.active) header nav a { transition: color 0.6s ease; }
  body.hero-nav-light.story-mode:has(#shop-page.active) header:not(.solid) nav {
    --dark-grey: #fff; --mid-grey: rgba(255,255,255,0.7); --light-grey: rgba(255,255,255,0.5); }
  body.hero-nav-light.story-mode:has(#shop-page.active) header:not(.solid) nav a { color: #fff; }
  @media (prefers-reduced-motion: reduce) { .st-carousel .st-slide { transition: none; } }

  /* A little white under the picture, COLLECTION, then the grid. Same type
     as the phone's label, at a fixed desktop size. */
  .st-end { padding: 48px 24px 40px; text-align: center; }
  .st-end-label { display: block; font-family: var(--font); font-weight: 300; font-size: 14px;
    letter-spacing: 0.03em; line-height: 1; text-transform: uppercase; color: var(--black); }
}
