@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@400;700&family=Noto+Sans+SC:wght@400;700&display=swap');

body {
    margin: 0;
    min-height: 100vh;
    background: #f3f4f6; /* keep body gray always */
    font-family: 'Kanit', Arial, sans-serif;
}
:root {
    --topbar-offset: 3rem;
    /* maximum hero height (can be overridden per-page or per-hero via CSS or data attribute)
       Examples: 900px, 80vh */
    --hero-max-height: 900px;
    /* minimum hero height (can be px or vh) */
    --hero-min-height: 320px;
}
.top-bar {
    /* use 100% instead of 100vw to avoid adding scrollbar when the viewport includes a scroll bar
       and to prevent the fixed bar from contributing to horizontal overflow */
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 50;
    box-sizing: border-box;
}
.top-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1rem;
    background: #fff;
    color: #222;
    margin: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    width: calc(100% - 3rem);
    /* max-width: 1300px; */
}
.logo img {
    /* base size: use a CSS variable for easier scaling */
    --logo-base-height: 40px; /* default base height */
    --logo-scale: 0.5; /* default scale for most screens (50%) */
    height: calc(var(--logo-base-height) * var(--logo-scale));
    width: auto;
    display: block;
}
.logo {
    font-size: 1.5rem;
    font-weight: bold;
}
.menu-btn {
    background: #fff;
    color: #222;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}
.menu-btn:hover {
    background: #eee;
}
.hero-bg {
    position: absolute;
    /* keep top offset for visual overlap but ensure the element spans the full container
       so background sizing doesn't push layout wider */
    top: -8%; right: 0; bottom: 0; left: 0;
    z-index: 1;
    /* kept for backward compatibility if JS not running */
    background-image: url('assets/images/power-bank-1.jpeg');
    background-position: left top;
    background-repeat: no-repeat;
    /* avoid vw values >100% which can create horizontal scroll; prefer cover as a safe default */
    background-size: cover;
    opacity: 0.95;
}

/* Ensure hero fills a predictable vertical area so content after it starts below */
.hero {
    position: relative;
    width: 100%;
    min-height: 80vh; /* adjust as needed: 80% of viewport height */
    /* limit maximum height; JS will also respect this value when sizing slides */
    max-height: var(--hero-max-height);
    /* enforce a CSS-level minimum */
    min-height: var(--hero-min-height);
    display: block;
    z-index: 1; /* base for slides */
    overflow-x: hidden;
    overflow-y: hidden;
}

/* Make sure slides are contained and do not overlap following sections */
.hero-slides,
.hero-slide .slide-base,

/* Slide layer stacking: base (bottom) -> mid (overlay, can be transparent) -> top (foreground image) */
.hero-slide .slide-base,
.hero-slide .slide-mid,
.hero-slide .slide-top {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
}
.hero-slide .slide-base { z-index: 1; }
.hero-slide .slide-mid { z-index: 2; pointer-events: none; }
.hero-slide .slide-top { z-index: 3; pointer-events: none; }

/* Rotation helpers for base/mid layers */
.rot-spin {
    transform-origin: center center;
    animation: hc-spin var(--rot-duration, 30s) linear infinite;
}
@keyframes hc-spin {
    to { transform: rotate(360deg); }
}
.rot-osc {
    transform-origin: center center;
    animation: hc-osc var(--rot-duration, 3s) ease-in-out infinite;
}
@keyframes hc-osc {
    0% { transform: rotate(calc(var(--rot-deg, 6deg) * -1)); }
    50% { transform: rotate(var(--rot-deg, 6deg)); }
    100% { transform: rotate(calc(var(--rot-deg, 6deg) * -1)); }
}
.hero-slide .slide-top,
.hero-bg {
    pointer-events: none;
}

/* Slides: position multiple full-bleed slides behind the title */
.hero-slides {
    position: absolute;
    inset: 0;
    z-index: 1;
    /* allow tilted/rotated slide elements to extend beyond the slide box */
    overflow: visible;
}
.hero-slide {
    position: absolute;
    inset: 0;
    background-position: left top;
    background-repeat: no-repeat;
    background-size: cover;
    opacity: 0;
    transform: translateX(0);
    transition: opacity 800ms ease, transform 800ms ease;
}
.hero-slide.active {
    opacity: 1;
    z-index: 1;
}

/* Two-layer slide contents */
.hero-slide .slide-base,
.hero-slide .slide-top {
    position: absolute;
    inset: 0;
    background-repeat: no-repeat;
}
.hero-slide .slide-base {
    z-index: 0; /* bottom layer */
    background-size: cover;
    filter: saturate(1.02) brightness(0.95);
}
.hero-slide .slide-top {
    z-index: 0.5; /* sits above base but below title */
    pointer-events: none;
    background-position: right top;
    background-repeat: no-repeat;
    /* make top image slightly less dominating so the base color shows through */
    opacity: 0.95;
}

/* Mid layer inner element: keeps image proportions while allowing rotation */
.hero-slide .slide-mid {
    z-index: 2; /* overlay layer */
    pointer-events: none;
    overflow: visible;
}
.hero-slide .slide-mid .mid-inner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    width: auto;
    height: auto;
    min-width: 10vw;
    min-height: 10vh;
    background-repeat: no-repeat;
    background-size: contain; /* default to contain to preserve aspect */
    background-position: center center;
    will-change: transform, opacity;
}

/* Title move-in animation */
.hero-title {
    position: absolute;
    top: var(--topbar-offset);
    left: 5rem;
    z-index: 2;
    color: #fff;
    max-width: 60vw;
    line-height: 1;
    /* text-shadow: 0 4px 24px rgba(0,0,0,0.5); */
    display: flex;
    flex-direction: column;
    gap: 0.2em;
    overflow: visible;
}
.hero-title .hero-title-line1,
.hero-title .hero-title-line2,
.hero-title .hero-title-line3,
.hero-title .hero-title-line4,
.hero-title .hero-title-line5 {
    transform: translateX(-40px);
    opacity: 0;
    transition: transform 600ms cubic-bezier(.2,.8,.2,1), opacity 600ms ease;
}
.hero-title.in-view .hero-title-line1,
.hero-title.in-view .hero-title-line2,
.hero-title.in-view .hero-title-line3,
.hero-title.in-view .hero-title-line4,
.hero-title.in-view .hero-title-line5 {
    transform: translateX(0);
    opacity: 1;
}
.hero-title-line1,
.hero-title-line2,
.hero-title-line3 {
    font-family: 'Kanit', Arial, sans-serif;
    font-size: 4.3rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-top: 0.5rem;
}
.hero-title-line4,
.hero-title-line5 {
    font-family: 'Kanit', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 100;
    letter-spacing: 1px;
    margin-top: 1rem;
    color: #FFF63B;
}
.contact-card { 
    background: #f0f0f0;
    color: #000;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    margin-top: 0.5rem;
    display: inline-block;
    max-width: 350px;
}
.contact-card-title {
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 1rem;
}
.contact-card-actions { display: flex; gap: 0.6rem; align-items: center; }
.line-btn { display: inline-block; padding: 0; background: transparent; border-radius: 6px; text-decoration: none; }
.line-btn img { height: 45px; width: auto; display: block; object-fit: contain; }
.line-btn:focus { outline: 3px solid rgba(0,192,0,0.28); }
.hero-title-line4 {
    margin-top: 1rem;
}
.hero-title-coming {
    color: #FFF63B; /* show the line in yellow */
    font-size: 2.5rem;
    margin-top: 0.6rem;
}
.mc-bold-italic {
    font-weight: 500;
    font-style: italic;
    color: #FFF63B;
}
.hero-title-line3 {
    color: #000;
    display: inline-block;
    line-height: 1;
    text-shadow: none; /* sharper text */
}
.hero-title-coming {
    font-family: 'Kanit', Arial, sans-serif;
    font-size: 2.5rem;
    font-weight: 300;
    font-style: normal;
    margin-top: 1em;
}
.scroll-btn {
    background: #040404;
    color: #FFF63B;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.2s;
    max-width: 150px;
}
.scroll-btn:hover {
    background: #e68900;
}
.form-section {
    background: transparent; /* form card has its own white background */
    padding: 3rem 1rem;
    display: flex;
    justify-content: center;
    position: relative; /* ensure normal flow */
    z-index: 5; /* above hero if any overlap */
}
#google-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    width: 100%;
    /* max-width: 720px; */
    background: #ffffff;
    padding: 2rem;
    border-radius: 40px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    border: 2px solid #e0e0e0;
    box-sizing: border-box;
}
#google-form input, #google-form select, #google-form textarea {
    padding: 0.8rem 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box; /* ensure padding/border don't break width */
    background: #f3f4f6; /* match body gray */
}
#google-form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
#google-form .form-field input {
    width: 100%;
    box-sizing: border-box;
}
#google-form textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 1rem;
    resize: vertical;
    box-sizing: border-box;
    background: #f3f4f6; /* match body gray */
    min-height: 120px;
    overflow: auto;
}

/* make select full width as well */
#google-form select {
    width: 100%;
}
#google-form button[type="submit"] {
    background: #2196f3;
    color: #fff;
    border: none;
    padding: 0.8rem 0;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}
#google-form button[type="submit"]:hover {
    background: #1769aa;
}

/* Contact links in the form */
.contact-link {
    font-weight: 700;
    color: #000000;
    text-decoration: none;
}
/* .contact-link:hover {
    text-decoration: underline;
} */

.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 1rem;
}

@media (max-width: 1399px) {
    .hero-title {
        top: var(--topbar-offset);
        left: 2rem;
        max-width: 60vw;
    }
    /* Reduce top-bar inner margin on smaller screens */
    .top-bar-inner {
        margin: 1rem;
        padding: 0.8rem 1rem;
        width: calc(100% - 2rem);
    }
    .hero-bg {
        top: 2vh; right: 0; bottom: 0; left: 3vh;
        /* avoid using oversized vw-based background sizes */
        background-size: cover;
    }
    .hero-title-line1,
    .hero-title-line2,
    .hero-title-line3 {
        font-size: 3rem;
    }
    .hero-title-coming {
        font-size: 1rem;
    }
}
@media (max-width: 768px) {
    .hero-title {
        top: 5rem;
        left: 6vw;
        max-width: 80vw;
    }
    .top-bar-inner {
        margin: 0.6rem;
        padding: 0.6rem 0.8rem;
        width: calc(100% - 1.2rem);
    }
    .hero-title-line1,
    .hero-title-line2,
    .hero-title-line3 {
        font-size: 1.7rem;
        margin-top: 0.2rem;
    }
    .hero-title-line4,
    .hero-title-line5 {
        font-size: 0.9rem;
        margin-top: 0.7rem;
    }
    .hero-title-coming {
        font-size: 0.9rem;
    }
    .hero-bg {
        display: block !important;
    }
    .hero-bg {
        top: 13rem; right: 0; bottom: 0; left: 5%;
        /* 200vw is intentionally huge and will cause overflow on many devices; use cover */
        background-size: cover;
        background-position: center top;
    }
}

@media (max-width: 600px) {
    #google-form .form-grid {
        grid-template-columns: 1fr; /* stack fields to single column on small screens */
    }
}

/* Large screens: increase logo scale to 70% */
@media (min-width: 1400px) {
    .logo img {
        --logo-scale: 0.7; /* 70% of base height */
    }
}

/* How to rent section */
.how-to-rent {
    position: relative;
    padding: 2rem 1rem;
    overflow: visible; /* allow decorative mid layer to overflow */
}
.how-to-bg {
    position: absolute;
    left: 0; right: 0; top: 0; bottom: 0;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    pointer-events: none;
}
.how-to-bg-base {
    z-index: 0;
    /* use the requested bg image for the How to rent section */
    background-image: url('assets/images/bg-how-to.png');
    opacity: 1;
}
.how-to-bg-mid {
    z-index: 1;
    background-image: url('assets/images/how-bg-mid.png');
    opacity: 0.45;
}
.how-to-inner {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}
.how-to-title {
    font-size: 2.4rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}
.how-to-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}
.how-card {
    position: relative;
    /* step image will fill the card as background */
    background-color: transparent;
    padding: 1.6rem;
    border-radius: 12px;
    /* box-shadow: 0 6px 20px rgba(0,0,0,0.08); */
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover; /* cover entire card */
    min-height: 370px;
    box-sizing: border-box;
}

/* keep the numeric element for accessibility but visually hide it */
.how-step {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.how-card h3 { margin: 0 0 0.2rem 0; font-size: 1rem; }
.how-card p { margin: 0; color: #333; text-align: center; font-size: 0.8rem; line-height: rem; }

/* Per-card step images shown as the card background */
.how-to-grid .how-card:nth-child(1) { background-image: url('assets/images/step-1.png'); }
.how-to-grid .how-card:nth-child(2) { background-image: url('assets/images/step-2.png'); }
.how-to-grid .how-card:nth-child(3) { background-image: url('assets/images/step-3.png'); }
.how-to-grid .how-card:nth-child(4) { background-image: url('assets/images/step-4.png'); }

/* overlay to improve text contrast when background image is bright */
.how-card::before {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 0; bottom: 0;
    /* background: linear-gradient(rgba(0,0,0,0.18), rgba(0,0,0,0.06)); */
    border-radius: 12px;
    z-index: 0;
}
/* ensure content sits above overlay */
.how-card > * { position: relative; z-index: 2; }

.how-to-text {
    position: absolute;
    bottom: 10px;
    padding: 1rem;
}

@media (max-width: 992px) {
    .how-to-grid { grid-template-columns: repeat(2, 1fr); }
}

/* small tablets / large phones: give more vertical room */
@media (max-width: 768px) {
    .how-to-grid { grid-template-columns: repeat(2, 1fr); }
    .how-to-rent { padding: 3rem 1rem 4rem; }
    .how-to-title { font-size: 1.9rem; margin-bottom: 1rem; }
    .how-card { padding: 1.4rem; background-size: cover; min-height: 44vh; }
    .how-to-text { bottom: 18px; left: 1rem; right: 1rem; padding: 0.9rem; }
}

/* phones: maximize vertical space using viewport height */
@media (max-width: 600px) {
    .how-to-grid { grid-template-columns: 1fr; }
    .how-to-rent { padding: 3.2rem 1rem 4.5rem; }
    .how-to-title { font-size: 1.8rem; }
    /* use vh so cards scale with device height and won't feel cramped */
    .how-card { padding: 1.4rem; background-size: cover; min-height: 50vh; }
    .how-to-text { bottom: 20px; left: 1rem; right: 1rem; padding: 1rem; }
}

/* Payment methods */
.payment-section { padding: 2rem 1rem; background: transparent; }
.payment-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.payment-title { 
    font-size: 2.4rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
 }
.payment-row { display: flex; gap: 0.75rem; align-items: center; justify-content: center; flex-wrap: nowrap; }
.payment-item { height: 80px; width: auto; display: inline-block; opacity: 1; flex: 0 0 auto; }
/* When logos overflow, switch to wrapped layout so they flow into multiple rows centered */
.payment-row.wrapped {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

/* Improve wrapping behavior: allow items to shrink and fill rows nicely on small screens */
.payment-row.wrapped .payment-item {
    flex: 1 1 20%; /* try 5 items per row, but allow shrink/grow */
    max-width: 180px; /* avoid extremely large logos */
    min-width: 110px; /* keep logos legible */
    height: auto; /* allow image to scale naturally */
}

@media (max-width: 768px) {
    .payment-row.wrapped .payment-item { flex: 1 1 40%; min-width: 120px; max-width: 46%; }
}

/* When content overflows, enable horizontal scrolling on the row */
.payment-row.scrollable {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}
.payment-row.scrollable .payment-item { display: inline-block; }

@keyframes scroll-logos {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* Certificate section */
.certificate-section { padding: 2rem 1rem; background: transparent; }
.certificate-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.certificate-title { 
    font-size: 2.4rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
 }
.certificate-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; align-items: stretch; }
.cert-card { background: #f8fafc; padding: 1rem; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; min-height: 160px; height: 100%; }
.cert-logo { width: 88px; height: 88px; object-fit: contain; margin-bottom: 1.2rem; }
.cert-desc { margin: 0; color: #333; font-size: 0.95rem; text-align: center; }

@media (max-width: 1100px) {
    .certificate-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
    .certificate-grid { grid-template-columns: 1fr; }
    .certificate-title { font-size: 1.4rem; }
}

/* Site footer / final section */
.site-footer { position: relative; margin: 1.2rem; margin-top: 3rem; padding: 0.6rem 0.25rem; overflow: visible; }
.site-footer-bg { position: absolute; left: 0; right: 0; top: 0; bottom: 0; background-repeat: no-repeat; background-size: cover; background-position: center top; pointer-events: none; border-radius: 15px;}
.site-footer-base { z-index: 0; background-image: url('assets/images/footer-bg.png'); }
.site-footer-mid { z-index: 1; background-image: url('assets/images/footer-mid.png'); opacity: 0.35; }
.site-footer-inner { position: relative; z-index: 2; max-width: none; margin: 0 auto; padding: 0.5rem 1rem; /* spacing overridden by margins below to match top-bar */ }
.site-footer-inner { margin: 0 0rem; width: calc(100% - 3rem); }
.site-footer-top { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.footer-logo { flex: 0 0 auto; }
.footer-logo img { height: 25px; width: auto; display: block; }
.footer-art { flex: 1 1 auto; display: flex; justify-content: center; align-items: center; }
/* decorative art should match logo height and keep aspect ratio */
.footer-art img { height: 25px; width: 70vw; max-width: 70%; display: block; }
.site-footer-bottom { margin-top: 1rem; text-align: center; }
.copyright { color: #222; font-size: 0.9rem; }

@media (max-width: 768px) {
    .site-footer-top { flex-direction: column; align-items: center; }
    .footer-art img { width: 80%; max-width: 400px; }
    .copyright { color: #222; font-size: 0.8rem; }
}

@media (max-width: 1399px) {
    .site-footer-inner { margin: 0 1rem; width: calc(100% - 2rem); }
}
@media (max-width: 768px) {
    .site-footer-inner { margin: 0 0.6rem; width: calc(100% - 1.2rem); padding: 1rem 0rem; }
}
