/*
 * AMS Accessibility widget
 * ------------------------
 * Po vzoru almamater.si — floating gumb (bottom-left), panel z 12 funkcijami,
 * CTRL+U shortcut. Barve: burgundy namesto navy.
 *
 * Vse uporabniške nastavitve so persistirane v localStorage ('ams-a11y').
 */

/* ============================================================
   TRIGGER GUMB — fixed bottom-left
   ============================================================ */
.ams-a11y-trigger {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 9998;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--ams-burgundy-500, #8B0030);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(26, 23, 21, 0.18);
    transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
    padding: 0;
}
.ams-a11y-trigger:hover,
.ams-a11y-trigger:focus-visible {
    background: var(--ams-burgundy-700, #67000C);
    transform: translateY(-2px);
    outline: none;
    box-shadow: 0 8px 22px rgba(26, 23, 21, 0.24);
}
.ams-a11y-trigger:focus-visible {
    outline: 3px solid var(--ams-burgundy-100, #F5E0E6);
    outline-offset: 2px;
}
.ams-a11y-trigger svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}
.ams-a11y-trigger[aria-expanded="true"] {
    background: var(--ams-burgundy-700, #67000C);
}

/* ============================================================
   PANEL — drawer z desne strani
   ============================================================ */
.ams-a11y-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(720px, 100vw);
    max-width: 100vw;
    z-index: 9999;
    background: #fff;
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.16);
    transform: translateX(100%);
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    font-family: var(--ams-font-sans, "Mulish", sans-serif);
}
.ams-a11y-panel[aria-hidden="false"] {
    transform: translateX(0);
}
.ams-a11y-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(26, 23, 21, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 0s linear 200ms;
}
.ams-a11y-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 200ms ease;
}

/* HEADER (naslov + CTRL+U + close) */
.ams-a11y-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 28px 32px 20px;
    border-bottom: 1px solid var(--ams-gray-100, #EDE9E3);
}
.ams-a11y-panel__title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.ams-a11y-panel__icon {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    color: var(--ams-burgundy-500, #8B0030);
    margin-top: 2px;
}
.ams-a11y-panel__icon svg { width: 100%; height: 100%; fill: currentColor; }
.ams-a11y-panel__title {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.2;
    font-weight: 700;
    color: var(--ams-gray-900, #1A1715);
}
.ams-a11y-panel__shortcut {
    display: block;
    margin-top: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ams-gray-500, #8A847B);
    letter-spacing: 0.05em;
}
.ams-a11y-panel__close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--ams-gray-700, #3D3834);
    border-radius: 4px;
    transition: color 150ms ease, background 150ms ease;
}
.ams-a11y-panel__close:hover,
.ams-a11y-panel__close:focus-visible {
    color: var(--ams-burgundy-500, #8B0030);
    background: var(--ams-gray-100, #EDE9E3);
    outline: none;
}
.ams-a11y-panel__close svg { width: 24px; height: 24px; }

/* GRID — 3 stolpci */
.ams-a11y-panel__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 0 32px;
    border-bottom: 1px solid var(--ams-gray-100, #EDE9E3);
}
.ams-a11y-feature {
    position: relative;
    appearance: none;
    background: transparent;
    border: 1px solid var(--ams-gray-100, #EDE9E3);
    margin: -1px 0 0 -1px;
    padding: 28px 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    text-align: center;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--ams-gray-900, #1A1715);
    line-height: 1.25;
    transition: background 150ms ease, color 150ms ease;
    min-height: 132px;
}
.ams-a11y-feature:hover,
.ams-a11y-feature:focus-visible {
    background: var(--ams-cream, #FAF7F2);
    outline: none;
    z-index: 1;
}
.ams-a11y-feature__icon {
    width: 32px;
    height: 32px;
    color: var(--ams-gray-900, #1A1715);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ams-a11y-feature__icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}
.ams-a11y-feature__label {
    font-weight: 500;
    word-break: break-word;
}
/* Aktiven feature: burgundy okvir + ozadje */
.ams-a11y-feature.is-active {
    background: var(--ams-burgundy-100, #F5E0E6);
    color: var(--ams-burgundy-700, #67000C);
    border-color: var(--ams-burgundy-500, #8B0030);
    z-index: 2;
}
.ams-a11y-feature.is-active .ams-a11y-feature__icon {
    color: var(--ams-burgundy-500, #8B0030);
}

/* FOOTER — bližnjice, izjava, ponastavi */
.ams-a11y-panel__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
    padding: 24px 32px;
    margin-top: auto;
}
.ams-a11y-panel__links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ams-a11y-panel__links a {
    color: var(--ams-burgundy-500, #8B0030);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ams-a11y-panel__links a:hover,
.ams-a11y-panel__links a:focus-visible {
    color: var(--ams-burgundy-700, #67000C);
    text-decoration: underline;
}
.ams-a11y-panel__links a::after {
    content: '→';
    transition: transform 150ms ease;
}
.ams-a11y-panel__links a:hover::after { transform: translateX(3px); }

.ams-a11y-reset {
    appearance: none;
    background: transparent;
    border: 2px solid var(--ams-burgundy-500, #8B0030);
    color: var(--ams-burgundy-500, #8B0030);
    border-radius: 999px;
    padding: 10px 20px 10px 14px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: background 180ms ease, color 180ms ease;
}
.ams-a11y-reset:hover,
.ams-a11y-reset:focus-visible {
    background: var(--ams-burgundy-500, #8B0030);
    color: #fff;
    outline: none;
}
.ams-a11y-reset__icon {
    display: inline-flex;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid currentColor;
    align-items: center;
    justify-content: center;
}
.ams-a11y-reset__icon::before {
    content: '→';
    line-height: 1;
    font-weight: 700;
}

/* Tooltip (Bližnjice modal) */
.ams-a11y-shortcuts-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(26, 23, 21, 0.55);
    padding: 16px;
}
.ams-a11y-shortcuts-modal.is-open {
    display: flex;
}
.ams-a11y-shortcuts-modal__inner {
    background: #fff;
    border-radius: 12px;
    max-width: 520px;
    width: 100%;
    padding: 28px;
    max-height: 80vh;
    overflow-y: auto;
}
.ams-a11y-shortcuts-modal__title {
    margin: 0 0 16px;
    font-size: 1.25rem;
    font-weight: 700;
}
.ams-a11y-shortcuts-modal table { width: 100%; border-collapse: collapse; }
.ams-a11y-shortcuts-modal td {
    padding: 8px 0;
    border-bottom: 1px solid var(--ams-gray-100, #EDE9E3);
    font-size: 0.95rem;
}
.ams-a11y-shortcuts-modal td:first-child {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--ams-burgundy-500, #8B0030);
    font-weight: 700;
    width: 40%;
}
.ams-a11y-shortcuts-modal__close {
    margin-top: 18px;
    padding: 10px 18px;
    background: var(--ams-burgundy-500, #8B0030);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}
.ams-a11y-shortcuts-modal__close:hover { background: var(--ams-burgundy-700, #67000C); }

/* ============================================================
   APPLIED BEHAVIORS — globalni razredi na <html>
   Te razrede a11y JS dodaja v <html>, ne v .ams-a11y-panel.
   ============================================================ */

/* 1) Navigacija s tipkovnico — vidni focus ring povsod */
html.ams-a11y-keyboard *:focus {
    outline: 3px solid var(--ams-burgundy-500, #8B0030) !important;
    outline-offset: 2px !important;
}

/* 2) Večji bel kurzor */
html.ams-a11y-cursor-white,
html.ams-a11y-cursor-white * {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'><path fill='%23ffffff' stroke='%23000000' stroke-width='1' d='M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 0 1 .35-.15h6.87a.5.5 0 0 0 .35-.85L6.35 2.85a.5.5 0 0 0-.85.35Z'/></svg>") 0 0, auto !important;
}

/* 3) Večji črn kurzor */
html.ams-a11y-cursor-black,
html.ams-a11y-cursor-black * {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'><path fill='%23000000' stroke='%23ffffff' stroke-width='1' d='M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 0 1 .35-.15h6.87a.5.5 0 0 0 .35-.85L6.35 2.85a.5.5 0 0 0-.85.35Z'/></svg>") 0 0, auto !important;
}

/* 5) Večja pisava */
html.ams-a11y-font-large {
    font-size: 125% !important;
}
/* 6) Odebeljena pisava */
html.ams-a11y-font-bold,
html.ams-a11y-font-bold * {
    font-weight: 700 !important;
}

/* 7) Povečaj kontrast — temno ozadje, svetla pisava */
html.ams-a11y-contrast-high,
html.ams-a11y-contrast-high body {
    background: #000 !important;
    color: #fff !important;
}
html.ams-a11y-contrast-high *:not(svg):not(path):not(img) {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}
html.ams-a11y-contrast-high a,
html.ams-a11y-contrast-high button,
html.ams-a11y-contrast-high .ams-btn {
    color: #FFD400 !important;
    border-color: #FFD400 !important;
}

/* 8) Barve v sivinah */
html.ams-a11y-grayscale {
    filter: grayscale(100%);
    -webkit-filter: grayscale(100%);
}

/* 9) Obrni kontrast */
html.ams-a11y-invert {
    filter: invert(100%) hue-rotate(180deg);
    -webkit-filter: invert(100%) hue-rotate(180deg);
}
/* slike popravi nazaj, da ostanejo "normalne" */
html.ams-a11y-invert img,
html.ams-a11y-invert video,
html.ams-a11y-invert iframe,
html.ams-a11y-invert picture,
html.ams-a11y-invert svg image {
    filter: invert(100%) hue-rotate(180deg);
    -webkit-filter: invert(100%) hue-rotate(180deg);
}

/* 10) Veliki naslovi */
html.ams-a11y-big-headings h1 { font-size: 3.5rem !important; line-height: 1.15 !important; }
html.ams-a11y-big-headings h2 { font-size: 2.75rem !important; line-height: 1.2 !important; }
html.ams-a11y-big-headings h3 { font-size: 2rem !important; line-height: 1.25 !important; }
html.ams-a11y-big-headings h4 { font-size: 1.6rem !important; }
html.ams-a11y-big-headings h5 { font-size: 1.35rem !important; }
html.ams-a11y-big-headings h6 { font-size: 1.2rem !important; }

/* 11) Podčrtaj povezave */
html.ams-a11y-underline a {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 3px !important;
}

/* 12) Disable animations */
html.ams-a11y-no-anim *,
html.ams-a11y-no-anim *::before,
html.ams-a11y-no-anim *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

/* ============================================================
   RESPONSIVE — mobile (do 600px)
   ============================================================ */
@media (max-width: 600px) {
    .ams-a11y-panel__grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 16px;
    }
    .ams-a11y-panel__header {
        padding: 20px 16px 16px;
    }
    .ams-a11y-panel__footer {
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
    }
    .ams-a11y-feature {
        padding: 20px 8px;
        font-size: 0.85rem;
        min-height: 116px;
    }
    .ams-a11y-trigger {
        width: 46px;
        height: 46px;
        left: 12px;
        bottom: 12px;
    }
    .ams-a11y-trigger svg { width: 24px; height: 24px; }
}
