/* =============================================================================
   WCAG Laravel – Accessibility Widget
   ============================================================================= */

:root {
    --aw-primary: #0055cc;
    --aw-toggle-size: 52px;
    --aw-panel-width: 296px;
    --aw-radius-panel: 18px;
    --aw-z: 99999;
}

/* Widget container – always fixed, never in flow
   ============================================================================= */

.aw-widget {
    position: fixed;
    z-index: var(--aw-z);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1;
}

.aw-widget.aw-position-bottom-left  { bottom: 1.5rem; left:  1.5rem; }
.aw-widget.aw-position-bottom-right { bottom: 1.5rem; right: 1.5rem; }
.aw-widget.aw-position-top-left     { top:    1.5rem; left:  1.5rem; }
.aw-widget.aw-position-top-right    { top:    1.5rem; right: 1.5rem; }

/* Toggle button
   ============================================================================= */

.aw-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--aw-toggle-size);
    height: var(--aw-toggle-size);
    border-radius: 50%;
    border: none;
    background: var(--aw-primary);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22), 0 1px 4px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
    outline: none;
}

.aw-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.14);
}

.aw-toggle-btn:focus-visible {
    outline: 3px solid var(--aw-primary);
    outline-offset: 3px;
}

/* Panel
   ============================================================================= */

.aw-panel {
    position: absolute;
    width: var(--aw-panel-width);
    background: #ffffff;
    border-radius: var(--aw-radius-panel);
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.16), 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;

    /* Closed state */
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95) translateY(6px);
    transition: opacity 0.2s ease,
                transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom left;
}

.aw-panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

/* Panel positioning relative to toggle */
.aw-position-bottom-left .aw-panel,
.aw-position-bottom-right .aw-panel {
    bottom: calc(var(--aw-toggle-size) + 0.75rem);
}

.aw-position-top-left .aw-panel,
.aw-position-top-right .aw-panel {
    top: calc(var(--aw-toggle-size) + 0.75rem);
    transform-origin: top left;
}

.aw-position-bottom-left .aw-panel,
.aw-position-top-left .aw-panel {
    left: 0;
}

.aw-position-bottom-right .aw-panel,
.aw-position-top-right .aw-panel {
    right: 0;
    transform-origin: bottom right;
}

/* Panel header
   ============================================================================= */

.aw-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.125rem 0.875rem;
    border-bottom: 1px solid #f0f0f0;
}

.aw-panel-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111;
    letter-spacing: -0.01em;
}

.aw-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #f4f4f5;
    color: #71717a;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.aw-close-btn:hover {
    background: #e4e4e7;
    color: #18181b;
}

.aw-close-btn:focus-visible {
    outline: 2px solid var(--aw-primary);
    outline-offset: 2px;
}

/* Panel body
   ============================================================================= */

.aw-panel-body {
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 72vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Groups
   ============================================================================= */

.aw-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.aw-group-label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #a1a1aa;
}

.aw-group-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

/* Buttons – pill shaped
   ============================================================================= */

.aw-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    border-radius: 999px;
    border: 1.5px solid #e4e4e7;
    background: #fafafa;
    color: #3f3f46;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease,
                transform 0.1s ease, box-shadow 0.15s ease;
    outline: none;
}

.aw-btn:hover {
    border-color: var(--aw-primary);
    color: var(--aw-primary);
    background: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--aw-primary) 12%, transparent);
}

.aw-btn:active {
    transform: scale(0.96);
}

.aw-btn:focus-visible {
    outline: 2px solid var(--aw-primary);
    outline-offset: 2px;
}

.aw-btn.aw-active {
    background: var(--aw-primary);
    border-color: var(--aw-primary);
    color: #fff;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--aw-primary) 35%, transparent);
}

.aw-btn.aw-active:hover {
    color: #fff;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--aw-primary) 45%, transparent);
}

/* Reset group */
.aw-group--reset {
    padding-top: 0.375rem;
    border-top: 1px solid #f0f0f0;
}

.aw-btn--reset {
    width: 100%;
    justify-content: center;
    background: transparent;
    color: #ef4444;
    border-color: #fecaca;
}

.aw-btn--reset:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #dc2626;
    box-shadow: none;
}

/* =============================================================================
   Accessibility State Classes (applied to <html>)
   ============================================================================= */

/* High Contrast */
html.aw-high-contrast body {
    background: #000 !important;
    color: #fff !important;
}

html.aw-high-contrast a {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

html.aw-high-contrast button,
html.aw-high-contrast input,
html.aw-high-contrast textarea,
html.aw-high-contrast select {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

/* Dark Mode */
html.aw-dark-mode {
    filter: invert(1) hue-rotate(180deg);
}

html.aw-dark-mode img,
html.aw-dark-mode video,
html.aw-dark-mode iframe,
html.aw-dark-mode canvas {
    filter: invert(1) hue-rotate(180deg);
}

/* Dyslexia Font */
html.aw-dyslexia-font,
html.aw-dyslexia-font * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', cursive !important;
    letter-spacing: 0.1em !important;
    word-spacing: 0.16em !important;
}

html.aw-dyslexia-font .fa,
html.aw-dyslexia-font .fas,
html.aw-dyslexia-font .far,
html.aw-dyslexia-font .fab,
html.aw-dyslexia-font .fal,
html.aw-dyslexia-font .fa-solid,
html.aw-dyslexia-font .fa-regular,
html.aw-dyslexia-font .fa-light,
html.aw-dyslexia-font .fa-thin,
html.aw-dyslexia-font .fa-brands {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", "Font Awesome 5 Free", "Font Awesome 5 Brands" !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
}

/* Line Height */
html.aw-line-height body,
html.aw-line-height p,
html.aw-line-height li,
html.aw-line-height td,
html.aw-line-height div {
    line-height: 1.9 !important;
}

/* Readable Font */
html.aw-readable-font,
html.aw-readable-font * {
    font-family: Georgia, 'Times New Roman', serif !important;
    letter-spacing: 0.04em;
    word-spacing: 0.1em;
}

html.aw-readable-font .fa,
html.aw-readable-font .fas,
html.aw-readable-font .far,
html.aw-readable-font .fab,
html.aw-readable-font .fal,
html.aw-readable-font .fa-solid,
html.aw-readable-font .fa-regular,
html.aw-readable-font .fa-light,
html.aw-readable-font .fa-thin,
html.aw-readable-font .fa-brands {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", "Font Awesome 5 Free", "Font Awesome 5 Brands" !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
}

/* Highlight Links */
html.aw-highlight-links a {
    background: #ffff00 !important;
    color: #000 !important;
    text-decoration: underline !important;
    outline: 2px solid #000 !important;
    padding: 0 2px;
    border-radius: 2px;
}

/* Color Vision Filters
   ============================================================================= */

html.aw-protanomalie  { filter: url(#aw-filter-protanomalie); }
html.aw-deuteranomalie { filter: url(#aw-filter-deuteranomalie); }
html.aw-tritanomalie  { filter: url(#aw-filter-tritanomalie); }
html.aw-grayscale     { filter: grayscale(100%); }
html.aw-achromatopsie { filter: url(#aw-filter-achromatopsie); }

/* Easter Egg – Activation Overlay
   ============================================================================= */

@keyframes aw-michael-fade {
    0%   { opacity: 0; }
    8%   { opacity: 1; }
    75%  { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes aw-michael-flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; }
    20%, 24%, 55% { opacity: 0.2; }
}

@keyframes aw-michael-glitch {
    0%        { clip-path: inset(40% 0 61% 0); transform: translate(-4px, 0); }
    20%       { clip-path: inset(92% 0 1% 0);  transform: translate(4px, 0); }
    40%       { clip-path: inset(43% 0 1% 0);  transform: translate(0, 0); }
    60%       { clip-path: inset(25% 0 58% 0); transform: translate(4px, 0); }
    80%       { clip-path: inset(54% 0 7% 0);  transform: translate(-4px, 0); }
    100%      { clip-path: inset(58% 0 43% 0); transform: translate(0, 0); }
}

@keyframes aw-michael-bar {
    from { width: 0; }
    to   { width: 100%; }
}

.aw-michael-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    font-family: 'Courier New', Courier, monospace;
    animation: aw-michael-fade 2.8s ease forwards;
    pointer-events: none;
    overflow: hidden;
}

/* CRT scanlines */
.aw-michael-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0, 0, 0, 0.25) 3px,
        rgba(0, 0, 0, 0.25) 4px
    );
    pointer-events: none;
}

.aw-michael-title {
    position: relative;
    font-size: clamp(2.5rem, 9vw, 6rem);
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    animation: aw-michael-flicker 3s linear infinite;
}

/* Glitch clone */
.aw-michael-title::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    animation: aw-michael-glitch 0.65s infinite linear alternate-reverse;
    opacity: 0.7;
}

.aw-michael-subtitle {
    font-size: clamp(0.75rem, 2.5vw, 1.1rem);
    letter-spacing: 0.6em;
    text-transform: uppercase;
    opacity: 0.8;
    animation: aw-michael-flicker 2s linear infinite;
}

.aw-michael-bar-wrap {
    width: min(360px, 70vw);
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 99px;
    overflow: hidden;
}

.aw-michael-bar {
    height: 100%;
    border-radius: 99px;
    animation: aw-michael-bar 2s linear forwards;
}

/* Colour themes */
.aw-michael-overlay--on  { }
.aw-michael-overlay--on  .aw-michael-title    { color: #00ff41; text-shadow: 0 0 18px #00ff41, 0 0 40px #00ff41; }
.aw-michael-overlay--on  .aw-michael-title::after { color: #00e5ff; }
.aw-michael-overlay--on  .aw-michael-subtitle { color: #00ff41; }
.aw-michael-overlay--on  .aw-michael-bar      { background: #00ff41; box-shadow: 0 0 10px #00ff41; }

.aw-michael-overlay--off .aw-michael-title    { color: #ff3131; text-shadow: 0 0 18px #ff3131, 0 0 40px #ff3131; }
.aw-michael-overlay--off .aw-michael-title::after { color: #ff9900; }
.aw-michael-overlay--off .aw-michael-subtitle { color: #ff3131; }
.aw-michael-overlay--off .aw-michael-bar      { background: #ff3131; box-shadow: 0 0 10px #ff3131; }

/* Easter Egg
   ============================================================================= */

html.aw-easter-egg {
    font-size: 150% !important;
}

html.aw-easter-egg body,
html.aw-easter-egg *:not(.aw-widget):not(.aw-widget *) {
    background-color: #000000 !important;
    color: #ffffff !important;
}

html.aw-easter-egg button,
html.aw-easter-egg input,
html.aw-easter-egg textarea,
html.aw-easter-egg select {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

html.aw-easter-egg a {
    background-color: #ffff00 !important;
    color: #000000 !important;
    text-decoration: underline !important;
    outline: 2px solid #000000 !important;
    padding: 0 2px;
    border-radius: 2px;
}

/* Big Cursor */
html.aw-big-cursor,
html.aw-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M8 4l26 17-11 2 6 13-5 2-6-13-10 7z' fill='%23000' stroke='%23fff' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") 0 0, auto !important;
}
