/* Reset, page layout and typography. Colours come from the theme tokens in themes.css. */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scrollbar-color: var(--border) var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    background-image: var(--bg-image);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

body:has(dialog[open]) {
    overflow: hidden;
}

h1, h2, h3, p, ul, ol {
    margin: 0;
}

ul, ol {
    padding: 0;
    list-style: none;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

::selection {
    background: var(--accent);
    color: var(--on-accent);
}

:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 0.05rem 0.35rem;
    border-radius: 6px;
    background: var(--field);
    border: 1px solid var(--border);
    white-space: pre-wrap;
}

.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;
}

.skip-link {
    position: absolute;
    left: 0.5rem;
    top: -4rem;
    z-index: 100;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
}
.skip-link:focus {
    top: 0.5rem;
}

.icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
}

.hint {
    font-size: 0.8125rem;
    color: var(--muted);
}

.muted {
    color: var(--muted);
}

/* Page layout */
.app {
    max-width: 40rem;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.app-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 40rem) {
    .app {
        padding: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
