/* =====================================================================
   IQ knihy – KARTY KNÍH v zoznamoch produktov
   Elementor „Products“ widget s classou produkt-filter (domovská stránka),
   súvisiace produkty na stránke knihy (kniha-dalsie) a hocikde s classou kniha-karty.
   Doplnkový obsah karty (obal, štítok, kategória, autor) pridáva inc/kniha-karty.php.
   ===================================================================== */

:is(.produkt-filter,.kniha-dalsie,.kniha-karty){
  --kk-ink:#231A24; --kk-muted:#7A707B; --kk-line:rgba(35,26,36,.1); --kk-gold:#B8964A;
  --kk-ease:cubic-bezier(.22,1,.36,1);
}

/* mriežka – počet stĺpcov ostáva z nastavení widgetu v Elementore */
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) ul.products{gap:34px 20px!important;margin:0!important;padding:0!important}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) ul.products::before,
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) ul.products::after{display:none!important}

/* karta */
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) ul.products li.product{
  position:relative;display:flex!important;flex-direction:column;
  width:auto!important;float:none!important;margin:0!important;padding:0!important;text-align:left!important;
  transition:transform .5s var(--kk-ease);
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) ul.products li.product:hover{transform:translateY(-6px)}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) a.woocommerce-loop-product__link{display:flex;flex-direction:column;color:inherit;text-decoration:none!important}

/* obal obálky – farebný podklad knihy, žiara, 3D obálka */
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .kk__obal{
  position:relative;aspect-ratio:4/5;border-radius:22px;overflow:hidden;
  display:grid;place-items:center;perspective:900px;isolation:isolate;
  background:var(--kk-podklad,#F4EEE7);
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .kk__obal::before{
  content:"";position:absolute;width:70%;aspect-ratio:1;border-radius:50%;z-index:-1;
  background:color-mix(in srgb,var(--kk-ziara,#ffffff) 55%,transparent);
  filter:blur(40px);opacity:.7;transition:transform .8s var(--kk-ease);
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) li.product:hover .kk__obal::before{transform:scale(1.2)}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .kk__obal img{
  position:relative;display:block;width:100%!important;height:auto!important;max-width:none!important;
  margin:0!important;aspect-ratio:auto!important;object-fit:contain;transform:none!important;
  border-radius:2px 6px 6px 2px!important;
  /* tieň cez filter – kreslí sa až s načítanou obálkou; vnútorný tieň = chrbát knihy */
  box-shadow:inset 3px 0 6px rgba(0,0,0,.2);filter:drop-shadow(12px 18px 16px rgba(35,26,36,.32));
}
/* 3D kniha – rovnako ako na stránke knihy (kniha-stranka.css → .kniha-scena):
   plochá obálka natočená do priestoru, z boku strany (bez lesku),
   pri prechode myšou sa kniha natočí rovno k nám a nadvihne */
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .kk__kniha{
  position:relative;display:block;width:58%;transform-style:preserve-3d;
  transform:rotateY(-24deg) rotateX(4deg);transition:transform .9s var(--kk-ease);
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .kk__kniha::before{
  content:"";position:absolute;top:3px;bottom:3px;right:0;width:clamp(12px,9%,26px);
  transform-origin:right center;transform:rotateY(-90deg);
  background:repeating-linear-gradient(90deg,#fffdf7 0 2px,#e7dfcf 2px 3px);
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) li.product:hover .kk__kniha{transform:rotateY(0deg) rotateX(0deg) translateY(-6px) scale(1.03)}

/* štítok (Bestseller, Novinka) + zľava WooCommerce v rovnakom štýle */
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .kk__stitok,
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) span.onsale{
  position:absolute;top:14px;left:14px;right:auto;z-index:2;margin:0!important;min-width:0;min-height:0;
  padding:6px 11px!important;border-radius:999px!important;line-height:1.2!important;
  background:var(--kk-ink)!important;color:#fff!important;
  font-family:"Inter",sans-serif;font-size:.7rem!important;font-weight:700!important;letter-spacing:.06em;text-transform:uppercase;
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) span.onsale{left:auto;right:14px;background:#B76E79!important}

/* text karty */
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .kk__kat{
  display:block;margin:16px 4px 0;
  font-family:"Cinzel",serif;font-size:.68rem;font-weight:600;letter-spacing:.16em;text-transform:uppercase;color:var(--kk-gold);
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .woocommerce-loop-product__title{
  margin:6px 4px 4px!important;padding:0!important;
  font-family:"Open Sans",sans-serif!important;font-weight:700!important;font-size:1.12rem!important;line-height:1.2!important;
  letter-spacing:0!important;text-transform:none!important;color:var(--kk-ink)!important;
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .kk__obal + .woocommerce-loop-product__title{margin-top:16px!important}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .kk__autor{margin:0 4px!important;font-family:"Inter",sans-serif;font-size:.86rem;line-height:1.4;color:var(--kk-muted)}

/* cena vľavo dole, šípka (tlačidlo WooCommerce) vpravo dole */
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .price{
  display:flex!important;align-items:center;min-height:40px;margin:10px 52px 0 4px!important;
  font-family:"Inter",sans-serif!important;font-size:1rem!important;font-weight:700!important;color:var(--kk-ink)!important;
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .price del{opacity:.5;font-weight:400;margin-right:6px}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .price ins{text-decoration:none}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .price .woocommerce-price-suffix{margin-left:6px;font-size:max(10px,.64em);font-weight:400;color:#7A707B;white-space:nowrap}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) .price .woocommerce-price-suffix .amount{font-size:inherit!important;font-weight:inherit!important;color:inherit!important}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) li.product .button{
  position:absolute!important;right:4px;bottom:0;z-index:2;
  width:40px!important;height:40px!important;min-width:0!important;margin:0!important;padding:0!important;
  border:0!important;border-radius:50%!important;background:transparent!important;
  box-shadow:inset 0 0 0 1px var(--kk-line)!important;
  font-size:0!important;line-height:0!important;color:transparent;color:var(--kk-ink)!important;
  display:block!important;overflow:hidden;text-indent:-999px;
  transition:background-color .3s,color .3s,transform .4s var(--kk-ease),box-shadow .3s!important;
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) li.product .button::before{
  content:"";position:absolute;inset:0;margin:auto;width:18px;height:18px;background:currentColor;text-indent:0;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center/contain no-repeat;
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) li.product:hover .button{
  background:var(--kk-ink)!important;color:#fff!important;box-shadow:none!important;transform:rotate(-45deg);
}
/* po pridaní do košíka */
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) li.product .button.loading{opacity:.5}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) li.product .button.added::before{
  -webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E");
  mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E");
}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) li.product .button.added{transform:none}
:is(.produkt-filter,.kniha-dalsie,.kniha-karty) a.added_to_cart{display:none!important}

/* odhalenie pri scrolle – len CSS, prehliadače bez podpory ukážu karty hneď */
@supports (animation-timeline:view()){
  :is(.produkt-filter,.kniha-dalsie,.kniha-karty) ul.products li.product{
    animation:kkUp linear both;animation-timeline:view();animation-range:entry 0% entry 50%;
  }
  @keyframes kkUp{from{opacity:0;translate:0 32px}to{opacity:1;translate:0 0}}
}

@media (max-width:767px){
  :is(.produkt-filter,.kniha-dalsie,.kniha-karty) ul.products{gap:26px 14px!important}
  :is(.produkt-filter,.kniha-dalsie,.kniha-karty) .kk__obal{border-radius:18px}
  :is(.produkt-filter,.kniha-dalsie,.kniha-karty) .woocommerce-loop-product__title{font-size:1rem!important}
  :is(.produkt-filter,.kniha-dalsie,.kniha-karty) .kk__stitok{top:10px;left:10px;font-size:.62rem!important;padding:5px 9px!important}
  :is(.produkt-filter,.kniha-dalsie,.kniha-karty) li.product .button{width:36px!important;height:36px!important}
  :is(.produkt-filter,.kniha-dalsie,.kniha-karty) .price{min-height:36px;margin-right:44px!important;font-size:.92rem!important}
}
@media (prefers-reduced-motion:reduce){
  :is(.produkt-filter,.kniha-dalsie,.kniha-karty) ul.products li.product{animation:none!important}
}
