/* ================================================
   CECCE — Theme Styles
   Author: Freddy Rosell
   Primary: #003570 | Secondary: #199B2D
   ================================================ */

:root {
  --cecce-primary:        #003570;
  --cecce-primary-dark:   #002a5a;
  --cecce-secondary:      #199B2D;
  --cecce-secondary-dark: #157a24;
  --cecce-white:          #FFFFFF;
  --cecce-light:          #F4F6FA;
  --cecce-dark:           #1A1A2E;
  --cecce-muted:          #6B7280;
  --cecce-border:         rgba(0, 53, 112, 0.10);
  --cecce-font:           'Manrope', sans-serif;
  --cecce-radius:         10px;
  --cecce-transition:     0.3s ease;
  /* Customizer-controlled header colors (fallback values) */
  --header-bg:    transparent;
  --nav-color:    #003570;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--cecce-font);
  background-color: #ffffff;
  color: var(--cecce-dark);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

/* ── Header / Navigation ──────────────────────── */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--header-bg);
  transition: background var(--cecce-transition), box-shadow var(--cecce-transition);
}

/* JS adds .over-dark when background is dark */
.site-header.over-dark {
  --nav-color: #ffffff;
}

/* JS adds .over-light when background brightness > threshold (now redundant but kept for clarity) */
.site-header.over-light {
  --nav-color: #003570;
}

/* On scroll: always dark text on light background */
.site-header.scrolled {
  background: rgba(247, 245, 239, 0.92) !important;
  box-shadow: 0 1px 24px rgba(0, 53, 112, 0.10);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  --nav-color: #003570;
}

/* Smooth padding transition on the inner header group */
.site-header > .wp-block-group {
  transition: padding-top var(--cecce-transition), padding-bottom var(--cecce-transition);
}

/* Compact header on scroll */
.site-header.scrolled > .wp-block-group {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

/* ── CECCE Nav block ──────────────────────────── */

.cecce-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.cecce-nav__list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2px;
  align-items: center;
}

/* Top-level links */
.cecce-nav__list > li > a {
  display: block;
  padding: 8px 14px;
  color: var(--nav-color);
  text-decoration: none;
  font-family: var(--cecce-font);
  font-weight: 500;
  font-size: 13.5px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.cecce-nav__list > li > a:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Dropdown arrow indicator */
.cecce-nav__list > li.menu-item-has-children > a {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cecce-nav__list > li.menu-item-has-children > a::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.7;
  flex-shrink: 0;
}

/* Sub-menu dropdown */
.cecce-nav__list li {
  position: relative;
}

.cecce-nav__list .sub-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 53, 112, 0.08);
  border: 1px solid rgba(0, 53, 112, 0.08);
  padding: 8px 0;
  list-style: none;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 200;
}

.cecce-nav__list li:hover > .sub-menu,
.cecce-nav__list li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.cecce-nav__list .sub-menu li > a {
  display: block;
  padding: 11px 20px;
  color: var(--cecce-dark);
  text-decoration: none;
  font-family: var(--cecce-font);
  font-size: 13.5px;
  font-weight: 500;
  border-bottom: 1px solid rgba(0, 53, 112, 0.05);
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.cecce-nav__list .sub-menu li:last-child > a {
  border-bottom: none;
}

.cecce-nav__list .sub-menu li > a:hover,
.cecce-nav__list .sub-menu li.current-menu-item > a {
  color: var(--cecce-secondary);
  background: rgba(25, 155, 45, 0.06);
}

/* Hamburger toggle (mobile) */
.cecce-nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
}

.cecce-nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--nav-color);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease, background 0.3s ease;
}

/* Hamburger → X animation */
.cecce-nav--open .cecce-nav__toggle span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.cecce-nav--open .cecce-nav__toggle span:nth-child(2) {
  opacity: 0;
}
.cecce-nav--open .cecce-nav__toggle span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Arrow injected by JS for mobile parent items — hidden on desktop */
.cecce-nav__item-arrow {
  display: none;
}

/* Slide panel injected by JS — hidden on desktop, shown via mobile CSS */
.cecce-nav__slide-panel {
  display: none;
}

/* Close button injected by JS — hidden on desktop */
.cecce-nav__close-btn {
  display: none;
}

/* Navigation block native styles (keep working with old nav block) */
.wp-block-navigation-item__content {
  color: var(--nav-color) !important;
  font-family: var(--cecce-font);
  font-weight: 500;
  font-size: 13.5px;
  transition: color var(--cecce-transition);
}

.wp-block-navigation-item__content:hover {
  color: rgba(255, 255, 255, 0.7) !important;
}

.wp-block-site-title a {
  color: var(--nav-color) !important;
  text-decoration: none;
}

/* ── Buttons ──────────────────────────────────── */

.wp-block-button__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--cecce-font);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  color: var(--cecce-white);
  background: var(--cecce-primary);
  border: 2px solid var(--cecce-primary);
  border-radius: 50px;
  padding: 12px 28px;
  cursor: pointer;
  transition: all var(--cecce-transition);
  text-decoration: none;
  white-space: nowrap;
}

.wp-block-button__link:hover {
  background: var(--cecce-primary-dark);
  border-color: var(--cecce-primary-dark);
  color: var(--cecce-white);
}

/* ── Main content offset for fixed header ────── */
.wp-site-blocks { padding-top: 0; }

/* ── General section spacing ─────────────────── */
.cecce-section { padding: 80px 0; }

.cecce-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Scrollbar ────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #F4F6FA; }
::-webkit-scrollbar-thumb { background: rgba(0, 53, 112, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cecce-primary); }

::selection { background: rgba(0, 53, 112, 0.15); color: var(--cecce-dark); }

/* ── Mobile ───────────────────────────────────── */
@media (max-width: 768px) {

  /* ── Close button for mobile nav overlay ────── */
  .cecce-nav__close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease, background 0.18s ease;
  }

  .cecce-nav__close-btn.is-visible {
    opacity: 1;
    visibility: visible;
  }

  .cecce-nav__close-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.36);
  }

  /* 98 % content width — overrides root padding & custom containers */
  .wp-site-blocks {
    padding-right: 1% !important;
    padding-left:  1% !important;
  }

  .cecce-container {
    padding-left:  1%;
    padding-right: 1%;
    max-width: 100%;
  }

  /* Show hamburger */
  .cecce-nav__toggle {
    display: flex;
  }

  /* ── First-level panel ──────────────────────── */
  .cecce-nav__list {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100dvh;
    background: var(--cecce-primary);
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 2px;
    z-index: 999;
    overflow-y: auto;
    padding: 96px 36px 52px;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear 0.35s;
  }

  .cecce-nav--open .cecce-nav__list {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear 0s;
  }

  .cecce-nav__list > li {
    width: 100%;
    text-align: right;
  }

  /* First-level links */
  .cecce-nav__list > li > a {
    display: flex;
    width: 100%;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.88) !important;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    padding: 10px 0;
    border-radius: 0;
    background: transparent;
    transition: color 0.15s ease;
  }

  .cecce-nav__list > li > a:hover {
    background: transparent;
    color: #ffffff !important;
  }

  .cecce-nav__list > li.current-menu-item > a,
  .cecce-nav__list > li.current-menu-ancestor > a {
    color: #ffffff !important;
  }

  /* Arrow hidden on mobile — tap opens the slide panel directly */
  .cecce-nav__item-arrow {
    display: none;
  }

  /* Desktop dropdown chevron: hidden on mobile */
  .cecce-nav__list > li.menu-item-has-children > a::after {
    display: none;
  }

  /* Sub-menus: hidden — shown via slide panel */
  .cecce-nav__list .sub-menu {
    display: none !important;
  }

  /* ── Slide panel (second-level) ─────────────── */
  .cecce-nav__slide-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background: var(--cecce-primary-dark, #002a5a);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-end;
    padding: 96px 36px 52px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
  }

  .cecce-nav__slide-panel.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  /* Back button — top left corner */
  .cecce-nav__back {
    position: absolute;
    top: 24px;
    left: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.88);
    font-family: var(--cecce-font);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    padding: 9px 16px 9px 10px;
    border-radius: 50px;
    transition: background 0.18s ease, border-color 0.18s ease;
  }

  .cecce-nav__back:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.28);
    color: #ffffff;
  }

  .cecce-nav__back svg {
    flex-shrink: 0;
  }

  /* Section label (parent item name) */
  .cecce-nav__slide-section {
    font-family: var(--cecce-font);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.32);
    margin: 0 0 16px;
    text-align: right;
  }

  /* Sub-item list in slide panel */
  .cecce-nav__slide-list {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
  }

  .cecce-nav__slide-list li a {
    display: block;
    color: rgba(255, 255, 255, 0.82);
    font-family: var(--cecce-font);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    padding: 10px 0;
    text-decoration: none;
    text-align: right;
    transition: color 0.15s ease;
  }

  .cecce-nav__slide-list li a:hover,
  .cecce-nav__slide-list li.current-menu-item a {
    color: #ffffff;
  }

  /* Plataforma Tecnológica — mobile: ocultar icono */
  .cecce-nav__platform-icon {
    display: none;
  }
}

/* ── Plataforma Tecnológica nav button (desktop only) ─────── */
@media (min-width: 769px) {
  .cecce-nav__platform-item > a {
    background: var(--cecce-primary) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .cecce-nav__platform-item > a:hover {
    background: var(--cecce-primary-dark) !important;
    color: #ffffff !important;
  }

  .cecce-nav__platform-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
  }
}

