/* ==========================================================================
   หน้าแรก index.php — ปรับ 2 ส่วน: "สั่งผลิตง่ายใน 4 ขั้นตอน" และ "ผลงานสมุดโรงเรียนของเรา"
   ไฟล์นี้ถูกโหลดก่อน site.css จึงใช้ id (#process / #portfolio) เพื่อให้ชนะกฎเดิม
   ========================================================================== */
/* ---------- สินค้าหลักของเรา: รูปการ์ดสัดส่วน 16:9 (แนวนอนกว่า 4:3 เดิม) ---------- */
#products .kk-cat-media { height: auto; min-height: 0; aspect-ratio: 16 / 9; }
/* ---------- สั่งผลิตง่ายใน 4 ขั้นตอน: เส้นเวลาแนวนอน (มือถือเป็นแนวตั้ง) ---------- */
#process .hs-steps { display: grid; margin: 34px 0 0; padding: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; }
#process .hs-step { position: relative; padding: 0 14px; text-align: center; }
#process .hs-node { position: relative; display: grid; width: 64px; height: 64px; margin: 0 auto 20px; place-items: center; color: var(--green-700); background: #fff; border: 1px solid var(--green-700); border-radius: 50%; font-size: 28px; }
#process .hs-ico { display: grid; place-items: center; line-height: 0; }
#process .hs-no { position: absolute; top: -6px; right: -6px; display: grid; width: 26px; height: 26px; place-items: center; color: #3a2a00; background: var(--amber); border: 2px solid #fff; border-radius: 50%; font-size: 13px; font-weight: 700; line-height: 1; }
#process .hs-step.is-last .hs-node { color: #fff; background: var(--green-700); box-shadow: 0 10px 22px rgba(0, 139, 87, .28); }
/* เส้นประเชื่อมระหว่างวงกลม */
#process .hs-step:not(.is-last)::after { position: absolute; top: 31px; left: calc(50% + 44px); width: calc(100% - 88px); content: ""; border-top: 1px dashed var(--line-strong); }
#process .hs-step h3 { margin: 0 0 8px; color: var(--ink); font-size: 18px; font-weight: 700; line-height: 1.4; }
#process .hs-step p { max-width: 280px; margin: 0 auto 12px; color: var(--text); font-size: 14px; line-height: 1.7; }
@media (max-width: 1100px) {
    #process .hs-step { padding: 0 8px; }
    #process .hs-step h3 { font-size: 16px; }
}
@media (max-width: 820px) {
    #process .hs-steps { max-width: 520px; margin: 28px auto 0; grid-template-columns: 1fr; }
    #process .hs-step { display: grid; padding: 0 0 30px; column-gap: 18px; grid-template-columns: 64px minmax(0, 1fr); text-align: left; }
    #process .hs-step.is-last { padding-bottom: 0; }
    #process .hs-node { margin: 0; grid-row: 1 / span 3; }
    #process .hs-step h3 { grid-column: 2; margin: 4px 0 6px; }
    #process .hs-step p { max-width: none; margin: 0 0 8px; grid-column: 2; }
    /* เส้นแนวตั้งระหว่างวงกลม */
    #process .hs-step:not(.is-last)::after { top: 72px; bottom: 8px; left: 31px; width: 0; height: auto; border-top: 0; border-left: 1px dashed var(--line-strong); }
}
/* ---------- ผลงานสมุดโรงเรียนของเรา: พื้นการ์ดเทากลาง ไม่ใช่เขียว ---------- */
#portfolio { background: var(--green-50); }
#portfolio .kk-show:not(.is-solo) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#portfolio .kk-show-item { border-color: var(--line); }
#portfolio .kk-show-item:hover { border-color: var(--line-strong); box-shadow: 0 18px 40px rgba(20, 30, 30, .12); }
#portfolio .kk-show.is-solo .kk-show-item { box-shadow: 0 18px 40px rgba(20, 30, 30, .12); }
#portfolio .kk-show-stage { background: #fff; }
#portfolio .kk-show-item figcaption { padding: 14px 18px 16px; gap: 3px; }
@media (max-width: 900px) {
    #portfolio .kk-show:not(.is-solo) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
    #portfolio .kk-show:not(.is-solo) { gap: 12px; }
    #portfolio .kk-show-item { border-radius: 22px; }
    #portfolio .kk-show-item figcaption { padding: 11px 13px 13px; }
    #portfolio .kk-show-item figcaption b { font-size: 14px; }
    #portfolio .kk-show-item figcaption span { font-size: 12px; }
}
/* ---------- สิ่งพิมพ์อื่นๆ ของเรา: การ์ดสินค้า 7 ใบ พื้นขาวยกน้ำหนัก + วงกลมตกแต่งหลังรูป ---------- */
#others .kk-strip { padding: 30px 32px 32px; background: var(--green-50); border-radius: 30px; }
#others .kk-strip-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
#others .kk-strip-title h2 { margin: 0 0 10px; font-size: 21px; font-weight: 700; line-height: 1.3; }
#others .kk-strip-rule { display: block; width: 34px; height: 3px; margin-bottom: 10px; background: var(--green-700); border-radius: 3px; }
#others .kk-strip-title p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
#others .kk-strip-more { flex: none; }
#others .kk-strip-row { display: flex; flex-wrap: wrap; gap: 16px; }
#others .kk-strip-item { display: flex; flex: 1 1 140px; max-width: 210px; flex-direction: column; color: inherit; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 2px 10px rgba(6, 60, 40, .06); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
#others .kk-strip-item:hover { border-color: var(--line-strong); box-shadow: 0 10px 24px rgba(6, 60, 40, .12); transform: translateY(-3px); }
#others .kk-strip-media { position: relative; display: grid; aspect-ratio: 1 / 1; margin: 12px 12px 0; place-items: center; }
#others .kk-strip-media::before { position: absolute; inset: 0; content: ""; background: linear-gradient(145deg, var(--green-50), var(--green-100)); border-radius: 22px; }
#others .kk-strip-media img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 22px; }
#others .kk-strip-size { position: relative; z-index: 1; color: var(--green-800); font-size: 12px; font-style: normal; font-weight: 600; line-height: 1.5; text-align: center; opacity: .75; }
#others .kk-strip-item b { display: flex; min-height: 3.6em; padding: 6px 10px 14px; font-size: 14px; font-weight: 700; line-height: 1.4; align-items: center; justify-content: center; }
@media (min-width: 1101px) {
    #others .kk-strip { display: grid; grid-template-columns: 210px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 28px; row-gap: 10px; padding: 22px 28px 28px; }
    #others .kk-strip-top { display: contents; }
    #others .kk-strip-title { grid-area: 1 / 1 / 3 / 2; align-self: center; }
    #others .kk-strip-title h2 { font-size: 24px; }
    #others .kk-strip-more { grid-area: 1 / 2; justify-self: end; align-self: end; }
    #others .kk-strip-row { grid-area: 2 / 2; flex-wrap: nowrap; gap: 12px; }
    #others .kk-strip-item { flex: 1 1 0; min-width: 0; max-width: none; }
    #others .kk-strip-item b { padding: 4px 6px 12px; font-size: 13px; }
}
@media (max-width: 860px) {
    #others .kk-strip-top { flex-direction: column; align-items: flex-start; gap: 12px; }
    #others .kk-strip { padding: 24px 22px 26px; }
    #others .kk-strip-item { flex-basis: calc((100% - 32px) / 3); max-width: none; }
}
@media (max-width: 480px) {
    #others .kk-strip-row { gap: 12px; }
    #others .kk-strip-item { flex-basis: calc((100% - 24px) / 3); }
    #others .kk-strip-item b { padding: 10px 6px 12px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    #others .kk-strip-item { transition: none; }
}
/* ==========================================================================
   เอฟเฟกต์เคลื่อนไหวหน้าแรก (คู่กับ assets/js/home-motion.js)
   ทุกอย่างปิดเองเมื่อผู้ใช้ตั้งค่า "ลดการเคลื่อนไหว" (ดู @media ท้ายส่วนนี้)
   ========================================================================== */
/* ---------- Hero: เอฟเฟกต์ย้ายไปอยู่ใน site.css แล้ว (ใช้ทุกหน้า) — mv-rise ก็ประกาศที่นั่น ---------- */
@keyframes mv-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- ขึ้นทีละส่วนเมื่อเลื่อนมาถึง (class mv ถูกเติมโดย home-motion.js เท่านั้น ถ้า JS ไม่ทำงานเนื้อหาแสดงปกติ) ---------- */
.has-motion .mv { opacity: 0; }
.has-motion .mv.mv-in { opacity: 1; animation: mv-rise .7s cubic-bezier(.2, .7, .2, 1) var(--mv-d, 0ms) backwards; }

/* ---------- การ์ดสินค้า / ผลงาน: รูปซูมเบาๆ ตอนเอาเมาส์ชี้ ---------- */
#products .kk-cat-media > img, #products .kk-cat-media > svg { transition: transform .7s cubic-bezier(.2, .7, .2, 1); }
#products .kk-cat:hover .kk-cat-media > img, #products .kk-cat:hover .kk-cat-media > svg { transform: scale(1.06); }
#portfolio .kk-show-stage img { transition: transform .7s cubic-bezier(.2, .7, .2, 1); }
#portfolio .kk-show-item:hover .kk-show-stage img { transform: scale(1.05); }
#others .kk-strip-media img { transition: transform .5s ease; }
#others .kk-strip-item:hover .kk-strip-media img { transform: scale(1.06); }
.kk-about-visual img { transition: transform 1.2s cubic-bezier(.2, .7, .2, 1); }
.kk-about-visual:hover img { transform: scale(1.04); }

/* ---------- 4 ขั้นตอน: วงกลมเด้งเข้า เส้นเชื่อมวิ่งต่อกัน ---------- */
@keyframes mv-pop { 0% { transform: scale(.55); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: none; opacity: 1; } }
@keyframes mv-line-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes mv-line-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.has-motion #process .hs-step.mv-in .hs-node { animation: mv-pop .6s cubic-bezier(.3, 1.4, .5, 1) calc(var(--mv-d, 0ms) + 120ms) backwards; }
.has-motion #process .hs-step.mv-in:not(.is-last)::after { transform-origin: left center; animation: mv-line-x .7s ease calc(var(--mv-d, 0ms) + 380ms) backwards; }
@media (max-width: 820px) {
    .has-motion #process .hs-step.mv-in:not(.is-last)::after { transform-origin: center top; animation-name: mv-line-y; }
}
.hs-step:hover .hs-node { transform: translateY(-3px); transition: transform .25s ease; }

/* ---------- ป้าย "30+ ปี" ลอยขึ้นลงช้าๆ ---------- */
@keyframes mv-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.kk-about-badge { animation: mv-float 4.5s ease-in-out infinite; }

/* ---------- แถบความคืบหน้าการเลื่อนหน้า ---------- */
.mv-progress { position: fixed; top: 0; left: 0; z-index: 9999; width: 100%; height: 3px; background: linear-gradient(90deg, var(--green-700), var(--amber)); transform: scaleX(0); transform-origin: left center; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
    .kk-about-badge { animation: none !important; }
    .has-motion .mv { opacity: 1; }
    .has-motion .mv.mv-in, .has-motion #process .hs-step.mv-in .hs-node, .has-motion #process .hs-step.mv-in::after { animation: none; }
    #products .kk-cat-media > img, #portfolio .kk-show-stage img, #others .kk-strip-media img, .kk-about-visual img { transition: none; }
}