*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'IBM Plex Sans Thai', system-ui, sans-serif;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
}

.hub-page {
    color: var(--text, #fff);
    padding: var(--page-pad-top, 16px) 0 3rem;
    padding-bottom: max(3rem, env(safe-area-inset-bottom));
    font-size: var(--fs-body, 16px);
}

.hub-container {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

.hub-header {
    margin: 0 auto var(--header-gap, 0px);
    padding: 0 1rem;
}

.hub-header__brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: var(--logo-mb, 0px);
}

.hub-avatar {
    display: block;
    max-width: min(100%, calc(var(--logo-h, 120px) * 2.4));
    width: auto;
    height: auto;
    max-height: var(--logo-h, 120px);
    margin: 0;
    border: none;
    border-radius: 0;
    object-fit: contain;
    flex-shrink: 0;
}

.hub-avatar--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--logo-h, 120px);
    height: var(--logo-h, 120px);
    font-size: calc(var(--logo-h, 120px) * 0.45);
    background: rgba(255, 255, 255, 0.1);
}

.hub-header__title,
.hub-text-title {
    margin: 0;
    font-size: var(--fs-title, 28px);
    font-weight: 700;
    line-height: 1.3;
}

.hub-header__brand .hub-tagline,
.hub-text-description {
    flex: 1;
    min-width: 0;
    margin: 0;
    text-align: left;
    opacity: 0.85;
    line-height: 1.4;
    font-size: var(--fs-description, 16px);
}

.hub-text-shop-title {
    font-size: var(--fs-shop-title, 16px);
}

.hub-text-content {
    font-size: var(--fs-content, 13px);
}

.hub-text-cta {
    font-size: var(--fs-cta, 13px);
}

.hub-text-footer {
    font-size: var(--fs-footer, 13px);
}

.hub-text-body {
    font-size: var(--fs-body, 16px);
}

/* Future public inputs — use class hub-input (or hub-text-input) */
.hub-input,
.hub-text-input,
input.hub-input,
textarea.hub-input,
select.hub-input {
    font: inherit;
    font-size: var(--fs-input, 16px);
    line-height: 1.4;
}

.hub-links {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    margin: 0;
    padding: 0;
}

.shop-block {
    width: 100%;
}

.shop-brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
    padding: 0 1rem;
    box-sizing: border-box;
}

.shop-brand__logo {
    display: block;
    max-height: var(--shop-logo-h, 48px);
    max-width: min(100%, calc(var(--shop-logo-h, 48px) * 2.4));
    width: auto;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.shop-brand__logo--icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--shop-logo-h, 48px);
    height: var(--shop-logo-h, 48px);
    font-size: calc(var(--shop-logo-h, 48px) * 0.55);
    line-height: 1;
}

.shop-brand__desc {
    flex: 1;
    min-width: 0;
    margin: 0;
    text-align: left;
    color: var(--shop-text, var(--text, #fff));
    font-size: var(--fs-description, 16px);
    line-height: 1.35;
    opacity: 0.9;
}

.promo-strip {
    position: relative;
    height: 240px;
    overflow: hidden;
}

.promo-strip__media {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    line-height: 0;
}

.promo-strip__media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: var(--img-fit, contain);
    object-position: var(--img-pos, center center);
}

.promo-strip__media--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    text-decoration: none;
    font-size: 3rem;
}

.promo-strip__grid {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    background: var(--grid-bg, #ffffff);
}

.promo-strip__grid--one-row {
    grid-template-rows: 1fr;
}

.promo-strip__grid--four {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    grid-template-areas:
        "i1 i2"
        "i3 i4";
}

.promo-strip__grid--four .promo-strip__cell--img1 { grid-area: i1; }
.promo-strip__grid--four .promo-strip__cell--img2 { grid-area: i2; }
.promo-strip__grid--four .promo-strip__cell--img3 { grid-area: i3; }
.promo-strip__grid--four .promo-strip__cell--img4 { grid-area: i4; }

.promo-strip__grid--nine {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    grid-template-areas:
        "i1 i2 i3"
        "i4 i5 i6"
        "i7 i8 i9";
}

.promo-strip__grid--nine .promo-strip__cell--img1 { grid-area: i1; }
.promo-strip__grid--nine .promo-strip__cell--img2 { grid-area: i2; }
.promo-strip__grid--nine .promo-strip__cell--img3 { grid-area: i3; }
.promo-strip__grid--nine .promo-strip__cell--img4 { grid-area: i4; }
.promo-strip__grid--nine .promo-strip__cell--img5 { grid-area: i5; }
.promo-strip__grid--nine .promo-strip__cell--img6 { grid-area: i6; }
.promo-strip__grid--nine .promo-strip__cell--img7 { grid-area: i7; }
.promo-strip__grid--nine .promo-strip__cell--img8 { grid-area: i8; }
.promo-strip__grid--nine .promo-strip__cell--img9 { grid-area: i9; }

.promo-strip__cell {
    display: block;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    line-height: 0;
    text-decoration: none;
}

.promo-strip__cell img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: var(--img-fit, cover);
    object-position: var(--img-pos, center center);
}

.promo-strip__cell--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    font-size: 1.6rem;
}

.promo-strip__cell--action {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    padding: 6px;
    background: transparent;
    text-align: left;
    overflow: hidden;
    line-height: 1.25;
    position: relative;
}

.promo-strip__lead {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    align-self: stretch;
    width: max(var(--cta-w, 120px), 64px);
    min-width: 64px;
    height: 100%;
    position: relative;
}

.promo-strip__cell--action h2,
.promo-strip__lead h2,
.promo-strip__action h2 {
    flex: 0 0 auto;
    margin: 0;
    width: 100%;
    font-size: var(--fs-shop-title, 16px);
    font-weight: 700;
    line-height: 1.2;
    color: var(--shop-text, var(--text, #fff));
    text-align: left;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    position: relative;
    z-index: 1;
}

.promo-strip__action h2 {
    text-align: center;
    line-height: 1.25;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.promo-strip__cell--action .promo-strip__cta {
    width: var(--cta-w, 120px);
    height: var(--cta-h, 40px);
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: none;
}

.promo-strip__copy {
    flex: 1;
    min-width: 0;
    margin: 0;
    color: var(--shop-text, var(--text, #fff));
    font-size: var(--fs-content, 13px);
    line-height: 1.35;
    overflow: hidden;
    word-break: break-word;
}

.promo-strip__action {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    width: max(112px, calc(var(--cta-w, 120px) + 24px));
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 8px 14px;
    text-align: center;
    background: none;
}

.promo-strip--flip .promo-strip__action {
    left: auto;
    right: 0;
    background: none;
}

.promo-strip__action h2 {
    flex: 0 0 auto;
    margin: 0;
    width: 100%;
    font-size: var(--fs-shop-title, 16px);
    font-weight: 700;
    line-height: 1.25;
    color: var(--shop-text, var(--text, #fff));
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.promo-strip__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: var(--cta-w, 120px);
    height: var(--cta-h, 40px);
    margin: 0;
    padding: 0 0.75rem;
    border-radius: 999px;
    background: var(--primary, #6366f1);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: var(--fs-cta, 13px);
    line-height: 1.2;
    text-align: center;
    word-break: break-word;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
    -webkit-tap-highlight-color: transparent;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: calc((100% - var(--cta-h, 40px)) * var(--cta-y, 50) / 100);
    z-index: 2;
}

.promo-strip__lead .promo-strip__cta {
    left: 0;
    transform: none;
}

.promo-strip__cta:hover,
.promo-strip__cta:active {
    filter: brightness(1.08);
}

.hub-empty {
    text-align: center;
    margin: 0 1rem;
    padding: 2rem 1rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius, 16px);
    opacity: 0.9;
    font-size: var(--fs-body, 16px);
}

.hub-footer {
    text-align: center;
    margin-top: 2.5rem;
    padding: 0 1rem;
    font-size: var(--fs-footer, 13px);
    opacity: 0.6;
}

@media (max-width: 480px) {
    .hub-page {
        padding-top: var(--page-pad-top, 12px);
    }

    .hub-avatar {
        max-width: min(100%, calc(var(--logo-h, 120px) * 2.4));
        max-height: var(--logo-h, 120px);
    }

    .promo-strip {
        height: 220px;
    }

    .promo-strip__action {
        width: max(96px, calc(var(--cta-w, 120px) + 16px));
    }
}

@media (min-width: 768px) {
    .hub-page {
        padding-top: var(--page-pad-top, 16px);
    }

    .promo-strip {
        height: 280px;
    }

    .promo-strip__action {
        width: max(128px, calc(var(--cta-w, 120px) + 24px));
    }
}
