/* ==========================================================================
   baf-wp.css — WordPress bridge layer

   The prototype stylesheets (tokens / common / per-page) are carried into this
   theme byte-for-byte and are never edited. Anything WordPress needs on top of
   them belongs here, and nothing else does.

   Loads last, so a rule here wins at equal specificity. Keep it small: every
   rule in this file is a difference between the served page and the signed-off
   design, and it should be obvious why each one exists.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Admin bar
   The prototype has a fixed header pinned to viewport top. The admin bar pushes
   the whole document down by 32px (46px on narrow screens) via html{margin-top}
   on a position:fixed element, which the header does not know about.
   -------------------------------------------------------------------------- */
body.admin-bar .header {
  top: 32px;
}

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

/* The intro overlay and the menu overlay both cover the viewport; without this
   they sit under the admin bar instead of starting below it. */
body.admin-bar .intro,
body.admin-bar .menu {
  top: 32px;
  height: calc(100% - 32px);
}

@media screen and (max-width: 782px) {
  body.admin-bar .intro,
  body.admin-bar .menu {
    top: 46px;
    height: calc(100% - 46px);
  }
}

/* --------------------------------------------------------------------------
   2. Core block/editor output
   `the_content()` emits core classes the prototype never had. These keep an
   editor-entered paragraph inside the same measure as the designed prose.
   -------------------------------------------------------------------------- */
/* Căn lề ảnh do trình soạn thảo sinh ra. Áp cho cả `.art-body` (bài viết) chứ
   không riêng `.legal-prose` — bài viết mới là chỗ khách chèn ảnh nhiều nhất. */
.legal-prose .alignleft,
.art-body .alignleft {
  float: left;
  margin: 0 1.5rem 1rem 0;
}

.legal-prose .alignright,
.art-body .alignright {
  float: right;
  margin: 0 0 1rem 1.5rem;
}

.legal-prose .aligncenter,
.art-body .aligncenter {
  display: block;
  margin-inline: auto;
}

/* `alignnone` là mặc định của TinyMCE khi không chọn căn lề — không có rule nào
   trong theme cho tới khi Classic Editor được bật. */
.legal-prose .alignnone,
.art-body .alignnone {
  display: block;
  height: auto;
  max-width: 100%;
}

/* Shortcode [caption] của Classic Editor. Dùng token có sẵn, không màu mới. */
.legal-prose .wp-caption,
.art-body .wp-caption {
  max-width: 100%;
  margin-bottom: 1.5rem;
}

.legal-prose .wp-caption img,
.art-body .wp-caption img {
  display: block;
  height: auto;
  max-width: 100%;
  border-radius: 12px;
}

.legal-prose .wp-caption-text,
.art-body .wp-caption-text {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 14px;
  font-style: italic;
  line-height: 1.6;
  text-align: center;
}

.legal-prose figure {
  margin: 1.5rem 0;
}

.legal-prose img {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   3. Accessibility helper core expects to exist
   `screen-reader-text` ships with WordPress markup (search form, pagination)
   but is not declared anywhere in the prototype stylesheets.
   -------------------------------------------------------------------------- */
.screen-reader-text {
  position: absolute !important; /* core utility: must beat any layout rule it lands on */
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.screen-reader-text:focus {
  z-index: 100000;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  padding: 12px 20px;
  clip-path: none;
  background: #fff;
  color: #024a28;
  font-size: 14px;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Nút chuyển ngữ (MONA Multilingual) — biến thể `select`
   Markup do plugin sinh: nó TRANG TRÍ một <select> thật chứ không thay thế, nên
   phần tử gốc vẫn là nguồn sự thật và đường dẫn không-JS của plugin vẫn chạy.
   Theme chỉ chỉnh cho khớp header.

   Bản thiết kế không vẽ nút này — bản tĩnh chỉ có tiếng Việt. Kiểu chữ lấy đúng
   theo .hnav__top bên cạnh (13px / 700 / --head) để hai thứ đọc như một hàng,
   thay vì để mặc định 14px / 600 / #1B1F2A của plugin.
   -------------------------------------------------------------------------- */
.header__lang { display: flex; align-items: center; }

.header__lang .mml-sel,
.header__lang .mml-sel__ctl { min-width: 0; }

.header__lang .mml-sel__ctl {
  padding: 6px 24px 6px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--head);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  transition: background var(--t-2) var(--ease), border-color var(--t-2) var(--ease);
}

.header__lang .mml-sel__ctl:hover { border-color: var(--line); background: var(--green-soft); }

/* Bàn phím phải thấy được tiêu điểm — nút này nằm đầu hàng điều hướng. */
.header__lang .mml-sel.is-focus .mml-sel__ctl,
.header__lang .mml-sel__ctl:focus-visible {
  border-color: var(--green);
  background: var(--green-soft);
  outline: none;
}

.header__lang .mml-sel__img { width: 18px; height: 18px; border-radius: 3px; }

.header__lang .mml-sel__caret { right: 8px; opacity: .55; }

/* Bảng chọn KHÔNG nằm trong .header__lang — select.js gắn nó thẳng vào <body>
   (assets/select.js:134) để không bị cắt bởi overflow của thanh header. Nên phải
   nhắm .mml-sel__panel trực tiếp; scope bằng .header__lang là rule chết, và đã
   chết một lần rồi. An toàn vì baf-wp.css chỉ nạp ở mặt tiền, nơi chỉ có đúng
   một .mml-sel là nút chuyển ngữ này. */
.mml-sel__panel .mml-sel__list {
  min-width: 148px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
  overflow: hidden;
}

.mml-sel__panel .mml-sel__opt { font-size: 13.5px; }

.mml-sel__panel .mml-sel__opt[aria-selected="true"] {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.mml-sel__panel .mml-sel__opt:hover { background: var(--green-soft); }

/* Dưới 560px header chỉ còn logo và hai nút — giấu nhãn, giữ lại cờ. */
@media (max-width: 560px) {
  .header__lang .mml-sel__ctl { padding-right: 20px; font-size: 0; }
  .header__lang .mml-sel__img { margin: 0; }
}
