/*
 * Refugees at Home public style pack
 *
 * This file is the stable change surface for brand, typography, spacing and
 * layout decisions. Component CSS must consume these tokens rather than repeat
 * raw values.
 */

:root {
    color-scheme: light;

    /* Brand palette from the June 2023 R@H brand guide. */
    --rath-color-red: #d90d32;
    --rath-color-red-dark: #a30928;
    --rath-color-yellow: #ecc524;
    --rath-color-green: #00b38d;
    --rath-color-blue: #006eab;
    --rath-color-orange: #dc6529;
    --rath-color-ink: #383334;
    --rath-color-cream: #efeae0;
    --rath-color-paper: #ffffff;

    /* Semantic colour roles. */
    --rath-color-text: var(--rath-color-ink);
    --rath-color-text-muted: #655f60;
    --rath-color-link: var(--rath-color-red);
    --rath-color-link-hover: var(--rath-color-red-dark);
    --rath-color-border: #d8d2c8;
    --rath-color-border-strong: #aca49a;
    --rath-color-focus: var(--rath-color-blue);
    --rath-color-error: #a30928;
    --rath-color-error-soft: #f9e3e7;
    --rath-color-success: #176c58;
    --rath-color-success-soft: #ddf3ed;
    --rath-color-info-soft: #e3f1f7;

    /*
     * Kapra Neue Pro and Brandon Text are the named brand faces. They are not
     * bundled until R@H confirms the web-font licence. The fallbacks preserve
     * the condensed-display / warm-humanist relationship without a network
     * dependency.
     */
    --rath-font-display: "Kapra Neue W05 Bold", "Arial Narrow", "Liberation Sans Narrow",
        "Helvetica Neue", sans-serif;
    --rath-font-body: "Brandon Text W01 Regular", "Avenir Next", Avenir, "Trebuchet MS",
        sans-serif;

    --rath-font-size-xs: 0.8125rem;
    --rath-font-size-sm: 0.9375rem;
    --rath-font-size-body: clamp(1rem, 0.97rem + 0.15vw, 1.125rem);
    --rath-font-size-lead: clamp(1.125rem, 1.03rem + 0.45vw, 1.45rem);
    --rath-font-size-h3: clamp(1.35rem, 1.17rem + 0.9vw, 2rem);
    --rath-font-size-h2: clamp(1.8rem, 1.45rem + 1.75vw, 3.15rem);
    --rath-font-size-h1: clamp(2.5rem, 1.75rem + 3.75vw, 5.25rem);

    --rath-line-height-tight: 0.98;
    --rath-line-height-heading: 1.08;
    --rath-line-height-body: 1.62;
    --rath-line-height-relaxed: 1.75;
    --rath-letter-spacing-display: 0.025em;

    --rath-space-1: 0.25rem;
    --rath-space-2: 0.5rem;
    --rath-space-3: 0.75rem;
    --rath-space-4: 1rem;
    --rath-space-5: 1.5rem;
    --rath-space-6: 2rem;
    --rath-space-7: 3rem;
    --rath-space-8: 4.5rem;
    --rath-space-9: 6.5rem;

    --rath-radius-sm: 0.35rem;
    --rath-radius-md: 0.75rem;
    --rath-radius-lg: 1.4rem;
    --rath-radius-pill: 999px;

    --rath-shadow-sm: 0 0.25rem 0.75rem rgb(56 51 52 / 10%);
    --rath-shadow-md: 0 1rem 2.5rem rgb(56 51 52 / 14%);

    --rath-container-wide: 76rem;
    --rath-container-content: 68rem;
    --rath-measure: 68ch;
    --rath-header-height: 5.25rem;

    --rath-duration-fast: 140ms;
    --rath-duration-medium: 240ms;
    --rath-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
    background: var(--rath-color-ink);
    scroll-behavior: smooth;
    text-size-adjust: 100%;
}

body {
    min-width: 20rem;
    margin: 0;
    background: var(--rath-color-paper);
    color: var(--rath-color-text);
    font-family: var(--rath-font-body);
    font-size: var(--rath-font-size-body);
    line-height: var(--rath-line-height-body);
    text-rendering: optimizeLegibility;
}

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

img,
picture,
svg,
video {
    display: block;
    max-width: 100%;
}

img,
video {
    height: auto;
}

a {
    color: var(--rath-color-link);
    text-decoration-thickness: 0.1em;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--rath-color-link-hover);
}

:focus-visible {
    outline: 0.2rem solid var(--rath-color-focus);
    outline-offset: 0.2rem;
}

::selection {
    background: var(--rath-color-yellow);
    color: var(--rath-color-ink);
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
blockquote,
figure {
    margin-block-start: 0;
}

h1,
h2,
h3,
h4 {
    color: var(--rath-color-ink);
    font-family: var(--rath-font-display);
    font-weight: 700;
    letter-spacing: var(--rath-letter-spacing-display);
    line-height: var(--rath-line-height-heading);
}

h1 {
    font-size: var(--rath-font-size-h1);
}

h2 {
    font-size: var(--rath-font-size-h2);
}

h3 {
    font-size: var(--rath-font-size-h3);
}

p,
li {
    max-width: var(--rath-measure);
}

blockquote {
    max-width: 58ch;
    margin-inline: 0;
    padding-inline-start: var(--rath-space-5);
    border-inline-start: 0.35rem solid var(--rath-color-yellow);
    color: var(--rath-color-ink);
    font-size: var(--rath-font-size-lead);
    font-weight: 600;
}

.rath-skip-link {
    position: fixed;
    inset-block-start: var(--rath-space-3);
    inset-inline-start: var(--rath-space-3);
    z-index: 1000;
    padding: var(--rath-space-3) var(--rath-space-4);
    transform: translateY(-200%);
    border-radius: var(--rath-radius-sm);
    background: var(--rath-color-paper);
    color: var(--rath-color-ink);
    font-weight: 700;
}

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

.rath-container {
    width: min(100% - 2 * var(--rath-space-5), var(--rath-container-content));
    margin-inline: auto;
}

.rath-container--wide {
    width: min(100% - 2 * var(--rath-space-5), var(--rath-container-wide));
}

.rath-stack {
    display: flex;
    flex-direction: column;
}

.rath-stack > * {
    margin-block: 0;
}

.rath-stack > * + * {
    margin-block-start: var(--rath-stack-space, var(--rath-space-5));
}

.rath-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rath-cluster-space, var(--rath-space-4));
    align-items: center;
}

.rath-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, var(--rath-grid-min, 16rem)), 1fr)
    );
    gap: var(--rath-grid-space, var(--rath-space-5));
}

.rath-measure {
    max-width: var(--rath-measure);
}

.rath-lead {
    max-width: 56ch;
    font-size: var(--rath-font-size-lead);
    line-height: 1.5;
}

.rath-eyebrow {
    margin-block-end: var(--rath-space-3);
    color: currentcolor;
    font-family: var(--rath-font-display);
    font-size: var(--rath-font-size-sm);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.rath-heading--display {
    text-transform: uppercase;
}

.rath-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 40rem) {
    :root {
        --rath-header-height: 4.5rem;
    }

    .rath-container,
    .rath-container--wide {
        width: min(100% - 2 * var(--rath-space-4), var(--rath-container-content));
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media (forced-colors: active) {
    :focus-visible {
        outline-color: Highlight;
    }
}
