/* --- Global Styles & Variables --- */
:root {
    --color-bg: #f4f4f4; /* Light grey background */
    --color-text: #333; /* Dark grey text */
    --color-primary: #2a9d8f; /* Teal green primary */
    --color-secondary: #e9c46a; /* Sandy yellow secondary */
    --color-accent: #f4a261; /* Orange accent */
    --color-dark: #264653; /* Dark blue/green */
    --color-light: #ffffff; /* White */
    --color-border: #ddd;

    --font-primary: 'Roboto', sans-serif;
    --font-heading: 'Press Start 2P', cursive; /* Pixelated font for titles */

    --container-width: 1100px;
    --spacing-unit: 1rem; /* 16px default */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    display: flex; /* Push footer down */
    flex-direction: column; /* Stack elements vertically */
    min-height: 100vh; /* Ensure body takes full viewport height */
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 calc(var(--spacing-unit) * 1.5); /* 24px */
}

h1, h2, h3 {
    margin-bottom: calc(var(--spacing-unit) * 0.75); /* 12px */
    color: var(--color-dark);
    line-height: 1.3;
}

h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); } /* Responsive font size */
h2 { font-size: clamp(1.3rem, 3.5vw, 1.8rem); }
h3 { font-size: clamp(1.1rem, 3vw, 1.4rem); }

p {
    margin-bottom: var(--spacing-unit); /* 16px */
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover, a:focus {
    color: var(--color-accent);
}

img { /* In case you add images later */
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Header --- */
.site-header {
    background-color: var(--color-dark);
    color: var(--color-light);
    padding: var(--spacing-unit) 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: var(--spacing-unit);
}

.site-title {
    font-family: var(--font-heading);
    color: var(--color-secondary);
    margin-bottom: 0; /* Override default h1 margin */
    font-size: clamp(1.2rem, 3vw, 1.6rem); /* Smaller pixel font */
    text-shadow: 2px 2px #264653; /* Simple shadow for pixel font */
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap; /* Allow nav items to wrap */
    gap: calc(var(--spacing-unit) * 1.5); /* 24px */
}

.main-nav a {
    color: var(--color-light);
    font-weight: bold;
    padding: 0.5rem 0;
    position: relative; /* For underline effect */
    transition: color 0.3s ease;
}

.main-nav a::after { /* Underline effect */
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-secondary);
    transition: width 0.3s ease;
}

.main-nav a:hover,
.main-nav a:focus {
    color: var(--color-secondary);
}

.main-nav a:hover::after,
.main-nav a:focus::after {
    width: 100%;
}


/* --- Main Content --- */
.site-main {
    flex-grow: 1; /* Allow main content to fill available space */
    padding: calc(var(--spacing-unit) * 2) 0; /* 32px top/bottom */
}

/* Hero Section */
.hero {
    background-color: var(--color-primary);
    color: var(--color-light);
    padding: calc(var(--spacing-unit) * 3) 0; /* 48px */
    text-align: center;
    margin-bottom: calc(var(--spacing-unit) * 2); /* 32px */
}

.hero h2 {
    color: var(--color-light);
    font-size: clamp(1.8rem, 5vw, 2.5rem);
}

.hero p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}


/* Server List & Cards */
.server-list {
    margin-bottom: calc(var(--spacing-unit) * 2.5); /* 40px */
}

.server-list h2 {
    text-align: center;
    margin-bottom: calc(var(--spacing-unit) * 2); /* 32px */
    position: relative;
    display: inline-block; /* To make underline only span text */
    left: 50%;
    transform: translateX(-50%);
}

.server-list h2::after { /* Decorative underline for section titles */
    content: '';
    position: absolute;
    bottom: -5px;
    left: 10%;
    width: 80%;
    height: 3px;
    background-color: var(--color-accent);
}

.featured-servers h2 {
    color: var(--color-accent); /* Highlight featured title */
}


.server-grid {
    display: flex;
    flex-wrap: wrap; /* Crucial for responsiveness */
    gap: calc(var(--spacing-unit) * 1.5); /* 24px spacing between cards */
    justify-content: center; /* Center cards if they don't fill a row */
}

.server-card {
    background-color: var(--color-light);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--spacing-unit); /* 16px */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column; /* Stack card content vertically */
    flex-basis: 300px; /* Suggested width, allows shrinking/growing */
    flex-grow: 1; /* Allow cards to grow to fill space */
    max-width: 400px; /* Prevent cards from becoming too wide */
}

.server-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.server-card.featured {
    border-left: 5px solid var(--color-secondary); /* Highlight featured cards */
}

.card-header {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--spacing-unit);
    margin-bottom: var(--spacing-unit);
    display: flex;
    flex-direction: column; /* Stack heading and IP */
    gap: calc(var(--spacing-unit) * 0.25); /* Small gap */
}

.card-header h3 {
    margin-bottom: 0; /* Remove default margin */
    color: var(--color-primary);
}

.server-ip {
    font-family: monospace; /* Good for IPs */
    background-color: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #555;
    align-self: flex-start; /* Only take width needed */
    cursor: pointer; /* Hint that it might be interactive */
}

.card-body {
    flex-grow: 1; /* Allows body to push footer down */
    margin-bottom: var(--spacing-unit);
}

.card-body p {
    font-size: 0.95em;
    margin-bottom: var(--spacing-unit);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 0.5); /* 8px */
}

.tag {
    background-color: #e0e0e0;
    color: #555;
    padding: 3px 8px;
    border-radius: 12px; /* Pill shape */
    font-size: 0.8em;
    font-weight: bold;
}

/* Example Tag Colors (add more as needed) */
.tag.survival { background-color: #8fbc8f; color: var(--color-dark); } /* DarkSeaGreen */
.tag.creative { background-color: #add8e6; color: var(--color-dark); } /* LightBlue */
.tag.minigames { background-color: #ffcc80; color: var(--color-dark); } /* Light Orange */
.tag.pvp { background-color: #ff7f7f; color: var(--color-dark); } /* Light Red */
.tag.pve { background-color: #90ee90; color: var(--color-dark); } /* LightGreen */
.tag.economy { background-color: #ffd700; color: var(--color-dark); } /* Gold */
.tag.skyblock { background-color: #b0e0e6; color: var(--color-dark); } /* PowderBlue */
.tag.hardcore { background-color: #a52a2a; color: var(--color-light); } /* Brown */
.tag.vanilla { background-color: #f5f5dc; color: var(--color-dark); } /* Beige */
.tag.building { background-color: #deb887; color: var(--color-dark); } /* BurlyWood */

.card-footer {
    margin-top: auto; /* Pushes footer to the bottom */
    padding-top: var(--spacing-unit);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    color: #666;
}

.join-button {
    background-color: var(--color-accent);
    color: var(--color-light);
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.join-button:hover:not(:disabled),
.join-button:focus:not(:disabled) {
    background-color: #d88c4a; /* Darker accent */
    transform: scale(1.05);
}
.join-button:disabled {
    background-color: #cccccc;
    cursor: default;
    transform: none;
}


/* How to Join Section */
.how-to-join {
    background-color: var(--color-light);
    padding: calc(var(--spacing-unit) * 2) 0; /* 32px */
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.how-to-join h2 {
    text-align: center;
    margin-bottom: calc(var(--spacing-unit) * 1.5); /* 24px */
}

.how-to-join ol {
    list-style: decimal;
    margin-left: calc(var(--spacing-unit) * 2); /* 32px */
    max-width: 700px; /* Keep list readable */
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-unit); /* Space for numbers */
}

.how-to-join li {
    margin-bottom: calc(var(--spacing-unit) * 0.75); /* 12px */
}

/* --- Footer --- */
.site-footer {
    background-color: var(--color-dark);
    color: #ccc; /* Lighter text for footer */
    text-align: center;
    padding: calc(var(--spacing-unit) * 1.5) 0; /* 24px */
    font-size: 0.9em;
    margin-top: auto; /* Pushes footer to bottom if content is short */
}
.site-footer p {
    margin-bottom: calc(var(--spacing-unit) * 0.5); /* 8px */
}


/* --- Responsive Design --- */

/* Tablet Styles */
@media (min-width: 768px) {
    .server-card {
        /* Adjust basis for tablets - allow slightly fewer cards per row than desktop */
         flex-basis: calc(50% - var(--spacing-unit) * 1.5); /* Aim for 2 cards per row */
    }

    .card-header {
        flex-direction: row; /* Place heading and IP side-by-side */
        justify-content: space-between;
        align-items: center;
    }
     .server-ip {
        align-self: center; /* Re-align IP */
    }
}

/* Desktop Styles */
@media (min-width: 1024px) {
     .server-card {
        /* Adjust basis for wider screens - aiming for ~3 cards per row */
        flex-basis: calc(33.333% - var(--spacing-unit) * 1.5);
    }
}

/* Smaller Mobile Adjustments (Optional) */
@media (max-width: 480px) {
    .site-title {
        text-align: center; /* Center title if header wraps */
        width: 100%;
    }
    .main-nav ul {
        justify-content: center; /* Center nav items */
        gap: var(--spacing-unit); /* Reduce gap */
    }
    .server-card {
         flex-basis: 100%; /* Force cards to full width */
    }
}