/* Dear Prelude storefront — product page template. Colours and title face come from the collection registry. */

.view-product { overflow-y: auto; overflow-x: hidden; background: var(--paper); -webkit-overflow-scrolling: touch; }
.product {
  --line: color-mix(in srgb, var(--ink) 20%, transparent);
  --wash: color-mix(in srgb, var(--ink) 6%, var(--paper));
  min-height: 100%; background: var(--paper); color: var(--ink);
}
.product p { max-width: 62ch; }
.product h2 { font-family: var(--font-display); letter-spacing: var(--track-display); font-size: clamp(1.75rem, 3vw, 2.75rem); line-height: 1.1; }
.product h3 { font-family: var(--font-display); letter-spacing: var(--track-display); font-size: 1.375rem; }

/* bar */
.p-bar {
  position: sticky; top: 0; z-index: 20; height: 60px; padding: 0 var(--gutter);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); font-size: .9375rem; letter-spacing: var(--track-text);
}
.p-back { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; padding: 10px 0; justify-self: start; }
.p-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1; }
.p-back:hover { text-decoration: underline; text-underline-offset: 5px; }
.p-bar-name { font-family: var(--p-font); font-style: var(--p-style); font-weight: var(--p-weight); font-size: 1.375rem; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 30px;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  font-size: .9375rem; font-weight: 400; letter-spacing: var(--track-text); text-decoration: none;
  transition: background .4s var(--ease), color .4s var(--ease);
}
.btn:hover { background: transparent; color: var(--ink); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--ink); }
.link-btn { font-size: .9375rem; text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; padding: 8px 0; }
.link-btn.is-off { color: var(--soft); text-decoration: none; }
.fine { font-size: .875rem; color: var(--soft); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:disabled:hover { background: var(--ink); color: var(--paper); }

/* hero — scroll-driven. Default rules are the still, stacked version (also used for reduced motion);
   .is-driven, added by product.js, turns it into the pinned stage. */
.p-hero { position: relative; }
.hero-stage { display: flex; flex-direction: column; align-items: center; gap: clamp(16px, 3vh, 28px); padding: clamp(28px, 6vh, 64px) var(--gutter) clamp(36px, 7vh, 72px); overflow: hidden; text-align: center; }
.hero-kicker { font-size: .9375rem; color: var(--soft); letter-spacing: var(--track-text); }
.hero-title { font-family: var(--p-font); font-style: var(--p-style); font-weight: var(--p-weight); letter-spacing: var(--p-tracking); font-size: clamp(3.5rem, 15vw, 10rem); line-height: 1; white-space: nowrap; outline: none; padding: 0 .06em; }
.hero-obj { margin: 0; width: min(72vw, 400px); aspect-ratio: var(--ratio, 2/3); overflow: hidden; background: var(--deep); }
.hero-obj img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; outline: 1px solid color-mix(in srgb, var(--ink) 16%, transparent); outline-offset: -1px; }
.product .hero-lede { font-family: var(--font-display); letter-spacing: var(--track-display); font-size: clamp(1.375rem, 2.3vw, 2.125rem); line-height: 1.25; max-width: 24ch; text-wrap: balance; }

/* --hero-travel is how far the visitor scrolls, in viewport heights, to run the hero from start to finish.
   Shorter on phones, where each swipe covers less of the page. */
.p-hero { --hero-travel: 73; }
@media (max-width: 760px), (max-aspect-ratio: 4/5) { .p-hero { --hero-travel: 60; } }
.p-hero.is-driven { height: calc(100vh - 60px + var(--hero-travel) * 1vh); }
.is-driven .hero-stage { position: sticky; top: 60px; height: calc(100vh - 60px); display: block; padding: 0; }
@supports (height: 100dvh) {
  .p-hero.is-driven { height: calc(100dvh - 60px + var(--hero-travel) * 1dvh); }
  .is-driven .hero-stage { height: calc(100dvh - 60px); }
}
.is-driven .hero-kicker { position: absolute; left: 0; right: 0; top: clamp(18px, 4.5vh, 40px); margin: 0 auto; }
.is-driven .hero-title { position: absolute; left: 50%; top: clamp(48px, 10vh, 96px); transform: translateX(-50%); z-index: 1; }
.is-driven .hero-obj {
  position: absolute; left: 50%; top: 0; z-index: 2; transform-origin: 50% 0; will-change: transform;
  overflow: visible; background: none;
}
.is-driven .hero-obj img { box-shadow: 0 calc(20px + 40px * var(--hp, 0)) calc(40px + 60px * var(--hp, 0)) calc(-24px - 10px * var(--hp, 0)) rgba(0, 0, 0, calc(.16 + .26 * var(--hp, 0))); }
.is-driven .hero-lede { position: absolute; left: 50%; z-index: 3; width: min(86%, 24ch); margin: 0; opacity: var(--lede, 0); transform: translate(-50%, calc((1 - var(--lede, 0)) * 22px)); }

/* the one description that follows the hero: a short, typeset introduction */
.p-intro { padding: clamp(64px, 13vh, 150px) var(--gutter) clamp(72px, 14vh, 160px); display: flex; justify-content: center; }
.product .p-intro p { font-family: var(--font-display); letter-spacing: var(--track-display); font-size: clamp(1.1875rem, 1.5vw, 1.4375rem); line-height: 1.6; max-width: 31em; text-align: center; text-wrap: pretty; }
.product .p-intro p.is-quiet { color: var(--soft); font-size: 1.0625rem; }

/* optional static gallery of invitation designs (off by default) */
.designs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 3vw, 40px); }
.designs figure { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.designs img { width: 100%; height: auto; }
.designs figcaption { font-size: .9375rem; color: var(--soft); }

/* sections */
.p-section { scroll-margin-top: 60px; padding: clamp(48px, 9vh, 112px) var(--gutter); border-top: 1px solid var(--line); }
.p-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: clamp(28px, 5vh, 56px); }

/* website demonstration: one panel holding the controls and the preview */
.demo { background: var(--wash); border: 1px solid var(--line); }
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 28px; flex-wrap: wrap; padding: 6px clamp(16px, 2.6vw, 36px); border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; gap: 28px; }
.seg button { position: relative; min-height: 48px; padding: 0 1px; font-size: .9375rem; letter-spacing: var(--track-text); color: var(--soft); transition: color .4s var(--ease); }
.seg button::after { content: ''; position: absolute; left: 0; right: 0; bottom: 9px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { color: var(--ink); }
.seg button[aria-pressed="true"]::after { transform: scaleX(1); }
.demo-open { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; font-size: .9375rem; letter-spacing: var(--track-text); text-decoration: none; }
.demo-open svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.1; transition: transform .4s var(--ease); }
a.demo-open:hover { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
a.demo-open:hover svg { transform: translate(2px, -2px); }
.demo-open.is-off { color: var(--soft); }
.demo-stage { padding: clamp(18px, 3.6vw, 56px); display: flex; justify-content: center; }
.device {
  width: 100%; max-width: 1240px; aspect-ratio: 16/10; max-height: 84vh;
  border: 1px solid var(--line); background: var(--paper); box-shadow: 0 30px 60px -40px rgba(0, 0, 0, .35);
  transition: max-width .9s var(--ease), border-radius .9s var(--ease);
}
.device[data-mode="mobile"] { max-width: 360px; aspect-ratio: 390/780; border-radius: 30px; }
.device-screen { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: inherit; }
/* drawn at a real screen size and scaled to the frame by js/product.js (bindDemo) */
.device iframe { position: absolute; left: 0; top: 0; width: 100%; height: 100%; border: 0; display: block; transform-origin: 0 0; }
.demo-placeholder { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 28px; text-align: center; }
.demo-title { font-family: var(--p-font); font-style: var(--p-style); font-weight: var(--p-weight); font-size: clamp(1.75rem, 4vw, 3rem); line-height: 1.1; }
.product .demo-placeholder p:last-child { max-width: 30ch; color: var(--soft); font-size: .9375rem; }

/* the details, set as an editorial index */
.p-index { padding-top: clamp(64px, 11vh, 130px); padding-bottom: clamp(64px, 11vh, 130px); }
.product .p-index-label { font-family: var(--font-text); font-weight: 300; font-size: .9375rem; letter-spacing: var(--track-text); color: var(--soft); margin-bottom: clamp(20px, 4vh, 40px); }
.idx { --rule: color-mix(in srgb, var(--ink) 14%, transparent); border-top: 1px solid var(--rule); }
.idx-item { border-bottom: 1px solid var(--rule); transition: border-color .6s var(--ease); }
.idx-item.is-open { border-bottom-color: color-mix(in srgb, var(--ink) 34%, transparent); }
.product .idx-head { font: inherit; }
.idx-btn {
  width: 100%; display: grid; grid-template-columns: clamp(3rem, 7vw, 6.5rem) minmax(0, 1fr) auto 13px; column-gap: clamp(14px, 2.4vw, 36px);
  align-items: baseline; padding: clamp(14px, 2.5vh, 24px) 2px; text-align: left;
}
.idx-num { font-size: .8125rem; letter-spacing: var(--track-text); color: var(--soft); font-variant-numeric: tabular-nums; }
.idx-title { font-family: var(--font-display); letter-spacing: var(--track-display); font-size: clamp(2rem, 4.3vw, 3.75rem); line-height: 1.04; transition: transform .7s var(--ease); }
.idx-sub { font-size: .9375rem; letter-spacing: var(--track-text); color: var(--soft); text-align: right; white-space: nowrap; }
.idx-btn .acc-mark { align-self: center; }
@media (hover: hover) { .idx-btn:hover .idx-title { transform: translateX(10px); } }
.acc-mark { position: relative; flex: none; width: 13px; height: 13px; }
.acc-mark::before, .acc-mark::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: currentColor; transition: transform .6s var(--ease); }
.acc-mark::after { transform: rotate(90deg); }
.acc-item.is-open .acc-mark::after { transform: rotate(0deg); }
.acc-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .65s var(--ease); }
.acc-item.is-open .acc-panel { grid-template-rows: 1fr; }
.acc-inner { min-height: 0; overflow: hidden; visibility: hidden; opacity: 0; transition: opacity .45s var(--ease), visibility 0s .65s; }
.acc-item.is-open .acc-inner { visibility: visible; opacity: 1; transition: opacity .7s var(--ease) .12s, visibility 0s; }

/* opened content: aligned under the heading, typeset for reading */
.idx-body {
  margin-left: calc(clamp(3rem, 7vw, 6.5rem) + clamp(14px, 2.4vw, 36px)); padding: 0 2px clamp(34px, 6vh, 60px);
  max-width: 60ch; display: flex; flex-direction: column; gap: 14px; font-size: 1.125rem; line-height: 1.75;
}
.product .idx-body p { max-width: none; }
.idx-body ul, .idx-body ol { display: flex; flex-direction: column; }
.idx-body li { padding: 13px 0; border-top: 1px solid var(--rule); }
.idx-body li:first-child { border-top: 0; padding-top: 0; }
.idx-body ol { counter-reset: step; }
.idx-body ol li { counter-increment: step; display: grid; grid-template-columns: 2.6em 1fr; }
.idx-body ol li::before { content: counter(step, upper-roman); font-family: var(--font-display); color: var(--soft); }
.idx-body strong { font-weight: 400; }

/* the purchase control: a link to Etsy, or a plain unavailable state */
.cta {
  display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 34px;
  background: var(--cta); color: var(--cta-text); border: 1px solid var(--cta);
  font-size: .9375rem; font-weight: 400; letter-spacing: var(--track-text); text-decoration: none; white-space: nowrap;
  transition: background .45s var(--ease), color .45s var(--ease);
}
a.cta:hover { background: transparent; color: var(--ink); border-color: var(--ink); }
.cta.is-unavailable { background: transparent; color: var(--soft); border: 1px solid var(--line); letter-spacing: var(--track-text); cursor: default; }

/* purchase block */
.p-purchase { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: clamp(80px, 14vh, 160px); padding-bottom: clamp(80px, 14vh, 160px); }
.p-purchase-kicker { font-size: .9375rem; letter-spacing: var(--track-text); color: var(--soft); margin-bottom: 18px; }
.product .p-purchase h2 { font-family: var(--p-font); font-style: var(--p-style); font-weight: var(--p-weight); letter-spacing: var(--p-tracking); font-size: clamp(3.25rem, 8vw, 7rem); line-height: 1; }
.product .p-purchase-line { font-family: var(--font-display); letter-spacing: var(--track-display); font-size: clamp(1.125rem, 1.4vw, 1.3125rem); line-height: 1.55; max-width: 34ch; margin-top: 26px; text-wrap: balance; }
.p-purchase-price { margin-top: 14px; letter-spacing: var(--track-text); }
.p-purchase .cta-main { margin-top: clamp(36px, 6vh, 52px); }
.cta svg { flex: none; width: 13px; height: 13px; margin-left: 12px; fill: none; stroke: currentColor; stroke-width: 1.2; transition: transform .45s var(--ease); }
a.cta:hover svg { transform: translate(2px, -2px); }
.cta-main { min-height: 64px; min-width: min(100%, 380px); padding: 0 48px; font-size: 1rem; letter-spacing: var(--track-text); }
.p-purchase .fine { margin-top: 18px; }

/* onward */
.p-next { display: inline-flex; flex-direction: column; gap: 4px; text-decoration: none; }
.p-next span { font-size: .9375rem; color: var(--soft); }
.p-next strong { font-family: var(--font-display); letter-spacing: var(--track-display); font-weight: 400; font-size: clamp(2.5rem, 6vw, 5rem); line-height: 1; }
.p-next:hover strong { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .12em; }

/* footer (collection pages only): a quiet close, not another hero */
.p-foot { border-top: 1px solid var(--line); padding: clamp(36px, 6vh, 64px) var(--gutter) clamp(22px, 4vh, 36px); display: flex; flex-direction: column; gap: clamp(22px, 4vh, 36px); }
.p-foot-script { font-size: clamp(2rem, 3vw, 2.75rem); color: var(--ink); align-self: flex-start; }
.product .p-foot-script { max-width: none; }
.p-foot-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 48px; }
.p-foot-brand { display: flex; flex-direction: column; gap: 4px; }
.p-foot-brand a { font-family: var(--font-display); letter-spacing: var(--track-display); font-size: 1.375rem; text-decoration: none; }
.p-foot-brand img { width: auto; }
.p-foot-brand p { font-size: .875rem; color: var(--soft); letter-spacing: var(--track-text); }
.p-foot-links { display: flex; flex-wrap: wrap; gap: 4px 30px; font-size: .9375rem; }
.p-foot-links a { text-decoration: none; padding: 8px 0; }
.p-foot-links a:hover { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.product .p-foot-legal { font-size: .8125rem; color: var(--soft); letter-spacing: var(--track-text); padding-top: 18px; border-top: 1px solid var(--line); max-width: none; }

/* sticky purchase: a slim bar on wide screens, a full-width control on phones.
   Shown after the hero, hidden while the purchase block is on screen (product.js). */
.p-sticky {
  /* fixed, so it never takes up space or extends the page when hidden; it stops short of the scrollbar */
  position: fixed; left: 0; right: var(--sb, 0px); bottom: 0; z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 9px var(--gutter) max(9px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 95%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  transform: translateY(105%); visibility: hidden; transition: transform .65s var(--ease), visibility 0s .65s;
}
.p-sticky.is-shown { transform: none; visibility: visible; transition: transform .65s var(--ease), visibility 0s; }
.p-sticky-name { display: flex; align-items: baseline; gap: 14px; font-family: var(--p-font); font-style: var(--p-style); font-weight: var(--p-weight); font-size: 1.5rem; line-height: 1.1; }
.p-sticky-name small { font-family: var(--font-text); font-style: normal; font-weight: 300; font-size: .9375rem; color: var(--soft); }
.p-sticky .cta { min-height: 44px; }

@media (max-width: 860px) {
  .p-bar-name { display: none; }
  .cta-main { width: 100%; }
  .device[data-mode="desktop"] { aspect-ratio: 4/3; }
}
@media (max-width: 640px) {
  .idx-btn { grid-template-columns: 2.4rem minmax(0, 1fr) 13px; row-gap: 6px; padding: clamp(14px, 2.5vh, 24px) 2px; }
  .idx-sub { grid-column: 2; grid-row: 2; text-align: left; white-space: normal; }
  .idx-btn .acc-mark { grid-column: 3; grid-row: 1; }
  .idx-body { margin-left: 0; font-size: 1.0625rem; }
  .p-sticky { padding: 10px 16px max(10px, env(safe-area-inset-bottom)); }
  .p-sticky-name { display: none; }
  .p-sticky .cta { width: 100%; min-height: 54px; font-size: 1rem; }
  .p-foot-row { flex-direction: column; align-items: flex-start; }
  .p-foot-links { gap: 0 28px; }
  .p-foot-links a { padding: 13px 0; }
  .demo-stage { padding: 14px; }
  .demo-bar { padding: 4px 14px; }
  .designs { grid-template-columns: 1fr; }
}

/* arriving from the gallery: the page and its title come in behind the travelling preview */
@keyframes dp-title-in { from { opacity: 0; transform: translateX(-50%) translateY(.14em); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes dp-fade-in { from { opacity: 0; } to { opacity: 1; } }
.product.is-entering .is-driven .hero-title { animation: dp-title-in calc(1s * var(--flight-k, 1)) var(--ease) calc(.28s * var(--flight-k, 1)) both; }
.product.is-entering .hero-kicker, .product.is-entering .p-bar { animation: dp-fade-in calc(.8s * var(--flight-k, 1)) var(--ease) calc(.45s * var(--flight-k, 1)) both; }
