/* =============================================================================
   Element defaults - how plain HTML looks before any class is applied.
   -----------------------------------------------------------------------------
   This is the global font style. Anything written as ordinary markup in a page
   template inherits from here, so content files stay free of styling classes.
   ============================================================================= */

body {
    background-color: var(--color-background);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-base);
    letter-spacing: var(--letter-spacing-base);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main {
    flex: 1 0 auto;
}

/* --- Headings ----------------------------------------------------------------
   Sizes are fluid (see tokens.css), so there are no media queries here.
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-heading);
    color: var(--color-heading);
    text-wrap: balance;
}

h1 {
    font-size: var(--font-size-h1);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
}

h2 {
    font-size: var(--font-size-h2);
    letter-spacing: var(--letter-spacing-tight);
}

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

h5,
h6 {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
}

/* --- Running text ------------------------------------------------------------
   Spacing lives on the bottom only, so the first element in a container never
   pushes it open.
   -------------------------------------------------------------------------- */
p,
ul:not([class]),
ol:not([class]),
dl,
figure,
table,
blockquote {
    margin-block: 0 var(--space-sm);
}

ul:not([class]),
ol:not([class]) {
    padding-inline-start: var(--space-md);
}

ul:not([class]) li,
ol:not([class]) li {
    margin-block-end: var(--space-2xs);
}

/* Intro paragraph, one step up from body text. */
.lead {
    font-size: var(--font-size-lead);
    line-height: 1.5;
    color: var(--color-text);
}

small,
.text-sm {
    font-size: var(--font-size-sm);
}

strong,
b {
    font-weight: var(--font-weight-semibold);
}

blockquote {
    padding-inline-start: var(--space-md);
    border-inline-start: 3px solid var(--color-accent);
    color: var(--color-text-muted);
}

/* --- Links -------------------------------------------------------------------
   Underlined by default: on a medical site a link has to be recognisable
   without relying on colour alone.
   -------------------------------------------------------------------------- */
a {
    color: var(--color-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
    transition: color var(--transition-fast);
}

a:hover,
a:focus-visible {
    color: var(--color-link-hover);
}

/* Long URLs in legal text must not blow out the layout. */
a[href^='http'],
a[href^='mailto:'] {
    overflow-wrap: anywhere;
}

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

::selection {
    background-color: var(--color-accent);
    color: var(--color-blue);
}

hr {
    border: 0;
    border-top: var(--border-width) solid var(--color-line);
    margin-block: var(--space-lg);
}

/* --- Tables ------------------------------------------------------------------ */
th,
td {
    text-align: start;
    padding: var(--space-2xs) var(--space-sm);
    border-bottom: var(--border-width) solid var(--color-line);
}

th {
    font-weight: var(--font-weight-semibold);
    color: var(--color-heading);
}

/* --- Addresses ---------------------------------------------------------------
   <address> is the correct element for contact blocks in the Impressum;
   browsers italicise it by default, which we do not want.
   -------------------------------------------------------------------------- */
address {
    font-style: normal;
}
