/***************************************
 * ACCESSIBILITY FRAMEWORK STYLES *
 ***************************************/

/* Dyslexic mode for Accessibility */
@font-face {
    font-family: "Lexend";
    src: url("../webfonts/Lexend/Lexend-VariableFont_wght.ttf")
        format("truetype");
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: "Lexend";
    src: url("../webfonts/Lexend/static/Lexend-Regular.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Lexend";
    src: url("../webfonts/Lexend/static/Lexend-Medium.ttf") format("truetype");
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: "Lexend";
    src: url("../webfonts/Lexend/static/Lexend-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: "Lexend";
    src: url("../webfonts/Lexend/static/Lexend-Bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}

/* CSS Variables for Accessibility */
:root {
    /* Base colors */
    --primary-color: #22c55e;
    --secondary-color: #16a34a;
    --accent-color: #059669;
    --text-color: #1f2937;
    --bg-color: #ffffff;
    --light-bg: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-color: rgba(0, 0, 0, 0.1);

    /* Adjustable text sizes */
    --text-base: 16px;
    --text-scale: 1;

    /* Default font */
    --font-family: "Inter", sans-serif;
}

/* Dark mode */
[data-theme="dark"] {
    --text-color: #f9fafb;
    --bg-color: #111827;
    --light-bg: #1f2937;
    --border-color: #374151;
    --shadow-color: rgba(0, 0, 0, 0.3);

    /* Variables CO-WATERS pour le mode sombre */
    --main-txt-color: #f9fafb;
    --marine: #7fb7d9;
    --lapis-lazuli: #5a9bd4;
    --cornflower: #6ba9e6;
    --blizzard: #2a5a7a;
    --salmon: #ff8674;
    --almond: #3a4a5a;
    --payne-gray: #a4aab8;
    --moonwalk: #4d5156;
    --antiflash-white: #2a3642;
    --main-title-color: #f9fafb;
}

/* High contrast mode */
[data-contrast="high"] {
    --primary-color: #000000;
    --secondary-color: #000000;
    --text-color: #000000;
    --bg-color: #ffffff;
    --light-bg: #ffffff;
    --border-color: #000000;

    /* Variables CO-WATERS pour le mode haut contraste */
    --main-txt-color: #000000;
    --marine: #000000;
    --lapis-lazuli: #000000;
    --cornflower: #000000;
    --blizzard: #ffffff;
    --salmon: #000000;
    --almond: #ffffff;
    --payne-gray: #000000;
    --moonwalk: #ffffff;
    --antiflash-white: #ffffff;
    --main-title-color: #000000;
}

[data-contrast="high"][data-theme="dark"] {
    --text-color: #ffffff;
    --bg-color: #000000;
    --light-bg: #000000;
    --border-color: #ffffff;

    /* Variables CO-WATERS pour haut contraste + mode sombre */
    --main-txt-color: #ffffff;
    --marine: #ffffff;
    --lapis-lazuli: #ffffff;
    --cornflower: #ffffff;
    --blizzard: #000000;
    --salmon: #ffffff;
    --almond: #000000;
    --payne-gray: #ffffff;
    --moonwalk: #000000;
    --antiflash-white: #000000;
    --main-title-color: #ffffff;
}

/* Dyslexic mode for accessibility */
[data-font="dyslexic"] {
    --font-family: "Lexend", sans-serif;
}

/* Application de la police aux éléments du site */
[data-font="dyslexic"] body,
[data-font="dyslexic"] h1,
[data-font="dyslexic"] h2,
[data-font="dyslexic"] h3,
[data-font="dyslexic"] h4,
[data-font="dyslexic"] h5,
[data-font="dyslexic"] h6,
[data-font="dyslexic"] p,
[data-font="dyslexic"] li,
[data-font="dyslexic"] a,
[data-font="dyslexic"] span,
[data-font="dyslexic"] div,
[data-font="dyslexic"] .navbar-link,
[data-font="dyslexic"] .navbar-item {
    font-family: Lexend, sans-serif !important;
}

/* Accessibility base styles */
body {
    font-family: var(--font-family);
    font-size: calc(var(--text-base) * var(--text-scale));
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s linear, color 0.3s linear;
}

/* Application de la taille de texte ajustable aux éléments du site */
/* Préserve les tailles relatives des éléments */
h1 {
    font-size: calc(clamp(2.5rem, 4.5vw, 5rem) * var(--text-scale));
    line-height: calc(80px * var(--text-scale));
}

h2 {
    font-size: calc(clamp(1.6rem, 5vw, 3rem) * var(--text-scale));
}

h3 {
    font-size: calc(clamp(20px, 2vw, 26px) * var(--text-scale));
}

h4 {
    font-size: calc(1.5rem * var(--text-scale));
}

h5 {
    font-size: calc(1rem * var(--text-scale));
}

h6 {
    font-size: calc(1.1rem * var(--text-scale));
}

p,
main li {
    font-size: calc(1.1rem * var(--text-scale));
}

footer .columns p,
footer .columns li {
    font-size: calc(1rem * var(--text-scale));
}

@media screen and (max-width: 969px) {
    h1 {
        line-height: calc(70px * var(--text-scale));
    }
}

a {
    font-size: inherit; /* Hérite de la taille de son parent */
}

.navbar-item,
.navbar-link {
    font-size: calc(1rem * var(--text-scale));
}

/* Transitions pour les éléments du site */
[data-theme="dark"] *,
[data-contrast="high"] * {
    transition: color 0.3s linear, background-color 0.3s linear,
        border-color 0.3s linear;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Accessibility button */
.accessibility-button {
    position: fixed;
    bottom: 0px;
    left: 0px;
    width: 60px;
    height: 60px;
    backdrop-filter: invert(1);
    border: none;
    background: black;
    cursor: pointer;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all 0.3s linear;
    transform: translateX(0);
    user-select: none;
    border-top: 3px solid rgb(0, 0, 0);
    border-right: 3px solid rgb(0, 0, 0);
}

[data-theme="dark"] .accessibility-button {
    border-top: 3px solid #22c55e;
    border-right: 3px solid #22c55e;
}

/* Container for accessibility icon */
.accessibility-icon-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Accessibility icon */
.accessibility-icon {
    transition: all 0.3s ease;
}

/* Visual indicator for active settings */
.accessibility-indicator {
    position: absolute;
    top: -6px;
    right: -7px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border: 2px solid white;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
    z-index: 1;
}

/* Active state for indicator */
.accessibility-indicator.active {
    opacity: 1;
    transform: scale(1);
}

@keyframes pulse-indicator {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Move accessibility button when modal is open */
.accessibility-modal.active ~ .accessibility-button,
.accessibility-modal.active + .accessibility-button {
    transform: translateX(300px);
}

/* @media (max-width: 768px) {
    .accessibility-modal.active ~ .accessibility-button,
    .accessibility-modal.active + .accessibility-button {
        transform: translateX(95vw);
    }
} */

.accessibility-button img {
    color: white;
}

.accessibility-button:hover {
    background: var(--secondary-color);
}

/* Accessibility modal */
.accessibility-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    pointer-events: none;
}

.accessibility-modal.active {
    pointer-events: auto;
}

.modal-content {
    position: fixed;
    bottom: 0;
    left: 0;
    margin: 0;
    width: 300px;
    background: #f7f7f7;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    transform: translateX(-100%);
    transition: transform 0.3s linear;
    overflow-y: auto;
    z-index: 2001;
    border: 2px solid var(--primary-color);
}

[data-theme="dark"] .modal-content {
    background: #1f2937;
    border-color: var(--primary-color);
}

.accessibility-modal.active .modal-content {
    transform: translateX(0);
}

/* Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(207, 207, 207, 0.4);
    opacity: 0;
    transition: opacity 0.3s linear;
    pointer-events: none;
}

.accessibility-modal.active .modal-overlay {
    opacity: 1;
    pointer-events: auto;
    backdrop-filter: blur(1px);
}

.modal-header {
    position: relative;
    padding-right: 2rem;
    margin-bottom: 1.5rem;
}

.close-button {
    position: absolute;
    top: -15px;
    right: -15px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-color);
    line-height: 1;
    padding: 0.5rem;
    border-radius: 4px;
    transition: transform 0.1s linear;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-button:hover {
    transform: scale(1.2);
}

.accessibility-controls {
    display: flex;
    flex-direction: column;
}

.control-group {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
}

/* Accessibility control styles */
/* Switch styles */
.switch-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0rem 0 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.switch-label {
    font-weight: 500;
    font-size: 1rem;
    margin-right: 1rem;
    color: var(--text-color);
}

/* The switch - the box around the slider */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

/* Hide default checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Rounded style */
.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Dark mode styles */
[data-theme="dark"] .slider {
    background-color: #666;
}

[data-theme="dark"] input:checked + .slider {
    background-color: var(--primary-color);
}

/* Note: Styles for high contrast + dark mode have been removed 
   as these modes are now mutually exclusive */

.control-group label {
    font-weight: 600;
    font-size: calc(1.1rem * var(--text-scale));
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.control-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.control-button {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--bg-color);
    color: var(--control-text-color, var(--text-color));
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s linear;
}

.control-button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.size-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-color);
}

.size-button {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    background: var(--bg-color);
    color: var(--control-text-color, var(--text-color));
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

/* Reset button */
.reset-section {
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.reset-button {
    padding: 0.75rem 1.5rem;
    background: #f87171;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s linear;
}

.reset-button:hover {
    background: #ef4444;
    transform: translateY(-2px);
}

/* Accessibility title */
#accessibility-title {
    font-size: 20px;
}

/* Dark mode image inversion for approach-container */
[data-theme="dark"] .approach-container img {
    filter: invert(1);
}
