/* ========================================================================== 
 * 13.78.22 — Context Rail Story Grammar
 * "Đang được quan tâm" is a quiet editorial context surface, not a ranking
 * chart. The underlying trending order remains authoritative; presentation no
 * longer exposes ordinal numbers or gives lower items an artificial demotion.
 * Tablet/mobile keep Feed central by not duplicating this desktop rail inline.
 * ========================================================================== */

.dhvx-story-rail {
  padding-bottom: 22px;
  border-bottom-color: color-mix(in srgb, var(--dhvx-border) 78%, transparent);
}

.dhvx-story-rail > h2 {
  margin: 0 0 13px;
  color: var(--dhvx-text);
  font-size: 14.75px;
  line-height: 1.32;
  font-weight: 740;
  letter-spacing: -.012em;
}

/* The order can still come from the existing trending source, but the public
 * surface reads as a set of stories rather than a numbered league table. */
.dhvx-trending.dhvx-trending--stories {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dhvx-trending.dhvx-trending--stories > li {
  display: block;
  padding: 13px 0;
  border-top: 1px solid color-mix(in srgb, var(--dhvx-border) 66%, transparent);
}

.dhvx-trending.dhvx-trending--stories > li:first-child {
  padding-top: 0;
  border-top: 0;
}

.dhvx-trending.dhvx-trending--stories .dhvx-trending__copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.dhvx-trending.dhvx-trending--stories .dhvx-trending__context {
  display: block;
  margin: 0;
  color: #8b867e;
  font-size: 10.5px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: .005em;
}

.dhvx-trending.dhvx-trending--stories .dhvx-trending__copy > a {
  color: var(--dhvx-text);
  font-family: var(--dhv-editorial-font, Cambria, Georgia, "Times New Roman", serif);
  font-size: 14.75px;
  line-height: 1.38;
  font-weight: 600;
  letter-spacing: -.009em;
  text-wrap: pretty;
  overflow-wrap: anywhere;
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: .16em;
}

.dhvx-trending.dhvx-trending--stories .dhvx-trending__copy > a:hover,
.dhvx-trending.dhvx-trending--stories .dhvx-trending__copy > a:focus-visible {
  color: var(--dhvx-text);
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, var(--dhvx-brand) 56%, transparent);
}

.dhvx-trending.dhvx-trending--stories .dhvx-trending__copy > a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--dhvx-brand) 35%, transparent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Feed desktop: rail remains secondary to the story stream. Equal title weight
 * avoids implying an editorial rank that the presentation itself does not own. */
@media (min-width: 1120px) {
  .dhvx-app[data-dhv-experience="feed"] .dhvx-story-rail > h2 {
    margin-bottom: 13px;
    font-size: 15px;
  }

  .dhvx-app[data-dhv-experience="feed"] .dhvx-trending.dhvx-trending--stories > li {
    display: block;
    padding-block: 13px;
  }

  .dhvx-app[data-dhv-experience="feed"] .dhvx-trending.dhvx-trending--stories .dhvx-trending__copy > a {
    color: var(--dhvx-text);
    font-size: 14.75px;
    line-height: 1.38;
    font-weight: 600;
  }

  .dhvx-app[data-dhv-experience="feed"] .dhvx-trending.dhvx-trending--stories .dhvx-trending__context {
    color: #8b867e;
    font-size: 10.5px;
  }
}

/* Listing/entity desktop uses the same story grammar. There is no numbered
 * treatment when moving between Home, Category, Tag or Author surfaces. */
@media (min-width: 1200px) {
  .dhvx-site-app.is-listing .dhvx-site-context .dhvx-story-rail,
  .dhvx-site-app.is-entity .dhvx-site-context .dhvx-story-rail {
    padding-bottom: 22px;
  }

  .dhvx-site-app.is-listing .dhvx-site-context .dhvx-story-rail > h2,
  .dhvx-site-app.is-entity .dhvx-site-context .dhvx-story-rail > h2 {
    margin-bottom: 13px;
    font-size: 15px;
  }

  .dhvx-site-app.is-listing .dhvx-site-context .dhvx-trending.dhvx-trending--stories > li,
  .dhvx-site-app.is-entity .dhvx-site-context .dhvx-trending.dhvx-trending--stories > li {
    display: block;
    padding-block: 13px;
  }

  .dhvx-site-app.is-listing .dhvx-site-context .dhvx-trending.dhvx-trending--stories .dhvx-trending__copy > a,
  .dhvx-site-app.is-entity .dhvx-site-context .dhvx-trending.dhvx-trending--stories .dhvx-trending__copy > a {
    color: var(--dhvx-text);
    font-family: var(--dhv-editorial-font, Cambria, Georgia, "Times New Roman", serif);
    font-size: 14.5px;
    line-height: 1.39;
    font-weight: 600;
  }
}

/* Tablet is intentionally Feed-first. The right rail is not transplanted into
 * the stream as another module; contextual tabs and the feed remain the route
 * forward. Existing shell rules already hide it, these guards make that
 * presentation contract explicit for the new rail grammar. */
@media (min-width: 768px) and (max-width: 1119px) {
  .dhvx-app[data-dhv-experience="feed"] > .dhvx-right { display: none !important; }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .dhvx-site-app.is-listing > .dhvx-site-context,
  .dhvx-site-app.is-entity > .dhvx-site-context { display: none !important; }
}

/* Mobile keeps one-column discovery. No desktop rail duplication competes with
 * Story Cards or bottom navigation. */
@media (max-width: 767px) {
  .dhvx-app[data-dhv-experience="feed"] > .dhvx-right,
  .dhvx-site-app.is-listing > .dhvx-site-context,
  .dhvx-site-app.is-entity > .dhvx-site-context { display: none !important; }
}

html[data-theme="dark"] .dhvx-story-rail {
  border-bottom-color: color-mix(in srgb, var(--dhvx-border) 82%, transparent);
}
html[data-theme="dark"] .dhvx-trending.dhvx-trending--stories > li {
  border-top-color: color-mix(in srgb, var(--dhvx-border) 72%, transparent);
}
html[data-theme="dark"] .dhvx-trending.dhvx-trending--stories .dhvx-trending__context {
  color: var(--dhvx-text-muted);
}

@media (forced-colors: active) {
  .dhvx-story-rail,
  .dhvx-trending.dhvx-trending--stories > li { border-color: CanvasText; }
  .dhvx-trending.dhvx-trending--stories .dhvx-trending__copy > a:focus-visible {
    outline-color: Highlight;
  }
}

/* ========================================================================== 
 * 13.78.42 — Recommendation Rail Convergence
 * One visual grammar for Core Recommendation Intelligence across Home,
 * Listing/Entity and Reader. This extends the existing context-rail owner;
 * no late override stylesheet is introduced.
 * ========================================================================== */
.dhvx-discovery-rail {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--dhvx-border) 84%, transparent);
  border-radius: 14px;
  background: var(--dhvx-surface, #fff);
  box-shadow: 0 8px 24px rgba(17,17,17,.035);
}
.dhvx-discovery-rail__head { padding: 16px 16px 12px; }
.dhvx-discovery-rail__eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--dhvx-brand, #d72b2f);
  font-size: 10.5px;
  line-height: 1.2;
  font-weight: 780;
  letter-spacing: .065em;
  text-transform: uppercase;
}
.dhvx-discovery-rail__head h2 {
  margin: 0;
  color: var(--dhvx-text);
  font: 750 18px/1.24 var(--dhvx-ui-font, Arial, Helvetica, sans-serif);
  letter-spacing: -.018em;
}
.dhvx-discovery-rail__head p {
  margin: 7px 0 0;
  color: var(--dhvx-text-muted);
  font-size: 12px;
  line-height: 1.45;
}
.dhvx-discovery-rail__list { display: grid; }
.dhvx-discovery-story { border-top: 1px solid color-mix(in srgb, var(--dhvx-border) 68%, transparent); }
.dhvx-discovery-story > a {
  display: grid;
  grid-template-columns: 76px minmax(0,1fr);
  gap: 11px;
  align-items: center;
  padding: 11px 14px;
  color: inherit;
  text-decoration: none;
  transition: background-color .15s ease, transform .15s ease;
}
.dhvx-discovery-story > a:hover,
.dhvx-discovery-story > a:focus-visible { background: color-mix(in srgb, var(--dhvx-surface-soft, #f7f7f8) 78%, white); }
.dhvx-discovery-story > a:focus-visible { outline: 2px solid color-mix(in srgb, var(--dhvx-brand) 38%, transparent); outline-offset: -2px; }
.dhvx-discovery-story__media {
  display: grid;
  place-items: center;
  width: 76px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 10px;
  background: var(--dhvx-surface-soft, #f7f7f8);
}
.dhvx-discovery-story__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dhvx-discovery-story__fallback { display:grid; place-items:center; width:100%; height:100%; color:var(--dhvx-brand); background:linear-gradient(145deg,#fff4f3,#f3f4f6); }
.dhvx-discovery-story__copy { min-width: 0; display: grid; gap: 4px; }
.dhvx-discovery-story__copy strong {
  color: var(--dhvx-text);
  font: 700 14.25px/1.36 var(--dhvx-ui-font, Arial, Helvetica, sans-serif);
  letter-spacing: -.012em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  text-wrap: pretty;
}
.dhvx-discovery-story__copy small { color: var(--dhvx-text-muted); font-size: 10.75px; line-height: 1.3; }
.dhvx-discovery-story__reason {
  width: fit-content;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f2f3f4;
  color: #62676e;
  font-size: 9.75px;
  line-height: 1.2;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dhvx-discovery-story__reason.is-interest { background:#e8f6f3; color:#1d766d; }
.dhvx-discovery-story__reason.is-related { background:#eef3fb; color:#355f9a; }
.dhvx-discovery-story__reason.is-fresh { background:#fff0ef; color:#b52a31; }
.dhvx-discovery-story__reason.is-popular { background:#f3edfb; color:#7650a3; }
.dhvx-discovery-story__reason.is-evergreen { background:#faf2df; color:#8a6628; }
.dhvx-discovery-story__reason.is-thoughtful { background:#eef5ed; color:#4f7651; }
.dhvx-discovery-story.is-featured > a { display:block; padding:0; }
.dhvx-discovery-story.is-featured .dhvx-discovery-story__media { width:100%; aspect-ratio:16/9; border-radius:0; }
.dhvx-discovery-story.is-featured .dhvx-discovery-story__copy { padding:12px 14px 14px; gap:6px; }
.dhvx-discovery-story.is-featured .dhvx-discovery-story__copy strong {
  font-family: var(--dhv-editorial-font, Cambria, Georgia, "Times New Roman", serif);
  font-size: 17px;
  line-height: 1.34;
  font-weight: 650;
  -webkit-line-clamp: 3;
}
.dhvx-discovery-rail__footer { border-top:1px solid color-mix(in srgb,var(--dhvx-border) 68%,transparent); padding:11px 14px 13px; }
.dhvx-discovery-rail__footer a { color:var(--dhvx-text-muted); font-size:11.5px; line-height:1.3; font-weight:700; text-decoration:none; }
.dhvx-discovery-rail__footer a:hover,.dhvx-discovery-rail__footer a:focus-visible { color:var(--dhvx-brand); text-decoration:underline; text-underline-offset:.2em; }

/* Inline recommendation and Reader "for you" blocks use the same reason/meta
 * hierarchy even though their layouts remain appropriate to their surfaces. */
.dhvx-recommend-item__copy { gap:4px; }
.dhvx-recommend-item__reason,
.dhv-for-you-card__reason { color:var(--dhvx-brand, #d72b2f); font-size:10.5px; line-height:1.25; font-weight:750; }
.dhv-for-you-card__copy { min-width:0; display:grid; gap:4px; }
.dhv-for-you-card__copy small { color:var(--dhvx-text-muted, #6b7077); font-size:11px; line-height:1.35; }

html[data-theme="dark"] .dhvx-discovery-rail { background:var(--dhvx-surface); box-shadow:none; }
html[data-theme="dark"] .dhvx-discovery-story__reason { background:color-mix(in srgb,var(--dhvx-surface-soft) 86%,white 14%); color:var(--dhvx-text-muted); }
@media (forced-colors: active) {
  .dhvx-discovery-rail,.dhvx-discovery-story,.dhvx-discovery-rail__footer { border-color:CanvasText; }
  .dhvx-discovery-story__reason { border:1px solid CanvasText; }
}

/* ========================================================================== 
 * 13.78.44 — Right Rail Rhythm + Professional Ad Shell
 *
 * MAINTENANCE OWNER:
 * - This file owns ALL desktop right-rail card spacing and advertising-shell
 *   presentation across Home, Listing/Entity and Reader.
 * - Ad inventory/provider behavior stays in dhv_render_adsense_slot().
 * - Page/grid geometry tokens are declared by the public presentation contract.
 * - Do not add ad-shell overrides to feed-preview, commercial-insertions,
 *   experience-site or route templates. Extend this section instead.
 * ========================================================================== */

/* One rail measure on every desktop surface. The center-facing edge stays
 * aligned to the platform grid so left/right visual gutters match. */
@media (min-width: 1300px) {
  .dhvx-app[data-dhv-experience="feed"] .dhvx-right__inner,
  .dhvx-site-app.is-listing .dhvx-right__inner,
  .dhvx-site-app.is-entity .dhvx-right__inner,
  .dhvx-site-app.is-reader .dhvx-right__inner {
    position: relative;
    top: auto;
    min-width: 0;
    overflow: visible;
  }
  .dhvx-app[data-dhv-experience="feed"] .dhvx-right__flow,
  .dhvx-site-app .dhvx-right__flow,
  .dhvx-app[data-dhv-experience="feed"] .dhvx-right-sticky-stack,
  .dhvx-site-app .dhvx-right-sticky-stack {
    width: min(100%, var(--dhvx-rail-card-width, 300px));
    max-width: var(--dhvx-rail-card-width, 300px);
    margin-left: 0;
    margin-right: auto;
  }
}

/* Recommendation rail and utility/commercial rail cards share one visual
 * language. Feed cards remain intentionally brighter than these rail surfaces. */
.dhvx-discovery-rail,
.dhvx-sticky-ad {
  border: 1px solid var(--dhvx-rail-card-border, #dde1e6);
  border-radius: var(--dhvx-rail-card-radius, 14px);
  background: var(--dhvx-rail-surface, #f7f8f9);
  box-shadow: var(--dhvx-rail-card-shadow, 0 8px 22px rgba(17,24,39,.035));
}
.dhvx-discovery-rail { overflow: hidden; }
.dhvx-discovery-rail__head { background: transparent; }

/* A single sticky offset aligns the late left dock and the right ad surface.
 * The right rail itself scrolls normally; only this ad stack becomes sticky.
 * IMPORTANT: spacing after discovery belongs to the normal-flow container,
 * not the sticky stack. A sticky margin would shift the ad below the left dock. */
.dhvx-right__flow:has(> *) {
  margin-bottom: var(--dhvx-rail-stack-gap, 16px);
}
.dhvx-right-sticky-stack {
  min-width: 0;
  width: 100%;
  max-width: var(--dhvx-rail-card-width, 300px);
  display: grid;
  gap: var(--dhvx-rail-stack-gap, 16px);
  margin-top: 0;
}
@media (min-width: 1200px) {
  /* 13.78.46 READER STICKY CONTAINMENT FIX.
   * Sticky descendants can only travel inside the height of their containing
   * block. Reader previously stretched the outer rail but left .dhvx-right__inner
   * at content height, so the article ad appeared to stay at its original spot.
   * Keep the Reader rail owner tall for the full grid row; do not fix this with
   * route-specific sticky overrides elsewhere. */
  .dhvx-site-app.is-reader > .dhvx-site-context {
    position: relative;
    align-self: stretch;
    min-height: 100%;
  }
  .dhvx-site-app.is-reader .dhvx-right__inner {
    position: relative;
    top: auto;
    min-height: 100%;
    height: 100%;
    max-height: none;
    overflow: visible;
  }
  .dhvx-right-sticky-stack {
    position: sticky;
    top: var(--dhvx-rail-sticky-top, 16px);
    z-index: 2;
  }
  body.admin-bar .dhvx-right-sticky-stack {
    top: var(--dhvx-rail-sticky-top-admin, 48px);
  }
}
@media (min-width: 1120px) and (max-width: 1199px) {
  .dhvx-app[data-dhv-experience="feed"] .dhvx-right-sticky-stack {
    position: static;
    max-width: 100%;
  }
}
@media (max-width: 1119px) {
  .dhvx-right-sticky-stack { display: none !important; }
}

/* Professional ad shell. The label is intentionally neutral and explicit;
 * no editorial CTA is mixed into paid inventory. Google/AdSense creative stays
 * untouched inside the body. */
.dhvx-sticky-ad {
  min-width: 0;
  width: 100%;
  max-width: var(--dhvx-rail-card-width, 300px);
  box-sizing: border-box;
  overflow: hidden;
  padding: 0;
  color: var(--dhvx-text-muted);
}
.dhvx-ad-shell__head {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--dhvx-border) 78%, transparent);
  background: color-mix(in srgb, var(--dhvx-rail-surface, #f7f8f9) 92%, #fff);
}
.dhvx-ad-shell__label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #727981;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 760;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.dhvx-ad-shell__label::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: #a5abb2;
}
.dhvx-ad-shell__body {
  min-width: 0;
  padding: 10px;
  background: #fff;
}
.dhvx-ad-shell__body .dhv-ad-slot,
.dhvx-ad-shell__body .dhvx-ad-slot,
.dhvx-ad-shell__body ins.adsbygoogle {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  overflow: hidden;
}
.dhvx-ad-shell__body ins.adsbygoogle { display: block !important; }
.dhvx-ad-preview__frame {
  width: 100%;
  aspect-ratio: 300 / 250;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed color-mix(in srgb, var(--dhvx-border-strong) 72%, transparent);
  border-radius: 10px;
  background: var(--dhvx-surface-soft, #f6f7f8);
  color: var(--dhvx-text-muted);
  font-size: 10.75px;
}
.dhvx-ad-live:has(ins.adsbygoogle[data-ad-status="unfilled"]),
.dhvx-ad-slot:has(> ins.adsbygoogle[data-ad-status="unfilled"]) { display: none; }

html[data-theme="dark"] .dhvx-discovery-rail,
html[data-theme="dark"] .dhvx-sticky-ad {
  background: var(--dhvx-platform-stage, #1d2024);
  border-color: var(--dhvx-platform-border, #34383d);
  box-shadow: none;
}
html[data-theme="dark"] .dhvx-ad-shell__head,
html[data-theme="dark"] .dhvx-ad-shell__body { background: var(--dhvx-platform-stage, #1d2024); }

@media (forced-colors: active) {
  .dhvx-discovery-rail,
  .dhvx-sticky-ad,
  .dhvx-ad-shell__head,
  .dhvx-ad-preview__frame { border-color: CanvasText; box-shadow: none; }
}

