/* ARÏA St. Moritz — The Engadin Collection.
   One page: a red box, closed. Scrolling, swiping or the Open button lifts the
   lid; inside, one product at a time, chosen with the dots.
   Breakpoints: desktop (> 800px), tablet (≤ 800px), phone (≤ 700px / ≤ 480px),
   phone held sideways (landscape, ≤ 500px tall), and Safari on iPhone/iPad. */

:root {
  --red: #99182a;
  --band-red: #951a2c;
  --gold: #bf9646;
  /* The logo's gold foil, without its darkest stops (they would sink into the
     red at small sizes): every word on the lid and the band is printed in it. */
  --foil: linear-gradient(100deg, #b8913f 0%, #e9d095 22%, #f3dfa6 34%, #d9b86a 48%, #bf9646 62%, #e4c987 80%, #b8913f 100%);
  --paper: #f5f1e8;
  --ink: #756c5e;
  --copy-ink: #4a4239;      /* product copy: darker, at full strength */
  --edge: clamp(24px, 4vw, 64px);
  --band: 10.5%;            /* height of the Open/Close band */
  --top-space: 12px;        /* Safari on iPhone: white above the box */
  --floor: clamp(18px, 3.5svh, 36px); /* Safari on iPhone: white below it */
}

/* The stories are set in Cormorant Garamond italic (SIL Open Font License),
   reduced to Latin characters. */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/cormorant-garamond-italic.woff2') format('woff2');
}

* { box-sizing: border-box; }

/* The page is exactly one window and never scrolls; the lid moves instead. */
html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--paper);
}
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #fff;
  color: var(--ink);
  font: 12px/1.6 Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, p, figure { margin: 0; }
h1, h2 { font-weight: 400; }
h1, h2, p, a, button, span, address { text-transform: uppercase; }
address { font-style: normal; }
button, a { color: inherit; -webkit-tap-highlight-color: transparent; }
button { font: inherit; border: 0; background: none; cursor: pointer; border-radius: 0; }
a { text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 1px solid currentColor; outline-offset: 6px; }
svg { display: block; width: 100%; height: 100%; overflow: visible; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Stage and box */

.top-canvas { display: none; }
.stage { position: relative; height: 100svh; background: #fff; }
.box {
  position: relative;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: var(--paper);
  box-shadow: 0 1px 1px rgba(79, 24, 34, .098);
}

/* The lid */

.box-lid {
  position: absolute;
  inset: 0 0 var(--band);
  z-index: 3;
  background: var(--red);
  color: var(--gold);
  border-radius: 2px 2px 1px 1px;
  box-shadow:
    inset 0 1px 0 rgba(228, 124, 133, .25),
    inset 1px 0 0 rgba(210, 84, 101, .2),
    inset -1px 0 0 rgba(101, 14, 36, .333),
    inset 0 -2px 0 rgba(208, 82, 98, .24);
}
/* While it moves the lid is its own layer, so the logo and the grain are not
   repainted on every frame; at rest it goes back to plain vector paint. */
.box-lid.is-moving { will-change: transform; }
.box.is-open .box-lid { transform: translateY(-103%); }
/* Without scripting the box is shown open. */
html:not(.js) .box-lid, html:not(.js) .band-action { display: none; }

.box-lid::after, .box-band::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url('/assets/brand/box-grain.svg') 0 0 / 128px 128px;
  opacity: .32;
}

/* The logo with the name sits at the very centre of the lid; the phrase hangs
   below it without moving it. */
.lid-composition {
  --phrase-gap: clamp(30px, 5.5svh, 52px);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;  /* the gold prints above the grain, like Open/Close */
  width: calc(100% - 90px);
}
.lid-phrase {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + var(--phrase-gap));
  font-size: 12px;
  letter-spacing: .015em;
  text-align: center;
}
.brand-lockup { flex: 0 0 auto; height: auto; }
/* The logo rises above the centre; the phrase keeps its place. A relative
   offset, not a transform, so the logo's settling animation is unaffected. */
.lid-logo {
  --logo-lift: clamp(28px, 6svh, 60px);
  position: relative;
  top: calc(-1 * var(--logo-lift));
  width: clamp(142px, 14vw, 185px);
}

.lid-note {
  position: absolute;
  z-index: 2;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .17em;
  line-height: 1.6;
}
.top-left { top: var(--edge); left: var(--edge); }
.top-right { top: var(--edge); right: var(--edge); }
.bottom-left { bottom: 28px; left: var(--edge); }
.bottom-right { bottom: 28px; right: var(--edge); }

/* The band: address, Open/Close, link */

.box-band {
  position: absolute;
  inset: calc(100% - var(--band)) 0 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  place-items: center;
  padding-inline: var(--edge);
  background: var(--band-red);
  color: var(--gold);
  box-shadow: inset 0 -1px 0 rgba(97, 15, 35, .2);
}
/* The line where the box opens: a lit lip on the lid, a dark groove, and the
   edge of the band catching the light. */
.box-band::before {
  content: '';
  position: absolute;
  top: -2px; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(to bottom,
    #c65866 0 1px, #4f0a18 1px 2.5px, #6d1022 2.5px, #7e1527 3.5px, #b13e4c 3.5px 5px);
  box-shadow: 0 1px 2px rgba(60, 6, 18, .28);
  pointer-events: none;
}
.band-action {
  position: relative;
  z-index: 1;
  grid-area: 1 / 2;
  min-width: 110px;
  min-height: 44px;
  padding: 12px 18px;
  font-size: 10px;
  letter-spacing: .16em;
}
.band-action:hover { color: #ead4a1; }

/* The phrase under the logo is printed in the logo's foil; the corner notes
   and the band keep the classic flat gold. */
.lid-phrase {
  background: var(--foil);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  outline-color: var(--gold);
}
.band-atelier {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
  padding-inline: var(--edge);
  z-index: 1;
  pointer-events: none;
}
.band-atelier address {
  grid-area: 1 / 1;
  justify-self: start;
  font-size: 9px;
  line-height: 1.8;
}
.band-atelier address span { display: block; }
.band-atelier a {
  grid-area: 1 / 3;
  justify-self: end;
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 9px;
  pointer-events: auto;
}

/* Inside the box: one product at a time */

.box-inside {
  position: absolute;
  inset: 0 0 var(--band);
  z-index: 1;
  background: var(--paper);
}
.collection {
  position: absolute;
  inset: 112px 9% 26px;
  touch-action: pan-y pinch-zoom;
}
body.is-page-zoomed .collection { touch-action: auto; }
.scenes { position: relative; height: calc(100% - 42px); }
/* The products are a carousel (main.js): slides overlap while one leaves and
   the next arrives, and a pointer can grab and drag them. */
.scene { position: absolute; inset: 0; }
.collection.is-dragging .scene, .collection.is-sliding .scene { will-change: transform, opacity; }
.collection image { -webkit-user-drag: none; }
@media (hover: hover) and (pointer: fine) {
  .collection { cursor: grab; }
  .collection.is-dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
  .collection button { cursor: pointer; }
}

.product {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 0;
}
.product-art {
  position: relative;
  flex-shrink: 1;
  width: min(43vw, 440px);
  height: 100%;
  min-height: 0;
  max-height: 64svh;
  margin-left: 35%;
  aspect-ratio: 260 / 450;
}
.product-copy {
  position: absolute;
  left: 5%;
  top: 43%;
  width: 32%;
  max-width: 420px;
  text-align: left;
}
.product-copy h2 {
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: .05em;
  line-height: 1.25;
  color: var(--red);
}
.product-tagline { margin-top: 10px; font-size: 9px; letter-spacing: .16em; color: var(--red); }
.fragrances { display: grid; gap: 24px; margin: 26px 0 0; }
.fragrances dt { font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--red); }
.fragrances dd { margin: 5px 0 0; font-size: 8.5px; letter-spacing: .1em; line-height: 1.8; text-transform: uppercase; color: var(--copy-ink); }
/* The story in an inclined serif, set apart from the spaced capitals of the labels. */
.product-story { max-width: 300px; margin-top: 40px; font: italic 400 12px/1.5 'Cormorant Garamond', Georgia, serif; letter-spacing: .01em; text-transform: none; color: var(--copy-ink); }

/* Desktop: the product sits in the right half, a little larger; its name higher. */
@media (min-width: 801px) {
  .product-art { transform: translateX(9vw) scale(1.12); transform-origin: 50% 100%; }
  .product-copy { top: 27%; }
}

/* The arrows: a quiet way to change product without a trackpad or a touch
   screen. Centred in the margin beside the products, at the bottle's height. */
.product-arrow {
  --arrow-top: calc((100% - 42px) / 2);
  --arrow-out: calc(-5.5% - 22px);
  position: absolute;
  top: var(--arrow-top);
  z-index: 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 72px;
  margin-top: -36px;
  padding: 0;
  color: var(--red);
  opacity: .45;
  transition: opacity .3s;
}
.product-arrow.prev { left: var(--arrow-out); }
.product-arrow.next { right: var(--arrow-out); }
.product-arrow:hover, .product-arrow:focus-visible { opacity: 1; }
.product-arrow:focus-visible { outline-offset: -6px; }
.product-arrow svg { width: 11px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.1; }
@media (max-width: 700px) {
  .product-arrow { --arrow-out: calc(-3.4% - 22px); --arrow-top: calc((100% - 30px - var(--caption-height, 220px)) / 2); }
}
@media (orientation: landscape) and (max-height: 500px) {
  .product-arrow { --arrow-out: calc(-4.3% - 22px); --arrow-top: calc((100% - 26px) / 2); }
}
@media (prefers-reduced-motion: reduce) { .product-arrow { transition: none; } }

/* The dots */

.product-dots {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  color: var(--red);
}
.dot-pair { display: flex; }
.product-dots button {
  display: grid;
  place-items: center;
  width: 7px;
  height: 44px;
  padding: 0;
  font-size: 0;
}
.product-dots button span {
  display: block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .3;
  transition: opacity .35s, transform .35s;
}
.product-dots button[aria-pressed="true"] span { opacity: 1; transform: scale(1.15); }
.product-dots button:hover span { opacity: .75; }
.product-dots button:focus-visible { outline-offset: 1px; }

/* Tablet */

@media (max-width: 800px) {
  :root { --edge: 25px; }
  .lid-phrase { font-size: 11px; }
  .lid-note { font-size: 8px; }
  .product-story { margin-top: 26px; margin-inline: auto; }
}

/* Phone: bottle above, copy below */

@media (max-width: 700px) {
  .collection { inset: 100px 6% 25px; }
  .product {
    display: grid;
    grid-template-rows: minmax(0, 1fr) var(--caption-height, auto);
    place-items: end center;
  }
  .product-art { grid-row: 1; width: auto; height: 100%; max-height: 58svh; max-width: 100%; margin: 0; }
  .product-copy {
    grid-row: 2;
    align-self: start;
    position: static;
    width: 100%;
    padding-top: 14px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .lid-composition { width: calc(100% - 48px); --phrase-gap: 38px; }
  .lid-logo { width: 145px; }
  .lid-note { font-size: 7px; letter-spacing: .12em; }
  .bottom-left, .bottom-right { bottom: 24px; }
  .box-band, .band-atelier { gap: 10px; padding-inline: 22px; }
  .band-action { min-width: 70px; padding-inline: 8px; font-size: 8px; }
  .band-atelier address, .band-atelier a { font-size: 8px; }
  .band-atelier address { max-width: 115px; line-height: 1.7; }

  .collection { inset: 36px 6% 2px; }
  .scenes { height: calc(100% - 30px); }
  .product-dots { bottom: -8px; }
  .product-copy { padding-top: 16px; }
  .product-copy h2 { font-size: 16px; }
  .product-tagline { margin-top: 9px; font-size: 7px; }
  .fragrances { grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
  .fragrances dt { font-size: 7px; }
  .fragrances dd { margin-top: 5px; font-size: 6.5px; line-height: 1.6; }
  .product-story { max-width: 290px; margin-top: 24px; font-size: 6.5px; line-height: 1.85; }
}
@media (max-width: 480px) and (max-height: 640px) {
  .product-art { max-height: 50svh; }
}

/* Phone held sideways: compact band and lid; copy left, bottle right. */

@media (orientation: landscape) and (max-height: 500px) {
  .box { --band: 46px; }
  .band-atelier { gap: 12px; }
  .band-atelier address, .band-atelier a, .band-action { font-size: 8px; }
  .band-atelier address span { display: inline; margin-left: .6em; }
  .lid-note { font-size: 7px; }
  .lid-composition { --phrase-gap: clamp(10px, 4svh, 22px); }
  .lid-logo { --logo-lift: clamp(8px, 4svh, 18px); width: clamp(78px, 30svh, 130px); }
  .lid-phrase { font-size: 9px; }

  .collection { inset: 14px 7% 4px; }
  .scenes { height: calc(100% - 26px); }
  .product-dots { bottom: -8px; }
  .product {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr);
    column-gap: 7vw;
    place-items: center stretch;
  }
  .product-art {
    grid-area: 1 / 2;
    width: auto;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0 4vw 0 0;
    transform: none;
  }
  .product-copy {
    grid-area: 1 / 1;
    place-self: center end;
    position: static;
    width: 100%;
    max-width: 340px;
    padding: 0;
    text-align: left;
  }
  .product-copy h2 { font-size: 17px; }
  .product-tagline { margin-top: 6px; font-size: 7px; }
  .fragrances { grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
  .fragrances dt { font-size: 7px; }
  .fragrances dd { margin-top: 3px; font-size: 6.5px; line-height: 1.6; }
  .product-story { max-width: 300px; margin: 12px 0 0; font-size: 6.5px; line-height: 1.75; }
}

/* Readable copy: larger from tablet up; phones keep compact sizes so the bottle
   keeps its height. */
@media (min-width: 701px) and (min-height: 501px) {
  .product-copy { width: 34%; }
  .product-copy h2 { font-size: clamp(24px, 2.3vw, 34px); }
  .product-tagline { margin-top: 12px; font-size: 11px; }
  .fragrances { margin-top: 30px; gap: 22px; }
  .fragrances dt { font-size: 11px; letter-spacing: .14em; }
  .fragrances dd { margin-top: 6px; font-size: 10.5px; letter-spacing: .08em; line-height: 1.7; }
  .product-story { max-width: 340px; margin-top: 34px; font-size: 17px; line-height: 1.5; }
}
@media (max-width: 700px) {
  .fragrances dd { font-size: 7px; }
  .product-story { font-size: 10.5px; line-height: 1.4; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .product-story { font-size: 10.5px; line-height: 1.35; }
}

/* Safari on iPhone and iPad: white above and below the box, so the browser
   bars stay white and the box sits on the page like an object. */
@supports (-webkit-touch-callout: none) {
  html, .stage { background: #fff; }
  .top-canvas {
    display: block;
    position: fixed;
    inset: 0 0 auto;
    z-index: 10;
    height: var(--top-space);
    background: #fff;
    pointer-events: none;
  }
  .stage { padding-top: var(--top-space); }
  .box { height: calc(100svh - var(--top-space) - var(--floor)); }
}

@media (prefers-reduced-motion: reduce) {
  .product-dots button span { transition: none; }
}

/* 404 */

html:has(.not-found) { overflow: auto; }
body.not-found { height: auto; min-height: 100svh; overflow: auto; background: var(--paper); }
.not-found-page {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 28px;
  min-height: 100svh;
  padding: 40px 24px;
  text-align: center;
}
.not-found-page .lid-logo { top: 0; width: 120px; }
.not-found-page h1 { font-size: 11px; letter-spacing: .16em; }
.not-found-page a { color: var(--red); font-size: 10px; letter-spacing: .16em; }
