/*
 * Estilos base de la tarjeta pública. Las plantillas
 * (en templates/NOMBRE/style.css) se cargan después y sobrescriben lo que necesiten.
 * Variables (desde Design::cssVars): --accent --on-accent --text --bg
 * --bg-color --font --fs --radius
 */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.card-page {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    font-size: var(--fs);
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    background-attachment: scroll;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p { overflow-wrap: anywhere; }
button { font: inherit; color: inherit; }
.ic { width: 1.25em; height: 1.25em; flex: 0 0 auto; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

/* Aviso de tarjeta desactivada */
.c-notice {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 10px 16px;
    text-align: center;
    font: 600 14px/1.3 system-ui, sans-serif;
    background: #fff4d6;
    color: #6b4e00;
}

/* ---------- Botones de acción superiores ---------- */
.c-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.c-action {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 50px;
    padding: 12px 10px;
    border-radius: min(var(--radius), 26px);
    font-size: .95em;
    white-space: nowrap;
    border: 1.5px solid color-mix(in srgb, var(--text) 18%, transparent);
    background: color-mix(in srgb, var(--bg-color) 55%, #ffffff);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, filter .15s ease;
}
.c-action--primary {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
}
.c-action:active { transform: scale(.98); }
.c-action:hover { filter: brightness(1.05); }

/* ---------- Bloques ---------- */
.c-blocks { display: flex; flex-direction: column; gap: 12px; }

.b-action {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 58px;
    padding: 12px 20px;
    border-radius: min(var(--radius), 29px);
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: transform .15s ease, filter .15s ease, background-color .15s ease;
}
.b-action:active { transform: scale(.985); }
.b-action__icon { display: grid; place-items: center; }
.b-action__icon .ic { width: 22px; height: 22px; }
.b-action__text { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.b-action__label { font-weight: 600; line-height: 1.25; }
.b-action__sub { font-size: .86em; opacity: .8; line-height: 1.35; margin-top: 2px; overflow-wrap: anywhere; }

/* Estilos de botón elegidos por el usuario */
.btn-filled .b-action { background: var(--accent); color: var(--on-accent); }
.btn-filled .b-action:hover { filter: brightness(1.07); }
.btn-soft .b-action { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--text); }
.btn-soft .b-action .b-action__icon { color: var(--accent); }
.btn-soft .b-action:hover { background: color-mix(in srgb, var(--accent) 19%, transparent); }
.btn-outline .b-action { background: transparent; border-color: var(--accent); color: var(--text); }
.btn-outline .b-action .b-action__icon { color: var(--accent); }
.btn-outline .b-action:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }

.b-heading { margin: 18px 0 2px; font-size: 1.15em; line-height: 1.25; }
.b-heading--lg { font-size: 1.5em; letter-spacing: -0.01em; }
.b-text { line-height: 1.6; }
.align-left { text-align: left; }
.align-center { text-align: center; }

.b-image { margin: 0; }
.b-image img { width: 100%; height: auto; border-radius: min(var(--radius), 22px); }

.b-video__title { margin: 0 0 8px; font-weight: 600; }
.b-video__frame {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: min(var(--radius), 22px);
    overflow: hidden;
    background: #000;
}
.b-video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.b-divider {
    width: 100%;
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--text) 16%, transparent);
    margin: 6px 0;
}
.b-spacer { height: 18px; }

.b-socials { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0; }
.b-social {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 13%, transparent);
    color: var(--accent);
    transition: transform .15s ease;
}
.b-social:hover { transform: translateY(-2px); }
.b-social .ic { width: 22px; height: 22px; }

/* ---------- Pie ---------- */
.c-branding { margin-top: 36px; text-align: center; font-size: 13px; opacity: .6; }
.c-branding a { text-decoration: none; }
.c-branding a:hover { text-decoration: underline; }

/* ---------- Diálogo compartir ---------- */
.c-share {
    width: min(92vw, 380px);
    border: 0;
    border-radius: 22px;
    padding: 18px 18px 20px;
    color: #16181d;
    background: #ffffff;
    font-family: var(--font);
    box-shadow: 0 30px 80px rgba(10, 12, 20, .35);
}
.c-share::backdrop { background: rgba(12, 14, 22, .55); }
.c-share__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.c-share__close { border: 0; background: #f0f1f4; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.c-share__qr { width: 220px; max-width: 100%; margin: 6px auto 14px; }
.c-share__qr svg { width: 100%; height: auto; display: block; }
.c-share__list { display: grid; gap: 8px; }
.c-share__opt {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #e3e5eb;
    border-radius: 12px;
    background: #fff;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}
.c-share__opt:hover { background: #f6f7f9; }
.c-share__opt.is-done { border-color: #127a50; color: #127a50; }

/* ---------- Página de contraseña ---------- */
.c-locked { display: grid; place-items: center; padding: 24px; }
.c-lock {
    width: min(100%, 380px);
    background: color-mix(in srgb, var(--bg-color) 30%, #ffffff);
    border-radius: 24px;
    padding: 32px 26px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(10, 12, 20, .12);
}
.c-lock__icon {
    width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
    display: grid; place-items: center;
    background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
}
.c-lock h1 { margin: 0 0 6px; font-size: 1.4em; }
.c-lock p { margin: 0 0 18px; opacity: .75; }
.c-lock form { display: grid; gap: 10px; }
.c-lock input {
    font: inherit; padding: 13px 14px; border-radius: 12px;
    border: 1.5px solid color-mix(in srgb, var(--text) 20%, transparent); background: #fff; color: #16181d;
}
.c-lock__error { color: #b42318 !important; opacity: 1 !important; margin: 0 !important; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---------- Bloques de la fase 3 ---------- */
.b-section-title { margin: 14px 0 10px; font-size: 1.08em; line-height: 1.3; }
.b-panel, .b-product, .b-quote, .b-form form {
    background: color-mix(in srgb, var(--text) 5%, transparent);
    border-radius: min(var(--radius), 20px);
}

/* Galería */
.b-gallery__grid { display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); }
.b-gallery--grid3 .b-gallery__grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.b-gallery--carousel .b-gallery__grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; padding-bottom: 6px; scrollbar-width: thin; }
.b-gallery--carousel .b-gallery__item { flex: 0 0 78%; aspect-ratio: 4 / 3; scroll-snap-align: center; }
.b-gallery__item { padding: 0; border: 0; background: color-mix(in srgb, var(--text) 8%, transparent); aspect-ratio: 1; border-radius: min(var(--radius), 14px); overflow: hidden; cursor: zoom-in; }
.b-gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.b-gallery__item:hover img { transform: scale(1.03); }
.b-gallery__item:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Vista ampliada */
.c-lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; }
.c-lightbox::backdrop { background: rgba(8, 9, 12, .92); }
.c-lightbox__fig { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 56px 16px 24px; }
.c-lightbox__fig img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: 8px; }
.c-lightbox__fig figcaption { color: #fff; text-align: center; font-size: 15px; max-width: 560px; }
.c-lightbox__btn { position: fixed; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; cursor: pointer; }
.c-lightbox__btn .ic { width: 22px; height: 22px; }
.c-lightbox__close { top: 12px; right: 12px; }
.c-lightbox__prev { left: 10px; top: 50%; transform: translateY(-50%); }
.c-lightbox__next { right: 10px; top: 50%; transform: translateY(-50%); }

/* Productos */
.b-products__list { display: flex; flex-direction: column; gap: 10px; }
.b-product { display: flex; gap: 14px; padding: 12px; align-items: flex-start; }
.b-product__img { width: 88px; height: 88px; object-fit: cover; border-radius: min(var(--radius), 12px); flex: 0 0 auto; }
.b-product__body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.b-product__name { margin: 0; font-size: 1em; line-height: 1.3; }
.b-product__price { margin: 0; font-weight: 700; color: var(--accent); }
.b-product__desc { margin: 0; font-size: .9em; opacity: .85; line-height: 1.45; }
.b-product__btn { align-self: flex-start; margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600; font-size: .9em; }
.b-product__btn .ic { width: 16px; height: 16px; }
.b-products--grid .b-products__list { display: grid; grid-template-columns: repeat(2, 1fr); }
.b-products--grid .b-product { flex-direction: column; }
.b-products--grid .b-product__img { width: 100%; height: auto; aspect-ratio: 1; }

/* Testimonios */
.b-testimonials__track { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: thin; }
.b-quote { margin: 0; flex: 0 0 86%; scroll-snap-align: center; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.b-testimonials__track .b-quote:only-child { flex-basis: 100%; }
.b-quote__stars { color: #f5a524; letter-spacing: 2px; font-size: 1.05em; }
.b-quote__stars span { opacity: .25; }
.b-quote blockquote { margin: 0; line-height: 1.55; font-size: .96em; }
.b-quote figcaption { display: flex; gap: 10px; align-items: center; margin-top: auto; }
.b-quote figcaption img, .b-quote__initial { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.b-quote__initial { display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.b-quote figcaption span { display: flex; flex-direction: column; line-height: 1.3; }
.b-quote figcaption small { opacity: .7; }

/* Formulario */
.b-form__intro { margin: -4px 0 12px; opacity: .85; line-height: 1.5; }
.b-form form { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.b-form__field { display: flex; flex-direction: column; gap: 5px; font-size: .9em; font-weight: 600; }
.b-form__field input, .b-form__field textarea {
    font: inherit; font-weight: 400; font-size: 16px; color: var(--text); width: 100%;
    background: color-mix(in srgb, var(--bg-color) 88%, var(--text) 4%);
    border: 1.5px solid color-mix(in srgb, var(--text) 18%, transparent);
    border-radius: min(var(--radius), 12px); padding: 10px 12px;
}
.b-form__field input:focus, .b-form__field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.b-form__btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; border: 0; border-radius: min(var(--radius), 25px); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; cursor: pointer; }
.b-form__btn[disabled] { opacity: .6; cursor: wait; }
.b-form__btn .ic { width: 18px; height: 18px; }
.b-form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.b-form__error { margin: 0; color: #c0392b; font-weight: 600; font-size: .9em; }
.b-form__ok { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-radius: min(var(--radius), 16px); background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 600; margin: 0; }
.b-form__ok .ic { color: var(--accent); flex: 0 0 auto; }

/* Insignia de perfil verificado */
.c-verified { display: inline-flex; vertical-align: -0.12em; margin-left: .3em; color: #1d9bf0; }
.c-verified svg { width: .9em; height: .9em; }

/* Botones "Guardar contacto / Compartir" al final de los bloques: mismos márgenes que los bloques */
.card-page .c-blocks > .c-actions { margin: 10px 0 0; }
