/* ============================================================
   Pasrasaa Publishing — สไตล์หน้าเว็บ
   สีและรูปทรงอ้างอิงจากไฟล์ดีไซน์ Pasrasaa Publishing.dc.html
   ตัวแปรสีถูกฉีดจากหน้าตั้งค่าหลังบ้าน (ดู layout.blade.php)
   ============================================================ */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: #fff;
    color: var(--ink);
    font-family: 'IBM Plex Sans Thai', 'Noto Sans Thai', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    /* หมายเหตุ: ห้ามใส่ overflow-x ที่ body — จะทำให้ position:sticky ของแถบเมนูไม่ทำงาน
       กันล้นแนวนอนด้วยการคุมความกว้างของ .decor และ max-width ของแต่ละส่วนแทน */
}

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); }
button, input, textarea, select { font-family: inherit; }
::placeholder { color: #c9a9aa; opacity: 1; }
img { max-width: 100%; }

/* ---------- แอนิเมชัน ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes floatA { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }
@keyframes floatB { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(14px) scale(1.07); } }
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes draw { from { stroke-dashoffset: 340; } to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.92); } 65% { transform: scale(1.02); } 100% { opacity: 1; transform: scale(1); } }
@keyframes expand { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 22px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(195, 21, 22, .35); }
    70% { box-shadow: 0 0 0 14px rgba(195, 21, 22, 0); }
    100% { box-shadow: 0 0 0 0 rgba(195, 21, 22, 0); }
}
@keyframes riseHeart {
    0% { opacity: 0; transform: translateY(10px) scale(.5); }
    18% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-150px) scale(1.2) rotate(14deg); }
}
@keyframes swing { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes sheetUp { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes ticker {
    0%, 28% { transform: translateY(0); }
    33.3%, 61.3% { transform: translateY(-33.333%); }
    66.6%, 94.6% { transform: translateY(-66.666%); }
    100% { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- โครงหน้า ---------- */
.wrap { max-width: 1080px; margin: 0 auto; }
.wrap-wide { max-width: 1180px; margin: 0 auto; }
.section { position: relative; padding: clamp(28px, 4.5vw, 56px) clamp(16px, 4vw, 40px); }
.section-last { padding-bottom: clamp(40px, 6vw, 80px); }

.h-mitr {
    margin: 0; font-family: 'Mitr', sans-serif; font-weight: 500;
    font-size: clamp(19px, 3.2vw, 32px); color: var(--red);
}
.h-serif {
    margin: 0; font-family: 'Playfair Display', Georgia, serif; font-weight: 900;
    font-size: clamp(22px, 4.6vw, 44px); letter-spacing: .01em; color: #231b1c;
}
.head-row { display: flex; align-items: center; gap: clamp(10px, 2vw, 20px); margin-bottom: clamp(14px, 2.2vw, 24px); }

.dot-solid { width: clamp(20px, 3vw, 34px); height: clamp(20px, 3vw, 34px); border-radius: 50%; background: var(--red); flex: none; }
.dot-ring {
    width: clamp(18px, 2.6vw, 28px); height: clamp(18px, 2.6vw, 28px); border-radius: 50%;
    border: clamp(6px, .9vw, 9px) solid var(--red); flex: none; animation: pulseRing 3.4s ease-out infinite;
}

/* กล่องเส้นประ — ลายเซ็นของดีไซน์นี้ */
.dashed-box {
    border: 2.5px dashed var(--red);
    border-radius: clamp(20px, 3vw, 32px);
    padding: clamp(20px, 3.4vw, 40px) clamp(18px, 3.4vw, 44px);
    background: #fffdfd;
    transition: transform .35s, box-shadow .35s;
}
.dashed-box:hover { transform: translateY(-4px); box-shadow: 0 16px 30px rgba(195, 21, 22, .14); }

/* วงกลมตกแต่งลอยพื้นหลัง */
.decor { position: absolute; border-radius: 50%; pointer-events: none; z-index: 0; }
/* ครอบวงกลมตกแต่งไม่ให้ดันความกว้างหน้าจอ (ต้นเหตุที่หน้าจอเลื่อนซ้ายขวาได้บนมือถือ) */
.section, .site-header { overflow-x: clip; }
.decor-solid { background: var(--red); }

/* ---------- หัวเว็บ ---------- */
.site-header { position: relative; background: #fff; }
.brand-row {
    position: relative; max-width: 1180px; margin: 0 auto;
    padding: clamp(20px, 3.4vw, 38px) clamp(16px, 4vw, 40px) clamp(12px, 2vw, 20px);
    display: flex; align-items: center; gap: clamp(6px, 1.6vw, 18px);
    animation: fadeIn .7s both;
}
.brand-text {
    display: flex; align-items: center; font-family: 'Baloo 2', cursive; font-weight: 800;
    color: var(--red); text-shadow: 3px 4px 0 var(--red-soft);
}
.brand-text .big { font-size: clamp(58px, 11.2vw, 120px); line-height: .74; letter-spacing: -.04em; }
.brand-text .stack {
    display: flex; flex-direction: column; line-height: .84;
    font-size: clamp(28px, 5.4vw, 57px); letter-spacing: -.01em;
}

/* ---------- แถบเมนู ---------- */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--red);
    box-shadow: 0 8px 22px rgba(195, 21, 22, .2);
    /* กันเบราว์เซอร์บางตัวคำนวณ sticky พลาดตอนมี element ลอยอยู่ใกล้ๆ */
    will-change: transform;
}
/* เงาเข้มขึ้นนิดเมื่อเลื่อนลงไปแล้ว ให้รู้ว่าแถบลอยอยู่เหนือเนื้อหา */
.site-nav.stuck { box-shadow: 0 10px 28px rgba(90, 0, 2, .34); }
.nav-inner {
    max-width: 1180px; margin: 0 auto; padding: 0 clamp(6px, 3vw, 28px);
    display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between;
    gap: 4px; overflow-x: auto; scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }

.nav-link-pill {
    display: flex; align-items: center; margin: clamp(5px, .9vw, 10px) 2px;
    padding: clamp(7px, 1.2vw, 13px) clamp(9px, 2.2vw, 25px); white-space: nowrap;
    color: #ffdfe0; font-family: 'Mitr', sans-serif; font-weight: 400;
    font-size: clamp(13px, 1.6vw, 17px); border-radius: 999px;
    transition: color .2s, background .25s;
}
.nav-link-pill:hover { color: #fff; background: rgba(255, 255, 255, .2); }
.nav-link-pill.active {
    background: #fff; color: var(--red); font-weight: 500;
    box-shadow: 0 7px 18px rgba(90, 0, 2, .28); animation: pop .3s both;
}
.nav-link-pill.active:hover { background: #fff; color: var(--red); }

.nav-icon-btn {
    border: 0; background: transparent; color: #fff; cursor: pointer; padding: 6px;
    display: flex; align-items: center; position: relative; transition: transform .25s;
}
.nav-icon-btn:hover { transform: translateY(-2px) scale(1.08); }
.nav-text-btn {
    border: 0; background: transparent; color: #ffdfe0; cursor: pointer;
    font-family: 'Mitr', sans-serif; font-size: clamp(10.5px, 1.5vw, 16px);
    padding: 6px 2px; white-space: nowrap; transition: color .2s;
}
.nav-text-btn:hover { color: #fff; }

.cart-badge {
    position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 9px; background: #fff; color: var(--red); font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; animation: pop .3s both;
}

.lang-switch {
    display: flex; align-items: center; gap: 4px;
    background: rgba(255, 255, 255, .16); border-radius: 999px; padding: 3px 4px;
}
.lang-switch a {
    display: block; color: #ffdfe0; border-radius: 999px; padding: 4px 11px;
    font-size: clamp(10.5px, 1.3vw, 12.5px); transition: color .2s;
}
.lang-switch a:hover { color: #fff; }
.lang-switch a.on { background: #fff; color: var(--red); font-weight: 600; animation: pop .25s both; }

/* ---------- การ์ดหนังสือ ---------- */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(max(140px, calc((100% - 3 * clamp(12px, 2.4vw, 28px)) / 4)), 1fr));
    gap: clamp(14px, 2.6vw, 34px) clamp(12px, 2.4vw, 28px);
}
.book-item { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.2vw, 13px); }
.book-cover {
    position: relative; width: 100%; aspect-ratio: 71/100; border-radius: 12px; overflow: hidden;
    background: #f6eeee; cursor: pointer; display: block;
    box-shadow: 0 10px 22px rgba(58, 40, 41, .16);
    transition: transform .4s cubic-bezier(.2, .8, .3, 1), box-shadow .4s;
}
.book-cover:hover { transform: translateY(-9px) rotate(-1.4deg); box-shadow: 0 20px 34px rgba(195, 21, 22, .26); }
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.badge-new {
    position: absolute; top: 8px; left: 8px; background: var(--red); color: #fff;
    font-family: 'Mitr', sans-serif; font-size: clamp(9.5px, 1.2vw, 12px);
    padding: 3px 11px; border-radius: 999px;
    box-shadow: 0 4px 10px rgba(195, 21, 22, .4); animation: swing 3s ease-in-out infinite;
}
.badge-out {
    position: absolute; top: 7px; left: 7px; right: 7px; background: var(--red); color: #fff;
    font-family: 'Mitr', sans-serif; font-size: clamp(8.5px, 1.1vw, 10.5px);
    padding: 3px 6px; border-radius: 999px; text-align: center;
    box-shadow: 0 4px 10px rgba(195, 21, 22, .4); animation: swing 3.4s ease-in-out infinite;
}
.badge-soldout {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(35, 27, 28, .5); color: #fff; font-family: 'Mitr', sans-serif;
    font-size: clamp(12px, 1.6vw, 15px);
}

.book-title-sm {
    font-size: clamp(12.5px, 1.6vw, 15px); color: #3a3234; line-height: 1.5;
    text-align: center; text-wrap: pretty;
}
.book-price-sm { font-family: 'Mitr', sans-serif; font-size: clamp(13px, 1.7vw, 16px); color: var(--red); }

.icon-btn {
    border: 0; background: transparent; color: var(--red); cursor: pointer; padding: 2px;
    display: flex; transition: transform .25s;
}
.icon-btn:hover { transform: scale(1.18); }
.icon-btn.wiggle:hover { animation: wiggle .5s ease; }

/* ---------- ปุ่ม ---------- */
.btn-red {
    border: 0; background: var(--red); color: #fff; font-family: 'Mitr', sans-serif;
    font-size: clamp(14px, 1.8vw, 17px); padding: clamp(12px, 1.7vw, 16px) clamp(30px, 4vw, 46px);
    border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 10px 22px rgba(195, 21, 22, .28); transition: transform .25s, box-shadow .25s;
}
.btn-red:hover { transform: translateY(-3px); box-shadow: 0 16px 28px rgba(195, 21, 22, .34); color: #fff; }
.btn-red:disabled { opacity: .65; cursor: not-allowed; transform: none; }

.btn-soft {
    display: inline-flex; align-items: center; gap: 9px;
    border: 1.5px solid #f0c7c8; background: #fffafa; color: #6f6263;
    border-radius: 999px; padding: clamp(11px, 1.5vw, 15px) clamp(18px, 2.4vw, 26px);
    font-size: clamp(12.5px, 1.6vw, 15px); cursor: pointer; transition: background .2s, transform .2s;
}
.btn-soft:hover { background: #ffeeef; transform: translateY(-2px); color: #6f6263; }

.btn-link-arrow {
    border: 0; background: transparent; color: var(--red); font-family: 'Mitr', sans-serif;
    font-size: clamp(13px, 1.8vw, 17px); cursor: pointer; padding: 6px 2px;
    display: inline-flex; align-items: center; gap: 7px; transition: gap .25s;
}
.btn-link-arrow:hover { gap: 13px; }

.line-tag {
    background: #06c755; color: #fff; font-size: 9px; font-weight: 700;
    border-radius: 6px; padding: 3px 5px; letter-spacing: .04em;
}

/* ---------- ฟอร์ม ---------- */
.field {
    width: 100%; border: 2px dashed var(--red); border-radius: 16px;
    padding: clamp(13px, 1.9vw, 19px) clamp(14px, 2vw, 22px);
    font-size: clamp(13.5px, 1.8vw, 17px); color: #3a3234; background: #fff;
    outline: none; transition: box-shadow .25s, border-style .25s;
}
.field:focus { box-shadow: 0 0 0 4px rgba(195, 21, 22, .12); border-style: solid; }
textarea.field { border-radius: 20px; resize: vertical; }
.field-sm { border-radius: 14px; padding: 13px 16px; font-size: clamp(13px, 1.7vw, 15.5px); }
.field-label { display: block; font-size: clamp(12.5px, 1.6vw, 14.5px); color: #8a7d7e; margin-bottom: 6px; }
.field-error { color: var(--red); font-size: 13px; margin-top: 5px; display: block; }

.form-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: clamp(12px, 2vw, 22px);
}
.span-all { grid-column: 1 / -1; }

/* ---------- ท้ายเว็บ ---------- */
.site-footer { background: var(--red); color: #fff; margin-top: auto; }
.footer-inner {
    max-width: 1180px; margin: 0 auto; padding: clamp(14px, 2.2vw, 22px) clamp(16px, 4vw, 40px);
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
}
.footer-copy { font-family: 'Baloo 2', cursive; font-weight: 700; font-size: clamp(11px, 1.5vw, 14.5px); }
.footer-inner a { color: #fff; display: flex; transition: transform .25s; }
.footer-inner a:hover { transform: translateY(-3px) scale(1.08); color: #fff; }

/* ---------- ปุ่มลอย ---------- */
.fab-cart {
    position: fixed; right: clamp(14px, 2.6vw, 28px); bottom: clamp(14px, 2.6vw, 28px); z-index: 101;
    width: clamp(54px, 7vw, 68px); height: clamp(54px, 7vw, 68px); border-radius: 50%;
    border: 3px solid #fff; background: var(--red); color: #fff; cursor: pointer;
    box-shadow: 0 16px 34px rgba(195, 21, 22, .42);
    display: flex; align-items: center; justify-content: center;
    animation: floatA 5.5s ease-in-out infinite; transition: box-shadow .25s;
}
.fab-cart:hover { box-shadow: 0 20px 40px rgba(195, 21, 22, .55); }
.fab-cart .cart-badge {
    top: -3px; right: -3px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
    font-size: 12.5px; box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
}
.fab-top {
    position: fixed; right: clamp(14px, 2.6vw, 28px);
    bottom: calc(clamp(14px, 2.6vw, 28px) + clamp(64px, 8vw, 80px)); z-index: 100;
    width: clamp(44px, 5.6vw, 54px); height: clamp(44px, 5.6vw, 54px); border-radius: 50%;
    border: 3px solid #fff; background: var(--red); color: #fff; cursor: pointer;
    box-shadow: 0 12px 26px rgba(195, 21, 22, .36);
    display: none; align-items: center; justify-content: center; font-size: clamp(15px, 2vw, 19px);
    animation: fadeIn .3s both, floatA 5s ease-in-out infinite;
}
.fab-top.show { display: flex; }

/* ---------- โมดัล ---------- */
.modal-mask {
    position: fixed; inset: 0; z-index: 110; background: rgba(35, 27, 28, .55);
    display: none; align-items: center; justify-content: center; padding: 20px;
    animation: fadeIn .25s both;
}
.modal-mask.open { display: flex; }
.modal-card {
    background: #fff; border-radius: clamp(20px, 3vw, 28px); padding: clamp(20px, 3.4vw, 34px);
    width: min(430px, 92vw); box-shadow: 0 26px 60px rgba(0, 0, 0, .3);
    animation: pop .32s both; max-height: 88vh; overflow: auto;
}
.modal-title { font-family: 'Mitr', sans-serif; color: var(--red); font-size: clamp(17px, 2.4vw, 22px); margin-bottom: 6px; }
.modal-note { margin: 0 0 16px; font-size: clamp(12.5px, 1.7vw, 14.5px); color: #8a7d7e; }
.modal-close {
    border: 0; background: #fff4f4; color: var(--red); width: 34px; height: 34px;
    border-radius: 50%; cursor: pointer; font-size: 15px; flex: none;
}

/* ตะกร้าเลื่อนขึ้นจากด้านล่าง */
.sheet-mask { align-items: flex-end; padding: clamp(14px, 3vw, 28px); }
.sheet-card {
    background: #fff; border-radius: clamp(20px, 3vw, 28px);
    padding: clamp(20px, 3.2vw, 32px) clamp(18px, 3.2vw, 34px) clamp(22px, 3.2vw, 32px);
    width: min(620px, 100%); margin: 0 auto; max-height: 82vh; overflow: auto;
    box-shadow: 0 22px 60px rgba(0, 0, 0, .34); animation: sheetUp .34s both;
}

.qty-box { display: flex; align-items: center; border: 1.5px solid #f0c7c8; border-radius: 12px; overflow: hidden; flex: none; }
.qty-box button {
    border: 0; background: #fffafa; color: var(--red);
    width: clamp(34px, 4vw, 40px); height: clamp(34px, 4vw, 40px);
    cursor: pointer; font-size: 17px; transition: background .2s;
}
.qty-box button:hover { background: #ffeeef; }
.qty-box .val { min-width: clamp(38px, 4.4vw, 46px); text-align: center; font-size: clamp(14px, 1.8vw, 17px); }

.cart-line { display: flex; gap: 12px; align-items: center; border-bottom: 1.5px dashed #f4dede; padding-bottom: 12px; }
.cart-line img { width: 52px; aspect-ratio: 71/100; object-fit: cover; border-radius: 7px; flex: none; box-shadow: 0 5px 12px rgba(0, 0, 0, .16); }

.total-row { display: flex; justify-content: space-between; }
.total-grand {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 2px dashed #f0c7c8; padding-top: 10px; margin-top: 4px;
    font-family: 'Mitr', sans-serif; font-size: clamp(15px, 2.2vw, 20px); color: var(--red);
}

/* ---------- toast ---------- */
.toast-msg {
    position: fixed; left: 50%; bottom: 26px; z-index: 120; background: #231b1c; color: #fff;
    border-radius: 999px; padding: 12px 24px; font-size: clamp(13px, 1.7vw, 15px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, .28); animation: toastIn .35s both;
}

/* ---------- สปินเนอร์ในปุ่ม ---------- */
.spin {
    width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff; border-radius: 50%; display: inline-block;
    animation: spinSlow .7s linear infinite;
}
.btn-soft .spin, .btn-outline .spin { border-color: rgba(195, 21, 22, .3); border-top-color: var(--red); }

/* ---------- แถบข่าววิ่ง ---------- */
.ticker-box {
    border: 2.5px dashed var(--red); border-radius: clamp(20px, 3vw, 34px);
    padding: clamp(6px, 1vw, 10px) clamp(16px, 3vw, 34px); overflow: hidden; background: #fffdfd;
    transition: transform .35s, box-shadow .35s;
}
.ticker-box:hover { transform: translateY(-4px); box-shadow: 0 16px 30px rgba(195, 21, 22, .14); }
.ticker-view { height: clamp(58px, 9vw, 86px); overflow: hidden; }
.ticker-item {
    height: clamp(58px, 9vw, 86px); display: flex; align-items: center; justify-content: center;
    text-align: center; font-size: clamp(13.5px, 2.1vw, 20px); color: #4a3f40; line-height: 1.4;
}

/* ---------- หน้ารายละเอียดหนังสือ ---------- */
.detail-cols { display: flex; flex-wrap: wrap; gap: clamp(20px, 4vw, 54px); }
.detail-left { flex: 1 1 330px; min-width: min(100%, 290px); display: flex; flex-direction: column; gap: clamp(10px, 1.6vw, 16px); }
.detail-right { flex: 1 1 340px; min-width: min(100%, 290px); display: flex; flex-direction: column; gap: clamp(10px, 1.5vw, 15px); }
.detail-cover {
    width: 100%; aspect-ratio: 71/100; border-radius: clamp(14px, 2vw, 20px); overflow: hidden;
    background: #f6eeee; box-shadow: 0 16px 36px rgba(58, 40, 41, .2);
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(8px, 1.4vw, 14px); }
.thumb-row .t {
    aspect-ratio: 1/1; border-radius: 10px; overflow: hidden; border: 2px solid var(--red);
    background: #f6eeee; cursor: pointer; padding: 0; display: block;
}
.thumb-row .t img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-row .t.dim { border-color: #e2a9aa; opacity: .75; }

.tab-row { display: flex; gap: clamp(18px, 3vw, 34px); border-bottom: 1.5px solid #f0dede; margin-bottom: clamp(18px, 2.6vw, 28px); }
.tab-btn {
    border: 0; background: transparent; padding: 0 0 12px; cursor: pointer;
    font-family: 'Mitr', sans-serif; font-size: clamp(14px, 1.9vw, 18px); color: #b3a7a8; transition: color .2s;
}
.tab-btn:hover { color: var(--red); }
.tab-btn.on { color: #231b1c; border-bottom: 3px solid var(--red); padding-bottom: 9px; }
.tab-pane { display: none; animation: expand .35s both; }
.tab-pane.on { display: block; }

.spec-row {
    display: flex; gap: 16px; padding: 11px 4px; border-bottom: 1.5px solid #f6e8e8;
    font-size: clamp(12.5px, 1.6vw, 15.5px);
}
.spec-row .k { width: 110px; font-weight: 600; color: #231b1c; flex: none; }
.spec-row .v { color: #5b4f50; }

.desc-p {
    margin: 0; white-space: pre-line; font-size: clamp(13px, 1.7vw, 16.5px);
    line-height: 1.95; color: #4a3f40; text-wrap: pretty;
}

/* ---------- ไทม์ไลน์ผลงาน (สลับกิ่งซ้าย-ขวา เหมือนกันทุกอุปกรณ์) ---------- */
.tl { position: relative; padding: clamp(6px, 1vw, 12px) 0; }

/* ก้านกลาง */
.tl-rail {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 2px;
    bottom: 2px;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(var(--red), var(--red) 80%, #f3c9ca);
}

.tl-row { position: relative; margin-bottom: clamp(6px, 1vw, 12px); min-height: clamp(44px, 6vw, 62px); }

/* จุดบนก้าน */
.tl-dot {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: clamp(13px, 1.7vw, 19px);
    width: clamp(13px, 1.7vw, 18px);
    height: clamp(13px, 1.7vw, 18px);
    border-radius: 50%;
    background: #fff;
    border: clamp(3px, .45vw, 4px) solid var(--red);
    z-index: 3;
    transition: transform .25s, box-shadow .25s;
}
.tl-row.on .tl-dot { transform: translateX(-50%) scale(1.28); box-shadow: 0 0 0 6px rgba(195, 21, 22, .14); }

/* คอลัมน์เนื้อหา — สลับข้างตามลำดับแถว */
.tl-col { width: 50%; padding: 0 clamp(12px, 2.2vw, 26px); }
.tl-row.side-l .tl-col { margin-left: 0;   text-align: right; }
.tl-row.side-r .tl-col { margin-left: 50%; text-align: left; }

.tl-toggle {
    display: inline-flex;
    align-items: center;
    gap: clamp(5px, .9vw, 10px);
    border: 0;
    background: transparent;
    padding: clamp(6px, 1vw, 11px) 0;
    cursor: pointer;
    transition: transform .25s;
}
.tl-row.side-l .tl-toggle { flex-direction: row-reverse; }
.tl-toggle:hover { transform: scale(1.05); }

.tl-year {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(15px, 2.4vw, 28px);
    color: #231b1c;
    letter-spacing: .02em;
    white-space: nowrap;
}
.tl-row.on .tl-year { color: var(--red); }
.tl-count {
    font-size: clamp(8.5px, 1.15vw, 12.5px);
    color: var(--red);
    border: 1.5px solid #f0c7c8;
    border-radius: 999px;
    padding: 2px clamp(5px, .8vw, 9px);
    white-space: nowrap;
}
.tl-caret { color: var(--red); font-size: clamp(8px, 1vw, 11px); }

.tl-list {
    display: none;
    flex-direction: column;
    gap: clamp(3px, .6vw, 8px);
    padding-bottom: clamp(6px, 1.2vw, 14px);
}
.tl-list.open { display: flex; animation: expand .35s both; }

.tl-work {
    display: flex;
    align-items: center;
    gap: clamp(4px, .7vw, 8px);
    font-size: clamp(9.5px, 1.35vw, 15px);
    letter-spacing: .03em;
    color: #5b4f50;
    line-height: 1.5;
    transition: color .2s;
    text-wrap: pretty;
}
.tl-row.side-l .tl-work { flex-direction: row-reverse; }
.tl-row.side-r .tl-work { flex-direction: row; }
.tl-work:hover,
.tl-work.peeking { color: var(--red); font-weight: 500; }
.tl-work:hover .heart,
.tl-work.peeking .heart { color: var(--red); transform: scale(1.25); }
.tl-work .heart { transition: color .2s, transform .2s; }
.tl-work .heart { flex: none; color: #eeb7b8; font-size: .85em; }

/* ปกหนังสือที่เด้งขึ้นมาฝั่งตรงข้าม เมื่อชี้เมาส์หรือแตะ */
.tl-pop {
    position: absolute;
    top: clamp(4px, .8vw, 10px);
    width: clamp(58px, 11vw, 122px);
    display: none;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    z-index: 4;
}
.tl-row .tl-pop.show { display: flex; animation: pop .3s both; }
/* ปกเด้งขึ้นฝั่งตรงข้ามกับข้อความเสมอ */
.tl-row.side-l .tl-pop { left: calc(50% + clamp(14px, 2.4vw, 30px)); }
.tl-row.side-r .tl-pop { right: calc(50% + clamp(14px, 2.4vw, 30px)); }

.tl-pop img {
    width: 100%;
    aspect-ratio: 71/100;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 12px 26px rgba(58, 40, 41, .3);
    animation: swing 4.5s ease-in-out infinite;
}
/* ⚠️ .no-cover ตั้ง display:flex ไว้ ซึ่ง specificity สูงกว่า [hidden] ของเบราว์เซอร์
   ต้องบังคับซ่อนเอง ไม่งั้นกล่องสำรองจะโผล่คู่กับปกจริงตลอด */
.tl-pop [hidden] { display: none !important; }

.tl-pop .no-cover {
    width: 100%;
    aspect-ratio: 71/100;
    border: 2px dashed #e2a9aa;
    border-radius: 10px;
    background: #fffafa;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 8px;
    box-shadow: 0 10px 20px rgba(58, 40, 41, .12);
    animation: swing 4.5s ease-in-out infinite;
}
.tl-pop .no-cover span {
    font-size: clamp(7px, .95vw, 9.5px);
    letter-spacing: .04em;
    line-height: 1.4;
    color: #8a7d7e;
    text-align: center;
}

.stat-strip {
    display: flex; flex-wrap: nowrap; justify-content: center; align-items: center;
    gap: clamp(8px, 3vw, 40px); margin-bottom: clamp(18px, 3vw, 32px);
}
.stat-num { font-family: 'Playfair Display', Georgia, serif; font-weight: 900; font-size: clamp(26px, 4.6vw, 46px); color: var(--red); line-height: 1; }
.stat-label { font-family: 'Mitr', sans-serif; font-size: clamp(9.5px, 1.5vw, 14px); color: #8a7d7e; letter-spacing: .04em; }
.stat-sep { width: 2px; height: clamp(34px, 5vw, 54px); background: repeating-linear-gradient(#f0c7c8 0 6px, transparent 6px 11px); flex: none; }

/* ประวัตินักเขียน — วางข้อความคู่กับรูปเสมอ ไม่ตกบรรทัดบนจอเล็ก (ตามดีไซน์) */
.author-cols { display: flex; flex-wrap: nowrap; gap: clamp(10px, 3vw, 38px); align-items: flex-start; }
.author-text { flex: 1 1 auto; min-width: 0; font-size: clamp(9.5px, 1.55vw, 16.5px); line-height: 1.9; }
.author-side { flex: 0 0 clamp(84px, 27%, 300px); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.author-tag {
    border: 1.5px dashed #e2a9aa; border-radius: 999px;
    padding: clamp(3px, .6vw, 6px) clamp(7px, 1.3vw, 14px);
    font-size: clamp(8px, 1.15vw, 13.5px); color: var(--red); text-align: center; white-space: nowrap;
}

/* ผลงานเด่น — 5 คอลัมน์เสมอทุกอุปกรณ์ (ใส่ได้ถึง 10 เล่ม = 2 แถว)
   ย่อช่องไฟลงเล็กน้อยเพื่อให้ปกไม่เล็กจนเกินไปตอนมี 2 แถว */
.featured-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: clamp(6px, 1.6vw, 18px) clamp(5px, 1.8vw, 20px);
}
.featured-grid .book-cover { border-radius: clamp(7px, 1vw, 11px); }
.featured-grid .book-cover:hover { transform: translateY(-6px) rotate(-1.2deg); }

/* ---------- สถานะคำสั่งซื้อ ---------- */
.step-row { display: flex; flex-wrap: wrap; gap: 6px; margin: clamp(14px, 2.4vw, 24px) 0; }
.step {
    flex: 1 1 120px; text-align: center; padding: 12px 8px; border-radius: 14px;
    background: #fdf4f4; color: #b3a7a8; font-size: clamp(11.5px, 1.5vw, 13.5px);
    border: 1.5px dashed #f0c7c8;
}
.step.done { background: var(--red); color: #fff; border-style: solid; border-color: var(--red); }
.step.current { background: #fff; color: var(--red); border-style: solid; border-width: 2.5px; font-weight: 600; }
.step.cancel { background: #3a3234; color: #fff; border-color: #3a3234; }

.log-item { position: relative; padding-left: 22px; padding-bottom: 16px; border-left: 2px solid #f0dede; }
.log-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.log-item::before {
    content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px;
    border-radius: 50%; background: #fff; border: 3px solid var(--red);
}

/* ---------- แจ้งเตือน/ตาราง ---------- */
.notice {
    border: 2px dashed var(--red); border-radius: 16px; padding: 14px 18px;
    font-size: clamp(13px, 1.7vw, 15px); line-height: 1.8; color: #4a3f40; background: #fffdfd;
}
.empty-box {
    border: 2.5px dashed #f0c7c8; border-radius: clamp(20px, 3vw, 30px);
    padding: clamp(26px, 4vw, 44px); text-align: center; background: #fffdfd;
}

.pager { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: clamp(24px, 4vw, 44px); }
.pager a, .pager span {
    min-width: 38px; height: 38px; padding: 0 12px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px solid #f0c7c8; color: #6f6263; font-size: 14px; background: #fff;
}
.pager a:hover { background: #fff4f4; color: var(--red); }
.pager .on { background: var(--red); border-color: var(--red); color: #fff; }
.pager .off { opacity: .4; }

/* ---------- เลือกจำนวนบนหน้าร้าน ---------- */
.store-toolbar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    margin-bottom: clamp(20px, 3vw, 34px);
}
.chip {
    border: 1.5px solid #f0c7c8; background: #fffafa; color: #6f6263;
    border-radius: 999px; padding: 8px 18px; font-size: clamp(12.5px, 1.6vw, 14.5px);
    cursor: pointer; transition: background .2s, transform .2s; white-space: nowrap;
}
.chip:hover { background: #ffeeef; transform: translateY(-2px); color: #6f6263; }
.chip.on { background: var(--red); border-color: var(--red); color: #fff; }

.search-box {
    display: flex; align-items: center; gap: 8px; border: 2px dashed var(--red);
    border-radius: 999px; padding: 6px 8px 6px 18px; background: #fff; flex: 1 1 240px; max-width: 340px;
}
.search-box input { border: 0; outline: none; flex: 1; min-width: 0; font-size: 14.5px; background: transparent; }
.search-box button {
    border: 0; background: var(--red); color: #fff; width: 34px; height: 34px;
    border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none;
}

/* ---------- หัวใจลอย (ตอนส่งฟอร์มติดต่อ) ---------- */
.hearts {
    position: absolute; left: 0; right: 0; bottom: 14%; pointer-events: none;
    display: flex; justify-content: center; gap: clamp(16px, 4vw, 46px); z-index: 6;
}

@media (max-width: 640px) {
    .stat-strip { gap: 10px; }
    .detail-cols { gap: 22px; }
}

/* ============================================================
   แก้ปัญหาบนมือถือ + ลูกเล่นเพิ่มเติม
   ============================================================ */

/* ---------- ปุ่มลอยมุมขวาล่าง ---------- */
/* ของเดิมใช้ right/bottom เป็น clamp ที่อ้าง vw ทำให้บนจอแคบปุ่มเลยขอบไปทางขวา
   เปลี่ยนมาใช้ค่าคงที่ + safe-area ของ iPhone และรวมปุ่มไว้ในคอลัมน์เดียว */
.fab-stack {
    position: fixed;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    z-index: 101;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.fab-cart,
.fab-top {
    /* ต้องเป็น relative ไม่ใช่ static — ป้ายจำนวนสินค้าเป็น absolute
       ถ้าเป็น static ป้ายจะข้ามไปยึด .fab-stack แล้วไปเกาะปุ่มลูกศรที่อยู่บนสุดแทน */
    position: relative;
    right: auto;
    bottom: auto;
    flex: none;
}

.fab-cart {
    width: clamp(50px, 13vw, 64px);
    height: clamp(50px, 13vw, 64px);
}
.fab-top {
    width: clamp(40px, 10.5vw, 50px);
    height: clamp(40px, 10.5vw, 50px);
    order: -1;             /* ลูกศรขึ้นบนอยู่เหนือปุ่มตะกร้า */
}

/* ---------- ตะกร้าแบบแผ่นเลื่อนขึ้น ---------- */
/* ของเดิมสูงเกินจอบนมือถือจนปุ่ม "ไปหน้าสั่งซื้อ" ตกขอบล่าง
   คุมความสูงด้วย dvh (เผื่อแถบ URL ของมือถือ) แล้วให้เลื่อนภายในการ์ด */
.sheet-mask {
    align-items: flex-end;
    padding: 0;
}
.sheet-card {
    width: min(620px, 100%);
    max-height: min(86dvh, 86vh);
    display: flex;
    flex-direction: column;
    border-radius: clamp(20px, 3vw, 28px) clamp(20px, 3vw, 28px) 0 0;
    padding-bottom: calc(clamp(18px, 3vw, 28px) + env(safe-area-inset-bottom, 0px));
    overflow: hidden;      /* ให้ส่วนที่เลื่อนเป็นลูกใน ไม่ใช่ทั้งการ์ด */
}
.sheet-head { flex: none; }
.sheet-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

@media (min-width: 700px) {
    .sheet-mask { align-items: center; padding: clamp(14px, 3vw, 28px); }
    .sheet-card { border-radius: clamp(20px, 3vw, 28px); max-height: 82vh; }
}

/* โมดัลทั่วไปก็ต้องไม่ล้นจอ */
.modal-card { max-height: min(88dvh, 88vh); }

/* ---------- สินค้าที่เกี่ยวข้อง: แถวเดียวทุกอุปกรณ์ ---------- */
.related-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(7px, 2vw, 26px);
}
.related-row .book-title-sm { font-size: clamp(9px, 1.3vw, 15px); }
.related-row .book-price-sm { font-size: clamp(9.5px, 1.35vw, 16px); }
.related-row .btn-red,
.related-row .btn-soft {
    padding: clamp(5px, 1vw, 8px) clamp(7px, 1.4vw, 16px);
    font-size: clamp(8.5px, 1.15vw, 13.5px);
    box-shadow: none;
    gap: 5px;
}

/* ============================================================
   ลูกเล่นเล็กๆ ให้หน้าเว็บมีชีวิต
   ============================================================ */

/* ปกหนังสือ: เงาวิ่งผ่านตอนชี้เมาส์ เหมือนแสงสะท้อนบนปกจริง */
.book-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .42) 50%, transparent 62%);
    transform: translateX(-120%);
    transition: transform .75s cubic-bezier(.2, .8, .3, 1);
    pointer-events: none;
}
.book-cover:hover::after { transform: translateX(120%); }

/* สันหนังสือบางๆ ด้านซ้ายของปก ให้ดูเป็นเล่มจริง */
.book-cover::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 5px;
    background: linear-gradient(90deg, rgba(0, 0, 0, .22), rgba(0, 0, 0, 0));
    z-index: 2;
    pointer-events: none;
}

/* หัวข้อมีเส้นใต้ค่อยๆ ลากออกมาตอนชี้ */
.h-mitr { position: relative; display: inline-block; }
.h-mitr::after {
    content: '';
    position: absolute;
    left: 0; bottom: -6px;
    height: 3px; width: 0;
    border-radius: 3px;
    background: var(--red-soft);
    transition: width .45s cubic-bezier(.2, .8, .3, 1);
}
.h-mitr:hover::after { width: 100%; }

/* ปุ่มกดแล้วยุบนิดหนึ่ง ให้รู้สึกว่ากดติด */
.btn-red:active, .btn-soft:active, .chip:active { transform: scale(.96); }

/* ตัวหนอนหัวใจตอนใส่ตะกร้าสำเร็จ */
@keyframes cartBump {
    0% { transform: scale(1); }
    35% { transform: scale(1.35) rotate(-8deg); }
    70% { transform: scale(.92) rotate(5deg); }
    100% { transform: scale(1); }
}
.cart-bump { animation: cartBump .55s cubic-bezier(.3, 1.4, .5, 1); }

/* ปกลอยขึ้นไปหาตะกร้าตอนกดใส่ตะกร้า */
.fly-cover {
    position: fixed;
    z-index: 130;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .3);
    pointer-events: none;
    transition: all .85s cubic-bezier(.5, -0.2, .7, 1);
}

/* หมวดหมู่/ชิป: ไล่สีอ่อนวิ่งเข้าเมื่อชี้ */
.chip { position: relative; overflow: hidden; }
.chip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(195, 21, 22, .1), transparent);
    transform: translateX(-100%);
    transition: transform .4s;
}
.chip:hover::before { transform: translateX(0); }
.chip.on::before { display: none; }

/* ตัวอักษรแบรนด์ขยับเบาๆ ตอนชี้ */
.brand-text { transition: transform .35s cubic-bezier(.2, .8, .3, 1); }
.brand-row a:hover .brand-text { transform: translateY(-3px) rotate(-1deg); }

/* ค่อยๆ ปรากฏตอนเลื่อนมาถึง */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .8, .3, 1); }
.reveal.seen { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
}

/* โครงร่างระหว่างรอรูปโหลด (กันหน้ากระตุก) */
.book-cover { background: linear-gradient(100deg, #f6eeee 30%, #fdf6f6 50%, #f6eeee 70%) #f6eeee; background-size: 220% 100%; }
.book-cover img { transition: opacity .45s; }
.book-cover img[data-loading] { opacity: 0; }

/* ริบบิ้นเล็กๆ มุมปกสำหรับเล่มที่ลดราคา */
.badge-sale {
    position: absolute; top: 8px; right: 8px;
    background: #231b1c; color: #fff;
    font-family: 'Mitr', sans-serif; font-size: clamp(9px, 1.15vw, 11.5px);
    padding: 3px 10px; border-radius: 999px; z-index: 3;
}

/* ============================================================
   จอเล็ก (มือถือ)
   ============================================================ */
@media (max-width: 600px) {
    /* ---------- แถบเมนู: บีบให้พอดีจอ ไม่ต้องเลื่อนซ้ายขวา ---------- */
    .nav-inner { padding: 0 6px; gap: 2px; overflow-x: visible; }

    .nav-link-pill {
        margin: 4px 1px;
        padding: 6px 9px;
        font-size: 12.5px;
    }

    /* "คำสั่งซื้อ" เปลี่ยนเป็นไอคอนเพื่อประหยัดที่ */
    .nav-text-btn { font-size: 0; padding: 6px 3px; }
    .nav-text-btn::before {
        content: '🧾';
        font-size: 17px;
        line-height: 1;
    }

    .nav-icon-btn { padding: 5px 3px; }

    .lang-switch { gap: 1px; padding: 2px 3px; }
    .lang-switch a { padding: 3px 7px; font-size: 10.5px; }

    /* ---------- หัวเว็บ: วงกลมตกแต่งอย่าบังโลโก้ ---------- */
    .site-header .decor { opacity: .5; }
    .site-header .decor:first-of-type {
        top: -190px !important;
        right: -140px !important;
        width: 250px !important;
        height: 250px !important;
        border-width: 58px !important;
    }

    .brand-row { padding: 14px 14px 8px; }

    /* ---------- ตัวหนังสือแบรนด์ให้เล็กลงหน่อย ---------- */
    .brand-text .big { font-size: 46px; }
    .brand-text .stack { font-size: 22px; }

    /* ---------- วงกลมตกแต่งในเนื้อหา: จางลง ไม่แย่งสายตา ---------- */
    .section .decor { opacity: .38; }

    /* ---------- การ์ดหนังสือ: 2 คอลัมน์ ---------- */
    .book-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }

    /* ---------- ตะกร้า: ปุ่มยืนยันต้องอยู่ในจอเสมอ ---------- */
    .sheet-card { padding-left: 16px; padding-right: 16px; }
    .cart-line { gap: 8px; }
    .cart-line img { width: 44px; }
}

/* จอแคบมากๆ */
@media (max-width: 380px) {
    .nav-link-pill { padding: 6px 7px; font-size: 11.5px; }
    .brand-text .big { font-size: 40px; }
    .brand-text .stack { font-size: 19px; }
}

/* ---------- เมนูที่กำลังเปิดอยู่: ไอคอน/ข้อความเน้นให้เห็นชัด ---------- */
.nav-text-btn.on { color: #fff; font-weight: 500; }
.nav-icon-btn.on { color: #fff; }
.nav-icon-btn.on::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -2px;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #fff;
}

/* ---------- ข้อความจากร้านถึงลูกค้า (แสดงในหน้าเช็กสถานะ/โพรไฟล์) ---------- */
.shop-note {
    border-radius: 16px;
    background: #fff6f6;
    border-left: 4px solid var(--red);
    padding: clamp(13px, 2vw, 18px) clamp(15px, 2.2vw, 20px);
    margin: clamp(16px, 2.6vw, 24px) 0;
    animation: fadeIn .4s both;
}
.shop-note-head {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: 'Mitr', sans-serif;
    font-size: clamp(13px, 1.7vw, 15.5px);
    color: var(--red);
    margin-bottom: 6px;
}
.shop-note-icon { animation: swing 3s ease-in-out infinite; display: inline-block; }
.shop-note p {
    margin: 0;
    white-space: pre-line;
    font-size: clamp(12.5px, 1.65vw, 15px);
    line-height: 1.85;
    color: #4a3f40;
}

/* ============================================================
   สถานะกำลังโหลด / กำลังส่ง
   ============================================================ */

/* ---------- แถบโหลดบางๆ ด้านบนจอ ---------- */
.ps-topbar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 200;
    background: linear-gradient(90deg, var(--red), #ff7a7b, var(--red));
    box-shadow: 0 0 10px rgba(195, 21, 22, .5);
    opacity: 0;
    pointer-events: none;
}
.ps-topbar.run {
    opacity: 1;
    animation: psTopBar 12s cubic-bezier(.1, .7, .3, 1) forwards;
}
.ps-topbar.done {
    opacity: 0;
    width: 100%;
    transition: width .2s ease, opacity .35s ease .15s;
}
@keyframes psTopBar {
    0%   { width: 0; }
    12%  { width: 38%; }
    40%  { width: 66%; }
    75%  { width: 86%; }
    100% { width: 94%; }
}

/* ---------- ปุ่มระหว่างกำลังส่ง ---------- */
.ps-loading-text { font-size: .95em; }

button[aria-busy="true"],
button[data-ps-loading] {
    cursor: progress;
    opacity: .9;
}

/* ---------- ฟอร์มระหว่างกำลังส่ง ---------- */
form.ps-busy { position: relative; }
form.ps-busy input,
form.ps-busy textarea,
form.ps-busy select {
    pointer-events: none;
    opacity: .72;
    transition: opacity .2s;
}
form.ps-busy::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .05);
    pointer-events: none;
}

/* ---------- ลิงก์ที่กำลังพาไปหน้าใหม่ ---------- */
.ps-link-busy { opacity: .6; cursor: progress; }

@media (prefers-reduced-motion: reduce) {
    .ps-topbar.run { animation: none; width: 60%; }
}

/* ---------- กล่องแจ้งชำระเงินในหน้าบัญชีสมาชิก ---------- */
.slip-box {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #fffafa;
    border: 1.5px dashed #f0c7c8;
}
.slip-current {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1.5px dashed #f4dede;
}
.slip-current img {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #f0dede;
    flex: none;
}
.slip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.slip-box .field-label { margin-bottom: 7px; }

/* ============================================================
   ป้ายส่วนลด + ราคา
   ============================================================ */

/* ป้ายห้อยมุมขวาบนของปก บอกว่าลดกี่ % */
.badge-off {
    position: absolute;
    top: 0;
    right: clamp(7px, 1.6vw, 12px);
    z-index: 3;
    background: var(--red);
    color: #fff;
    font-family: 'Mitr', sans-serif;
    font-size: clamp(10px, 1.35vw, 13.5px);
    line-height: 1;
    padding: clamp(6px, 1vw, 9px) clamp(6px, 1vw, 9px) clamp(11px, 1.6vw, 15px);
    box-shadow: 0 5px 12px rgba(90, 0, 2, .32);
    /* ตัดปลายล่างเป็นหางริบบิ้น */
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
    animation: swing 3.6s ease-in-out infinite;
    transform-origin: top center;
}
.badge-off b { font-weight: 500; }

/* ราคาเดิมขีดฆ่า */
.price-line { display: flex; align-items: baseline; justify-content: center; gap: 7px; flex-wrap: wrap; }
.price-was {
    text-decoration: line-through;
    color: #b3a7a8;
    font-size: clamp(10.5px, 1.35vw, 13.5px);
}

/* หัวข้อ NEWS UPDATE ให้เท่าหัวข้ออื่น */
.h-serif-sm { font-size: clamp(19px, 3.2vw, 32px); }

/* ป้ายบอกว่าตอนนี้เป็นราคาช่วงงานหนังสือ */
.fair-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--red);
    color: #fff;
    font-family: 'Mitr', sans-serif;
    font-size: clamp(11px, 1.4vw, 13.5px);
    border-radius: 999px;
    padding: 5px 15px;
    box-shadow: 0 6px 16px rgba(195, 21, 22, .28);
    animation: pop .35s both;
}

/* กล่องสรุปส่วนลดในหน้ารายละเอียด */
.save-note {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #fff1f1;
    color: var(--red);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: clamp(11.5px, 1.5vw, 14px);
    align-self: flex-start;
}

/* ---------- ผลงานที่ไม่มีขายในร้าน (เล่มเก่า/สำนักพิมพ์อื่น) ---------- */
.tl-work-off { cursor: default; }
.tl-work-off:hover { color: #8a7d7e; }
.tl-pub {
    font-size: .78em;
    color: #b3a7a8;
    border: 1px solid #f0dede;
    border-radius: 999px;
    padding: 1px 7px;
    white-space: nowrap;
    flex: none;
}
.tl-pop-note {
    display: block;
    font-size: clamp(8px, 1.05vw, 11px);
    color: #8a7d7e;
    text-align: center;
    line-height: 1.4;
    margin-top: -2px;
}
.tl-pop-note[hidden] { display: none !important; }

/* ---------- ปุ่มเข้าสู่ระบบด้วย LINE / Google ---------- */
.social-sep {
    display: flex; align-items: center; gap: 12px;
    margin: clamp(16px, 2.4vw, 22px) 0 clamp(12px, 2vw, 16px);
    color: #b3a7a8; font-size: 13px;
}
.social-sep::before, .social-sep::after {
    content: ''; flex: 1; height: 1px; background: #f0dede;
}
.social-btns { display: flex; flex-direction: column; gap: 10px; }
.social-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    border-radius: 999px; padding: 12px 18px;
    font-size: clamp(13.5px, 1.7vw, 15px); font-weight: 500;
    border: 1.5px solid #e6dede; background: #fff; color: #3a3234;
    transition: transform .2s, box-shadow .2s, background .2s;
}
.social-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(58, 40, 41, .12); color: #3a3234; }
.social-ico {
    background: #06c755; color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 6px; padding: 3px 6px; letter-spacing: .04em; flex: none;
}
.social-ico-svg { width: 19px; height: 19px; flex: none; }
.social-line:hover { background: #f2fbf5; border-color: #b7e6c8; }
.social-google:hover { background: #f7f9fd; border-color: #cfdcf5; }

/* ---------- หนังสือที่ลงข้อมูลไว้ก่อน ยังไม่เปิดขาย ---------- */
.badge-soon { background: rgba(35, 27, 28, .62); }

.soon-box {
    border: 2px dashed var(--red);
    border-radius: 16px;
    padding: clamp(12px, 1.9vw, 17px) clamp(14px, 2.1vw, 19px);
    background: #fffdfd;
    align-self: flex-start;
}
.soon-head {
    font-family: 'Mitr', sans-serif;
    color: var(--red);
    font-size: clamp(13.5px, 1.8vw, 16px);
    margin-bottom: 4px;
}
.soon-box p {
    margin: 0;
    font-size: clamp(12.5px, 1.6vw, 15px);
    color: #5b4f50;
    line-height: 1.75;
}

/* ---------- แจ้งเตือนเรื่องอีเมลตกกล่องจดหมายขยะ ---------- */
.mail-tip {
    border: 2px dashed var(--red);
    border-radius: 16px;
    padding: clamp(14px, 2.2vw, 20px) clamp(15px, 2.4vw, 22px);
    background: #fffdfd;
    margin-bottom: clamp(18px, 2.8vw, 26px);
    animation: pop .4s both;
}
.mail-tip-head {
    font-family: 'Mitr', sans-serif;
    color: var(--red);
    font-size: clamp(14px, 1.9vw, 17px);
    margin-bottom: 5px;
}
.mail-tip p {
    margin: 0;
    font-size: clamp(12.5px, 1.65vw, 15px);
    line-height: 1.85;
    color: #5b4f50;
}

/* ---------- รูปประกอบหัวข้อ "เกี่ยวกับเรา" ----------
   ไม่กำหนดความสูงตายตัว ปล่อยให้สูงตามสัดส่วนจริงของรูป
   จะได้ไม่โดนครอบตัด (object-fit:cover) และไม่ยืดผิดส่วน (object-fit:fill) */
.about-photo {
    width: 100%;
    height: auto;
    display: block;
    border-radius: clamp(18px, 2.6vw, 28px);
    box-shadow: 0 14px 30px rgba(58, 40, 41, .18);
    animation: floatA 11s ease-in-out infinite;
}

/* ---------- ลิงก์นโยบายท้ายเว็บ ---------- */
.footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
    flex-wrap: wrap;
}
.footer-links button {
    border: 0;
    background: transparent;
    color: #ffdfe0;
    font-family: inherit;
    font-size: clamp(11px, 1.4vw, 13.5px);
    padding: 2px 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color .2s;
}
.footer-links button:hover { color: #fff; }
.footer-links span { color: rgba(255, 255, 255, .45); font-size: 12px; }

/* ---------- หน้าต่างนโยบาย ---------- */
.policy-card {
    width: min(680px, 94vw);
    max-height: min(86dvh, 86vh);
    display: flex;
    flex-direction: column;
    padding: 0;
}
.policy-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: clamp(18px, 3vw, 26px) clamp(20px, 3.2vw, 30px) clamp(12px, 1.8vw, 16px);
    border-bottom: 1.5px dashed #f4dede;
}
.policy-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    padding: clamp(14px, 2.4vw, 20px) clamp(20px, 3.2vw, 30px) clamp(20px, 3.2vw, 30px);
}
.policy-body p {
    margin: 0 0 clamp(11px, 1.8vw, 16px);
    font-size: clamp(13px, 1.7vw, 15.5px);
    line-height: 1.9;
    color: #4a3f40;
    white-space: pre-line;
    text-wrap: pretty;
}
.policy-body p:last-child { margin-bottom: 0; }
.policy-loading { display: flex; justify-content: center; padding: 30px 0; }
.policy-loading .spin { border-color: rgba(195, 21, 22, .25); border-top-color: var(--red); }

/* ลิงก์นโยบายที่ชี้ออกไปเว็บอื่น — ให้หน้าตาเหมือนปุ่มธรรมดา มีไอคอนบอกว่าเปิดแท็บใหม่ */
.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #ffdfe0;
    font-size: clamp(11px, 1.4vw, 13.5px);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color .2s;
}
.footer-links a:hover { color: #fff; }
.footer-links .ext-ico { width: 11px; height: 11px; flex: none; opacity: .8; }
