/* ==========================================================================
   The top of every page (nav) and the homepage opening (hero + price strip).
   Structure: Vesper v04. Spacing, type and the hero composition were reset
   in the Impeccable pass (see DESIGN.md): one container, one left edge,
   AWARE as a true cut-out standing clear of the Clip panel.
   ========================================================================== */

.opening-nav, .opening-scene, .opening-offers {
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
}

/* one container for nav, hero and strip: the same edges as .measure below */
.opening-nav-inner, .opening-composition, .opening-offers-inner {
  width: 100%;
  max-width: 1520px;
  margin-inline: auto;
  padding-inline: max(var(--pad), env(safe-area-inset-left)) max(var(--pad), env(safe-area-inset-right));
}

/* ---------- nav ---------- */
.opening-nav {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--rule);
}
.opening-nav-inner {
  min-height: 72px;
  padding-block: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 clamp(20px, 2.4vw, 40px);
}
.company-ink, .product-ink {
  position: relative;
  display: block;
  overflow: hidden;
}
/* Only the transparent margins lie outside these boxes. The full source
   files are drawn at their own aspect ratios, with no colour treatment. */
.company-ink {
  flex: none;
  width: clamp(112px, 10.4vw, 150px);
  aspect-ratio: 1407 / 576;
  border-radius: 4px;
}
.company-ink img, .product-ink img {
  display: block;
  max-width: none;
  height: auto;
  position: absolute;
  pointer-events: none;
}
.company-ink img {
  width: 120.82445%;
  left: -11.22957%;
  top: -23.95833%;
}
.product-ink {
  width: clamp(160px, min(18.5vw, 24vh), 276px);
  aspect-ratio: 2033 / 554;
}
.product-ink img {
  width: 111.36252%;
  left: -7.62420%;
  top: -17.32852%;
}
.opening-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(16px, 2.3vw, 36px);
  margin-left: auto;
}
.opening-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
  font-size: 1.0625rem;
  font-weight: 500;
  transition: color var(--motion-fast) var(--ease-standard);
}
.opening-links a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* the buy button: Clip's own button, with its darker bottom edge */
.opening-buy, .button-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px 3px;
  border-radius: var(--radius-control);
  background: var(--blue-action);
  box-shadow: inset 0 -3px 0 var(--blue-edge);
  color: #fff;
  font: 800 1rem/1 var(--display);
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}
.opening-nav .opening-buy { color: #fff; }
@media (hover: hover) { .opening-buy:hover, .button-buy:hover { background: #0560ba; transform: translateY(-1px); } }
.opening-buy:active, .button-buy:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 var(--blue-edge); }
.button-buy { min-height: 56px; padding: 0 28px 4px; border-radius: var(--radius-control); box-shadow: inset 0 -4px 0 var(--blue-edge); font-size: 1.125rem; }

/* ---------- hero ---------- */
/* above the strip, so AWARE's feet come down in front of the Pro slab */
.opening-scene { position: relative; z-index: 2; overflow-x: clip; }
.opening-composition {
  /* content edge to viewport edge: how far the screen may run off to the right */
  --edge: max(var(--pad), calc((100vw - 1520px) / 2 + var(--pad)));
  display: grid;
  grid-template-columns: minmax(0, 0.98fr) minmax(0, 1.02fr);
  column-gap: var(--space-6);
  align-items: end;
  padding-top: clamp(24px, 5.4vh, 72px);
}
/* how far AWARE's feet come down onto the Pro slab; the slab's top padding matches it */
.opening-scene, .opening-offers { --stand: clamp(34px, 5vh, 62px); }
.opening-copy { position: relative; z-index: 3; min-width: 0; padding-bottom: clamp(20px, 4.4vh, 72px); }
.opening-identity { display: grid; gap: clamp(14px, 2.8vh, 32px); justify-items: start; }
.opening-copy h1 {
  /* sized by the screen's width and by its height, so a short laptop still shows the price below */
  font: 800 clamp(2.75rem, min(5.6vw, 9.2vh), 5.5rem) / 0.95 var(--display);
  letter-spacing: -0.035em;
  color: var(--ink);
  margin: 0;
  text-wrap: nowrap;
}
.opening-copy h1 span { display: block; white-space: nowrap; }
.opening-copy h1 .mark { display: inline; color: var(--accent); }
.opening-description {
  font-size: clamp(1.125rem, 1.45vw, 1.3125rem);
  line-height: 1.5;
  max-width: 27em;
  margin: clamp(14px, 2.8vh, 32px) 0 0;
  text-wrap: pretty;
}
.opening-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-6);
  margin-top: clamp(16px, 3.2vh, 32px);
}
.opening-price-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  font: 800 1.125rem/1 var(--display);
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
  transition: text-decoration-thickness var(--motion-fast) var(--ease-standard);
}
.opening-price-link:hover { text-decoration-thickness: 4px; }
.opening-price-link svg { flex: none; color: var(--accent); }
.opening-trust {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 31em;
  margin: clamp(12px, 2.4vh, 24px) 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
  text-wrap: pretty;
}
.opening-trust svg { flex: none; margin-top: 1px; color: var(--accent); }

.opening-scene-art { position: relative; align-self: stretch; min-width: 0; min-height: min(43vw, 58vh); }
/* the real Clip screen: its panel sits clear of AWARE, the window runs off the right edge */
.receipt-crop {
  --scr-w: clamp(380px, 36vw, 520px);
  position: absolute;
  z-index: 1;
  top: 3%;
  left: 39.5%;
  height: 78%;
  /* on very wide screens the whole window fits instead of running off */
  width: min(calc(var(--scr-w) * 1.217), calc(60.5% + var(--edge) + 40px));
  overflow: hidden;
  border: 1px solid var(--screen-edge);
  border-radius: var(--radius-control);
  background: #0e0e0e;
  box-shadow: var(--shadow-screen);
}
.receipt-crop img { display: block; width: calc(var(--scr-w) * 1.217); max-width: none; height: auto; }
/* AWARE: a true alpha cut-out of the canon render, standing on the Pro slab */
.paper-carrier {
  position: absolute;
  z-index: 2;
  /* anchored by his right side, so the pages always stop short of the Clip panel whatever his size */
  right: 38%;
  bottom: calc(-1 * var(--stand));
  width: min(88%, 62vh);
  max-width: none;
  height: auto;
  pointer-events: none;
}

/* ---------- the price, directly under the hero ---------- */
.opening-offers { position: relative; z-index: 1; padding-bottom: var(--section-tight); }
.opening-offers-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.76fr) minmax(0, 1.24fr);
  column-gap: var(--space-6);
  align-items: stretch;
}
.opening-offer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  justify-content: space-between;
  align-items: center;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  transition: background-color var(--motion-base) var(--ease-standard);
}
.opening-offer:first-child {
  padding: clamp(14px, 3vh, 32px) var(--space-12) clamp(14px, 3vh, 32px) 0;
  border-block: 1px solid var(--rule);
}
.opening-offer:last-child {
  padding: var(--stand) clamp(24px, 3.4vw, 48px) clamp(16px, 3vh, 36px);
  background: var(--slab);
  color: var(--slab-ink);
  border-radius: var(--radius-slab);
}
@media (hover: hover) { .opening-offer:last-child:hover { background: var(--slab-hover); } }
.opening-offer:last-child:focus-visible { outline-color: var(--slab-focus); }
.opening-offer strong, .opening-offer b {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
}
.opening-offer strong { font-size: clamp(1.75rem, min(3.6vw, 5.4vh), 3.25rem); text-wrap: balance; }
.opening-offer b { font-size: clamp(2.5rem, min(6vw, 8.6vh), 5.25rem); line-height: 0.9; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.opening-offer small { display: block; margin-top: 6px; font-size: clamp(1.0625rem, 1.45vw, 1.3125rem); line-height: 1.3; }
.opening-offer:first-child small { color: var(--muted); }
.opening-offer:last-child small { color: var(--slab-muted); }
.opening-offer:hover strong { text-decoration: underline; text-underline-offset: 0.13em; text-decoration-thickness: 2px; }

/* laptop and small desktop: AWARE steps in so he clears the copy and the Clip panel */
@media (min-width: 900px) and (max-width: 1180px) {
  .opening-description { max-width: 21em; }
  .opening-trust { max-width: 23em; }
  .paper-carrier { width: min(80%, 62vh); bottom: calc(10px - var(--stand)); }
  .opening-links { gap: 18px; }
  .opening-nav-inner { gap: 0 18px; }
  .opening-actions { column-gap: var(--space-4); }
  .button-buy { font-size: 1rem; padding-inline: 20px; }
}

/* tall screens: more air above the lockup, paid for by a slightly smaller tagline so the price stays in view */
@media (min-width: 900px) and (min-height: 860px) {
  .opening-composition { padding-top: 72px; }
  .opening-copy h1 { font-size: clamp(2.75rem, min(5.2vw, 9.2vh), 5.25rem); }
}

/* short laptop screens: tighten the stack so "Pro $19" is readable without scrolling */
@media (min-width: 900px) and (max-height: 800px) {
  .opening-composition { padding-top: 36px; }
  .opening-copy { padding-bottom: 16px; }
  .opening-copy h1 { font-size: clamp(2.75rem, min(5.6vw, 8.2vh), 5.5rem); }
  .opening-identity { gap: 10px; }
  .opening-description { margin-top: 12px; font-size: 1.0625rem; max-width: 33em; }
  .opening-actions { margin-top: 14px; }
  .opening-trust { margin-top: 8px; }
  .button-buy { min-height: 50px; }
  .opening-scene, .opening-offers { --stand: 28px; }
  .opening-offer:last-child { padding-bottom: 14px; }
}
@media (min-width: 900px) and (max-width: 1180px) and (max-height: 800px) {
  .opening-description { max-width: 24em; }
}

@media (max-width: 899px) {
  .opening-nav-inner { flex-wrap: wrap; gap: 0 16px; min-height: 0; padding-block: 10px 0; }
  .company-ink { width: 104px; }
  .opening-buy { margin-left: auto; min-height: 44px; padding-inline: 16px; font-size: 0.9375rem; }
  .opening-links { order: 3; flex: 1 0 100%; gap: 8px; justify-content: space-between; margin: 8px 0 0; border-top: 1px solid var(--rule); }
  .opening-links a { font-size: 0.9375rem; }

  .opening-composition { grid-template-columns: minmax(0, 1fr); padding-top: 32px; }
  .opening-copy { display: contents; }
  .opening-identity { order: 1; }
  .opening-scene-art { order: 2; min-height: 0; height: clamp(292px, 76vw, 560px); margin-top: var(--space-5); }
  .opening-actions { order: 3; margin-top: var(--space-8); }
  .opening-description { order: 4; margin-top: var(--space-8); max-width: 34em; }
  .opening-trust { order: 5; margin-bottom: var(--space-12); }
  .receipt-crop { --scr-w: clamp(250px, 60vw, 440px); top: 0; height: 88%; left: auto; width: var(--scr-w); right: calc(-1 * var(--pad) - 10px); }
  .paper-carrier { left: -9%; right: auto; width: clamp(220px, 57vw, 430px); bottom: -6px; }
  .product-ink { width: clamp(150px, 44vw, 230px); }

  .opening-offers-inner { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-6); }
  .opening-offer:last-child { order: -1; }
  .opening-offer:first-child { padding-right: 0; }
}

@media (max-width: 480px) {
  /* the three beats scale with the screen, so a larger text setting can never push them off it */
  .opening-copy h1 { font-size: min(2.75rem, 11.2vw); }
  .opening-buy { padding-inline: 13px; font-size: 0.875rem; }
  .opening-buy, .button-buy { white-space: normal; text-align: center; }
  .opening-actions .button-buy { width: 100%; }
}

/* ---------- the opening's one authored moment: the tagline lands in its three beats,
   AWARE arrives with the pages. Pure CSS, so nothing waits on script and nothing flashes. ---------- */
@media (prefers-reduced-motion: no-preference) {
  .opening-copy h1 .beat { animation: beat-in var(--motion-slow) var(--ease-standard) backwards; }
  .opening-copy h1 .beat:nth-child(2) { animation-delay: 130ms; }
  .opening-copy h1 .beat:nth-child(3) { animation-delay: 260ms; }
  .receipt-crop { animation: screen-in var(--motion-slow) var(--ease-standard) 100ms backwards; }
  .paper-carrier { animation: aware-in var(--motion-slow) var(--ease-standard) 280ms backwards; }
}
@keyframes beat-in { from { opacity: 0; transform: translateY(38%); } }
@keyframes screen-in { from { opacity: 0; transform: translateX(7%); } }
@keyframes aware-in { from { opacity: 0; transform: translateX(-5%); } }
