/*
 * Site shell for the Geoffrey marketing site.
 *
 * Everything visual comes from the design system (styles/ds/*.css, copied
 * verbatim from the design) and from the design's own inline styles, which the
 * build carries into the HTML. This file holds ONLY what the static build adds
 * on top of the design, and it should stay that small:
 *
 *   - choosing between the renderings the build ships side by side
 *     (desktop / mobile, motion / static) — the design chose in JS at runtime;
 *   - the menu overlay's closed state (the design mounted it on demand);
 *   - progressive-enhancement fallbacks for when JS does not run;
 *   - the skip link and the 404 page, which the design does not draw;
 *   - section 03 ("How it works"), authored in the repo on the operator's
 *     instruction (scripts/lib/sections/handover.mjs explains why).
 *
 * Layout appearing here is a sign the change belongs in the design instead.
 */

/* ── Which rendering shows ─────────────────────────────────────────────── */
/* The DS breakpoint is 900px (components.css). site.js additionally detaches
   whichever rendering is hidden, so anchors, focus order and find-in-page only
   ever see one copy; these rules are what applies before and without it. */
.v-mob,
.v-motion { display: none; }
html.js-motion .v-motion { display: block; }
html.js-motion .v-static { display: none; }
@media (max-width: 899px) {
  .v-desk { display: none; }
  .v-mob { display: block; }
}

/* ── One currency per visitor ──────────────────────────────────────────── */
/* Every price ships twice (data-cur="chf|eur"); <html data-currency> is set
   per request from the visitor's country by functions/_middleware.js.
   scripts/lib/currency.mjs explains the rest. */
html[data-currency="chf"] [data-cur="eur"],
html[data-currency="eur"] [data-cur="chf"] { display: none !important; }
.how-chip > [data-cur] { display: contents; }

/* The mobile design is drawn at 390px inside a 520px column. On a tablet,
   keep its content in that column but let every band run full width, by
   widening the page margin the whole layout already hangs off. */
.v-mob {
  --page-margin: max(20px, calc((100vw - 480px) / 2));
  overflow-x: clip;
}

/* Anchored sections land below the compact header, with or without JS. */
.pair { scroll-margin-top: var(--header-h-compact); }

/* The sticky CTA covers the bottom of the footer on a phone. */
@media (max-width: 899px) {
  body:has(.g-sticky) .g-footer { padding-bottom: 84px; }
}

/* ── Section 03 · How it works (authored override) ──────────────────────── */
/* Markup: scripts/lib/sections/handover.mjs. Behaviour: site.js "Carousel".
   The carousel bleeds to both viewport edges; its first card and its controls
   still line up with the page grid through --how-inset. */
.how { --how-inset: max(var(--page-margin), calc((100vw - var(--page-max)) / 2 + var(--page-margin))); }
.how-head {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: 40px;
  align-items: end;
}
.how-head__title { grid-column: 1 / span 7; display: flex; flex-direction: column; gap: 40px; }
.how-head__aside { grid-column: 9 / span 4; display: flex; flex-direction: column; gap: 32px; }
.how-head__aside .g-lead { margin: 0; }
.how-cta { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.how-cta .g-label { color: var(--ink-muted); }

.how-carousel { margin: clamp(56px, 6vw, 96px) calc(50% - 50vw) 0; }
.how-rail {
  list-style: none;
  margin: 0;
  padding: 0 var(--how-inset);
  display: flex;
  gap: var(--gutter);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--how-inset);
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.how-rail::-webkit-scrollbar { display: none; }
.how-rail::after { content: ""; flex: 0 0 calc(var(--how-inset) - var(--gutter)); }
.how-rail.is-dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.how-rail:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }

.how-card {
  flex: none;
  /* Wide on desktop so about one and a half cards show, which reads as
     "swipe"; tall portrait on phones (below). */
  width: min(62vw, calc(72svh * 1.6));
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.how-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-1);
  background: var(--surface-linen);
}
.how-card__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.how-card__text {
  margin: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  max-width: 40ch;
  font-family: var(--font-serif);
  font-size: var(--type-title);
  line-height: var(--leading-title);
  letter-spacing: -0.015em;
  font-weight: var(--weight-title);
}
.how-card__text .g-label { color: var(--accent-deep); }

/* The proof on each card: a small app-style chip, DS tokens only. */
.how-chip {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  background: var(--surface-cream);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  font-size: 15px;
  line-height: 1.35;
}
.how-chip__k { color: var(--ink-muted); }
.how-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.how-pill { padding: 8px 10px; border: 1px solid var(--rule-strong); border-radius: var(--radius-1); color: var(--ink); font-size: 10.5px; }
.how-pill--accent { border-color: var(--accent); color: var(--accent-deep); }
.how-strike { font-family: var(--font-serif); font-size: 1.25rem; color: var(--ink-muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.how-new { font-family: var(--font-serif); font-style: italic; font-size: 1.6rem; line-height: 1.05; letter-spacing: -0.02em; }
.how-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 8px; border-top: 1px solid var(--rule); }
.how-row .g-label { color: var(--ink-muted); white-space: nowrap; }
.how-row .how-flag { color: var(--accent-deep); }
.how-row--total { border-top-color: var(--accent); }
.how-total { font-family: var(--font-serif); font-size: 1.4rem; letter-spacing: -0.02em; }

.how-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 32px var(--how-inset) 0;
}
.how-nav__count { color: var(--accent-deep); min-width: 64px; }
.how-nav__bar { flex: 1; height: 1px; background: var(--rule); }
.how-nav__fill { height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0.333); transition: transform .5s var(--ease-expo); }
.how-nav__btn {
  flex: none;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background .5s var(--ease-expo), color .5s var(--ease-expo), opacity .3s;
}
.how-nav__btn:hover { background: var(--ink); color: var(--cream-50); }
.how-nav__btn[disabled] { opacity: .3; pointer-events: none; }
/* Without JS the rail still swipes and scrolls; only the buttons need JS. */
html:not(.js) .how-nav__btn { display: none; }

@media (max-width: 899px) {
  .how-head__title, .how-head__aside { grid-column: 1 / -1; }
  .how-head__title { gap: 32px; }
  .how-card { width: 84vw; gap: 18px; }
  .how-card__media { aspect-ratio: 4 / 5; }
  .how-card__text { grid-template-columns: 32px minmax(0, 1fr); }
  .how-chip { left: 12px; right: 12px; bottom: 12px; padding: 14px 16px; }
  .how-nav { padding-top: 24px; gap: 14px; }
  .how-nav__btn { width: 44px; height: 44px; }
}

/* ── Household cards on touch screens ──────────────────────────────────── */
/* The DS (components.css, `@media (hover:none)`) turns the hover panel into
   unstyled flow content on touch devices, laying the description over the top
   of the photo with no background. With no hover to reveal it, show it on a
   green scrim fading up from the bottom of the photo instead, so the top of
   the picture stays clear (chosen over a solid panel, frosted glass and
   text-below in a prototype review). Fix upstream in the DS and delete this. */
@media (hover: none) {
  .g-house__panel {
    position: absolute;
    inset: auto 0 0 0;
    padding: 72px 20px 20px;
    transform: none;
    color: var(--on-green);
    background: linear-gradient(to top, rgba(15, 29, 21, 0.92) 0%, rgba(15, 29, 21, 0.78) 45%, rgba(15, 29, 21, 0) 100%);
  }
  .g-house__panel p { color: var(--cream-50); font-size: 1rem; line-height: 1.45; }

  /* Card 01: the family sits low in the frame, under the scrim. The photo is
     landscape in a portrait box, so there is no height to pan into, and
     zooming crops the children off the sides. Slide it up instead and fade
     its lower edge into a dark-green fill, which the scrim then covers. */
  .g-house__img:has(img[src*="photo-1663090245363"]) { background: var(--green-950); }
  .g-house img[src*="photo-1663090245363"] {
    transform: translateY(-22%);
    -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
  }
}

/* Card 04's photo is landscape inside a portrait card; centred, the crop
   shows bottles and torsos. Anchor it right, where the faces are. Keyed on
   the image so it follows the photo, not the card's position. */
.g-house img[src*="photo-1519671282429"] { object-position: 100% 50%; }

/* ── Menu overlay ──────────────────────────────────────────────────────── */
/* The overlay carries an inline display:flex from the design, which beats the
   UA's [hidden] rule — hence !important. */
#menu[hidden] { display: none !important; }
html.menu-open { overflow: hidden; }

/* ── Without JS ────────────────────────────────────────────────────────── */
/* Every FAQ answer is readable; the accordion is an enhancement. */
html:not(.js) .g-faq__a { grid-template-rows: 1fr; }
html:not(.js) .g-faq__icon { display: none; }

/* ── Skip link ─────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--surface-forest);
  color: var(--on-green);
  border-radius: var(--radius-pill);
  font-size: var(--type-small);
  text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--on-green); }

/* ── 404 ───────────────────────────────────────────────────────────────── */
.notfound {
  min-height: 70svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: clamp(28px, 3vw, 44px);
  padding-top: calc(var(--header-h) - 24px);
}
.notfound__actions { display: flex; flex-wrap: wrap; gap: 16px; }
