/*
Theme Name: Carros PF
Author: egluu
Version: 1.2.3
*/

/* ─── Design tokens ──────────────────────────────────────────── */
:root {
  --cpf-primary:        #202C76;
  --cpf-primary-alt:    #7778ad;
  --cpf-surface:        #F8FAFC;
  --cpf-surface-low:    #f6f3f2;
  --cpf-surface-mid:    #f0eded;
  --cpf-on-surface:     #1c1b1b;
  --cpf-muted:          #454651;
  --cpf-outline:        #767682;
  --cpf-outline-subtle: #c6c5d2;
}

/* ─── Container ─────────────────────────────────────────────── */
.cpf-container {
  width: 100%;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 2rem;
  padding-right: 2rem;
}
@media (min-width: 1024px) {
  .cpf-container { padding-left: 64px; padding-right: 64px; }
}

/* ─── Breakout full-width dentro de .cpf-content ───────────── */
.cpf-content .alignfull {
  margin-left:  calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  max-width: 100vw;
  width: 100vw;
}

/* ─── Global resets ──────────────────────────────────────────── */
*:not(.rounded-full), *:not(.rounded-full)::before, *:not(.rounded-full)::after { border-radius: 0 !important; }
.rounded-full { border-radius: 9999px !important; }

body {
  background-color: var(--cpf-surface);
  color: var(--cpf-on-surface);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}


/* ─── Header ─────────────────────────────────────────────────── */
.cpf-header {
  background: #fff;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 50;
}

/* Nav menu reset */
.cpf-nav-list,
.cpf-mobile-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cpf-nav-list {
  display: none;
  align-items: center;
  gap: 2rem;
}
@media (min-width: 1024px) {
  .cpf-nav-list { display: flex; }
}
.cpf-nav-list a {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cpf-on-surface);
  text-decoration: none;
  padding-bottom: 8px;
  transition: color .15s;
}
.cpf-nav-list a:hover { color: var(--cpf-primary); }
.cpf-nav-list .current-menu-item > a,
.cpf-nav-list .current-menu-ancestor > a {
  color: var(--cpf-on-surface);
  text-decoration: underline;
  text-decoration-color: var(--cpf-primary);
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

/* Mobile nav */
.cpf-mobile-nav {
  display: none;
  border-top: 1px solid var(--cpf-outline-subtle);
  padding: 1rem 0;
}
.cpf-mobile-nav.is-open { display: block; }
.cpf-mobile-nav a {
  display: block;
  padding: 0.625rem 0;
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cpf-on-surface);
  text-decoration: none;
  border-bottom: 1px solid var(--cpf-outline-subtle);
}
.cpf-mobile-nav a:last-child { border-bottom: none; }
.cpf-mobile-nav .cpf-btn-primary { color: #fff; }

/* Mobile nav accordion (sub-menu) */
.cpf-mobile-nav .sub-menu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0 0 0.25rem 1rem;
}
.cpf-mobile-nav li.is-open > .sub-menu {
  display: block;
}
.cpf-mobile-nav .sub-menu li a {
  font-size: 10px;
  padding: 0.45rem 0;
  color: var(--cpf-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cpf-mobile-nav .sub-menu li a::before {
  content: '';
  display: block;
  width: 12px;
  height: 1px;
  background: var(--cpf-outline-subtle);
  flex-shrink: 0;
}
/* Accordion head: link + chevron button in one row */
.cpf-mobile-nav .cpf-accordion-head {
  display: flex;
  align-items: stretch;
}
.cpf-mobile-nav .cpf-accordion-head > a {
  flex: 1;
  border-bottom: none;
}
.cpf-mobile-nav .cpf-accordion-btn {
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--cpf-outline);
  transition: color 0.15s;
}
.cpf-mobile-nav .cpf-accordion-btn svg {
  transition: transform 0.2s ease;
}
.cpf-mobile-nav li.is-open > .cpf-accordion-head .cpf-accordion-btn svg {
  transform: rotate(180deg);
}
.cpf-mobile-nav .cpf-accordion-btn:hover { color: var(--cpf-primary); }

/* ─── Footer ─────────────────────────────────────────────────── */
.cpf-footer {
  background: #fff;
  border-top: 1px solid var(--cpf-on-surface);
}
.cpf-footer-widgets .widget-title {
  font-family: 'Source Code Pro', monospace;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--cpf-on-surface);
  margin: 0 0 0.5rem;
}
.cpf-footer-widgets a {
  text-decoration: none;
  transition: color .15s;
  font-family: 'Source Code Pro', monospace;
}
.cpf-footer-widgets :not(.widget-contact) a {
  font-size: 12px;
}
.cpf-footer-widgets a:not(.cpf-btn-outline):hover { color: var(--cpf-primary); }
.cpf-footer-widgets ul { list-style: none; margin: 0; padding: 0; }
.cpf-footer-widgets li { margin-bottom: 0.3rem; }
.cpf-footer-cats li { margin-bottom: 0.15rem;}
.cpf-footer-email { text-transform: none !important; }

/* ─── Legal nav (footer copyright bar) ──────────────────────── */
.cpf-legal-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}
.cpf-legal-nav a {
  font-family: 'Source Code Pro', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cpf-outline);
  text-decoration: none;
  transition: color .15s;
}
.cpf-legal-nav a:hover { color: var(--cpf-primary); }

/* ─── RankMath breadcrumb ────────────────────────────────────── */
.cpf-breadcrumb-wrap .rank-math-breadcrumb p {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--cpf-outline);
}
.cpf-breadcrumb-wrap .rank-math-breadcrumb a {
  color: var(--cpf-outline);
  text-decoration: none;
  transition: color .15s;
}
.cpf-breadcrumb-wrap .rank-math-breadcrumb a:hover { color: var(--cpf-primary); }
.cpf-breadcrumb-wrap .rank-math-breadcrumb .last { color: var(--cpf-primary); }

/* ─── Pagination ─────────────────────────────────────────────── */
.cpf-page-item a,
.cpf-page-item span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  font-weight: 700;
}
.cpf-page-item.bg-on-surface a,
.cpf-page-item.bg-on-surface span { color: #fff; }

/* ─── Category description wysiwyg ──────────────────────────── */
.cpf-cat-description p  { margin-bottom: 0.75rem; }
.cpf-cat-description p:last-child { margin-bottom: 0; }
.cpf-cat-description strong { color: var(--cpf-primary); font-weight: 700; }
.cpf-cat-description h2 {
  font-family: 'Source Code Pro', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--cpf-primary);
  margin: 1.5rem 0 0.5rem;
}

/* ─── WordPress admin bar offset ────────────────────────────── */
.admin-bar .cpf-header { top: 32px; }
@media screen and (max-width: 782px) {
  .admin-bar .cpf-header { top: 46px; }
}
/* Page offset with admin bar + megamenu */
@media (min-width: 1024px) {
  .admin-bar.cpf-has-megamenu #cpf-page {
    padding-top: calc(122px + var(--cpf-megamenu-h, 120px)); /* 90 + 32 + megamenu */
  }
}

/* ─── Product gallery (Slick) ───────────────────────────────── */
.cpf-gallery-main .slick-slide { outline: none; }
.cpf-gallery-main .slick-slide > div { line-height: 0; }

.cpf-slick-prev,
.cpf-slick-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--wp--preset--color--outline, #767682);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  color: var(--wp--preset--color--on-surface, #1c1b1b);
  padding: 0;
}
.cpf-slick-prev { left: 8px; }
.cpf-slick-next { right: 8px; }
.cpf-slick-prev:hover,
.cpf-slick-next:hover {
  background: var(--wp--preset--color--primary);
  border-color: var(--wp--preset--color--primary);
  color: #fff;
}
.cpf-slick-prev svg,
.cpf-slick-next svg { width: 18px; height: 18px; }

.cpf-gallery-nav .slick-track { margin-left: 0; }
.cpf-gallery-nav .cpf-nav-thumb { cursor: pointer; transition: border-color .15s; }
.cpf-gallery-nav .slick-current .cpf-nav-thumb {
  border: 2px solid var(--wp--preset--color--primary) !important;
}
.cpf-gallery-nav .slick-slide:not(.slick-current) .cpf-nav-thumb img:not([class*="absolute"]) {
  opacity: .6;
}

/* Nav arrows — shown only when thumbs overflow (> 4) */
.cpf-gallery-nav--has-arrows .slick-list { margin: 0 30px; }

.cpf-nav-prev,
.cpf-nav-next {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 10;
  width: 28px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--wp--preset--color--outline-subtle, #c6c5d2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  color: var(--wp--preset--color--on-surface, #1c1b1b);
  padding: 0;
}
.cpf-nav-prev { left: 0; }
.cpf-nav-next { right: 0; }
.cpf-nav-prev:hover,
.cpf-nav-next:hover {
  background: var(--wp--preset--color--primary);
  border-color: var(--wp--preset--color--primary);
  color: #fff;
}
.cpf-nav-prev svg,
.cpf-nav-next svg { width: 14px; height: 14px; }

/* ─── Product content wysiwyg ───────────────────────────────── */
.cpf-content a { color: var(--cpf-primary); text-decoration: underline; }

/* ─── CPF Hero block ─────────────────────────────────────────── */

/* Button group: stacked + full-width on mobile, row + auto on sm+ */
.cpf-hero .wp-block-group.is-layout-flex:has(.wp-block-button) {
  flex-direction: column;
}
.cpf-hero .wp-block-button,
.cpf-hero .wp-block-button .wp-block-button__link {
  width: 100%;
  text-align: center;
  justify-content: center;
}
@media (min-width: 640px) {
  .cpf-hero .wp-block-group.is-layout-flex:has(.wp-block-button) {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .cpf-hero .wp-block-button,
  .cpf-hero .wp-block-button .wp-block-button__link {
    width: auto;
  }
}

/* ─── CPF Products Block — reset WP element overrides ───────── */

/* Section heading: undo .cpf-content h4 margins and enforce brand colors */
.cpf-products-block .cpf-section-heading h4 {
  margin: 0;
  color: var(--wp--preset--color--primary);
  text-transform: uppercase;
}

/* "View all" link inside section heading */
.cpf-products-block .cpf-section-heading a {
  text-decoration: none;
  color: var(--wp--preset--color--outline);
}
.cpf-products-block .cpf-section-heading a:hover {
  color: var(--wp--preset--color--primary);
}

/* Product card: reset h3 size/case overridden by theme.json elements */
.cpf-products-block article h3 {
  font-size: var(--wp--preset--font-size--body);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.2;
  margin-top: 0;
}

/* Product card link: undo .cpf-content a underline/color */
.cpf-products-block article a,
.cpf-products-block article a:visited {
  text-decoration: none;
  color: inherit;
}
.cpf-dimensions table { width: 100%; border-collapse: collapse; }
.cpf-dimensions td, .cpf-dimensions th {
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--cpf-outline-subtle);
  font-size: 13px;
}

/* ─── Block styles: core/button ─────────────────────────────── */

.wp-block-button.is-style-primary .wp-block-button__link,
.wp-block-button.is-style-secondary .wp-block-button__link,
.wp-block-button.is-style-negative .wp-block-button__link,
.wp-block-button.is-style-negative-filled .wp-block-button__link,
.wp-block-button.is-style-link .wp-block-button__link,
.wp-block-button.is-style-link-arrow .wp-block-button__link {
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 0;
  transition: background-color .15s, color .15s, border-color .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  text-decoration: none;
}

/* Primary — filled */
.wp-block-button.is-style-primary .wp-block-button__link {
  background-color: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--white);
  border: 2px solid var(--wp--preset--color--primary);
  padding: 0.75rem 1.5rem;
  text-decoration: none;
}
.wp-block-button.is-style-primary .wp-block-button__link:hover {
  background-color: transparent;
  color: var(--wp--preset--color--primary);
}

/* Secondary — outline */
.wp-block-button.is-style-secondary .wp-block-button__link {
  background-color: transparent;
  color: var(--wp--preset--color--primary);
  border: 2px solid var(--wp--preset--color--primary);
  padding: 0.75rem 1.5rem;
  text-decoration: none;
}
.wp-block-button.is-style-secondary .wp-block-button__link:hover {
  background-color: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--white);
}

/* Link */
.wp-block-button.is-style-link .wp-block-button__link,
.wp-block-button.is-style-link-arrow .wp-block-button__link {
  background: none;
  color: var(--wp--preset--color--primary);
  border: none;
  padding: 0;
  text-decoration: none;
}
.wp-block-button.is-style-link .wp-block-button__link:hover,
.wp-block-button.is-style-link-arrow .wp-block-button__link:hover {
  color: var(--wp--preset--color--secondary);
}

/* Link → (chevron) */
.wp-block-button.is-style-link-arrow .wp-block-button__link::after {
  content: '›';
  font-size: 1.6em;
  line-height: 1.6;
  font-weight: 100;
  text-decoration: none;
  display: inline-block;
  padding-left: .25rem;
}

/* Negative — white outline on dark bg */
.wp-block-button.is-style-negative .wp-block-button__link {
  background-color: transparent;
  color: var(--wp--preset--color--white);
  border: 2px solid var(--wp--preset--color--white);
  padding: 0.75rem 1.5rem;
  text-decoration: none;
}
.wp-block-button.is-style-negative .wp-block-button__link:hover {
  background-color: var(--wp--preset--color--white);
  color: var(--wp--preset--color--primary);
}

/* Negative filled — white bg on dark bg */
.wp-block-button.is-style-negative-filled .wp-block-button__link {
  background-color: var(--wp--preset--color--white);
  color: var(--wp--preset--color--primary);
  border: 2px solid var(--wp--preset--color--white);
  padding: 0.75rem 1.5rem;
  text-decoration: none;
}
.wp-block-button.is-style-negative-filled .wp-block-button__link:hover {
  background-color: transparent;
  color: var(--wp--preset--color--white);
}

/* ─── WhatsApp floating button ──────────────────────────────── */
.cpf-wa-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50% !important;
  background: #32cd32;
  color: #fff;
  text-decoration: none;
  transition: transform .3s;
}
.cpf-wa-btn svg {
  display: block;
  filter: drop-shadow(0 0 8px #32cd32);
  width: 60px;
  height: 60px;
}
.cpf-wa-btn:hover,
.cpf-wa-btn:focus,
.cpf-wa-btn:active {
  transform: scale(1.1);
  transform-origin: center;
  text-decoration: none;
}

/* ─── Tailwind layout overrides for Gutenberg blocks ────────── */
/* WP core sets display:flow-root on is-layout-constrained, overriding Tailwind grid/flex */
.wp-block-group.grid { display: grid; }
.wp-block-group.flex { display: flex; }
.wp-block-group.inline-flex { display: inline-flex; }

/* ─── Classic editor (TinyMCE) reset ────────────────────────── */
body.mce-content-body {
  background-color: #ffffff !important;
  padding: 16px !important;
}

/* ─── Contact page ───────────────────────────────────────────── */

/* Map placeholder — add background-image via CSS or inline style to show the map */
.cpf-map-placeholder {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Contact Form 7 ─────────────────────────────────────────────── */
.wpcf7-form p {
  margin-bottom: 1.25rem;
}
.wpcf7-form p:last-child {
  margin-bottom: 0;
}
.wpcf7-form label {
  display: block;
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wp--preset--color--on-surface);
  margin-bottom: 0.35rem;
}
.wpcf7-form .wpcf7-form-control-wrap {
  display: block;
}
.wpcf7-form .wpcf7-form-control {
  width: 100%;
}
/* Submit button — same visual as cpf-btn-primary */
.wpcf7-form input[type="submit"],
.wpcf7-submit {
  background-color: var(--wp--preset--color--primary) !important;
  color: #ffffff !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 12px !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  font-weight: 700 !important;
  padding: 1rem 2rem !important;
  cursor: pointer !important;
  border: none !important;
  border-radius: 0 !important;
  transition: background-color 150ms !important;
}
.wpcf7-form input[type="submit"]:hover,
.wpcf7-submit:hover {
  background-color: var(--wp--preset--color--on-surface) !important;
}
/* Validation error tip */
.wpcf7-not-valid-tip {
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  color: #ba1a1a;
  margin-top: 0.25rem;
  display: block;
}
/* Response output (success / error) */
.wpcf7-response-output {
  border: none !important;
  margin: 1rem 0 0 !important;
  padding: 0.75rem 1rem !important;
  font-family: 'Source Code Pro', monospace !important;
  font-size: 11px !important;
  border-left-width: 3px !important;
  border-left-style: solid !important;
}
.wpcf7-form.sent .wpcf7-response-output {
  background-color: #f0f9f0;
  color: #1a5c1a;
  border-left-color: #1a5c1a !important;
}
.wpcf7-form.failed .wpcf7-response-output,
.wpcf7-form.invalid .wpcf7-response-output,
.wpcf7-form.spam .wpcf7-response-output {
  background-color: #fff5f5;
  color: #ba1a1a;
  border-left-color: #ba1a1a !important;
}

/* ─── Megamenu ───────────────────────────────────────────────── */
#cpf-megamenu {
  display: none; /* mobile: hidden */
}

/* Admin bar offset for megamenu (desktop only — mobile megamenu is hidden) */
.admin-bar #cpf-megamenu { top: 122px; } /* 90 + 32 */

@media (min-width: 1024px) {
  #cpf-megamenu {
    display: block;
    position: fixed;
    top: 90px;
    left: 0;
    width: 100%;
    z-index: 48;
    background: #fff;
    border-bottom: 1px solid #c6c5d2;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.15s ease;
  }

  #cpf-megamenu.is-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    pointer-events: none;
  }

  /* Extra page top offset to clear the megamenu bar.
     --cpf-megamenu-h is set via JS once the bar is rendered.
     The 120px fallback is an approximation to avoid layout jump. */
  body.cpf-has-megamenu #cpf-page {
    padding-top: calc(90px + var(--cpf-megamenu-h, 120px));
  }

  .cpf-megamenu-track {
    display: flex;
  }

  .cpf-megamenu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 1rem 0.75rem;
    text-decoration: none;
    transition: background-color 0.15s;
  }

  .cpf-megamenu-item:hover {
    background-color: var(--wp--preset--color--surface-mid);
  }

  .cpf-megamenu-img {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .cpf-megamenu-img img {
    max-height: 72px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
  }

  .cpf-megamenu-label {
    font-family: 'Source Code Pro', monospace;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--wp--preset--color--on-surface);
    text-align: center;
    margin-top: 0.5rem;
    line-height: 1.3;
  }
}
