/* Shared base for the industry demo pages (852l.ink/demo/<id>/). Each page sets its own look
   with CSS variables and its own <style>; this file holds what they all share: the reset, the
   motion system, and the "this is a demo" bar and sheet. No JavaScript: the pages are served with
   script-src 'none', so every interaction is CSS (:target, :checked, :has, scroll-snap). */

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --page-w: 460px;
  --gutter: 20px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The page is a single column, like a real 852Link page; on wide screens it stays phone-width
   and the hero becomes a rounded panel instead of bleeding to the edges. */
.page { width: 100%; max-width: var(--page-w); margin: 0 auto; padding-bottom: 112px; }
.pad { padding-left: var(--gutter); padding-right: var(--gutter); }
@media (min-width: 560px) {
  .page { padding-top: 28px; }
  .bleed { border-radius: 24px; overflow: clip; }
}

/* Motion ---------------------------------------------------------------------------------------
   Entrance (once per visit, so it can afford a little delight): fade and rise, staggered 60ms.
   Below the fold, blocks reveal as they scroll in, where the browser supports scroll timelines;
   elsewhere they are simply there. */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade { from { opacity: 0; } }

.rv { animation: rise 700ms var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 60ms + 80ms); }

@supports (animation-timeline: view()) {
  .sv {
    animation: rise var(--ease-out) both;
    animation-timeline: view();
    animation-range: entry 0% entry 55%;
  }
}

/* Count-up for whole numbers: <span class="count" style="--to: 240" aria-hidden="true"></span>
   next to a .sr copy of the number for screen readers. Browsers without @property show the final
   number after a moment. */
@property --n { syntax: "<integer>"; inherits: false; initial-value: 0; }
@keyframes count { from { --n: 0; } to { --n: var(--to); } }
.count { --n: var(--to); counter-reset: n var(--n); animation: count 1400ms var(--ease-out) 300ms backwards; }
.count::after { content: counter(n); }

/* Anything pressable confirms the press; large cards press more lightly (--press: 0.985). */
.press { transition: transform 160ms var(--ease-out), background-color 200ms ease, box-shadow 200ms ease; }
.press:active { transform: scale(var(--press, 0.97)); }

/* Demo chrome -----------------------------------------------------------------------------------
   A slim bar pinned to the bottom leads back to the landing page, says what this is and links to
   how to get 852Link. Every in-page link
   opens #demo, a sheet that explains what that button would do on a real page. */
.demo-bar {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border-radius: 999px;
  background: rgba(14, 14, 14, 0.86);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  color: #EDEDED;
  font: 500 13px/1.2 "Inter", ui-sans-serif, system-ui, sans-serif;
  transform: translateX(-50%);
  animation: bar-in 600ms var(--ease-out) 1.2s backwards;
}
@keyframes bar-in { from { opacity: 0; transform: translate(-50%, 16px); } }
.demo-bar b { font-weight: 600; color: #FFFFFF; white-space: nowrap; }
@media (max-width: 359px) { .demo-bar b { display: none; } } /* room for both buttons on the smallest phones */
/* Inside the landing page's phones (src="…/#embed") the bar is left out: the phone frame already
   says it's a demo, and the page should look like the real thing. */
:root:has(#embed:target) .demo-bar { display: none; }
:root:has(#embed:target) .page { padding-bottom: 28px; }
.demo-bar a {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 600;
}
.demo-bar .back { padding-left: 10px; background: rgba(255, 255, 255, 0.1); color: #FFFFFF; }
.demo-bar .get { background: #E8FF5A; color: #0A0B0B; }
@media (hover: hover) and (pointer: fine) { .demo-bar .back:hover { background: rgba(255, 255, 255, 0.16); } }

.sheet { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; justify-items: center; visibility: hidden; transition: visibility 0s linear 220ms; }
.sheet:target { visibility: visible; transition: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); opacity: 0; transition: opacity 220ms ease; }
.sheet:target .sheet-backdrop { opacity: 1; transition-duration: 320ms; }
.sheet-card {
  position: relative;
  width: min(100%, var(--page-w));
  padding: 10px 22px max(22px, env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: #FFFFFF;
  color: #121212;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  transform: translateY(100%);
  transition: transform 220ms var(--ease-out);
}
.sheet:target .sheet-card { transform: none; transition: transform 420ms var(--ease-drawer); }
.sheet-grab { width: 36px; height: 5px; margin: 0 auto 18px; border-radius: 99px; background: #DADADA; }
.sheet-card h2 { font-size: 21px; line-height: 1.2; font-weight: 650; letter-spacing: -0.015em; }
.sheet-card p { margin-top: 8px; color: #585858; font-size: 15px; line-height: 1.5; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.sheet-actions a { display: flex; align-items: center; justify-content: center; min-height: 50px; border-radius: 14px; font-weight: 600; }
.sheet-actions .primary { background: #121212; color: #FFFFFF; }
.sheet-actions .secondary { background: #F1F1F1; color: #121212; }
@media (min-width: 560px) {
  .sheet { align-items: center; }
  .sheet-card { width: 400px; padding: 26px; border-radius: 22px; opacity: 0; transform: scale(0.96); transition: transform 180ms var(--ease-out), opacity 180ms ease; }
  .sheet:target .sheet-card { opacity: 1; transform: none; transition: transform 260ms var(--ease-out), opacity 200ms ease; }
  .sheet-grab { display: none; }
}

.demo-foot { margin-top: 40px; text-align: center; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.demo-foot a { text-decoration: underline; text-underline-offset: 2px; }

/* Reduced motion: keep short fades that help follow what changed; drop everything that moves.
   Pages mark decorative motion with .motion (the element itself) or .motion-fx (its ::before/::after). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv, .sv { animation: fade 400ms ease backwards !important; animation-timeline: auto !important; }
  .motion, .motion-fx::before, .motion-fx::after, .count { animation: none !important; }
  .press:active { transform: none; }
  .demo-bar { animation: fade 400ms ease 1.2s backwards; }
  .sheet-card, .sheet:target .sheet-card { transform: none; opacity: 0; transition: opacity 200ms ease; }
  .sheet:target .sheet-card { opacity: 1; }
}
