/*
 * ObstetriCal design tokens on top of Pico CSS v2: brand palette, sizes, shadows, radii and the mapping onto pico's variables.
 * Colors are taken from the Wix palette of charly-franz.de.
 * Load order (base.html): pico.min.css, tokens.css, layout.css, elements.css, then the css of a page or component.
 *
 * Breakpoints, in px like pico's own (media queries can't read tokens, so they are written out):
 * phone up to 640px, tablet up to 768px, desktop from 1024px.
 */
:root {
    /* plum: primary brand color, used for buttons on charly-franz.de */
    --cf-plum-100: #dcbddb;
    --cf-plum-300: #ba92b8;
    --cf-plum-500: #935491;
    --cf-plum-700: #653963;
    --cf-plum-900: #321d32;

    /* sage: secondary accent */
    --cf-sage-100: #e8eced;
    --cf-sage-300: #cddbdb;
    --cf-sage-500: #a0c0c3;
    --cf-sage-700: #447070;
    --cf-sage-900: #223838;

    /* neutrals */
    --cf-ink: #2b2b2b;
    /* muted text; darker than the palette's gray (#8a8c8d), which is too faint for small print on white (wcag aa needs 4.5:1) */
    --cf-gray: #727272;
    --cf-white: #ffffff;

    /* shape and type */
    /* poppins is the font of charly-franz.de; it must be self-hosted, the privacy policy excludes google fonts */
    /* TODO: there is no font file yet, so the system font renders; self-host poppins or drop it from the list */
    --pico-font-family-sans-serif: "Poppins", system-ui, "Segoe UI", Roboto, sans-serif;
    /* two radii: pico's for boxes, fields and pop-ups, the small one for cards, the navbar's menu and checkboxes */
    --pico-border-radius: 0.75rem;
    --cf-radius-sm: 0.25rem;
    /* three shadows: sm for cards at rest, md for cards on hover, the navbar and messages, lg for pop-ups above the page */
    --cf-shadow-sm: 0 1px 4px rgba(43, 43, 43, 0.05);
    --cf-shadow-md: 0 2px 12px rgba(43, 43, 43, 0.08);
    --cf-shadow-lg: 0 8px 24px rgba(43, 43, 43, 0.12);
    /*
     * text sizes below the base size (1rem), the only ones in use; headings keep their own sizes.
     * md: page text, navbar, footer, messages. sm: filters, hints and other secondary text.
     * xs and 2xs: the small print of cards (calendar, course catalog)
     */
    --cf-text-md: 0.875rem;
    --cf-text-sm: 0.8rem;
    --cf-text-xs: 0.75rem;
    --cf-text-2xs: 0.6875rem;
    /* side padding of form fields and buttons; a token, because pico overrides its own variable inside button groups */
    --cf-field-spacing-horizontal: 0.8rem;

    /* layout */
    /* height of the sticky navbar (measured in chrome: 71px at a 20px root font); everything placed below it builds on this */
    --cf-header-height: 3.55rem;
    /* where a link target stops below the navbar: its height and some air */
    --cf-anchor-offset: calc(var(--cf-header-height) + 1.45rem);
}

/* --- light mode: the only one, base.html sets data-theme="light" --- */
[data-theme="light"],
:root:not([data-theme="dark"]) {
    --pico-background-color: var(--cf-white);
    --pico-color: var(--cf-ink);
    --pico-muted-color: var(--cf-gray);
    --pico-card-background-color: var(--cf-white);
    --pico-card-box-shadow: var(--cf-shadow-md);

    --pico-primary: var(--cf-plum-500);
    --pico-primary-background: var(--cf-plum-500);
    --pico-primary-border: var(--cf-plum-500);
    --pico-primary-underline: rgba(147, 84, 145, 0.5);
    --pico-primary-hover: var(--cf-plum-700);
    --pico-primary-hover-background: var(--cf-plum-700);
    --pico-primary-hover-border: var(--cf-plum-700);
    --pico-primary-hover-underline: var(--cf-plum-700);
    --pico-primary-focus: rgba(147, 84, 145, 0.35);
    --pico-primary-inverse: var(--cf-white);

    --pico-secondary: var(--cf-sage-700);
    --pico-secondary-background: var(--cf-sage-700);
    --pico-secondary-border: var(--cf-sage-700);
    --pico-secondary-underline: rgba(68, 112, 112, 0.5);
    --pico-secondary-hover: var(--cf-sage-900);
    --pico-secondary-hover-background: var(--cf-sage-900);
    --pico-secondary-hover-border: var(--cf-sage-900);
    --pico-secondary-hover-underline: var(--cf-sage-900);
    --pico-secondary-focus: rgba(68, 112, 112, 0.35);
    --pico-secondary-inverse: var(--cf-white);
}

/*
 * --- base size follows the window height too ---
 * pico raises the root font size with the window width only (16px below 576px up to 21px from 1536px).
 * notebooks are as wide as desktops but much lower, so the same size makes everything look too big.
 * on low windows the size is capped; the steps only lower it, a narrow window keeps pico's smaller size.
 * the later, lower caps win, as they come after the higher ones.
 */
@media (min-width: 1024px) and (max-height: 900px) {
    :root {
        --pico-font-size: 112.5%;
    }
}

@media (min-width: 768px) and (max-height: 760px) {
    :root {
        --pico-font-size: 106.25%;
    }
}

@media (min-width: 576px) and (max-height: 640px) {
    :root {
        --pico-font-size: 100%;
    }
}
