/* ==========================================================================
   SHARED CTA RECIPE  (src/styles/cta.css)
   --------------------------------------------------------------------------
   Canonical metrics copied from the "Add Item" button on service/index.php
   service cards (.service-card-button inside .service-card-actions):

     min-height 2.36rem · padding 0.5rem 0.78rem · 1px border ·
     border-radius 30px · label 0.88rem / 900 / 0.018em / 1.05

   Two variants:
     .tv-cta--red    — identical to Add Item (red gradient + sheen)
     .tv-cta--ghost  — transparent / light-grey gradient + hairline border
                       (the established secondary-surface look)

   Loaded LAST in head.php so it wins same-specificity conflicts with
   legacy rules (e.g. the global `button, .learn-more` rule in m072224.css).
   Width is intentionally NOT set — each context controls its own width.
   ========================================================================== */

:root {
  --tv-cta-height: 2.36rem; /* = --svc-button-height */
  --tv-cta-radius: 30px; /* = --svc-button-radius   */
  --tv-cta-pad-y: 0.5rem;
  --tv-cta-pad-x: 0.78rem;
  --tv-cta-gap: 0.42rem;
  --tv-cta-font-size: 0.88rem;
  --tv-cta-font-weight: 500;
  --tv-cta-letter-spacing: 0.018em;
  --tv-cta-line-height: 1.05;

  /* Red — mirrors --svc-cta-red-* in service-cards.css */
  --tv-cta-red-bg: linear-gradient(
    180deg,
    rgba(210, 20, 20, 0.98) 0%,
    rgba(150, 0, 0, 0.98) 100%
  );
  --tv-cta-red-bg-hover: linear-gradient(
    180deg,
    rgba(232, 32, 32, 1) 0%,
    rgba(176, 0, 0, 1) 100%
  );
  --tv-cta-red-bg-active: linear-gradient(
    180deg,
    rgba(170, 0, 0, 1) 0%,
    rgba(120, 0, 0, 1) 100%
  );
  --tv-cta-red-border: rgb(155, 5, 5);
  --tv-cta-red-border-hover: rgb(88, 10, 10);
  --tv-cta-red-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 12px 24px rgba(170, 0, 0, 0.28),
    0 8px 18px rgba(0, 0, 0, 0.2);
  --tv-cta-red-shadow-hover:
    inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 16px 30px rgba(170, 0, 0, 0.36),
    0 10px 22px rgba(0, 0, 0, 0.24);
  --tv-cta-red-focus: 0 0 0 3px rgba(170, 0, 0, 0.24),
    0 0 0 6px rgba(170, 0, 0, 0.1);

  /* Ghost — the transparent / light-grey gradient surface used elsewhere */
  --tv-cta-ghost-bg: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.07) 0%,
    rgba(255, 255, 255, 0.045) 100%
  );
  --tv-cta-ghost-bg-hover: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.065) 100%
  );
  --tv-cta-ghost-border: rgba(255, 255, 255, 0.1);
  --tv-cta-ghost-border-hover: rgba(255, 255, 255, 0.14);
  --tv-cta-ghost-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 10px 24px rgba(0, 0, 0, 0.2);
  --tv-cta-ghost-shadow-hover:
    inset 0 1px 0 rgba(255, 255, 255, 0.055), 0 12px 28px rgba(0, 0, 0, 0.24);
}

/* --------------------------------------------------------------------------
   Base — works on <button>, <a>, and elements wrapping <span>s.
   Resets everything the legacy `button, .learn-more` rule applies.
   -------------------------------------------------------------------------- */

.tv-cta {
  appearance: none;
  -webkit-appearance: none;

  box-sizing: border-box;

  position: relative;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--tv-cta-gap);

  min-height: var(--tv-cta-height);
  margin: 0;
  padding: var(--tv-cta-pad-y) var(--tv-cta-pad-x);
  overflow: hidden;

  border: 1px solid transparent;
  border-radius: var(--tv-cta-radius);
  outline: none;

  color: #fff;

  font-family: inherit;
  font-size: var(--tv-cta-font-size);
  font-weight: var(--tv-cta-font-weight);
  letter-spacing: var(--tv-cta-letter-spacing);
  line-height: var(--tv-cta-line-height);
  text-align: center;
  text-decoration: none;
  text-transform: none;
  white-space: nowrap;

  cursor: pointer;
  user-select: none;

  transform: translate3d(0, 0, 0);

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

.tv-cta:hover,
.tv-cta:focus-visible {
  color: #fff;
  text-decoration: none;
  transform: translate3d(0, -1px, 0);
}

.tv-cta:active {
  transform: translate3d(0, 0, 0);
}

/* Inner spans (labels) inherit the CTA typography exactly */
.tv-cta .btn-label,
.tv-cta > span:not(.btn-icon) {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-transform: inherit;
}

/* Optional spacing helpers (legacy .learn-more carried margin-top) */
.tv-cta--mt {
  margin-top: 1.25rem;
}

.tv-cta-row {
  display: flex;
  margin-top: 1.25rem;
}

/* --------------------------------------------------------------------------
   RED — identical to the service-card Add Item CTA
   -------------------------------------------------------------------------- */

.tv-cta--red {
  border-color: var(--tv-cta-red-border);
  background: var(--tv-cta-red-bg);
  box-shadow: var(--tv-cta-red-shadow);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.26);
}

/* Top sheen — same as .service-card-button::before */
.tv-cta--red::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0) 48%
  );
  opacity: 0.72;
  transition: opacity 140ms ease;
}

.tv-cta--red:hover,
.tv-cta--red:focus-visible {
  border-color: var(--tv-cta-red-border-hover);
  background: var(--tv-cta-red-bg-hover);
  box-shadow: var(--tv-cta-red-shadow-hover);
  filter: saturate(1.04);
}

.tv-cta--red:hover::before,
.tv-cta--red:focus-visible::before {
  opacity: 0.92;
}

.tv-cta--red:active {
  background: var(--tv-cta-red-bg-active);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.24),
    0 2px 6px rgba(170, 0, 0, 0.12);
}

.tv-cta--red:focus-visible {
  box-shadow: var(--tv-cta-red-shadow-hover), var(--tv-cta-red-focus);
}

/* --------------------------------------------------------------------------
   GHOST — transparent / light-grey gradient + hairline border
   -------------------------------------------------------------------------- */

.tv-cta--ghost {
  border-color: var(--tv-cta-ghost-border);
  background: var(--tv-cta-ghost-bg);
  box-shadow: var(--tv-cta-ghost-shadow);
  color: rgba(255, 255, 255, 0.92);
}

.tv-cta--ghost:hover,
.tv-cta--ghost:focus-visible {
  border-color: var(--tv-cta-ghost-border-hover);
  background: var(--tv-cta-ghost-bg-hover);
  box-shadow: var(--tv-cta-ghost-shadow-hover);
  color: #fff;
}

.tv-cta--ghost:active {
  background: var(--tv-cta-ghost-bg);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.22);
}

.tv-cta--ghost:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.28);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Responsive modifier — red on desktop, ghost at mobile widths.
   Usage: class="tv-cta tv-cta--red tv-cta--ghost-mobile"
   -------------------------------------------------------------------------- */

@media (max-width: 1200px) {
  .tv-cta--red.tv-cta--ghost-mobile {
    border-color: var(--tv-cta-ghost-border);
    background: var(--tv-cta-ghost-bg);
    box-shadow: var(--tv-cta-ghost-shadow);
    color: rgba(255, 255, 255, 0.92);
    text-shadow: none;
  }

  .tv-cta--red.tv-cta--ghost-mobile::before {
    content: none;
  }

  .tv-cta--red.tv-cta--ghost-mobile:hover,
  .tv-cta--red.tv-cta--ghost-mobile:focus-visible {
    border-color: var(--tv-cta-ghost-border-hover);
    background: var(--tv-cta-ghost-bg-hover);
    box-shadow: var(--tv-cta-ghost-shadow-hover);
    color: #fff;
    filter: none;
  }

  .tv-cta--red.tv-cta--ghost-mobile:active {
    background: var(--tv-cta-ghost-bg);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.22);
  }

  .tv-cta--red.tv-cta--ghost-mobile:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.28);
    outline-offset: 3px;
  }
}

/* --------------------------------------------------------------------------
   Element-level guards — contextual rules like `.footer a`,
   `.option button`, `.s-interior-title button`, and `.b-model button:hover`
   carry element+class specificity (0,1,1)/(0,2,1) and would out-rank the
   bare variant classes. Re-assert the recipe at the same specificity;
   cta.css loads last, so it wins the resulting ties. Layout properties
   (width / margin / max-width) are deliberately NOT guarded — contexts
   like `.option button { width: 100%; max-width: 18rem }` stay in charge.
   -------------------------------------------------------------------------- */

a.tv-cta,
button.tv-cta,
a.tv-cta:hover,
button.tv-cta:hover,
a.tv-cta:focus-visible,
button.tv-cta:focus-visible {
  /* e.g. `.footer a` sets font-size 1rem / line-height 1.8rem, which
     would otherwise inflate the CTA height */
  font-size: var(--tv-cta-font-size);
  font-weight: var(--tv-cta-font-weight);
  letter-spacing: var(--tv-cta-letter-spacing);
  line-height: var(--tv-cta-line-height);
  text-decoration: none;
}

button.tv-cta {
  /* `.s-interior-title button` sets overflow: visible, which would let
     the red sheen layer escape the rounded corners */
  overflow: hidden;
}

a.tv-cta--red,
button.tv-cta--red {
  border-color: var(--tv-cta-red-border);
  background: var(--tv-cta-red-bg);
  box-shadow: var(--tv-cta-red-shadow);
  color: #fff;
}

a.tv-cta--red:hover,
button.tv-cta--red:hover,
a.tv-cta--red:focus-visible,
button.tv-cta--red:focus-visible {
  border-color: var(--tv-cta-red-border-hover);
  background: var(--tv-cta-red-bg-hover);
  box-shadow: var(--tv-cta-red-shadow-hover);
  color: #fff;
}

a.tv-cta--ghost,
button.tv-cta--ghost {
  border-color: var(--tv-cta-ghost-border);
  background: var(--tv-cta-ghost-bg);
  box-shadow: var(--tv-cta-ghost-shadow);
  color: rgba(255, 255, 255, 0.92);
}

a.tv-cta--ghost:hover,
button.tv-cta--ghost:hover,
a.tv-cta--ghost:focus-visible,
button.tv-cta--ghost:focus-visible {
  border-color: var(--tv-cta-ghost-border-hover);
  background: var(--tv-cta-ghost-bg-hover);
  box-shadow: var(--tv-cta-ghost-shadow-hover);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Disabled / loading (both variants)
   -------------------------------------------------------------------------- */

.tv-cta[disabled],
.tv-cta[aria-disabled="true"],
.tv-cta.is-loading {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
  transform: none;
  filter: none;
}

/* --------------------------------------------------------------------------
   Play / Close icon support (home page video CTAs)
   Scaled down from the legacy 2rem .learn-more icon so the CTA height
   still resolves to the canonical 2.36rem.
   -------------------------------------------------------------------------- */

.tv-cta .btn-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  transition: transform 0.25s ease;
}

.tv-cta:hover .btn-icon {
  transform: scale(1.1);
}

/* Play triangle */
.tv-cta .btn-icon::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border-left: 0.62rem solid currentColor;
  border-top: 0.38rem solid transparent;
  border-bottom: 0.38rem solid transparent;
  margin-left: 0.12rem;
}

/* Close (X) state — JS toggles .is-close on the anchor */
.tv-cta.is-close .btn-icon::before,
.tv-cta.is-close .btn-icon::after {
  content: "";
  position: absolute;
  width: 0.9rem;
  height: 2px;
  background: currentColor;
  border: 0;
  margin: 0;
}

.tv-cta.is-close .btn-icon::before {
  transform: rotate(45deg);
}

.tv-cta.is-close .btn-icon::after {
  transform: rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Small phones — the service-card Add Item itself bumps to 2.46rem with
   0.56rem vertical padding at ≤620px (service-cards.css), so the shared
   tokens follow it to stay pixel-identical at every width.
   -------------------------------------------------------------------------- */

@media (max-width: 620px) {
  :root {
    --tv-cta-height: 2.46rem;
    --tv-cta-pad-y: 0.56rem;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .tv-cta,
  .tv-cta::before,
  .tv-cta .btn-icon {
    transition: none;
  }
}
