/* The design language of motor.dev (galadriel's assets/app.css): Futura headings, black rules,
   flat gray shadows, and the Kandinsky palette. Keep the tokens in step with app.css. */

:root {
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    /* Geometric display fonts with a system sans fallback. */
    --font-display: Futura, "Futura PT", "Century Gothic", "URW Gothic", "URW Gothic L", var(--font-sans);
    --tracking-caps: 0.08em;
    --color-text: #111;
    --color-muted: #4a4a4a;
    --color-line: #e4e4e4;
    --color-surface: #f2f2f2;
    --color-field: #fff;
    --color-background: #fefefe;
    /* The gray shadow of buttons and raised panels. */
    --shadow: 0.25rem 0.25rem 0 var(--color-line);

    /* Kandinsky palette. Contrast ratios: against background, white, and --color-text.
       WCAG AA minimums: 4.5:1 for text; 3:1 for lines, borders, and icons. */
    --color-cobalt: #1c4ba0;         /* 8.1:1, white 8.2:1, text 2.3:1 */
    --color-turquoise: #1a7f86;      /* 4.7:1, white 4.8:1, text 4.0:1 */
    --color-violet: #5b3a8e;         /* 8.5:1, white 8.6:1, text 2.2:1 */
    --color-rose-madder: #b8285f;    /* 5.9:1, white 6.0:1, text 3.2:1 */
    --color-vermilion: #e34234;      /* 4.1:1, white 4.1:1, text 4.6:1 */
    --color-cadmium-yellow: #f2c12e; /* 1.7:1, white 1.7:1, text 11.2:1: only for fills under dark text */

    /* Links are bold, cobalt, and underlined. Cobalt is only 2.3:1 with --color-text, so the
       underline, not the color, marks a link in a paragraph (WCAG 1.4.1). */
    --color-link: var(--color-cobalt);
    --color-link-hover: #2563d3;
}

html {
    scroll-padding-top: 1.5rem;
    /* Every page keeps space for the scrollbar, so short pages and long pages have the same frame. */
    scrollbar-gutter: stable;
}

body {
    margin: 0 auto;
    max-width: 52rem;
    padding: 1.5rem;
    font-family: var(--font-sans);
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-background);
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    /* Futura has no semibold; use medium. */
    font-weight: 500;
    line-height: 1.15;
}

h1 {
    font-size: 2.5rem;
    line-height: 1.35;
}

h2 {
    margin: 2.5rem 0 1rem;
    font-size: 1.75rem;
}

h3 {
    margin: 1.75rem 0 0.5rem;
    font-size: 1.125rem;
}

h4 {
    margin: 1.5rem 0 0.5rem;
    font-size: 1rem;
}

/* The first paragraph after the title of a page leads into it. */
main > h1 + p {
    font-size: 1.1875rem;
    line-height: 1.55;
}

/* Keep the landing page prose and benefits at Motor's reading size. */
.index main > p,
.index main > ul {
    font-size: 1.1875rem;
    line-height: 1.55;
}

li + li {
    margin-top: 0.375rem;
}

a {
    color: var(--color-link);
    font-weight: 600;
    text-decoration-line: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.25em;
    transition: color 150ms ease;
}

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

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

/* A heading that links to itself keeps the color of the text. */
h2 a,
h3 a {
    color: inherit;
}

/* The logo and the main navigation. */
body > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 3rem;
}

/* The logo keeps the color of the text, without an underline. */
.logo {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--color-text);
    text-decoration-line: none;
    font: 500 2rem/1 var(--font-display);
}

.logo svg {
    display: block;
    height: 2rem;
    width: auto;
}

.logo .cutout {
    fill: var(--color-background);
}

body > header ul {
    display: flex;
    align-items: baseline;
    gap: 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

body > header li + li {
    margin-top: 0;
}

body > header nav a {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 500;
    white-space: nowrap;
}

/* The link of the page that is open is black, without an underline. */
body > header nav a[aria-current="page"],
body > footer a[aria-current="page"] {
    color: var(--color-text);
    text-decoration-line: none;
}

/* The copyright line and the footer links. */
body > footer {
    margin-top: 3rem;
    color: var(--color-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0 1.25rem;
}

body > footer ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

body > footer li + li {
    margin-top: 0;
}

body > footer a {
    font-weight: 500;
}

/* Code: mono text, and a block of code on the gray surface with a black rule at the left. */
code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

pre {
    margin: 0.75rem 0 1.25rem;
    padding: 0.875rem 1rem;
    overflow-x: auto;
    border-left: 4px solid var(--color-text);
    background: var(--color-surface);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.55;
}

pre code {
    font-size: inherit;
}

/* A quotation or a note: the text on the gray surface, with a turquoise rule at the left. */
blockquote {
    margin: 1.25rem 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--color-turquoise);
    background: var(--color-surface);
}

blockquote > :first-child {
    margin-top: 0;
}

blockquote > :last-child {
    margin-bottom: 0;
}

table {
    width: 100%;
    margin: 0 0 1rem;
    border-collapse: collapse;
}

/* A wide table scrolls on its own, so the page doesn't scroll sideways. */
@media (max-width: 40rem) {
    table {
        display: block;
        overflow-x: auto;
    }
}

th,
td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-line);
    text-align: left;
    vertical-align: baseline;
}

th {
    border-bottom: 2px solid var(--color-text);
    font: 500 0.75rem var(--font-display);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--color-muted);
}

hr {
    margin: 2.5rem 0;
    border: 0;
    border-top: 2px solid var(--color-text);
}

img {
    max-width: 100%;
}

/* A band of tiles that tiles.js draws: `<div class="tiles rotors" aria-hidden="true"></div>` for
   rotors, or `class="tiles shapes"` for simple shapes. The band reserves its space, so the page
   doesn't shift when the tiles are drawn. */
.tiles {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    aspect-ratio: 12 / 1;
    margin-bottom: 2.5rem;
    border: 2px solid var(--color-text);
    overflow: hidden;
}

.tiles svg {
    display: block;
    width: 100%;
    height: 100%;
}

.tiles + h1 {
    margin-top: 0;
}

/* Half-height shape band; clip tiles beyond the first row. */
.tiles.shapes {
    grid-template-columns: repeat(24, 1fr);
    grid-auto-rows: 100%;
    aspect-ratio: 24 / 1;
    margin: 2.5rem 0 0;
}

@media (max-width: 40rem) {
    .tiles {
        grid-template-columns: repeat(6, 1fr);
        aspect-ratio: 6 / 2;
    }

    .tiles.shapes {
        grid-template-columns: repeat(12, 1fr);
        aspect-ratio: 12 / 1;
    }

    h1 {
        font-size: 2rem;
    }

}


/* Repository URLs and agent instructions must fit narrow screens. */
p code {
    overflow-wrap: anywhere;
}

pre:has(code.language-text) {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.button {
    display: inline-block;
    padding: 0.625rem 1rem;
    border: 2px solid var(--color-text);
    background: var(--color-field);
    color: var(--color-text);
    box-shadow: var(--shadow);
    font-family: var(--font-display);
    font-weight: 500;
    text-decoration: none;
}

.button:hover {
    background: var(--color-surface);
}
