/* [2 พ.ย. 2569] สมุดบันทึกลดน้ำหนัก /weight-loss-diary (.dy) — ต่อจาก pages-v2.css (.pv tokens) · view pages/diary/index.php · JS diary.js
   จอแรกมือถือ: หัวข้อ + ภาพสมุด + ฟอร์มอีเมล ต้องเห็นครบ · สำเร็จแล้วปุ่มดาวน์โหลดอยู่ที่เดิม */

/* แถบโหลดบางขอบบน (ห้าม overlay/skeleton) */
.dy-bar { position: fixed; top: 0; left: 0; z-index: 100; width: 0; height: 3px; background: #00a755; opacity: 0; transition: width .2s ease-out, opacity .2s ease-out; pointer-events: none; }
.dy-bar.on { width: 88%; opacity: 1; transition: width 8s cubic-bezier(.1, .7, .2, 1), opacity .1s; }

/* ---------- หัวหน้า ---------- */
.dy-hero { padding: 16px 0 22px; background: linear-gradient(180deg, var(--g-l) 0%, #f5f9f0 70%, #fff 100%); border-bottom: 1px solid #e4eed8; }
.dy-hero-in { display: grid; gap: 14px; }
.dy-head .art-crumb { margin-bottom: 6px; font-size: 13.5px; }
.dy-kick { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 3px 10px 3px 8px; border-radius: 999px; background: #fff; border: 1px solid var(--g-b); color: var(--g-d); font-size: 13px; font-weight: 700; }
.dy h1 { margin: 10px 0 0; font-size: clamp(28px, 7.6vw, 46px); font-weight: 800; line-height: 1.22; letter-spacing: -.01em; color: #133a20; text-wrap: balance; }
.dy-sub { margin: 8px 0 0; color: var(--ink2); font-size: 15.5px; line-height: 1.6; text-wrap: pretty; }

.dy-show { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 16px; }
.dy-stack { position: relative; width: 100%; aspect-ratio: 900 / 1274; margin: 6px 0 4px 8px; }
.dy-pg { position: absolute; inset: 0; width: 100%; height: 100%; border: 1px solid #dfe7d5; border-radius: 4px; background: #fff; box-shadow: 0 6px 16px -8px rgba(29, 38, 24, .35); }
.dy-pg-3 { transform: translate(10px, 4px) rotate(7deg); }
.dy-pg-2 { transform: translate(-8px, 2px) rotate(-6deg); }
.dy-pg-1 { box-shadow: 0 10px 24px -10px rgba(29, 38, 24, .45); }
.dy-in { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.dy-in li { display: flex; align-items: flex-start; gap: 8px; font-size: 14.5px; line-height: 1.45; color: var(--ink); }
.dy-in .pv-ic { margin-top: 1px; color: var(--g-d); }

/* ---------- ฟอร์ม / สำเร็จ ---------- */
.dy-get { scroll-margin-top: 80px; }
.dy-form, .dy-ok { display: grid; gap: 10px; padding: 16px; border: 1.5px solid var(--g-b); border-radius: 18px; background: #fff; box-shadow: 0 8px 24px -18px rgba(29, 38, 24, .45); }
.dy-form[hidden], .dy-ok[hidden] { display: none; }
.dy-get-h { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.35; color: #133a20; }
.dy-field { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--bg2); color: var(--ink2); transition: border-color .15s ease-out, background-color .15s ease-out; }
.dy-field:focus-within { border-color: var(--g); background: #fff; }
.dy-field input { flex: 1; min-width: 0; height: 48px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 17px; color: var(--ink); }
.dy-field input::placeholder { font-size: 15px; color: #8b9585; }
.dy-consent { display: flex; align-items: flex-start; gap: 10px; padding: 2px 0; font-size: 13.5px; line-height: 1.55; color: var(--ink2); cursor: pointer; }
.dy-consent input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--g); cursor: pointer; }
.dy-consent a { color: var(--g-d); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.dy-btn { width: 100%; }
.dy-btn[disabled] { opacity: .7; cursor: progress; }
.dy-err { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--red-l); color: #9b2c2c; font-size: 14px; line-height: 1.5; }
.dy-err[hidden] { display: none; }
.dy-err a { color: #9b2c2c; font-weight: 700; text-decoration: underline; }
.dy-fine { display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--ink2); }
.dy-fine[hidden] { display: none; }
.dy-fine .pv-ic { margin-top: 2px; color: #8b9585; }
.dy-ok { border-color: var(--g); scroll-margin-top: 80px; outline: 0; }
.dy-ok-h { display: flex; align-items: center; gap: 10px; }
.dy-ok-h .pv-ic { color: var(--g); }
.dy-ok-t { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.3; color: #133a20; }
.dy-ok-s { margin: 2px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink2); overflow-wrap: anywhere; }
.dy-dl { width: 100%; }
.dy-next { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg2); text-decoration: none; font-size: 14px; line-height: 1.5; color: var(--ink2) !important; transition: border-color .15s ease-out; }
.dy-next:hover { border-color: var(--g); }
.dy-next b { display: block; color: var(--g-d); font-size: 14.5px; }
.dy-next .pv-ic { color: var(--g-d); }
.dy-again { justify-self: center; padding: 6px 10px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--g-d); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.dy-again[hidden] { display: none; }

/* ---------- เนื้อหา ---------- */
.dy-body { padding-top: 6px; padding-bottom: 96px; }
.dy-body > section:first-child { margin-top: 30px; }
.dy-ev { display: grid; gap: 10px; margin: 16px 0 0 !important; padding: 0 !important; list-style: none !important; }
.dy-ev li { padding: 12px 14px 13px; border: 1px solid var(--line); border-left: 4px solid var(--g); border-radius: 4px 14px 14px 4px; background: #fff; }
.dy-ev b { display: block; font-size: 16px; line-height: 1.4; color: #133a20; }
.dy-ev span { display: block; margin-top: 3px; font-size: 15px; line-height: 1.65; color: var(--ink2); }

.dy-pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; margin: 16px 0 0 !important; padding: 0 !important; list-style: none !important; }
.dy-pages img { display: block; width: 100%; height: auto; aspect-ratio: 900 / 1274; border: 1px solid #dfe7d5; border-radius: 6px; background: #fff; box-shadow: 0 6px 18px -12px rgba(29, 38, 24, .4); }
.dy-pages b { display: block; margin-top: 8px; font-size: 15.5px; line-height: 1.4; }
.dy-pages span { display: block; margin-top: 2px; font-size: 13.5px; line-height: 1.55; color: var(--ink2); }

.dy-tips { display: grid; gap: 10px; margin: 14px 0 0 !important; padding: 0 !important; list-style: none !important; counter-reset: dy; }
.dy-tips li { position: relative; padding: 12px 14px 12px 54px; border: 1px solid var(--line); border-radius: 14px; background: #fff; counter-increment: dy; }
.dy-tips li::before { content: counter(dy); position: absolute; left: 14px; top: 12px; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--g-l); color: var(--g-d); font-size: 15px; font-weight: 800; }
.dy-tips b { display: block; font-size: 16px; line-height: 1.45; }
.dy-tips span { display: block; margin-top: 2px; font-size: 15px; line-height: 1.6; color: var(--ink2); }

.dy-day { margin-top: 14px; border: 1.5px solid var(--g-b); border-radius: 18px; background: #fff; overflow: hidden; font-variant-numeric: tabular-nums; }
.dy-meal + .dy-meal { border-top: 1px solid var(--line); }
.dy-meal { padding: 12px 14px; }
.dy-meal-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0 !important; }
.dy-meal-h b { font-size: 16px; }
.dy-meal-h span { font-size: 13px; color: var(--ink2); }
.dy-meal-h em { margin-left: auto; font-style: normal; font-size: 13.5px; font-weight: 700; color: var(--g-d); }
.dy-meal ul { display: grid; gap: 2px; margin: 6px 0 0; padding: 0; list-style: none; }
.dy-meal li { display: grid; grid-template-columns: minmax(0, 1fr) 72px 50px; gap: 8px; font-size: 14.5px; line-height: 1.55; color: var(--ink); }
.dy-meal li span:nth-child(n+2) { text-align: right; color: var(--ink2); }
.dy-tot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 12px 14px; border-top: 1.5px solid var(--g-b); background: var(--g-l); }
.dy-tot b { font-size: 16px; margin-right: auto; }
.dy-tot span { font-size: 16px; font-weight: 800; color: #133a20; }
.dy-habit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; padding: 12px 14px 4px; list-style: none; }
.dy-habit li { display: flex; align-items: flex-start; gap: 6px; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.dy-habit .pv-ic { margin-top: 1px; color: var(--g-d); }
.dy-memo { display: flex; align-items: flex-start; gap: 6px; margin: 0 !important; padding: 6px 14px 14px; font-size: 14px !important; color: var(--ink2) !important; }
.dy-memo .pv-ic { margin-top: 2px; color: var(--g-d); }
.dy-src { margin-top: 8px !important; font-size: 13px !important; line-height: 1.6; color: var(--ink2) !important; }

.dy-tdee { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 16px; padding: 14px 16px; border-radius: 16px; background: var(--g-l); }
.dy-tdee p { margin: 0; max-width: 30em; font-size: 15px; line-height: 1.6; color: var(--ink2); }
.dy-tdee b { display: block; color: var(--ink); }
.dy-tdee .pv-btn { min-height: 46px; font-size: 15.5px; }

.dy-cf { margin-top: 40px; }
.dy-cf-p { margin: 6px 0 0 !important; font-size: 15.5px; color: var(--ink2) !important; }
.dy-cf .art-menu li span { font-variant-numeric: tabular-nums; }
.dy-cf-n { margin: 12px 0 0 !important; font-size: 14px !important; color: var(--ink2) !important; }
.dy-cf-b { margin-top: 12px; }

.dy-end { padding: 18px 16px; border-radius: 20px; background: var(--g-l); border: 1px solid var(--g-b); }
.dy-end-in { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 14px; align-items: center; }
.dy-end img { display: block; width: 100%; height: auto; aspect-ratio: 900 / 1274; border: 1px solid #dfe7d5; border-radius: 4px; background: #fff; box-shadow: 0 6px 14px -8px rgba(29, 38, 24, .4); transform: rotate(-4deg); }
.dy-end h2 { font-size: 20px !important; }
.dy-end p { margin: 4px 0 12px !important; font-size: 15px; color: var(--ink2) !important; }
.dy-end .pv-btn { width: 100%; }

.dy-refs h2 { font-size: 19px !important; }
.dy-refs ol { margin: 10px 0 0 !important; padding-left: 20px !important; display: grid; gap: 6px; list-style: decimal; font-size: 13.5px; line-height: 1.6; color: var(--ink2); overflow-wrap: anywhere; }
.dy-upd { margin-top: 10px !important; font-size: 13px !important; color: var(--ink2) !important; }

/* ปุ่มติดล่างมือถือ */
.dy-sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -16px rgba(29, 38, 24, .35); transform: translateY(110%); transition: transform .25s ease-out; }
.dy-sticky.show { transform: none; }
.dy-sticky .pv-btn { width: 100%; }

@media (max-width: 359px) {
  .dy-show { grid-template-columns: 92px minmax(0, 1fr); gap: 12px; }
  .dy-in li { font-size: 13.5px; }
}
@media (min-width: 640px) {
  .dy-pages { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dy-ev { grid-template-columns: 1fr 1fr; }
  .dy-tips { grid-template-columns: 1fr 1fr; }
  .dy-habit { grid-template-columns: repeat(4, minmax(0, auto)); justify-content: start; gap: 8px 22px; }
  .dy-end { padding: 24px; }
  .dy-end-in { grid-template-columns: 120px minmax(0, 1fr); gap: 24px; }
  .dy-end .pv-btn { width: auto; display: inline-flex; padding: 10px 26px; }
  .dy-meal, .dy-tot { padding-left: 18px; padding-right: 18px; }
  .dy-meal li { grid-template-columns: minmax(0, 1fr) 90px 70px; }
}
@media (min-width: 900px) {
  .dy-hero { padding: 26px 0 40px; }
  .dy-hero-in { grid-template-columns: minmax(0, 1fr) 400px; grid-template-areas: 'head show' 'get show'; column-gap: 56px; row-gap: 22px; align-items: start; }
  .dy-head { grid-area: head; }
  .dy-get { grid-area: get; max-width: 560px; }
  .dy-show { grid-area: show; grid-template-columns: 1fr; gap: 28px; justify-items: center; padding-top: 34px; }
  .dy-stack { width: 270px; margin: 10px 0 0; }
  .dy-pg-3 { transform: translate(44px, 12px) rotate(8deg); }
  .dy-pg-2 { transform: translate(-40px, 8px) rotate(-7deg); }
  .dy-in { gap: 10px; padding: 16px 18px; border: 1px solid var(--g-b); border-radius: 16px; background: rgba(255, 255, 255, .7); width: 100%; }
  .dy-in li { font-size: 15px; }
  .dy-sub { font-size: 17px; max-width: 34em; }
  .dy-form, .dy-ok { padding: 20px 22px; gap: 12px; }
  .dy-sticky { display: none; }
  .dy-body { padding-bottom: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .dy-bar, .dy-bar.on, .dy-sticky { transition: none; }
}

/* รอบ 2: กันตัดคำ "น้ำ|หนัก" ในหัวข้อ · รายการข้างภาพอยู่เหนือภาพที่เอียง · แถวบนเดสก์ท็อปไม่ยืด */
.dy-nw { white-space: nowrap; }
.dy-in { position: relative; z-index: 1; }
.art-faq summary > span { flex: 1; }
@media (min-width: 900px) {
  .dy-hero-in { grid-template-rows: auto 1fr; }
}
