/*
 * Golfissimo Accessibility Baseline
 * Native accessibility support for storefront, authentication and portal UI.
 * This stylesheet is intentionally loaded last so that visible keyboard focus
 * cannot accidentally be removed by page-specific component styles.
 */

.a11y-skip-link {
    position: fixed;
    z-index: 100000;
    top: 10px;
    left: 10px;
    max-width: calc(100vw - 20px);
    padding: 11px 16px;
    border: 2px solid #ffffff;
    border-radius: 10px;
    color: #ffffff;
    background: #153d2f;
    box-shadow: 0 0 0 3px #153d2f;
    font: 700 14px/1.25 "DM Sans", Arial, sans-serif;
    text-decoration: none;
    transform: translateY(-180%);
    transition: transform .15s ease;
}

.a11y-skip-link:focus,
.a11y-skip-link:focus-visible {
    transform: translateY(0);
    outline: 0 !important;
}

.a11y-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/*
 * Two-tone keyboard ring: white remains visible on dark Golfissimo surfaces,
 * the green outer ring remains visible on light surfaces.
 */
:where(
    a[href],
    button,
    input,
    select,
    textarea,
    summary,
    [role="button"],
    [role="link"],
    [role="menuitem"],
    [tabindex]:not([tabindex="-1"])
):focus-visible {
    outline: 3px solid #ffffff !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 5px #153d2f !important;
}

/* Do not let disabled controls look actionable. */
:where(button, input, select, textarea):disabled,
[aria-disabled="true"] {
    cursor: not-allowed;
}

/* Customer-facing controls should be comfortably operable by touch. */
.student-portal-page :where(button, .btn, input:not([type="checkbox"]):not([type="radio"]), select, textarea),
.auth-page :where(button, .btn, input:not([type="checkbox"]):not([type="radio"]), select, textarea),
.shop-body :where(button, .shop-btn, input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    min-height: 44px;
}

.student-portal-page :where(input[type="checkbox"], input[type="radio"]),
.auth-page :where(input[type="checkbox"], input[type="radio"]),
.shop-body :where(input[type="checkbox"], input[type="radio"]) {
    min-width: 22px;
    min-height: 22px;
}

/* Icon-only controls in the public/customer interfaces. */
.shop-body :where(
    .shop-header-icon-button,
    .shop-search-close,
    .shop-mobile-nav-close,
    .shop-announcement-controls button,
    .shop-image-lightbox-close,
    .shop-image-lightbox-nav
),
.student-portal-page :where(
    .menu-button,
    .notification-trigger
) {
    min-width: 44px;
    min-height: 44px;
}

/* Links in actual reading content must not rely on colour alone. */
.shop-body :where(.shop-rich-text, .rich-text, .shop-legal-content) a,
.student-portal-page .page-content :where(p, li) a,
.auth-page :where(p, li) a {
    text-decoration: underline;
    text-decoration-thickness: .08em;
    text-underline-offset: .16em;
}

/* Better resilience for zoom and long labels. */
.shop-body,
.student-portal-page,
.auth-page {
    overflow-wrap: anywhere;
}

.shop-body :where(button, a, input, select, textarea),
.student-portal-page :where(button, a, input, select, textarea),
.auth-page :where(button, a, input, select, textarea) {
    touch-action: manipulation;
}

/* Respect OS/browser motion preferences throughout Golfissimo. */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto !important;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Keep controls understandable in Windows High Contrast / forced colours. */
@media (forced-colors: active) {
    :where(
        a[href],
        button,
        input,
        select,
        textarea,
        summary,
        [role="button"],
        [tabindex]:not([tabindex="-1"])
    ):focus-visible {
        outline: 3px solid Highlight !important;
        box-shadow: none !important;
    }

    .a11y-skip-link {
        border-color: ButtonText;
        color: ButtonText;
        background: Canvas;
        box-shadow: none;
    }
}

/* =========================================================
   User-controlled display preferences
   ========================================================= */

html[data-a11y-font="large"] body {
    zoom: 1.08;
}

html[data-a11y-font="xlarge"] body {
    zoom: 1.16;
}

@supports not (zoom: 1) {
    html[data-a11y-font="large"] body {
        font-size: 108%;
    }

    html[data-a11y-font="xlarge"] body {
        font-size: 116%;
    }
}

html.a11y-links a[href]:not(.btn):not(.shop-btn):not(.golfi-help-launcher):not(.a11y-widget-launcher) {
    text-decoration: underline !important;
    text-decoration-thickness: .12em !important;
    text-underline-offset: .18em !important;
}

html.a11y-reduce-motion,
html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
}

html.a11y-high-contrast body {
    --canvas: #ffffff;
    --ink: #08120e;
    --muted: #33473e;
    --line: #81948b;
    --green-900: #0b3325;
    --green-800: #124b37;
    --green-700: #155840;
}

html.a11y-high-contrast .app-shell .page-content,
html.a11y-high-contrast .student-portal-page,
html.a11y-high-contrast .auth-page,
html.a11y-high-contrast .shop-body {
    color: #08120e;
}

html.a11y-high-contrast .card,
html.a11y-high-contrast .card-shell,
html.a11y-high-contrast .ui-card,
html.a11y-high-contrast .shop-card,
html.a11y-high-contrast .shop-product-card,
html.a11y-high-contrast .student-card {
    border-color: #71877d !important;
}

html.a11y-high-contrast .shop-body {
    --shop-ink: #08120e !important;
    --shop-muted: #33473e !important;
    --shop-line: #71877d !important;
    --shop-canvas: #ffffff !important;
    --shop-green-950: #082f22 !important;
    --shop-green-900: #0b3c2b !important;
    --shop-green-800: #124f39 !important;
    --shop-green-700: #155b41 !important;
}

.a11y-settings {
    display: grid;
    gap: 12px;
    color: #10251c;
}

.a11y-settings-intro {
    padding-bottom: 12px;
    border-bottom: 1px solid #dce6e1;
}

.a11y-settings-intro strong,
.a11y-settings-intro p {
    display: block;
    margin: 0;
}

.a11y-settings-intro strong {
    font-size: 14px;
}

.a11y-settings-intro p {
    margin-top: 4px;
    color: #60766b;
    font-size: 11px;
    line-height: 1.5;
}

.a11y-settings-group {
    display: grid;
    gap: 7px;
}

.a11y-settings-label {
    color: #425d51;
    font-size: 11px;
    font-weight: 800;
}

.a11y-font-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.a11y-font-options button,
.a11y-settings-reset {
    min-height: 42px;
    border: 1px solid #cad8d1;
    border-radius: 11px;
    background: #fff;
    color: #164d39;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
}

.a11y-font-options button[aria-pressed="true"] {
    border-color: #164d39;
    color: #fff;
    background: #164d39;
}

.a11y-settings-toggle {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid #dce6e1;
    border-radius: 13px;
    background: #fff;
    cursor: pointer;
}

.a11y-settings-toggle > span:first-child {
    min-width: 0;
}

.a11y-settings-toggle strong,
.a11y-settings-toggle small {
    display: block;
}

.a11y-settings-toggle strong {
    color: #153d2f;
    font-size: 12px;
}

.a11y-settings-toggle small {
    margin-top: 2px;
    color: #6b7f76;
    font-size: 10px;
    line-height: 1.35;
}

.a11y-settings-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.a11y-switch {
    position: relative;
    display: block;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #cbd7d1;
    transition: background .15s ease;
}

.a11y-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(7, 35, 25, .2);
    transition: transform .15s ease;
}

.a11y-settings-toggle input:checked + .a11y-switch {
    background: #1c654b;
}

.a11y-settings-toggle input:checked + .a11y-switch::after {
    transform: translateX(18px);
}

.a11y-settings-toggle:has(input:focus-visible) {
    outline: 3px solid #ffffff !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 5px #153d2f !important;
}

.a11y-settings-reset {
    margin-top: 2px;
    background: #f5f8f6;
}

.a11y-widget {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 175;
    font-family: "DM Sans", Arial, sans-serif;
}

.a11y-widget.is-shop {
    right: auto;
    left: 18px;
}

.a11y-widget-launcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 6px 14px 6px 6px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: #153d2f;
    box-shadow: 0 14px 34px rgba(8, 42, 31, .22);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
}

.a11y-widget-mark {
    display: grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 5px;
    border-radius: 999px;
    color: #153d2f;
    background: #fff;
    font-size: 12px;
    font-weight: 900;
}

.a11y-widget-panel {
    position: absolute;
    right: 0;
    bottom: 58px;
    width: min(360px, calc(100vw - 28px));
    max-height: min(600px, calc(100dvh - 100px));
    overflow: hidden;
    border: 1px solid rgba(20, 56, 43, .15);
    border-radius: 20px;
    background: #f7f9f8;
    box-shadow: 0 26px 70px rgba(8, 42, 31, .22);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(.985);
    transform-origin: bottom right;
    transition: opacity .16s ease, transform .16s ease;
}

.a11y-widget.is-shop .a11y-widget-panel {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

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

.a11y-widget-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 16px;
    color: #fff;
    background: linear-gradient(135deg, #123b2d, #245d48);
}

.a11y-widget-head > div {
    min-width: 0;
    flex: 1;
}

.a11y-widget-head strong,
.a11y-widget-head small {
    display: block;
}

.a11y-widget-head strong {
    font-size: 14px;
}

.a11y-widget-head small {
    margin-top: 2px;
    color: rgba(255,255,255,.74);
    font-size: 10px;
}

.a11y-widget-head button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255,255,255,.12);
    cursor: pointer;
    font: inherit;
    font-size: 19px;
    font-weight: 800;
}

.a11y-widget-body {
    max-height: calc(min(600px, 100dvh - 100px) - 70px);
    overflow-y: auto;
    padding: 16px;
}

@media (max-width: 620px) {
    .a11y-widget,
    .a11y-widget.is-shop {
        right: 10px;
        bottom: 10px;
        left: auto;
    }

    .a11y-widget.is-shop {
        bottom: 62px;
    }

    .a11y-widget-panel,
    .a11y-widget.is-shop .a11y-widget-panel {
        position: fixed;
        right: 10px;
        bottom: 68px;
        left: 10px;
        width: auto;
        max-height: calc(100dvh - 88px);
        transform-origin: bottom right;
    }

    .a11y-widget.is-shop .a11y-widget-panel {
        bottom: 118px;
    }
}

.a11y-settings-toggle input:focus-visible {
    outline: 0 !important;
    box-shadow: none !important;
}

.a11y-settings-toggle input:focus-visible + .a11y-switch {
    outline: 3px solid #ffffff;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px #153d2f;
}
