/* Shared by the article pages: the back-to-top button and the link preview card
   (assets/js/article-ui.js). */

/* Back to top: a round button with a ring that fills as you read, and a label that
   slides out on hover. */
.pt-totop { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 0; height: 52px; padding: 0; border: 0; border-radius: 26px; background: #004aeb; color: #fff; font: 600 14px/1 "Noto Sans Thai", Arial, sans-serif; box-shadow: 0 8px 24px #00184a40; cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(16px); transition: opacity .25s ease, transform .25s ease, visibility .25s, background-color .2s ease; }
.pt-totop.is-shown { opacity: 1; visibility: visible; transform: translateY(0); }
.pt-totop:hover { background: #0037b3; }
.pt-totop-icon { position: relative; display: grid; place-items: center; width: 52px; height: 52px; flex: none; }
.pt-totop-icon > svg:not(.pt-totop-ring) { width: 20px; height: 20px; transition: transform .2s ease; }
.pt-totop:hover .pt-totop-icon > svg:not(.pt-totop-ring) { transform: translateY(-2px); }
.pt-totop-ring { position: absolute; inset: 4px; width: 44px; height: 44px; transform: rotate(-90deg); }
.pt-totop-ring circle { fill: none; stroke: #fe9300; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .1s linear; }
.pt-totop-label { max-width: 0; overflow: hidden; white-space: nowrap; transition: max-width .25s ease, padding .25s ease; }
.pt-totop:hover .pt-totop-label,
.pt-totop:focus-visible .pt-totop-label { max-width: 140px; padding-right: 18px; }
.pt-totop:focus-visible { outline: 3px solid #fe9300; outline-offset: 3px; }
@media (min-width: 768px) { .pt-totop { right: 75px; } }

/* Link preview: floating card under (or over) a link in the article text */
.pt-lp { position: fixed; z-index: 70; width: 320px; max-width: calc(100vw - 24px); display: grid; overflow: hidden; border: 1px solid #dce3ef; border-radius: 14px; background: #fff; color: #00184a; font-family: "Noto Sans Thai", Arial, sans-serif; box-shadow: 0 16px 40px #00184a2e; pointer-events: none; opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .18s ease, transform .18s ease; }
.pt-lp.is-above { transform: translateY(-6px) scale(.98); }
.pt-lp.is-open { opacity: 1; transform: none; }
.pt-lp-img { display: block; aspect-ratio: 1.91 / 1; background: #eef3fb; overflow: hidden; }
.pt-lp-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pt-lp-body { display: grid; gap: 4px; padding: 12px 14px 14px; }
.pt-lp-site { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: #52647e; }
.pt-lp-site img { width: 14px; height: 14px; border-radius: 3px; }
.pt-lp b { font-size: 14.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pt-lp-desc { font-size: 12.5px; line-height: 1.55; color: #52647e; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pt-lp-price { font-size: 16px; color: #e07b00; }
.pt-lp em { font-style: normal; font-size: 12.5px; font-weight: 600; color: #004aeb; margin-top: 2px; }
.pt-lp.is-loading .pt-lp-body::after { content: ""; height: 3px; margin-top: 4px; border-radius: 2px; background: linear-gradient(90deg, #eef3fb 25%, #c7d6ff 50%, #eef3fb 75%); background-size: 200% 100%; animation: pt-lp-load 1s linear infinite; }
@keyframes pt-lp-load { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .pt-totop, .pt-totop *, .pt-lp { transition: none !important; }
  .pt-lp.is-loading .pt-lp-body::after { animation: none; }
}
