:root {
    --brand-start: #4f5bd5;
    --brand-end: #764ba2;
    --bg: #f7f8fc;
    --surface: #ffffff;
    --text: #1a2033;
    --muted: #667085;
    --border: #e6e9f2;
    --navbar-bg: rgba(255, 255, 255, 0.92);
    color-scheme: light;
}
html[data-theme="dark"] {
    --bg: #10131f;
    --surface: #171c2c;
    --text: #eef0f8;
    --muted: #9aa4bf;
    --border: #2a3149;
    --navbar-bg: rgba(23, 28, 44, 0.92);
    color-scheme: dark;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    overflow-x: hidden;
    transition: background-color .2s ease, color .2s ease;
}

a { text-decoration: none; }

.section-title {
    font-weight: 800;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin-bottom: .5rem;
}
.section-subtitle {
    color: var(--muted);
    margin-bottom: 2.5rem;
}

/* ---------- Navbar ---------- */
.home-navbar {
    background: var(--navbar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: .85rem 0;
}
.home-navbar .navbar-brand {
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--text);
    display: inline-flex;
    align-items: center;
}
.brand-logo {
    height: 42px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}
.home-navbar .nav-link {
    color: var(--text);
    font-weight: 500;
    padding: .5rem 1rem;
}
.home-navbar .nav-link:hover { color: var(--brand-end); }

.home-navbar .navbar-toggler {
    border-color: var(--border);
    box-shadow: none !important;
    color: var(--text);
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    font-size: 1.1rem;
    line-height: 1;
}
@media (max-width: 991.98px) {
    .home-navbar .navbar-toggler {
        display: inline-flex;
    }
}
.home-navbar .navbar-toggler svg {
    display: block;
    margin: 0 auto;
}

.theme-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color .15s ease, transform .1s ease;
}
.theme-toggle-btn:hover { background: var(--border); }
.theme-toggle-btn:active { transform: scale(0.94); }
.theme-toggle-btn .fa-sun { display: none; }
html[data-theme="dark"] .theme-toggle-btn .fa-moon { display: none; }
html[data-theme="dark"] .theme-toggle-btn .fa-sun { display: inline-block; }

.btn-admin-login {
    background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
    color: #fff !important;
    font-weight: 600;
    border-radius: 999px;
    padding: .5rem 1.2rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}
.btn-admin-login:hover { filter: brightness(1.08); color: #fff; }

/* ---------- Ticker ---------- */
.ticker-wrap {
    background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
    color: #fff;
    overflow: hidden;
    white-space: nowrap;
    padding: .55rem 0;
}
.ticker-track {
    display: inline-block;
    padding-left: 100%;
    animation: ticker-scroll 30s linear infinite;
}
.ticker-wrap:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
    display: inline-block;
    margin-right: 3.5rem;
    font-weight: 500;
    font-size: .95rem;
}
.ticker-item a { color: #fff; text-decoration: underline; }
@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* ---------- Hero ---------- */
.hero-section { position: relative; }
.hero-carousel .carousel-item { height: min(78vh, 640px); }
.hero-slide-img { height: 100%; object-fit: cover; }
.hero-slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,.55) 100%);
}
.hero-caption {
    left: 5%; right: 5%; bottom: 8%;
    text-align: left;
}
.hero-caption h2 {
    font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 3rem);
    text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.hero-caption p {
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    max-width: 640px;
    text-shadow: 0 2px 10px rgba(0,0,0,.4);
}

.hero-fallback {
    min-height: min(78vh, 560px);
    background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
}
.fallback-title {
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.15;
}
.fallback-subtitle {
    font-size: clamp(1rem, 1.8vw, 1.3rem);
    opacity: .92;
    max-width: 640px;
    margin: 0 auto;
}

.btn-hero-cta {
    background: #fff;
    color: var(--brand-end) !important;
    font-weight: 700;
    border-radius: 999px;
    padding: .65rem 1.6rem;
    display: inline-block;
    transition: transform .15s ease;
}
.btn-hero-cta:hover { transform: translateY(-2px); }

/* ---------- Gallery ---------- */
.gallery-section { padding: 4.5rem 0; }
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.gallery-item {
    position: relative;
    display: block;
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--surface);
    border: 1px solid var(--border);
}
.gallery-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}
.gallery-item:hover img { transform: scale(1.08); }
.gallery-caption {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: linear-gradient(0deg, rgba(0,0,0,.65), transparent);
    color: #fff;
    font-size: .85rem;
    padding: .6rem .75rem .4rem;
}

/* ---------- Articles ---------- */
.articles-section { padding: 4.5rem 0; background: var(--surface); }
.articles-page-section { padding: 3.5rem 0 4.5rem; }
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1.5rem;
}
.article-card {
    display: block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    color: var(--text);
    transition: transform .2s ease, box-shadow .2s ease;
}
.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,.1);
    color: var(--text);
}
.article-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
.article-card-body { padding: 1.25rem; }
.article-card-body h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: .5rem;
}
.article-card-body p {
    color: var(--muted);
    font-size: .92rem;
    margin-bottom: .75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.article-read-more {
    color: var(--brand-end);
    font-weight: 600;
    font-size: .9rem;
}
.btn-view-all {
    display: inline-block;
    border: 2px solid var(--brand-end);
    color: var(--brand-end);
    font-weight: 700;
    border-radius: 999px;
    padding: .6rem 1.6rem;
}
.btn-view-all:hover { background: var(--brand-end); color: #fff; }

.article-detail-section { padding: 3rem 0 5rem; }
.article-detail { max-width: 760px; }
.article-back-link { color: var(--muted); font-weight: 600; display: inline-block; margin-bottom: 1.25rem; }
.article-back-link:hover { color: var(--brand-end); }
.article-detail-title {
    font-weight: 800;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    margin-bottom: .5rem;
}
.article-detail-date { color: var(--muted); margin-bottom: 1.5rem; }
.article-detail-cover {
    width: 100%;
    border-radius: 16px;
    margin-bottom: 2rem;
    max-height: 420px;
    object-fit: cover;
}
.article-detail-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text);
}

/* ---------- Membership ---------- */
.membership-page-section { padding: 3.5rem 0 5rem; }
.membership-section { padding: 1.5rem 0 4.5rem; background: var(--surface); }
.membership-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
}
.membership-card .form-control,
.membership-card .input-group-text {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
.btn-check-membership {
    background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
    color: #fff;
    font-weight: 700;
    border-radius: 12px;
    padding: .7rem;
}
.btn-check-membership:hover { filter: brightness(1.08); color: #fff; }

.membership-placeholder {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.membership-placeholder i { display: block; }
.membership-result {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
}
.member-photo {
    width: 72px; height: 72px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--border);
}
.detail-label { color: var(--muted); font-size: .8rem; }
.result-details > div { margin-bottom: .5rem; }

/* ---------- Footer ---------- */
.home-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 3.5rem 0 1.5rem;
    color: var(--text);
}
.home-footer h5 { font-weight: 700; margin-bottom: 1rem; }
.footer-brand { font-size: 1.2rem; display: flex; align-items: center; }
.footer-about, .footer-contact-list { color: var(--muted); }
.footer-contact-list li { margin-bottom: .6rem; }
.footer-contact-list a { color: var(--text); }
.footer-contact-list a:hover { color: var(--brand-end); }
.map-wrap { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.map-wrap iframe { width: 100%; height: 180px; border: 0; display: block; }
.footer-divider { border-color: var(--border); margin: 2rem 0 1rem; }
.footer-bottom { color: var(--muted); gap: .75rem; }
.footer-admin-link { color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; }
.footer-admin-link:hover { color: var(--brand-end); }

/* ---------- Lightbox ---------- */
.lightbox-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2rem;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img { max-width: 90vw; max-height: 80vh; border-radius: 8px; }
.lightbox-caption { color: #fff; margin-top: 1rem; text-align: center; }
.lightbox-close {
    position: absolute; top: 18px; right: 28px;
    color: #fff; font-size: 2.2rem; cursor: pointer; line-height: 1;
}

@media (max-width: 767px) {
    .hero-carousel .carousel-item { height: 60vh; }
    .hero-caption { bottom: 6%; }
    .membership-card { padding: 1.25rem; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
