/*
 * Page layouts (inc/layouts.php). <html> carries data-vc-card, data-vc-header, data-vc-sticky,
 * data-vc-width, data-vc-radius and data-vc-font; the columns of the grids and the arrangement of the
 * home page are built in PHP. Every rule keys on a value other than the default, so the default layout
 * is the base stylesheets alone, apart from the featured home block at the end.
 */

/* ---------- Corners: radii across the stylesheets are written as calc(N * var(--vc-r)) ---------- */

:root {
  --vc-r: 1;
  --vc-pill: 999px;
}

[data-vc-radius="square"] {
  --vc-r: 0.25;
  --vc-pill: 4px;
  --bulma-radius-small: 2px;
  --bulma-radius: 2px;
  --bulma-radius-medium: 3px;
  --bulma-radius-large: 4px;
  --bulma-radius-rounded: 4px;
}

[data-vc-radius="round"] {
  --vc-r: 1.75;
  --bulma-radius-small: 0.4rem;
  --bulma-radius: 0.65rem;
  --bulma-radius-medium: 0.85em;
  --bulma-radius-large: 1.1rem;
}

/* ---------- Font ---------- */

/* The device's own Thai-capable font: nothing to download. */
[data-vc-font="system"] {
  --bulma-family-primary: system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", "Leelawadee UI", Thonburi, Tahoma, sans-serif;
}

/* ---------- Video cards ---------- */

/* Title over the picture on a dark fade; the badges move to the top corners. */
[data-vc-card="overlay"] .thumb-block .post-video {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: calc(5px * var(--vc-r, 1));
}

[data-vc-card="overlay"] .thumb-block .post-thumbnail::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 34%, rgba(0, 0, 0, 0) 62%);
  pointer-events: none;
}

/* No bottom padding: the clamped title would show a sliver of its third line in it. */
[data-vc-card="overlay"] .loop-video .post-header {
  position: absolute;
  right: 0;
  bottom: 0.55rem;
  left: 0;
  z-index: 6;
  margin: 0;
  padding: 0 0.65rem;
}

[data-vc-card="overlay"] .thumb-block .post-header h3 {
  color: #fff !important;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

/* On the dark fade the accent always takes its light shade, whatever the theme. */
[data-vc-card="overlay"] .thumb-block a:hover .post-header h3 {
  color: var(--vc-accent-lite) !important;
}

[data-vc-card="overlay"] .thumb-block .post-category {
  right: auto;
  left: 8px;
}

[data-vc-card="overlay"] .thumb-block .post-duration {
  top: 8px;
  right: 8px;
  bottom: auto;
}

[data-vc-card="overlay"] .thumb-block .post-views {
  top: 34px;
  right: 8px;
  bottom: auto;
  left: auto;
}

/* Small cards on phones keep the title readable: fewer badges, smaller type. */
@media screen and (max-width: 768px) {
  [data-vc-card="overlay"] .thumb-block .post-views {
    display: none;
  }

  [data-vc-card="overlay"] .loop-video .post-header {
    bottom: 0.4rem;
    padding: 0 0.5rem;
  }

  [data-vc-card="overlay"] .thumb-block .post-header h3 {
    font-size: 0.8rem;
    line-height: 1.35;
  }
}

/* Each video in its own raised box. */
[data-vc-card="boxed"] .thumb-block .post-video {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.45rem 0.45rem 0.6rem;
  border: 1px solid var(--vc-border);
  border-radius: calc(10px * var(--vc-r, 1));
  background: var(--vc-surface-2);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

[data-vc-card="boxed"] .thumb-block .post-video:hover,
[data-vc-card="boxed"] .thumb-block .post-video:focus-visible {
  border-color: var(--vc-link);
  box-shadow: 0 8px 20px var(--vc-shadow);
  transform: translateY(-2px);
}

[data-vc-card="boxed"] .thumb-block .post-thumbnail {
  border-radius: calc(6px * var(--vc-r, 1));
}

[data-vc-card="boxed"] .loop-video .post-header {
  margin-top: 0.55rem;
  padding: 0 0.2rem;
}

/* Picture on the left, a longer title on the right. Grids only: the popular strip keeps its cards. */
[data-vc-card="list"] .thumb-block.cell .post-video {
  display: grid;
  grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
}

[data-vc-card="list"] .loop-video.cell .post-header {
  margin-top: 0;
  -webkit-line-clamp: 3;
}

[data-vc-card="list"] .loop-video.cell .post-header h3 {
  font-size: 0.98rem;
  line-height: 1.5;
}

[data-vc-card="list"] .fixed-grid > .grid {
  row-gap: 1.1rem;
}

/* Only the running time on the picture. */
[data-vc-card="clean"] .thumb-block .post-category,
[data-vc-card="clean"] .thumb-block .post-views {
  display: none;
}

[data-vc-card="clean"] .thumb-block .post-duration {
  background: rgba(0, 0, 0, 0.72);
}

[data-vc-card="clean"] .thumb-block .post-duration span {
  color: #fff !important;
}

[data-vc-card="clean"] .loop-video .post-header h3 {
  font-weight: 600;
}

/* ---------- Header ---------- */

/* Logo on its own row in the middle, the menu and search on the row below. */
@media screen and (min-width: 1024px) {
  [data-vc-header="centered"] .site-branding .navbar {
    flex-wrap: wrap;
  }

  [data-vc-header="centered"] .site-branding .navbar-brand {
    flex: 0 0 100%;
    justify-content: center;
  }

  [data-vc-header="centered"] .site-branding .navbar-menu {
    flex: 1 0 100%;
    margin-top: 0.65rem;
  }
}

/* A slimmer header with a smaller logo. */
[data-vc-header="compact"] .site-branding {
  padding: 8px 0 !important;
}

[data-vc-header="compact"] .main-logo img {
  max-height: 48px !important;
}

[data-vc-header="compact"] .site-title-text {
  font-size: 1.3rem;
}

@media screen and (max-width: 999px) {
  [data-vc-header="compact"] .main-logo img {
    max-height: 40px !important;
  }

  [data-vc-header="compact"] .site-title-text {
    font-size: 1.1rem;
  }
}

/* The header stays at the top while the page scrolls, under the WordPress toolbar when there is one. */
[data-vc-sticky="on"] .site-header {
  position: sticky;
  top: var(--wp-admin--admin-bar--height, 0px);
  z-index: 38;
}

[data-vc-sticky="on"] {
  scroll-padding-top: 7rem;
}

/* Below 600px the WordPress toolbar scrolls away with the page. */
@media screen and (max-width: 600px) {
  [data-vc-sticky="on"] .site-header {
    top: 0;
  }
}

/* ---------- Width ---------- */

@media screen and (min-width: 1024px) {
  [data-vc-width="wide"] .container {
    max-width: min(1600px, calc(100% - 2rem)) !important;
  }

  [data-vc-width="full"] .container {
    max-width: calc(100% - 2rem) !important;
  }

  [data-vc-width="wide"] .tags-container,
  [data-vc-width="full"] .tags-container {
    max-width: none;
  }
}

/* ---------- Home page: the featured block (รูปแบบหน้าแรก "ไฮไลต์") ---------- */

.home-featured {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.home-featured.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.home-featured__lead {
  min-width: 0;
}

/* As tall as the ranked column beside it; 16:9 when it stands alone (phones). */
.home-featured__media {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: calc(8px * var(--vc-r, 1));
  background: var(--vc-sunken);
}

.home-featured__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.home-featured__media:hover img {
  transform: scale(1.03);
}

.home-featured__media:focus-visible {
  outline: 2px solid var(--vc-link);
  outline-offset: 3px;
}

.home-featured__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 48%, rgba(0, 0, 0, 0) 75%);
}

.home-featured__body {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.1rem 1.25rem 1.25rem;
}

.home-featured__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.home-featured__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: calc(4px * var(--vc-r, 1));
  background: rgba(0, 0, 0, 0.55);
  color: #fff !important;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

.home-featured__badge.is-accent {
  background: var(--vc-accent);
  color: var(--vc-on-accent) !important;
}

.home-featured__title {
  display: -webkit-box;
  overflow: hidden;
  color: #fff !important;
  font-size: clamp(1.1rem, 2.1vw, 1.6rem);
  font-weight: 700;
  line-height: 1.35;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.home-featured__play {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.15rem;
  border-radius: var(--vc-pill, 999px);
  background: var(--vc-accent);
  color: var(--vc-on-accent) !important;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.home-featured__media:hover .home-featured__play {
  background: var(--vc-accent-strong);
  color: var(--vc-on-strong) !important;
}

.home-featured__list {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.6rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-featured__item a {
  display: grid;
  grid-template-columns: auto minmax(0, 42%) minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem;
  border: 1px solid var(--vc-border);
  border-radius: calc(8px * var(--vc-r, 1));
  background: var(--vc-surface-2);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.home-featured__item a:hover,
.home-featured__item a:focus-visible {
  border-color: var(--vc-link);
  background: var(--vc-surface-3);
}

.home-featured__rank {
  min-width: 1.6rem;
  color: var(--vc-link) !important;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

.home-featured__thumb {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: calc(5px * var(--vc-r, 1));
  background: var(--vc-sunken);
}

.home-featured__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-featured__text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.home-featured__name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--vc-text) !important;
  font-size: 0.9rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.home-featured__item a:hover .home-featured__name {
  color: var(--vc-link) !important;
}

.home-featured__meta {
  color: var(--vc-text-muted) !important;
  font-size: 0.78rem;
}

.home-featured__meta i {
  margin-right: 0.3rem;
}

@media screen and (max-width: 1023px) {
  .home-featured {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media screen and (max-width: 768px) {
  .home-featured__body {
    gap: 0.4rem;
    padding: 0.8rem;
  }

  .home-featured__play {
    display: none;
  }

  .home-featured__badge {
    font-size: 0.7rem;
  }
}
