/* ════════════════════════════════════════════════════════════
   TIENDA — componentes compartidos (home, catálogo, ficha)
   Paleta: variables --clr-* definidas en base.html
════════════════════════════════════════════════════════════ */
:root {
    --tn-ink:  #1C1C1C;
    --tn-sand: #F7F1EB;
    --tn-ease: cubic-bezier(.22, 1, .36, 1);
}
body.bg-white { background: var(--clr-bg); }

/* ── Layout ── */
.tn-wrap { max-width: 80rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px)  { .tn-wrap { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .tn-wrap { padding: 0 2rem; } }
.tn-section { padding-top: 3.5rem; }
@media (min-width: 1024px) { .tn-section { padding-top: 4.5rem; } }

/* ── Encabezado de sección ── */
.tn-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.tn-title { margin: 0; font-size: clamp(1.35rem, 2.2vw, 1.75rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; color: var(--clr-text); }
.tn-sub { margin: .35rem 0 0; font-size: .88rem; color: var(--clr-muted); }
.tn-more {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: .45rem;
    padding: .55rem .95rem; border: 1px solid var(--clr-border); border-radius: 999px; background: #fff;
    font-size: .82rem; font-weight: 700; color: var(--clr-text); text-decoration: none;
    transition: border-color .2s, color .2s;
}
.tn-more i { font-size: .7rem; transition: transform .2s; }
.tn-more:hover { border-color: var(--clr-orange); color: var(--clr-orange); }
.tn-more:hover i { transform: translateX(2px); }

/* ── Grilla de productos ── */
.tn-grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px)  { .tn-grid { gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .tn-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .tn-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
/* Vitrinas: solo filas completas según el número de columnas */
@media (max-width: 639px)                          { .tn-grid--filas > :nth-child(n+7)  { display: none; } }
@media (min-width: 640px) and (max-width: 1023px)  { .tn-grid--filas > :nth-child(n+10) { display: none; } }
@media (min-width: 1024px) and (max-width: 1279px) { .tn-grid--filas > :nth-child(n+9)  { display: none; } }

/* ── Tarjeta de producto ── */
.pc {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid var(--clr-border); border-radius: 1rem; background: #fff;
    transition: border-color .2s, box-shadow .3s, transform .3s var(--tn-ease);
}
.pc:hover { border-color: rgba(229,99,40,.45); box-shadow: 0 16px 34px rgba(28,28,28,.08); transform: translateY(-3px); }
.pc:focus-within { border-color: var(--clr-orange); }
.pc-media { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--tn-sand); }
.pc-media img {
    position: relative; width: 100%; height: 100%; padding: 12%;
    object-fit: contain; mix-blend-mode: multiply;
    transition: transform .6s var(--tn-ease);
}
.pc:hover .pc-media img { transform: scale(1.06); }
.pc-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: #DCD2C9; }
.pc-media.has-img .pc-ph { display: none; }
.pc-badges { position: absolute; top: .6rem; left: .6rem; z-index: 2; pointer-events: none; display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; }
.pc-badge { padding: .22rem .55rem; border-radius: 999px; font-size: .64rem; font-weight: 800; letter-spacing: .01em; }
.pc-badge--off   { background: var(--clr-orange); color: #fff; }
.pc-badge--promo { background: var(--tn-ink); color: #fff; }
.pc-badge--low   { background: #fff; color: var(--clr-orange-2); box-shadow: 0 0 0 1px #F4D2BE inset; }
.pc-body { flex: 1; display: flex; flex-direction: column; gap: .25rem; padding: .85rem .9rem 1rem; }
.pc-brand { margin: 0; font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--clr-muted); }
.pc-name {
    min-height: 2.7em; font-size: .82rem; font-weight: 600; line-height: 1.35; color: var(--clr-text); text-decoration: none;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pc-name::after { content: ''; position: absolute; inset: 0; z-index: 1; }   /* toda la tarjeta es clickeable */
.pc-name:focus-visible { outline: none; }
.pc-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem; margin-top: auto; padding-top: .45rem; }
.pc-prices { min-width: 0; }
.pc-old { display: block; font-size: .74rem; font-weight: 600; color: var(--clr-muted); text-decoration: line-through; }
.pc-price { display: block; font-size: 1.2rem; font-weight: 800; line-height: 1.1; color: var(--clr-text); }
.pc-price--off { color: var(--clr-orange-2); }
.pc-add {
    position: relative; z-index: 2; flex-shrink: 0;
    width: 38px; height: 38px; border: 0; border-radius: .75rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: var(--tn-ink); color: #fff; font-size: .82rem;
    transition: background .2s, transform .15s;
}
.pc-add:hover { background: var(--clr-orange); }
.pc-add:active { transform: scale(.92); }
.pc-add:focus-visible { outline: 2px solid var(--clr-orange); outline-offset: 2px; }
.pc-add.is-loading { opacity: .6; pointer-events: none; }
.pc-add.is-done { background: var(--clr-orange); }

/* ── Aviso "agregado al carrito" ── */
.tn-toast {
    position: fixed; left: 50%; bottom: 1.5rem; z-index: 60;
    display: flex; align-items: center; gap: .85rem; max-width: calc(100vw - 2rem);
    padding: .75rem .75rem .75rem 1.1rem; border-radius: 1rem;
    background: var(--tn-ink); color: #fff; font-size: .86rem; font-weight: 600;
    box-shadow: 0 20px 50px rgba(0,0,0,.3);
    opacity: 0; visibility: hidden; transform: translate(-50%, 1.5rem);
    transition: transform .4s var(--tn-ease), opacity .3s, visibility .3s;
}
.tn-toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.tn-toast-ico { color: var(--clr-orange); }
.tn-toast.is-error .tn-toast-ico { color: #FCA5A5; }
.tn-toast a {
    flex-shrink: 0; padding: .45rem .8rem; border-radius: .6rem; background: var(--clr-orange);
    color: #fff; font-size: .8rem; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.tn-toast.is-error a { display: none; }

/* ── Botones ── */
.tn-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
    padding: .9rem 1.4rem; border: 0; border-radius: .85rem; cursor: pointer; text-decoration: none;
    font-size: .92rem; font-weight: 700; transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.tn-btn:active { transform: scale(.98); }
.tn-btn:disabled { opacity: .55; cursor: not-allowed; }
.tn-btn--primary { background: var(--clr-orange); color: #fff; }
.tn-btn--primary:hover:not(:disabled) { background: var(--clr-orange-2); }
.tn-btn--dark { background: var(--tn-ink); color: #fff; }
.tn-btn--dark:hover:not(:disabled) { background: #333; }
.tn-btn--ghost { background: #fff; color: var(--clr-text); border: 1px solid var(--clr-border); }
.tn-btn--ghost:hover { border-color: var(--clr-orange); color: var(--clr-orange); }

/* ── Migas de pan ── */
.tn-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0; padding: 0; list-style: none; font-size: .78rem; color: var(--clr-muted); }
.tn-crumbs a { color: var(--clr-muted); text-decoration: none; }
.tn-crumbs a:hover { color: var(--clr-orange); }
.tn-crumbs li + li::before { content: '/'; margin-right: .4rem; color: #CFC6BE; }
.tn-crumbs [aria-current] { color: var(--clr-text); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
    .pc, .pc-media img, .tn-toast, .tn-btn { transition: none; }
}
