/*
Theme Name: CacauWP
Theme URI: https://lince.host/themes/cacauwp
Author: Rodrigo Arcres - LINCE
Author URI: https://lince.host
Description: A basic WordPress theme with Bootstrap 5. ZapDicas-style linear feed layout.
Version: 1.12
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cacauwp
*/

:root {
  --primary-color: #d58532;
  --bs-primary: var(--primary-color);
  --bs-btn-border-color: var(--primary-color);
  --secondary-color: #12863d;
  --bs-secondary: var(--secondary-color);
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
}

/* Force the system font stack on every element, including form controls
   (button, input, select, textarea), which don't inherit font-family by default.
   Bootstrap 5 sets its own --bs-body-font-family — this overrides it everywhere. */
*,
*::before,
*::after,
html,
body,
button,
input,
select,
textarea,
optgroup,
.btn,
.form-control,
.navbar,
.navbar-brand,
.navbar-nav,
.nav-link,
.entry-content,
.entry-title,
h1, h2, h3, h4, h5, h6 {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif !important;
}

body a {
  color: var(--bs-primary);
}

.bg-primary {
  background-color: var(--bs-primary) !important;
}

.btn-primary {
  background-color: var(--bs-primary) !important;
}

.border-primary {
  border-color: color-mix(in srgb, var(--bs-primary) 85%, black) !important;
}

.bg-secondary {
  background-color: var(--secondary-color) !important;
}

.text-secondary {
  color: var(--secondary-color) !important;
}

.btn-secondary {
  background-color: var(--secondary-color) !important;
  border-color: var(--secondary-color) !important;
  color: #fff !important;
}

.fs-7 {
  font-size: 0.75rem !important;
}

@media screen and (max-width: 768px) {
  .fs-1 {
    font-size: 1.75rem !important;
  }
}

/* Single article width — keep reading column comfortable */
main.single article {
  max-width: 100%;
}

/* ============================================================
   SECTION TITLE (used on home, archives, related, sidebar)
   ============================================================ */
.section-title {
  display: flex;
  align-items: center;
  color: #000;
  font-weight: 700;
  text-transform: uppercase;
  border-bottom: 2px solid var(--bs-primary);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.section-title::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  background-color: var(--bs-primary);
  margin-right: 10px;
}

/* ============================================================
   POST CARD — LINEAR LIST (ZapDicas-style)
   ============================================================ */
.post-list .post-card:last-child {
  border-bottom: 0 !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.post-card-thumb-link {
  overflow: hidden;
  border-radius: 6px;
}

.post-card-thumb {
  display: block;
  border-radius: 6px;
  transition: transform 0.3s ease;
}

.post-card-thumb-link:hover .post-card-thumb {
  transform: scale(1.03);
}

.post-card-category {
  color: var(--bs-primary);
  letter-spacing: 0.03em;
}

.post-card-category:hover {
  color: color-mix(in srgb, var(--bs-primary) 70%, black);
}

.post-card-title a {
  transition: color 0.2s ease;
}

.post-card-title a:hover {
  color: var(--bs-primary) !important;
}

.post-card-excerpt {
  font-size: 0.95rem;
  line-height: 1.5;
}

.post-card-meta a:hover {
  color: var(--bs-primary) !important;
}

/* ============================================================
   SIDEBAR — Latest News widget
   ============================================================ */
.sidebar {
  position: sticky;
  top: 1rem;
}

.sidebar-widget {
  background: #fff;
}

.sidebar-title {
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--bs-primary);
  padding-bottom: 0.5rem;
  letter-spacing: 0.03em;
}

.sidebar-title::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: var(--bs-primary);
  margin-right: 8px;
}

.sidebar-recent-item:last-child {
  border-bottom: 0 !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.sidebar-recent-item a {
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.sidebar-recent-item a:hover {
  color: var(--bs-primary) !important;
}

@media (max-width: 991.98px) {
  .sidebar {
    position: static;
  }
}

/* ============================================================
   ENTRY CONTENT (single)
   ============================================================ */
.entry-content p {
  color: #46494c;
}

.entry-content h2,
.entry-content h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.entry-thumbnail img {
  max-height: 480px;
  object-fit: cover;
}

/* ============================================================
   HEADER & MENU — Marked hover + animated indicator
   ============================================================ */

/* Header wrapper — slightly more breathing room */
header.position-relative .navbar {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

/* Brand */
.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: opacity 0.2s ease;
  padding: 0;
}

.navbar-brand:hover {
  opacity: 0.85;
}

/* Constrain the logo image so it doesn't blow up the header height.
   The actual max-height is set dynamically by the Customizer (cacauwp_customizer_css)
   via --header-logo-height CSS variable. */
header .navbar-brand img,
header .custom-logo {
  width: auto;
  height: auto;
  display: block;
}

/* Reset link basics inside the menu */
#mainMenu a {
  text-decoration: none;
  color: var(--header-text-color, #fff);
}

/* ----- Desktop nav links ----- */
@media (min-width: 992px) {
  #mainMenu .navbar-nav {
    gap: 0.25rem !important;
    align-items: center;
  }

  #mainMenu .navbar-nav .nav-link,
  #mainMenu .navbar-nav > li > a {
    position: relative;
    padding: 0.55rem 1rem !important;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    color: var(--header-text-color, #fff) !important;
    transition: background-color 0.25s ease, color 0.25s ease;
  }

  /* Animated underline indicator */
  #mainMenu .navbar-nav .nav-link::after,
  #mainMenu .navbar-nav > li > a::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 4px;
    width: 0;
    height: 2px;
    background: var(--header-text-color, #fff);
    transition: width 0.3s ease, left 0.3s ease;
    border-radius: 2px;
  }

  #mainMenu .navbar-nav .nav-link:hover,
  #mainMenu .navbar-nav > li > a:hover,
  #mainMenu .navbar-nav .current-menu-item > a,
  #mainMenu .navbar-nav .current_page_item > a {
    background-color: rgba(255, 255, 255, 0.12);
  }

  #mainMenu .navbar-nav .nav-link:hover::after,
  #mainMenu .navbar-nav > li > a:hover::after,
  #mainMenu .navbar-nav .current-menu-item > a::after,
  #mainMenu .navbar-nav .current_page_item > a::after {
    width: calc(100% - 2rem);
    left: 1rem;
  }
}

/* ----- Mobile nav links ----- */
@media (max-width: 991.98px) {
  #mainMenu {
    margin-top: 0.5rem;
  }

  #mainMenu .navbar-nav {
    gap: 0 !important;
    flex-direction: column;
    width: 100%;
  }

  #mainMenu .navbar-nav > li {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  #mainMenu .navbar-nav > li:last-child {
    border-bottom: 0;
  }

  #mainMenu .navbar-nav .nav-link,
  #mainMenu .navbar-nav > li > a {
    display: block;
    padding: 0.85rem 0.5rem !important;
    font-weight: 600;
    font-size: 1rem;
    color: var(--header-text-color, #fff) !important;
    transition: background-color 0.2s ease, padding-left 0.2s ease;
  }

  #mainMenu .navbar-nav .nav-link:hover,
  #mainMenu .navbar-nav > li > a:hover,
  #mainMenu .navbar-nav .current-menu-item > a,
  #mainMenu .navbar-nav .current_page_item > a {
    background-color: rgba(255, 255, 255, 0.12);
    padding-left: 1rem !important;
  }
}

/* ----- Hamburger toggle: animated to X ----- */
.navbar-toggler {
  border: 0 !important;
  padding: 0.4rem;
  outline: none !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.navbar-toggler:hover,
.navbar-toggler:focus {
  background-color: rgba(255, 255, 255, 0.15);
}

.navbar-toggler svg {
  fill: var(--header-text-color, #fff);
  transition: transform 0.3s ease;
}

.navbar-toggler[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

/* ----- Search toggle button (desktop) ----- */
#search-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

#search-toggle:hover,
#search-toggle:focus {
  background-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

#search-toggle.active {
  background-color: rgba(255, 255, 255, 0.2);
}

#search-toggle svg {
  width: 18px;
  height: 18px;
  fill: var(--header-text-color, #fff) !important;
  transition: transform 0.2s ease;
}

/* ----- Search dropdown panel ----- */
#search-container {
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  z-index: 1000;
  margin-top: 0.5rem;
}

#search-container.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#search-container .search-form {
  padding: 0.75rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

#search-container .form-control {
  border-radius: 6px 0 0 6px;
  font-size: 0.95rem;
}

#search-container .btn {
  border-radius: 0 6px 6px 0;
}

/* ============================================================
   SUBMENU (DROPDOWN) — hover on desktop, click on mobile
   ============================================================ */

/* Chevron icon next to parent items */
.submenu-chevron {
  margin-left: 0.4rem;
  vertical-align: middle;
  transition: transform 0.25s ease;
  display: inline-block;
}

/* Make sure parent item itself doesn't get its underline indicator
   spilling onto the wider submenu region */
#mainMenu .nav-item.has-dropdown {
  position: relative;
}

/* ----- Desktop: hover-open dropdown ----- */
@media (min-width: 992px) {
  #mainMenu .submenu {
    /* Visual */
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 220px;

    /* Position */
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1050;

    /* Animation: hidden by default, fade + slide in on hover */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }

  /* Open on hover OR keyboard focus-within OR explicit .open class */
  #mainMenu .has-dropdown:hover > .submenu,
  #mainMenu .has-dropdown:focus-within > .submenu,
  #mainMenu .has-dropdown.open > .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  /* Rotate chevron when parent is hovered/open */
  #mainMenu .has-dropdown:hover > a .submenu-chevron,
  #mainMenu .has-dropdown:focus-within > a .submenu-chevron,
  #mainMenu .has-dropdown.open > a .submenu-chevron {
    transform: rotate(180deg);
  }

  /* Submenu links */
  #mainMenu .submenu li {
    list-style: none;
  }

  #mainMenu .submenu a {
    display: block;
    padding: 0.6rem 1rem;
    color: #2b2b2b !important;
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
    border-radius: 0;
  }

  #mainMenu .submenu a:hover,
  #mainMenu .submenu .current-menu-item > a {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--bs-primary) !important;
    padding-left: 1.25rem;
  }

  /* Submenu links should NOT use the desktop underline indicator */
  #mainMenu .submenu a::after {
    display: none !important;
  }

  /* Hover-bridge: invisible padding so the cursor doesn't fall into a gap
     when moving from parent to submenu */
  #mainMenu .has-dropdown::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 8px;
    background: transparent;
  }
}

/* ----- Mobile: click-to-toggle submenu ----- */
@media (max-width: 991.98px) {
  #mainMenu .submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: rgba(0, 0, 0, 0.1);
  }

  #mainMenu .has-dropdown.open > .submenu {
    /* Plenty of room for nested items; capped to avoid layout jumps */
    max-height: 500px;
  }

  #mainMenu .has-dropdown > a .submenu-chevron {
    margin-left: auto;
    transition: transform 0.25s ease;
  }

  #mainMenu .has-dropdown.open > a .submenu-chevron {
    transform: rotate(180deg);
  }

  /* Make the parent <a> a flex row so the chevron sits at the end */
  #mainMenu .has-dropdown > a.has-submenu {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
  }

  #mainMenu .submenu li {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  #mainMenu .submenu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--header-text-color, #fff) !important;
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background-color 0.2s ease, padding-left 0.2s ease;
  }

  #mainMenu .submenu a:hover,
  #mainMenu .submenu .current-menu-item > a {
    background-color: rgba(255, 255, 255, 0.1);
    padding-left: 2rem;
  }
}

/* ============================================================
   MOBILE: CENTERED LOGO (Customizer toggle)
   When body has .cacauwp-center-logo-mobile, the logo is centered
   and the hamburger toggle moves to the left edge.
   ============================================================ */
@media (max-width: 991.98px) {
  body.cacauwp-center-logo-mobile .navbar > .container {
    /* Toggle (left)  |  Brand (center)  |  empty spacer (right) */
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.5rem;
  }

  body.cacauwp-center-logo-mobile .navbar-toggler {
    grid-column: 1;
    grid-row: 1;
    order: -1;
    margin-right: 0;
  }

  body.cacauwp-center-logo-mobile .navbar-brand {
    grid-column: 2;
    grid-row: 1;
    margin: 0 auto;
    text-align: center;
  }

  body.cacauwp-center-logo-mobile .navbar-brand img {
    margin: 0 auto;
  }

  /* Collapse panel takes full width below the row */
  body.cacauwp-center-logo-mobile #mainMenu {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  /* Search dropdown panel still anchors right */
  body.cacauwp-center-logo-mobile #search-container {
    grid-column: 1 / -1;
  }
}

/* ============================================================
   PAGINATION (used by paginate_links 'list')
   ============================================================ */
.page-numbers {
  display: flex;
  flex-wrap: wrap;
  padding-left: 0;
  list-style: none;
  justify-content: center;
  gap: 6px;
}

.page-numbers li {
  margin: 0;
}

.page-numbers li span.current,
.page-numbers li a {
  display: block;
  padding: 0.5rem 0.85rem;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  color: var(--bs-primary);
  text-decoration: none;
  background-color: #fff;
  font-size: 0.95rem;
}

.page-numbers li span.current {
  background-color: var(--bs-primary);
  color: #fff;
  border-color: var(--bs-primary);
}

.page-numbers li a:hover {
  background-color: #f8f9fa;
  border-color: var(--bs-primary);
}

.page-numbers.dots,
.page-numbers li span.dots {
  background: transparent;
  border: 0;
  color: #6c757d;
}

/* ============================================================
   AUTHOR BOX (single)
   ============================================================ */
.author-box .author-desc {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ============================================================
   FOOTER — Left-aligned logo + copyright bar with links
   ============================================================ */
.site-footer {
  text-align: left;
}

.site-footer .footer-logo {
  text-align: left;
}

/* WP custom logo wrapper is centered by default — override */
.site-footer .footer-logo .custom-logo-link {
  display: inline-block;
  margin: 0;
}

.site-footer .footer-logo img,
.site-footer .footer-logo .custom-logo {
  margin: 0;
  width: auto;
  height: auto;
  /* max-height is set dynamically by the Customizer via --footer-logo-height */
  /* Force the logo to render in white regardless of its original colors,
     so it always contrasts with the dark footer background.
     Works for solid-color logos (PNG/SVG); gradient logos may render flat. */
  filter: brightness(0) invert(1);
}

.site-footer .footer-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
}

.site-footer .footer-text a {
  color: inherit;
  text-decoration: underline;
}

/* Copyright bar */
.site-footer .footer-bottom {
  font-size: 0.9rem;
}

.site-footer .footer-copyright {
  color: rgba(255, 255, 255, 0.75);
}

/* Footer menu links */
.site-footer .footer-menu {
  list-style: none;
  padding: 0;
}

.site-footer .footer-menu li {
  list-style: none;
}

.site-footer .footer-menu a {
  color: rgba(255, 255, 255, 0.85) !important;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
  padding: 0;
}

.site-footer .footer-menu a:hover {
  color: #fff !important;
  text-decoration: underline;
}

/* ============================================================
   LEGACY (kept for compatibility)
   ============================================================ */
.category-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-title::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--bs-primary);
}

.min-h-200 {
  min-height: 200px;
}

.object-fit-cover-bg {
  background-size: cover;
  background-position: center;
}

.overlay-gradient {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}
