/* Site extras — keep style.css identical to style_bk.css */

.text-brwn { color: #967869; }
.bg-navb { background: rgb(42, 37, 38); }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Google Maps — contain overflow (Android expands layout viewport if this leaks) */
#map {
    max-width: 100%;
    overflow: hidden;
}

#map img,
#map > div,
#map > div > div {
    max-width: 100% !important;
}

/* —— Home: Notebook Studio promo —— */
.nb-home-studio {
    --nb-home-studio-ink: #1c1917;
    --nb-home-studio-muted: #78716c;
    --nb-home-studio-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --nb-home-studio-nav-offset: 110px;
    position: relative;
    overflow: hidden;
    margin-top: 0;
    padding-top: var(--nb-home-studio-nav-offset);
    min-height: calc(300px + var(--nb-home-studio-nav-offset));
    background-color: #efeae3;
    background-size: cover;
    background-position: center 40%;
    background-repeat: no-repeat;
}

.nb-home-studio__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(
            105deg,
            rgba(252, 250, 247, 0.14) 0%,
            transparent 22%,
            transparent 78%,
            rgba(252, 250, 247, 0.12) 100%
        ),
        linear-gradient(
            180deg,
            rgba(252, 250, 247, 0.06) 0%,
            transparent 42%,
            rgba(246, 245, 242, 0.28) 100%
        );
}

.nb-home-studio__content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    box-sizing: border-box;
    padding: 1.75rem 1.5rem 2.75rem;
}

.nb-home-studio__copy {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 36rem;
    margin: 0;
}

.nb-home-studio__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem 0.4rem;
    margin: 0 0 0.85rem;
    line-height: 1;
}

.nb-home-studio__by {
    font-family: var(--nb-home-studio-display);
    font-size: clamp(0.95rem, 2.4vw, 1.125rem);
    font-weight: 400;
    font-style: italic;
    line-height: 1;
    letter-spacing: 0.05em;
    color: #5c534c;
    transform: translateY(0.18em);
    text-shadow: 0 1px 14px rgba(252, 250, 247, 0.35);
}

.nb-home-studio__flynery-mark {
    display: block;
    width: clamp(4.5rem, 16vw, 7.25rem);
    height: auto;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 12px rgba(252, 250, 247, 0.25));
}

.nb-home-studio__title {
    margin: 0 0 0.65rem;
    padding: 0;
    border: none;
    line-height: 1;
    background: none;
}

.nb-home-studio__title-studio {
    display: block;
    font-family: var(--nb-home-studio-display) !important;
    font-size: clamp(2.05rem, 6.5vw, 3.15rem);
    font-weight: 500 !important;
    line-height: 1.12;
    letter-spacing: 0.065em;
    color: var(--nb-home-studio-ink);
    text-shadow:
        0 1px 18px rgba(252, 250, 247, 0.5),
        0 0 1px rgba(252, 250, 247, 0.65);
}

.nb-home-studio__tagline {
    margin: 0 0 0.45rem;
    max-width: 28rem;
    font-family: 'Kanit', sans-serif;
    font-size: clamp(0.9375rem, 2.2vw, 1.125rem);
    font-weight: 400;
    line-height: 1.55;
    letter-spacing: 0.015em;
    color: #3d3835;
    text-shadow: 0 1px 14px rgba(252, 250, 247, 0.4);
}

.nb-home-studio__lead {
    margin: 0;
    max-width: 32rem;
    font-family: 'Kanit', sans-serif;
    font-size: clamp(0.75rem, 1.85vw, 0.9375rem);
    font-weight: 300;
    line-height: 1.6;
    letter-spacing: 0.012em;
    color: var(--nb-home-studio-muted);
    text-shadow: 0 1px 12px rgba(252, 250, 247, 0.35);
}

.nb-home-studio__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.15rem;
    padding: 0.6rem 1.25rem 0.6rem 0.95rem;
    border: 1px solid rgba(92, 83, 76, 0.28);
    border-radius: 999px;
    background: rgba(252, 250, 247, 0.88);
    color: #3d3835 !important;
    font-family: 'Kanit', sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.2;
    text-decoration: none !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.7) inset,
        0 4px 18px rgba(28, 25, 23, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.15s ease;
}

.nb-home-studio__cta:hover,
.nb-home-studio__cta:focus {
    background: rgba(252, 250, 247, 0.98);
    border-color: rgba(92, 83, 76, 0.45);
    color: #1c1917 !important;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.85) inset,
        0 6px 22px rgba(28, 25, 23, 0.12);
}

.nb-home-studio__cta:focus {
    outline: none;
}

.nb-home-studio__cta:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(92, 83, 76, 0.22);
}

.nb-home-studio__cta:active {
    transform: scale(0.98);
}

.nb-home-studio__cta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: #5c554e;
    color: #faf8f5;
    font-size: 0.7rem;
}

.nb-home-studio__cta-icon .fa {
    line-height: 1;
}

.nb-home-studio__cta-text {
    transform: translateY(0.01em);
    font-weight: 500 !important;
}

.nb-home-studio__wave {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    z-index: 3;
    line-height: 0;
    pointer-events: none;
}

.nb-home-studio__wave svg {
    display: block;
    width: 100%;
    height: clamp(28px, 5vw, 56px);
}

@media (max-width: 768px) {
    /*
     * navbar เป็น position:fixed สูง ~110px บนมือถือ
     * offset ต้องมากกว่านั้น ไม่งั้นบรรทัด "by Flynery / Notebook Studio"
     * จะไปซ่อนอยู่หลัง navbar (เคยตั้ง 100px แล้วหัวหาย)
     */
    .nb-home-studio {
        --nb-home-studio-nav-offset: 128px;
        min-height: calc(260px + var(--nb-home-studio-nav-offset));
    }

    .nb-home-studio__content {
        min-height: 260px;
        padding: 1.5rem 1.15rem 2.35rem;
    }

    .nb-home-studio__brand {
        margin-bottom: 0.65rem;
    }

    .nb-home-studio__title {
        margin-bottom: 0.55rem;
    }

    .nb-home-studio__cta {
        margin-top: 0.95rem;
        padding: 0.55rem 1.1rem 0.55rem 0.85rem;
        font-size: 0.875rem;
    }
}

/*
 * Product cards:
 * - default 1 column
 * - 3 columns ONLY on real desktop (fine pointer + hover)
 *   → Android ที่ขยาย layout viewport เกิน 992px จะไม่โดน 3 คอลัมน์
 */
.nb-product-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
}

@media (min-width: 992px) and (hover: hover) and (pointer: fine) {
    .nb-product-col {
        flex: 0 0 33.333333% !important;
        max-width: 33.333333% !important;
        width: 33.333333% !important;
    }
}

/* JS class on real Android phones — always 1 column */
html.is-android-phone .nb-product-col,
html.nb-android-wide .nb-product-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Touch phones/tablets: keep 1 col even if width MQ lies */
@media (hover: none) and (pointer: coarse) {
    .nb-product-col {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
}

/*
 * Mobile / touch — ใช้ media query เป็นหลัก (ไม่พึ่ง JS class)
 * กันเคส Chrome Desktop-site / UA ไม่มี Android / layout viewport โกหก
 * ห้ามใส่ img { height:auto } ทั้งไซต์ — พังมาก่อนแล้ว
 */
@media (max-width: 991.98px), (hover: none) and (pointer: coarse) {
    html {
        max-width: 100%;
        overflow-x: hidden;
    }

    /*
     * body ต้องเป็น clip ไม่ใช่ hidden
     * style.css ตั้ง html, body { height: 100% } ไว้ — hidden บน body ที่สูงเท่าจอ
     * จะทำให้ body กลายเป็น scroll container เอง แล้ว window.scrollY ค้างที่ 0 ตลอด
     * (สคริปต์ทั้งหน้าที่ใช้ window.scrollY / scrollTo จะเพี้ยนหมด เช่น jarallax
     * และการล็อกตำแหน่งตอนเปิดชีทจานสีที่ทำให้หน้าเด้งกลับไปบนสุด)
     * clip กันล้นแนวนอนได้เหมือน hidden แต่ไม่สร้าง scroll container
     */
    body {
        max-width: 100%;
        overflow-x: clip;
    }

    .btn-group-custom {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        max-width: 100%;
    }

    .container,
    .container-fluid,
    .carousel,
    .carousel-inner,
    .carousel-item,
    .carousel-img,
    .nb-home-studio,
    .row {
        max-width: 100%;
    }

    iframe,
    .fb_iframe_widget,
    #fb-root {
        max-width: 100% !important;
    }

    /* fixed bg ทำให้ Chrome Android สเกลหน้าเพี้ยน */
    body:before {
        background-attachment: scroll !important;
    }

    /* carousel: อย่าใช้ height:100% — โหว่ดำ / ตัดข้อความบนมือถือ */
    #carouselExampleIndicators,
    #carouselExampleIndicators .carousel-inner,
    #carouselExampleIndicators .carousel-item {
        height: auto !important;
        min-height: 0 !important;
    }

    /*
     * ห้ามใช้ flex + justify-content:flex-end ที่นี่
     * ถ้าเนื้อหาสูงกว่ากรอบ (ฟอนต์ใหญ่ / จอแคบ) ข้อความจะล้น "ขึ้นไปด้านบน"
     * แล้วถูก .carousel-inner{overflow:hidden} ตัดหัวข้อทิ้ง
     * ใช้ block + padding-top เป็นพื้นที่ภาพแทน — ล้นขึ้นไม่ได้
     */
    #carouselExampleIndicators .carousel-img {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        width: 100% !important;
        padding-top: 42vw !important;
        background-size: cover !important;
        background-position: center center !important;
    }

    /*
     * caption เดิม absolute ทับภาพ — ข้อความยาวถูกตัด (ตัวหนังสือไม่ขึ้น)
     * มือถือ: วาง caption ใน flow ให้ข้อความครบ
     *
     * ต้องเป็น relative + z-index (ห้าม static)
     * .carousel-item::before ใน style.css เป็นเลเยอร์ดำ z-index:1 คลุมทั้งสไลด์
     * ถ้า caption เป็น static จะใช้ z-index ไม่ได้ → เลเยอร์ทับข้อความ สีจาง ไม่ขาว
     * relative ยังอยู่ใน flow ปกติ (ไม่ล้นขึ้นด้านบนเหมือน flex-end)
     */
    #carouselExampleIndicators .carousel-caption {
        position: relative !important;
        z-index: 3 !important;
        top: auto !important;
        bottom: auto !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        /* padding-top เผื่อระยะให้เฉดไล่จางกลืนกับภาพด้านบน */
        padding: 4rem 0.85rem 1.15rem !important;
        transform: none !important;
        background: linear-gradient(
            180deg,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.35) 22%,
            rgba(0, 0, 0, 0.72) 48%,
            rgba(0, 0, 0, 0.85) 100%
        );
    }

    #carouselExampleIndicators .carousel-caption .display-4 {
        font-size: 1.35rem !important;
        line-height: 1.35 !important;
        margin-bottom: 0.5rem !important;
    }

    #carouselExampleIndicators .carousel-caption .lead,
    #carouselExampleIndicators .carousel-caption .btn {
        font-size: 0.875rem !important;
        line-height: 1.45 !important;
    }

    #carouselExampleIndicators .carousel-caption .btn-lg {
        font-size: 0.9rem !important;
        padding: 0.45rem 0.85rem !important;
        white-space: normal !important;
    }

    /* การ์ดสินค้า: ภาพไม่ทับตัวอักษร + อ่านชัด */
    .nb-product-col .warpper-card-img {
        display: block;
        overflow: hidden;
    }

    .nb-product-col .warpper-card-img img {
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .nb-product-col .card-body {
        position: relative;
        z-index: 1;
        background: #fff;
    }

    .nb-product-col .card-tthd,
    .nb-product-col .card-text {
        color: #443027 !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .nb-product-col .card-tthd {
        font-size: 1.125rem !important;
        line-height: 1.35 !important;
    }

    .nb-product-col .card-text {
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
    }
}

/*
 * แท็บเล็ต / หน้าต่างเบราว์เซอร์แคบ
 *
 * ถ้าปล่อยให้กรอบสไลด์สูงตามเนื้อหาคำบรรยาย กรอบจะเตี้ยเกินไป
 * → `background-size: cover` ไม่จำเป็นต้องตัดด้านข้าง จึงเห็นภาพเต็มความกว้าง
 * → สมุดในภาพดูเล็กและกระจายกว้างกว่าเวอร์ชันเดสก์ท็อปเดิม
 *
 * บังคับความสูงขั้นต่ำให้สัดส่วนใกล้เคียงเดิม (สูง/กว้าง ≈ 0.76)
 * ไม่ใช้กับจอโทรศัพท์ (< 576px) เพราะสัดส่วนตรงนั้นสูงพออยู่แล้ว
 */
@media (min-width: 576px) and (max-width: 991.98px) {
    #carouselExampleIndicators .carousel-img {
        padding-top: 47vw !important;
    }
}

/* สำรองเมื่อ JS ใส่ class (layout กว้างผิด / overflow) */
html.is-android-phone,
html.nb-android-wide {
    max-width: 100%;
    overflow-x: hidden;
}

/* body ใช้ clip ตามเหตุผลเดียวกับบล็อก mobile ด้านบน — hidden จะฆ่า window.scrollY */
html.is-android-phone body,
html.nb-android-wide body {
    max-width: 100%;
    overflow-x: clip;
}

html.is-android body:before,
html.is-android-phone body:before {
    background-attachment: scroll !important;
}

html.is-android-phone #carouselExampleIndicators,
html.is-android-phone #carouselExampleIndicators .carousel-inner,
html.is-android-phone #carouselExampleIndicators .carousel-item,
html.nb-android-wide #carouselExampleIndicators,
html.nb-android-wide #carouselExampleIndicators .carousel-inner,
html.nb-android-wide #carouselExampleIndicators .carousel-item {
    height: auto !important;
    min-height: 0 !important;
}

html.is-android-phone #carouselExampleIndicators .carousel-img,
html.nb-android-wide #carouselExampleIndicators .carousel-img {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    width: 100% !important;
    padding-top: 42vw !important;
    background-size: cover !important;
    background-position: center center !important;
}

html.is-android-phone #carouselExampleIndicators .carousel-caption,
html.nb-android-wide #carouselExampleIndicators .carousel-caption {
    position: relative !important;
    z-index: 3 !important;
    top: auto !important;
    bottom: auto !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    padding: 4rem 0.85rem 1.15rem !important;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.35) 22%,
        rgba(0, 0, 0, 0.72) 48%,
        rgba(0, 0, 0, 0.85) 100%
    );
}
