/*
 * Reset, element defaults and the focus ring. ADR 0028 §2.
 *
 * Everything here is an element selector, so anything in the components or
 * shell layer wins without needing a stronger selector to do it. That is what
 * the cascade layers declared in tokens.css buy in place of a preprocessor.
 *
 * No colour value may appear in this file. Reference tokens with var(--…).
 */

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

    html {
        /*
         * The owner portal's bottom tab bar is fixed, so an in-page anchor
         * would otherwise land underneath it.
         */
        scroll-padding-block-end: var(--tab-bar-height);
    }

    body {
        margin: 0;
        background-color: var(--surface-page);
        color: var(--text);
        font-family: var(--font-body);
        font-size: var(--font-size-body);
        line-height: var(--line-height-body);
        -webkit-text-size-adjust: 100%;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        margin: 0;
        color: var(--text-strong);
        font-family: var(--font-heading);
        line-height: var(--line-height-heading);
    }

    h1 {
        font-size: var(--font-size-page-title);
        font-weight: var(--font-weight-bold);
    }

    h2 {
        font-size: var(--font-size-section-title);
        font-weight: var(--font-weight-semibold);
    }

    h3 {
        font-size: var(--font-size-card-title);
        font-weight: var(--font-weight-semibold);
    }

    p {
        margin: 0;
        max-inline-size: var(--measure-body);
    }

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

    dl,
    dd,
    dt,
    figure {
        margin: 0;
    }

    a {
        color: var(--brand-600);
    }

    /*
     * Nothing is a link only because it is coloured (docs/ux/patterns.md), so
     * links in running text are underlined. A link that is unambiguous by
     * position — a nav item, a card that is entirely a link, a button-shaped
     * action — opts out with .is-unadorned rather than by removing the rule
     * everywhere and remembering to put it back.
     *
     * The browser underlines every link by default, so opting out has to
     * remove that underline, not merely skip adding one.
     */
    a:not(.is-unadorned) {
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    a.is-unadorned {
        text-decoration: none;
    }

    a:hover {
        color: var(--brand-700);
    }

    img,
    svg,
    video {
        display: block;
        max-inline-size: 100%;
    }

    img {
        block-size: auto;
    }

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

    /* The UA's checked fill is its own blue; the brand violet keeps the one off-palette colour off every form. */
    input[type='checkbox'],
    input[type='radio'] {
        accent-color: var(--brand-600);
    }

    /*
     * The focus ring is never removed. :focus-visible rather than :focus so a
     * pointer user does not see a ring on every click, and the fallback below
     * keeps the ring for browsers that lack it — the floor in ADR 0028 §7 has
     * it, but a missing ring is the failure worth being paranoid about.
     */
    :focus {
        outline: var(--focus-ring-width) solid var(--brand-600);
        outline-offset: var(--focus-ring-offset);
    }

    :focus:not(:focus-visible) {
        outline: none;
    }

    :focus-visible {
        outline: var(--focus-ring-width) solid var(--brand-600);
        outline-offset: var(--focus-ring-offset);
    }

    /*
     * Visible only once focused. The skip link is the first thing in the tab
     * order of both shells, because a keyboard user should not have to walk
     * seventeen navigation items to reach the page.
     */
    .skip-link {
        position: absolute;
        inset-block-start: var(--space-2);
        inset-inline-start: var(--space-2);
        z-index: 10;
        padding: var(--space-3) var(--space-4);
        border-radius: var(--radius-md);
        background-color: var(--brand-600);
        color: var(--surface-card);
        font-weight: var(--font-weight-medium);
        transform: translateY(-200%);
    }

    .skip-link:focus {
        transform: translateY(0);
    }

    /*
     * The shell-less layout. One centred column on the page tint, wide enough
     * for an auth card and narrow enough that the public reservation form does
     * not run past the measure. It lives in the base layer rather than a
     * shell-*.css because it is not a shell — ADR 0028 §1.
     *
     * min-block-size plus justify-content vertically centres short content —
     * the auth card — and simply has no effect on tall content, which already
     * fills the space: flexbox only distributes leftover room, so a page
     * longer than the viewport top-aligns on its own. That is exactly what
     * flows/breeder-sign-in.md asks of the sign-in card: "vertically centred
     * where there is room and top-aligned where there is not".
     */
    .bare-shell {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: var(--space-6);
        inline-size: 100%;
        min-block-size: 100dvh;
        max-inline-size: var(--bare-shell-max-width);
        margin-inline: auto;
        padding: var(--space-8) var(--space-5) var(--space-12);
    }

    /* Available to assistive technology, absent from the visual layout. */
    .visually-hidden {
        position: absolute;
        inline-size: 1px;
        block-size: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    /* The public form's honeypot. It also carries the `hidden` attribute: either one alone is enough. */
    .form-trap {
        display: none !important;
    }

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