/* AdLoop Manager. Tokens and components: DESIGN.md at the repository root. */

:root {
    color-scheme: light dark;
    --bg: #ffffff;
    --surface: #f4f5f7;
    --text: #1a1d23;
    --muted: #4b5363;
    --border: #6b7280;
    --accent: #1d4ed8;
    --on-accent: #ffffff;
    --focus: #1d4ed8;
    --error-bg: #fdecec;
    --error-text: #8a1c1c;
    --error-border: #b42318;
    --info-bg: #eef3ff;
    --info-text: #1e3a8a;
    --info-border: #1d4ed8;
    --warn-bg: #fff4e5;
    --warn-text: #7a3e00;
    --warn-border: #b45309;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2rem;
    --space-6: 3rem;
    --radius: 0.375rem;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151a;
        --surface: #1c2028;
        --text: #e8eaed;
        --muted: #aab2bf;
        --border: #8b93a1;
        --accent: #8ab4ff;
        --on-accent: #0b1220;
        --focus: #8ab4ff;
        --error-bg: #3a1517;
        --error-text: #ffd7d5;
        --error-border: #ff8a80;
        --info-bg: #16233d;
        --info-text: #d6e4ff;
        --info-border: #8ab4ff;
        --warn-bg: #33240f;
        --warn-text: #ffe2b8;
        --warn-border: #f5a524;
    }
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    /* A long e-mail address breaks instead of making the page scroll sideways. */
    overflow-wrap: break-word;
}

h1 { font-size: 1.75rem; line-height: 1.25; margin: 0 0 var(--space-3); }
h2 { font-size: 1.25rem; line-height: 1.3; margin: var(--space-5) 0 var(--space-2); }
p, ol, ul { margin: 0 0 var(--space-3); }
small, .muted { color: var(--muted); }
small { font-size: 0.875rem; }
a { color: var(--accent); }
code {
    font-family: var(--mono);
    font-size: 0.9375rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 var(--space-1);
    overflow-wrap: anywhere;
}

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

/* Page shell */
.skip-link {
    position: absolute;
    left: var(--space-3);
    top: -4rem;
    background: var(--bg);
    color: var(--accent);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 1;
}
.skip-link:focus { top: var(--space-3); }

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-3);
    border-bottom: 1px solid var(--border);
}
.site-name { font-weight: 600; }

main {
    max-width: 40rem;
    margin: 0 auto;
    padding: var(--space-5) var(--space-3) var(--space-6);
}
main:focus { outline: none; }
main.wide { max-width: 72rem; }

/* Main navigation: the current page has aria-current="page", a heavier weight and an underline */
.site-nav ul { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); list-style: none; margin: 0; padding: 0; }
.site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0 var(--space-1);
    text-decoration: none;
}
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] {
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-underline-offset: 0.375rem;
}

/* Button: a link or a button element */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: var(--space-2) var(--space-4);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: filter 120ms ease;
}
.button:hover { filter: brightness(1.1); }
.button-secondary { background: transparent; color: var(--accent); }
.button-danger { background: var(--error-border); border-color: var(--error-border); color: var(--on-accent); }
.button-row { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); }
.button-row form { margin: 0; }

/* Notice: the text says what kind it is, the colour only repeats it */
.notice {
    border: 1px solid var(--info-border);
    border-left-width: 4px;
    border-radius: var(--radius);
    background: var(--info-bg);
    color: var(--info-text);
    padding: var(--space-3);
    margin: 0 0 var(--space-4);
}
.notice-error {
    border-color: var(--error-border);
    background: var(--error-bg);
    color: var(--error-text);
}
.notice-warning {
    border-color: var(--warn-border);
    background: var(--warn-bg);
    color: var(--warn-text);
}
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.notice a { color: inherit; }

/* Form fields: label, then hint, then error text, then the control */
.form { margin: 0 0 var(--space-5); }
.field { margin: 0 0 var(--space-4); }
.field > label, .field-label { display: block; font-weight: 600; margin-bottom: var(--space-1); }
.hint { display: block; color: var(--muted); font-size: 0.875rem; margin-bottom: var(--space-1); }
.field-error { display: block; color: var(--error-text); background: var(--error-bg); border-left: 4px solid var(--error-border); padding: 0 var(--space-2); margin-bottom: var(--space-1); font-weight: 600; }
.input {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 2.75rem;
    padding: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font: inherit;
}
.input-short { max-width: 12rem; }
textarea.input { font-family: var(--mono); min-height: 8rem; resize: vertical; }
.input[aria-invalid="true"] { border: 2px solid var(--error-border); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 var(--space-4); padding: var(--space-3); min-width: 0; }
legend { font-weight: 600; padding: 0 var(--space-1); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 var(--space-3); }

/* Check box and switch rows: the box and its label (the label also selects the box) */
.check-row { display: flex; align-items: flex-start; gap: var(--space-2); margin: 0 0 var(--space-3); }
.check-row input { width: 1.25rem; height: 1.25rem; margin: 0.125rem 0 0; flex: none; accent-color: var(--accent); }
.check-row label { min-height: 1.5rem; }
.check-row .hint { margin: 0; }
.check-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; }

/* Data table: wide tables scroll inside their own region, never the page */
.table-wrap { overflow-x: auto; margin: 0 0 var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
caption { text-align: left; font-weight: 600; padding: var(--space-2) var(--space-3); }
th, td { text-align: left; vertical-align: top; padding: var(--space-2) var(--space-3); border-top: 1px solid var(--border); }
thead th { background: var(--surface); white-space: nowrap; }
td .button-row { margin-top: 0; }
td.data { font-family: var(--mono); font-size: 0.875rem; overflow-wrap: anywhere; min-width: 12rem; }
.nowrap { white-space: nowrap; }

/* Description list for values, e.g. the health of the service */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-4); margin: 0 0 var(--space-4); }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* Pagination: previous and next links with the page number between them */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

.steps li { margin-bottom: var(--space-2); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
