/* Site Manager front-door landing — 2026-11-27 redesign (v2) */
:root {
    --sm-overlay: .3;
    --bg1: #3d2a05;
    --bg2: #7a5a12;
    --glow: rgba(255, 221, 128, .28);
    --pattern: rgba(255, 230, 160, .07);
    --text: #fff8e1;
    --muted: rgba(255, 248, 225, .78);
    --accent: #f3d36b;
    --btn-bg: linear-gradient(180deg, #fbe7a1 0%, #e2b544 55%, #c9962a 100%);
    --btn-text: #3b2a05;
    --btn2-border: rgba(243, 211, 107, .9);
    --btn2-text: #fdf3c4;
    --frame: linear-gradient(145deg, #fff3c4, #c9962a 45%, #f9e08b 70%, #a8791c);
    --banner-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    color-scheme: dark;
}

.theme-royal_purple {
    --bg1: #1f0f38; --bg2: #4b2a7a; --glow: rgba(227, 196, 106, .22); --pattern: rgba(227, 196, 106, .07);
    --text: #fbf5ff; --muted: rgba(251, 245, 255, .78); --accent: #e3c46a;
    --btn2-border: rgba(227, 196, 106, .9); --btn2-text: #fbefc9;
}
.theme-royal_blue {
    --bg1: #071330; --bg2: #173a7a; --glow: rgba(212, 175, 55, .22); --pattern: rgba(212, 175, 55, .07);
    --text: #f4f7ff; --muted: rgba(244, 247, 255, .78); --accent: #e6c35c;
    --btn2-border: rgba(230, 195, 92, .9); --btn2-text: #fbefc9;
}
.theme-royal_sky {
    --bg1: #f3f8ff; --bg2: #cfe2ff; --glow: rgba(255, 255, 255, .8); --pattern: rgba(30, 58, 138, .05);
    --text: #12306b; --muted: #34508c; --accent: #1e3a8a;
    --btn-bg: linear-gradient(180deg, #2c4fa8 0%, #1e3a8a 100%); --btn-text: #ffffff;
    --btn2-border: #1e3a8a; --btn2-text: #1e3a8a;
    --banner-shadow: 0 20px 50px rgba(30, 58, 138, .18);
    color-scheme: light;
}
.theme-ivory {
    --bg1: #fdfaf2; --bg2: #efe3c4; --glow: rgba(255, 255, 255, .85); --pattern: rgba(138, 106, 31, .06);
    --text: #3f2d0c; --muted: #6b5420; --accent: #8a6a1f;
    --btn2-border: #8a6a1f; --btn2-text: #5c4410;
    --banner-shadow: 0 20px 50px rgba(92, 68, 16, .18);
    color-scheme: light;
}
.theme-solemn_black {
    --bg1: #030303; --bg2: #1d1d20; --glow: rgba(255, 255, 255, .07); --pattern: rgba(255, 255, 255, .03);
    --text: #f3f4f6; --muted: rgba(243, 244, 246, .74); --accent: #d1d5db;
    --btn-bg: linear-gradient(180deg, #ffffff 0%, #d4d4d8 100%); --btn-text: #0b0b0c;
    --btn2-border: rgba(209, 213, 219, .8); --btn2-text: #e5e7eb;
    --frame: linear-gradient(145deg, #f4f4f5, #9ca3af 45%, #e5e7eb 70%, #6b7280);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body.sm-landing {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text);
    font-family: "Kanit", Tahoma, "Noto Sans Thai", sans-serif;
    background-color: var(--bg1);
    background-image:
        radial-gradient(ellipse at 50% 18%, var(--glow), transparent 62%),
        repeating-linear-gradient(45deg, var(--pattern) 0 1px, transparent 1px 22px),
        repeating-linear-gradient(-45deg, var(--pattern) 0 1px, transparent 1px 22px),
        linear-gradient(170deg, var(--bg1) 0%, var(--bg2) 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

body.sm-landing.has-bg-image {
    background-image: var(--sm-bg-image);
    background-size: cover;
    background-position: center;
}

.sm-background-video {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -3;
}

.sm-backdrop {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background: rgba(0, 0, 0, 0);
}

.has-bg-image .sm-backdrop,
.sm-background-video ~ .sm-backdrop {
    background: rgba(0, 0, 0, var(--sm-overlay));
}

.sm-preview-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 9px 16px;
    background: #6d28d9;
    color: #fff;
    text-align: center;
    font-size: 14px;
}

.sm-stage {
    min-height: 100vh;
    min-height: 100dvh;
    width: min(1180px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(16px, 2.6vh, 28px);
    padding: clamp(16px, 3vh, 36px) clamp(14px, 3vw, 40px) clamp(14px, 2.4vh, 26px);
    text-align: center;
}

.is-preview .sm-stage { min-height: calc(100dvh - 40px); }

/* ---- Template: finished banner picture ---- */
.sm-banner { margin: 0; width: 100%; display: flex; justify-content: center; }

.sm-banner img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 210px);
    max-height: calc(100dvh - 210px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: var(--banner-shadow);
}

/* ---- Template: portrait + typed wording ---- */
.sm-portrait { display: flex; justify-content: center; }

.sm-frame {
    width: clamp(190px, 26vw, 300px);
    aspect-ratio: 3 / 4;
    padding: 9px;
    border-radius: 50%;
    background: var(--frame);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .12), 0 22px 50px rgba(0, 0, 0, .35);
}

.sm-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .55);
    background: rgba(255, 255, 255, .08);
}

.theme-solemn_black .sm-frame img { filter: grayscale(1); }

.sm-copy { max-width: 920px; }

.sm-headline {
    margin: 0;
    font-family: "Srisakdi", "Kanit", serif;
    font-weight: 700;
    font-size: clamp(34px, 6.2vw, 68px);
    line-height: 1.35;
    color: var(--accent);
    text-shadow: 0 2px 18px rgba(0, 0, 0, .25);
}

.theme-royal_sky .sm-headline,
.theme-ivory .sm-headline { text-shadow: none; }

.theme-solemn_black .sm-headline {
    font-family: "Kanit", serif;
    font-weight: 500;
    font-size: clamp(26px, 4.4vw, 46px);
    color: #ffffff;
}

.sm-subheading {
    margin: 10px auto 0;
    max-width: 880px;
    font-size: clamp(17px, 2.3vw, 25px);
    font-weight: 500;
    line-height: 1.6;
    color: var(--text);
}

.sm-divider {
    width: min(360px, 70%);
    height: 12px;
    margin: 16px auto;
    background:
        radial-gradient(circle, var(--accent) 0 4px, transparent 5px) center / 12px 12px no-repeat,
        linear-gradient(90deg, transparent, var(--accent) 18%, var(--accent) 82%, transparent) center / 100% 1px no-repeat;
    opacity: .85;
}

.sm-detail {
    margin: 0 auto;
    max-width: 820px;
    font-size: clamp(15px, 1.7vw, 18px);
    font-weight: 300;
    line-height: 1.85;
    color: var(--muted);
}

/* ---- Buttons ---- */
.sm-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px 18px;
}

.sm-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 220px;
    min-height: 52px;
    padding: 12px 30px;
    border-radius: 999px;
    font-family: "Kanit", Tahoma, sans-serif;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.25;
    text-decoration: none;
    transition: all .25s ease;
}

.sm-button-primary {
    background: var(--btn-bg);
    color: var(--btn-text);
    border: 1px solid rgba(255, 255, 255, .35);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .55);
}

.sm-button-secondary {
    background: rgba(255, 255, 255, .06);
    color: var(--btn2-text);
    border: 1.5px solid var(--btn2-border);
}

.sm-button:hover { transform: translateY(-2px); filter: brightness(1.06); }
.sm-button-secondary:hover { background: rgba(255, 255, 255, .14); }

.sm-button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.sm-button-image { min-width: 0; padding: 0; background: none; border: 0; box-shadow: none; }
.sm-button-image img { display: block; width: min(250px, 80vw); height: auto; }

.sm-ext { font-size: 14px; opacity: .8; }

.sm-owner {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
    letter-spacing: .02em;
}

.sm-owner span { display: block; font-size: 11px; opacity: .8; }

.sm-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

[hidden] { display: none !important; }

/* ---- Small screens ---- */
@media (max-width: 640px) {
    .sm-stage { justify-content: flex-start; padding-top: 18px; }
    .sm-banner img { max-height: none; border-radius: 6px; }
    .sm-actions { width: 100%; flex-direction: column; align-items: stretch; max-width: 420px; }
    .sm-button { width: 100%; min-width: 0; }
    .sm-frame { width: min(62vw, 240px); }
}

@media (max-height: 560px) and (min-width: 641px) {
    .sm-banner img { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
    .sm-button { transition: none; }
    .sm-button:hover { transform: none; }
}
