/* -------------------------------------------------
   0️⃣  CSS VARIABLES
   ------------------------------------------------- */
:root {
    --bg-color-dark: #121212;
    --bg-color-light: #ffffff;
    --question-bg-dark: #2a2a2a;
    --question-bg-light: #f0f0f0;
    --answer-bg-dark: #1c1c1c;
    --answer-bg-light: #ffffff;
    --text-color-dark: #f5f5f5;
    --text-color-light: #000000;
    --accent-color: #bb86fc;
    --border-color-dark: #333;
    --border-color-light: #ccc;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
                    Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* -------------------------------------------------
   1️⃣  GLOBAL RESET
   ------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* -------------------------------------------------
   2️⃣  BASE STYLES
   ------------------------------------------------- */
html {
    scroll-behavior: smooth;
}
body {
    background-color: var(--bg-color-dark);
    color: var(--text-color-dark);
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.6;
    padding: 2rem;
    transition: background-color 0.3s, color 0.3s;
}
body.light-mode {
    background-color: var(--bg-color-light);
    color: var(--text-color-light);
}

/* Headings */
h1 {
    font-size: 2.2rem;
    line-height: 1.3;
}
h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* -------------------------------------------------
   3️⃣  TEXT & CODE
   ------------------------------------------------- */
.question,
.answer {
    font-size: 1rem;
    line-height: 1.7;
    text-align: justify;
    text-align-last: left;
}
.question p,
.answer p {
    margin-bottom: 1.2rem;
}
code,
.token {
    font-family: "SF Mono", "Menlo", "Consolas", "Courier New", monospace;
    background: rgba(255,255,255,0.08);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}
body.light-mode code {
    background: rgba(0,0,0,0.08);
}

/* -------------------------------------------------
   4️⃣  CONTAINER (used on the Q&A pages)
   ------------------------------------------------- */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
    background-color: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    text-align: center;
    position: relative;
}
body.light-mode .container {
    background-color: #ffffff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* -------------------------------------------------
   5️⃣  FIXED HEADER (sticky on top)
   ------------------------------------------------- */
.fixed-header {
    position: sticky;
    top: 0;
    background-color: #1a1a1a;
    padding: 1rem;
    border-radius: 12px;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
body.light-mode .fixed-header {
    background-color: #ffffff;
}

/* Theme toggle button (inside the fixed header) */
.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--accent-color);
    z-index: 10;
}
body.light-mode .theme-toggle {
    color: var(--text-color-light);
}

/* User info (inside header) */
.user-header {
    text-align: center;
    margin-bottom: 2rem;
}
.user-header h1 {
    margin-bottom: 1rem;
    color: var(--text-color-dark);
}
body.light-mode .user-header h1 {
    color: var(--text-color-light);
}
.user-info {
    margin-top: 0.5rem;
    font-size: 1rem;
    color: #aaa;
}
.user-info .editable {
    color: var(--text-color-dark);
    font-weight: 500;
}
body.light-mode .user-info .editable {
    color: var(--text-color-light);
}
.email-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}
.email-link:hover {
    text-decoration: underline;
}

/* -------------------------------------------------
   6️⃣  QUESTION / ANSWER BLOCKS
   ------------------------------------------------- */
.qa-pair {
    margin-bottom: 1.5rem;
}

/* Question */
.question {
    background: var(--question-bg-dark);
    padding: 1.5rem 1.75rem 1.5rem 3rem; /* left padding leaves room for icon */
    border-radius: 8px;
    border: 1px dashed #555;
    margin-bottom: 0.75rem;
    position: relative;
    font-style: italic;
    color: #ccc;
}
body.light-mode .question {
    background: var(--question-bg-light);
    border-color: var(--border-color-light);
    color: var(--text-color-light);
}
.question .icon {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    font-size: 1.4rem;
    color: #ccc;
}
body.light-mode .question .icon {
    color: var(--text-color-light);
}

/* Answer */
.answer {
    background: var(--answer-bg-dark);
    padding: 1.5rem 1.75rem 1.5rem 3rem;
    border-radius: 8px;
    border: 1px solid var(--border-color-dark);
    position: relative;
    font-style: normal;
    color: var(--text-color-dark);
}
body.light-mode .answer {
    background: var(--answer-bg-light);
    border-color: var(--border-color-light);
    color: var(--text-color-light);
}
.answer .icon {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    font-size: 1.4rem;
    color: var(--accent-color);
}

/* -------------------------------------------------
   7️⃣  DOWNLOAD BUTTONS (inside answers)
   ------------------------------------------------- */
.downloads {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    color: #fff;
}
.download-btn.pdf {
    background-color: #1e88e5ce;
}
.download-btn.json {
    background-color: #6200ea9d;
}
.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.download-btn i {
    font-size: 1.25rem;
}

/* -------------------------------------------------
   8️⃣  IMAGE ANSWER + MODAL (click‑to‑enlarge)
   ------------------------------------------------- */
.image-answer {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
    padding: 1rem;
    background: #433e3e;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.image-link {
    display: inline-block;
    text-decoration: none;
    transition: all 0.3s ease;
}
.image-link:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.responsive-image {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #ddd;
    cursor: pointer;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px;
}
.modal-content {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s;
}
.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    background: none;
    border: none;
}
.download-btn-modal {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background-color: #bb86fc;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
}
.download-btn-modal:hover {
    background-color: #a259f9;
}

/* -------------------------------------------------
   9️⃣  TASK BUTTONS (front‑page navigation)
   ------------------------------------------------- */
.task-buttons {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: var(--question-bg-dark);
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.212);
}

/* Light‑mode override for the container background */
body.light-mode .task-buttons,
body.light-mode .task-links {
    background: var(--question-bg-light);
}

/* Button grid – vertical layout */
.button-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;   /* full‑width buttons */
}

/* Individual button */
.task-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 0.5rem;
    background: #ffffff61;
    color: #fff;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}
.task-button i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.task-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    background: #a259f9;
}

/* Light‑mode button text colour (optional) */
body.light-mode .task-button {
    color: #212121;                /* dark text for readability */
    background: #ffffff61;   /* keep accent colour or change */
}

/* -------------------------------------------------
   10️⃣  SCROLL BUTTONS
   ------------------------------------------------- */

.scroll-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #f5f5f5b2;
    color: #070303;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 99;
    display: none;                /* shown by JS */
    align-items: center;
    justify-content: center;
}
.scroll-btn:hover {
    background-color: #af95ccc5;
    transform: translateY(-2px);
}
.scroll-btn i {
    display: flex;
}

/* Position the top‑button slightly above the bottom one */
.scroll-btn.top-btn {
    bottom: 80px;   /* space between the two buttons */
}

/* Reduce header height */
.fixed-header {
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

/* Hide name/email on scroll */
.hide-on-scroll .user-header p {
    display: none;
}

/* Footer Styles */
.site-footer {
    /* position: fixed; */
    bottom: 10px;
    width: 100%;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-color-dark);
}

body.light-mode .site-footer {
    color: var(--text-color-light);
}

/* Set current year dynamically */


/* -------------------------------------------------
   11️⃣  CLOSE BUTTON (inside Q&A pages)
   ------------------------------------------------- */
.close-button {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: #bb86fcc2;
    box-shadow: 0px 2px 2px rgba(0,0,0,0.5);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}
.close-button:hover {
    background-color: #a259f9;
    transform: scale(1.02);
}
.close-button:active {
    transform: scale(0.98);
}

/* -------------------------------------------------
   12️⃣  FOCUS OUTLINE (accessibility)
   ------------------------------------------------- */
button:focus,
a:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* -------------------------------------------------
   16️⃣  PLACEHOLDER STYLE FOR Unpublished Weeks
   ------------------------------------------------- */
.placeholder {
    margin-top: 3rem;
    text-align: center;
    padding: 2rem;
    background: var(--question-bg-dark);
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
body.light-mode .placeholder {
    background: var(--question-bg-light);
}
.placeholder-icon {
    font-size: 4rem;
    /* color: var(--accent-color); */
    text-shadow: #1a1a1a 1px;
    margin-bottom: 1rem;
}
.placeholder-text {
    font-size: 1.5rem;
    color: var(--text-color-dark);
    margin-top: 1rem;
}
body.light-mode .placeholder-text {
    color: var(--text-color-light);
}


/* -------------------------------------------------
   13️⃣  PRINT‑FRIENDLY STYLES
   ------------------------------------------------- */
@media print {
    body {
        background-color: #fff !important;
        color: #000 !important;
    }
    .theme-toggle,
    .close-button {
        display: none;
    }
    .container,
    .task-buttons,
    .task-links {
        box-shadow: none;
        background-color: #fff;
    }
    .question,
    .answer {
        border: 1px solid #000;
        background: #fff;
    }
    .icon {
        color: #000 !important;
    }
}

/* -------------------------------------------------
   14️⃣  MOBILE‑SPECIFIC ADJUSTMENTS
   ------------------------------------------------- */
@media (max-width: 768px) {
    .container,
    .task-buttons,
    .task-links {
        padding: 1rem;
        max-width: 95%;
    }

    h1 {
        font-size: 1.8rem;
    }

    .question,
    .answer {
        font-size: 0.95rem;
        line-height: 1.6;
        padding: 1.25rem 1.25rem 1.25rem 2.5rem;   /* reduced left padding */
    }

    .question .icon,
    .answer .icon {
        top: 0.8rem;
        left: 0.8rem;
        font-size: 1.3rem;
    }

    .downloads {
        flex-direction: column;
        gap: 0.75rem;
    }
    .download-btn {
        width: 100%;
        text-align: center;
    }

    .scroll-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
        bottom: 15px;
        right: 15px;
    }
    .scroll-btn.top-btn {
        bottom: 70px;
    }
}
