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

/* layout tokens: navbar/footer heights used for anchor and sticky math */
:root{
    --navbar-height: 6.5rem;
    --footer-height: 6.5rem;
    --rules-extra-bottom: 0rem; /* extra bottom padding when a large section is open */
}

/* Make the rules page a column flex layout so the footer stays at the bottom when content is short */
.rules-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.rules-page main#main { flex: 1 0 auto; padding-bottom: var(--footer-height, 6.5rem); }

/* Attempt to load the Minecrafter font if available locally or in /fonts */
@font-face{
    font-family: 'Minecrafter';
    src: local('Minecrafter'), local('Minecrafter-Regular'), url('fonts/Minecrafter.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

body {
    font-family: 'Minecrafter', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /* design tokens */
    /* tan / warm palette tuned to match the site hero */
    --bg: #16120d;            /* very dark brown */
    --surface: #2b2419;       /* deep warm surface */
    --muted: #2b2419;
    --accent: #d9b48a;        /* warm tan */
    --accent-2: #c79e6a;      /* darker tan */
    --text: #fbf6ec;          /* off-white */
    --muted-text: #cfc1b3;    /* light tan text */
    --glass: rgba(28,20,12,0.45);
    --hero-overlay-start: rgba(8,6,4,0.6);
    --hero-overlay-end: rgba(10,8,6,0.24);
    --hero-overlay-start: rgba(2,6,6,0.45);
    --hero-overlay-end: rgba(2,6,6,0.18);

    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: #022;
    border-radius: 6px;
    z-index: 2000;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--glass);
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    z-index: 2000;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}


.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.4rem; /* spacing when only text is present */
}

.nav-logo h2 {
    color: var(--accent);
    font-weight: 700;
    font-size: 1rem; /* ensure the text size is predictable */
    line-height: 1;
    margin: 0;
}

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

.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
}

.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent-2);
}

.nav-discord {
    /* Match standard nav link styling - same font/size/color */
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s ease;
    background: transparent;
    padding: 0;
}

.nav-discord:hover {
    color: var(--accent-2);
}

/* Nav dropdown (Rules) */
.nav-item.nav-dropdown{ position: relative; }
.nav-dropdown-toggle{
    background: transparent;
    border: none;
    color: var(--text);
    font-weight: 500; /* match nav link weight for consistency */
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.95rem;
}
.nav-dropdown-menu{
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    background: var(--surface);
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 8px 30px rgba(5,4,3,0.6);
    display: none;
    z-index: 2200;
}
.nav-dropdown.open .nav-dropdown-menu{ display: block; }
.nav-dropdown-menu a{ display:block; padding:0.5rem 0.75rem; color:var(--muted-text); text-decoration:none; border-radius:6px; font-weight:500; font-size:0.95rem; }
.nav-dropdown-menu a:hover{ background: rgba(255,255,255,0.02); color:var(--accent-2); }

/* keyboard focus outlines for accessibility */
.nav-dropdown-menu a:focus{ outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-dropdown-toggle:focus{ outline: 2px solid var(--accent); outline-offset: 2px; }


/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* use the project-local background image only (no gradient) */
    background-color: #0a0a0a;
    background-image: url('bg.png');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    padding: 8rem 2rem 4rem;
}

/* Hero overlay moved from inline styles so it applies site-wide */
.hero{
    position: relative;
}
.hero::before{
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--hero-overlay-start), var(--hero-overlay-end));
    pointer-events: none;
    z-index: 0;
}
.hero-content{ position: relative; z-index: 2; }

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #e9f7f5 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--muted-text);
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.btn-primary {
    background: linear-gradient(180deg,var(--accent),var(--accent-2));
    color: #1b1208;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(215,180,140,0.14);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    padding: 1rem 2rem;
    text-decoration: none;
    border: 2px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    font-weight: 600;
    transition: border-color 0.3s ease, background 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--accent-2);
    background: rgba(199,158,106,0.06);
}

.server-ip {
    background: transparent;
    border: none;
    padding: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.server-ip { display: inline-flex; align-items: center; gap: 0.75rem; }

.btn-copy {
    background: var(--accent);
    color: #1b1208;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-copy:active { transform: translateY(1px); }


/* Features Section */
.features {
    padding: 8rem 2rem;
    background: linear-gradient(180deg, rgba(6,20,19,0.35), rgba(6,20,19,0.15));
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.feature-content h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--accent-2);
}

.feature-content h3 {
    font-size: 1.5rem;
    color: var(--muted-text);
    margin-bottom: 1.5rem;
}

.feature-content p {
    font-size: 1.1rem;
    color: var(--muted-text);
    line-height: 1.8;
}

.feature-image img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(20,12,8,0.6);
}

/* Page content helpers */
.content {
    padding-top: 6.5rem; /* avoid nav overlap */
}

/* Small page hero for non-home pages for visual consistency */
.page-hero{
    padding: 3.5rem 1rem;
    background: linear-gradient(180deg, rgba(6,12,13,0.4), rgba(6,12,13,0.15));
    color: var(--text);
}
.page-hero .page-hero-inner{ max-width:1200px; margin:0 auto; text-align:center; }
.page-hero h1{ font-size:2rem; margin-bottom:0.5rem; }
.page-hero p.lede{ color:var(--muted-text); font-size:1.05rem; margin:0 auto; max-width:760px; }

/* Skip-link styles (moved inline -> stylesheet) */
.skip-link{
    position: absolute; left:-999px; top:auto; width:1px; height:1px; overflow:hidden;
}
.skip-link:focus{ left:1rem; top:1rem; width:auto; height:auto; padding:0.5rem 1rem; background:var(--accent); color:#022; border-radius:6px; z-index:3000; }

/* Rules section styling: use the site bg image with an inner panel for legibility */
.rules-section{
    /* no background image for rules page — use the site background color */
    background: var(--bg);
    position: relative;
    /* occupy full viewport below the fixed navbar */
    min-height: calc(100vh - 6.5rem);
    /* ensure the top of this section clears the fixed navbar */
    padding: 6.5rem 0 0 0; /* top padding equals navbar height */
}
.rules-section::before{
    display: none; /* remove dark overlay since we no longer use bg.png */
}
.rules-panel{
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: block; /* switch to grid inside .rules-grid for layout */
    background: transparent;
}
.rules-panel header h1{ margin:0 0 0.25rem 0; color:var(--text); font-size:2rem; }
.rules-panel header p.lede{ color:var(--muted-text); margin-bottom:1rem; }
.rules-toc{ margin-bottom:1.25rem; display:block; }
.rules-toc ul{ list-style: none; padding-left: 0; display:flex; flex-wrap:wrap; gap:0.5rem 1rem; }
.rules-toc a{ color:var(--accent-2); text-decoration:none; padding:0.25rem 0.5rem; border-radius:6px; background: rgba(0,0,0,0.08); }
.rules-grid{ display:grid; grid-template-columns: 1fr; gap:1.5rem; height:100%; }
.rules-content h2{ color:var(--accent-2); margin-top:1rem; }
.rules-content p, .rules-content li{ color:var(--muted-text); line-height:1.8; }
.rules-content ul{ margin-left:1.1rem; }

@media(min-width:900px){
    /* Desktop: left column + main column layout that spans the entire viewport width */
    .rules-grid{ grid-template-columns: 260px 1fr; height: calc(100vh - 6.5rem); }
    .rules-toc{ margin:0; }
    .rules-toc ul{ flex-direction:column; gap:0.5rem; }

    /* left sidebar fixed/ sticky to the top area beneath the navbar */
    .rules-grid aside.rules-toc{
        position: sticky;
    top: var(--navbar-height);
    bottom: var(--footer-height, 0); /* stop above the fixed footer height */
        align-self: start;
        width: 260px;
        height: auto; /* let top/bottom determine the occupied area */
        padding: 0.75rem 0.75rem 1.5rem 0.75rem;
        overflow-y: auto; /* allow the TOC to scroll independently if items overflow */
        background: var(--surface);
        border-right: 1px solid rgba(255,255,255,0.03);
    }
    .rules-grid aside.rules-toc ul{ display:flex; flex-direction:column; gap:0.6rem; }
    .rules-grid aside.rules-toc a{ color:var(--muted-text); padding:0.45rem 0.6rem; display:block; border-radius:6px; }
    .rules-grid aside.rules-toc a:hover{ background: rgba(255,255,255,0.02); color:var(--accent-2); }
    .rules-grid aside.rules-toc a.active{ background: linear-gradient(90deg, rgba(215,180,140,0.08), rgba(215,180,140,0.04)); color:var(--text); }

    /* main content area scrolls with the page (no inner scrollbar) */
    /* bottom padding ensures breathing room; footer is in normal flow so a modest gap is enough */
    .rules-content{ padding:2.5rem 2.5rem 3rem 2.5rem; overflow: visible; height: auto; background: transparent; }

}

/* When the Gameplay Rules section is open, add extra bottom padding so long content doesn't overlap the footer */
/* dynamic padding for open sections is handled by JS; no hardcoded extra padding here */

/* Each rules section should look like its own card/block for clarity, but only when expanded */
.rules-content > section:not(.collapsed){
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 20px rgba(3,3,3,0.45);
}
.rules-content > section h2{ margin-top:0; }

/* Collapsible body default to hidden. JS will set max-height when expanded. Hidden sections are removed from flow. */
.collapsible-body{ max-height: 0; opacity: 0; transition: max-height 0.28s ease, opacity 0.24s ease; overflow: hidden; }
.rules-content section.collapsed{ display: none; }
.rules-content section:not(.collapsed) > .collapsible-body{ opacity: 1; }

/* Make TOC flush if you prefer a tighter left edge */
.rules-grid aside.rules-toc{ padding-left: 1rem; padding-right:1rem; }

@media (max-width:899px){
    /* on small screens, keep TOC as a compact list above content — now it's the aside but we keep it accessible */
    .rules-grid{ grid-template-columns: 1fr; }
    .rules-grid aside.rules-toc{ position: relative; top: auto; width: 100%; height: auto; padding: 0.75rem 1rem; background: transparent; }
    .rules-grid aside.rules-toc ul{ display:flex; gap:0.5rem; flex-wrap:wrap; }
}

/* Collapsible section controls */
.rules-content section{ scroll-margin-top:9rem; }

/* give a little top spacing so the fixed toolbar doesn't cover the first rule */
.rules-content{ padding-top:2.5rem; }
.collapsible-toggle{
    appearance: none;
    background: transparent;
    border: none;
    color: var(--accent-2);
    font-weight: 700;
    margin-left: 0.5rem;
    cursor: pointer;
}
.collapsible-body{
    transition: max-height 0.28s ease, opacity 0.24s ease;
    overflow: hidden;
}
.collapsed > .collapsible-body{
    max-height: 0;
    opacity: 0;
    padding-top: 0;
}
.rules-content section{ border-left: 3px solid transparent; padding-left: 0.75rem; }
.rules-content section.collapsed{ border-left-color: rgba(255,255,255,0.02); }

/* CTA Section */
.cta-section {
    padding: 6rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(6,20,19,0.28) 0%, rgba(4,12,12,0.18) 100%);
}

/* Make the CTA container full-bleed so the two-column CTA spans the full page width
   without being constrained by the site's centered .container max-width. This only
   affects the CTA section so other containers keep the centered max-width. */
.cta-section > .container {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0 1rem; /* reduce side padding so the two boxes can be wider */
}

.cta-section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

.cta-section p {
    font-size: 1.25rem;
    color: var(--muted-text);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cta-grid{
    display: grid;
    grid-template-columns: 320px 1fr; /* left sidebar + main video */
    gap: 1.25rem;
    align-items: stretch;
    justify-items: stretch;
    width: 100%;
}
.cta-left { text-align: left; display:flex; flex-direction:column; justify-content:center; gap:0.75rem; padding:2rem 1.5rem; background: transparent; box-shadow: none; border-radius:0; width:100%; max-width:none; }
.cta-left p { margin: 0; color: var(--muted-text); max-width: 1100px; }
.cta-left-buttons { display:flex; gap:0.75rem; align-items:center; }
.video-wrap{ position: relative; display: flex; flex-direction: column; width: 100%; }
.video-wrap .cta-video{ width: 100%; flex: 1 1 auto; display: flex; align-items: stretch; background: transparent; }
.video-wrap .cta-video iframe{ width:100%; height:100%; display:block; border:0; }
/* ensure a reasonable minimum so the iframe is visible even when sidebar is short */
.video-wrap .cta-video{ min-height: 300px; }

/* Thumbnail sidebar removed — single canonical feature iframe is used on /home */

@media (max-width: 900px){
    .cta-grid{ grid-template-columns: 1fr; gap:1rem; text-align:center; }
    .cta-video iframe{ height:200px; }
    .cta-left { text-align: center; }
    .cta-left-buttons { justify-content:center; }
}

/* CTA band spacing — stack by default and let content determine height */
.cta-section { padding: 4rem 0; }
.cta-section > .container { padding: 0 2rem; }
.cta-grid { height: auto; align-items: stretch; gap: 1.25rem; grid-template-columns: 320px 1fr; }

/* wrap to allow the refresh button to sit outside the video card */
.video-wrap{ position: relative; display: block; width: 100%; }
.video-wrap .cta-video{ width: 100%; }

/* small refresh control inside the video card */
.video-actions{ margin-top: 0.75rem; display:flex; justify-content:flex-end; }
.watch-full-btn{ display:none; }

@media (max-width:900px){
    .cta-grid { height: auto; grid-template-columns: 1fr; }
    .cta-left, .cta-video { height: auto; }
    .video-refresh-btn{ top:8px; right:8px; position: absolute; transform: none; }
}

/* Feature area (iframe under the CTA heading) */
.cta-feature{ max-width:1200px; margin: 1.25rem auto 2rem auto; padding: 0 2rem; }
.cta-feature-controls{ display:flex; gap:0.75rem; align-items:center; justify-content:flex-start; margin-bottom:0.75rem; }
.cta-feature-video{ width:100%; max-width:900px; margin:0 auto; }
.cta-feature-video iframe{ width:100%; height:360px; border-radius:10px; border:0; }

@media (max-width:900px){
    .cta-feature-video iframe{ height:220px; }
    .cta-feature-controls{ justify-content:center; }
}

/* Footer */
footer {
    background: linear-gradient(180deg, rgba(4,10,10,0.12), rgba(4,10,10,0.04));
    border-top: 1px solid rgba(255,255,255,0.03);
    padding: 3rem 2rem 2rem;
    text-align: center;
}

/* On the rules page the footer should be fixed to the bottom of the viewport */
/* previously the footer was fixed on the rules page; revert to normal flow so content expansion pushes it down */

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-links a {
    color: var(--accent-2);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--text);
}

.footer-text p {
    color: var(--muted-text);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* On the rules page we fix the footer to the bottom and use a CSS variable
   for its height so JS can write an exact px value. The main content then
   reserves that height to avoid overlap. */
.rules-page footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    z-index: 2100;
}

/* hide/show footer by translating it out of view; body gets .footer-hidden when footer should hide */
.rules-page footer {
    transition: transform 240ms ease-in-out, opacity 200ms ease-in-out;
    will-change: transform;
}
.rules-page.footer-hidden footer {
    transform: translateY(100%);
    opacity: 0.0;
    pointer-events: none;
}

/* Featured video section with two-column layout */
.featured-video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.featured-video-content {
    grid-column: 1 / 3;
}

#featured-video-container {
    grid-column: 3 / 5;
}

.featured-video-content h2 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.featured-video-content ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;
}

.featured-video-content li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.featured-video-content li::before {
    content: "✓";
    color: var(--accent);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.featured-video-content li strong {
    color: var(--text);
}

.featured-video-content p {
    color: var(--muted-text);
    line-height: 1.7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-toggle {
        display: inline-block;
    }

    .nav-links {
        position: absolute;
        right: 1rem;
        top: 68px;
        display: flex;
        flex-direction: column;
        background: rgba(6,12,13,0.92);
        padding: 1rem;
        border-radius: 8px;
        gap: 1rem;
        box-shadow: 0 10px 30px rgba(0,0,0,0.6);
        display: none;
    }

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

    /* When mobile nav is open, dropdown menus should render inline inside the mobile panel */
    .nav-links.show .nav-dropdown-menu{
        position: static;
        display: block;
        box-shadow: none;
        background: transparent;
        padding: 0;
    }
    .nav-links.show .nav-dropdown-menu a{ padding: 0.5rem 0; color: var(--text); }
    
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .features {
        padding: 4rem 1rem;
    }
    
    .cta-section {
        padding: 4rem 1rem;
    }

    .featured-video-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .featured-video-content {
        order: 2;
    }

    #featured-video-container {
        order: 1;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    /* leave room for fixed navbar when jumping to anchors */
    scroll-padding-top: 6.5rem;
}

/* Feature debug panel removed */
