body {
    background-color: #000;
    color: #00ff00;
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    text-align: center;
    transition: background-color 0.3s, color 0.3s;
}

/* Ensure homepage layout is preserved – do not apply policy/contact overrides */
body:not(.policy-page):not(.contact-page) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* Policy & Contact page overrides – only apply when .policy-page or .contact-page class is present */
body.policy-page,
body.contact-page {
    display: block !important;
    height: auto !important;
    min-height: 100vh;
    align-items: initial !important;
    justify-content: initial !important;
    padding-top: 60px;
    text-align: left;
}

/* Terminal container – ensure centering on homepage only */
#terminal-container {
    font-size: 32px;
    line-height: 1.6;
    display: inline-block;
    position: fixed;
    background-color: black;
    padding: 20px;
    border-radius: 8px;
    max-width: 800px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
}

#terminal, #terminal * {
    color: inherit !important;
}

.theme3 #terminal, .theme3 #terminal * {
    color: white !important;
}

#terminal a {
    color: inherit;
    text-decoration: none;
}

#terminal a:hover {
    text-decoration: underline;
}

#cursor {
    display: inline-block;
    width: 12px;
    height: 0.9em;
    background-color: #00ff00;
    animation: blink 1s step-end infinite;
    margin-left: 2px;
    vertical-align: middle;
}

.theme2 #cursor, .theme3 #cursor {
    background-color: white !important;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.theme2 footer, .theme3 footer {
    color: white!important;
}

footer {
    position: fixed;
    bottom: 20px;
    font-size: 14px;
    background-color: black;
    padding: 20px;
    border-radius: 8px;
    max-width: 800px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s;
    color: inherit;
}

footer a {
    color: inherit;
    text-decoration: none;
    margin: 0 12px;
}

footer a:hover {
    text-decoration: underline;
}

.background-article {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    color: inherit;
    padding: 3% 10%;
    font-size: 1.2rem;
    line-height: 1.6;
    z-index: -1;
}

.theme1 { background-color: black; color: green; }
.theme2 { background-color: black; color: white; }
.theme3 { background-color: white; color: black; }

#accessibility-slider {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    padding: 12px;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    font-size: 14px;
    width: 180px;
    text-align: center;
    backdrop-filter: blur(4px);
}

#theme-previews, .theme-previews {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
    justify-content: center;
}

.theme-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: transform 0.2s, border-color 0.2s;
}

.theme-preview:hover { transform: scale(1.1); border-color: #aaa; }
.theme-preview:focus { outline: 2px solid #fff; border-color: #fff; }

.theme-preview[data-value="1"] { background-color: black; color: green; }
.theme-preview[data-value="2"] { background-color: black; color: white; }
.theme-preview[data-value="3"] { background-color: white; color: black; border-color: #333; }

/* Burger menu – unified for desktop & mobile */
#burger-button {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1002;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: inherit;
    width: 40px;
    height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bar {
    display: block;
    width: 30px;
    height: 3px;
    background-color: currentColor;
    transition: 0.4s;
}

/* Perfectly centred X */
#burger-button.change .bar:nth-child(1) {
    transform: rotate(45deg);
    transform-origin: top left;
    width: 38px;
}

#burger-button.change .bar:nth-child(2) {
    opacity: 0;
}

#burger-button.change .bar:nth-child(3) {
    transform: rotate(-45deg);
    transform-origin: bottom left;
    width: 38px;
}

#side-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 240px;
    height: 100%;
    background-color: inherit;
    transition: right 0.3s ease;
    z-index: 1001;
    padding: 40px 20px 20px 20px;
    box-shadow: inset 8px 0 10px -8px rgba(0,0,0,0.6);
    overflow-y: auto;
    overflow-x: hidden;
    text-align: center;
}

#side-menu.open { right: 0; }

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    z-index: 1000;
}

#overlay.active { display: block; }

/* Menu links – centered, theme colours, proper spacing */
#side-menu a {
    color: inherit !important;
    text-decoration: none;
    display: block;
    margin: 20px auto;
    font-size: 16px;
    line-height: 1.8;
    width: fit-content;
}

#side-menu a:hover {
    text-decoration: underline;
}

/* Accessibility label – centered */
#menu-accessibility p {
    margin: 0 0 15px 0;
    font-weight: bold;
    color: inherit;
    text-align: center;
}

/* Centered theme previews in menu */
.theme-previews {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    justify-content: center;
    margin: 15px auto;
    width: fit-content;
}

/* Toggle switch for terminal effect */
.toggle-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    color: inherit;
    margin: 15px 0;
}

.toggle-switch input {
    appearance: none;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    position: relative;
    transition: background-color 0.3s;
}

.toggle-switch input:checked {
    background-color: #00ff00;
}

.toggle-switch input:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: white;
    top: 1px;
    left: 1px;
    transition: left 0.3s;
}

.toggle-switch input:checked:before {
    left: 21px;
}

.theme2 .toggle-switch input:checked {
    background-color: white;
}

.theme3 .toggle-switch input:checked {
    background-color: black;
}

.theme3 .toggle-switch input:before {
    background-color: black;
}

.theme3 .toggle-switch input:checked:before {
    background-color: white;
}

/* Progressive enhancement: hide accessibility options when JS is present (they are JS-only now) */
.js #menu-accessibility {
    display: block;
}

/* No-JS: hide accessibility options and terminal */
.no-js #menu-accessibility,
.no-js #terminal-container {
    display: none;
}

/* No-JS: show menu open, hide burger */
.no-js #side-menu { right: 0; }
.no-js #burger-button { display: none; }

/* Floating Get In Touch button */
#contact-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: inherit;
    color: inherit;
    border: 2px solid currentColor;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    text-decoration: none;
    z-index: 1002;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

#contact-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6);
}

.theme3 #contact-button {
    border-color: black;
}

@media (max-width: 768px) {
    #contact-button {
        bottom: 80px;
        padding: 10px 16px;
        font-size: 15px;
    }
}

/* Cookie banner */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    color: inherit;
    padding: 15px 20px;
    box-sizing: border-box;
    z-index: 1003;
    font-size: 14px;
    text-align: center;
    backdrop-filter: blur(4px);
    display: none;
}

#cookie-banner.show {
    display: block;
}

#cookie-banner p {
    margin: 0;
    display: inline-block;
    max-width: 80%;
}

#cookie-banner a {
    color: inherit;
    text-decoration: underline;
}

#cookie-banner button {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #00ff00;
    color: black;
    border: none;
    padding: 8px 20px;
    cursor: pointer;
    font-weight: bold;
    border-radius: 4px;
}

.theme2 #cookie-banner button, .theme3 #cookie-banner button {
    background-color: white;
    color: black;
}

.theme3 #cookie-banner {
    background-color: rgba(255, 255, 255, 0.9);
    color: black;
}

@media (max-width: 768px) {
    #cookie-banner p {
        display: block;
        max-width: 100%;
        margin-bottom: 10px;
    }
    #cookie-banner button {
        position: static;
        transform: none;
        display: block;
        width: 100%;
        margin-top: 10px;
    }
}

/* Policy & Contact content styling */
.policy-content,
.contact-content {
    max-width: 900px;
    margin: 0 auto 120px auto;
    padding: 0 20px;
    line-height: 1.6;
    width: 100%;
    box-sizing: border-box;
}

.policy-content h1,
.contact-content h1 {
    text-align: center;
    font-size: 2.5em;
    margin: 40px 0 20px 0;
}

.policy-content .last-updated,
.contact-content p {
    text-align: center;
    font-style: italic;
    margin-bottom: 40px;
}

.policy-content h2,
.contact-content h2 {
    margin-top: 40px;
    margin-bottom: 15px;
    border-bottom: 1px solid currentColor;
    padding-bottom: 10px;
}

.policy-content h3,
.contact-content h3 {
    margin-top: 30px;
    margin-bottom: 10px;
}

.policy-content p, .policy-content ul, .policy-content ol,
.contact-content p, .contact-content ul {
    margin-bottom: 20px;
}

.policy-content ul, .policy-content ol {
    padding-left: 20px;
}

/* Contact form styling */
#contact-form {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 10px;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 1px solid currentColor;
    background-color: inherit;
    color: inherit;
    font-family: inherit;
    font-size: 16px;
    border-radius: 4px;
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

#contact-form button {
    align-self: center;
    background-color: #00ff00;
    color: black;
    border: none;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#contact-form button:hover {
    background-color: #00cc00;
}

.theme2 #contact-form button {
    background-color: white;
    color: #000 !important;
}

.theme2 #contact-form button:hover {
    background-color: #f0f0f0;
}

.theme3 #contact-form button {
    background-color: black;
    color: white !important;
}

.theme3 #contact-form button:hover {
    background-color: #333;
}

#form-feedback {
    margin-top: 20px;
    font-weight: bold;
    text-align: center;
}

/* Mobile-specific contact form improvements */
@media (max-width: 768px) {
    .contact-content {
        padding: 0 20px;
    }

    #contact-form {
        gap: 40px;
    }

    #contact-form input,
    #contact-form select,
    #contact-form textarea {
        font-size: 18px;
        padding: 16px;
    }

    #contact-form button {
        width: 100%;
        padding: 16px;
        font-size: 20px;
    }
}

/* Terminal-style feedback – centred like homepage terminal */
#terminal-feedback {
    font-size: 32px;
    line-height: 1.6;
    display: inline-block;
    position: fixed;
    background-color: black;
    padding: 20px;
    border-radius: 8px;
    max-width: 800px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
}

/* Ensure feedback text is visible in high-contrast theme */
.theme3 #terminal-feedback #feedback-text {
    color: white !important;
}

#feedback-cursor {
    display: inline-block;
    width: 12px;
    height: 0.9em;
    background-color: #00ff00;
    animation: blink 1s step-end infinite;
    margin-left: 2px;
    vertical-align: middle;
}

.theme2 #feedback-cursor, .theme3 #feedback-cursor {
    background-color: white !important;
}

/* Ensure fixed elements stay fixed on policy & contact pages */
.policy-page #contact-button,
.contact-page #contact-button,
.policy-page #cookie-banner,
.contact-page #cookie-banner,
.policy-page #burger-button,
.contact-page #burger-button {
    position: fixed;
}

/* No-JS fallback: 240px menu on right, content shifted left */
.no-js #side-menu {
    position: absolute;
    top: 0;
    right: 0;
    width: 240px !important;
    height: 100vh;
    background-color: inherit;
    box-shadow: none;
    padding: 20px;
    overflow-y: auto;
    transition: none;
}

.no-js #overlay {
    display: none !important;
}

.no-js #burger-button {
    display: none !important;
}

/* No-JS: add right padding to background-article to clear the menu */
.no-js .background-article {
    padding-right: 300px !important;
    box-sizing: border-box;
}

.no-js #terminal-container {
    display: none !important;
}

/* Ensure theme preview circles are perfect circles in menu */
#side-menu .theme-preview {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Force readable Aa text in previews – independent of theme */
#side-menu .theme-preview span {
    color: inherit !important;
}

/* Specific preview colours – Aa text always readable */
#side-menu .theme-preview[data-value="1"] { background-color: black; color: green !important; }
#side-menu .theme-preview[data-value="2"] { background-color: black; color: white !important; }
#side-menu .theme-preview[data-value="3"] { background-color: white; color: black !important; border-color: #333; }

/* Inverted terminal colors for theme1 and theme2 */
.theme1 #terminal-container,
.theme1 #terminal-feedback {
    background-color: green;
    color: black !important;
}

.theme1 #terminal, .theme1 #terminal * {
    color: black !important;
}

.theme1 #cursor, .theme1 #feedback-cursor {
    background-color: black !important;
}

.theme2 #terminal-container,
.theme2 #terminal-feedback {
    background-color: white;
    color: black !important;
}

.theme2 #terminal, .theme2 #terminal * {
    color: black !important;
}

.theme2 #cursor, .theme2 #feedback-cursor {
    background-color: black !important;
}
