/* Trang hub Nata workspace — lưới bento.
   Dùng chung token màu/chữ với style.css, chỉ thêm phần riêng của hub.
   Không dùng backdrop-filter ở bất kỳ đâu: gây giật khi cuộn. */

.hub-body { background: var(--cream); }

/* ------------------------------------------------------------- Header */

.hub-head {
  position: sticky; top: 0; z-index: 40;
  background: var(--cream);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.hub-head.is-stuck { border-bottom-color: var(--border); }

.hub-head-inner { display: flex; align-items: center; gap: 24px; height: var(--head-h); }

.hub-nav { display: flex; gap: 4px; margin-left: auto; }
.hub-nav a {
  padding: 8px 14px; border-radius: 999px;
  color: var(--ink-2); font-weight: 700; font-size: 15px; text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.hub-nav a:hover { background: var(--chip-bg); color: var(--brand); }

.hub-hotline {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 12px; border-radius: 999px;
  background: var(--brand); color: var(--on-brand); text-decoration: none;
}
.hub-hotline .ic { width: 20px; height: 20px; flex: none; }
.hub-hotline span { display: flex; flex-direction: column; line-height: 1.15; }
.hub-hotline small { font-size: 11px; opacity: .72; }
.hub-hotline strong { font-size: 15px; font-weight: 800; white-space: nowrap; }

/* --------------------------------------------------------------- Hero */

.hub-hero { padding: 72px 0 40px; text-align: center; }
.hub-hero .eyebrow { margin-bottom: 20px; }

.hub-title {
  margin: 0 auto 20px;
  max-width: 16ch;
  font-size: clamp(38px, 6.4vw, 72px);
  line-height: 1.04;
  letter-spacing: -.035em;
  font-weight: 900;
  color: var(--ink);
}

.hub-lead {
  margin: 0 auto;
  max-width: 62ch;
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.62;
  color: var(--ink-2);
}

/* --------------------------------------------------------- Lưới bento */

.hub-grid-wrap { padding: 32px 0 80px; }

.bento {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Mỗi ô: nền gradient riêng + hình SVG, chữ nổi lên trên.
   --t1/--t2 là hai màu của tông, đặt ở từng class tone-* bên dưới. */
.bento-card {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: 10px;
  padding: 24px;
  min-height: 210px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background:
    radial-gradient(130% 110% at 100% 0%, var(--t1) 0%, transparent 62%),
    radial-gradient(120% 120% at 0% 100%, var(--t2) 0%, transparent 58%),
    var(--card);
  color: inherit; text-decoration: none;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

a.bento-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 18px 40px rgba(46, 13, 3, .11);
}
a.bento-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Hình minh hoạ phủ cả ô rồi mờ dần xuống đáy, để chữ luôn đọc được.
   Phủ cả ô chứ không chỉ phần trên: ô nhỏ rất dẹt, nếu giới hạn chiều cao
   thì preserveAspectRatio="slice" xén hình thành một dải hẹp mất đầu mất đuôi. */
.bento-art {
  position: absolute; inset: 0;
  display: block;
  color: var(--t3);
  pointer-events: none;
  z-index: -1;
  -webkit-mask-image: linear-gradient(#000 46%, transparent 94%);
          mask-image: linear-gradient(#000 46%, transparent 94%);
}
.bento-svg { width: 100%; height: 100%; display: block; }

/* Lớp phủ mờ dần ở đáy ô: giữ chữ tách khỏi nét vẽ mà không phải làm nhạt hình */
.bento-card::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 58%;
  background: linear-gradient(to top, var(--card) 18%, rgba(255, 255, 255, .72) 52%, transparent);
  pointer-events: none;
  z-index: -1;
}

a.bento-card .bento-art { transition: transform .35s ease; }
a.bento-card:hover .bento-art { transform: scale(1.05); }

/* Ô lớn: TaskFlow, 2 cột 2 hàng */
.bento-card.is-hero { grid-column: span 2; grid-row: span 2; min-height: 430px; }

.bento-card.is-wide  { grid-column: span 1; }
.bento-card.is-small { grid-column: span 1; min-height: 190px; }

/* Ô chưa có domain: nhạt đi, viền nét đứt, không bấm được */
.bento-card.is-soon { border-style: dashed; }
.bento-card.is-soon .bento-art { opacity: .55; }
.bento-card.is-soon .bento-name { color: var(--ink-2); }
.bento-card.is-soon .bento-desc { color: var(--ink-3); }

.bento-badge {
  position: absolute; top: 18px; right: 18px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--ink-3);
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.bento-card:not(.is-soon) .bento-badge { color: #1f7a52; border-color: rgba(65, 196, 137, .4); }

.bento-body { display: flex; flex-direction: column; gap: 6px; }
.bento-name {
  font-size: 24px; font-weight: 900; letter-spacing: -.02em; color: var(--ink);
  line-height: 1.15;
}
.bento-desc { font-size: 14px; line-height: 1.55; color: var(--ink-2); max-width: 36ch; }

.bento-card.is-hero .bento-name { font-size: 40px; }
.bento-card.is-hero .bento-desc { font-size: 17px; max-width: 42ch; }

/* Bảng màu từng tông: t1/t2 cho nền, t3 cho nét vẽ SVG */
.bento-card.tone-green  { --t1: rgba(65,196,137,.26);  --t2: rgba(46,197,221,.14);  --t3: #2f9e74; }
.bento-card.tone-blue   { --t1: rgba(91,155,240,.26);  --t2: rgba(157,123,248,.13); --t3: #3f77cc; }
.bento-card.tone-purple { --t1: rgba(157,123,248,.26); --t2: rgba(239,128,180,.13); --t3: #7a55d8; }
.bento-card.tone-cyan   { --t1: rgba(46,197,221,.24);  --t2: rgba(91,155,240,.12);  --t3: #2a93a6; }
.bento-card.tone-amber  { --t1: rgba(247,178,74,.28);  --t2: rgba(255,122,69,.14);  --t3: #c08429; }
.bento-card.tone-pink   { --t1: rgba(239,128,180,.26); --t2: rgba(157,123,248,.12); --t3: #cc6396; }

/* ------------------------------------------- Dải "Coming Soon"

   Gộp mọi hạng mục chưa bật thành một ô. Vị trí và bề rộng do PHP tính
   (coming_soon_slot) rồi truyền vào qua biến --cs-*, nên lưới luôn kín
   dù bật bao nhiêu ô. Trên điện thoại lưới còn 1 cột nên bỏ qua hết. */

.bento-soon {
  grid-column: var(--cs-col, auto) / span var(--cs-span, 3);
  grid-row: span var(--cs-rows, 1);
  position: relative;
  display: grid; place-items: center;
  min-height: 190px;
  padding: 24px;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: linear-gradient(115deg,
    rgba(65,196,137,.30) 0%,
    rgba(46,197,221,.26) 22%,
    rgba(91,155,240,.28) 44%,
    rgba(157,123,248,.26) 64%,
    rgba(239,128,180,.26) 82%,
    rgba(247,178,74,.28) 100%);
  background-size: 260% 100%;
  animation: soon-drift 24s linear infinite alternate;
}

.bento-soon-text {
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: .5;
}

@keyframes soon-drift {
  from { background-position: 0% 50%; }
  to   { background-position: 100% 50%; }
}

/* ------------------------------------------------------------ Liên hệ */

.hub-contact { padding: 0 0 88px; }

.hub-contact-card {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 24px;
  padding: 32px;
  border-radius: var(--r-xl);
  background: var(--dark);
  color: var(--dark-text);
}
.hub-contact-copy h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.6vw, 30px); font-weight: 900; letter-spacing: -.02em;
  color: var(--dark-title);
}
.hub-contact-copy p { margin: 0; font-size: 15px; line-height: 1.6; max-width: 52ch; }
.hub-contact-links { display: flex; flex-wrap: wrap; gap: 10px; }
.hub-contact-links .btn-ghost {
  background: transparent; border-color: var(--dark-3); color: var(--dark-title);
}
.hub-contact-links .btn-ghost:hover { background: var(--dark-3); }

/* ------------------------------------------------------- Chân trang */

.hub-foot { padding: 28px 0 40px; border-top: 1px solid var(--border); }
.hub-foot-inner { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.hub-foot-brand { margin: 0; font-size: 15px; color: var(--ink-2); }
.hub-foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; }
.hub-foot-links a { font-size: 14px; color: var(--ink-2); text-decoration: none; }
.hub-foot-links a:hover { color: var(--brand); text-decoration: underline; }
.hub-foot-copy { margin: 0; font-size: 13px; color: var(--ink-3); }

/* ----------------------------------------------------------- Màn nhỏ */

@media (max-width: 960px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento-card.is-hero { grid-column: span 2; grid-row: auto; min-height: 380px; }
}

@media (max-width: 720px) {
  .hub-nav, .hub-hotline { display: none; }
  .hub-hero { padding: 48px 0 28px; }
  .bento { grid-template-columns: 1fr; gap: 12px; }
  /* Vẫn giữ chiều cao để hình minh hoạ còn thở được — ô dẹt quá thì
     slice xén mất hình, nhìn như ô trống chỉ có nền màu. */
  .bento-card { grid-column: span 1; min-height: 172px; }
  .bento-soon { grid-column: 1 / -1; grid-row: auto; min-height: 128px; }
  .bento-card.is-hero { grid-column: span 1; min-height: 246px; }
  .bento-card.is-hero .bento-name { font-size: 28px; }
  .bento-card.is-hero .bento-desc { font-size: 15px; }
  .bento-card::after { height: 50%; }
  .hub-contact-card { padding: 24px; }
  .hub-contact-links .btn { width: 100%; justify-content: center; }
}

/* ===================================================== Chuyển động hình ô

   Thuần CSS, không cần JS. Hai lớp:
     - "vẽ vào" chạy một lần khi tải trang (animation-fill-mode: both)
     - "thở" lặp vô hạn, chỉ dùng transform/opacity để trình duyệt chạy trên
       GPU; không lặp stroke-dashoffset vì nó bắt vẽ lại liên tục, gây giật.
   transform-box: view-box để transform-origin đếm theo toạ độ trong viewBox.
   Toàn bộ tắt khi máy bật "giảm chuyển động" — xem cuối tệp.             */

.bento-svg [class^="a-"] { transform-box: view-box; }

/* --- TaskFlow: vòng tiến độ chạy lên, việc hiện dần, tích vẽ sau cùng --- */

.a-ring {
  stroke-dasharray: 0 541;
  animation: ring-fill 1.5s cubic-bezier(.22, 1, .36, 1) .25s both;
}
/* 367/541 = 68% chu vi vòng r=86. Đổi bán kính thì phải tính lại hai số này. */
@keyframes ring-fill { to { stroke-dasharray: 367 541; } }

.a-check {
  stroke-dasharray: 90; stroke-dashoffset: 90;
  animation: draw 0.5s ease-out 1.5s both;
}

.a-bar {
  transform-origin: 96px 0;
  animation: bar-in .7s cubic-bezier(.22, 1, .36, 1) both;
}
.a-bar:nth-of-type(1) { animation-delay: .20s; }
.a-bar:nth-of-type(2) { animation-delay: .30s; }
.a-bar:nth-of-type(3) { animation-delay: .40s; }
.a-bar:nth-of-type(4) { animation-delay: .50s; }
.a-bar:nth-of-type(5) { animation-delay: .60s; }
@keyframes bar-in {
  from { transform: scaleX(.2); opacity: 0; }
  to   { transform: scaleX(1);  opacity: 1; }
}

.a-tick { animation: pop .45s cubic-bezier(.34, 1.56, .64, 1) both; }
.a-tick:nth-of-type(1) { transform-origin: 66px 97px;  animation-delay: .16s; }
.a-tick:nth-of-type(2) { transform-origin: 66px 141px; animation-delay: .26s; }
.a-tick:nth-of-type(3) { transform-origin: 66px 185px; animation-delay: .36s; }
.a-tick:nth-of-type(4) { transform-origin: 66px 229px; animation-delay: .46s; }
.a-tick:nth-of-type(5) { transform-origin: 66px 273px; animation-delay: .56s; }

/* --- Finance: đường tiền vẽ từ trái sang, cột mọc lên, đỉnh nhấp nháy --- */

.a-line {
  stroke-dasharray: 480; stroke-dashoffset: 480;
  animation: draw 1.7s cubic-bezier(.4, 0, .2, 1) .2s both;
}
.a-area { animation: fade-in 1.2s ease-out 1.1s both; }

.a-col {
  transform-origin: 0 300px;
  animation: col-up .8s cubic-bezier(.22, 1, .36, 1) both;
}
.a-col:nth-of-type(1) { animation-delay: .5s; }
.a-col:nth-of-type(2) { animation-delay: .62s; }
.a-col:nth-of-type(3) { animation-delay: .74s; }
@keyframes col-up { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.a-dot {
  transform-origin: 348px 72px;
  animation: pop .5s cubic-bezier(.34, 1.56, .64, 1) 1.6s both;
}

/* --- CRM: ba vòng quỹ đạo quay quanh tâm, tốc độ và chiều khác nhau --- */

.a-orbit {
  transform-origin: 300px 150px;
  animation: spin linear infinite;
}
.a-orbit-1 { animation-duration: 26s; }
.a-orbit-2 { animation-duration: 42s; animation-direction: reverse; }
.a-orbit-3 { animation-duration: 64s; }
@keyframes spin { to { transform: rotate(360deg); } }

/* .a-core dùng ở cả CRM lẫn Freelancer, hai tâm khác nhau — phải tách theo
   tông, nếu không hình bên Freelancer sẽ phình ra quanh điểm của CRM. */
.a-core { animation: breathe 4.5s ease-in-out infinite; }
.tone-purple .a-core { transform-origin: 300px 150px; }
.tone-amber  .a-core { transform-origin: 96px 118px; }

/* --- Nata: lưới hiện ra, từng ô sáng lên lần lượt rồi lặp lại --- */

.a-grid { animation: fade-in 1s ease-out both; }

.a-cell { animation: cell-glow 7s ease-in-out infinite; }
.a-cell:nth-of-type(1) { animation-delay: 0s; }
.a-cell:nth-of-type(2) { animation-delay: 2.3s; }
.a-cell:nth-of-type(3) { animation-delay: 4.6s; }
@keyframes cell-glow {
  0%, 60%, 100% { opacity: .55; }
  20%, 40%      { opacity: 1; }
}

.a-pin { transform-origin: 200px 125px; animation: breathe 3.8s ease-in-out infinite; }

/* --- Freelancer: các tia bắn ra lần lượt, đầu tia nảy, tâm thở --- */

.a-ray {
  stroke-dasharray: 220; stroke-dashoffset: 220;
  animation: draw .9s cubic-bezier(.22, 1, .36, 1) both;
}
.a-ray:nth-of-type(1) { animation-delay: .30s; }
.a-ray:nth-of-type(2) { animation-delay: .42s; }
.a-ray:nth-of-type(3) { animation-delay: .54s; }
.a-ray:nth-of-type(4) { animation-delay: .66s; }
.a-ray:nth-of-type(5) { animation-delay: .78s; }
.a-ray:nth-of-type(6) { animation-delay: .90s; }

.a-end { animation: pop .45s cubic-bezier(.34, 1.56, .64, 1) both; }
.a-end:nth-of-type(1) { transform-origin: 206px 86px;  animation-delay: 1.05s; }
.a-end:nth-of-type(2) { transform-origin: 214px 142px; animation-delay: 1.17s; }
.a-end:nth-of-type(3) { transform-origin: 190px 196px; animation-delay: 1.29s; }

/* --- Product: ba lớp trôi lên xuống lệch pha, trông như đang xếp chồng --- */

.a-layer { animation: float 6s ease-in-out infinite; }
.a-layer-1 { animation-delay: 0s; }
.a-layer-2 { animation-delay: .5s; }
.a-layer-3 { animation-delay: 1s; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}

/* --- Dùng chung --- */

/* .a-halo nằm ở cả Finance lẫn Freelancer, mỗi nơi một tâm khác nhau */
.tone-blue  .a-halo { transform-origin: 348px 72px; }
.tone-amber .a-halo { transform-origin: 96px 118px; }
.a-halo { animation: halo 4s ease-in-out infinite; }

@keyframes draw    { to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop     { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes halo    { 0%, 100% { transform: scale(1); opacity: .75; } 50% { transform: scale(1.22); opacity: 1; } }

/* Rê chuột vào ô thì hình nhanh hơn một nhịp, cho thấy ô đang "sống" */
a.bento-card:hover .a-orbit-1 { animation-duration: 13s; }
a.bento-card:hover .a-orbit-2 { animation-duration: 21s; }
a.bento-card:hover .a-orbit-3 { animation-duration: 32s; }
a.bento-card:hover .a-layer   { animation-duration: 3s; }
a.bento-card:hover .a-halo,
a.bento-card:hover .a-core    { animation-duration: 2s; }

/* Máy bật "giảm chuyển động": đứng yên hoàn toàn, nhưng hình vẫn hiện đủ */
@media (prefers-reduced-motion: reduce) {
  .bento-svg [class^="a-"] { animation: none !important; }
  .bento-soon { animation: none; }
  .a-ring  { stroke-dasharray: 367 541; }
  .a-check { stroke-dashoffset: 0; }
  .a-line, .a-ray { stroke-dashoffset: 0; }
}
