/* Shared interaction feedback for the Gedy storefront and management screens. */
:root {
  --interaction-ink: #223d33;
  --interaction-hover: #3d5b48;
  --interaction-tint: #e8eee3;
  --interaction-ring: #849769;
}

:where(a[href], button, summary, select, [role="button"], [role="tab"],
  input[type="button"], input[type="submit"], input[type="reset"],
  input[type="checkbox"], input[type="radio"], input[type="file"],
  input[type="range"], label[for]) {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: #223d3333;
}

:where(a[href], button, summary, select, [role="button"], [role="tab"]) {
  transition: color .18s ease, background-color .18s ease,
    border-color .18s ease, box-shadow .18s ease, opacity .18s ease,
    transform .18s ease, filter .18s ease;
}

body :is(.button, .primary, .secondary, .danger) {
  transition: color .18s ease, background-color .18s ease,
    border-color .18s ease, box-shadow .18s ease, opacity .18s ease,
    transform .18s ease, filter .06s ease;
}

body :where(a[href], button, summary, select, input, textarea,
  [contenteditable="true"], [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid var(--interaction-ring);
  outline-offset: 4px;
}

:where(a[href], button) > .ui-arrow,
.content-card .ui-arrow {
  transition: transform .18s ease;
}

/* Hover is limited to real pointing devices so touch screens do not get stuck. */
@media (hover: hover) and (pointer: fine) {
  :where(a[href]):not([aria-disabled="true"]):hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: .25em;
  }

  body :where(button:not(:disabled):not([aria-disabled="true"]),
    summary, [role="button"]:not([aria-disabled="true"]),
    [role="tab"]:not([aria-disabled="true"])):hover {
    background-color: var(--interaction-tint);
    box-shadow: 0 0 0 2px #223d3324;
  }

  body :is(.button, .primary):not(:disabled):not([aria-disabled="true"]):hover {
    background: var(--interaction-hover);
    border-color: var(--interaction-hover);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px #223d3324;
  }

  body .secondary:not(:disabled):not([aria-disabled="true"]):hover {
    background: var(--interaction-tint);
    border-color: var(--interaction-hover);
    color: var(--interaction-ink);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px #223d331a;
  }

  body .danger:not(:disabled):hover {
    background: #f7e7e1;
    border-color: #974934;
    color: #7c3021;
    transform: translateY(-2px);
  }

  body :is(.text-link, .header-contact):hover {
    color: var(--interaction-hover);
    border-color: var(--interaction-hover);
    box-shadow: 0 2px 0 var(--interaction-hover);
    text-decoration: none;
  }

  body :is(.text-link, .button, .header-contact, .mobile-call):hover .ui-arrow,
  .content-card > a:hover .ui-arrow {
    transform: translate(3px, -3px);
  }

  body :is(a.category-card, a.brand-card, a.product-image,
    .content-card > a, .brand-rail a):hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px #223d3324;
    text-decoration: none;
  }

  :is(.brand, .footer-brand, .admin-brand, .login-logo):hover {
    opacity: .78;
    text-decoration: none;
  }

  :where(input:not([readonly]), select, textarea, [contenteditable="true"]):not(:disabled):hover {
    border-color: var(--interaction-ring);
  }
}

/* Press feedback also works with touch and native keyboard button activation. */
body :where(a[href], button, summary, [role="button"], [role="tab"]):not(:disabled):not([aria-disabled="true"]):is(:active, [data-ui-pressed]) {
  filter: brightness(.88);
  transition-duration: .06s;
}

body :is(button, a.button, a.primary, a.secondary, a.danger):not(:disabled):not([aria-disabled="true"]):is(:active, [data-ui-pressed]) {
  transform: translateY(1px) scale(.98);
  box-shadow: 0 1px 3px #223d3340;
}

body :is(a.category-card, a.brand-card, a.product-image,
  .content-card > a, .brand-rail a):is(:active, [data-ui-pressed]) {
  transform: scale(.99);
}

body a[href]:not([aria-disabled="true"]):is(:active, [data-ui-pressed]) {
  opacity: .8;
}

body :is(button, input, select, a, [role="button"], [role="tab"]):is(:disabled, [aria-disabled="true"]) {
  cursor: not-allowed;
  opacity: .48;
  transform: none;
  filter: none;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  :where(a[href], button, summary, select, [role="button"], [role="tab"], .ui-arrow) {
    transition: none !important;
  }
  body :is(a[href], button, summary, [role="button"], [role="tab"]):is(:hover, :active, [data-ui-pressed]),
  body :is(a[href], button):is(:hover, :active, [data-ui-pressed]) .ui-arrow {
    transform: none !important;
  }
}
