/*
 * carl-topham.com app theme, v1.
 * A framework-free stylesheet that gives an app site the look of carl-topham.com: Quicksand, the red/mint palette,
 * square corners, and light/dark mode.
 *
 * Use:   <link rel="stylesheet" href="https://carl-topham.com/app-theme/v1/theme.css">
 * Brand: override --accent (and optionally --accent-hover / --accent-contrast) after the link, e.g.
 *        :root { --accent: #0a84ff; --accent-hover: #0066cc; --accent-contrast: #fff; }
 * Dark:  follows the OS by default. Force a mode with class="light" or class="dark" on <html>.
 *        A plain :root override applies in both modes; to set a different dark accent, repeat it inside
 *        @media (prefers-color-scheme: dark) { :root { --accent: ...; } }
 *
 * v1 only gets compatible changes. Breaking changes ship as /app-theme/v2/.
 */

@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url('./fonts/quicksand-latin-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url('./fonts/quicksand-latin-500.woff2') format('woff2');
}
@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-display: swap;
    font-weight: 600;
    src: url('./fonts/quicksand-latin-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Quicksand';
    font-style: normal;
    font-display: swap;
    font-weight: 700;
    src: url('./fonts/quicksand-latin-700.woff2') format('woff2');
}

/* ---------- tokens ---------- */
:where(:root) {
    color-scheme: light dark;

    --font: 'Quicksand', system-ui, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --radius: 0;
    --content-width: 900px;
    --wide-width: 1200px;

    --accent: #e8002f;
    --accent-hover: #cc0429;
    --accent-contrast: #fff;
    --secondary: #05ffd0;
    --secondary-contrast: #181818;

    --text: rgba(0, 0, 0, 0.87);
    --text-muted: #616161;
    --bg: #fff;
    --bg-alt: #f1f1f1;
    --divider: rgba(0, 0, 0, 0.12);
    --hover: rgba(0, 0, 0, 0.04);
    --mark: #ffebee;
    --code-bg: #282c34;
    --code-text: #abb2bf;
    --header-bg: #fff;
    --header-text: #222;
}

@media (prefers-color-scheme: dark) {
    :where(:root:not(.light)) {
        --accent: #ff5978;
        --accent-hover: #ff2d55;
        --accent-contrast: #181818;
        --text: #efefef;
        --text-muted: #bdbdbd;
        --bg: #282828;
        --bg-alt: #424242;
        --divider: rgba(255, 255, 255, 0.12);
        --hover: rgba(255, 255, 255, 0.08);
        --mark: rgba(255, 5, 52, 0.35);
        --code-bg: #353535;
        --header-bg: #121212;
        --header-text: #efefef;
    }
}
:where(:root.dark) {
    --accent: #ff5978;
    --accent-hover: #ff2d55;
    --accent-contrast: #181818;
    --text: #efefef;
    --text-muted: #bdbdbd;
    --bg: #282828;
    --bg-alt: #424242;
    --divider: rgba(255, 255, 255, 0.12);
    --hover: rgba(255, 255, 255, 0.08);
    --mark: rgba(255, 5, 52, 0.35);
    --code-bg: #353535;
    --header-bg: #121212;
    --header-text: #efefef;
}

/* ---------- base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}
html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    letter-spacing: 0.00938em;
    color: var(--text);
    background: var(--bg);
}
img,
svg,
video {
    max-width: 100%;
    height: auto;
}
[hidden] {
    display: none !important;
}
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
::selection {
    background: var(--mark);
}

/* ---------- typography ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 1.25em;
    font-weight: 400;
}
h1 {
    font-size: 1.25rem;
    line-height: 1.167;
}
h2 {
    font-size: 1.5rem;
    line-height: 1.2;
}
h3 {
    font-size: 1.375rem;
    line-height: 1.167;
}
h4 {
    font-size: 1.3125rem;
    line-height: 1.235;
}
h5,
h6 {
    font-size: 1.125rem;
    line-height: 1.334;
}
@media (min-width: 600px) {
    h1 {
        font-size: 3rem;
    }
    h2 {
        font-size: 2rem;
    }
    h3 {
        font-size: 1.75rem;
    }
}
p,
ul,
ol,
dl,
blockquote,
pre,
table,
figure {
    margin: 0 0 1.25em;
}
ul,
ol {
    padding-left: 1.5em;
}
li + li {
    margin-top: 0.25em;
}
strong,
b {
    font-weight: 700;
}
small,
.muted {
    color: var(--text-muted);
}
mark {
    background: var(--mark);
    color: inherit;
}
hr {
    border: 0;
    border-top: 1px solid var(--divider);
    margin: 2em 0;
}
a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
    text-underline-offset: 0.15em;
}
a:hover {
    text-decoration-color: currentColor;
}
blockquote {
    padding: 0.25em 0 0.25em 1em;
    border-left: 4px solid var(--accent);
    color: var(--text-muted);
}
blockquote > :last-child {
    margin-bottom: 0;
}
code,
kbd,
pre {
    font-family: var(--mono);
    font-size: 0.9em;
}
:not(pre) > code,
kbd {
    padding: 0.1em 0.35em;
    background: var(--bg-alt);
    border-radius: var(--radius);
}
pre {
    padding: 1em;
    overflow-x: auto;
    background: var(--code-bg);
    color: var(--code-text);
    border-radius: var(--radius);
}
table {
    width: 100%;
    border-collapse: collapse;
}
th,
td {
    padding: 0.6em 0.8em;
    text-align: left;
    border-bottom: 1px solid var(--divider);
}
th {
    font-weight: 600;
}

/* ---------- layout ---------- */
.container {
    width: 100%;
    max-width: var(--content-width);
    margin-inline: auto;
    padding-inline: 1rem;
}
.container-wide {
    max-width: var(--wide-width);
}
@media (min-width: 600px) {
    .container {
        padding-inline: 1.5rem;
    }
}
.section {
    padding-block: 3rem;
}
.section-alt {
    background: var(--bg-alt);
}
.stack > * + * {
    margin-top: 1rem;
}
.grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ---------- header / footer ---------- */
.site-header {
    background: var(--header-bg);
    color: var(--header-text);
    border-bottom: 1px solid var(--divider);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 64px;
}
.site-header a {
    color: inherit;
    text-decoration: none;
}
.site-header .brand {
    font-weight: 600;
    font-size: 1.25rem;
}
.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}
.site-header nav a:hover {
    color: var(--accent);
}
.site-footer {
    padding-block: 2rem;
    background: var(--bg-alt);
    color: var(--text-muted);
    font-size: 0.9rem;
}
.site-footer a {
    color: inherit;
}
.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

/* ---------- components ---------- */
.hero {
    padding-block: 4rem;
    text-align: center;
}
.hero h1 {
    margin-bottom: 0.5em;
}
.hero p {
    max-width: 38em;
    margin-inline: auto;
    color: var(--text-muted);
    font-size: 1.125rem;
}
.hero .actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.button {
    display: inline-block;
    padding: 0.6em 1.4em;
    font: inherit;
    font-weight: 500;
    line-height: 1.5;
    color: var(--accent-contrast);
    background: var(--accent);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
}
.button:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.button-outline {
    color: var(--accent);
    background: transparent;
}
.button-outline:hover {
    color: var(--accent-contrast);
}
.card {
    padding: 1.5rem;
    background: var(--bg);
    border: 1px solid var(--divider);
    border-radius: var(--radius);
}
.section-alt .card {
    border-color: transparent;
}
.card > :last-child {
    margin-bottom: 0;
}
.chip {
    display: inline-block;
    padding: 0.15em 0.75em;
    font-size: 0.85rem;
    background: var(--bg-alt);
    border-radius: 999px;
}
