/* style/game-rules.css */

/* Base styles for the page content, ensuring light text on dark body background */
.page-game-rules {
    font-family: 'Arial', sans-serif;
    color: var(--text-main-color, #F2FFF6); /* Default text color for dark background */
    background-color: var(--background-color, #08160F); /* Ensure body background is respected */
    line-height: 1.6;
}

/* Color variables from custom palette */
:root {
    --primary-color: #11A84E;
    --secondary-color: #22C768;
    --button-gradient: linear-gradient(180deg, #2AD16F 0%, #13994A 100%);
    --card-bg-color: #11271B;
    --background-color-custom: #08160F; /* Custom background for page sections */
    --text-main-color: #F2FFF6;
    --text-secondary-color: #A7D9B8;
    --border-color: #2E7A4E;
    --glow-color: #57E38D;
    --gold-color: #F2C14E;
    --divider-color: #1E3A2A;
    --deep-green-color: #0A4B2C;
}

/* Hero Section */
.page-game-rules__hero-section {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding-top: 10px; /* Small top padding, body handles --header-offset */
    padding-bottom: 60px;
    background-color: var(--background-color-custom);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.page-game-rules__hero-image-wrapper {
    width: 100%;
    max-height: 500px; /* Limit height for hero image on desktop */
    overflow: hidden;
    margin-bottom: 30px;
}

.page-game-rules__hero-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    object-position: center;
}

.page-game-rules__hero-content {
    max-width: 900px;
    padding: 0 20px;
}

.page-game-rules__main-title {
    color: var(--text-main-color);
    margin-bottom: 20px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.page-game-rules__description {
    color: var(--text-secondary-color);
    font-size: 1.1em;
    margin-bottom: 30px;
}

.page-game-rules__cta-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

/* Buttons */
.page-game-rules__btn-primary,
.page-game-rules__btn-secondary {
    display: inline-block;
    padding: 15px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
    max-width: 100%; /* Ensure buttons don't overflow */
    white-space: normal; /* Allow text to wrap */
    word-wrap: break-word; /* Allow long words to break */
}

.page-game-rules__btn-primary {
    background: var(--button-gradient);
    color: var(--text-main-color); /* Light text on dark button */
    border: 2px solid transparent;
}

.page-game-rules__btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.page-game-rules__btn-secondary {
    background: transparent;
    color: var(--primary-color); /* Primary color text on transparent background */
    border: 2px solid var(--primary-color);
}

.page-game-rules__btn-secondary:hover {
    background: var(--primary-color);
    color: var(--text-main-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* General Section Styling */
.page-game-rules__section {
    padding: 60px 0;
    background-color: var(--background-color-custom);
    color: var(--text-main-color);
}

.page-game-rules__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.page-game-rules__section-title {
    color: var(--gold-color); /* Gold color for section titles */
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.5em;
    font-weight: 700;
}

.page-game-rules__sub-title {
    color: var(--primary-color); /* Primary color for sub-titles */
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.8em;
    font-weight: 600;
}

.page-game-rules__text-block {
    margin-bottom: 20px;
    color: var(--text-secondary-color);
}

.page-game-rules__image-content {
    width: 100%;
    height: auto;
    display: block;
    margin: 30px auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    object-fit: cover;
    min-width: 200px; /* Enforce min size */
    min-height: 200px; /* Enforce min size */
}

.page-game-rules__list {
    list-style: disc inside;
    margin-bottom: 20px;
    padding-left: 20px;
    color: var(--text-secondary-color);
}

.page-game-rules__list-item {
    margin-bottom: 10px;
    color: var(--text-secondary-color);
}

.page-game-rules__list-item strong {
    color: var(--text-main-color);
}

/* FAQ Section */
.page-game-rules__faq-section {
    background-color: var(--card-bg-color); /* Darker background for FAQ section */
}

.page-game-rules__faq-list {
    margin-top: 30px;
}

.page-game-rules__faq-item {
    background-color: var(--background-color-custom); /* Slightly lighter background for each FAQ item */
    border: 1px solid var(--divider-color);
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    color: var(--text-main-color);
}

.page-game-rules__faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.1em;
    color: var(--text-main-color);
    transition: background-color 0.3s ease;
    list-style: none; /* For details/summary */
}

.page-game-rules__faq-item summary::-webkit-details-marker {
    display: none;
}

.page-game-rules__faq-item summary {
    list-style: none;
}

.page-game-rules__faq-question:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.page-game-rules__faq-qtext {
    flex-grow: 1;
    color: var(--text-main-color);
}

.page-game-rules__faq-toggle {
    font-size: 1.5em;
    line-height: 1;
    margin-left: 15px;
    color: var(--gold-color);
}

.page-game-rules__faq-answer {
    padding: 0 20px 20px 20px;
    font-size: 0.95em;
    color: var(--text-secondary-color);
    /* For JS-controlled div, use max-height transition */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.page-game-rules__faq-item.active .page-game-rules__faq-answer {
    max-height: 2000px; /* Sufficiently large to show content */
    transition: max-height 0.5s ease-in;
}

.page-game-rules__faq-item[open] .page-game-rules__faq-answer {
    max-height: fit-content;
}

.page-game-rules__faq-item[open] .page-game-rules__faq-toggle {
    content: "−";
}

.page-game-rules__cta-buttons--bottom {
    margin-top: 50px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .page-game-rules__main-title {
        font-size: 2.2em;
    }
    .page-game-rules__section-title {
        font-size: 2em;
    }
    .page-game-rules__sub-title {
        font-size: 1.6em;
    }
}

@media (max-width: 768px) {
    .page-game-rules {
        font-size: 16px;
        line-height: 1.6;
    }

    .page-game-rules__hero-section {
        padding-bottom: 40px;
    }

    .page-game-rules__hero-image-wrapper {
        max-height: 300px;
    }

    .page-game-rules__main-title {
        font-size: 1.8em;
    }

    .page-game-rules__description {
        font-size: 1em;
    }

    .page-game-rules__cta-buttons {
        flex-direction: column;
        gap: 15px;
        padding: 0 15px; /* Add padding to container for buttons */
    }
    
    .page-game-rules__btn-primary,
    .page-game-rules__btn-secondary {
        width: 100% !important; /* Force full width on mobile */
        max-width: 100% !important;
        padding: 12px 20px !important;
        font-size: 1em !important;
        box-sizing: border-box !important;
        white-space: normal !important;
        word-wrap: break-word !important;
    }

    .page-game-rules__section {
        padding: 40px 0;
    }

    .page-game-rules__container {
        padding: 0 15px;
    }

    .page-game-rules__section-title {
        font-size: 1.8em;
        margin-bottom: 30px;
    }

    .page-game-rules__sub-title {
        font-size: 1.4em;
    }

    .page-game-rules img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        display: block !important;
        min-width: 200px !important; /* Enforce min size on mobile */
        min-height: 200px !important; /* Enforce min size on mobile */
    }

    .page-game-rules__section,
    .page-game-rules__card,
    .page-game-rules__container,
    .page-game-rules__cta-buttons,
    .page-game-rules__button-group,
    .page-game-rules__btn-container {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding-left: 15px;
        padding-right: 15px;
        overflow: hidden !important; /* Prevent horizontal scroll */
    }

    .page-game-rules__hero-section {
        padding-top: 10px !important; /* body already handles --header-offset */
    }

    .page-game-rules__faq-question {
        font-size: 1em;
        padding: 15px;
    }
    .page-game-rules__faq-answer {
        padding: 0 15px 15px 15px;
    }
}