/*
Theme Name: Multialambres B2B
Theme URI: https://www.multi-alambres.com/
Author: Equipo de desarrollo
Description: Tema de bloques para la tienda mayorista de Multialambres Ltda.: catálogo para ferreterías, búsqueda por referencia, pedido rápido y portada con escena 3D.
Version: 0.3.0
Requires at least: 7.0
Requires PHP: 8.3
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: df-b2b
*/

:root {
  color-scheme: light;
  --df-brand: var(--wp--preset--color--brand, #0067be);
  --df-brand-dark: var(--wp--preset--color--brand-dark, #004b8d);
  --df-deep: var(--wp--preset--color--brand-deep, #0a2540);
  --df-ink: var(--wp--preset--color--ink, #0f1e2e);
  --df-muted: var(--wp--preset--color--muted, #55687a);
  --df-line: var(--wp--preset--color--line, #d9e1e8);
  --df-surface: var(--wp--preset--color--surface, #f2f5f8);
  --df-accent: var(--wp--preset--color--accent, #e5891f);
  --df-radius: 14px;
  --df-shadow: var(--wp--preset--shadow--card);
  --df-focus: 0 0 0 3px #fff, 0 0 0 6px var(--df-accent);
}

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { text-underline-offset: .18em; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--df-accent); outline-offset: 2px; }
.wp-site-blocks { min-height: 100vh; display: flex; flex-direction: column; }
.wp-site-blocks > main, .wp-site-blocks > .df-main { flex: 1; }
.wp-site-blocks > *, .df-site-header > *, .df-main--home > *, .wp-site-blocks > * > .df-site-header { margin-block-start: 0 !important; }
.wp-site-blocks > footer, .wp-site-blocks > .wp-block-template-part:last-child { margin-block-start: 0 !important; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------- Encabezado ---------- */
.df-site-header { position: relative; z-index: 30; }
.df-topbar { background: var(--df-deep); color: #c8d8e8; font-size: .82rem; padding-block: .45rem; }
.df-topbar p { margin: 0; }
.df-topbar__links { display: flex; gap: 1.25rem; }
.df-topbar a { color: #fff; text-decoration: none; font-weight: 600; }
.df-topbar a:hover { text-decoration: underline; }
.df-mainbar { background: var(--df-brand); color: #fff; padding-block: .9rem; }
.df-mainbar__inner { gap: clamp(1rem, 3vw, 2.5rem) !important; }
.df-mainbar .wp-block-site-logo img { display: block; height: auto; max-width: 190px; }
.df-mainbar .df-search { flex: 1; max-width: 640px; margin: 0; }
.df-header-actions { gap: .75rem !important; }
.df-header-actions, .df-header-actions a, .df-header-actions button { color: #fff !important; }
.df-header-actions .wc-block-customer-account__account-icon, .df-header-actions svg { fill: currentColor; }
.df-header-actions .wc-block-customer-account a { font-weight: 600; font-size: .92rem; text-decoration: none; }
.df-header-actions .wc-block-mini-cart__button { padding: .4rem; border-radius: 10px; }
.df-header-actions .wc-block-mini-cart__button:hover { background: rgba(255,255,255,.12); }
.df-header-actions .wc-block-mini-cart__badge { background: var(--df-accent) !important; color: var(--df-ink) !important; }
.df-navbar { background: #fff; border-bottom: 1px solid var(--df-line); box-shadow: 0 2px 10px rgba(15,30,46,.04); }
.df-navbar .wp-block-navigation { gap: 0; }
.df-navbar .wp-block-navigation-item__content { display: block; padding: .85rem 1rem; color: var(--df-ink); text-decoration: none; border-bottom: 3px solid transparent; }
.df-navbar .wp-block-navigation-item__content:hover, .df-navbar .current-menu-item > .wp-block-navigation-item__content { color: var(--df-brand); border-bottom-color: var(--df-accent); }
.df-navbar .wp-block-navigation-item:first-child .wp-block-navigation-item__content { padding-left: 0; }

/* ---------- Buscador ---------- */
.df-search { position: relative; max-width: 760px; margin: 1.5rem 0; }
.df-search label { display: block; font-size: .9rem; font-weight: 700; margin-bottom: .5rem; }
.df-search__row { display: flex; gap: 0; border-radius: 12px; box-shadow: 0 1px 0 rgba(15,30,46,.05); }
.df-search input[type="search"] { flex: 1; min-width: 0; padding: .85rem 1rem; border: 2px solid var(--df-line); border-right: 0; border-radius: 12px 0 0 12px; font: inherit; background: #fff; color: var(--df-ink); }
.df-mainbar .df-search input[type="search"] { border-color: #fff; }
.df-search input[type="search"]:focus-visible { outline: none; border-color: var(--df-accent); }
.df-search button { border: 0; border-radius: 0 12px 12px 0; padding: .85rem 1.35rem; background: var(--df-accent); color: var(--df-ink); font: inherit; font-weight: 800; cursor: pointer; }
.df-search button:hover { background: #f29a33; }
.df-search__results { position: absolute; left: 0; right: 0; top: calc(100% + .4rem); z-index: 40; list-style: none; margin: 0; padding: .35rem; background: #fff; border: 1px solid var(--df-line); border-radius: 12px; box-shadow: 0 16px 40px rgba(10,37,64,.18); color: var(--df-ink); }
.df-search__results:empty { display: none; }
.df-search__results li + li { border-top: 1px solid var(--df-surface); }
.df-search__results a { display: flex; justify-content: space-between; gap: .75rem; padding: .7rem .8rem; color: var(--df-ink); text-decoration: none; border-radius: 8px; }
.df-search__results a:hover, .df-search__results a:focus { background: var(--df-surface); outline: none; }
.df-search__results .df-search__empty { padding: .7rem .8rem; color: var(--df-muted); }
.df-search__badge { flex: none; align-self: center; padding: .1rem .5rem; border-radius: 999px; background: var(--wp--preset--color--accent-soft, #fdf0e1); color: #8a4a06; font-size: .75rem; font-weight: 700; }

/* ---------- Botones ---------- */
.wp-block-button.is-style-df-accent .wp-block-button__link { background: var(--df-accent); color: var(--df-ink); }
.wp-block-button.is-style-df-accent .wp-block-button__link:hover { background: #f29a33; color: var(--df-ink); }
.wp-block-button.is-style-df-ghost .wp-block-button__link { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.7); }
.wp-block-button.is-style-df-ghost .wp-block-button__link:hover { background: rgba(255,255,255,.12); color: #fff; }
.wp-block-button.is-style-outline .wp-block-button__link { color: var(--df-brand); box-shadow: inset 0 0 0 2px var(--df-brand); border: 0; background: transparent; }
.wp-block-button__link { transition: background-color .15s ease, transform .15s ease; }
.wp-block-button__link:hover { transform: translateY(-1px); }

/* ---------- Portada ---------- */
.df-eyebrow { margin: 0 0 .6rem; color: var(--df-accent); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.df-hero {
  position: relative; overflow: hidden; color: #fff; padding-block: clamp(2.5rem, 6vw, 5rem);
  background:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(135deg, #0a2540 0%, #004b8d 55%, #0067be 100%);
}
.df-hero::after { content: ""; position: absolute; inset: auto -10% -45% 35%; height: 90%; background: radial-gradient(closest-side, rgba(74,163,255,.35), transparent); pointer-events: none; }
.df-hero__cols { position: relative; z-index: 1; gap: clamp(2rem, 5vw, 4rem) !important; }
.df-hero .df-eyebrow { color: #ffb15c; }
.df-hero__title { color: #fff !important; font-size: clamp(2.2rem, 4.6vw, 3.6rem) !important; max-width: 14ch; margin: 0 0 1rem; }
.df-hero__lead { color: #d3e3f3; font-size: clamp(1.05rem, 1.6vw, 1.25rem); max-width: 34rem; }
.df-hero__actions { margin-top: 1.75rem; gap: .75rem; }
.df-hero__chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.75rem 0 0; padding: 0; list-style: none; }
.df-hero__chips li { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .8rem; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); font-size: .85rem; font-weight: 600; color: #fff; }
.df-hero__chips li::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--df-accent); }
.df-hero3d { position: relative; aspect-ratio: 1 / 1; max-height: 470px; margin-inline: auto; border-radius: 22px; overflow: hidden; background: radial-gradient(circle at 50% 45%, rgba(74,163,255,.28), rgba(10,37,64,.55) 70%); box-shadow: var(--wp--preset--shadow--raised); border: 1px solid rgba(255,255,255,.14); }
.df-hero3d__fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .6s ease; }
.df-hero3d__canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; transition: opacity .8s ease; }
.df-hero3d.is-ready .df-hero3d__canvas { opacity: 1; }
.df-hero3d.is-ready .df-hero3d__fallback { opacity: 0; }
.df-hero3d__badge { position: absolute; left: 1rem; bottom: 1rem; padding: .45rem .8rem; border-radius: 999px; background: rgba(10,37,64,.75); color: #fff; font-size: .8rem; font-weight: 700; backdrop-filter: blur(6px); opacity: 0; transition: opacity .6s ease .3s; }
.df-hero3d.is-ready .df-hero3d__badge { opacity: 1; }

/* ---------- Secciones ---------- */
.df-section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.df-section h2 { margin-top: 0; }
.df-section__head { margin-bottom: 1.75rem; align-items: flex-end !important; }
.df-section__head h2 { margin: 0; }
.df-link-arrow { margin: 0; font-weight: 700; }
.df-link-arrow a { text-decoration: none; }
.df-link-arrow a::after { content: " →"; }
.df-pasos, .df-atencion { background: var(--df-surface); }

.df-cards { gap: 1.25rem !important; }
.df-card { position: relative; background: #fff; border: 1px solid var(--df-line); border-radius: var(--df-radius); overflow: hidden; box-shadow: var(--df-shadow); transition: transform .2s ease, box-shadow .2s ease; }
.df-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(15,30,46,.06), 0 18px 40px rgba(15,30,46,.12); }
.df-card__img { margin: 0 !important; aspect-ratio: 4 / 3; overflow: hidden; background: var(--df-surface); }
.df-card__img a { display: block; height: 100%; }
.df-card__img img { display: block; width: 100%; height: 100% !important; object-fit: cover; transition: transform .4s ease; }
.df-card:hover .df-card__img img { transform: scale(1.04); }
.df-card__title { margin: 1rem 1.1rem .35rem !important; font-size: 1.15rem !important; }
.df-card__title a { color: var(--df-ink); text-decoration: none; }
.df-card__title a::after { content: ""; position: absolute; inset: 0; }
.df-card__text { margin: 0 1.1rem 1.2rem !important; color: var(--df-muted); font-size: .95rem; }

.df-steps { gap: 1.25rem !important; counter-reset: paso; }
.df-step { background: #fff; border: 1px solid var(--df-line); border-radius: var(--df-radius); padding: 1.5rem; }
.df-step h3 { margin: .25rem 0 .4rem; }
.df-step p:last-child { margin: 0; color: var(--df-muted); }
.df-step__num { margin: 0; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border-radius: 12px; background: var(--df-brand); color: #fff; font-weight: 800; }
.df-pasos .wp-block-buttons { margin-top: 1.75rem; }

.df-info { gap: 1.25rem !important; }
.df-info__item { background: #fff; border: 1px solid var(--df-line); border-radius: var(--df-radius); padding: 1.5rem 1.5rem 1.5rem 4.75rem; position: relative; scroll-margin-top: 1.5rem; }
.df-info__item h3 { margin: 0 0 .35rem; }
.df-info__item p { margin: 0; color: var(--df-muted); }
.df-info__item::before { content: ""; position: absolute; left: 1.5rem; top: 1.5rem; width: 2.25rem; height: 2.25rem; background: var(--df-brand); -webkit-mask: var(--df-icon) center / contain no-repeat; mask: var(--df-icon) center / contain no-repeat; }
.df-info__item--envios { --df-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 6h11v9H3zM14 9h4l3 3v3h-7z' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'/%3E%3Ccircle cx='7' cy='17.5' r='1.8' fill='none' stroke='black' stroke-width='1.8'/%3E%3Ccircle cx='17' cy='17.5' r='1.8' fill='none' stroke='black' stroke-width='1.8'/%3E%3C/svg%3E"); }
.df-info__item--tiendas { --df-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 10v10h16V10M3 10l2-6h14l2 6zM9 20v-5h6v5' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.df-info__item--horarios { --df-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M12 7v5l3 2' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }

.df-cta { background: linear-gradient(135deg, #004b8d, #0067be); color: #fff; padding-block: clamp(2.5rem, 6vw, 4rem); }
.df-cta h2 { color: #fff; margin: 0 0 .35rem; }
.df-cta p { margin: 0; color: #d3e3f3; }

/* ---------- Productos (bucle clásico de WooCommerce) ---------- */
.df-destacados > .woocommerce { max-width: var(--wp--style--global--wide-size) !important; width: 100%; }
.woocommerce ul.products, .woocommerce-page ul.products { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; margin: 0 !important; padding: 0; }
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none !important; }
.woocommerce ul.products li.product { position: relative; float: none !important; width: auto !important; margin: 0 !important; padding: 0 0 1.1rem !important; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--df-line); border-radius: var(--df-radius); overflow: hidden; box-shadow: var(--df-shadow); }
.woocommerce ul.products li.product a img { aspect-ratio: 1 / 1; object-fit: cover; margin: 0 0 .9rem !important; background: var(--df-surface); }
.woocommerce ul.products li.product .woocommerce-loop-product__title { padding: 0 1rem !important; font-size: 1rem !important; line-height: 1.35; color: var(--df-ink); font-weight: 700; }
.woocommerce ul.products li.product .price { padding: 0 1rem; margin-top: auto !important; color: var(--df-deep) !important; font-weight: 800; font-size: 1.1rem !important; }
.woocommerce ul.products li.product .button { margin: .75rem 1rem 0 !important; padding: .7rem 1rem !important; border-radius: 10px !important; background: var(--df-brand) !important; color: #fff !important; font-weight: 700 !important; text-align: center; }
.woocommerce ul.products li.product .button:hover { background: var(--df-brand-dark) !important; }
.woocommerce ul.products li.product.outofstock::before { content: "Agotado"; position: absolute; top: .75rem; left: .75rem; z-index: 2; padding: .2rem .6rem; border-radius: 999px; background: var(--df-ink); color: #fff; font-size: .75rem; font-weight: 700; }
.woocommerce span.onsale { background: var(--df-accent); color: var(--df-ink); }

/* ---------- Páginas, formularios y pedido rápido ---------- */
.wp-site-blocks > main:not(.df-main--home) { padding-block: clamp(1.5rem, 4vw, 3rem) clamp(2.5rem, 6vw, 4rem); }
.single-product .product_title, .single-product .wp-block-post-title { font-size: clamp(1.6rem, 2.6vw, 2.25rem) !important; overflow-wrap: normal; word-break: normal; hyphens: manual; }
.single-product .price, .single-product .wc-block-components-product-price { color: var(--df-deep); font-weight: 800; font-size: 1.5rem; }
.woocommerce-breadcrumb, .wc-block-breadcrumbs { font-size: .88rem; color: var(--df-muted); }
.df-main:not(.df-main--home) { padding-block: clamp(2rem, 5vw, 3.5rem); }
.df-page-title { margin-top: 0; }
.woocommerce form .input-text, .woocommerce form select, .df-pedido-rapido__form textarea { border: 1.5px solid #b9c6d2; border-radius: 10px; padding: .7rem .85rem; background: #fff; }
.woocommerce form .input-text:focus, .df-pedido-rapido__form textarea:focus { border-color: var(--df-brand); outline: none; box-shadow: 0 0 0 3px rgba(0,103,190,.18); }
.woocommerce button.button, .woocommerce a.button, .woocommerce input.button { border-radius: 10px; background: var(--df-brand); color: #fff; font-weight: 700; }
.woocommerce button.button:hover, .woocommerce a.button:hover { background: var(--df-brand-dark); color: #fff; }
.df-pedido-rapido { max-width: 780px; background: #fff; border: 1px solid var(--df-line); border-radius: var(--df-radius); padding: clamp(1.25rem, 3vw, 2rem); box-shadow: var(--df-shadow); }
.df-pedido-rapido__form label { display: block; font-weight: 800; margin-bottom: .25rem; }
.df-pedido-rapido__ayuda { margin: 0 0 .75rem; color: var(--df-muted); font-size: .92rem; }
.df-pedido-rapido__form textarea { box-sizing: border-box; width: 100%; font: .95rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.df-pedido-rapido__form button { margin-top: .9rem; border: 0; border-radius: 10px; padding: .85rem 1.4rem; background: var(--df-brand); color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.df-pedido-rapido__form button:hover { background: var(--df-brand-dark); }

/* ---------- Pie de página ---------- */
.df-site-footer { background: var(--df-deep); color: #c8d8e8; padding-block: clamp(2.5rem, 6vw, 4rem) 1.5rem; margin-top: 0; }
.df-site-footer a { color: #fff; text-decoration: none; }
.df-site-footer a:hover { text-decoration: underline; }
.df-footer-cols { gap: 2rem !important; }
.df-footer-title { color: #fff; font-size: .8rem !important; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 1rem; }
.df-footer-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; font-size: .95rem; }
.df-footer-lead { font-size: .95rem; max-width: 22rem; }
.df-social { margin-top: 1rem; }
.df-footer-legal { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid rgba(255,255,255,.12); font-size: .82rem; color: #9fb3c8; }
.df-footer-legal p { margin: 0; }

/* ---------- Adaptación a pantallas pequeñas ---------- */
@media (max-width: 1024px) {
  .woocommerce ul.products, .woocommerce-page ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 781px) {
  .df-topbar { display: none; }
  .df-mainbar { padding-block: .7rem; }
  .df-mainbar__inner { flex-wrap: wrap !important; row-gap: .7rem !important; column-gap: .75rem !important; }
  .df-mainbar .wp-block-site-logo img { max-width: 148px; }
  .df-mainbar .df-search { order: 3; flex-basis: 100%; max-width: none; }
  .df-header-actions .wc-block-customer-account__label, .df-header-actions .wc-block-customer-account__link > :not(.wc-block-customer-account__visual) { display: none; }
  .df-navbar .wp-block-navigation__responsive-container-open::after { content: "Menú"; margin-left: .4rem; font-weight: 700; }
  .df-navbar .wp-block-navigation__responsive-container-open { padding: .75rem 0; color: var(--df-ink); }
  .df-hero__media { order: -1; }
  .df-hero3d { max-height: 300px; aspect-ratio: 16 / 10; }
  .woocommerce ul.products, .woocommerce-page ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .df-info__item { padding-left: 4.25rem; }
}
@media (max-width: 480px) {
  .df-search__row { flex-direction: row; }
  .df-search button { padding-inline: 1rem; }
  .woocommerce ul.products li.product .button { margin-inline: .6rem !important; font-size: .85rem !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
