/*
 * Product-surface interaction styles.
 *
 * Everything else in the console is inline-styled from `lib/ui/tokens`, but
 * hover cannot be expressed inline — so the two interactive affordances live
 * here as classes. Names are `sp-` prefixed so nothing can collide with the
 * Webflow cascade, and this sheet is only linked by the (app), (checkout) and
 * (ops) layouts — the marketing page never loads it.
 *
 * Both effects use the existing orange accent. No new colour enters the
 * palette: the lift is the accent at 42–55%, the row wash is the accent at 8%.
 */

/* -------------------------------------------------------------------------
 * Cards — KPI tiles and panels. A 4px lift and an orange edge.
 * ---------------------------------------------------------------------- */
.sp-card {
  /* Anchors the corner brackets defined below. */
  position: relative;
  transition:
    transform 0.18s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.18s cubic-bezier(0.22, 0.61, 0.36, 1),
    border-color 0.18s ease;
  will-change: transform;
}

.sp-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--orange) 55%, #2e2e2c);
  box-shadow:
    0 16px 34px -12px color-mix(in srgb, var(--orange) 42%, transparent),
    0 4px 10px -4px rgba(0, 0, 0, 0.5);
}

/* A card that is also a link keeps the same treatment without the underline. */
a.sp-card,
a.sp-card:hover {
  text-decoration: none;
}

/* -------------------------------------------------------------------------
 * Corner brackets.
 *
 * Lifted from the template's own nav links (`.header-menu-link-dekor` in
 * webflow.css): two 0.5rem squares with 2px orange borders, one showing its
 * top-left corner and one its bottom-right, sitting at opposite ends of a
 * diagonal. At rest they are transparent and pulled inward; on hover they fade
 * in and slide out to the corners.
 *
 * The template pairs this with a scramble-text effect driven by GSAP. That part
 * is deliberately not ported — GSAP only ships with the marketing bundle, and
 * scrambling a currency figure while someone is reading it is exactly the kind
 * of "cosmetic motion over a number" this product should not do.
 *
 * Scaled up from the nav's 0.5rem because a card is a much bigger target: at
 * nav size the brackets vanish against a 15rem-wide tile.
 * ---------------------------------------------------------------------- */
.sp-card::before,
.sp-card::after {
  content: '';
  position: absolute;
  width: 0.75rem;
  height: 0.75rem;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s,
    transform 0.3s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}

/* Top-left */
.sp-card::before {
  top: 0.55rem;
  left: 0.55rem;
  border-top: 2px solid var(--orange);
  border-left: 2px solid var(--orange);
  transform: translate(50%, 50%);
}

/* Bottom-right */
.sp-card::after {
  right: 0.55rem;
  bottom: 0.55rem;
  border-right: 2px solid var(--orange);
  border-bottom: 2px solid var(--orange);
  transform: translate(-50%, -50%);
}

.sp-card:hover::before,
.sp-card:hover::after,
.sp-card:focus-visible::before,
.sp-card:focus-visible::after {
  opacity: 1;
  transform: translate(0, 0);
}

/* -------------------------------------------------------------------------
 * Rows — table rows in the payments, escrow, settlements and refunds lists.
 * A wash only. No lift: a row that moves shifts every column beside it.
 * ---------------------------------------------------------------------- */
.sp-row {
  transition: background-color 0.15s ease;
}

.sp-row:hover {
  background-color: color-mix(in srgb, var(--orange) 12%, transparent);
}

/* Keyboard parity — tabbing to a link inside a row lights the row too. */
.sp-row:focus-within {
  background-color: color-mix(in srgb, var(--orange) 16%, transparent);
}

/* -------------------------------------------------------------------------
 * Focus. §21.3 accessibility: "keyboard/focus/labels/contrast/status
 * semantics pass baseline review."
 *
 * `:focus-visible` rather than `:focus`, so a mouse click on a button does not
 * leave a ring behind but tabbing to it does. The ring is offset rather than
 * inset so it never sits on top of the control's own border, and it uses
 * `outline` rather than `box-shadow` so Windows high-contrast mode keeps it.
 *
 * Scoped to `.sp-scope`, a `display: contents` wrapper the three product
 * layouts render. That keeps the rule off the marketing page, whose stylesheet
 * link persists across client navigation.
 * ---------------------------------------------------------------------- */
.sp-scope :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Table rows: the ring would be clipped by the row's own overflow, so the row
   lights up instead — `.sp-row:focus-within` already does this. Keep the link's
   own ring too, since that is what actually holds focus. */

/* Skip link — the first tab stop on every console page. Off-screen until
   focused, so it costs nothing visually but saves a keyboard user from tabbing
   through the whole sidebar on every navigation. */
.sp-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.7rem 1.1rem;
  background: #181818;
  border: 1px solid var(--orange);
  border-radius: 6px;
  font-size: 0.875rem;
  text-decoration: none;
  color: #f2f2f0;
}

.sp-skip:focus {
  left: 1rem;
  top: 1rem;
}

/* -------------------------------------------------------------------------
 * Reduced motion: keep the colour feedback, drop the movement.
 * ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sp-card,
  .sp-row {
    transition: none;
  }
  .sp-card:hover {
    transform: none;
  }
  /* Brackets still appear — they are the affordance. Only the slide goes. */
  .sp-card::before,
  .sp-card::after {
    transition: opacity 0.3s;
    transform: none;
  }
  .sp-card:hover::before,
  .sp-card:hover::after {
    transform: none;
  }
}

/* -------------------------------------------------------------------------
 * Buttons.
 *
 * The template's own hover lives on `.button-primary-text:hover` and swaps the
 * text layer's background to --lightgrey. In the console that rule never fired:
 * Button set `backgroundColor` inline, and an inline style beats a stylesheet
 * rule, so the secondary variant had no hover at all. That is why these read as
 * labels rather than controls.
 *
 * All button colour now lives here, keyed off `data-variant`, so hover works and
 * the dark palette is respected. `--lightgrey` would be #e4e4e4 here — the
 * console does not override webflow's :root — which is why the invert target is
 * written out rather than inherited.
 * ---------------------------------------------------------------------- */
.sp-btn .sp-btn-text {
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

/* Primary — orange fill, dark label. Inverts on hover, leaving the 1px edge. */
.sp-btn[data-variant='primary'] .sp-btn-text {
  background-color: var(--orange);
  color: #0e0e0e;
}
.sp-btn[data-variant='primary']:hover .sp-btn-text {
  background-color: #181818;
  color: var(--orange);
}

/* Danger — same behaviour, red edge. */
.sp-btn[data-variant='danger'] .sp-btn-text {
  background-color: #f2706e;
  color: #0e0e0e;
}
.sp-btn[data-variant='danger']:hover .sp-btn-text {
  background-color: #181818;
  color: #f2706e;
}

/*
 * Secondary — an outline. At rest the label is full-strength text, not the
 * muted tone it used to be: a control that whispers is a control nobody clicks.
 * On hover it takes the orange edge and label, so it moves toward the primary
 * rather than filling in.
 */
.sp-btn[data-variant='secondary'] .sp-btn-text {
  background-color: #181818;
  color: #f2f2f0;
}
.sp-btn[data-variant='secondary']:hover .sp-btn-text {
  background-color: color-mix(in srgb, var(--orange) 14%, #181818);
  color: var(--orange);
}
/* The 1px edge behind the label is the button's only outline — light it too. */
.sp-btn[data-variant='secondary']:hover .button-primary-border {
  background-color: var(--orange);
}
.sp-btn .button-primary-border {
  transition: background-color 0.2s ease;
}

/* Corner brackets, same as the cards — the shape that reads as "interactive"
   everywhere else in this product. */
.sp-btn {
  position: relative;
}
.sp-btn::before,
.sp-btn::after {
  content: '';
  position: absolute;
  z-index: 3;
  width: 0.5rem;
  height: 0.5rem;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s,
    transform 0.3s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
.sp-btn::before {
  top: -0.4rem;
  left: -0.4rem;
  border-top: 2px solid var(--orange);
  border-left: 2px solid var(--orange);
  transform: translate(50%, 50%);
}
.sp-btn::after {
  right: -0.4rem;
  bottom: -0.4rem;
  border-right: 2px solid var(--orange);
  border-bottom: 2px solid var(--orange);
  transform: translate(-50%, -50%);
}
.sp-btn:hover::before,
.sp-btn:hover::after,
.sp-btn:focus-visible::before,
.sp-btn:focus-visible::after {
  opacity: 1;
  transform: translate(0, 0);
}

/* A disabled button is not a target — no hover, no brackets. */
.sp-btn:disabled {
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .sp-btn::before,
  .sp-btn::after,
  .sp-btn:hover::before,
  .sp-btn:hover::after {
    transition: opacity 0.3s;
    transform: none;
  }
}

/* -------------------------------------------------------------------------
 * Narrow screens.
 *
 * The detail panels are label/value pairs on a two-column grid whose label
 * track has a hard minimum (minmax(6rem, 8rem)). Below roughly 560px that
 * minimum plus the card's own padding leaves the value column too little room,
 * and the value pushes out of the card. Stack them instead — §18.1's card-row
 * rule applied to detail panels rather than tables.
 * ---------------------------------------------------------------------- */
@media (max-width: 560px) {
  .sp-detail-row {
    grid-template-columns: 1fr !important;
    gap: 0.2rem !important;
    align-items: start !important;
  }
}

/* The payment detail tabs are a fixed set that cannot wrap sensibly. Let the
   strip scroll rather than push the page sideways. */
.sp-tabs {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.sp-tabs::-webkit-scrollbar {
  display: none;
}

/* A button is never allowed to be wider than what contains it. */
.sp-btn {
  max-width: 100%;
}
.sp-btn .sp-btn-text {
  overflow-wrap: anywhere;
}
