:root {
    --bg-deep: #080808;
    --bg-card: rgba(25, 25, 25, 0.85);
    --gold-primary: #D4AF37;
    --gold-light: #FFE5B4;
    --gold-dark: #8A6E24;
    --text-main: #EAEAEA;
    --text-muted: #B0B0B0;
    --accent-red: #580000;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Sarabun', sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    overflow-x: hidden;
    /* Subtle Pattern */
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.03) 0%, transparent 60%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23D4AF37' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { 
    background: linear-gradient(to bottom, var(--gold-dark), var(--gold-primary)); 
    border-radius: 4px; 
    border: 2px solid #000;
}

/* --- Canvas for Smoke/Particles --- */
#sacred-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; pointer-events: none;
}

/* --- Navigation --- */
nav {
    position: fixed; width: 100%; top: 0; z-index: 1000;
    padding: 20px 50px;
    display: flex; justify-content: space-between; align-items: center;
    transition: all 0.4s ease;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
}

nav.scrolled {
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(15px);
    padding: 15px 50px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 4px 30px rgba(0,0,0,0.6);
}

.brand {
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    background: linear-gradient(to right, var(--gold-light), var(--gold-primary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    letter-spacing: 2px;
    display: flex; align-items: center; gap: 12px;
    text-transform: uppercase;
    text-decoration: none;
}

.menu a {
    color: var(--text-main); text-decoration: none; margin-left: 35px;
    font-weight: 300; transition: 0.3s; position: relative; font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.menu a::after {
    content: ''; position: absolute; bottom: -5px; left: 50%; width: 0; height: 1px;
    background: var(--gold-primary); transition: 0.3s; transform: translateX(-50%);
}
.menu a:hover::after { width: 100%; }
.menu a:hover { color: var(--gold-light); text-shadow: 0 0 8px rgba(212, 175, 55, 0.6); }

/* --- Hero Section --- */
header {
    height: 100vh;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center;
    position: relative; overflow: hidden;
}

.hero-bg-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, transparent 20%, #050505 100%), 
                url('https://images.unsplash.com/photo-1599707367072-cd6ad6cb3d2e?q=80&w=2070&auto=format&fit=crop');
    background-size: cover; background-position: center;
    filter: brightness(0.5) saturate(0.2);
    z-index: -2;
    animation: breathe 12s infinite alternate ease-in-out;
}

@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.08); } }

.hero-title {
    font-family: 'Charm', cursive;
    font-size: clamp(3.5rem, 8vw, 6.5rem);
    line-height: 1.3;
    z-index: 1;
    background: linear-gradient(45deg, #BF953F, #FCF6BA, #B38728, #FBF5B7, #AA771C);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 5s linear infinite;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.8));
}

@keyframes shine { to { background-position: 300% center; } }

.hero-subtitle {
    font-size: 1.1rem; letter-spacing: 6px; color: var(--text-muted);
    margin-top: 15px; font-weight: 300; text-transform: uppercase;
    border-top: 1px solid rgba(212, 175, 55, 0.5);
    border-bottom: 1px solid rgba(212, 175, 55, 0.5);
    padding: 12px 40px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.scroll-indicator {
    position: absolute; bottom: 40px;
    width: 24px; height: 44px;
    border: 2px solid rgba(212, 175, 55, 0.6);
    border-radius: 20px;
    display: flex; justify-content: center;
}
.scroll-indicator::before {
    content: ''; width: 4px; height: 6px; background: var(--gold-primary);
    border-radius: 2px; margin-top: 8px;
    animation: scrollDown 2s infinite;
}
@keyframes scrollDown { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(20px); } }

/* --- Content Container --- */
.container { max-width: 1200px; margin: 0 auto; padding: 100px 20px; position: relative; z-index: 2; }

.section-head { text-align: center; margin-bottom: 70px; position: relative; }
.section-head h2 {
    font-family: 'Charm', cursive; font-size: 3.8rem; color: var(--gold-primary);
    margin-bottom: 10px; text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}
.section-head p { font-size: 1.1rem; color: #999; letter-spacing: 1px; }
.section-head::after {
    content: '✦ ✦ ✦'; display: block; color: var(--gold-dark); 
    font-size: 1rem; margin-top: 20px; letter-spacing: 10px; opacity: 0.7;
}

/* --- 3D Cards Grid --- */
.grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 40px;
    perspective: 1200px; 
}

.card-wrapper {
    position: relative;
    transform-style: preserve-3d;
}

.card {
    background: var(--bg-card);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex; flex-direction: column;
    position: relative;
}

.card::after {
    content: ''; position: absolute; inset: 0;
    box-shadow: inset 0 0 20px rgba(212, 175, 55, 0);
    transition: 0.3s; pointer-events: none; z-index: 4; border-radius: 8px;
}

.card:hover {
    border-color: var(--gold-primary);
    box-shadow: 0 15px 40px rgba(0,0,0,0.6), 0 0 20px rgba(212, 175, 55, 0.2);
    transform: translateY(-5px);
}
.card:hover::after { box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.1); }

.card-img-box {
    height: 240px; overflow: hidden; position: relative;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.card-img-box img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.8s ease; filter: grayscale(20%) sepia(10%);
}

.card:hover .card-img-box img { transform: scale(1.1); filter: grayscale(0%) sepia(0%); }

.card-body { padding: 30px; flex-grow: 1; position: relative; z-index: 2; }

.card-tag {
    display: inline-block; font-size: 0.7rem; color: #111;
    background: linear-gradient(135deg, #D4AF37, #F9E29C); 
    padding: 3px 10px;
    border-radius: 2px; font-weight: 700; margin-bottom: 15px;
    text-transform: uppercase; letter-spacing: 1px;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.card h3 {
    font-family: 'Cinzel', serif; font-size: 1.5rem; margin-bottom: 12px; color: #fff;
    letter-spacing: 0.5px;
}

.card p { 
    color: #ccc; font-weight: 300; line-height: 1.7; font-size: 0.95rem;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* --- Lucky Number Widget --- */
.lucky-widget {
    background: linear-gradient(135deg, #110505 0%, #000 100%);
    border: 1px solid #331010;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    margin-top: 120px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lucky-widget::before {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(212,175,55,0.05) 0%, transparent 60%);
    animation: rotateBg 30s linear infinite;
}
@keyframes rotateBg { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.lucky-btn {
    background: linear-gradient(to right, #D4AF37, #AA771C);
    color: #111; border: none;
    padding: 15px 40px; font-size: 1.1rem; border-radius: 50px;
    cursor: pointer; font-family: 'Sarabun'; font-weight: 600;
    margin-top: 25px; transition: 0.4s;
    position: relative; z-index: 2;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
    letter-spacing: 1px;
}
.lucky-btn:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 5px 30px rgba(212, 175, 55, 0.6); 
    color: #000;
}

#luckyResult {
    font-size: 4rem; font-family: 'Charm'; color: var(--gold-light);
    margin-top: 30px; min-height: 80px; 
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    font-weight: 700;
}

/* --- Modal --- */
.modal {
    display: none; position: fixed; z-index: 2000; left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(15px);
    align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.4s ease;
}

.modal.show { opacity: 1; }

.modal-content {
    background: #121212; border: 1px solid var(--gold-dark);
    width: 95%; max-width: 1200px;
    display: grid; grid-template-columns: 0.7fr 1.3fr;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.8);
    transform: translateY(30px); transition: 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
    position: relative;
    max-height: 90vh; 
}

.modal.show .modal-content { transform: translateY(0); }

.modal-img { 
    position: relative; 
    height: 100%;
    min-height: 400px;
    background: #000;
}
.modal-img img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }

.modal-text {
    padding: 50px 60px;
    display: flex; flex-direction: column;
    background: linear-gradient(160deg, #1a1a1a 0%, #0d0d0d 100%);
    position: relative;
    overflow-y: auto; 
}

.modal-info-group {
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    padding-top: 25px;
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.info-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.1);
    transition: 0.3s;
}
.info-item:hover {
    background: rgba(212, 175, 55, 0.05);
    border-color: var(--gold-primary);
}

.info-item i { font-size: 1.2rem; margin-bottom: 10px; display: block; }

.info-item h4 {
    color: var(--gold-primary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px;
    margin-bottom: 8px; font-family: 'Cinzel', serif;
}
.info-item p { font-size: 0.9rem; color: #ddd; margin-bottom: 0; line-height: 1.5; }

.corner {
    position: absolute; width: 30px; height: 30px;
    border: 2px solid var(--gold-primary);
    transition: 0.3s; pointer-events: none;
}
.tl { top: 15px; left: 15px; border-bottom: none; border-right: none; }
.br { bottom: 15px; right: 15px; border-top: none; border-left: none; }
.tr { top: 15px; right: 15px; border-bottom: none; border-left: none; }
.bl { bottom: 15px; left: 15px; border-top: none; border-right: none; }

.close-modal-btn {
    position: absolute; top: 25px; right: 25px;
    width: 45px; height: 45px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--gold-primary);
    color: var(--gold-primary); 
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 10;
}
.close-modal-btn:hover { 
    background: var(--gold-primary); color: #000; 
    transform: rotate(90deg); box-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

/* --- Footer --- */
footer {
    border-top: 1px solid rgba(255,255,255,0.05);
    padding: 80px 20px; text-align: center;
    margin-top: 150px; background: #020202;
    color: #555; font-size: 0.9rem;
}

/* Creator Badge */
.creator-badge {
    margin-top: 60px; 
    padding: 30px 40px; 
    border: 1px solid var(--gold-dark); 
    border-radius: 12px; 
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(0,0,0,0.5) 100%);
    display: inline-block;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}
.creator-badge:hover {
    border-color: var(--gold-primary);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.15);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12) 0%, rgba(0,0,0,0.6) 100%);
}
.creator-badge::before {
    content: ''; position: absolute; top:0; left:0; width: 2px; height: 100%;
    background: var(--gold-primary);
}

/* --- Form Styles (สำหรับไฟล์ wish.html) --- */
.wish-form input, .wish-form textarea {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--gold-light);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-family: 'Sarabun';
    outline: none;
    transition: 0.3s;
}
.wish-form input:focus, .wish-form textarea:focus {
    border-color: var(--gold-primary);
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}
.wish-form label {
    display: block; color: var(--text-muted); margin-bottom: 8px; font-size: 0.9rem;
}

@media (max-width: 900px) {
    .modal-content { 
        grid-template-columns: 1fr; 
        height: 100%; width: 100%; border: none; max-width: none;
        grid-template-rows: 250px 1fr;
    }
    .modal.show .modal-content { transform: none; }
    .modal-img { height: 100%; }
    .modal-text { padding: 30px 20px; }
    .hero-title { font-size: 3.5rem; }
    .menu { display: none; } 
    .close-modal-btn { top: 15px; right: 15px; width: 40px; height: 40px; background: rgba(0,0,0,0.8); }
    .modal-info-group { grid-template-columns: 1fr; gap: 15px; }
}