/* Sacred Objects - Thai Temple Theme */
.amx-wrap, .amx-lb, .amx-modal {
    --band: #3B2314;
    --card: #FFFBF0;
    --ink: #3B2314;
    --mut: #7A5A45;
    --gold: #D4A838;
    --goldD: #A67C1F;
    --peach: #FDEBDD;
    --danger: #8F1D1D;
}
.amx-lb, .amx-lb *, .amx-modal, .amx-modal * { box-sizing: border-box; }
.amx-modal[hidden] { display: none !important; }
.amx-wrap {
    background: transparent;
    color: var(--ink);
    line-height: 1.6;
    max-width: 1120px;
    margin: 0 auto;
    box-sizing: border-box;
    font-family: 'Kanit', sans-serif, system-ui;
}
.amx-wrap * { box-sizing: border-box; }
.amx-wrap [hidden], .amx-lb[hidden] { display: none !important; }

.amx-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 28px;
    background: #FFFBF0;
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 16px 20px;
    align-items: center;
    box-shadow: 0 6px 18px rgba(59, 35, 20, 0.12);
}
.amx-bar input.amx-q {
    border: 1px solid var(--goldD);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 12px 20px;
    min-height: 46px;
    font: inherit;
    flex: 1;
    min-width: 240px;
    outline: none;
}
.amx-bar input.amx-q:focus {
    border-color: var(--band);
    box-shadow: 0 0 0 2px rgba(212, 168, 56, 0.3);
}

.amx-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
.amx-card {
    background: var(--card);
    border: 2px solid var(--gold);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 26px rgba(59, 35, 20, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
@media (min-width: 768px) {
    .amx-card {
        flex-direction: row;
        align-items: stretch;
    }
}
.amx-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(59, 35, 20, 0.22);
}

/* Image gallery area on card */
.amx-pics {
    display: flex;
    gap: 16px;
    padding: 24px 20px;
    background: radial-gradient(circle at 50% 50%, #F9D9C6 0, #FDEBDD 45%, #FFFBF0 85%);
    border-bottom: 2px solid var(--gold);
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}
@media (min-width: 768px) {
    .amx-pics {
        border-bottom: none;
        border-right: 2px solid var(--gold);
        width: 360px;
        flex-shrink: 0;
        padding: 28px 20px;
    }
}
.amx-fig {
    all: unset;
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font: inherit;
    width: auto !important;
}
.amx-picbox {
    width: 130px;
    height: 160px;
    background: #F4EADB;
    border: 4px solid #fff;
    border-radius: 12px;
    overflow: hidden;
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 2px var(--gold), 0 8px 18px rgba(59, 35, 20, 0.25);
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.amx-fig:hover .amx-picbox {
    transform: scale(1.04);
    border-color: #fff;
}
.amx-picbox img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.amx-single-pic {
    width: 220px;
    height: 260px;
}
.amx-figcaption {
    font-size: 0.82rem;
    color: #8E2A1E;
    font-weight: 700;
    text-align: center;
}
.amx-figcaption::before {
    content: "◆ ";
    color: var(--gold);
    font-size: 0.7em;
}

.amx-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
}
@media (min-width: 768px) {
    .amx-body {
        padding: 28px 32px;
    }
}
.amx-body h3 {
    margin: 0 0 10px;
    font-size: 1.4rem;
    line-height: 1.4;
    color: #8E2A1E;
    font-weight: 700;
}
@media (min-width: 768px) {
    .amx-body h3::after {
        display: block;
        content: "";
        width: 60px;
        height: 3px;
        margin-top: 8px;
        border-radius: 3px;
        background: linear-gradient(90deg, var(--gold), transparent);
    }
}
.amx-meta {
    color: var(--mut);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 14px;
    line-height: 1.7;
    padding: 6px 0 6px 12px;
    border-left: 3px solid var(--gold);
    background: linear-gradient(90deg, rgba(212, 168, 56, 0.1), transparent);
}
.amx-body p {
    margin: 0 0 16px;
    font-size: 0.98rem;
    color: var(--ink);
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.amx-more {
    margin-top: auto;
    background: linear-gradient(180deg, #F4D98C, #D4A838) !important;
    border: 2px solid var(--goldD) !important;
    color: var(--band) !important;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    padding: 10px 20px !important;
    border-radius: 10px !important;
    font-size: 0.92rem;
    width: fit-content !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center;
    gap: 6px;
    box-shadow: none !important;
}
.amx-more::after { content: "›"; font-size: 1.2em; line-height: 1; }
.amx-more:hover {
    background: #8E2A1E !important;
    border-color: #6E1D14 !important;
    color: #FFF8E7 !important;
}

.amx-empty {
    text-align: center;
    padding: 56px 20px;
    color: var(--mut);
    background: var(--card);
    border: 2px dashed var(--gold);
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 600;
}
.amx-acts {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #E6D5B8;
}
.amx-acts .amx-btn {
    flex: 1;
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    transition: all 0.3s ease;
    border: 1px solid var(--band);
    background: var(--band);
    color: #FBF3E0;
    text-align: center;
}
.amx-acts .amx-btn:hover { background: #5A3A22; color: #fff; }
.amx-acts .amx-del {
    background: var(--danger);
    border-color: #6E1010;
    color: #fff;
}
.amx-acts .amx-del:hover { background: #6E1010; }

@media (min-width: 768px) {
    .amx-acts .amx-btn { flex: 0 0 auto; min-width: 100px; }
}

/* Lightbox */
.amx-lb {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(30, 12, 6, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 16px;
}
.amx-lb img {
    max-width: min(960px, 94vw);
    max-height: 62vh;
    object-fit: contain;
    border: 3px solid var(--gold);
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    background: #000;
}
.amx-cap {
    color: var(--gold);
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}
.amx-desc {
    max-width: min(720px, 94vw);
    max-height: 20vh;
    overflow: auto;
    background: var(--card);
    color: var(--ink);
    border: 2px solid var(--gold);
    border-radius: 10px;
    padding: 14px 18px;
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 0.95rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.amx-lbbar { display: flex; gap: 10px; }
.amx-lbbar .amx-btn {
    background: var(--gold);
    color: var(--band);
    border-color: var(--goldD);
    font-weight: 700;
}

/* Modal Form */
.amx-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(30, 12, 6, 0.88);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: auto;
}
.amx-form {
    background: var(--card);
    color: var(--ink);
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 28px;
    width: min(600px, 100%);
    display: grid;
    gap: 16px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.4);
}
.amx-form h3 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--band);
    border-bottom: 2px solid var(--gold);
    padding-bottom: 12px;
}
.amx-form label {
    display: grid;
    gap: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--band);
}
.amx-form input, .amx-form textarea {
    border: 1px solid var(--goldD);
    background: #FFFFFF !important;
    color: var(--ink) !important;
    border-radius: 8px;
    padding: 12px 14px;
    font: inherit;
    width: 100%;
    outline: none;
}
.amx-th {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}
.amx-th:empty { display: none; }
.amx-th div {
    position: relative;
    aspect-ratio: 1;
    border: 2px solid var(--gold);
    border-radius: 8px;
    overflow: hidden;
    background: #FFFFFF;
}
.amx-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.amx-th button {
    position: absolute !important;
    top: 6px !important; right: 6px !important; left: auto !important; bottom: auto !important;
    transform: none !important; margin: 0 !important;
    width: 24px !important; height: 24px !important;
    min-width: 0 !important; min-height: 0 !important; padding: 0 !important;
    border: 2px solid #fff !important; border-radius: 50% !important;
    background: var(--danger) !important; color: #fff !important;
    font-size: 15px !important; line-height: 1 !important;
    display: grid !important; place-items: center !important;
    cursor: pointer;
}
.amx-err {
    margin: 0;
    color: var(--danger);
    font-weight: 600;
    background: #FFEBEE;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #FFCDD2;
}
.amx-err:empty { display: none; }
.amx-fa {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #E6D5B8;
    padding-top: 18px;
}
.amx-fa .amx-cancel {
    background: #FFFFFF !important;
    color: var(--band) !important;
    border-color: var(--goldD) !important;
}
.amx-fa .amx-cancel:hover {
    background: var(--peach) !important;
}
