/* Tandao Theme v0.3.34 — editorial hyperlinks and image captions.
 * Only editor-authored content. Navigation, contents lists, UX blocks,
 * galleries, image links and buttons retain their own styles.
 */

/* Match WordPress post/page bodies and WooCommerce product copy. */
:is(
  .tpa-article .tpa-prose,
  .tpa-standard-page .tpa-prose,
  .woocommerce div.product .woocommerce-tabs .panel,
  .woocommerce div.product .woocommerce-product-details__short-description
) :is(p, li, td, dd, blockquote, figcaption) a[href]:not(:is(.button, .btn, .wp-block-button__link, .wp-element-button, .tpa-button, .tpa-card-link, [role="button"])):not(:where(
  .tpa-ux-block a, .ux-block a, .tpa-ux-gallery a, .ux-gallery a,
  .wp-block-gallery a, .blocks-gallery-grid a, .gallery a,
  .wp-block-image a, .wp-caption a, .wp-block-buttons a,
  .ez-toc-container a, .toc_container a, .lwptoc a, .rank-math-toc-block a,
  .wp-block-table-of-contents a, .tpa-toc a, .toc a
)) {
  color: #0066cc !important;
  text-decoration: none !important;
  text-underline-offset: initial !important;
}

:is(
  .tpa-article .tpa-prose,
  .tpa-standard-page .tpa-prose,
  .woocommerce div.product .woocommerce-tabs .panel,
  .woocommerce div.product .woocommerce-product-details__short-description
) :is(p, li, td, dd, blockquote, figcaption) a[href]:not(:is(.button, .btn, .wp-block-button__link, .wp-element-button, .tpa-button, .tpa-card-link, [role="button"])):not(:where(
  .tpa-ux-block a, .ux-block a, .tpa-ux-gallery a, .ux-gallery a,
  .wp-block-gallery a, .blocks-gallery-grid a, .gallery a,
  .wp-block-image a, .wp-caption a, .wp-block-buttons a,
  .ez-toc-container a, .toc_container a, .lwptoc a, .rank-math-toc-block a,
  .wp-block-table-of-contents a, .tpa-toc a, .toc a
)):is(:hover, :focus-visible, :active) {
  color: #004999 !important;
  text-decoration: none !important;
}

/* Classic Editor frequently wraps linked text in spans/strong tags with an
 * inline black color. Force those text nodes to inherit the blue link color. */
:is(
  .tpa-article .tpa-prose,
  .tpa-standard-page .tpa-prose,
  .woocommerce div.product .woocommerce-tabs .panel,
  .woocommerce div.product .woocommerce-product-details__short-description
) :is(p, li, td, dd, blockquote, figcaption) a[href]:not(:is(.button, .btn, .wp-block-button__link, .wp-element-button, .tpa-button, .tpa-card-link, [role="button"])):not(:where(
  .tpa-ux-block a, .ux-block a, .tpa-ux-gallery a, .ux-gallery a,
  .wp-block-gallery a, .blocks-gallery-grid a, .gallery a,
  .wp-block-image a, .wp-caption a, .wp-block-buttons a,
  .ez-toc-container a, .toc_container a, .lwptoc a, .rank-math-toc-block a,
  .wp-block-table-of-contents a, .tpa-toc a, .toc a
)) :is(span, strong, b, em, i, font) {
  color: inherit !important;
  text-decoration: none !important;
}

/* Keep inline editorial text links on the normal text baseline.
 * Image/media links remain block-level as required by responsive media CSS. */
:is(
  .tpa-article .tpa-prose,
  .tpa-standard-page .tpa-prose,
  .woocommerce div.product .woocommerce-tabs .panel,
  .woocommerce div.product .woocommerce-product-details__short-description
) :is(p, li, td, dd, blockquote) a[href]:not(:has(img, picture, svg)):not(:is(.button, .btn, .wp-block-button__link, .wp-element-button, .tpa-button, .tpa-card-link, [role="button"])):not(:where(
  .tpa-ux-block a, .ux-block a, .wp-block-gallery a, .gallery a,
  .ez-toc-container a, .toc_container a, .lwptoc a, .rank-math-toc-block a,
  .wp-block-table-of-contents a, .tpa-toc a, .toc a
)) {
  display: inline !important;
  width: auto !important;
  max-width: none !important;
  white-space: normal !important;
  vertical-align: baseline !important;
}

/* Existing Theme rules accidentally set picture links to display:inline.
 * Keep linked images in their intended responsive block layout. */
:is(
  .tpa-article .tpa-prose,
  .tpa-standard-page .tpa-prose,
  .woocommerce div.product .woocommerce-tabs .panel,
  .woocommerce div.product .woocommerce-product-details__short-description
) :is(p, figure) > a[href]:has(img, picture):not(.button):not(.btn):not(.wp-block-button__link):not(.wp-element-button):not(:where(
  .tpa-ux-block a, .ux-block a, .tpa-ux-gallery a, .ux-gallery a,
  .wp-block-gallery a, .gallery a
)) {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Genuine WordPress captions (Classic Editor / Gutenberg / gallery). */
:is(
  .tpa-article .tpa-prose,
  .tpa-standard-page .tpa-prose,
  .woocommerce div.product .woocommerce-tabs .panel,
  .woocommerce div.product .woocommerce-product-details__short-description
) :is(figcaption, .wp-caption-text, .wp-element-caption, .gallery-caption, .blocks-gallery-item__caption):not(:where(.tpa-ux-block *, .ux-block *, .tpa-ux-gallery *, .ux-gallery *)) {
  text-align: center !important;
  font-style: italic !important;
  font-size: 14px;
  line-height: 1.5;
  color: #666;
  margin-top: 5px !important;
}
