/* about-us.css : chỉ nạp ở page 185 */

/* Ẩn nội dung đến khi JS dựng xong khung (tự hiện sau 2,5s nếu JS lỗi) */
body.page-id-185:not(.ab-ready) #tm-main{opacity:0;animation:ab-show 0s 2.5s forwards}
@keyframes ab-show{to{opacity:1}}

.ab-stage{
  --ab-gal-h:100svh;            /* chiều cao vùng gallery ở section 2 (vd: calc(100svh - 160px)) */
  position:relative;height:100vh;height:100svh;
  overflow:hidden;isolation:isolate;
}
/* Dùng svh (ổn định) chứ không dùng dvh: dvh đổi chiều cao khi thanh địa chỉ co/giãn lúc cuộn,
   làm nội dung bên dưới nhảy => giật ở đoạn section 3 -> 4. Phần lệch (nếu có) đã được
   html.ab-pinned ẩn đi bên dưới. */

/* Khi stage đang bị ghim (timeline section 1-3 chưa chạy xong): ẩn mọi thứ nằm dưới stage.
   visibility:hidden giữ nguyên layout nên chiều cao trang không đổi.
   JS bật/tắt class .ab-pinned trên <html>. */
html.ab-pinned .ab-flow,
html.ab-pinned footer{visibility:hidden}

/* Các section xếp chồng 100vh, chỉ section có is-active mới hiển thị */
.ab-stage > [id^="sec-about-"]{
  position:absolute!important;inset:0;height:100%;
  min-height:0!important;margin:0;
  overflow:hidden;visibility:hidden;
  will-change:transform;
}
.ab-stage > [id^="sec-about-"]:not(:first-child){transform:translateY(100%)}
.ab-stage > [id^="sec-about-"].is-active{visibility:visible}

/* Section 4 trở đi: cuộn bình thường, chiều cao theo nội dung (không ép 100vh) */
.ab-flow{height:auto!important;min-height:0!important;position:relative;background:#fff}

/* Section 2: các ảnh xếp chồng, JS kéo rèm lần lượt từng ảnh */
#sec-about-2 .uk-grid-margin{margin-top:0!important}
#sec-about-2 .gallery-img{position:relative;height:var(--ab-gal-h);overflow:hidden}
#sec-about-2 .gallery-img > div{
  position:absolute;inset:0;margin:0!important;padding:0!important;
  will-change:transform;
}
#sec-about-2 .gallery-img picture{display:block;width:100%;height:100%}
#sec-about-2 .gallery-img img{display:block;width:100%;height:100%;max-height:none;object-fit:cover}

/* Section 3: chữ chưa active = #D9D9D9, active = đen (chỉ đổi màu, không dùng opacity) */
#sec-about-3 .ab-w{display:inline-block;color:#D9D9D9;transition:color .35s ease}
#sec-about-3 .ab-w.is-active{color:#000000}

/* Section 4: JS bật uk-active cho mục gần giữa màn hình nhất */
#sec-about-4 .switcher a,
#sec-about-4 .switcher .uk-panel{transition:color .35s ease}

/* =====================================================================
   DESKTOP (>= 960px): headline và content cùng 1 hàng, căn dưới
   ===================================================================== */
@media (min-width:960px){
  #sec-about-4 .switcher{
    display:grid!important;
    grid-template-columns:2fr 1fr;
    column-gap:30px;row-gap:0;
    margin-left:0!important;
    align-items:end;                 /* dự phòng: căn đáy ô */
    align-items:last baseline;       /* ưu tiên: dòng cuối của content thẳng hàng với chân chữ headline */
  }
  /* 2 cột đổ chung vào grid; JS gán grid-row / grid-column cho từng cặp */
  #sec-about-4 .switcher > div{display:contents}
  #sec-about-4 .switcher .headline,
  #sec-about-4 .switcher > div:nth-child(2) > .uk-panel{
    margin:0!important;padding-left:0!important;
  }
}

/* =====================================================================
   MOBILE (<= 959px)
   ===================================================================== */
@media (max-width:959px){

  /* Section 1-3 trong khung: căn giữa khi ngắn, bắt đầu từ trên khi dài hơn 100vh.
     JS sẽ trượt khối này lên để cuộn hết nội dung trước khi chuyển section. */
  .ab-stage > [id^="sec-about-"] > div{margin-block:auto;will-change:transform}

  /* Section 1: bỏ max-height + overflow:auto của đoạn chữ (JS tự cuộn) */
  #page\#0{max-height:none!important;overflow:visible!important}

  /* Section 4: mỗi title + headline thành 1 nhóm (title ngay trên, headline ngay dưới) */
  #sec-about-4 .switcher{
    display:flex!important;flex-direction:column;flex-wrap:nowrap;
    margin-left:0!important;
  }
  #sec-about-4 .switcher > div{display:contents}   /* 2 cột đổ chung vào 1 flex, JS gán order xen kẽ */

  #sec-about-4 .switcher .headline:not(:first-child){
    margin-top:25px!important;padding-top:25px;
    border-top:1px solid #848484;
    text-align:center;
    width:100%;
  }
  #sec-about-4 .switcher > div:nth-child(2) > .uk-panel{
    margin-top:8px!important;margin-bottom:0!important;   /* sát title của chính nó */
    font-size:20px;line-height:1.1;
  }
  #sec-about-4 .switcher > div:nth-child(2) *{font-size:20px;
  margin-right:auto;
}
}