/*
 * Motion: hover, press and entrance effects that make the interface feel alive.
 * Styling only — loaded last, changes no layout (transforms don't move neighbours) and no behaviour.
 * Everything here is switched off for people who ask their system for reduced motion.
 */
:root {
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);   /* a small overshoot, like a soft bounce */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --shadow-hover: 0 14px 34px rgba(6, 95, 70, .16), 0 3px 8px rgba(17, 24, 39, .06);
}

/* People who ask their system for less motion get none of this. */
@media (prefers-reduced-motion: no-preference) {

  /* ------------------------------------------------------------ buttons: grow on hover, sink when pressed */
  .btn, .icon-btn, .chip, .quick, .icon-choice, .check-chip, .site-header nav a, .site-header .login-avatar,
  .topbar .user, .side-item, .menu-pop button, .sheet-item, .lang-btn {
    transition: transform .22s var(--ease-spring), background-color .2s, border-color .2s, color .2s, box-shadow .25s, filter .2s;
  }
  .btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.04); box-shadow: 0 8px 20px rgba(6, 95, 70, .18); }
  .btn.text:hover:not(:disabled) { box-shadow: none; }
  .btn:active:not(:disabled) { transform: translateY(0) scale(.95); box-shadow: none; transition-duration: .08s; }
  .btn .icon { transition: transform .25s var(--ease-spring); }
  .btn:hover:not(:disabled) .icon { transform: scale(1.15); }

  .icon-btn:hover:not(:disabled) { transform: scale(1.14); }
  .icon-btn:hover:not(:disabled) .icon { color: var(--primary); }
  .sidebar .icon-btn:hover:not(:disabled) .icon, .announcement-bar .icon-btn:hover .icon,
  .bubble-row.mine .bubble .icon-btn:hover .icon, .icon-btn.filled:hover .icon { color: inherit; }
  .icon-btn:active:not(:disabled) { transform: scale(.88); transition-duration: .08s; }

  .chip:hover { transform: translateY(-2px) scale(1.06); border-color: var(--primary); color: var(--primary); }
  .chip[aria-pressed="true"]:hover, .chip.on-dark:hover { color: #fff; }
  .chip:active { transform: scale(.94); transition-duration: .08s; }

  /* A soft ring that spreads out from a pressed button. */
  .btn:not(:disabled):active, .icon-btn:not(:disabled):active, .chip:active, .quick:active {
    animation: press-ring .45s ease-out;
  }
  @keyframes press-ring {
    from { box-shadow: 0 0 0 0 rgba(16, 185, 129, .45); }
    to { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
  }

  /* ------------------------------------------------------------ cards: lift, grow and glow on hover */
  .site-card, .pic-card, .feature, .feature2, .stat-tile, .quick, .fee-tile, .help-item.card, .card.clickable,
  a.card, .plan-card, .icon-choice, .next-slot, .site-stats .stat, .juz {
    transition: transform .3s var(--ease-spring), box-shadow .3s var(--ease-out), border-color .25s, background-color .25s, filter .25s;
  }
  .site-card:hover, .pic-card:hover, .feature:hover, .card.clickable:hover, a.card:hover, .fee-tile:hover {
    transform: translateY(-6px) scale(1.02); box-shadow: var(--shadow-hover); border-color: rgba(6, 95, 70, .35);
  }
  .feature2:hover { transform: translateY(-6px) scale(1.03); box-shadow: var(--shadow-hover); filter: brightness(1.02) saturate(1.08); }
  .stat-tile:hover { transform: translateY(-5px) scale(1.04); box-shadow: var(--shadow-hover); }
  .quick:hover { transform: translateY(-4px) scale(1.06); box-shadow: var(--shadow-hover); color: var(--primary); }
  .plan-card:hover, .help-item.card:hover { box-shadow: var(--shadow-hover); border-color: rgba(6, 95, 70, .3); }
  .icon-choice:hover { transform: translateY(-3px) scale(1.06); }
  .next-slot:hover { transform: translateY(-3px) scale(1.01); box-shadow: 0 16px 36px rgba(6, 95, 70, .3); }
  .site-stats .stat:hover { transform: translateY(-4px) scale(1.04); background: rgba(255, 255, 255, .16); }
  .juz:hover { transform: scale(1.18); z-index: 1; position: relative; box-shadow: 0 4px 12px rgba(17, 24, 39, .15); }
  .site-card:active, .pic-card:active, .feature2:active, a.card:active, .card.clickable:active, .quick:active {
    transform: translateY(-2px) scale(.98); transition-duration: .1s;
  }

  /* Every other card (dashboards, sections, charts) lifts gently; not while you are typing inside it. */
  .card { transition: transform .35s var(--ease-spring), box-shadow .3s var(--ease-out), border-color .25s; }
  .card:where(:hover:not(:focus-within)) { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: rgba(6, 95, 70, .25); }
  .card:where(:focus-within) { box-shadow: var(--shadow-hover); }
  .section-head .icon-box, .card .icon-box { transition: transform .4s var(--ease-spring); }
  .card:hover .section-head .icon-box { transform: scale(1.12) rotate(-6deg); }

  /* Things inside a hovered card come alive too: titles take the brand colour, icons bounce, pictures zoom. */
  .site-card .title, .pic-card .title, .feature h3, .feature2 h3, .stat-tile .v { transition: color .25s, transform .3s var(--ease-spring); }
  .site-card:hover .title, .pic-card:hover .title, .feature:hover h3, .feature2:hover h3 { color: var(--primary); }
  .feature2 .big, .stat-tile .ic, .quick .icon-box, .feature .icon-box { transition: transform .4s var(--ease-spring), box-shadow .3s; }
  .feature2:hover .big, .stat-tile:hover .ic, .quick:hover .icon-box, .feature:hover .icon-box {
    transform: scale(1.14) rotate(-6deg); box-shadow: 0 6px 16px rgba(17, 24, 39, .12);
  }
  .stat-tile:hover .v { transform: scale(1.08); }
  .feature2 .go { transition: transform .3s var(--ease-spring), background-color .2s; }
  .feature2:hover .go { transform: translateX(-4px) scale(1.15); background: #fff; }
  [dir="ltr"] .feature2:hover .go { transform: translateX(4px) scale(1.15); }
  .pic-card .pic img, .pic-card .avatar-pic img, .center-cover img { transition: transform .6s var(--ease-out); }
  .pic-card:hover .pic img, .pic-card:hover .avatar-pic img { transform: scale(1.1); }
  .center-cover:hover img { transform: scale(1.04); }

  /* ------------------------------------------------------------ lists and menus: slide toward the pointer */
  a.row, button.row, .row.clickable { transition: background-color .2s, box-shadow .25s, transform .25s var(--ease-out); }
  a.row:hover, button.row:hover, .row.clickable:hover { box-shadow: inset 3px 0 0 var(--primary); }
  [dir="rtl"] a.row:hover, [dir="rtl"] button.row:hover, [dir="rtl"] .row.clickable:hover { box-shadow: inset -3px 0 0 var(--primary); }
  a.row:hover .title, button.row:hover .title, .row.clickable:hover .title { color: var(--primary); }
  .row .title { transition: color .2s; }
  .row .chev { transition: transform .25s var(--ease-spring), color .2s; }
  a.row:hover .chev, button.row:hover .chev, .row.clickable:hover .chev { color: var(--primary); transform: translateX(-4px) scale(1.2); }
  [dir="ltr"] a.row:hover .chev, [dir="ltr"] button.row:hover .chev, [dir="ltr"] .row.clickable:hover .chev { transform: translateX(4px) scale(1.2); }
  a.row:active, button.row:active, .row.clickable:active { transform: scale(.99); }
  table.data tr.clickable td { transition: background-color .2s, color .2s; }
  table.data tr.clickable:hover td { color: var(--primary); }

  .side-item:hover { transform: translateX(-4px); }
  [dir="ltr"] .side-item:hover { transform: translateX(4px); }
  .side-item .icon { transition: transform .3s var(--ease-spring), color .2s; }
  .side-item:hover .icon { transform: scale(1.2); color: #fff; }
  .side-item[aria-current="page"]:hover .icon { color: var(--primary); }
  .side-item:active { transform: scale(.97); }

  .menu-pop button:hover, .sheet-item:hover { transform: translateX(-3px); }
  [dir="ltr"] .menu-pop button:hover, [dir="ltr"] .sheet-item:hover { transform: translateX(3px); }

  /* ------------------------------------------------------------ the public site's header and links */
  .site-header nav a:hover { transform: translateY(-2px) scale(1.07); color: var(--primary); }
  .site-header nav a:active { transform: scale(.95); }
  .site-header nav a .icon { transition: transform .3s var(--ease-spring); }
  .site-header nav a:hover .icon { transform: scale(1.2) rotate(-8deg); }
  .site-header .brand img, .site-header .brand .logo { transition: transform .5s var(--ease-spring); }
  .site-header .brand:hover img, .site-header .brand:hover .logo { transform: rotate(-8deg) scale(1.08); }
  .site-header .login-avatar:hover, .topbar .user:hover { transform: scale(1.06); }

  /* Footer and in-text links: an underline that grows from the start of the word. */
  .site-footer .links a, .plain-link .strong {
    background-image: linear-gradient(currentColor, currentColor); background-repeat: no-repeat;
    background-size: 0% 2px; background-position: 100% 100%;
    transition: background-size .3s var(--ease-out), color .2s;
  }
  [dir="ltr"] .site-footer .links a, [dir="ltr"] .plain-link .strong { background-position: 0 100%; }
  .site-footer .links a:hover, .plain-link:hover .strong { background-size: 100% 2px; text-decoration: none; }
  .site-footer .links a { display: inline-block; transition: background-size .3s var(--ease-out), color .2s, transform .25s var(--ease-spring); }
  .site-footer .links a:hover { transform: translateY(-2px); }

  /* Badges and small status pills pop a little. */
  .badge { transition: transform .2s var(--ease-spring); }
  .badge:hover { transform: scale(1.1); }

  /* Form fields glow softly when focused. */
  .input { transition: border-color .2s, box-shadow .25s; }
  .input:focus { box-shadow: 0 0 0 4px rgba(6, 95, 70, .12); }

  /* ------------------------------------------------------------ entrance: content rises into place */
  @keyframes rise-in {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
  }
  .site-card, .pic-card, .feature, .feature2, .stat-tile, .quick, .fee-tile, .next-slot {
    animation: rise-in .5s var(--ease-out) backwards;
  }
  /* Neighbours arrive one after another. */
  :is(.site-card, .pic-card, .feature, .feature2, .stat-tile, .quick, .fee-tile):nth-child(2) { animation-delay: .05s; }
  :is(.site-card, .pic-card, .feature, .feature2, .stat-tile, .quick, .fee-tile):nth-child(3) { animation-delay: .1s; }
  :is(.site-card, .pic-card, .feature, .feature2, .stat-tile, .quick, .fee-tile):nth-child(4) { animation-delay: .15s; }
  :is(.site-card, .pic-card, .feature, .feature2, .stat-tile, .quick, .fee-tile):nth-child(5) { animation-delay: .2s; }
  :is(.site-card, .pic-card, .feature, .feature2, .stat-tile, .quick, .fee-tile):nth-child(n+6) { animation-delay: .25s; }
  .announcement-bar { animation: rise-in .45s var(--ease-out) backwards; }

  /* Hover effects only where there is a real pointer: on phones a tap shouldn't leave a card stuck in its "lifted" state. */
  @media (hover: none) {
    .btn:hover:not(:disabled), .icon-btn:hover:not(:disabled), .chip:hover, .site-card:hover, .pic-card:hover, .feature:hover,
    .feature2:hover, .stat-tile:hover, .quick:hover, .card.clickable:hover, a.card:hover, .fee-tile:hover, .icon-choice:hover,
    .next-slot:hover, .site-stats .stat:hover, .juz:hover, .card:hover:not(:focus-within), .side-item:hover, .menu-pop button:hover, .sheet-item:hover,
    .site-header nav a:hover, .site-footer .links a:hover, .badge:hover, .login-avatar:hover, .topbar .user:hover,
    a.row:active, button.row:active, .row.clickable:active { transform: none; }
  }

}
