/* Shared interaction contract. Keep pd-sig-* decorations and entrance motion owned
   by their existing modules. Only destination cards get a stretched link. */
:root {
  --pd-hover-mint: #3EE6B5;
  --pd-hover-edge: rgba(62, 230, 181, .35);
  --pd-hover-shadow: 0 0 0 1px rgba(62, 230, 181, .25), 0 12px 40px -12px rgba(62, 230, 181, .22);
}

html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card) {
  position: relative;
  isolation: isolate;
}
html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card):not([data-aos]):where(:not([data-xp-reveal]), .xp-settled) {
  transition: transform .3s ease-out, box-shadow .3s ease-out, border-color .3s ease-out;
}
html body :is(.pd-linked-card, .pd-action-card, a.pd-hover-card, .dt-card, .tb-card) { cursor: pointer; }

html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card)[class]::before {
  content: "";
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: inherit;
  z-index: 3;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .08) 50%, transparent 60%);
  background-size: 250% 100%;
  background-position: 100% 0;
  opacity: 0;
  transform: none;
  pointer-events: none;
  animation: none;
  transition: none;
}
@keyframes pd-card-sheen {
  0% { background-position: 100% 0; opacity: 0; }
  15%, 80% { opacity: 1; }
  100% { background-position: -100% 0; opacity: 0; }
}

html body :is(.card, .news-card, .tool-card, .pd-hover-card) .card-media { overflow: hidden; }
html body :is(.card, .news-card, .tool-card, .pd-hover-card) .card-media img {
  filter: saturate(.92) brightness(.92);
  transition: transform .6s cubic-bezier(.2, .7, .2, 1), filter .3s ease-out;
}
html body :is(.card, .news-card, .tool-card, .pd-hover-card) :is(.card-title, .pd-card-link-title, .pd-card-heading, .dt-link-title, .tb-card-name) {
  transition: color .2s ease-out;
}

/* Intermediate layout wrappers must not become the containing block for ::after. */
html body :is(.pd-linked-card, .pd-action-card) :is(.pd-card-link-layout, .pd-card-link-title) {
  position: static;
  z-index: auto;
  isolation: auto;
  border-radius: inherit;
}
html body :is(.pd-linked-card, .pd-action-card) :is(.card-link, .card-trigger) {
  position: static;
  border: 0;
  border-radius: inherit;
  padding: 0;
  margin: 0;
  background: none;
  box-shadow: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  text-decoration: none;
  cursor: pointer;
}
html body :is(.pd-linked-card, .pd-action-card) :is(.card-link, .card-trigger)::after {
  content: "";
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: none;
  /* This is the native link hit area. Decorative overlays above it ignore input. */
  pointer-events: auto;
}
html body :is(.pd-linked-card, .pd-action-card) :is(a[href], button, input, select, textarea, label, summary, [role="button"], [tabindex], [contenteditable="true"], [data-csp-onclick]):not(.card-link, .card-trigger),
html body :is(.pd-linked-card, .pd-action-card) .card-features-more {
  position: relative;
  z-index: 2;
}
html body :is(.pd-linked-card, .pd-action-card):has(:is(.card-link, .card-trigger):focus-visible),
html body a.pd-hover-card:focus-visible {
  outline: 2px solid #3EE6B5;
  outline-offset: 3px;
}
/* The outer outline is visible even when the media frame clips its own image. */
@supports selector(:has(*)) {
  html body :is(.pd-linked-card, .pd-action-card) :is(.card-link, .card-trigger):focus-visible { outline: none; }
}

/* Secondary actions share geometry. Primary pd-sig-button treatment stays intact. */
html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button),
html#pd-reviewed-home body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .55rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .875rem;
  line-height: 1.5;
  letter-spacing: .01em;
  color: #3EE6B5;
  background: rgba(62, 230, 181, .08);
  border: 1px solid rgba(62, 230, 181, .28);
  text-decoration: none;
  text-shadow: none;
  box-shadow: none;
  transition: background-color .2s ease-out, color .2s ease-out, border-color .2s ease-out, box-shadow .3s ease-out, transform .2s ease-out;
}
html body .btn-arrow { display: inline-block; flex: none; transition: transform .2s ease-out; }
html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"]):not(.pd-sig-button):focus-visible,
html#pd-reviewed-home body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"]):not(.pd-sig-button):focus-visible {
  outline: 2px solid #3EE6B5;
  outline-offset: 2px;
}
html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"]):not(.pd-sig-button):not(:disabled):not([aria-disabled="true"]):active,
html#pd-reviewed-home body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"]):not(.pd-sig-button):not(:disabled):not([aria-disabled="true"]):active {
  transform: translateY(0) scale(.98);
}

/* Text links only: card titles, actions and navigation retain their own geometry. */
html body :is(main, article, .pd-article-body) :is(p, li, dd, figcaption) > a[href]:not([class*="btn"], [class*="button"], [data-xp-action], .card-link, .pd-hover-card, .pd-secondary-action, .tag),
html body a.pd-text-link {
  color: #3EE6B5;
  text-decoration-line: underline;
  text-decoration-color: rgba(62, 230, 181, .4);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  transition: color .2s, text-decoration-color .2s, text-shadow .2s;
}
html body :is(.pd-primary-menu, .pd-tools-menu, .pd-site-footer, .pd-footer, footer) a:not(.pd-sig-button),
html body .pd-primary-menu summary {
  transition: color .2s, background-color .2s;
}
html body :is(.pd-primary-menu, .pd-tools-menu, .pd-site-footer, .pd-footer, footer) a[aria-current="page"]:not(.pd-sig-button) {
  color: #3EE6B5;
  background-image: linear-gradient(90deg, #3EE6B5, #7CF7D4);
  background-position: center calc(100% - 4px);
  background-repeat: no-repeat;
  background-size: calc(100% - 24px) 2px;
}
html body .pd-primary-menu > a[aria-current="page"]:not(.pd-report-link) { background-image: none; }
html body .pd-primary-menu > a[aria-current="page"]:not(.pd-report-link)::after {
  height: 2px;
  background: linear-gradient(90deg, #3EE6B5, #7CF7D4);
  pointer-events: none;
}
html body .pd-primary-menu details:has(a[aria-current="page"]) > summary {
  color: #3EE6B5;
  background: linear-gradient(90deg, #3EE6B5, #7CF7D4) center calc(100% - 4px) / calc(100% - 24px) 2px no-repeat;
}
html body :is(.pd-site-footer, footer) a[aria-current="page"]:not(.pd-sig-button) { background-size: 100% 2px; }

@media (hover: hover) and (pointer: fine) {
  html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card)[class]:hover,
  html#pd-reviewed-home body .pd-hover-card:hover,
  html[data-page="news"] body #newsGrid > .news-card:hover {
    border-color: rgba(62, 230, 181, .35);
    box-shadow: 0 0 0 1px rgba(62, 230, 181, .25), 0 12px 40px -12px rgba(62, 230, 181, .22);
  }
  html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card):not([data-aos]):where(:not([data-xp-reveal]), .xp-settled):hover {
    transform: translateY(-4px);
  }
  /* Separate translate composes with AOS' transform; its reveal is never reset. */
  html body :is(.card, .tool-card, .pd-hover-card)[data-aos].aos-animate:hover { translate: 0 -4px; }
  html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card):hover::before {
    animation: pd-card-sheen 1s ease 1;
  }
  html body :is(.card, .news-card, .tool-card, .pd-hover-card):hover .card-media img {
    transform: scale(1.05);
    filter: brightness(1.05) saturate(1.05);
  }
  html body :is(.card, .news-card, .tool-card, .pd-hover-card):hover :is(.card-title, .pd-card-link-title, .pd-card-heading, .dt-link-title, .tb-card-name) { color: #3EE6B5; }
  html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button):not(:disabled):not([aria-disabled="true"]):hover,
  html#pd-reviewed-home body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button):not(:disabled):not([aria-disabled="true"]):hover {
    background: rgba(62, 230, 181, .16);
    border-color: rgba(62, 230, 181, .55);
    box-shadow: 0 0 18px -4px rgba(62, 230, 181, .35);
    color: #3EE6B5;
    transform: translateY(-1px);
  }
  html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"]):not(:disabled):not([aria-disabled="true"]):hover .btn-arrow,
  html#pd-reviewed-home body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"]):not(:disabled):not([aria-disabled="true"]):hover .btn-arrow { transform: translateX(3px); }
  html body :is(main, article, .pd-article-body) :is(p, li, dd, figcaption) > a[href]:not([class*="btn"], [class*="button"], [data-xp-action], .card-link, .pd-hover-card, .pd-secondary-action, .tag):hover,
  html body a.pd-text-link:hover {
    text-decoration-color: #3EE6B5;
    text-shadow: 0 0 12px rgba(62, 230, 181, .25);
  }
  html body :is(.pd-primary-menu, .pd-tools-menu, .pd-site-footer, .pd-footer, footer) a:not(.pd-sig-button):hover,
  html body .pd-primary-menu summary:hover { color: #3EE6B5; }
}

/* Pressed feedback takes precedence while the pointer is still hovering. */
html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button):not(:disabled):not([aria-disabled="true"]):active,
html#pd-reviewed-home body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button):not(:disabled):not([aria-disabled="true"]):active {
  transform: translateY(0) scale(.98);
}

/* Touch and reduced motion retain color feedback without sticky movement. */
@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card):not([data-aos]),
  html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"]):not(.pd-sig-button),
  html#pd-reviewed-home body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"]):not(.pd-sig-button) {
    transition: color .2s, background-color .2s, border-color .2s;
  }
  html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card):not([data-aos]):where(:not([data-xp-reveal]), .xp-settled):hover,
  html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"]):not(.pd-sig-button):is(:hover, :active),
  html body :is(.card, .news-card, .tool-card, .pd-hover-card):hover .card-media img,
  html#pd-reviewed-home body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"]):not(.pd-sig-button):is(:hover, :active),
  html body .btn-arrow {
    transform: none !important;
    translate: none !important;
    transition: color .2s, background-color .2s, border-color .2s, filter .2s;
  }
  html body :is(.card, .tool-card, .pd-hover-card)[data-aos].aos-animate:hover { translate: none !important; }
  html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card)::before { animation: none !important; opacity: 0 !important; }
  html body :is(.card, .news-card, .tool-card, .pd-hover-card):hover :is(.card-title, .pd-card-link-title, .pd-card-heading, .dt-link-title, .tb-card-name) { color: #3EE6B5; }
}
@media (hover: none), (pointer: coarse) {
  html body :is(.pd-secondary-action, .read-btn),
  html#pd-reviewed-home body :is(.pd-secondary-action, .read-btn) { min-height: 44px; }
}
@media print {
  html body :is(.card, .news-card, .tool-card, .pd-hover-card)::before { display: none; }
}

/* Legacy article styles use !important, including rules in pd-quality. Keep the
   interaction contract in that existing layer; preserve surfaces, layout and
   pd-sig-* decorations. XP entrance motion finishes before hover takes over. */
@layer pd-quality {
  html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card):not([data-aos]):where(:not([data-xp-reveal]), .xp-settled) {
    transition: transform .3s ease-out, box-shadow .3s ease-out, border-color .3s ease-out !important;
  }

  html body :is(.pd-linked-card, .pd-action-card) :is(.pd-card-link-layout, .pd-card-link-title, .card-link, .card-trigger) {
    position: static !important;
    z-index: auto !important;
    isolation: auto !important;
  }
  html body :is(.pd-linked-card, .pd-action-card) :is(.card-link, .card-trigger) {
    color: inherit !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
    text-shadow: none !important;
  }
  html body :is(.pd-linked-card, .pd-action-card) :is(a[href], button, input, select, textarea, label, summary, [role="button"], [tabindex], [contenteditable="true"], [data-csp-onclick]):not(.card-link, .card-trigger) {
    position: relative !important;
    z-index: 2 !important;
  }
  /* Auto-generated heading permalinks remain a separate, reachable control. */
  html body .pd-linked-card .pd-card-link-title:has(> .card-link):has(> .pd-h-anchor) {
    display: flex !important;
    align-items: flex-start;
    gap: 8px;
    padding-inline-end: 0 !important;
  }
  html body .pd-card-link-title:has(> .pd-h-anchor) > .card-link { flex: 1; min-width: 0; }
  html body .pd-linked-card .pd-card-link-title > .pd-h-anchor {
    inset: auto !important;
    inset-inline: auto !important;
    flex: 0 0 40px;
  }
  html body :is(.pd-linked-card, .pd-action-card):has(:is(.card-link, .card-trigger):focus-visible),
  html body a.pd-hover-card:focus-visible {
    outline: 2px solid #3EE6B5 !important;
    outline-offset: 3px !important;
  }
  @supports selector(:has(*)) {
    html body :is(.pd-linked-card, .pd-action-card) :is(.card-link, .card-trigger):focus-visible { outline: none !important; }
  }

  html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button) {
    align-items: center !important;
    gap: .5rem !important;
    padding: .55rem 1.1rem !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    font-size: .875rem !important;
    line-height: 1.5 !important;
    letter-spacing: .01em !important;
    color: #3EE6B5 !important;
    background: rgba(62, 230, 181, .08) !important;
    border: 1px solid rgba(62, 230, 181, .28) !important;
    box-shadow: none !important;
    text-decoration: none !important;
    text-shadow: none !important;
    filter: none !important;
    transition: background-color .2s ease-out, color .2s ease-out, border-color .2s ease-out, box-shadow .3s ease-out, transform .2s ease-out !important;
  }
  html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button):focus-visible {
    outline: 2px solid #3EE6B5 !important;
    outline-offset: 2px !important;
  }
  html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button)[hidden] {
    display: none !important;
  }

  @media (hover: hover) and (pointer: fine) {
    html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card)[class]:hover {
      border-color: var(--pd-hover-edge) !important;
      box-shadow: var(--pd-hover-shadow) !important;
    }
    html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card):not([data-aos]):where(:not([data-xp-reveal]), .xp-settled):hover {
      transform: translateY(-4px) !important;
    }
    html body :is(.card, .news-card, .tool-card, .pd-hover-card):hover :is(.card-title, .pd-card-link-title, .pd-card-heading, .dt-link-title, .tb-card-name) {
      color: var(--pd-hover-mint) !important;
    }
    html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button):not(:disabled):not([aria-disabled="true"]):hover {
      background: rgba(62, 230, 181, .16) !important;
      border-color: rgba(62, 230, 181, .55) !important;
      box-shadow: 0 0 18px -4px rgba(62, 230, 181, .35) !important;
      transform: translateY(-1px) !important;
    }
  }
  html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button):not(:disabled):not([aria-disabled="true"]):active {
    transform: translateY(0) scale(.98) !important;
  }

  @media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
    html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card):not([data-aos]):where(:not([data-xp-reveal]), .xp-settled),
    html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button) {
      transition: color .2s, background-color .2s, border-color .2s !important;
    }
    html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card):not([data-aos]):where(:not([data-xp-reveal]), .xp-settled):hover,
    html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button):not(:disabled):not([aria-disabled="true"]):is(:hover, :active),
    html body .btn-arrow {
      transform: none !important;
      translate: none !important;
    }
    html body :is(.card, .news-card, .tool-card, .pd-hover-card):hover .card-media img {
      transform: none !important;
      transition: filter .2s !important;
    }
    html body :is(.card, .news-card, .tool-card, .tool-resource-card, .dt-card, .tb-card, .dt-link-card, .pd-hover-card)::before { animation: none !important; opacity: 0 !important; }
  }
  @media (hover: none), (pointer: coarse) {
    html body :is(.pd-secondary-action, .read-btn, [data-xp-action="secondary"], .pd-btn-secondary, .pd-btn-outline, .pd-button--secondary, .btn-secondary, .btn-ghost):not(.pd-sig-button) { min-height: 44px !important; }
  }
}
