/* Design tokens and base styles shared by the web and the app. The colors take their cue from a school exercise book:
   ink blue for links and focus, a yellow highlighter for what is selected, a teacher's red pen for problems.
   Every pair of text and background is checked against WCAG AA in Edvaniq.Client.UnitTests (ContrastTests). */

:root {
    color-scheme: light;

    --color-paper: #fbfcfe;
    --color-surface: #ffffff;
    --color-line: #d9dfea;
    --color-ink: #1a2233;
    --color-ink-muted: #4b5568;
    --color-accent: #1f3fa6;
    --color-accent-hover: #182f7d;
    --color-on-accent: #ffffff;
    --color-highlight: #ffe45c;
    --color-on-highlight: #1a2233;
    --color-alert: #a61b12;
    --color-alert-surface: #fdeeec;
    --color-on-alert-surface: #6e140d;
    --color-right: #1d6b35;
    --color-right-surface: #eaf6ee;
    --color-on-right-surface: #134a24;

    --font-body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;

    --radius: 0.375rem;
    --focus-ring: 3px solid var(--color-accent);
    --shell-nav-width: 15rem;
    --content-width: 42rem;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--color-paper);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
}

h1,
h2,
h3 {
    line-height: 1.2;
    margin: 0 0 var(--space-4);
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

h1:focus {
    outline: none;
}

p {
    margin: 0 0 var(--space-4);
}

a {
    color: var(--color-accent);
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--color-accent-hover);
}

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

button {
    font: inherit;
    cursor: pointer;
    border-radius: var(--radius);
}

.button {
    border: 0;
    padding: var(--space-2) var(--space-4);
    background: var(--color-accent);
    color: var(--color-on-accent);
    font-weight: 600;
}

.button:hover {
    background: var(--color-accent-hover);
}

/* The step next to the main one: same size, less weight. */
.button-secondary {
    min-height: 2.75rem;
    padding: var(--space-2) var(--space-4);
    background: var(--color-surface);
    color: var(--color-ink);
    border: 2px solid var(--color-ink-muted);
    font-weight: 600;
}

.button-secondary:hover {
    border-color: var(--color-ink);
}

/* A link that looks like the button: where nothing may depend on the runtime having loaded, a link still works. */
a.button {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    text-decoration: none;
}

a.button:hover {
    color: var(--color-on-accent);
}

/* Read out by screen readers, not shown. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Markdown from the user or the AI (SafeMarkdown in Client.UI). */
.markdown {
    overflow-wrap: anywhere;
}

.markdown > :first-child {
    margin-top: 0;
}

.markdown > :last-child {
    margin-bottom: 0;
}

.markdown blockquote {
    margin: 0 0 var(--space-4);
    padding-left: var(--space-3);
    border-left: 4px solid var(--color-line);
}

.markdown pre {
    overflow-x: auto;
    padding: var(--space-3);
    background: var(--color-paper);
    border: 1px solid var(--color-line);
    border-radius: var(--radius);
}

.markdown-table {
    overflow-x: auto;
    margin-bottom: var(--space-4);
}

.markdown table {
    border-collapse: collapse;
}

.markdown th,
.markdown td {
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--color-line);
    text-align: left;
    vertical-align: top;
    overflow-wrap: normal;
}

.markdown .align-center {
    text-align: center;
}

.markdown .align-right {
    text-align: right;
}

/* A button that opens and closes a part below it (aria-expanded), the whole row as large as a thumb. The mark points
   right when closed and down when open. */
.disclosure {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-height: 2.75rem;
    padding: var(--space-2) 0;
    border: 0;
    background: none;
    color: var(--color-accent);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.disclosure:hover {
    color: var(--color-accent-hover);
}

.disclosure-mark {
    flex: none;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
}

.disclosure[aria-expanded="true"] .disclosure-mark {
    transform: rotate(45deg);
}

@media (min-width: 48rem) {
    h1 {
        font-size: 2.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}