/* Floating buttons and the accessibility menu (traki_floating_buttons).
   A portal can recolour them by redefining the --traki-fab-* variables. */
:root {
    --traki-fab-primary: var(--t-primary, #233876);
    --traki-fab-primary-text: #fff;
    --traki-fab-surface: #fff;
    --traki-fab-text: #0f172a;
    --traki-fab-muted: #64748b;
    --traki-fab-border: #e2e8f0;
    --traki-fab-switch-off: #e2e8f0;
}

.traki-fab-stack {
    position: fixed;
    right: 8px;
    bottom: 16px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: inherit;
}

@media (min-width: 640px) {
    .traki-fab-stack {
        right: 16px;
    }
}

@media (min-width: 768px) {
    .traki-fab-stack {
        right: 32px;
        bottom: 32px;
        gap: 16px;
    }
}

/* The language button's own stack, bottom left. It exists only on the phone
   layout (up to 1024px, the nav panel's breakpoint); above that the nav
   panel keeps its own language switcher. */
.traki-fab-stack--left {
    right: auto;
    left: 8px;
    align-items: flex-start;
}

@media (min-width: 640px) {
    .traki-fab-stack--left {
        right: auto;
        left: 16px;
    }
}

@media (min-width: 768px) {
    .traki-fab-stack--left {
        right: auto;
        left: 32px;
    }
}

@media (min-width: 1025px) {
    .traki-fab-stack--left {
        display: none;
    }
}

/* Above the cookie banner while it is showing (consent.js sets both). */
html.traki-consent-banner-open .traki-fab-stack {
    bottom: calc(var(--traki-consent-banner-height, 0px) + 32px);
}

@media print {
    .traki-fab-stack {
        display: none;
    }
}

/* Holds the menu button and its panel; the panel opens above the button. */
.traki-fab-group {
    position: relative;
}

.traki-fab {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--traki-fab-primary);
    color: var(--traki-fab-primary-text);
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / .2), 0 4px 6px -4px rgb(0 0 0 / .2);
    transition: filter .15s, transform .15s;
}

.traki-fab:hover {
    filter: brightness(1.15);
}

.traki-fab:focus-visible {
    outline: 2px solid var(--traki-fab-primary);
    outline-offset: 3px;
}

.traki-fab svg {
    width: 32px;
    height: 32px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (min-width: 768px) {
    .traki-fab svg {
        width: 40px;
        height: 40px;
    }
}

/* The editor's "Edit page" pencil: a little smaller than the main button. */
.traki-fab--edit {
    width: 48px;
    height: 48px;
}

.traki-fab--edit svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    stroke: none;
}

/* ---------------------------------------------------------------- panel */

.traki-fab-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    box-sizing: border-box;
    width: min(320px, calc(100vw - 16px));
    padding: 16px;
    border: 1px solid var(--traki-fab-border);
    border-radius: 12px;
    background: var(--traki-fab-surface);
    color: var(--traki-fab-text);
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / .15), 0 4px 6px -4px rgb(0 0 0 / .15);
}

.traki-fab-panel[hidden] {
    display: none;
}

/* The language list: opens above the round button, anchored to its left
   edge (the stack is bottom left), as wide as its longest name. */
.traki-fab-group--language .traki-fab-panel {
    right: auto;
    left: 0;
    width: auto;
    min-width: 160px;
    padding: 4px 0;
    overflow: hidden;
}

.traki-fab-lang__item {
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 16px;
    line-height: 24px;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.traki-fab-lang__item:hover,
.traki-fab-lang__item:focus-visible {
    background: var(--traki-fab-switch-off);
    outline: none;
}

.traki-fab-lang__item--active {
    font-weight: 600;
}

.traki-fab-lang__item--disabled {
    color: var(--traki-fab-muted);
    cursor: default;
}

.traki-fab-lang__item--disabled:hover {
    background: none;
}

.traki-fab-lang__check {
    position: absolute;
    right: 12px;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.traki-fab-panel:focus {
    outline: none;
}

.traki-fab-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--traki-fab-border);
}

.traki-fab-panel__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
}

.traki-fab-panel__more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    color: inherit;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.traki-fab-panel__more:hover {
    background: #f1f5f9;
}

.traki-fab-panel__more svg,
.traki-fab-iconbtn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.traki-fab-panel__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 12px;
}

.traki-fab-panel__label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.traki-fab-font__row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.traki-fab-font__value {
    flex: 1;
    text-align: center;
    font-weight: 500;
}

.traki-fab-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--traki-fab-border);
    border-radius: 6px;
    background: var(--traki-fab-surface);
    color: var(--traki-fab-text);
    cursor: pointer;
}

.traki-fab-iconbtn:hover:not(:disabled) {
    background: #f1f5f9;
}

.traki-fab-iconbtn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.traki-fab-iconbtn:focus-visible,
.traki-fab-panel__more:focus-visible,
.traki-fab-switch input:focus-visible + .traki-fab-switch__track {
    outline: 2px solid var(--traki-fab-primary);
    outline-offset: 2px;
}

/* Font-size zoom is only offered where the page has room for it. */
@media (max-width: 639px) {
    .traki-fab-font {
        display: none;
    }
}

/* ------------------------------------------------------------- switches */

.traki-fab-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}

.traki-fab-switch__text {
    font-size: 14px;
}

.traki-fab-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    opacity: 0;
    pointer-events: none;
}

.traki-fab-switch__track {
    position: relative;
    flex: none;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: var(--traki-fab-switch-off);
    transition: background .15s;
}

.traki-fab-switch__track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / .3);
    transition: transform .15s;
}

.traki-fab-switch input:checked + .traki-fab-switch__track {
    background: var(--traki-fab-primary);
}

.traki-fab-switch input:checked + .traki-fab-switch__track::after {
    transform: translateX(20px);
}

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

/* ------------------------------------------------- accessibility effects
   Classes the script puts on <html>. */

/* High contrast, part 1: the design tokens change (black text on white, dark
   borders, darker status colours). Specificity beats the :root token block.
   Colours an editor picked in a component's props, and the nav and footer
   colours stored in the database, do not use these tokens: part 2 below
   (the contrast guard in floating-buttons.js) takes care of those. */
html.traki-a11y-high-contrast {
    --t-primary: #000;
    --t-primary-ch: 0 0 0;
    --t-secondary: #262626;
    --t-text: #000;
    --t-surface: #fff;
    --t-surface-alt: #f2f2f2;
    --t-border-light: #767676;
    --t-border: #595959;
    --t-border-strong: #000;
    --t-error: #a60000;
    --t-success: #005a1a;
    --t-warning: #7a4a00;
    --portal-page-bg: #fff;
    --traki-fab-border: #000;
    --traki-fab-muted: #262626;
    --traki-fab-switch-off: #595959;
}

/* High contrast, part 2: text the contrast guard found below WCAG AA against
   the solid colour behind it gets black or white, whichever reads better.
   The attribute exists only while High contrast is on (the script removes it
   otherwise), and every rule here is scoped to the class, so the normal page
   is untouched. Only the text colour is forced, never a background. */
html.traki-a11y-high-contrast [data-traki-hc="dark"] {
    color: #000 !important;
}

html.traki-a11y-high-contrast [data-traki-hc="light"] {
    color: #fff !important;
}

/* A marked element never keeps a text-fill colour or a gradient clipped to its
   text (the fading numerals): the forced colour above must be what shows. A
   marked element has no image behind it, so nothing else is lost. */
html.traki-a11y-high-contrast [data-traki-hc] {
    -webkit-text-fill-color: currentColor !important;
    background-image: none !important;
}

/* Reduced motion: every animation and transition ends at once. The loading
   spinner keeps turning, it is the only sign that work is going on. The
   carousel autoplay is stopped by wpc-carousel.js, which watches this class. */
html.traki-a11y-reduce-motion,
html.traki-a11y-reduce-motion *:not(.t-btn-spinner),
html.traki-a11y-reduce-motion *::before,
html.traki-a11y-reduce-motion *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

html.traki-a11y-underline-links a {
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

html.traki-a11y-large-cursor,
html.traki-a11y-large-cursor * {
    cursor:
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M7 2L7 38L15 30L23 46L29 43L21 27L31 27Z" fill="white" stroke="black" stroke-width="2" stroke-linejoin="round"/></svg>')
            7 2,
        auto !important;
}

html.traki-a11y-large-cursor a,
html.traki-a11y-large-cursor [role="link"] {
    cursor:
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M21 2C18.8 2 17 3.8 17 6v15.5l-2.2-2.2c-1.6-1.6-4.1-1.6-5.6 0-1.6 1.6-1.6 4.1 0 5.6l9 9C19.8 35.6 22.3 37 25 37h4c5 0 9-4 9-9V18c0-1.7-1.3-3-3-3s-3 1.3-3 3v-2c0-1.7-1.3-3-3-3s-3 1.3-3 3v-1c0-1.7-1.3-3-3-3s-3 1.3-3 3V6c0-2.2-1.8-4-4-4z" fill="white" stroke="black" stroke-width="1.5" stroke-linejoin="round"/></svg>')
            21 2,
        pointer !important;
}

html.traki-a11y-large-cursor button,
html.traki-a11y-large-cursor input,
html.traki-a11y-large-cursor select,
html.traki-a11y-large-cursor textarea,
html.traki-a11y-large-cursor [role="button"] {
    cursor:
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M7 2L7 38L15 30L23 46L29 43L21 27L31 27Z" fill="white" stroke="black" stroke-width="2" stroke-linejoin="round"/></svg>')
            7 2,
        pointer !important;
}
