:root {
    --primary-color: #2a2a2a;
    --secondary-color: #3a3a3a;
    --accent-color: #ff8c00;
    --accent-hover: #ffa500;
    --text-color: #e0e0e0;
    --text-secondary: #b0b0b0;
    --dark-bg: #1a1a1a;
    --card-bg: #2a2a2a;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --hover-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    --border-radius: 8px;
    --header-height: 0px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--dark-bg);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background:
        linear-gradient(to right, black 0%, transparent 18%),
        linear-gradient(to left,  black 0%, transparent 18%),
        black url('images/ui/text_banner.png') center / min(100%, 1720px) auto no-repeat;
    border-bottom: 3px solid var(--accent-color);
    height: min(11vw, 189px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
}

/* Three-column page layout */
.page-layout {
    display: grid;
    grid-template-columns: 275px 1fr 275px;
    gap: 2rem;
    max-width: 1720px;
    margin: 0 auto;
    padding: 0 1.5rem;
    align-items: start;
}

/* Main Content */
main {
    padding: 3rem 0;
}

/* Sticky sidebars */
.sidebar-left,
.sidebar-right {
    position: sticky;
    top: calc(var(--header-height) + 1rem);
    max-height: calc(100vh - var(--header-height) - 2rem);
    overflow-y: auto;
    padding-top: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: #3a3a3a transparent;
}

/* Sidebar nav panel */
.sidebar-nav {
    background: var(--card-bg);
    border: 1px solid #3a3a3a;
    border-radius: var(--border-radius);
    padding: 1.25rem;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-color);
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #3a3a3a;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li + li {
    margin-top: 0.1rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.4rem 0.6rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: var(--accent-color);
    background-color: rgba(255, 140, 0, 0.08);
}

/* Donation panel */
.donation-panel {
    background: var(--card-bg);
    border: 1px solid #3a3a3a;
    border-radius: var(--border-radius);
    padding: 1.25rem;
}

.donation-panel-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.donation-panel-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.donation-panel-actions .btn {
    font-size: 0.875rem;
    padding: 0.6rem 1rem;
    flex: none;
    text-align: center;
}

/* Tiers inside the sidebar */
.sidebar-tiers {
    background-color: transparent;
    padding: 0;
    margin: 0.75rem 0 1rem;
}

.sidebar-tiers .donation-tier {
    font-size: 0.8rem;
}

section {
    margin-bottom: 4rem;
}

section h2 {
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--accent-color);
    display: inline-block;
}

.section-description {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    border: 1px solid #3a3a3a;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--hover-shadow);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #1a1a1a;
}

.card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.card-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    flex-grow: 1;
}

.download-count {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 0.25rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    flex: 1;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-secondary {
    background-color: #4a4a4a;
    color: white;
    border: 1px solid var(--accent-color);
}

.btn-secondary:hover {
    background-color: #5a5a5a;
}

.btn-kofi {
    background-color: #ff5e5b;
    color: white;
}

.btn-kofi:hover {
    background-color: #ff3e3b;
}

/* Help Card Specific Styles */
.helpcard-card .card-image {
    height: auto;
    cursor: pointer;
    object-fit: cover;
    display: block;
}

/* Table Card Specific Styles */
.table-thumbnail {
    cursor: pointer;
    transition: opacity 0.5s ease-in-out;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

.disclaimer {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    opacity: 0.7;
}

/* Modal for Image Preview */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 1001;
}

.modal-close:hover {
    color: var(--accent-color);
}

/* Gallery Modal Specific Styles */
.gallery-modal {
    /* Inherits .modal styles but needs to ensure proper stacking */
}

.gallery-modal .modal-content {
    position: relative;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.3s;
    z-index: 1001;
    user-select: none;
}

.gallery-nav:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.gallery-prev {
    left: 20px;
}

.gallery-next {
    right: 20px;
}

.gallery-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-size: 1rem;
    z-index: 1001;
}
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #ccc;
}

/* Responsive Design */
@media (max-width: 1100px) {
    .page-layout {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .sidebar-left,
    .sidebar-right {
        display: none;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    section h2 {
        font-size: 1.5rem;
    }

}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
    font-size: 1.1rem;
}

#wip-section {
    margin-bottom: 1.5rem;
}

#wip-section .grid {
    margin-top: 0.5rem;
}

#wip-section .empty-state {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    text-align: left;
}

/* WIP Card */
.wip-card {
    border: 2px solid #ff6b6b;
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(255, 107, 107, 0.05) 100%);
}

.wip-card .card-title {
    color: #ff8c00;
}

.donation-tiers {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.donation-tier {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #3a3a3a;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.donation-tier:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.donation-tier strong {
    color: #ff8c00;
}

/* WIP image height override */
.wip-card-image-container .card-image {
    height: auto;
}

/* WIP Section Full Width */
#wip-grid,
#featured-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
}

/* WIP Card Layout */
.wip-card {
    display: flex;
    flex-direction: column;
}

.wip-card-top {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.wip-card-image-container {
    flex: 0 0 50%;
    padding: 1.5rem;
}

.wip-card-image-container img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.wip-card-description-container {
    flex: 1;
    display: block;
    padding: 1.5rem 1.5rem 1.5rem 0;
}

.wip-card-description-container .card-info {
    flex-grow: 0;
    margin-bottom: 0.5rem;
}

.wip-description-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-top: 0.5rem;
}

.wip-card-description-container .donation-tiers {
    background-color: transparent;
    padding: 0;
    margin-top: 1rem;
}

.wip-card-description-container .card-actions {
    display: flex;
}

.wip-card-description-container .btn {
    flex: 1;
}

.table-credits {
    list-style: none;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #3a3a3a;
}

.table-credits li {
    position: relative;
    padding-left: 1rem;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    font-weight: 300;
    color: #909090;
    line-height: 1.5;
}

.table-credits li::before {
    content: "–";
    position: absolute;
    left: 0;
    color: #707070;
}

@media (max-width: 768px) {
    .wip-card {
        overflow: visible;
    }

    .wip-card-top {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin-bottom: 0;
    }

    .wip-card-image-container {
        flex: none;
        width: 100%;
        padding: 1.5rem 1.5rem 0 1.5rem;
    }

    .wip-card-image-container img {
        width: 100%;
        height: auto;
    }

    .wip-card-description-container {
        flex: none;
        width: 100%;
        display: block;
        padding: 1.5rem;
    }
}

/* Poll */
.poll-card {
    background: var(--card-bg);
    border: 1px solid #3a3a3a;
    border-radius: var(--border-radius);
    padding: 1.75rem 2rem;
    margin-top: 1.5rem;
}

.poll-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.35rem;
}

.poll-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.poll-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-size: 0.9rem;
    color: var(--text-color);
}

.poll-option:hover {
    background-color: rgba(255, 140, 0, 0.08);
}

.poll-option input[type="radio"] {
    accent-color: var(--accent-color);
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    cursor: pointer;
}

.poll-actions {
    margin-top: 1rem;
    padding-left: 0.75rem;
}

.poll-submit {
    flex: none;
    width: auto;
    padding: 0.6rem 1.75rem;
    font-size: 0.9rem;
}

.poll-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    opacity: 0.7;
}

/* Poll results */
.poll-results {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.poll-result {
    font-size: 0.875rem;
}

.poll-result-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

.poll-result-voted .poll-result-label {
    color: var(--text-color);
    font-weight: 600;
}

.poll-result-pct {
    color: var(--accent-color);
    font-weight: 600;
    flex-shrink: 0;
    margin-left: 1rem;
}

.poll-result-bar-bg {
    height: 8px;
    background-color: #3a3a3a;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.poll-result-bar {
    height: 100%;
    background-color: var(--accent-color);
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 0;
}

.poll-result-voted .poll-result-bar {
    background-color: var(--accent-hover);
}

.poll-result-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Poll Closed Announcement */
.poll-closed-card {
    background: var(--card-bg);
    border: 1px solid #3a3a3a;
    border-radius: var(--border-radius);
    padding: 1.75rem 2rem;
    margin-top: 1.5rem;
    overflow: hidden;
}

.poll-closed-top {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}

.poll-closed-image-wrap {
    flex: 0 0 45%;
}

.poll-closed-image-wrap img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.poll-closed-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.poll-closed-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.75rem;
}

.poll-closed-body {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    flex: 1;
}

.poll-pie-corner {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #3a3a3a;
}

#poll-pie-chart {
    flex-shrink: 0;
}

.poll-pie-legend {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.poll-pie-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.poll-pie-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.poll-pie-label {
    flex: 1;
}

.poll-pie-pct {
    font-weight: 600;
    color: var(--text-color);
    margin-left: 0.25rem;
}

@media (max-width: 900px) {
    .poll-closed-top {
        flex-direction: column;
    }

    .poll-closed-image-wrap {
        flex: none;
        width: 100%;
    }

    .poll-pie-corner {
        flex-direction: row;
        align-items: center;
    }
}
