/* Chuyển động thuần CSS. Nội dung luôn hiện khi trình duyệt không hỗ trợ. */
:root {
  --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Điều khiển bằng checkbox HTML, hoạt động cả khi JavaScript bị tắt. */
.motion-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
}
.motion-control {
  position: fixed;
  z-index: 40;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 15px;
  border: 2px solid var(--ink);
  border-radius: 30px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.motion-control .icon {
  width: 14px;
  height: 14px;
}
.motion-control .motion-start {
  display: none;
}
.motion-toggle:checked + .motion-control .motion-stop {
  display: none;
}
.motion-toggle:checked + .motion-control .motion-start {
  display: inline-flex;
}
.motion-control:hover {
  background: var(--sun-soft);
}
.motion-page .site-footer {
  padding-bottom: 70px;
}

/* Sân khấu sản phẩm: ba công việc chuyển tiếp trong cùng một nhịp. */
.hero-stage {
  isolation: isolate;
  background: linear-gradient(140deg, #00c28e 0%, #00a07e 48%, #0b8590 100%);
}
.stage-atmosphere {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}
.stage-orbit {
  position: absolute;
  width: 650px;
  aspect-ratio: 1;
  top: -290px;
  right: -160px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
}
.stage-orbit::before,
.stage-orbit::after {
  content: "";
  position: absolute;
  inset: 45px;
  border: 1px dashed rgba(255, 255, 255, 0.26);
  border-radius: inherit;
}
.stage-orbit::after {
  inset: 90px;
  border-style: solid;
}
.stage-orbit i {
  position: absolute;
  top: 50%;
  left: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 7px rgba(244, 207, 106, 0.28);
}
.stage-glow {
  position: absolute;
  width: 480px;
  height: 480px;
  left: -200px;
  bottom: -150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(209, 236, 101, 0.6), rgba(209, 236, 101, 0) 70%);
}
.stage-top,
.hero-stage > .screen-frame {
  position: relative;
  z-index: 1;
}
.stage-stories {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 44px;
  width: min(100%, 840px);
  margin: 30px auto 34px;
}
.stage-stories::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 12%;
  right: 12%;
  border-top: 2px dashed rgba(255, 255, 255, 0.6);
}
.story-packet {
  position: absolute;
  left: 12%;
  top: calc(50% - 4px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 5px rgba(244, 207, 106, 0.3);
}
.story-card {
  --tilt: -3deg;
  position: relative;
  padding: 15px 18px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--sun-soft);
  box-shadow: 4px 5px 0 var(--ink);
  transform: rotate(var(--tilt));
}
.story-card.order {
  --tilt: 2deg;
  background: #ebf5b0;
}
.story-card.team {
  --tilt: -2deg;
  background: #c9275f;
  color: #fff;
}
.story-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.story-symbol {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--sun);
  color: var(--ink);
  border-radius: 10px;
}
.story-symbol .icon {
  width: 18px;
  height: 18px;
}
.order .story-symbol {
  background: var(--lime);
  color: var(--ink);
}
.team .story-symbol {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}
.story-card strong {
  display: block;
  margin: 10px 0 2px;
  font-size: 14px;
  font-weight: 600;
}
.story-card small {
  display: block;
  color: #3f524b;
  font-size: 9px;
}
.team small {
  color: #ffe9f0;
}
.story-dots {
  display: flex;
  gap: 4px;
}
.story-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--coral);
}
.story-check {
  width: 19px;
  height: 19px;
  color: var(--green);
  stroke-dasharray: 30;
  stroke-dashoffset: 0;
}
.story-avatars {
  display: flex;
  padding-left: 6px;
}
.story-avatars i {
  width: 15px;
  height: 15px;
  margin-left: -5px;
  border-radius: 50%;
  border: 2px solid #c9275f;
  background: #ffd3bf;
}
.story-avatars i:nth-child(2) {
  background: #dceba1;
}
.story-avatars i:nth-child(3) {
  background: #a9cbb8;
}
.stage-legend {
  position: absolute;
  right: 0;
  bottom: -23px;
  color: #fff;
  background: rgba(5, 58, 47, 0.7);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: 0.06em;
}

/* Dải chữ chuyển động, nội dung trang vẫn đọc được bên ngoài dải này. */
.rhythm-strip {
  position: relative;
  overflow: hidden;
  padding: 20px 0;
  margin-top: 46px;
  background: var(--lime);
  border-block: 3px solid var(--ink);
  color: var(--ink);
  outline-offset: -5px;
}
.rhythm-strip:focus-visible {
  outline: 3px solid var(--coral);
}
.rhythm-track {
  display: flex;
  width: max-content;
}
.rhythm-group {
  display: flex;
  align-items: center;
  flex: none;
  gap: 36px;
  padding-right: 36px;
}
.rhythm-group span {
  font-size: clamp(22px, 3vw, 38px);
  font-weight: 800;
  letter-spacing: -0.045em;
  white-space: nowrap;
}
.rhythm-group b {
  color: var(--coral-ink);
  font-size: 27px;
  font-weight: 700;
}
.rhythm-group .rhythm-outline {
  color: var(--violet);
}

/* Các điểm chạm: chuyển động phản hồi, không làm xê dịch bố cục. */
.motion-page .button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition:
    transform 0.25s var(--motion-ease),
    background 0.25s,
    box-shadow 0.25s;
}
.motion-page .button::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgba(255, 255, 255, 0.45);
  transform: translateX(-110%) skewX(-18deg);
  transition: transform 0.65s var(--motion-ease);
}
.motion-page .button:is(:hover, :focus-visible)::before {
  transform: translateX(0) skewX(-18deg) scaleX(1.3);
}
.motion-page .desktop-nav a {
  position: relative;
}
.motion-page .desktop-nav a::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 0;
  right: 0;
  height: 0;
  background: none;
}
.motion-page .feature-card,
.motion-page .channel-card,
.motion-page .security-item {
  position: relative;
  transition:
    transform 0.25s,
    background 0.3s,
    box-shadow 0.25s,
    border-color 0.3s;
}
.motion-page .feature-icon,
.motion-page .brand img,
.motion-page .channel-word b {
  transition:
    transform 0.5s var(--motion-ease),
    border-radius 0.4s;
}
.motion-page .product-visual .screen-frame,
.motion-page .hero-stage > .screen-frame {
  transform-origin: center bottom;
  transition:
    transform 0.8s var(--motion-ease),
    box-shadow 0.8s;
}
.journey-item {
  position: relative;
}
.motion-page .journey-item::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--coral);
  transform: scaleX(0);
  transform-origin: left;
}
.motion-page .flow-board {
  position: relative;
  background: rgba(255, 255, 255, 0.06);
}
.motion-page .flow-node {
  position: relative;
}
.motion-page .flow-node::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 2px solid var(--lime);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
}
.motion-page .flow-connector {
  position: relative;
  height: 44px;
}
.motion-page .flow-connector::after {
  content: "";
  position: absolute;
  left: calc(50% - 3px);
  top: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  opacity: 0;
  box-shadow: 0 0 0 4px #dceba115;
}
.motion-page .cta-panel,
.motion-page .about-mark {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.motion-page .cta-panel::before,
.motion-page .about-mark::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 420px;
  height: 420px;
  right: -160px;
  top: -260px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 38%;
  box-shadow:
    0 0 0 36px rgba(255, 255, 255, 0.07),
    0 0 0 72px rgba(255, 255, 255, 0.05);
  pointer-events: none;
}
.motion-page .about-mark::before {
  top: -190px;
  right: -190px;
  border-color: rgba(10, 46, 39, 0.22);
}
.motion-page .faq summary::after {
  transition: transform 0.3s var(--motion-ease);
}
.motion-page .faq summary:hover::after {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: no-preference) {
  .motion-page .hero-heading .eyebrow,
  .motion-page .page-hero .eyebrow {
    animation: rise-in 0.8s var(--motion-ease) both;
  }
  .motion-page .hero h1,
  .motion-page .page-hero h1 {
    animation: rise-in 1s 0.1s var(--motion-ease) both;
  }
  .motion-page .hero-intro,
  .motion-page .page-hero .lead {
    animation: rise-in 1s 0.22s var(--motion-ease) both;
  }
  .motion-page .hero-stage {
    animation: stage-in 1.2s 0.28s var(--motion-ease) both;
  }
  .motion-page .hero h1 .accent,
  .motion-page .page-hero h1 .accent {
    background: linear-gradient(var(--lime), var(--lime)) left 90% / 100% 0.4em
      no-repeat;
    animation: accent-in 1s 0.65s var(--motion-ease) both;
  }
  .stage-orbit {
    animation: orbit-turn 42s linear infinite;
  }
  .stage-glow {
    animation: glow-drift 14s ease-in-out infinite alternate;
  }
  .story-card {
    animation: card-float 6s ease-in-out infinite;
  }
  .story-card.order {
    animation-delay: -2s;
  }
  .story-card.team {
    animation-delay: -4s;
  }
  .story-packet {
    animation: story-transfer 6s linear infinite;
  }
  .story-dots i {
    animation: typing-dot 1.6s ease-in-out infinite;
  }
  .story-dots i:nth-child(2) {
    animation-delay: 0.16s;
  }
  .story-dots i:nth-child(3) {
    animation-delay: 0.32s;
  }
  .story-check {
    animation: check-draw 6s ease-in-out infinite;
  }
  .story-avatars i {
    animation: teammate-in 6s ease-in-out infinite;
  }
  .story-avatars i:nth-child(2) {
    animation-delay: 0.2s;
  }
  .story-avatars i:nth-child(3) {
    animation-delay: 0.4s;
  }
  .rhythm-track {
    animation: rhythm-travel 36s linear infinite;
  }
  .rhythm-strip:is(:hover, :focus-within) .rhythm-track {
    animation-play-state: paused;
  }
  .motion-page .journey-item::before {
    animation: journey-pass 12s ease-in-out infinite;
  }
  .motion-page .journey-item:nth-child(2)::before {
    animation-delay: 3s;
  }
  .motion-page .journey-item:nth-child(3)::before {
    animation-delay: 6s;
  }
  .motion-page .journey-item:nth-child(4)::before {
    animation-delay: 9s;
  }
  .motion-page .flow-node::after {
    animation: node-active 9s ease-in-out infinite;
  }
  .motion-page .flow-node:nth-child(3)::after {
    animation-delay: 3s;
  }
  .motion-page .flow-node:nth-child(5)::after {
    animation-delay: 6s;
  }
  .motion-page .flow-connector::after {
    animation: flow-packet 9s 1.4s ease-in-out infinite;
  }
  .motion-page .flow-connector:nth-child(4)::after {
    animation-delay: 4.4s;
  }
  .motion-page .cta-panel::before,
  .motion-page .about-mark::before {
    animation: orbit-turn 40s linear infinite;
  }
  .motion-page .about-mark > img {
    animation: brand-float 7s ease-in-out infinite;
  }
  .motion-page .faq details[open] > p,
  .motion-page .mobile-nav[open] .mobile-links {
    animation: rise-in 0.35s var(--motion-ease) both;
  }

  @supports (animation-timeline: view()) {
    .motion-page
      :is(
        .section-head,
        .split-copy,
        .product-visual,
        .flow-copy,
        .flow-board,
        .feature-detail,
        .about-copy,
        .cta-panel,
        .principles,
        .contact-grid
      ) {
      animation: scroll-reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 65%;
    }
    .motion-page .feature-card,
    .motion-page .channel-card,
    .motion-page .security-item {
      animation: scroll-reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 80%;
    }
    .motion-page .feature-card:nth-child(3n + 2) {
      animation-range: entry 5% entry 85%;
    }
    .motion-page .feature-card:nth-child(3n + 3) {
      animation-range: entry 10% entry 90%;
    }
  }
  @supports (animation-timeline: scroll()) {
    .motion-page .site-header::after {
      content: "";
      position: absolute;
      left: 0;
      bottom: -1px;
      width: 100%;
      height: 2px;
      background: var(--coral);
      transform-origin: left;
      animation: reading-progress linear both;
      animation-timeline: scroll(root);
    }
  }
  @media (hover: hover) and (pointer: fine) {
    .motion-page .brand:hover img {
      transform: rotate(-9deg) scale(1.06);
    }
    .motion-page .channel-word:hover b {
      transform: translateY(-4px) rotate(-8deg);
    }
    .motion-page .feature-card:is(:hover, :focus-within),
    .motion-page .channel-card:is(:hover, :focus-within),
    .motion-page .security-item:hover {
      box-shadow: 0 8px 0 var(--lime);
      border-color: var(--ink);
      transform: translateY(-4px);
    }
    .motion-page .feature-card:is(:hover, :focus-within) .feature-icon {
      transform: translateY(-5px) rotate(-8deg);
      border-radius: 50%;
    }
    .motion-page .product-visual:is(:hover, :focus-within) .screen-frame {
      transform: perspective(1200px) rotateY(-3deg) translateY(-5px);
      box-shadow: 12px 20px 50px rgba(0, 50, 40, 0.3);
    }
    .motion-page .hero-stage:is(:hover, :focus-within) > .screen-frame {
      transform: perspective(1800px) rotateX(2deg) translateY(-3px);
    }
    .story-card:hover {
      animation-play-state: paused;
    }
    .motion-page .button:is(:hover, :focus-visible) {
      box-shadow: 0 6px 0 var(--ink);
    }
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes stage-in {
  from {
    opacity: 0;
    transform: translateY(35px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes accent-in {
  from {
    background-size: 0% 0.4em;
  }
  to {
    background-size: 100% 0.4em;
  }
}
@keyframes orbit-turn {
  to {
    transform: rotate(360deg);
  }
}
@keyframes glow-drift {
  to {
    transform: translate(130px, -130px) scale(1.15);
  }
}
@keyframes card-float {
  0%,
  100% {
    transform: translateY(0) rotate(var(--tilt));
  }
  50% {
    transform: translateY(-8px) rotate(calc(var(--tilt) * -0.4));
  }
}
@keyframes story-transfer {
  0% {
    left: 12%;
    opacity: 0;
  }
  8%,
  92% {
    opacity: 1;
  }
  100% {
    left: 88%;
    opacity: 0;
  }
}
@keyframes typing-dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}
@keyframes check-draw {
  0%,
  22% {
    stroke-dashoffset: 30;
    opacity: 0.2;
  }
  42%,
  90% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0.2;
  }
}
@keyframes teammate-in {
  0%,
  45%,
  100% {
    transform: translateY(0);
  }
  60%,
  75% {
    transform: translateY(-4px);
  }
}
@keyframes rhythm-travel {
  to {
    transform: translateX(-50%);
  }
}
@keyframes journey-pass {
  0%,
  26%,
  100% {
    transform: scaleX(0);
    transform-origin: left;
  }
  10%,
  20% {
    transform: scaleX(1);
    transform-origin: left;
  }
  25% {
    transform: scaleX(0);
    transform-origin: right;
  }
}
@keyframes node-active {
  0%,
  32%,
  100% {
    opacity: 0;
  }
  8%,
  23% {
    opacity: 0.85;
  }
}
@keyframes flow-packet {
  0%,
  27%,
  100% {
    transform: translateY(0);
    opacity: 0;
  }
  3% {
    opacity: 1;
  }
  22% {
    transform: translateY(38px);
    opacity: 1;
  }
  26% {
    transform: translateY(40px);
    opacity: 0;
  }
}
@keyframes brand-float {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-10px) rotate(3deg);
  }
}
@keyframes scroll-reveal {
  from {
    opacity: 0.3;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes reading-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@media (max-width: 850px) {
  .stage-stories {
    gap: 22px;
    margin-top: 22px;
  }
  .story-card {
    padding: 13px;
  }
  .story-card strong {
    font-size: 12px;
  }
  .story-card small {
    font-size: 8px;
  }
  .stage-orbit {
    width: 450px;
    top: -230px;
    right: -200px;
  }
}
@media (max-width: 560px) {
  .stage-stories {
    gap: 8px;
    margin: 23px 0 30px;
  }
  .story-card {
    padding: 11px 8px;
    border-radius: 10px;
    --tilt: -2deg;
  }
  .story-card strong {
    font-size: 9px;
    margin-top: 8px;
  }
  .story-card small {
    display: none;
  }
  .story-card-top {
    gap: 3px;
  }
  .story-symbol {
    width: 25px;
    height: 25px;
    border-radius: 7px;
  }
  .story-symbol .icon {
    width: 15px;
    height: 15px;
  }
  .story-dots {
    gap: 2px;
  }
  .story-dots i {
    width: 3px;
    height: 3px;
  }
  .story-check {
    width: 15px;
    height: 15px;
  }
  .story-avatars i {
    width: 11px;
    height: 11px;
    margin-left: -5px;
  }
  .stage-legend {
    font-size: 7px;
    bottom: -21px;
  }
  .rhythm-strip {
    margin-top: 30px;
    padding: 17px 0;
  }
  .rhythm-group {
    gap: 24px;
    padding-right: 24px;
  }
  .rhythm-group b {
    font-size: 21px;
  }
  .motion-control {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    padding: 10px 12px;
    font-size: 9px;
  }
}

/* Dừng đưa mọi phần tử về trạng thái tĩnh, không để nội dung bị ẩn giữa nhịp. */
#motion-toggle:checked ~ :is(header, main, footer),
#motion-toggle:checked ~ :is(header, main, footer) *,
#motion-toggle:checked ~ :is(header, main, footer)::before,
#motion-toggle:checked ~ :is(header, main, footer)::after,
#motion-toggle:checked ~ :is(header, main, footer) *::before,
#motion-toggle:checked ~ :is(header, main, footer) *::after {
  animation: none !important;
  transition: none !important;
}
#motion-toggle:checked ~ header::after {
  display: none;
}
html:has(#motion-toggle:checked) {
  scroll-behavior: auto;
}
@media (prefers-reduced-motion: reduce) {
  .motion-toggle,
  .motion-control {
    display: none;
  }
  .motion-page *,
  .motion-page *::before,
  .motion-page *::after {
    animation: none !important;
    transition: none !important;
  }
}
@media print {
  .motion-toggle,
  .motion-control,
  .stage-atmosphere,
  .rhythm-strip {
    display: none;
  }
  .motion-page *,
  .motion-page *::before,
  .motion-page *::after {
    animation: none !important;
    transition: none !important;
  }
}
