/* ==========================================================
   motion.css — Motion sloj za Domaći Med
   Čisti CSS, bez biblioteka. Radi uz Bootstrap 5.3 i dark mode.
   Poštuje prefers-reduced-motion (vidi dno fajla).
   ========================================================== */

:root {
    --mo-ease: cubic-bezier(.22,.61,.36,1);
    --mo-dur: .7s;
    --hero-drop: #e8a317;
    --mo-honeycomb: %23d97706;
}
[data-bs-theme="dark"] {
    --hero-drop: #8b5cf6;
}

/* ---------- 1. Scroll reveal ---------- */
[data-reveal] {
    opacity: 0;
    transform: translate3d(0, 28px, 0);
    transition: opacity var(--mo-dur) var(--mo-ease),
                transform var(--mo-dur) var(--mo-ease);
    transition-delay: var(--mo-delay, 0s);
    will-change: opacity, transform;
}
[data-reveal="left"]  { transform: translate3d(-32px, 0, 0); }
[data-reveal="right"] { transform: translate3d(32px, 0, 0); }
[data-reveal="zoom"]  { transform: scale(.94); }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- 2. Naslov po riječima ---------- */
.mo-split .mo-word {
    display: inline-block;
    opacity: 0;
    transform: translate3d(0, .55em, 0) rotate(2deg);
    transition: opacity .55s var(--mo-ease), transform .55s var(--mo-ease);
    transition-delay: var(--mo-delay, 0s);
}
.mo-split.is-visible .mo-word { opacity: 1; transform: none; }

/* ---------- 3. Hero: živi gradijent + saće ---------- */
.hero {
    position: relative;
    background-size: 220% 220%;
    animation: mo-honey-shift 20s ease-in-out infinite;
}
.hero > .container { position: relative; z-index: 2; }

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='56' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%23d97706' stroke-width='2'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34' fill='none' stroke='%23d97706' stroke-width='2'/%3E%3C/svg%3E");
    opacity: .13;
    animation: mo-drift 60s linear infinite;
    pointer-events: none;
    z-index: 1;
}
[data-bs-theme="dark"] .hero::before { opacity: .09; }

@keyframes mo-honey-shift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}
@keyframes mo-drift {
    to { background-position: 560px 1000px; }
}

/* Emoji tegla — lagano "diše" */
.mo-jar {
    display: inline-block;
    animation: mo-breathe 5s ease-in-out infinite;
    transform-origin: 50% 90%;
}
@keyframes mo-breathe {
    0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
    40%      { transform: translateY(-7px) scale(1.05) rotate(-3deg); }
    70%      { transform: translateY(-2px) scale(1.02) rotate(2deg); }
}

/* ---------- 4. Pčele ---------- */
.mo-bee {
    position: absolute;
    font-size: 1.3rem;
    opacity: .8;
    pointer-events: none;
    will-change: transform;
    z-index: 1;
}
.mo-bee--1 { top: 24%; left: 7%;  animation: mo-bee1 17s ease-in-out infinite; }
.mo-bee--2 { top: 62%; right: 9%; animation: mo-bee2 23s ease-in-out infinite; }

@keyframes mo-bee1 {
    0%   { transform: translate(0,0) rotate(0deg); }
    25%  { transform: translate(70px,-22px) rotate(10deg); }
    50%  { transform: translate(135px,16px) rotate(-8deg); }
    75%  { transform: translate(48px,36px) rotate(6deg); }
    100% { transform: translate(0,0) rotate(0deg); }
}
@keyframes mo-bee2 {
    0%   { transform: translate(0,0) rotate(0deg) scaleX(-1); }
    30%  { transform: translate(-90px,26px) rotate(-9deg) scaleX(-1); }
    60%  { transform: translate(-40px,-34px) rotate(7deg) scaleX(-1); }
    100% { transform: translate(0,0) rotate(0deg) scaleX(-1); }
}

/* ---------- 5. Medni rub + kapljice ispod hero sekcije ---------- */
.mo-honeydrip {
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 46px;
    pointer-events: none;
    z-index: 3;
}
.mo-honeydrip svg { display: block; width: 100%; height: 46px; }

.mo-drop {
    position: absolute;
    top: 30px;
    width: 11px; height: 11px;
    border-radius: 50% 50% 58% 58%;
    background: var(--hero-drop);
    opacity: 0;
    animation: mo-drop 7.5s var(--mo-ease) infinite;
}
.mo-drop:nth-child(2) { left: 19%; animation-delay: 0s; }
.mo-drop:nth-child(3) { left: 48%; animation-delay: 2.6s; }
.mo-drop:nth-child(4) { left: 79%; animation-delay: 5.1s; }

@keyframes mo-drop {
    0%   { opacity: 0; transform: translateY(-8px) scale(.4); }
    10%  { opacity: 1; transform: translateY(0) scale(1); }
    18%  { opacity: 1; transform: translateY(2px) scaleY(1.35) scaleX(.78); }
    52%  { opacity: 1; transform: translateY(28px) scaleY(1.2) scaleX(.85); }
    72%  { opacity: 0; transform: translateY(48px) scale(.35); }
    100% { opacity: 0; transform: translateY(48px) scale(.35); }
}

/* ---------- 6. Navbar koji se skuplja ---------- */
.navbar {
    transition: padding .3s var(--mo-ease), box-shadow .3s var(--mo-ease),
                backdrop-filter .3s;
}
.navbar.mo-shrunk {
    padding-top: .2rem;
    padding-bottom: .2rem;
    box-shadow: 0 6px 24px rgba(0,0,0,.09);
}
.navbar-brand { transition: transform .3s var(--mo-ease); display: inline-block; }
.navbar.mo-shrunk .navbar-brand { transform: scale(.9); }

/* ---------- 7. Trust kartice ---------- */
.trust-card {
    transition: transform .3s var(--mo-ease), box-shadow .3s var(--mo-ease),
                border-color .3s;
}
.trust-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,.09);
    border-color: #f59e0b;
}
.trust-card > div:first-child {
    transition: transform .45s var(--mo-ease);
    display: inline-block;
}
.trust-card:hover > div:first-child { transform: translateY(-5px) scale(1.18); }

/* ---------- 8. Proizvodi ---------- */
.product-card { overflow: hidden; }
.product-card .product-img,
.product-card .product-img-placeholder {
    transition: transform .55s var(--mo-ease);
}
.product-card:hover .product-img { transform: scale(1.07); }
.product-card:hover .product-img-placeholder { transform: scale(1.15) rotate(-5deg); }

/* Lab badge — prelaz svjetla */
.badge-lab { position: relative; overflow: hidden; }
.badge-lab::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 32%, rgba(255,255,255,.7) 50%, transparent 68%);
    transform: translateX(-130%);
    animation: mo-shimmer 5s ease-in-out infinite;
}
@keyframes mo-shimmer {
    0%, 72%  { transform: translateX(-130%); }
    100%     { transform: translateX(130%); }
}

/* ---------- 9. Kategorije ---------- */
.kat-pill {
    transition: background .25s, color .25s, border-color .25s,
                transform .22s var(--mo-ease);
}
.kat-pill:hover { transform: translateY(-3px); }
.kat-pill.active { animation: mo-pop .45s var(--mo-ease); }
@keyframes mo-pop {
    0%   { transform: scale(.88); }
    60%  { transform: scale(1.07); }
    100% { transform: scale(1); }
}

/* ---------- 10. Dodavanje u korpu ---------- */
.mo-pressed { animation: mo-press .35s var(--mo-ease); }
@keyframes mo-press {
    0%   { transform: scale(1); }
    40%  { transform: scale(.86); }
    100% { transform: scale(1); }
}

.mo-fly {
    position: fixed;
    z-index: 2000;
    width: 20px; height: 20px;
    border-radius: 50% 50% 58% 58%;
    background: radial-gradient(circle at 32% 30%, #fde68a, #d97706);
    box-shadow: 0 0 16px rgba(245,158,11,.65);
    pointer-events: none;
}
.mo-cart-pulse { animation: mo-cart .55s var(--mo-ease); }
@keyframes mo-cart {
    0%   { transform: scale(1) rotate(0deg); }
    35%  { transform: scale(1.22) rotate(-10deg); }
    65%  { transform: scale(.96) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* ---------- 11. Članci ---------- */
.article-card .article-img { transition: transform .55s var(--mo-ease); }
.article-card { overflow: hidden; }
.article-card:hover .article-img { transform: scale(1.06); }

/* ---------- 12. Dev traka ---------- */
.dev-banner {
    background-image: repeating-linear-gradient(45deg,
        rgba(0,0,0,.07) 0 14px, transparent 14px 28px);
    animation: mo-stripes 9s linear infinite;
}
@keyframes mo-stripes {
    to { background-position: 79px 0; }
}

/* ---------- 13. Mobilno ---------- */
@media (max-width: 768px) {
    .mo-bee { display: none; }
    .mo-honeydrip { height: 30px; }
    .mo-honeydrip svg { height: 30px; }
    .mo-drop { top: 18px; width: 9px; height: 9px; }
    [data-reveal] { transform: translate3d(0, 18px, 0); }
}

/* ---------- 14. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    [data-reveal],
    .mo-split .mo-word {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    .hero, .hero::before, .mo-jar, .badge-lab::after,
    .dev-banner, .mo-bee, .mo-drop, .mo-cart-pulse, .mo-pressed {
        animation: none !important;
    }
    .mo-bee, .mo-drop { display: none !important; }
    .product-card:hover .product-img,
    .product-card:hover .product-img-placeholder,
    .article-card:hover .article-img,
    .trust-card:hover { transform: none !important; }
}
