/*
 * KNMA Accessibility — Styles
 * WCAG 2.0 compliant accessibility toolbar & modes
 */

/* ==========================================================================
   SKIP LINK
   ========================================================================== */

.knma-acc-skip {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100001;
    background: #005fcc;
    color: #fff;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 6px 6px;
    transition: top 0.2s;
}

.knma-acc-skip:focus {
    top: 0;
    outline: 3px solid #ff0;
}

/* ==========================================================================
   TOGGLE BUTTON (always visible, fixed on right side)
   ========================================================================== */

.knma-acc-toggle {
    position: fixed;
    top: 25%;
    right: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: #2E3F7F;
    color: #fff;
    border: none;
    padding: 10px 6px;
    width: 36px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    border-radius: 6px 0 0 6px;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.25);
    transition: background 0.2s, width 0.2s;
}

.knma-acc-toggle:hover,
.knma-acc-toggle:focus-visible {
    background: #1a2a5c;
}

.knma-acc-toggle:focus-visible {
    outline: 3px solid #ff0;
    outline-offset: 2px;
}

.knma-acc-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    rotate: 90deg;
}

.knma-acc-toggle-text {
    font-size: 14px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    margin-top: 6px;
    line-height: 1;
}

/* ==========================================================================
   PANEL
   ========================================================================== */

.knma-acc-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #1a1a2e;
    color: #f0f0f0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    overflow-x: auto;
}

.knma-acc-panel[hidden] {
    display: none;
}

.knma-acc-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    min-height: 40px;
}

.knma-acc-panel-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.knma-acc-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #f0f0f0;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    transition: background 0.15s;
    flex-shrink: 0;
}

.knma-acc-close:hover,
.knma-acc-close:focus-visible {
    background: rgba(255,255,255,0.2);
}

.knma-acc-close:focus-visible {
    outline: 3px solid #ff0;
    outline-offset: 1px;
}

/* Panel body — horizontal layout */
.knma-acc-panel-body {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 12px 20px 14px;
    flex-wrap: wrap;
}

/* Group */
.knma-acc-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.knma-acc-group-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aab;
}

/* Buttons row */
.knma-acc-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.knma-acc-buttons button {
    background: rgba(255,255,255,0.1);
    color: #f0f0f0;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 5px 10px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    min-height: 32px;
}

.knma-acc-buttons button:hover {
    background: rgba(255,255,255,0.2);
}

.knma-acc-buttons button:focus-visible {
    outline: 3px solid #ff0;
    outline-offset: 1px;
}

.knma-acc-buttons button.active {
    background: #005fcc;
    border-color: #005fcc;
    color: #fff;
}

/* Contrast preview buttons */
.knma-acc-contrast-normal {
    background: #f0f0f0 !important;
    color: #1a1a1a !important;
    border-color: #999 !important;
}

.knma-acc-contrast-wb {
    background: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

.knma-acc-contrast-bw {
    background: #fff !important;
    color: #000 !important;
    border-color: #000 !important;
}

.knma-acc-contrast-bb {
    background: #D0E8F8 !important;
    color: #063462 !important;
    border-color: #063462 !important;
}

.knma-acc-contrast-btn.active {
    outline: 3px solid #ff0;
    outline-offset: 2px;
}

/* Reset button */
.knma-acc-group--reset {
    margin-left: auto;
    justify-content: flex-end;
}

.knma-acc-reset-btn {
    background: rgba(255,70,70,0.2) !important;
    border-color: rgba(255,70,70,0.4) !important;
    color: #ff9090 !important;
    padding: 5px 14px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 32px;
}

.knma-acc-reset-btn:hover {
    background: rgba(255,70,70,0.35) !important;
}

.knma-acc-reset-btn:focus-visible {
    outline: 3px solid #ff0;
    outline-offset: 1px;
}

/* ==========================================================================
   FONT SIZE SCALING
   Uses CSS zoom on body so that fixed-px sizes also scale.
   The toolbar is excluded via counter-zoom so it stays at normal size.
   ========================================================================== */

html.knma-acc-active body {
    zoom: var(--knma-acc-font-scale, 1);
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

html.knma-acc-active .knma-acc-toolbar {
    zoom: calc(1 / var(--knma-acc-font-scale, 1));
}

/* ==========================================================================
   LETTER SPACING
   ========================================================================== */

html.knma-acc-letterspacing-1 body {
    letter-spacing: 1px;
}

html.knma-acc-letterspacing-2 body {
    letter-spacing: 2px;
}

html.knma-acc-letterspacing-3 body {
    letter-spacing: 3.5px;
}

/* ==========================================================================
   LINE HEIGHT
   ========================================================================== */

html.knma-acc-lineheight-1 body {
    line-height: 1.8 !important;
}

html.knma-acc-lineheight-1 body * {
    line-height: inherit !important;
}

html.knma-acc-lineheight-2 body {
    line-height: 2.2 !important;
}

html.knma-acc-lineheight-2 body * {
    line-height: inherit !important;
}

/* ==========================================================================
   HIDE IMAGES
   ========================================================================== */

html.knma-acc-no-images img,
html.knma-acc-no-images svg,
html.knma-acc-no-images video,
html.knma-acc-no-images picture,
html.knma-acc-no-images [style*="background-image"],
html.knma-acc-no-images .swiper-slide {
    visibility: hidden !important;
}

/* Keep accessibility toolbar images visible */
html.knma-acc-no-images .knma-acc-toolbar img,
html.knma-acc-no-images .knma-acc-toolbar svg {
    visibility: visible !important;
}

/* ==========================================================================
   CONTRAST: WHITE ON BLACK
   ========================================================================== */

html.knma-acc-contrast-white-on-black,
html.knma-acc-contrast-white-on-black body {
    background-color: #000 !important;
    color: #fff !important;
}

html.knma-acc-contrast-white-on-black *:not(.knma-acc-toolbar):not(.knma-acc-toolbar *) {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #555 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

html.knma-acc-contrast-white-on-black a:not(.knma-acc-toolbar a) {
    color: #6cf !important;
    text-decoration: underline !important;
}

html.knma-acc-contrast-white-on-black a:hover:not(.knma-acc-toolbar a),
html.knma-acc-contrast-white-on-black a:focus:not(.knma-acc-toolbar a) {
    color: #9df !important;
}

html.knma-acc-contrast-white-on-black input:not(.knma-acc-toolbar input),
html.knma-acc-contrast-white-on-black textarea:not(.knma-acc-toolbar textarea),
html.knma-acc-contrast-white-on-black select:not(.knma-acc-toolbar select) {
    background-color: #222 !important;
    color: #fff !important;
    border: 1px solid #888 !important;
}

html.knma-acc-contrast-white-on-black button:not(.knma-acc-toolbar button) {
    background-color: #333 !important;
    color: #fff !important;
    border: 1px solid #888 !important;
}

/* ==========================================================================
   CONTRAST: BLACK ON WHITE
   ========================================================================== */

html.knma-acc-contrast-black-on-white,
html.knma-acc-contrast-black-on-white body {
    background-color: #fff !important;
    color: #000 !important;
}

html.knma-acc-contrast-black-on-white *:not(.knma-acc-toolbar):not(.knma-acc-toolbar *) {
    background-color: #fff !important;
    color: #000 !important;
    border-color: #999 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

html.knma-acc-contrast-black-on-white a:not(.knma-acc-toolbar a) {
    color: #00c !important;
    text-decoration: underline !important;
}

html.knma-acc-contrast-black-on-white a:hover:not(.knma-acc-toolbar a),
html.knma-acc-contrast-black-on-white a:focus:not(.knma-acc-toolbar a) {
    color: #009 !important;
}

html.knma-acc-contrast-black-on-white input:not(.knma-acc-toolbar input),
html.knma-acc-contrast-black-on-white textarea:not(.knma-acc-toolbar textarea),
html.knma-acc-contrast-black-on-white select:not(.knma-acc-toolbar select) {
    background-color: #fff !important;
    color: #000 !important;
    border: 1px solid #666 !important;
}

html.knma-acc-contrast-black-on-white button:not(.knma-acc-toolbar button) {
    background-color: #eee !important;
    color: #000 !important;
    border: 1px solid #666 !important;
}

/* ==========================================================================
   CONTRAST: BLUE ON LIGHT BLUE
   ========================================================================== */

html.knma-acc-contrast-blue-on-lightblue,
html.knma-acc-contrast-blue-on-lightblue body {
    background-color: #D0E8F8 !important;
    color: #063462 !important;
}

html.knma-acc-contrast-blue-on-lightblue *:not(.knma-acc-toolbar):not(.knma-acc-toolbar *) {
    background-color: #D0E8F8 !important;
    color: #063462 !important;
    border-color: #7BA7CC !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

html.knma-acc-contrast-blue-on-lightblue a:not(.knma-acc-toolbar a) {
    color: #0a4d8c !important;
    text-decoration: underline !important;
}

html.knma-acc-contrast-blue-on-lightblue a:hover:not(.knma-acc-toolbar a),
html.knma-acc-contrast-blue-on-lightblue a:focus:not(.knma-acc-toolbar a) {
    color: #083a66 !important;
}

html.knma-acc-contrast-blue-on-lightblue input:not(.knma-acc-toolbar input),
html.knma-acc-contrast-blue-on-lightblue textarea:not(.knma-acc-toolbar textarea),
html.knma-acc-contrast-blue-on-lightblue select:not(.knma-acc-toolbar select) {
    background-color: #E4F0FA !important;
    color: #063462 !important;
    border: 1px solid #7BA7CC !important;
}

html.knma-acc-contrast-blue-on-lightblue button:not(.knma-acc-toolbar button) {
    background-color: #B8D8F0 !important;
    color: #063462 !important;
    border: 1px solid #7BA7CC !important;
}

/* ==========================================================================
   FOCUS VISIBLE (enhanced for keyboard users)
   ========================================================================== */

html.knma-acc-active *:focus-visible {
    outline: 3px solid #005fcc !important;
    outline-offset: 2px !important;
}

html.knma-acc-contrast-white-on-black *:focus-visible {
    outline-color: #ff0 !important;
}

html.knma-acc-contrast-blue-on-lightblue *:focus-visible {
    outline-color: #063462 !important;
}

/* ==========================================================================
   TOOLBAR: keep its own styles when panel is open and page is pushed down
   ========================================================================== */

.knma-acc-panel ~ .knma-acc-toggle {
    /* When panel is open, hide the side toggle */
}

body.knma-acc-panel-open {
    padding-top: var(--knma-acc-panel-height, 0px);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media only screen and (max-width: 991px) {
    .knma-acc-panel-body {
        gap: 16px;
        padding: 12px 16px;
    }

    .knma-acc-group--reset {
        margin-left: 0;
        width: 100%;
    }
}

@media only screen and (max-width: 767px) {
    .knma-acc-panel-body {
        flex-direction: column;
        gap: 12px;
        padding: 10px 14px;
    }

    .knma-acc-buttons--contrast {
        flex-wrap: wrap;
    }

    .knma-acc-toggle-text {
        font-size: 11px;
    }
}
