/* ============================================================
   GENERAL STYLING
============================================================ */

/* Ensure full page stretch */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-size: var(--user-font-size, 16px); /* Controlled by accessibility settings */
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background-color: #f9f9f9;
    line-height: 1.6;
    color: #333;
}
main {
    flex: 1; /* grows to fill available space */
}

/* ============================================================
   TEXT ELEMENTS (all scale with --user-font-size)
============================================================ */
body, p, h1, h2, h3, h4, h5, h6, li, label, a, .card h3 {
    font-size: var(--user-font-size);
}

/* Headings (can still scale relatively if needed) */
h1 { font-size: calc(var(--user-font-size) * 2); text-align: center; color: darkblue; margin-top: 20px; }
h2 { font-size: calc(var(--user-font-size) * 1.5); color: darkblue; margin-top: 30px; }
#ClearSub { font-size: calc(var(--user-font-size) * 1.7); text-align: center; color: darkblue; margin-top: 20px; }
.card h3 { font-size: calc(var(--user-font-size) * 1.1); margin: 0; }

/* Paragraphs and lists */
p, li {
    margin: 10px 0;
}

/* Explanation section */
#Explanation {
    max-width: 900px;
    margin: 20px auto;
    padding: 10px 20px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Content list styling */
#contentlist {
    margin-top: 10px;
    padding-left: 20px;
}

/* Card section styling */
#Cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Card styling */
.card {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    border: 2px solid #ccc;
    border-radius: 10px;
    aspect-ratio: 1 / 1;
    text-decoration: none;
    color: #333;
    font-family: Arial, sans-serif;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    text-align: center;
    padding: 20px;
}

/* Card hover effect */
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.2);
    border-color: #888;
}

/* Focus outline for accessibility */
.card:focus {
    outline: 3px solid darkblue;
    outline-offset: 4px;
}

/* Footer styling */
footer {
    background-color: #003366;
    color: #fff;
    text-align: center;
    padding: 15px 20px;
    margin-top: auto;
}

footer a {
    color: #ffcc00;
    text-decoration: none;
}

/* Header styling */
#site-header {
    background-color: #003366;
    padding: 15px 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

#site-header .home-link {
    color: #ffcc00;
    text-decoration: none;
    font-weight: bold;
    font-size: calc(var(--user-font-size) * 1.2);
    padding: 8px 15px;
    border: 2px solid #ffcc00;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

#site-header .home-link:hover {
    background-color: #ffcc00;
    color: #003366;
    transform: translateY(-2px);
}

/* Example styling */
.example {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #ccc;
    width: 300px;
}

.status-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin-bottom: 10px;
    border-radius: 4px;
    color: #000;
    font-weight: 600;
}

.correct .status-box {
    border: 1px solid #333;
}

.correct .status-box:first-child {
    background: #d4f8d4;
}

.correct .status-box.error {
    background: #ffe0e0;
}

.only-colour {
    height: 40px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.success-only {
    background: #00cc44;
}

.error-only {
    background: #ff3333;
}

/* ============================================================
   HIGH CONTRAST MODE — TOTAL OVERRIDE
============================================================ */
.high-contrast {
    background-color: #000 !important;
    color: #fff !important;
}

.high-contrast * {
    color: #fff !important;
    background-color: transparent !important;
    border-color: #fff !important;
}

.high-contrast header,
.high-contrast footer,
.high-contrast section,
.high-contrast nav,
.high-contrast main,
.high-contrast .card,
.high-contrast #Explanation,
.high-contrast #Cards {
    background-color: #000 !important;
}

.high-contrast a {
    color: #00aaff !important;
    text-decoration: underline !important;
}

.high-contrast button,
.high-contrast input[type="button"],
.high-contrast input[type="submit"] {
    background-color: #000 !important;
    color: #fff !important;
    border: 2px solid #00aaff !important;
}

.high-contrast hr {
    border-color: #fff !important;
}

.high-contrast .card {
    border: 2px solid #00aaff !important;
}

.high-contrast pre {
    background-color: #000 !important;
    color: #0ff !important;
    border: 1px solid #fff !important;
}

.high-contrast *:focus {
    outline: 3px solid #00aaff !important;
    outline-offset: 3px !important;
}

/* ============================================================
   DYSLEXIA FONT
============================================================ */
.dyslexia-font {
    font-family: Arial, Verdana, sans-serif;
    letter-spacing: 0.5px;
    word-spacing: 2px;
}

/* ============================================================
   REDUCE MOTION
============================================================ */
.reduce-motion * {
    animation: none !important;
    transition: none !important;
}

/* ============================================================
   TEXT SPACING
============================================================ */
.text-spacing {
    line-height: 1.8 !important;
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
}

/* ============================================================
   DARK MODE — readable text everywhere
============================================================ */
.dark-mode {
    background-color: #121212 !important;
    color: #e6e6e6 !important;
}

.dark-mode a {
    color: #4da3ff !important;
}

.dark-mode header,
.dark-mode footer,
.dark-mode section,
.dark-mode nav,
.dark-mode main,
.dark-mode .card,
.dark-mode #Explanation,
.dark-mode #Cards {
    background-color: #121212 !important;
    color: #e6e6e6 !important;
}

.dark-mode input,
.dark-mode textarea,
.dark-mode select,
.dark-mode button {
    background-color: #1c1c1c !important;
    color: #ffffff !important;
    border: 1px solid #4da3ff !important;
}

.dark-mode input[type="checkbox"] + label,
.dark-mode label[for] {
    color: #ffffff !important;
}

.dark-mode pre {
    background-color: #1c1c1c !important;
    color: #0ff !important;
    border: 1px solid #fff !important;
}

.dark-mode *:focus {
    outline: 3px solid #ffcc00 !important;
    outline-offset: 3px !important;
}

/* ============================================================
   GRAYSCALE
============================================================ */
.grayscale {
    filter: grayscale(100%);
}

/* ============================================================
   INVERT MODE — Minimal fix for checkbox labels
============================================================ */
.invert {
    filter: invert(100%) hue-rotate(180deg) !important;
    background-color: #000;
}

.invert header,
.invert footer,
.invert section,
.invert nav,
.invert main,
.invert .card,
.invert #Explanation,
.invert #Cards {
    background-color: #000 !important;
}

.invert input[type="checkbox"] + label,
.invert label[for] {
    color: #ffffff !important;
}

/* ============================================================
   FOCUS OUTLINE
============================================================ */
.focus-outline *:focus {
    outline: 3px solid #ffcc00 !important;
    outline-offset: 4px;
}
