/* ==========================================================================
   TIMONA - TƯƠNG THÍCH WORDPRESS / FLATSOME
   Nạp giữa components.css và mobile.css. KHÔNG sửa style.css / components.css /
   mobile.css của designer (giữ nguyên để đối chiếu); mọi chỗ cần hoà với Flatsome viết ở đây.
   ========================================================================== */

/* 1. Font: giống bộ HTML của designer (anh Hiếu chốt 04/11/2026), site không nạp tệp font nào. Bộ HTML không nhúng
   SVN-Aguda và Plus Jakarta Sans nên chữ hiện theo phần dự phòng của --font-brand / --font-body trong style.css:
   tiêu đề `sans-serif` (Helvetica Mac/iPhone, Arial Windows, Roboto Android), nội dung -apple-system (San Francisco) /
   sans-serif. Tệp woff2 vẫn giữ ở assets/timona/fonts/ nếu sau này dùng lại. */

/* 1b. Quy tắc của header nằm ở đầu pages.css (designer đặt ở "trang con"). pages.css chưa nạp ở sprint 1 nên chép
   đúng 3 quy tắc đó sang đây (nguyên văn): trạng thái menu đang mở và mục "Xem tất cả". Sprint nạp pages.css thì xoá khối này. */
.menu-item-link.active {
  color: var(--color-accent-gold);
}

.menu-item-link.menu-pill-btn.active {
  color: var(--color-primary);
}

.dropdown-pane a.dropdown-all-link {
  font-family: var(--font-brand);
  color: var(--color-accent-gold);
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.5px;
}

/* 2. Flatsome cũng có lớp .container (rộng 1080px, đệm 15px). Khung mới dùng .container 1320px / đệm 24px
   của designer; trong nội dung UX Builder (.row .container) giữ cách xử lý của Flatsome để không vỡ bố cục. */
/* Flatsome in `.container, .row {max-width: 1270px}` (từ Theme Options, nạp sau file này): trả về 1320px của designer
   cho .container của header, thanh trên và footer. Chỉ đặt max-width; đệm 24px / 16px (mobile) do style.css và mobile.css. */
.top-bar > .container,
.site-header > .container,
.site-footer > .container {
  max-width: 1320px;
}

/* Flatsome gắn clearfix `.container:after {content:""; display:table}`: trong khung flex của header nó thành một phần tử
   ảo, chiếm thêm một khoảng gap và đẩy nút menu mobile lệch khỏi mép phải. Bỏ ở các container của khung. */
.top-bar > .container::before,
.top-bar > .container::after,
.site-header > .container::before,
.site-header > .container::after,
.site-footer > .container::before,
.site-footer > .container::after {
  content: none;
  display: none;
}

/* `.container` trong nội dung (UX Builder) là của Flatsome. Style.css của designer (`.container {margin: 0 auto; padding: 0 24px}`)
   nạp sau flatsome.css nên đè mất ba chỗ; trả lại đúng như Flatsome (đã đối chiếu bằng cách tắt CSS khung trên trang chủ,
   /khoa-hoc/, /gioi-thieu/ và một bài viết: kích thước, đệm, lề, max-width khớp từng phần tử). max-width 1270px do Theme Options đặt. */
.row .container {
  padding-left: 0;
  padding-right: 0;
}

/* `<section class="section container">`: Flatsome để đệm của `.section` (30px 0; có ID inline thì ID thắng), không phải 15px của `.container` */
.section.container {
  padding: 30px 0;
}

/* Tiêu đề khối (`.section-title-container`) có lề dưới 24px của Flatsome */
.container.section-title-container {
  margin-bottom: 24px;
}

/* Khi tiêu đề khối nằm thẳng trong section (không trong .row): đệm 15px của `.container` Flatsome (designer: 24px, 16px trên mobile) */
.section-content > .container.section-title-container {
  padding-left: 15px;
  padding-right: 15px;
}

/* 3. Reset của designer chạy trên toàn trang; trả lại vài thứ nội dung bài viết/UX Builder cần. */
.entry-content ul:not(.nav):not(.menu) {
  list-style: disc;
}

.entry-content ol {
  list-style: decimal;
}

.entry-content a:not(.button):not([class*="btn"]) {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 4. Header / thanh trên: chống CSS tuỳ biến của Theme Options (input, p, b) đè lên khung mới. */
.top-bar .search-pill-box input,
.top-bar .search-pill-box input[type="search"] {
  background: transparent;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none;
  color: #ffffff !important;
  height: 15.5px;
  line-height: normal;
  margin: 0;
  padding: 0;
  font-size: 13px;
  width: 130px;
}

.top-bar .search-pill-box input::-webkit-search-cancel-button {
  display: none;
}

.search-pill-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: none;
  line-height: 1;
}

.top-bar a,
.site-footer a {
  color: inherit;
}

.top-bar-item strong a:hover,
.footer-contacts-grid strong a:hover {
  color: var(--color-accent-gold);
}

.site-header a,
.site-footer a,
.mobile-drawer-panel a {
  text-decoration: none;
}

/* Chữ trong khung luôn theo font/độ đậm của designer, không theo p {...} trong Theme Options */
.top-bar p,
.site-header p,
.site-footer p,
.mobile-drawer-panel p {
  font-family: inherit;
  font-weight: inherit;
  /* Flatsome đặt p {margin-bottom: 1.3em}; designer không có lề dưới (làm cột footer cao thêm ~20px) */
  margin-bottom: 0;
}

.site-footer b,
.site-footer strong,
.top-bar b,
.top-bar strong {
  font-weight: 700;
}

/* Dòng pháp lý (số giấy phép, trụ sở) thêm vào footer; cùng màu/cỡ chữ với dòng bản quyền của designer */
.footer-phap-ly-row {
  font-size: 13px;
  line-height: 1.6;
  color: #89a4dd;
  padding: 18px 0 0;
}

/* Header dính trên cùng: chừa chỗ thanh admin khi đăng nhập */
.admin-bar .site-header {
  top: 32px;
}

@media (max-width: 782px) {
  .admin-bar .site-header {
    top: 46px;
  }
}

/* ≤ 600px WordPress cho thanh admin `position: absolute` (cuộn đi theo trang): header bám mép trên, không chừa khoảng trống. */
@media (max-width: 600px) {
  .admin-bar .site-header {
    top: 0;
  }
}

/* Mục bấm được bằng bàn phím: menu xổ hiện khi có tiêu điểm bên trong, hoặc đã mở bằng chạm */
.has-dropdown:focus-within .dropdown-pane,
.has-dropdown.is-open .dropdown-pane {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.menu-item-link:focus-visible,
.dropdown-pane a:focus-visible,
.mobile-hamburger:focus-visible,
.drawer-close-btn:focus-visible,
.drawer-nav-link:focus-visible {
  outline: 2px solid var(--color-accent-gold);
  outline-offset: 2px;
}

/* Hamburger / nút là <button>: giữ màu chữ trắng như designer, bỏ kiểu nút của Flatsome */
.mobile-hamburger,
.drawer-close-btn,
.drawer-group-toggle {
  box-shadow: none;
  text-transform: none;
  margin: 0;
}

.drawer-nav-link,
.drawer-group-toggle {
  min-height: 0;
}

/* Logo trong ngăn kéo và footer (designer đặt style trực tiếp trong HTML) */
.drawer-head .tm-logo-ngan-keo {
  height: 38px;
  width: auto;
}

.footer-legal-info .tm-logo-footer {
  width: auto;
}

/* Nút <a> thay cho <button data-open-modal> (popup làm ở sprint 2, tạm trỏ #dang-ky) */
a.btn-consult-gold,
a.mobile-bottom-btn {
  text-decoration: none;
}

/* 5. Nền tảng chữ/màu: Flatsome in body {font-family: Roboto; color: ...} từ Theme Options SAU file CSS này,
   nên viết lại ở mức cụ thể hơn (body.timona-khung) để font Plus Jakarta Sans, màu chữ và nền của designer thắng. */
body.timona-khung {
  font-family: var(--font-body);
  background-color: var(--color-bg-page);
  color: var(--color-text-body);
  line-height: 1.6;
  font-size: 16px;
  /* Flatsome: `body {-webkit-font-smoothing: antialiased}` làm nét chữ trên Mac khác bộ HTML (để mặc định). */
  -webkit-font-smoothing: auto;
}

/* Flatsome: `h1…h6 {text-rendering: optimizeSpeed}` (tắt kerning) và nút `optimizeLegibility`; bộ HTML để mặc định. */
html :is(h1, h2, h3, h4, h5, h6),
html :is(.button, button, input[type="button"], input[type="reset"], input[type="submit"]) {
  text-rendering: auto;
}

/* Tiêu đề: font thương hiệu (--font-brand) viết hoa, chữ đậm 700 (mặc định trình duyệt) như designer. Theme Options của Flatsome
   in `h1…h6, .banner h1, .banner h2 {font-family: Roboto; font-weight: 500}` sau file này. Độ ưu tiên (0,0,2) / (0,1,2) thắng
   quy tắc đó nhưng vẫn thua các lớp riêng của designer (vd. `.mini-post h4` dùng font thân, không viết hoa). */
html :is(h1, h2, h3, h4, h5, h6),
html .banner :is(h1, h2) {
  font-family: var(--font-brand);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

/* Flatsome: `td, th {font-size: .9em; line-height: 1.3}`, `td {color: #666}`; designer để ô bảng thừa cỡ, màu, dòng của bảng. */
html :is(td, th) {
  font-size: inherit;
  line-height: inherit;
}
html td {
  color: inherit;
}

/* Chữ đậm tối đa 700. Site dùng font hệ thống (như bộ HTML): trên Windows, độ đậm 800–900 của Arial rơi vào Arial Black,
   font này thiếu chữ tiếng Việt có dấu (Ư, Ấ, Ổ…) nên trình duyệt vá bằng Times New Roman, chữ lẫn font. Trên Mac Helvetica
   không có nét đậm hơn Bold nên nhìn không đổi. Ghi đè hai lớp 800 của designer (components.css); `b, strong` để 700 thay vì
   `bolder` (trong đoạn đậm 600 sẽ thành 900). */
html :is(b, strong),
.modal-title,
.form-submit-btn {
  font-weight: 700;
}

/* Designer dùng <button> (dòng cao "normal" mặc định của trình duyệt); site dùng <a> nên thừa dòng cao 1.6 của thân trang.
   :where() giữ độ ưu tiên 0: quy tắc dòng cao riêng của designer (vd. mobile.css) vẫn thắng.
   Thanh dưới mobile: designer chỉ dùng <button> cho nút đăng ký (.btn-mobile-form); gọi ngay / Zalo là <a> nên giữ 1.6. */
:where(a.btn-pill-blue, a.btn-hero-primary, a.btn-consult-gold, a.news-tab-btn, a.btn-center-more, a.btn-mobile-form) {
  line-height: normal;
}

/* Nút <button> trong khung: Flatsome đặt min-height, lề dưới, đệm cho mọi <button>; trả về như designer */
.site-header button,
.top-bar button,
.mobile-drawer-panel button {
  min-height: 0;
  margin: 0;
  box-shadow: none;
}

/* Flatsome đặt cho mọi <button>: line-height 2.4em, letter-spacing .03em, chữ đậm. :where() giữ độ ưu tiên bằng 0 để
   các lớp của designer (.drawer-nav-link, .mobile-hamburger...) vẫn quyết định, chỉ bỏ mặc định của Flatsome. */
:where(.site-header, .top-bar, .mobile-drawer-panel) button {
  line-height: normal;
  letter-spacing: normal;
  font-weight: 400;
  text-transform: none;
}

.search-pill-box {
  margin: 0;
}

.search-pill-box .search-pill-submit {
  width: auto;
  height: auto;
  min-height: 0;
  min-width: 0; /* Flatsome 3.20 đặt nút tối thiểu 24px, làm ô tìm kiếm thanh đầu trang rộng thêm 9px */
  margin: 0;
  padding: 0;
}

/* 6. Gỡ bỏ phần cũ của site mà khung mới thay thế */
/* Nút liên hệ nổi của plugin button-contact-vr (trùng với nút nổi gọi/Zalo của khung mới) */
#button-contact-vr {
  display: none !important;
}

/* 7. Nội dung cũ (UX Builder) trên điện thoại: body có overflow-x:hidden (designer) nên bảng rộng hơn màn hình
   sẽ bị cắt mất; cho bảng cuộn ngang trong khung của nó để không mất nội dung. */
@media (max-width: 768px) {
  #content table,
  .entry-content table,
  .page-wrapper table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* 8. Thanh 3 nút cố định dưới cùng (≤768px): designer chừa chỗ bằng body{padding-bottom} trong mobile.css, nhưng
   global-styles của WordPress in sau (body{padding:0}) đè mất nên cuối trang bị thanh che. Đặt lại, độ ưu tiên cao hơn. */
@media (max-width: 768px) {
  body.timona-khung {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }
}

/* 9. Hộp thông báo (#timona-toast): designer giấu bằng translateX(120%) của chính hộp; khi chưa có chữ hộp chỉ rộng ~78px
   nên 120% không bù được lề phải 24px, lộ ~8px viền vàng ở mép phải. Đẩy hẳn ra ngoài và ẩn khi chưa hiện. */
.toast-notice:not(.is-show) {
  transform: translateX(calc(100% + 48px));
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0s linear 0.3s;
}

/* Thanh quản trị (chỉ người đăng nhập thấy): `img { display:block; height:auto }` của style.css làm icon site
   (WordPress 7 thêm vào mục tên site) phình theo ảnh 2x thành 90px và đẩy tên site rơi xuống đè logo đầu trang. */
#wpadminbar img.site-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  max-width: none;
  margin: 0 6px 0 0;
  vertical-align: middle;
  position: relative;
  top: -2px;
}
