/* ==========================================================================
   DABACO OIL - unified News + Nutrition page (/vi/tin-tuc, /en/news)
   Loaded after fidelity-base.css; recreates prototype #tin-tuc + #dinh-duong.
   Every rule is prefixed .fp-root so it wins over the scoped reset of the base file.
   Numbers are the literal prototype values; display type is rescaled for Be Vietnam Pro.
   Progressive enhancement: without JavaScript both panels are stacked and the chips/pager are hidden;
   editorial-browser.js adds .is-enhanced to the page root.
   ========================================================================== */

.fp-root.fp-editorial {
  /* height of the TIN TUC / DINH DUONG bar (56px + 1px line); the breadcrumb overlay starts below it */
  --fp-subnav-h: 57px;
  --fp-green: var(--dabaco-blue);
  --fp-green-hover: var(--dabaco-blue-hover);
  /* Nutrition-only accents override these variables on the Omega block. */
  --fp-on-leaf: #dcebf8;
}

/* The hidden attribute must beat every display rule below (features, cards, pager, empty state, panels). */
.fp-root.fp-editorial [hidden] {
  display: none !important; /* reason: component display rules (grid/flex) have the same or higher specificity than the UA [hidden] rule */
}

/* --------------------------------------------------------------------------
   Switcher (prototype .menu a: 15.5px / 600, 4px gold bar under the active item)
   -------------------------------------------------------------------------- */
.fp-root .fp-subnav {
  background: #fff;
  border-bottom: 1px solid var(--fp-line);
}

.fp-root .fp-subnav a {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 18px;
  font-size: var(--fs-body);
  font-weight: 600;
  white-space: nowrap;
  color: var(--fp-ink);
}

.fp-root .fp-subnav a::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background: var(--fp-gold);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.2s;
}

.fp-root .fp-subnav a:hover {
  color: var(--fp-green);
}

.fp-root .fp-subnav a[aria-current="page"] {
  color: var(--fp-leaf);
}

.fp-root .fp-subnav a[aria-current="page"]::after {
  transform: scaleY(1);
}

/* --------------------------------------------------------------------------
   Category chips (pill buttons, aria-pressed)
   -------------------------------------------------------------------------- */
.fp-root .fp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: var(--fp-gap-md);
}

.fp-root .fp-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: 1px solid var(--fp-line);
  border-radius: var(--fp-radius-pill);
  background: #fff;
  color: var(--fp-ink);
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
}

.fp-root .fp-chip:hover {
  border-color: var(--fp-green);
  color: var(--fp-green);
}

.fp-root .fp-chip[aria-pressed="true"] {
  padding: 7px 17px;
  border: 2px solid var(--fp-green);
  color: var(--fp-green);
}

/* without JavaScript the filter and the pager cannot work: hide them */
.fp-root.fp-editorial:not(.is-enhanced) .fp-chips,
.fp-root.fp-editorial:not(.is-enhanced) .fp-pager {
  display: none;
}

/* --------------------------------------------------------------------------
   Meta line (category + date), shared by feature and cards
   -------------------------------------------------------------------------- */
.fp-root .fp-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-small);
  color: var(--fp-muted);
}

.fp-root .fp-meta__date .fp-icon {
  margin-right: 7px;
  color: var(--fp-gold);
}

/* --------------------------------------------------------------------------
   Promoted feature (first record of the filtered list)
   -------------------------------------------------------------------------- */
.fp-root .fp-feature {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 28px;
  padding: 24px;
  border: 1px solid var(--fp-line);
  border-radius: var(--fp-radius);
  background: #fff;
  box-shadow: var(--fp-shadow);
}

.fp-root .fp-feature__media {
  display: block;
}

.fp-root .fp-feature__title {
  margin: 12px 0 14px;
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.2;
  color: var(--fp-leaf);
}

/* card titles clamp at three lines like the prototype (same Be Vietnam Pro 17.5px, so the same line counts) */
.fp-root .fp-post__title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The prototype also clamps the feature title at three lines, but its condensed display face is much narrower than
   Be Vietnam Pro: the longest headline (99 characters) would be cut off, so the feature title is shown in full. */

.fp-root .fp-feature__link:hover .fp-feature__title,
.fp-root .fp-post__link:hover .fp-post__title {
  color: var(--fp-green);
}

.fp-root .fp-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-weight: 700;
  color: var(--fp-green);
}

.fp-root .fp-more:hover {
  color: var(--fp-green);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Card grid (3 / 2 / 1 columns)
   -------------------------------------------------------------------------- */
.fp-root .fp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  scroll-margin-top: calc(var(--header-height) + 28px); /* pager click: grid lands below the sticky header */
}

.fp-root .fp-post {
  overflow: hidden;
  border: 1px solid var(--fp-line);
  border-radius: var(--fp-radius);
  background: #fff;
  box-shadow: var(--fp-shadow);
  transition: box-shadow 0.2s;
}

.fp-root .fp-post:hover {
  box-shadow: var(--fp-shadow-hover);
}

.fp-root .fp-post__link {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.fp-root .fp-post__thumb {
  position: relative;
}

.fp-root .fp-post__thumb .fp-media {
  background: var(--fp-paper);
}

.fp-root .fp-post__body {
  padding: 18px 22px 24px;
}

.fp-root .fp-post__title {
  margin-top: 8px;
  font-size: var(--fs-h5);
  font-weight: 700;
  line-height: 1.4;
}

/* kind badge over the thumbnail (Nutrition only) */
.fp-root .fp-kind {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 4px 12px;
  border-radius: var(--fp-radius-pill);
  background: #fff;
  color: var(--fp-leaf);
  font-size: var(--fs-small);
  font-weight: 700;
  line-height: 1.5;
}

/* empty state */
.fp-root .fp-empty {
  grid-column: 1 / -1;
  padding: 56px 24px;
  border: 1px dashed var(--fp-line);
  border-radius: var(--fp-radius);
  background: #fff;
  text-align: center;
  color: var(--fp-muted);
}

.fp-root .fp-empty .fp-icon {
  display: block;
  margin: 0 auto 10px;
  font-size: var(--fs-h2);
  color: var(--fp-gold);
}

/* --------------------------------------------------------------------------
   Pager (built by editorial-browser.js: previous, 1..n, next)
   -------------------------------------------------------------------------- */
.fp-root .fp-pager {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: var(--fp-gap-md);
}

.fp-root .fp-pager button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--fp-line);
  border-radius: 50%;
  background: #fff;
  color: var(--fp-ink);
  font-weight: 600;
  cursor: pointer;
}

.fp-root .fp-pager button:hover:not(:disabled) {
  border-color: var(--fp-green);
  color: var(--fp-green);
}

.fp-root .fp-pager button[aria-current] {
  border-color: var(--fp-green);
  background: var(--fp-green);
  color: #fff;
}

.fp-root .fp-pager button:disabled {
  opacity: 0.35;
  cursor: default;
}
