/**
 * c43 base layout / typography / header foundation.
 * Prefer body.c43-theme scoping. Complements Flatsome Theme Options.
 */

body.c43-theme {
  font-family: var(--c43-font);
  color: var(--c43-text);
  background-color: var(--c43-bg);
}

body.c43-theme #wrapper,
body.c43-theme #main,
body.c43-theme #main.dark {
  background-color: var(--c43-bg);
}

body.c43-theme h1,
body.c43-theme h2,
body.c43-theme h3,
body.c43-theme h4,
body.c43-theme h5,
body.c43-theme h6,
body.c43-theme .heading-font {
  font-family: var(--c43-font);
  color: var(--c43-text);
}

body.c43-theme a {
  color: var(--c43-primary);
}

body.c43-theme a:hover {
  color: var(--c43-highlight);
}

/* Header heights — reinforce Theme Options */
body.c43-theme .header-main {
  height: var(--c43-header-height);
}

body.c43-theme #logo {
  width: var(--c43-logo-width);
}

body.c43-theme #logo img {
  max-height: var(--c43-logo-max);
}

body.c43-theme .header-bottom {
  min-height: var(--c43-header-bottom-height);
  background-color: var(--c43-bg);
}

body.c43-theme .header-bg-color,
body.c43-theme .header-wrapper {
  background-color: var(--c43-bg);
}

body.c43-theme .header.show-on-scroll .header-main,
body.c43-theme .stuck .header-main {
  height: var(--c43-header-height-sticky) !important;
}

body.c43-theme .stuck #logo img {
  max-height: var(--c43-logo-max-sticky) !important;
}

body.c43-theme .header:not(.transparent) .header-bottom-nav.nav > li > a {
  color: var(--c43-text);
}

body.c43-theme .header:not(.transparent) .header-bottom-nav.nav > li > a:hover,
body.c43-theme .header:not(.transparent) .header-bottom-nav.nav > li.active > a,
body.c43-theme .header:not(.transparent) .header-bottom-nav.nav > li.current > a {
  color: var(--c43-nav-hover);
}

body.c43-theme .absolute-footer {
  background-color: var(--c43-bg);
  color: var(--c43-text);
}

body.c43-theme .nav > li > a {
  font-family: var(--c43-font);
}

@media (max-width: 549px) {
  body.c43-theme .header-main {
    height: var(--c43-header-height-sticky);
  }

  body.c43-theme #logo img {
    max-height: var(--c43-logo-max-sticky);
  }
}

/* -------- Prose pages/posts: readable width + side gutters -------- */
body.c43-theme {
  --c43-prose-max: 1080px;
  --c43-prose-gutter: 16px;
}

/* Blank raw-content pages (e.g. khuyến mãi, đăng ký) — no Flatsome container */
body.c43-theme.c43-prose-page #main > .page-header-excerpt,
body.c43-theme.c43-prose-page #main > #content.content-area {
  max-width: var(--c43-prose-max);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--c43-prose-gutter);
  padding-right: var(--c43-prose-gutter);
  box-sizing: border-box;
}

body.c43-theme.c43-prose-page #main > .page-header-excerpt {
  padding-top: 1rem;
}

body.c43-theme.c43-prose-page #content.content-area,
body.c43-theme.c43-prose-post .entry-content {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

body.c43-theme.c43-prose-page #content img,
body.c43-theme.c43-prose-page #content figure,
body.c43-theme.c43-prose-page #content .wp-caption,
body.c43-theme.c43-prose-page #content iframe,
body.c43-theme.c43-prose-page #content table,
body.c43-theme.c43-prose-post .entry-content img,
body.c43-theme.c43-prose-post .entry-content figure,
body.c43-theme.c43-prose-post .entry-content iframe,
body.c43-theme.c43-prose-post .entry-content table {
  max-width: 100% !important;
  height: auto;
}

body.c43-theme.c43-prose-page #content table,
body.c43-theme.c43-prose-post .entry-content table {
  display: block;
  overflow-x: auto;
}

/* TOC must stay inside prose column */
body.c43-theme.c43-prose-page #ez-toc-container,
body.c43-theme.c43-prose-post #ez-toc-container {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
}

/* Dark-friendly TOC on black pages */
body.c43-theme.c43-prose-page #ez-toc-container.ez-toc-grey,
body.c43-theme.c43-prose-post #ez-toc-container.ez-toc-grey {
  background: #1a1b24;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--c43-text);
}

body.c43-theme.c43-prose-page #ez-toc-container .ez-toc-title,
body.c43-theme.c43-prose-page #ez-toc-container a.ez-toc-link,
body.c43-theme.c43-prose-post #ez-toc-container .ez-toc-title,
body.c43-theme.c43-prose-post #ez-toc-container a.ez-toc-link {
  color: var(--c43-text) !important;
}

body.c43-theme.c43-prose-page #ez-toc-container a.ez-toc-link:hover,
body.c43-theme.c43-prose-post #ez-toc-container a.ez-toc-link:hover {
  color: var(--c43-highlight) !important;
}

/* Single posts: ensure Flatsome row has side gutters on small screens */
body.c43-theme.c43-prose-post #content.blog-wrapper {
  padding-left: var(--c43-prose-gutter);
  padding-right: var(--c43-prose-gutter);
  box-sizing: border-box;
}

body.c43-theme.c43-prose-post #content.blog-wrapper > .row {
  max-width: var(--c43-prose-max);
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 549px) {
  body.c43-theme {
    --c43-prose-gutter: 14px;
  }

  body.c43-theme.c43-prose-page #content.content-area p,
  body.c43-theme.c43-prose-page #content.content-area h1,
  body.c43-theme.c43-prose-page #content.content-area h2,
  body.c43-theme.c43-prose-page #content.content-area h3 {
    max-width: 100%;
  }
}
