:root {
  --ease-enter: cubic-bezier(.22, 1, .36, 1);
  --ease-reveal: cubic-bezier(.2, .72, .24, 1);
  --ease-change: cubic-bezier(.4, 0, .2, 1);
  --motion-quick: 180ms;
  --motion-change: 440ms;
  --motion-panel: 560ms;
  --motion-enter: 860ms;
}

.hero-section {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  overflow: clip;
}

.hero-title { display: grid; line-height: 40px; }
.hero-title-line {
  display: block;
  overflow: hidden;
  /* Preserve the original line spacing and leave room for descenders. */
  padding-block: .16em;
  margin-block: -.16em;
}
.hero-title-line > span { display: block; }

.hero-animation {
  position: relative;
  width: 300px;
  max-width: 100%;
  height: 300px;
}

.hero-glow {
  position: absolute;
  width: 300px;
  max-width: 100%;
  height: 300px;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent 12%, black 26%);
}

.hero-glow img { width: 100%; height: 100%; object-fit: contain; }

.portal-preview {
  display: grid;
  aspect-ratio: 1402 / 1012;
  overflow: hidden;
  border-radius: 10px;
}

.portal-preview img {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  opacity: 0;
  visibility: hidden;
}

.portal-preview img[aria-hidden="false"] { opacity: 1; visibility: visible; }

.portal-control + .portal-control { margin-top: 1.5rem; }
.portal-control,
.portal-card { border-radius: 12px; }
.portal-card { position: relative; }
.portal-card::before {
  content: "";
  position: absolute;
  inset: 23% auto 23% 0;
  width: 3px;
  border-radius: 999px;
  background: #8222fd;
  opacity: 0;
}
.portal-control[aria-selected="true"] .portal-card::before { opacity: 1; }
.portal-control[aria-selected="true"] .portal-card {
  box-shadow: 0 7px 20px rgb(64 0 146 / .09), 0 1px 3px rgb(64 0 146 / .08);
}

.portal-icon { display: grid; }
.portal-icon img { grid-area: 1 / 1; }
.portal-icon img:last-child,
.portal-control[aria-selected="true"] .portal-icon img:first-child { opacity: 0; }
.portal-control[aria-selected="true"] .portal-icon img:last-child { opacity: 1; }

.portal-title { color: #400092; }
.portal-control[aria-selected="true"] .portal-title { color: #8222fd; margin-top: -.25rem; }
.portal-description { display: grid; grid-template-rows: 0fr; opacity: 0; }
.portal-description > p { min-height: 0; overflow: hidden; }
.portal-control[aria-selected="true"] .portal-description { grid-template-rows: 1fr; opacity: 1; }

.carousel-window { overflow: hidden; touch-action: pan-y pinch-zoom; }
.carousel-track { display: grid; }
.carousel-slide {
  grid-area: 1 / 1;
  min-width: 0;
  align-self: start;
  opacity: 0;
  visibility: hidden;
}
.carousel-slide[data-slide="active"] { opacity: 1; visibility: visible; }

.carousel-dots {
  display: flex;
  justify-content: center;
  margin: 0;
  padding: .4375rem 0;
  list-style: none;
}

.carousel-dot {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  cursor: pointer;
}

.carousel-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9183a3;
}
.carousel-dot[aria-selected="true"]::before { width: 16px; background: #8222fd; }

.carousel-dot:focus-visible {
  outline: 2px solid #8222fd;
  outline-offset: -1px;
}

.contact-submit { background-color: #ffba00; color: #490096; }

@media (max-width: 767px) {
  .portal-body {
    --portal-preview-width: min(100vw - 48px, 50svh);
    display: block;
  }
  .portal-artwork {
    position: sticky;
    inset-block-start: 0;
    z-index: 1;
    padding-block: 8px;
    background-color: #f9f4ff;
  }
  .portal-preview { width: var(--portal-preview-width); margin-inline: auto; }
  .portal-controls { margin-top: 2rem; }
  .portal-control { scroll-margin-block-start: calc(var(--portal-preview-width) * .722 + 24px); }
}

@media (max-width: 374px) {
  .site-header > .container, .hero-section > .container { padding-inline: 16px; }
  .site-header img { width: clamp(64px, 30vw, 104px); }
  .site-header a:not(.motion-logo) { padding-inline: 10px; font-size: .875rem; }
  .hero-section .hero-intro { margin-block: 12px; }
  .hero-section .hero-title { font-size: clamp(1.6875rem, 9vw, 2.25rem); line-height: 1.14; }
  .hero-section .hero-description { padding-inline: 0; font-size: .9375rem; }
  .hero-animation, .hero-glow { height: min(300px, 100vw - 32px); }
  .portal-control .portal-card { padding: 1rem; }
  .portal-control .portal-icon { margin-inline-end: .75rem; }
}

@media (min-width: 768px) {
  .hero-animation { width: 400px; height: 400px; }
  .hero-glow { width: 500px; height: 500px; }
}

@media (hover: hover) and (pointer: fine) {
  .motion-link:hover { text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: .25em; }
  .motion-button.bg-bright-purple:hover { background-color: #6d16de; }
  .motion-button.bg-yellow-purple:hover, .contact-submit:hover { background-color: #ffca29; }
  .portal-control:hover .portal-card { box-shadow: 0 5px 18px rgb(64 0 146 / .09); }
  .carousel-dot:hover::before { background-color: #8222fd; }
  .integration-link:hover { text-underline-offset: .25em; }
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  ::view-transition-group(root) { animation-duration: 420ms; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-timing-function: var(--ease-change); }

  html { scroll-behavior: smooth; }

  @keyframes content-enter {
    from {
      opacity: var(--entry-opacity, .12);
      transform: translate(var(--entry-x, 0px), var(--entry-y, 30px)) scale(var(--entry-scale, 1));
    }
    to { opacity: 1; transform: none; }
  }

  [data-entrance] {
    animation: content-enter var(--entry-duration, var(--motion-enter)) var(--ease-reveal) var(--entry-delay, 0ms) backwards;
  }

  @keyframes hero-title-enter {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: none; }
  }

  .hero-title-line > span { animation: hero-title-enter 960ms var(--ease-reveal) 90ms backwards; }
  .hero-title-line + .hero-title-line > span { animation-delay: 220ms; }

  [data-entrance="header"] { --entry-opacity: .6; --entry-y: -12px; --entry-duration: 640ms; }
  [data-entrance="hero-copy"] { --entry-opacity: .25; --entry-delay: 330ms; }
  [data-entrance="hero-action"] { --entry-opacity: .32; --entry-y: 22px; --entry-delay: 440ms; }
  [data-entrance="hero-art"] { --entry-scale: .9; --entry-y: 36px; --entry-delay: 190ms; --entry-duration: 1s; }
  [data-entrance="page"] { --entry-opacity: .25; --entry-y: 24px; --entry-duration: 660ms; }
  [data-entrance="form-status"] { --entry-y: 8px; --entry-duration: var(--motion-change); }

  [data-reveal-state="pending"] {
    opacity: var(--reveal-opacity, 0);
    transform: translate(var(--entry-x, 0px), var(--entry-y, 30px)) scale(var(--entry-scale, 1));
  }

  [data-reveal-state="visible"] {
    animation: content-enter var(--motion-enter) var(--ease-reveal) var(--entry-delay, 0ms) backwards;
    --entry-opacity: var(--reveal-opacity, 0);
  }

  [data-reveal="visual"] { --entry-y: 38px; --entry-scale: .95; }
  [data-reveal="background"] { --entry-y: 0px; --reveal-opacity: .45; }

  @supports (animation-timeline: view()) {
    @keyframes artwork-drift {
      from { translate: 0 var(--art-offset, 18px); }
      to { translate: 0 calc(-1 * var(--art-offset, 18px)); }
    }

    [data-scroll-art] {
      animation: artwork-drift 1ms linear both;
      animation-timeline: view();
    }

    .hero-art { --art-offset: 24px; }
  }

  .motion-link {
    text-decoration-line: underline;
    text-decoration-color: transparent;
    text-underline-offset: .35em;
    transition: text-decoration-color var(--motion-quick), text-underline-offset var(--motion-quick);
  }
  .integration-link { text-underline-offset: .12em; transition: text-underline-offset var(--motion-quick); }

  .motion-button {
    transition: background-color var(--motion-quick), box-shadow var(--motion-quick),
      background-position var(--motion-panel) var(--ease-reveal);
    background-image: linear-gradient(108deg, transparent 37%, rgb(255 255 255 / .28) 50%, transparent 63%);
    background-size: 290% 100%;
    background-position: 100% 0;
    background-repeat: no-repeat;
  }
  .motion-button:focus-visible { background-position: 0 0; }

  .motion-logo img, .store-badge img, .feature-card img {
    transition: opacity var(--motion-quick), transform var(--motion-change) var(--ease-enter);
  }

  .feature-card .shadow, .pricing-card {
    transition: box-shadow var(--motion-change) var(--ease-enter), border-color var(--motion-change);
  }

  .portal-preview img {
    transform: translateX(min(10%, 48px)) scale(.96);
    transition: opacity var(--motion-change) var(--ease-change),
      transform var(--motion-panel) var(--ease-reveal), visibility 0s var(--motion-change);
  }
  .portal-preview img[data-preview="before"] { transform: translateX(max(-10%, -48px)) scale(.96); }
  .portal-preview img[data-preview="active"] { transform: none; transition-delay: 0s; }
  .portal-card { transition: box-shadow var(--motion-change) var(--ease-enter); }
  .portal-card::before {
    transform: scaleY(.25);
    transition: opacity var(--motion-quick), transform var(--motion-change) var(--ease-reveal);
  }
  .portal-control[aria-selected="true"] .portal-card::before { transform: none; }
  .portal-icon img { transition: opacity var(--motion-quick); }
  .portal-title { transition: color var(--motion-quick), margin-top var(--motion-change) var(--ease-enter); }
  .portal-description {
    transition: grid-template-rows var(--motion-change) var(--ease-enter), opacity var(--motion-quick) var(--ease-change);
  }
  .portal-control[aria-selected="true"] .portal-description { transition-delay: 0s, 70ms; }

  .carousel-slide {
    transform: translateX(min(16%, 96px));
    transition: opacity var(--motion-change) var(--ease-change),
      transform var(--motion-panel) var(--ease-reveal), visibility 0s var(--motion-change);
  }
  .carousel-slide[data-slide="before"] { transform: translateX(max(-16%, -96px)); }
  .carousel-slide[data-slide="active"] { transform: none; transition-delay: 0s; }
  .carousel-dot::before {
    transition: width var(--motion-change) var(--ease-enter), background-color var(--motion-quick);
  }

  .contact-field { transition: box-shadow var(--motion-quick); }
  .contact-field:focus { box-shadow: 0 0 0 5px rgb(130 34 253 / .08); }
}

@media (prefers-reduced-motion: no-preference) and (min-width: 768px) {
  [data-reveal] { --entry-y: 44px; }
  [data-reveal="visual"] { --entry-y: 48px; }
  [data-reveal="background"] { --entry-y: 0px; }
  [data-reveal-step="1"] { --entry-delay: 105ms; }
  [data-reveal-step="2"] { --entry-delay: 210ms; }
  [data-reveal-step="3"] { --entry-delay: 315ms; }
  [data-reveal-side="left"] { --entry-x: -20px; }
  [data-reveal-side="right"] { --entry-x: 20px; }
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  .motion-button:hover { box-shadow: 0 8px 20px rgb(48 32 93 / .2); background-position: 0 0; }
  .motion-button:active { box-shadow: none; }
  .motion-logo:hover img { opacity: 1; }
  .store-badge:hover img { opacity: .88; }
  .feature-card:hover img { transform: translateY(-9px) scale(1.035); }
  .feature-card:hover .shadow, .pricing-card:hover { box-shadow: 0 12px 34px rgb(64 0 146 / .09); }
  .pricing-card:hover { border-color: #c9a4fb; }
}
