/* Main2 — modern Library Week landing (standalone) */
:root {
    --m2-navy: #12114a;
    --m2-navy-light: #2a2878;
    --m2-accent: #f20487;
    --m2-accent-soft: #ff4da6;
    --m2-bg: #f9faff;
    --m2-text: #2d3348;
    --m2-muted: #5c6378;
    --m2-radius: 16px;
    --m2-shadow: 0 8px 32px rgba(18, 17, 74, 0.08);
    --m2-container: min(1140px, 92vw);
}

*, *::before, *::after { box-sizing: border-box; }

.m2-page {
    font-family: 'IBM Plex Sans Thai', 'Sarabun', sans-serif;
    color: var(--m2-text);
    background: #fff;
    line-height: 1.6;
    margin: 0;
}

.thai-text {
    line-break: strict;
    word-break: normal;
    overflow-wrap: break-word;
    text-wrap: pretty;
}

.thai-keep {
    white-space: nowrap;
}

.about-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.m2-about .about-actions {
    margin-top: 0;
}

.m3-about-bento__text .about-actions {
    align-self: flex-start;
}

@media (max-width: 767px) {
    .thai-keep {
        white-space: normal;
    }
}

.m2-container {
    width: var(--m2-container);
    margin: 0 auto;
}

/* Header */
.m2-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(18, 17, 74, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.m2-header__inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 10px 4vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.m2-header__logo img {
    height: 52px;
    width: auto;
}

.m2-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 20px;
}

.m2-nav a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.2s;
}

.m2-nav a:hover { color: var(--m2-accent-soft); }

.m2-nav__classic {
    opacity: 0.75;
    font-size: 0.85rem !important;
}

.m2-nav__cta {
    background: var(--m2-accent);
    color: #fff !important;
    padding: 8px 16px;
    border-radius: 8px;
}

.m2-nav__cta:hover { background: #d10375; color: #fff !important; }

.m2-header__toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.m2-header__toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

/* Hero */
.m2-hero {
    position: relative;
    min-height: 72vh;
    margin-top: 72px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.m2-hero__slides {
    position: absolute;
    inset: 0;
}

.m2-hero__slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    animation: m2HeroFade 24s infinite;
}

.m2-hero__slide:nth-child(1) { animation-delay: 0s; }
.m2-hero__slide:nth-child(2) { animation-delay: 4s; }
.m2-hero__slide:nth-child(3) { animation-delay: 8s; }
.m2-hero__slide:nth-child(4) { animation-delay: 12s; }
.m2-hero__slide:nth-child(5) { animation-delay: 16s; }
.m2-hero__slide:nth-child(6) { animation-delay: 20s; }

@keyframes m2HeroFade {
    0%, 14% { opacity: 1; }
    18%, 100% { opacity: 0; }
}

.m2-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(18,17,74,0.35) 0%, rgba(18,17,74,0.85) 100%);
}

.m2-hero__content {
    position: relative;
    z-index: 2;
    padding: 48px 4vw 64px;
    max-width: 1140px;
    margin: 0 auto;
    width: 100%;
}

.m2-hero__badge {
    display: inline-block;
    background: rgba(242,4,135,0.9);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
}

.m2-hero__title {
    color: #fff;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 20px;
    max-width: 800px;
}

.m2-hero__desc {
    color: rgba(255, 255, 255, 0.92);
    font-size: 1.05rem;
    line-height: 1.65;
    margin: -8px 0 24px;
    max-width: 720px;
}

.m2-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.m2-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

.m2-btn:hover { transform: translateY(-2px); }

.m2-btn--primary {
    background: var(--m2-accent);
    color: #fff;
    box-shadow: 0 4px 20px rgba(242,4,135,0.35);
}

.m2-btn--ghost {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1.5px solid rgba(255,255,255,0.4);
}

/* Section common */
.m2-section {
    padding: 80px 0;
}

.m2-section--alt {
    background: var(--m2-bg);
}

.m2-section__head {
    text-align: center;
    margin-bottom: 48px;
}

.m2-section__label {
    display: inline-block;
    color: var(--m2-accent);
    font-size: 1.15rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.m2-section__title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--m2-navy);
    margin: 0 0 12px;
}

.m2-section__desc {
    color: var(--m2-muted);
    max-width: min(720px, 100%);
    margin: 0 auto;
    font-size: 1.05rem;
    line-height: 1.7;
    padding: 0 4px;
}

/* About */
.m2-about {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

.m2-about__image {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(18, 17, 74, 0.1);
}

.m2-about__image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.m2-about__text {
    font-size: 1.05rem;
    color: var(--m2-muted);
    text-indent: 2em;
    line-height: 1.85;
    margin: 0 0 28px;
}

.m2-about .m2-btn--primary {
    margin-top: 4px;
}

/* Sections embedded in legacy Main page */
.m2-embed {
    font-family: 'IBM Plex Sans Thai', 'Sarabun', sans-serif;
}

.m2-embed .m2-section {
    padding: 72px 0;
}

.m2-embed .m2-container {
    width: min(1140px, 92vw);
    margin: 0 auto;
}

/* Speakers */
.m2-section--dark {
    background: linear-gradient(160deg, var(--m2-navy) 0%, #1e1c5c 100%);
    color: #fff;
}

.m2-section--dark .m2-section__title { color: #fff; }
.m2-section--dark .m2-section__desc { color: rgba(255,255,255,0.75); }

.m2-speakers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 32px;
}

.m2-speaker-card {
    background: #fff;
    border-radius: var(--m2-radius);
    overflow: hidden;
    box-shadow: var(--m2-shadow);
    transition: transform 0.25s, box-shadow 0.25s;
}

.m2-speaker-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 48px rgba(18, 17, 74, 0.18);
}

.m2-speaker-card__img {
    position: relative;
    aspect-ratio: 3 / 4;
    min-height: 340px;
    overflow: hidden;
    background: linear-gradient(180deg, #e8eaf3 0%, #d8dbe8 100%);
}

.m2-speaker-card__img::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 35%;
    background: linear-gradient(to top, rgba(18, 17, 74, 0.18), transparent);
    pointer-events: none;
}

.m2-speaker-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 18%;
    display: block;
    transition: transform 0.35s ease;
}

.m2-speaker-card:hover .m2-speaker-card__img img {
    transform: scale(1.03);
}

.m2-speaker-card__body {
    padding: 22px 20px 24px;
    text-align: center;
}

.m2-speaker-card__name {
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--m2-navy);
    margin: 0 0 10px;
    line-height: 1.35;
}

.m2-speaker-card__org {
    font-size: 0.9rem;
    color: var(--m2-muted);
    line-height: 1.5;
    margin: 0;
}

/* Partners / sponsor section (Main2 preview — mirrors legacy style.css) */
.sponsor-section {
    position: relative;
    padding: 100px 0 80px;
    background-color: #12114a;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

.sponsor-section::before {
    position: absolute;
    inset: 0;
    background-image: url(../images/icons/pattern-1.png);
    background-position: right top;
    content: "";
    opacity: 0.12;
    pointer-events: none;
}

.sponsor-section .float-text {
    position: absolute;
    right: -90px;
    top: 65px;
    color: #fff;
    opacity: 0.02;
    font-size: 4rem;
    font-weight: 700;
    writing-mode: vertical-rl;
    pointer-events: none;
}

.sponsor-section__inner {
    position: relative;
    z-index: 1;
}

.m2-section__head--on-dark .m2-section__title {
    color: #fff;
}

.m2-section__head--on-dark .m2-section__desc {
    color: rgba(255, 255, 255, 0.78);
}

.sponsors-area {
    position: relative;
    text-align: center;
}

.sponsor-section .client-logo {
    display: inline-block;
    margin: 0 14px 30px;
    vertical-align: top;
}

.sponsor-section .client-logo .image {
    margin: 0;
    padding: 12px 16px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s, box-shadow 0.2s;
}

.sponsor-section .client-logo .image:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
}

.sponsor-section .client-logo img {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    opacity: 1;
}

/* Location */
.m2-location {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
}

.m2-location__tabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.m2-location__tab {
    text-align: left;
    padding: 14px 18px;
    border: none;
    border-radius: 10px;
    background: #fff;
    color: var(--m2-navy);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: background 0.2s, color 0.2s;
}

.m2-location__tab.is-active,
.m2-location__tab:hover {
    background: var(--m2-navy);
    color: #fff;
}

.m2-location__panel {
    display: none;
    border-radius: var(--m2-radius);
    overflow: hidden;
    box-shadow: var(--m2-shadow);
}

.m2-location__panel.is-active { display: block; }

.m2-location__panel h3 {
    text-align: center;
    padding: 16px;
    margin: 0;
    background: var(--m2-navy);
    color: #fff;
    font-size: 1.1rem;
}

.m2-location__panel img {
    width: 100%;
    height: auto;
    display: block;
}

/* Contact / Footer */
.m2-contact {
    background: var(--m2-navy);
    color: #fff;
    padding: 64px 0 24px;
}

.m2-contact__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.m2-contact__info h3 {
    font-size: 1.25rem;
    margin: 0 0 20px;
}

.m2-contact__info p,
.m2-contact__info a {
    color: rgba(255,255,255,0.88);
    font-size: 0.95rem;
    margin: 0 0 12px;
    text-decoration: none;
}

.m2-contact__info a:hover { color: var(--m2-accent-soft); }

.m2-contact__map {
    border-radius: var(--m2-radius);
    overflow: hidden;
    min-height: 280px;
}

.m2-contact__map iframe {
    width: 100%;
    height: 100%;
    min-height: 280px;
    border: 0;
}

.m2-footer-copy {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
}

.m2-back-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--m2-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 16px rgba(242,4,135,0.4);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.m2-back-top.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive */
@media (max-width: 991px) {
    .m2-about { grid-template-columns: 1fr; }
    .m2-location { grid-template-columns: 1fr; }
    .m2-location__tabs { flex-direction: row; flex-wrap: wrap; }
    .m2-contact__grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
    .m2-header__toggle { display: flex; }

    .m2-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--m2-navy);
        padding: 16px 4vw 20px;
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .m2-nav.is-open { display: flex; }

    .m2-header { position: relative; }
    .m2-hero { margin-top: 0; min-height: 60vh; }
}

/* CheckName — blue header bar (RegisterHeader), no banner slide */
body.checkname-page .reg-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #12114a !important;
}

body.checkname-page .page-wrapper {
    padding-top: 0;
}

/* Registration page — header only, no banner */
body.register-page {
    background: #eef1f8;
    font-family: 'IBM Plex Sans Thai', 'Sarabun', sans-serif;
}

body.register-page .sign-up-section {
    padding: 32px 0 64px;
}

body.register-page .sign-up-form {
    max-width: 1140px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 12px 48px rgba(18, 17, 74, 0.1);
}

body.register-page .sign-up-form .form-column .inner-column {
    margin-left: 0;
    padding: 40px 48px 36px;
}

body.register-page .sign-up-form .title-box h3 {
    font-size: 1.35rem;
    margin-bottom: 10px;
}

body.register-page .sign-up-form .title-box h4.title {
    font-size: 1.08rem;
    line-height: 1.45;
    margin-bottom: 16px;
}

body.register-page .sign-up-form .post-info {
    font-size: 0.92rem;
    line-height: 1.75;
    color: #3d4251;
}

body.register-page .sign-up-form .post-info img {
    vertical-align: middle;
    margin-right: 4px;
}

@media (max-width: 991px) {
    body.register-page .sign-up-form .form-column .inner-column {
        padding: 28px 24px 24px;
    }
}
