/* Reading preferences. The panel and the preferences are plain CSS on purpose: they must work
   whatever the compiled Tailwind build happens to contain. The head of every page sets the
   data-* attributes on <html> before anything is painted (see layout.blade.php). */

/* Text size: everything in the page is in rem, so this scales it all; the map stays in px. */
html[data-text="large"] { font-size: 112.5%; }
html[data-text="xlarge"] { font-size: 125%; }

html[data-underline] a { text-decoration: underline; text-underline-offset: 2px; }

html[data-spacing] body { letter-spacing: 0.04em; word-spacing: 0.1em; }
html[data-spacing] body p,
html[data-spacing] body li { line-height: 1.7; }
html[data-spacing] #map,
html[data-spacing] #map * { letter-spacing: normal; word-spacing: normal; }

html[data-motion="reduce"] *,
html[data-motion="reduce"] *::before,
html[data-motion="reduce"] *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

/* The button in the header. */
.a11y-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    color: #026582;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 1.25rem;
}
.a11y-open:hover { background: #f3f4f6; }
.a11y-open:focus-visible,
.a11y-panel button:focus-visible { outline: 2px solid #026582; outline-offset: 2px; }

/* The panel. A native <dialog>: Esc closes it, focus stays inside it and goes back to the button. */
.a11y-panel {
    width: calc(100% - 1.5rem);
    max-width: 24rem;
    max-height: calc(100% - 2rem);
    margin: auto; /* Tailwind's reset zeroes it, and it is what centres a <dialog> */
    padding: 0;
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    color: #111827;
    background: #fff;
    overflow: hidden;
}
.a11y-panel[open] { display: flex; flex-direction: column; }
.a11y-panel::backdrop { background: rgba(17, 24, 39, 0.5); }

.a11y-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}
.a11y-head h2 { margin: 0; font-size: 1.125rem; font-weight: 600; line-height: 1.3; }
.a11y-head p { margin: 0.125rem 0 0; font-size: 0.8125rem; color: #6b7280; }
.a11y-close {
    flex: none;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.5rem;
    color: #6b7280;
    background: transparent;
    cursor: pointer;
}
.a11y-close:hover { background: #f3f4f6; color: #111827; }

.a11y-body { padding: 0.75rem 1.25rem 1rem; overflow-y: auto; }
.a11y-group { margin: 0 0 1rem; padding: 0; border: 0; }
.a11y-group legend { margin-bottom: 0.5rem; padding: 0; font-size: 0.875rem; font-weight: 600; }
.a11y-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.a11y-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 3.5rem;
    padding: 0.5rem 0.25rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    color: #374151;
    background: #fff;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
}
.a11y-choice i { font-size: 1.125rem; }
.a11y-choice:hover { background: #f9fafb; }
.a11y-choice[aria-pressed="true"] { border-color: #026582; background: #f0f6f8; color: #026582; box-shadow: inset 0 0 0 1px #026582; }
.a11y-note { margin: 0.5rem 0 0; font-size: 0.75rem; color: #6b7280; }

.a11y-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: inherit;
    background: #f9fafb;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.a11y-switch strong { display: block; font-size: 0.875rem; font-weight: 600; }
.a11y-switch small { display: block; font-size: 0.75rem; color: #6b7280; }
.a11y-track {
    position: relative;
    flex: none;
    width: 2.5rem;
    height: 1.5rem;
    border-radius: 999px;
    background: #d1d5db;
    transition: background 0.15s;
}
.a11y-track::after {
    content: "";
    position: absolute;
    top: 0.1875rem;
    left: 0.1875rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s;
}
.a11y-switch[aria-checked="true"] .a11y-track { background: #026582; }
.a11y-switch[aria-checked="true"] .a11y-track::after { transform: translateX(1rem); }

.a11y-foot { padding: 0.75rem 1.25rem 1rem; border-top: 1px solid #e5e7eb; text-align: center; }
.a11y-reset {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    color: #374151;
    background: #fff;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}
.a11y-reset:hover { background: #f9fafb; }
.a11y-foot p { margin: 0.5rem 0 0; font-size: 0.75rem; color: #6b7280; }

/* Header: the button sits beside the menu toggle on small screens and after the menu on large ones. */
.a11y-bar { margin-left: auto; }
@media (min-width: 1024px) {
    .a11y-bar { order: 2; margin-left: 1.5rem; padding-left: 1.5rem; border-left: 1px solid #e5e7eb; }
    #navbarMenu { margin-left: auto; }
    .a11y-open { width: 2rem; height: 2rem; font-size: 1rem; }
    /* The social icons, a little larger than the accessibility button beside them. */
    .nav-social i { font-size: 18px; }
}
