/* ==========================================================================
   D2W motion + responsive refinements (loaded after the theme CSS).
   Reveal animations only apply when d2w-motion.js has added .d2w-motion to <html>,
   so content is never hidden if JavaScript is off.
   ========================================================================== */

/* ---------- Scroll reveal ---------- */
.d2w-motion [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  transition: opacity .7s cubic-bezier(.2, .65, .3, 1), transform .7s cubic-bezier(.2, .65, .3, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.d2w-motion [data-reveal="left"] { transform: translate3d(-32px, 0, 0); }
.d2w-motion [data-reveal="right"] { transform: translate3d(32px, 0, 0); }
.d2w-motion [data-reveal="zoom"] { transform: scale(.96); }
.d2w-motion [data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- One-off fades ---------- */
@keyframes d2wFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes d2wFadeOnly { from { opacity: 0; } to { opacity: 1; } }
.d2w-fade-in { animation: d2wFadeIn .45s ease both; }
.d2w-tab-enter > * { animation: d2wFadeIn .4s ease both; }

/* Hero text rises in on first paint (no JS needed, short so it never delays reading). */
.sec-1 .container > * { animation: d2wFadeIn .8s cubic-bezier(.2, .65, .3, 1) both; }
.sec-1 .container > *:nth-child(2) { animation-delay: .08s; }
.sec-1 .container > *:nth-child(3) { animation-delay: .16s; }
.sec-1 .container > *:nth-child(4) { animation-delay: .24s; }
.sec-1 .container > *:nth-child(5) { animation-delay: .32s; }
.sec-1 .container > *:nth-child(6) { animation-delay: .4s; }
.page-title .container { animation: d2wFadeIn .6s ease both; }

/* ---------- Smooth hover transitions ---------- */
a.btn.all-btn, .btn.all-btn, a.open-offer-popup, .btn.info-btn, .membership-cta, .tnp-submit, .d2w-contact-submit, #submit-button {
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, filter .2s ease;
}
a.btn.all-btn:hover, .btn.all-btn:hover, a.open-offer-popup:hover, .btn.info-btn:hover, .membership-cta:hover, .tnp-submit:hover, .d2w-contact-submit:hover, #submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(189, 109, 0, .28);
}
.partner-photo img, .d2w-svc-media img, .info-box-icon img, .d2w-service-slide img, .d2w-shop-card img {
  transition: transform .5s cubic-bezier(.2, .65, .3, 1), filter .3s ease;
}
/* Zoom only where the image sits in its own clipped box; elsewhere just brighten, so layouts don't change. */
.d2w-svc-box:hover .d2w-svc-media img { transform: scale(1.04); }
.partner-photo:hover img, .d2w-service-slide:hover img, .d2w-shop-card:hover img { filter: brightness(1.1); }
.icon-card, .d2w-pi-card, .d2w-pi-pillar, .testimino-back, .d2w-shop-card {
  transition: transform .3s ease, box-shadow .3s ease;
}
.icon-card:hover, .d2w-pi-card:hover, .d2w-pi-pillar:hover, .d2w-shop-card:hover { transform: translateY(-4px); }
.d2w-nav .nav-link, .dropdown-item, .footer-container a { transition: color .2s ease, background-color .2s ease; }
.d2w-nav .dropdown-menu { animation: d2wFadeIn .2s ease both; }

/* ---------- Public site: small screens ---------- */
@media (max-width: 991.98px) {
  .d2w-header .d2w-logo img { max-height: 84px; width: auto; }
  .d2w-header .navbar-collapse { padding-bottom: 12px; }
  .d2w-header .navbar-collapse.show, .d2w-header .navbar-collapse.collapsing { animation: d2wFadeOnly .25s ease both; }
}
@media (max-width: 575.98px) {
  .d2w-header .d2w-logo img { max-height: 70px; }
  .page-title { min-height: 170px; padding: 40px 0; }
  .page-title .entry-title, .page-title h1 { font-size: 32px !important; line-height: 1.2 !important; }
  .sec-7 { padding: 60px 0; }
  .sec-11 { padding-top: 60px; }
  .sec-11 .sec-intro, .sec-12 .sec-intro, .sec-intro { padding-bottom: 36px; }
  .sec-12 { padding: 50px 0 30px; }
  .testo-inner { min-height: 0 !important; }
  .d2w-contact-page { padding-top: 20px; }
  .newsletter-form { flex-wrap: wrap; gap: 8px; }
  .newsletter-form input, .newsletter-form button { width: 100%; }
}

/* ---------- Affiliate area: collapsible menu on phones/tablets ---------- */
.d2w-dash-menu-toggle { display: none; }
@media (max-width: 991px) {
  #affwp-affiliate-dashboard.maindashboard .colone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px !important;
  }
  #affwp-affiliate-dashboard.maindashboard .colone a.dashboard-logo { margin: 0 !important; padding: 0 !important; }
  #affwp-affiliate-dashboard.maindashboard .colone a.dashboard-logo img { width: 92px !important; }
  .d2w-dash-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid rgba(198, 134, 0, .55);
    border-radius: 10px;
    background: rgba(198, 134, 0, .15);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
  }
  .d2w-dash-menu-bars { display: inline-flex; flex-direction: column; gap: 4px; }
  .d2w-dash-menu-bars span { display: block; width: 18px; height: 2px; background: #e7ab35; border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
  .d2w-dash-menu-toggle[aria-expanded="true"] .d2w-dash-menu-bars span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .d2w-dash-menu-toggle[aria-expanded="true"] .d2w-dash-menu-bars span:nth-child(2) { opacity: 0; }
  .d2w-dash-menu-toggle[aria-expanded="true"] .d2w-dash-menu-bars span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  #affwp-affiliate-dashboard.maindashboard .colone #dash-menu {
    display: none;
    flex: 1 0 100%;
    padding-top: 6px;
  }
  #affwp-affiliate-dashboard.maindashboard .colone #dash-menu.is-open { display: block; animation: d2wFadeIn .25s ease both; }
  #affwp-affiliate-dashboard.maindashboard .colone li { padding: 12px 16px !important; border-radius: 8px; }
  #affwp-affiliate-dashboard .d2w-affwp-table-scroll, #affwp-affiliate-dashboard .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
/* Affiliate area tables become label/value cards on phones. */
@media (max-width: 767px) {
  #affwp-affiliate-dashboard table.d2w-stack-table { min-width: 0 !important; width: 100% !important; }
  #affwp-affiliate-dashboard table.d2w-stack-table thead { display: none; }
  #affwp-affiliate-dashboard table.d2w-stack-table tbody,
  #affwp-affiliate-dashboard table.d2w-stack-table tr { display: block; width: 100%; }
  #affwp-affiliate-dashboard table.d2w-stack-table tr {
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid rgba(198, 134, 0, .28);
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
  }
  #affwp-affiliate-dashboard table.d2w-stack-table td {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    width: 100% !important;
    padding: 7px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, .06) !important;
    text-align: left !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  #affwp-affiliate-dashboard table.d2w-stack-table td:last-child { border-bottom: 0 !important; }
  #affwp-affiliate-dashboard table.d2w-stack-table td[data-th]::before {
    content: attr(data-th);
    color: rgba(255, 255, 255, .6);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
  }
  #affwp-affiliate-dashboard table.d2w-stack-table td:not([data-th]) { display: block; }
  #affwp-affiliate-dashboard table.d2w-stack-table .d2w-visit-status { justify-self: start; }
  #affwp-affiliate-dashboard .d2w-affwp-table-scroll { max-height: none !important; overflow: visible !important; }
}

/* ---------- Admin panel ---------- */
.d2w-admin-content { animation: d2wFadeOnly .35s ease both; }
.adm-loading-fade { transition: opacity .2s ease; }
.adm-loading-fade.is-loading { opacity: .45; pointer-events: none; }
.adm-card, .adm-stat, .adm-page-card { animation: d2wFadeIn .4s ease both; }
.adm-stat { transition: transform .2s ease, border-color .2s ease; }
a.adm-stat:hover { transform: translateY(-2px); border-color: rgba(193, 142, 48, .5); }
.d2w-admin-sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .d2w-admin-sidebar.open + .d2w-admin-sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1025; background: rgba(0, 0, 0, .55); animation: d2wFadeOnly .2s ease both; }
  .d2w-admin-topbar { flex-wrap: wrap; }
  .d2w-admin-title h1 { font-size: 18px; }
  .d2w-admin-actions { width: 100%; }
  .d2w-admin-actions .btn { flex: 1 1 auto; }
  .adm-filters > * { flex: 1 1 140px; max-width: none !important; min-width: 0 !important; }
}
/* Tables turn into stacked cards on phones. */
@media (max-width: 767.98px) {
  .adm-table-stack thead { display: none; }
  .adm-table-stack, .adm-table-stack tbody, .adm-table-stack tr, .adm-table-stack td { display: block; width: 100%; }
  .adm-table-stack tr { padding: 10px 14px; border-bottom: 1px solid var(--adm-border); }
  .adm-table-stack td { padding: 4px 0; border: 0; }
  .adm-table-stack td[data-label] { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 12px; align-items: start; text-align: right; }
  .adm-table-stack td[data-label]::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 4; color: var(--adm-muted); font-size: 12px; text-align: left; }
  .adm-table-stack td[data-label] > * { grid-column: 2; min-width: 0; justify-self: end; }
  .adm-table-stack td.text-end { text-align: left !important; padding-top: 8px; }
  .adm-table-wrap { border-radius: 12px; }
  .adm-image-preview { width: 100%; flex-basis: auto; height: 140px; }
}

/* ---------- Respect "reduce motion" ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .d2w-motion [data-reveal] { opacity: 1; transform: none; }
}
