/* ========================================
   VALERA - Minecraft Roleplay Nation
   Complete Stylesheet
   Colors: Dark Red (#8B0000, #DC143C) & Gold (#DAA520, #FFD700)
   Fonts: Cinzel (headings), Inter (body)
   ======================================== */

/* ---- Reset & Base ---- */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #DAA520;
}

/* ---- Keyframes ---- */

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Navigation ---- */

nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    border-bottom: 1px solid rgba(218, 165, 32, 0.12);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-brand img {
    height: 32px;
    width: auto;
}

.nav-brand span {
    font-family: 'Cinzel', serif;
    color: #DAA520;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 3px;
}

.nav-links {
    display: flex;
    gap: 2px;
}

.nav-links a {
    padding: 8px 14px;
    color: #999;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 1.2px;
    border-radius: 6px;
    transition: color 0.25s ease, background 0.25s ease;
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    color: #FFD700;
    background: rgba(218, 165, 32, 0.08);
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #DAA520;
    cursor: pointer;
}

/* ---- Sections (General) ---- */

section {
    min-height: 100vh;
    padding: 0;
    animation: fadeInSection 0.4s ease-out;
}

@keyframes fadeInSection {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 40px 60px;
}

.section-title {
    font-family: 'Cinzel', serif;
    font-size: 2.4rem;
    color: #DAA520;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.section-subtitle {
    text-align: center;
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 50px;
    letter-spacing: 1px;
}

/* Gold underline for section titles */
.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #DAA520, transparent);
    margin: 12px auto 0;
}

/* ---- Section Banner Images ---- */

.section-banner {
    width: 100%;
    height: 220px;
    object-fit: cover;
    object-position: center 40%;
    display: block;
    filter: brightness(0.5);
    margin-top: -1px;
}

.section-banner-wrap {
    position: relative;
    overflow: hidden;
}

.section-banner-wrap .banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(10,10,10,0.3) 0%, rgba(10,10,10,0.95) 100%);
    pointer-events: none;
}

/* ---- Hero / Home Section ---- */

#home {
    min-height: 100vh;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.hero {
    flex: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-size: cover;
    background-position: center 40%;
    background-repeat: no-repeat;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(10, 10, 10, 0.7) 60%,
        rgba(10, 10, 10, 1) 100%
    );
    z-index: 0;
}

.hero-content {
    text-align: center;
    z-index: 1;
    position: relative;
    padding: 0 20px;
    animation: fadeInUp 1s ease-out;
}

.hero-flag {
    width: 140px;
    height: 140px;
    margin: 0 auto 24px;
    filter: drop-shadow(0 0 40px rgba(218, 165, 32, 0.4));
    animation: float 4s ease-in-out infinite;
    border-radius: 8px;
    object-fit: contain;
}

.hero-title {
    font-family: 'Cinzel', serif;
    font-size: 4.5rem;
    font-weight: 900;
    color: #DAA520;
    text-shadow: 0 2px 60px rgba(218, 165, 32, 0.3);
    letter-spacing: 8px;
    text-transform: uppercase;
    line-height: 1.1;
}

.hero-motto {
    font-size: 1rem;
    letter-spacing: 10px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin: 20px 0;
    font-weight: 300;
}

.hero-description {
    max-width: 560px;
    margin: 24px auto 0;
    color: #aaa;
    font-size: 0.95rem;
    line-height: 1.8;
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
    color: rgba(218, 165, 32, 0.4);
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 1;
    text-decoration: none;
    transition: color 0.3s;
}

.scroll-indicator:hover {
    color: rgba(218, 165, 32, 0.8);
}

/* ---- Home Panels ---- */

.home-panel {
    background: #0a0a0a;
    padding: 80px 40px;
}

.home-panel-alt {
    background: #080808;
}

.home-panel-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 60px;
}

.home-panel-reverse {
    flex-direction: row-reverse;
}

.home-panel-text {
    flex: 1;
}

.home-panel-title {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: #DAA520;
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.home-panel-text p {
    color: #999;
    font-size: 1rem;
    line-height: 1.9;
}

.home-panel-image {
    flex: 1;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #1a1a1a;
}

.home-panel-image img {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 768px) {
    .home-panel {
        padding: 50px 20px;
    }
    .home-panel-inner,
    .home-panel-reverse {
        flex-direction: column;
        gap: 30px;
    }
    .home-panel-title {
        font-size: 1.4rem;
    }
}

/* ---- Cards (Reusable) ---- */

.card {
    background: #111;
    border-radius: 12px;
    border: 1px solid #1a1a1a;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(218, 165, 32, 0.2);
}

.card-body {
    padding: 20px;
}

.card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* ---- Members ---- */

.members-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.members-search-wrap {
    position: relative;
    flex: 1;
    max-width: 360px;
}

.members-search-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #444;
    font-size: 0.82rem;
    pointer-events: none;
}

.members-search-wrap input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.25s;
}

.members-search-wrap input:focus {
    outline: none;
    border-color: #DAA520;
}

.members-search-wrap input::placeholder {
    color: #444;
}

.members-count {
    font-size: 0.8rem;
    color: #555;
    white-space: nowrap;
}

.members-count span {
    color: #DAA520;
    font-weight: 600;
}

.members-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.member-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #111;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    padding: 8px 16px;
    transition: border-color 0.25s, background 0.25s;
    cursor: default;
}

.member-chip:hover {
    border-color: rgba(218, 165, 32, 0.25);
    background: #151515;
}

.member-chip .member-name {
    font-family: 'Inter', sans-serif;
    font-size: 0.86rem;
    font-weight: 500;
    color: #ddd;
}

.member-chip .member-rank {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 2px 7px;
    border-radius: 4px;
    line-height: 1;
}

.member-chip .member-rank.rank-founder  { color: #FFD700; background: rgba(255, 215, 0, 0.1); }
.member-chip .member-rank.rank-council  { color: #DC143C; background: rgba(220, 20, 60, 0.1); }
.member-chip .member-rank.rank-general  { color: #c0392b; background: rgba(192, 57, 43, 0.1); }
.member-chip .member-rank.rank-officer  { color: #e67e22; background: rgba(230, 126, 34, 0.1); }
.member-chip .member-rank.rank-citizen  { color: #666; background: rgba(136, 136, 136, 0.06); }
.member-chip .member-rank.rank-default  { color: #DAA520; background: rgba(218, 165, 32, 0.08); }
.member-chip .member-rank.rank-loyalist { color: #2ecc71; background: rgba(46, 204, 113, 0.1); }

.members-empty {
    width: 100%;
    text-align: center;
    padding: 40px 20px;
    color: #444;
    font-size: 0.9rem;
}

/* ---- Org Chart (Government Hierarchy) ---- */

.org-chart-wrapper {
    overflow-x: auto;
    padding: 20px 0 40px;
    -webkit-overflow-scrolling: touch;
}

.org-chart {
    display: flex;
    justify-content: center;
    min-width: max-content;
}

.org-chart ul {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.org-chart li {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0 16px;
}

.org-node {
    position: relative;
    z-index: 1;
}

/* ── Space between parent and children rows ── */
.org-chart li > ul {
    margin-top: 60px;
    position: relative;
}

/* ── Vertical line DOWN from parent card to the children row ── */
.org-chart li:has(> ul) > .org-node::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 100%);
    width: 2px;
    height: 60px;
    background: #DAA520;
    z-index: 0;
}

/* ── Children: each li gets top padding for the vertical connector ── */
.org-chart ul ul > li {
    padding-top: 30px;
}

/* ── Horizontal bar across siblings (::before) ── */
.org-chart ul ul > li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #DAA520;
}

.org-chart ul ul > li:first-child::before {
    left: 50%;
}

.org-chart ul ul > li:last-child::before {
    right: 50%;
}

.org-chart ul ul > li:only-child::before {
    display: none;
}

/* ── Vertical connector from horizontal bar to card (::after) ── */
.org-chart ul ul > li::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 30px;
    background: #DAA520;
}

/* ── Root level: no upward connectors ── */
.org-chart > ul > li {
    padding-top: 0;
}
.org-chart > ul > li::before,
.org-chart > ul > li::after {
    display: none;
}

/* ── The profile card ── */
.org-card {
    background: #111;
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    width: 200px;
    text-align: center;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    position: relative;
}

.org-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    border-color: rgba(218, 165, 32, 0.3);
}

.org-card-img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    background: #1a1a1a;
    display: block;
}

.org-card-img-placeholder {
    width: 100%;
    height: 130px;
    background: linear-gradient(135deg, #8B0000 0%, #3a0000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: rgba(218, 165, 32, 0.4);
}

.org-card-info {
    padding: 14px 12px 16px;
}

.org-card-name {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #FFD700;
    margin-bottom: 2px;
}

.org-card-title {
    font-size: 0.7rem;
    color: #DC143C;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    margin-bottom: 6px;
}

.org-card-desc {
    color: #777;
    font-size: 0.78rem;
    line-height: 1.5;
}

/* ---- Timeline (History) ---- */

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: linear-gradient(#DAA520, #8B0000);
}

.timeline-item {
    position: relative;
    margin-bottom: 40px;
    width: 50%;
}

.timeline-item:nth-child(odd) {
    padding-right: 30px;
    text-align: right;
    left: 0;
}

.timeline-item:nth-child(even) {
    padding-left: 30px;
    left: 50%;
}

.timeline-item .timeline-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #DAA520;
    border: 3px solid #0a0a0a;
    top: 20px;
    z-index: 1;
}

.timeline-item:nth-child(odd) .timeline-dot {
    right: -7px;
}

.timeline-item:nth-child(even) .timeline-dot {
    left: -7px;
}

.timeline-item .timeline-date {
    font-family: 'Cinzel', serif;
    color: #DAA520;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.timeline-item .timeline-content {
    background: #111;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #1a1a1a;
}

.timeline-item .timeline-content h3 {
    font-family: 'Cinzel', serif;
    color: #e0e0e0;
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.timeline-item .timeline-content p {
    color: #888;
    font-size: 0.9rem;
}

/* ---- Allies Grid ---- */

.allies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.ally-card {
    background: #111;
    border-radius: 12px;
    border: 1px solid #1a1a1a;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.ally-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(218, 165, 32, 0.2);
}

.ally-card .ally-flag {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: #1a1a1a;
}

.ally-flag-placeholder {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #1a1a1a, #111);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #333;
}

.ally-card .ally-info {
    padding: 18px;
}

.ally-card .ally-name {
    font-family: 'Cinzel', serif;
    color: #DAA520;
    font-size: 1.1rem;
}

.ally-card .ally-desc {
    color: #888;
    font-size: 0.9rem;
    margin-top: 8px;
    line-height: 1.6;
}

/* ---- Commonwealth ---- */

.commonwealth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.cw-type-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 8px;
    border-radius: 4px;
    margin: 6px 0;
}

.cw-type-badge.vassal {
    color: #e67e22;
    background: rgba(230, 126, 34, 0.1);
}

.cw-type-badge.commonwealth {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

/* ---- Wars & Events ---- */

.tab-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 30px;
}

.tab-btn {
    padding: 9px 22px;
    background: transparent;
    border: 1px solid rgba(218, 165, 32, 0.3);
    color: #888;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.tab-btn:hover {
    background: rgba(218, 165, 32, 0.08);
    color: #DAA520;
}

.tab-btn.active {
    background: #DAA520;
    color: #0a0a0a;
    border-color: #DAA520;
    font-weight: 600;
}

.wars-list,
.events-list {
    display: grid;
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.war-card,
.event-card {
    background: #111;
    border-radius: 12px;
    border: 1px solid #1a1a1a;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    padding: 24px;
}

.war-card:hover,
.event-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(218, 165, 32, 0.2);
}

.war-card h3,
.event-card h3 {
    font-family: 'Cinzel', serif;
    color: #DAA520;
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.war-card .war-date,
.event-card .event-date {
    color: #666;
    font-size: 0.82rem;
    margin-bottom: 10px;
}

.war-card p,
.event-card p {
    color: #888;
    font-size: 0.9rem;
    line-height: 1.6;
}

.event-location {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #666;
}

.event-location i {
    color: #DAA520;
    margin-right: 4px;
}

.war-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.stat-badge {
    background: rgba(218, 165, 32, 0.06);
    border: 1px solid rgba(218, 165, 32, 0.12);
    border-radius: 8px;
    padding: 8px 14px;
    text-align: center;
    font-size: 0.82rem;
    color: #DAA520;
}

.stat-badge i {
    margin-right: 4px;
    opacity: 0.7;
}

.result-badge,
.war-result {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 12px;
}

.result-badge.victory, .war-result.victory {
    background: rgba(0, 180, 0, 0.1);
    color: #00cc00;
    border: 1px solid rgba(0, 180, 0, 0.2);
}

.result-badge.defeat, .war-result.defeat {
    background: rgba(220, 20, 20, 0.1);
    color: #ff4444;
    border: 1px solid rgba(220, 20, 20, 0.2);
}

.result-badge.draw, .war-result.draw {
    background: rgba(218, 165, 32, 0.1);
    color: #DAA520;
    border: 1px solid rgba(218, 165, 32, 0.2);
}

/* ---- Attendance Form ---- */

.attendance-form {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.attendance-form input {
    flex: 1;
    min-width: 180px;
    padding: 10px 14px;
    background: #1a1a1a;
    border: 1px solid #222;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.attendance-form input:focus {
    border-color: #DAA520;
    outline: none;
}

.attend-btn {
    padding: 10px 18px;
    background: #DAA520;
    color: #0a0a0a;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

.attend-btn:hover {
    background: #FFD700;
}

.attendance-count {
    margin-top: 10px;
    color: #666;
    font-size: 0.85rem;
}

.attendance-count span {
    color: #DAA520;
    font-weight: 600;
}

/* ---- News Grid ---- */

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.news-card {
    background: #111;
    border-radius: 12px;
    border: 1px solid #1a1a1a;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    padding: 24px;
}

.news-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(218, 165, 32, 0.2);
}

.news-card h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: #e0e0e0;
    margin-bottom: 8px;
}

.news-meta {
    display: flex;
    gap: 14px;
    font-size: 0.78rem;
    color: #555;
    margin-bottom: 12px;
}

.news-meta i {
    margin-right: 4px;
    color: #DAA520;
    opacity: 0.6;
}

.news-card p {
    color: #888;
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid #222;
    border-radius: 20px;
    padding: 6px 14px;
    color: #666;
    cursor: pointer;
    transition: border-color 0.3s, color 0.3s;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
}

.reaction-btn:hover,
.reaction-btn.reacted {
    border-color: #DAA520;
    color: #DAA520;
}

.reaction-btn .count {
    font-weight: 600;
}

/* ---- Gallery Grid ---- */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.gallery-item {
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    aspect-ratio: 16 / 10;
    background: #111;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item .gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 14px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    color: #ccc;
    font-size: 0.82rem;
}

/* ---- Lightbox ---- */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox img {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 6px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
    transition: color 0.3s;
}

.lightbox-close:hover {
    color: #DAA520;
}

.lightbox-caption {
    color: #888;
    margin-top: 15px;
    font-size: 0.9rem;
}

/* ---- Join Discord ---- */

.join-discord-wrap {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
    padding: 40px 20px;
}

.join-discord-text {
    color: #999;
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 30px;
}

.btn-discord {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 40px;
    background: #5865F2;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1.15rem;
    font-weight: 600;
    font-family: 'Cinzel', serif;
    letter-spacing: 2px;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
}

.btn-discord:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(88, 101, 242, 0.4);
    background: #4752c4;
}

.btn-discord i {
    font-size: 1.4rem;
}

/* ---- Footer ---- */

footer {
    background: #050505;
    border-top: 1px solid #151515;
    padding: 40px 5%;
    text-align: center;
}

.footer-flag {
    width: 50px;
    margin: 0 auto 12px;
    opacity: 0.5;
    border-radius: 4px;
}

.footer-motto {
    font-family: 'Cinzel', serif;
    color: rgba(218, 165, 32, 0.5);
    letter-spacing: 4px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.footer-copy {
    color: #333;
    font-size: 0.75rem;
    margin-top: 8px;
}

/* ---- Back to Top ---- */

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(218, 165, 32, 0.15);
    color: #DAA520;
    border: 1px solid rgba(218, 165, 32, 0.2);
    font-size: 1rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s, background 0.3s;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
}

.back-to-top:hover {
    background: rgba(218, 165, 32, 0.25);
}

/* ---- Utility ---- */

.loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 2px solid #1a1a1a;
    border-top-color: #DAA520;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #444;
    font-size: 0.9rem;
}

/* ---- Mobile org chart ---- */
@media (max-width: 600px) {
    .org-chart {
        min-width: unset;
    }
    .org-chart ul {
        flex-direction: column;
        align-items: center;
    }
    .org-chart li {
        padding: 0;
    }
    .org-chart ul ul > li {
        padding-top: 0;
    }
    .org-card {
        width: 240px;
    }
    .org-chart ul ul > li::before {
        display: none;
    }
    .org-chart ul ul > li::after {
        position: relative;
        display: block;
        top: auto;
        left: auto;
        transform: none;
        width: 2px;
        height: 20px;
        margin: 0 auto;
    }
    .org-chart li:has(> ul) > .org-node::after {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        display: block;
        width: 2px;
        height: 20px;
        margin: 0 auto;
    }
    .org-chart li > ul {
        margin-top: 0;
    }
}

/* ---- Responsive (max-width: 768px) ---- */

@media (max-width: 768px) {

    .hamburger {
        display: block;
    }

    .nav-links {
        position: fixed;
        inset: 0;
        background: rgba(10, 10, 10, 0.98);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 16px;
        display: none;
        z-index: 999;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        font-size: 1.1rem;
        padding: 10px 20px;
    }

    .hero-title {
        font-size: 2.2rem;
        letter-spacing: 4px;
    }

    .hero-motto {
        letter-spacing: 5px;
        font-size: 0.8rem;
    }

    .hero-flag {
        width: 100px;
        height: 100px;
    }

    .section-container {
        padding: 60px 20px 40px;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .section-banner {
        height: 150px;
    }

    .members-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .members-search-wrap {
        max-width: 100%;
    }

    .allies-grid,
    .news-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .timeline::before {
        left: 20px;
        transform: none;
    }

    .timeline-item {
        width: 100%;
        padding-left: 50px !important;
        padding-right: 0 !important;
        text-align: left !important;
        left: 0 !important;
    }

    .timeline-item .timeline-dot {
        left: 12px !important;
        right: auto !important;
    }
}
