/*
 * Layout and components, mobile-first. Colours, fonts and spacing come from tokens.css only.
 */

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

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

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background: var(--color-background);
    color: var(--color-text);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    overflow-wrap: break-word;
}

img,
svg,
video {
    max-width: 100%;
    height: auto;
}

h1,
h2,
h3 {
    margin: 0 0 var(--space-3);
    color: var(--color-primary);
    font-family: var(--font-family-heading);
    font-weight: var(--font-weight-heading);
    line-height: var(--line-height-heading);
}

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

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

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

a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

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

code {
    overflow-wrap: anywhere;
}

/* Visible focus on every interactive element */
:focus-visible {
    outline: var(--focus-width) solid var(--color-focus);
    outline-offset: 2px;
}

/* Skip link: the first tab stop, visible when focused */
.skip-link {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 10;
    padding: var(--space-2) var(--space-3);
    background: var(--color-background);
    color: var(--color-primary);
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

/* The focused skip link sits on the dark header */
.skip-link:focus-visible {
    outline-color: var(--color-focus-on-dark);
}

/* Page layout */
.container {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--space-3);
}

.site-header {
    border-bottom: var(--accent-bar-width) solid var(--color-accent); /* decorative brand bar */
    background: var(--color-dark);
    color: var(--color-on-dark);
}

.site-header .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-3);
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
}

.site-header__logo {
    display: inline-flex;
    min-height: 24px;
}

.site-header__logo img {
    display: block;
    width: 128px;
}

main {
    flex: 1 0 auto;
    padding-top: var(--space-5);
    padding-bottom: var(--space-6);
}

main:focus {
    outline: none;
}

.site-footer {
    background: var(--color-dark);
    color: var(--color-on-dark);
    font-size: var(--font-size-small);
}

/* Header and footer are dark sections: white links, orange hover and focus ring */
.site-header a,
.site-footer a {
    color: var(--color-on-dark);
}

.site-header a:hover,
.site-footer a:hover {
    color: var(--color-on-dark-hover);
}

.site-header :focus-visible,
.site-footer :focus-visible {
    outline-color: var(--color-focus-on-dark);
}

.site-footer .container {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
}

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Links in navigation get a touch target of at least 24x24px (WCAG 2.2, 2.5.8) */
.site-footer__links a,
.language-switcher a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    min-width: 24px;
}

/* Components */

/* Button: <button class="button"> or <a class="button">; .button--secondary for the outlined variant */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    max-width: 100%;
    padding: var(--space-2) var(--space-4);
    border: var(--border-width) solid var(--color-accent);
    border-radius: var(--radius);
    background: var(--color-accent);
    color: var(--color-on-accent);
    font: inherit;
    font-weight: var(--font-weight-bold);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.button--secondary {
    border-color: var(--color-primary);
    background: var(--color-background);
    color: var(--color-primary);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/*
 * Form field:
 * <div class="field"><label class="field__label" for="x">…</label>
 * <p class="field__help" id="x-help">…</p><input class="field__input" id="x" aria-describedby="x-help x-error">
 * <p class="field__error" id="x-error">…</p></div>
 * .field--invalid on the wrapper when the value is rejected.
 */
.field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
}

.field__label {
    font-weight: var(--font-weight-bold);
}

.field__help {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-small);
}

.field__input {
    width: 100%;
    max-width: 32rem;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-background);
    color: var(--color-text);
    font: inherit;
}

.field__error {
    margin: 0;
    color: var(--color-error);
    font-weight: var(--font-weight-bold);
}

.field--invalid .field__input {
    border: 2px solid var(--color-error);
}

/* Checkbox: <div class="checkbox"><input type="checkbox" id="x"><label for="x">…</label></div> */
.checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.checkbox input {
    flex: none;
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: var(--color-primary);
}

.checkbox label {
    min-height: 24px;
}

/* Notice: <div class="notice notice--info|success|error" role="status|alert"> */
.notice {
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    border-left: 4px solid var(--color-info);
    border-radius: var(--radius);
    background: var(--color-info-surface);
    color: var(--color-text);
}

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

.notice--success {
    border-left-color: var(--color-success);
    background: var(--color-success-surface);
}

.notice--error {
    border-left-color: var(--color-error);
    background: var(--color-error-surface);
}

/* Hidden on screen, still read by screen readers */
.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;
}

/* Whitepaper landing page: one column on small screens, the image column only from 48rem up */
.whitepaper__media {
    display: none;
}

.whitepaper__image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}

/* The title is large text (--font-size-h1), so the 3:1 of --color-accent-large-text is enough */
.whitepaper h1 {
    color: var(--color-accent-large-text);
}

/* Thank-you page: one column at every width, in source order: title, text, button or expired notice, xuntos.nl link */
.whitepaper--thanks {
    max-width: var(--reading-max-width);
}

/* Marketing's exact brand orange, the documented contrast exception (see --color-title-thanks) */
.whitepaper--thanks h1 {
    color: var(--color-title-thanks);
}

/* Lead form */
.whitepaper__form {
    margin-top: var(--space-6);
}

/* The required marker after a label; hidden from screen readers, which announce the input's required attribute */
.field__required {
    color: var(--color-error);
    font-weight: var(--font-weight-bold);
}

.lead-form__required-notice {
    margin: 0 0 var(--space-4);
    color: var(--color-text-muted);
    font-size: var(--font-size-small);
}

.lead-form__consent {
    margin-bottom: var(--space-4);
}

.lead-form__consent .checkbox {
    margin-bottom: var(--space-1);
}

/* The honeypot: off-screen rather than display:none, which some bots skip */
.lead-form__website {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.lead-form__notice {
    margin-top: var(--space-4);
    color: var(--color-text-muted);
    font-size: var(--font-size-small);
}

@media (min-width: 48rem) {
    main {
        padding-top: var(--space-6);
    }

    .whitepaper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-6);
        align-items: start;
    }

    .whitepaper__media {
        display: block;
    }

    .whitepaper--thanks {
        display: block;
    }
}

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