/* ===========================================================
   Satit FB Feed — ธีม "กิจกรรมชาวสาธิต" (พื้นครีม / ปุ่มส้ม)
   ฟอนต์ TH Sarabun New | คุมสีผ่านตัวแปร --satit-fb-*
   =========================================================== */

.satit-fb-wrap {
    --satit-fb-bg:      #f7edd9;   /* พื้นครีม */
    --satit-fb-title:   #2b2b2b;   /* สีหัวข้อ */
    --satit-fb-text:    #5f5f5f;   /* สีคำโปรย */
    --satit-fb-btn:     #c15617;   /* ปุ่มส้ม */
    --satit-fb-btn-txt: #ffffff;   /* ตัวอักษรบนปุ่ม */
    --satit-fb-accent:  #c15617;   /* สีเน้นหัวข้อ section */
    --satit-fb-cols:    4;
    --satit-fb-radius:  6px;

    font-family: "TH Sarabun New", "Sarabun", "Prompt", system-ui, sans-serif;
    background: var(--satit-fb-bg);
    padding: 40px clamp(16px, 4vw, 56px);
    margin: 24px 0;
    box-sizing: border-box;
}

.satit-fb-wrap *,
.satit-fb-wrap *::before,
.satit-fb-wrap *::after { box-sizing: border-box; }

/* ---------- หัวข้อ section ---------- */
.satit-fb-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 30px;
    font-weight: 700;
    color: var(--satit-fb-title);
    margin: 0 0 26px;
    line-height: 1.3;
}
.satit-fb-heading .satit-fb-hl {
    color: var(--satit-fb-accent);
}
.satit-fb-heading svg {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    fill: var(--satit-fb-title);
}

/* ---------- Grid (อิงความกว้างจริงของพื้นที่ ไม่พึ่ง viewport) ---------- */
.satit-fb-feed {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--satit-fb-min, 240px)), 1fr));
    gap: 28px;
}
.satit-fb-feed.satit-fb-list {
    grid-template-columns: 1fr;
    gap: 22px;
}
.satit-fb-list .satit-fb-card {
    display: grid;
    grid-template-columns: minmax(0, 300px) 1fr;
    gap: 20px;
    align-items: start;
}

/* ---------- การ์ด (แบน โปร่ง) ---------- */
.satit-fb-card {
    display: flex;
    flex-direction: column;
    background: transparent;
    border: 0;
}

.satit-fb-thumb {
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    border-radius: var(--satit-fb-radius);
    background: #e7ddc6;
    margin-bottom: 14px;
}
.satit-fb-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.satit-fb-card:hover .satit-fb-thumb img { transform: scale(1.05); }

.satit-fb-title {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--satit-fb-title);
    margin: 0 0 8px;
    overflow-wrap: break-word;
    word-break: break-word;
}
.satit-fb-title a {
    color: inherit;
    text-decoration: none;
}
.satit-fb-title a:hover { color: var(--satit-fb-btn); }

.satit-fb-text {
    font-size: 18px;
    line-height: 1.5;
    color: var(--satit-fb-text);
    margin: 0 0 16px;
    flex: 1 1 auto;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ---------- ปุ่ม อ่านเพิ่มเติม ---------- */
.satit-fb-btn {
    align-self: flex-start;
    display: inline-block;
    background: var(--satit-fb-btn);
    color: var(--satit-fb-btn-txt);
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    padding: 9px 20px;
    border-radius: var(--satit-fb-radius);
    white-space: nowrap;
    transition: filter .15s ease, transform .15s ease;
}
.satit-fb-btn:hover {
    filter: brightness(.92);
    transform: translateY(-1px);
    color: var(--satit-fb-btn-txt);
}

/* ---------- สถานะ ---------- */
.satit-fb-error {
    padding: 14px 16px;
    background: #fff4f4;
    border: 1px solid #ffcaca;
    border-radius: 8px;
    color: #b02a2a;
    font-family: "TH Sarabun New", "Sarabun", sans-serif;
    font-size: 17px;
}
.satit-fb-empty {
    padding: 20px;
    text-align: center;
    color: #6b7280;
    font-size: 18px;
}

/* ---------- ปรับจอเล็ก (เสริม auto-fit) ---------- */
@media (max-width: 600px) {
    .satit-fb-wrap { padding: 26px 16px; }
    .satit-fb-heading { font-size: 24px; }
    .satit-fb-feed { gap: 22px; }
    .satit-fb-list .satit-fb-card { grid-template-columns: 1fr; }
    .satit-fb-title { font-size: 20px; }
    .satit-fb-text { font-size: 17px; }
}

/* ===========================================================
   โหมด embed — ป็อปอัปแสดงโพสต์เต็ม (iframe ของ Facebook)
   =========================================================== */
.satit-fb-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.satit-fb-modal.is-open { display: flex; }

.satit-fb-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .6);
}
.satit-fb-modal-box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 12px;
    width: min(560px, 100%);
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
}
.satit-fb-modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease;
}
.satit-fb-modal-close:hover { background: rgba(0, 0, 0, .8); }

.satit-fb-modal-body {
    padding: 40px 12px 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.satit-fb-modal-body iframe {
    width: 100% !important;
    min-height: 60vh;
    border: 0;
    display: block;
}
