/**
 * Reusable Jedi-Robe information-box component.
 *
 * Migration-safe extraction from the canonical Jedi-Robe dark-commerce
 * stylesheet. Rule order and declarations are preserved for staging review.
 *
 * @package Jedi_Theme
 * @since   2026-08-25
 */

/**
 * Dark galactic shopping-help cards.
 *
 * Restyles the reusable Jedi-Robe information-box shortcode as a responsive
 * dark support grid. Green identifies important guidance, while blue remains
 * the keyboard-focus colour.
 *
 * @package Jedi_Theme
 */

/* ==========================================================================
   Information-box section
   ========================================================================== */

body.jr-dark-commerce .jr-info-boxes {
  position: relative;
  isolation: isolate;

  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1rem, 1.5vw, 1.5rem);

  width: 100%;
  margin: clamp(1rem, 2vw, 3rem) auto;
  padding-top: clamp(2rem, 3vw, 3rem);
  padding-bottom: clamp(1rem, 2vw, 2rem);

  border: 0;
  background: transparent;
}

/**
 * Replace the existing solid white section divider with a fading green line.
 *
 * @package Jedi_Theme
 */

body.jr-dark-commerce .jr-info-boxes::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 0;

  height: 1px;

  background:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(45, 166, 83, 0.18) 15%,
      rgba(69, 217, 107, 0.72) 50%,
      rgba(45, 166, 83, 0.18) 85%,
      transparent 100%
    );

  box-shadow: 0 0 1.25rem rgba(45, 166, 83, 0.14);
  content: "";
  pointer-events: none;
}

/**
 * Add a restrained atmospheric glow behind the card grid.
 *
 * @package Jedi_Theme
 */

body.jr-dark-commerce .jr-info-boxes::after {
  position: absolute;
  top: -3rem;
  left: 50%;
  z-index: -1;

  width: min(70rem, 85vw);
  height: 20rem;

  background:
    radial-gradient(
      ellipse,
      rgba(63, 126, 176, 0.055),
      transparent 68%
    );

  content: "";
  transform: translateX(-50%);
  pointer-events: none;
}

/* ==========================================================================
   Information card
   ========================================================================== */

body.jr-dark-commerce .jr-info-box {
  position: relative;
  z-index: 1;
  isolation: isolate;
  overflow: hidden;

  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(0.9rem, 1.2vw, 1.2rem);
  align-items: start;

  min-width: 0;
  min-height: 7.5rem;
  padding: clamp(1.15rem, 1.7vw, 1.5rem);

  border: 1px solid rgba(111, 203, 255, 0.22) !important;
  border-radius: 0.375rem;

  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.035),
      transparent 42%
    ),
    radial-gradient(
      circle at 100% 0,
      rgba(111, 203, 255, 0.055),
      transparent 15rem
    ),
    rgba(10, 17, 27, 0.46) !important;

  color: var(--jr-text) !important;
  text-decoration: none !important;

  box-shadow:
    0 1.25rem 2.75rem rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);

  transition:
    border-color 220ms ease,
    background 220ms ease,
    box-shadow 220ms ease,
    transform 220ms ease;
}

/**
 * Add a short illuminated indicator at the top of each card.
 *
 * @package Jedi_Theme
 */

body.jr-dark-commerce .jr-info-box::before {
  position: absolute;
  top: 0;
  left: 0;

  width: clamp(3.5rem, 30%, 8rem);
  height: 1px;

  background:
    linear-gradient(
      90deg,
      var(--jr-green-light),
      rgba(45, 166, 83, 0)
    );

  box-shadow: 0 0 1rem rgba(45, 166, 83, 0.18);
  content: "";
  opacity: 0.72;

  transition:
    width 220ms ease,
    opacity 220ms ease;
}

body.jr-dark-commerce .jr-info-box > * {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Card icon
   ========================================================================== */

body.jr-dark-commerce .jr-info-box__icon {
  display: grid;
  width: 3rem;
  height: 3rem;
  flex: 0 0 3rem;
  place-items: center;

  border: 1px solid transparent;
  border-radius: 50%;

  background:
    linear-gradient(
      145deg,
      #141c28,
      #090d14
    ) padding-box,
    linear-gradient(
      145deg,
      rgba(69, 217, 107, 0.72),
      rgba(45, 166, 83, 0.18) 58%,
      rgba(111, 203, 255, 0.16)
    ) border-box;

  color: var(--jr-green-light);

  box-shadow:
    0 0.75rem 1.5rem rgba(0, 0, 0, 0.25),
    0 0 1rem rgba(45, 166, 83, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);

  transition:
    color 220ms ease,
    box-shadow 220ms ease,
    transform 220ms ease;
}

body.jr-dark-commerce .jr-info-box__icon svg {
  display: block;
  width: 1.35rem;
  height: 1.35rem;

  color: currentcolor;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   Card content
   ========================================================================== */

body.jr-dark-commerce .jr-info-box__content {
  min-width: 0;
  padding-top: 0.1rem;
}

body.jr-dark-commerce .jr-info-box__title {
  margin: 0 0 0.45rem;

  color: var(--jr-text) !important;
  font-size: clamp(1rem, 0.94rem + 0.14vw, 1.12rem);
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.3;
  text-wrap: balance;

  transition:
    color 180ms ease,
    text-shadow 180ms ease;
}

body.jr-dark-commerce .jr-info-box__description {
  margin: 0;

  color: var(--jr-text);
  font-size: clamp(0.86rem, 0.82rem + 0.08vw, 0.94rem);
  line-height: 1.6;
  text-wrap: pretty;

  transition: color 180ms ease;
}

/* ==========================================================================
   Direction arrow
   ========================================================================== */

body.jr-dark-commerce .jr-info-box__arrow {
  display: grid;
  width: 1.85rem;
  height: 1.85rem;
  align-self: center;
  place-items: center;

  border: 1px solid var(--jr-border);
  border-radius: 50%;

  background: rgba(255, 255, 255, 0.018);
  color: var(--jr-text);

  font-size: 1rem;
  line-height: 1;

  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

/* ==========================================================================
   Hover interaction
   ========================================================================== */

/**
 * Apply card movement only where the device supports genuine hover.
 *
 * @package Jedi_Theme
 */

@media (hover: hover) and (pointer: fine) {
  body.jr-dark-commerce .jr-info-box:hover {
    border-color: rgba(45, 166, 83, 0.48) !important;

    background:
      linear-gradient(
        135deg,
        rgba(111, 203, 255, 0.065),
        transparent 40%
      ),
      rgba(11, 19, 30, 0.68) !important;

    box-shadow:
      0 1.75rem 3.5rem rgba(0, 0, 0, 0.34),
      0 0 1.5rem rgba(45, 166, 83, 0.07),
      inset 0 1px 0 rgba(255, 255, 255, 0.04);

    transform: translateY(-0.25rem);
  }

  body.jr-dark-commerce .jr-info-box:hover::before {
    width: 62%;
    opacity: 1;
  }

  body.jr-dark-commerce .jr-info-box:hover .jr-info-box__icon {
    color: var(--jr-green-bright);

    box-shadow:
      0 1rem 1.8rem rgba(0, 0, 0, 0.3),
      0 0 1.25rem rgba(45, 166, 83, 0.13),
      inset 0 1px 0 rgba(255, 255, 255, 0.055);

    transform: translateY(-0.125rem);
  }

  body.jr-dark-commerce .jr-info-box:hover .jr-info-box__title {
    color: var(--jr-text) !important;
    text-shadow: 0 0 1rem rgba(45, 166, 83, 0.1);
  }

  body.jr-dark-commerce .jr-info-box:hover .jr-info-box__description {
    color: var(--jr-text-soft) !important;
  }

  body.jr-dark-commerce .jr-info-box:hover .jr-info-box__arrow {
    border-color: rgba(45, 166, 83, 0.48);
    background: rgba(45, 166, 83, 0.07);
    color: var(--jr-green-light) !important;
    transform: translateX(0.25rem);
  }
}

/* ==========================================================================
   Keyboard focus
   ========================================================================== */

body.jr-dark-commerce .jr-info-box:focus-visible {
  border-color: var(--jr-blue) !important;
  outline: 3px solid rgba(111, 203, 255, 0.85);
  outline-offset: 4px;

  box-shadow:
    0 0 0 1px rgba(111, 203, 255, 0.12),
    0 0 1.75rem rgba(111, 203, 255, 0.13);
}

body.jr-dark-commerce
  .jr-info-box:focus-visible
  .jr-info-box__arrow {
  border-color: var(--jr-blue);
  color: var(--jr-blue-light) !important;
}

/* ==========================================================================
   Responsive layout
   ========================================================================== */

@media (max-width: 1180px) {
  body.jr-dark-commerce .jr-info-boxes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  body.jr-dark-commerce .jr-info-boxes {
    grid-template-columns: 1fr;
    gap: 1rem;
    /* margin-block: 3rem; */
    padding-top: 2rem;
  }

  body.jr-dark-commerce .jr-info-box {
    min-height: 0;
    padding: 1.15rem;
  }

  body.jr-dark-commerce .jr-info-box__arrow {
    width: 1.75rem;
    height: 1.75rem;
  }
}

/* ==========================================================================
   Reduced-motion preference
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  body.jr-dark-commerce .jr-info-box,
  body.jr-dark-commerce .jr-info-box::before,
  body.jr-dark-commerce .jr-info-box__icon,
  body.jr-dark-commerce .jr-info-box__arrow {
    transition: none;
  }

  body.jr-dark-commerce .jr-info-box:hover,
  body.jr-dark-commerce .jr-info-box:hover .jr-info-box__icon,
  body.jr-dark-commerce .jr-info-box:hover .jr-info-box__arrow {
    transform: none;
  }
}

