/*colours + fonts + theme switcher*/

:root {
    --text-color: light-dark(#333, #e6e2e8);
    --bg-color: light-dark(#fff, #0d0d0d);
    --highlight-color: light-dark(#dbe6ff, #33324a);
    --link-color: light-dark(#4c7bef, #a9b8f0);
    --link-hover-color: light-dark(#2952c0, #cdd6f7);
    --muted-color: light-dark(#888, #9d99a6);
    --surface-color: light-dark(#f5f5f7, #16151a);
    --border-color: light-dark(#e0e0e0, #222);
    --danger-color: light-dark(#c0392b, #e0776a);
}

/*font stacks*/
:root {
    --font-family: "Hiragino Kaku Gothic Pro", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono-font: "JetBrains Mono", "Cascadia Code", FMono-Regular, Consolas, DejaVu Sans Mono, "Liberation Mono", Menlo, monospace;

    --text-tooltip: 0.7rem;
    --text-xs: 0.75rem;
    --text-sm: 0.85rem;
    --text-md: 0.9rem;
    --text-lg: 1.1rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;
}

::selection {
    background-color: var(--highlight-color);
}

.theme-switch {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1000;
}

.theme-toggle {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: color 0.1s, border-color 0.1s;
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

.theme-toggle:hover,
.theme-toggle[aria-expanded="true"] {
    color: var(--link-color);
    border-color: var(--link-color);
}

.theme-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 110px;
    list-style: none;
    margin: 0;
    padding: 4px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.theme-menu[hidden] {
    display: none;
}

.theme-menu li {
    padding: 6px 10px;
    font-family: var(--font-family);
    font-size: var(--text-sm);
    color: var(--text-color);
    text-align: left;
    cursor: pointer;
}

.theme-menu li:hover {
    background: var(--highlight-color);
}

.theme-menu li[aria-selected="true"] {
    color: var(--link-color);
    font-weight: 600;
}

/*theme button stays at the top of the page*/
@media (max-width: 600px) {
    .theme-switch {
        position: absolute;
    }
}
