/*!
 * Stage Menu styles · by Eva Akselrad · Ownstage Event Solutions
 * Theme it by overriding the --sm-* variables on :root (see README).
 */
:root {
  /* Defaults match Ownstage (ownstage.app). Override any of these to fit another brand. */
  --sm-backdrop: #0e0c0a;        /* what you see behind the tilted page */
  --sm-page-bg: #f7f3eb;         /* page background while tilted (set to your site's background) */
  --sm-text: #f7f3eb;            /* menu link colour */
  --sm-muted: rgba(247, 243, 235, 0.7); /* menu footer text */
  --sm-accent: #ffd56a;          /* underline, current page, hover rings */
  --sm-line: rgba(247, 243, 235, 0.2);
  --sm-font: 'Syne', system-ui, sans-serif;
  --sm-font-weight: 700;
  --sm-tracking: -0.03em;
  --sm-font-size: clamp(1.6rem, 3.4vw, 2.5rem);
  --sm-menu-w: min(440px, 46vw); /* menu panel width */
  --sm-shift: calc(var(--sm-menu-w) * -1.05);
  --sm-depth: -500px;            /* how far back the page goes */
  --sm-tilt: 18deg;              /* how much it swings */
  --sm-radius: 14px;
  --sm-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  --sm-duration: 0.6s;           /* keep in sync with the `duration` option */
  --sm-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
@media (max-width: 700px) {
  :root { --sm-menu-w: 68vw; --sm-shift: calc(var(--sm-menu-w) * -0.95); --sm-depth: -420px; --sm-tilt: 24deg; }
}

/* ---------- Stage: normal page flow until the menu opens or a page changes over ---------- */
.sm-stage { position: relative; }
html.sm-lock, html.sm-nav { overflow: hidden; background: var(--sm-backdrop); }
html.sm-lock body, html.sm-nav body { overflow: hidden; height: 100vh; background: var(--sm-backdrop); }
.sm-lock .sm-persp, .sm-nav .sm-persp { position: fixed; inset: 0; perspective: 1600px; overflow: hidden; z-index: 1; }
.sm-lock .sm-stage, .sm-nav .sm-stage {
  position: absolute; left: 0; right: 0; min-height: 100vh;
  transform-origin: 50% var(--sm-origin-y, 50vh);
  transition: transform var(--sm-duration) var(--sm-ease), border-radius var(--sm-duration), box-shadow var(--sm-duration), opacity 0.5s;
  background: var(--sm-page-bg); will-change: transform;
}
/* Sticky headers can't stick inside a frozen page; let them sit in place. */
.sm-lock .sm-stage [data-sm-sticky], .sm-nav .sm-stage [data-sm-sticky] { position: relative !important; }

/* Open: the page swings back and left */
.sm-open .sm-stage {
  transform: translateX(var(--sm-shift)) translateZ(var(--sm-depth)) rotateY(var(--sm-tilt)) translateY(var(--sm-fly, 0px));
  border-radius: var(--sm-radius); box-shadow: var(--sm-shadow); cursor: pointer; overflow: hidden;
}
.sm-open .sm-stage::after { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.15); pointer-events: none; }

/* From the menu: the next page flies up into the tilted slot, the old one is pushed away */
.sm-open .sm-stage.is-flying { transition: transform 0.82s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s; }
.sm-open .sm-stage.is-entering { --sm-fly: 115vh; transition: none; }
.sm-open .sm-stage.is-leaving { --sm-fly: -38vh; opacity: 0; transition: transform 0.75s cubic-bezier(0.5, 0, 0.2, 1), opacity 0.5s ease 0.15s; }

/* Ordinary links: card stack. New page slides up over the old one; Back drops the top card away. */
.sm-nav .sm-stage { transform: translateY(var(--sm-fly, 0px)) scale(var(--sm-scale, 1)); transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), border-radius 0.7s; overflow: hidden; }
.sm-nav .sm-stage::after { content: ''; position: absolute; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity 0.7s; pointer-events: none; }
.sm-nav .sm-stage:last-child { box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.35); }
.sm-nav .sm-stage.is-entering { --sm-fly: 100vh; transition: none; border-radius: 24px 24px 0 0; }
.sm-nav .sm-stage.is-leaving { --sm-scale: 0.93; --sm-fly: -2vh; border-radius: 20px; }
.sm-nav .sm-stage.is-under { --sm-scale: 0.93; transition: none; border-radius: 20px; }
.sm-nav .sm-stage.is-leaving::after, .sm-nav .sm-stage.is-under::after { opacity: 1; }
.sm-nav .sm-stage.is-under::after { transition: none; }
.sm-nav .sm-stage.is-dropping { --sm-fly: 100vh; border-radius: 24px 24px 0 0; transition: transform 0.65s cubic-bezier(0.55, 0, 0.75, 0.2); }
.sm-busy a { cursor: progress; }

/* ---------- Menu panel ---------- */
.sm-menu {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 2; width: var(--sm-menu-w);
  display: flex; flex-direction: column; justify-content: center; padding: 60px 48px;
  color: var(--sm-text);
  background: linear-gradient(90deg, transparent 0, color-mix(in srgb, var(--sm-backdrop) 92%, transparent) 48px);
  visibility: hidden; pointer-events: none; opacity: 0; transition: opacity 0.28s ease;
}
html:not(.sm-ready) .sm-menu { display: none; }
.sm-lock .sm-menu { visibility: visible; }
.sm-open .sm-menu { opacity: 1; pointer-events: auto; transition-duration: 0.2s; }
@media (max-width: 700px) { .sm-menu { padding: 60px 24px; } }

.sm-links { list-style: none; margin: 0 0 40px; padding: 0; }
.sm-links li { opacity: 0; transform: translateX(60px); transition: opacity 0.35s, transform 0.5s var(--sm-ease); }
.sm-open .sm-links li { opacity: 1; transform: none; transition-delay: calc(0.18s + var(--i, 0) * 0.045s); }
.sm-links a { position: relative; display: inline-block; padding: 4px 0; font: var(--sm-font-weight) var(--sm-font-size)/1.2 var(--sm-font); letter-spacing: var(--sm-tracking); color: var(--sm-text); text-decoration: none; }
.sm-links a::after { content: ''; position: absolute; left: 0; bottom: 4px; width: 100%; height: 2px; background: var(--sm-accent); transform: scaleX(0); transform-origin: left; transition: transform 0.3s; }
.sm-links a:hover::after, .sm-links a:focus-visible::after, .sm-links a[aria-current]::after { transform: scaleX(1); }
.sm-links a[aria-current] { color: var(--sm-accent); }
.sm-links a:focus-visible { outline: 2px solid var(--sm-accent); outline-offset: 4px; }

.sm-foot { display: grid; gap: 4px; font-size: 0.95rem; opacity: 0; transition: opacity 0.4s; }
.sm-open .sm-foot { opacity: 1; transition-delay: 0.55s; }
.sm-foot a { color: var(--sm-muted); text-decoration: none; }
.sm-foot a:hover { color: var(--sm-text); }
.sm-label { margin: 0 0 6px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sm-accent); }

/* ---------- Buttons (optional: use your own and keep the data attributes) ---------- */
.sm-toggle { width: 44px; height: 44px; display: inline-grid; place-content: center; gap: 5px; padding: 0; background: none; border: 1px solid var(--sm-line); border-radius: 50%; cursor: pointer; transition: border-color 0.2s, transform 0.3s; }
.sm-toggle:hover { border-color: var(--sm-accent); transform: rotate(90deg); }
.sm-toggle span { display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.sm-toggle span:nth-child(2) { width: 12px; justify-self: end; }

.sm-close { position: absolute; top: 24px; right: 24px; width: 48px; height: 48px; padding: 0; border-radius: 50%; border: 1px solid var(--sm-line); background: none; cursor: pointer; opacity: 0; transition: opacity 0.3s, transform 0.3s, border-color 0.2s; }
.sm-open .sm-close { opacity: 1; transition-delay: 0.3s; }
.sm-close:hover { border-color: var(--sm-accent); transform: rotate(90deg); }
.sm-close span { position: absolute; left: 14px; top: 22px; width: 18px; height: 2px; background: var(--sm-text); }
.sm-close span:first-child { transform: rotate(45deg); }
.sm-close span:last-child { transform: rotate(-45deg); }

.sm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .sm-stage, .sm-menu, .sm-links li, .sm-foot, .sm-close { transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .sm-open .sm-stage { transform: translateX(var(--sm-shift)); }
}
