/* Theme */
:root {
    --bg: oklch(96.7% 0.001 286.375) /* Zinc-100 */;
    --bg-highlight:oklch(92% 0.004 286.32) /* Zinc-200 */;
    --fg:  oklch(21% 0.006 285.885) /* Zinc-900 */;
    --muted: oklch(27.4% 0.006 286.033) /* Zinc-800 */;
    --border: oklch(87.1% 0.006 286.286) /* Zinc-300 */;
    --highlight: oklch(47% 0.157 37.304) /* Orange-800 */;
    --link: oklch(43.2% 0.232 292.759); /* Violet-800 */;
    --shadow: oklch(21% 0.006 285.885 / 0.1) /* Zinc-900 */;
    font-size: 18px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: oklch(21% 0.006 285.885) /* Zinc-900 */;
        --bg-highlight: oklch(27.4% 0.006 286.033) /* Zinc-800 */;
        --fg: oklch(96.7% 0.001 286.375) /* Zinc-100 */;
        --muted: oklch(92.3% 0.003 48.717) /* Zinc-200 */;
        --border: oklch(37% 0.013 285.805) /* Zinc-300 */;
        --highlight: oklch(81.1% 0.111 293.571) /* Violet-300 */;
        --link: oklch(83.7% 0.128 66.29) /* Orange-300 */;
        --shadow: oklch(96.7% 0.001 286.375 / 0.1) /* Zinc-100 */;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html,
body {
    height: 100%;
}
body {
    font-family: "IBM Plex Sans", sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
}

a {
    color: var(--fg);
    text-decoration: none;
}
a:hover {
    color: var(--link);
}
a:visited {
    color: var(--fg);
}

h1, h2, h3, h4, h5, h6 {
    font-family: "IBM Plex Sans Condensed", system-ui, sans-serif;
}

pre, code {
    font-family: "IBM Plex Mono", monospace;
}

svg {
    height: 1em;
    width: 1em;
    line-height: 1em;
}
/* Layout utilities */
.container {
    width: min(780px, calc(100% - 2rem));
    margin-inline: auto;
}

.spacer {
    flex-grow: 1;
}
.muted {
    color: var(--muted);
}

/* Header */
body > header {
    position: sticky;
    top: 0;
    backdrop-filter: blur(15px);
    background: color-mix(in srgb, var(--bg-highlight) 60%, transparent);
    box-shadow: 0 0 4px var(--shadow);
    z-index: 1; /* ensure header is above content */
}
body > header > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}
.brand {
    font-family: "IBM Plex Sans Condensed", sans-serif;
    font-weight: 600;
    font-size: 1.5rem;
    white-space: nowrap;
    background-image: linear-gradient(110deg, var(--link), var(--highlight));
    background-clip: text;
    color: transparent;
    transition: color 0.2s ease, transform 0.2s ease;
}
.brand:hover {
    color: var(--link);
    transform: translateY(-2px);
}

body > header a {
    text-decoration: none;
    line-height: 3rem;
    padding: 0.3rem 0rem;
}

nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: nowrap;
    flex-shrink: 2;
}
nav a {
    border-top: 0.3rem solid transparent;
    border-bottom: 0.3rem solid transparent;
    transition: border-color 0.2s ease;
}
nav a:hover,
nav a.active {
    color: var(--link);
    border-bottom: 0.3rem solid var(--link);
}
nav a > span {
    display: inline-block;
    transition: transform 0.2s ease;
}
nav a:hover > span {
    transform: translateY(-2px);
}
.icon-link {
    font-size: calc(4/3 * 1rem);
    display: flex;
    align-items: center;
    transition: color 0.2s ease, transform 0.2s ease;
}
.icon-link:hover {
    transform: rotate(3deg) scale(1.08);
}
/* Mobile menu toggle */
.menu-state {
    display: none;
}
.menu-toggle {
    display: none;
    background: none;
    cursor: pointer;
    padding: 0.5rem 0;
}
.menu-toggle:hover {
    transform: scale(1.06);
}
.menu-toggle:hover .menu-bar {
    background: var(--link);
}
.menu-toggle .menu-bar {
    display: block;
    width: calc(4/3 * 1rem);
    height: 2px;
    background: var(--fg);
    margin: 6px 0;
    transform-origin: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-state:checked + .menu-toggle .menu-bar:first-child {
    transform: translateY(4px) rotate(45deg);
}
.menu-state:checked + .menu-toggle .menu-bar:last-child {
    transform: translateY(-4px) rotate(-45deg);
}

/* Main content */
main.container {
    margin-top: 2rem;
    padding-bottom: 2rem;
}

.hero.with-image {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.hero-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    box-shadow: 0 0 4px var(--shadow);
}
.hero-image:hover {
    transform: rotate(3deg) scale(1.03);
}
.hero-text {
    min-width: 0;
}
.hero-title {
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    line-height: 1.15;
    margin: 0 0 0.35rem 0;
}
.hero-subtitle {
    margin: 0;
    color: var(--muted);
    max-width: 60ch;
}
.social-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-size: calc(4/3 * 1rem);
}
.social-links a {
    color: var(--muted);
    transition: color 0.2s ease, transform 0.2s ease;
    transform-origin: center;
    padding: 0;
    line-height: 1;
}
.social-links a:hover {
    color: var(--link);
    transform: rotate(360deg);
}
/* make it a bit silly */
.social-links a:hover:nth-of-type(odd) {
    transform: rotate(-360deg);
}

/* Page header */
.page-header {
    margin-bottom: 2rem;
}
.page-subtitle {
    color: var(--muted);
}
.page-meta {
    margin-top: 0.5em;
}

/* Meta data element */
.meta {
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2em 1em;
    margin: 0.2em 0;
    font-family: "IBM Plex Sans", sans-serif;
}

.meta > span {
    display: inline-flex;
    align-items: center;
}

/* Prose */
.prose {
    font-family: "IBM Plex Serif", serif;
    margin-top: 1.5rem;
}
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    margin: 1em 0 0.25em 0;
}
.prose p {
    margin: 0.8em 0;
}
.prose a {
    text-decoration: none;
    border-bottom: 2px dotted var(--link);
}
.prose a:hover {
    color: var(--link);
    border-bottom: 2px solid var(--link);
}

.prose pre {
    padding: 0.75rem;
    border-radius: 5px;
    background: color-mix(in srgb, var(--bg-highlight) 60%, transparent);
}

.prose sup {
    line-height: 1;
}
.prose blockquote {
    margin: 0 0 0 1.6em;
}

.prose .footnotes {
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    margin-top: 2em;
    padding-top: 1em;
}

.prose .footnotes ol {
    counter-reset: footnote;
    list-style: none;
    padding-left: 0;
}
.prose .footnotes ol > li {
    counter-increment: footnote;
    position: relative;
    padding-left: 1.4em;
}
.prose .footnotes ol > li::before {
    content: counter(footnote);
    position: absolute;
    left: 0;
    top: 0;
    font-size: 0.75em;
    line-height: 1;
}
/* Special treatment for footnotes and back references */
.prose .footnotes a[href^="#"],
.prose .footnote-reference a {
    display: inline-block;
    color: var(--link);
    border: none;
    transition: transform 0.2s ease;
}
.prose .footnotes a[href^="#"]:hover {
    transform: translateX(-2px);
}
.prose .footnote-reference a:hover {
    transform: translateY(-2px);
}

/* Section article list */
.article-list {
    list-style: none;
    padding: 0;
}
.article-list h2 {
    margin: 0.2em 0 ;
    font-size: 1.1rem;
}
.article-list h2 + p {
    margin-top: 0;
    font-size: 0.9rem;
}
.article-list .type {
    color: var(--highlight);
    margin: 0;
    font-size: 0.9rem;
    font-family: "IBM Plex Sans", sans-serif;
}

/* Search */
#search-input {
    width: 100%;
    padding: 0.75em 1em;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--fg);
    background: var(--bg-highlight);
    outline: none;
    font-size: inherit;
}
#search-input:focus {
    border-color: color-mix(in srgb, var(--highlight) 50%, var(--border));
}
#search-results {
    margin: 1rem 0 0;
    display: grid;
    gap: 0.6rem;
}
#search-results li {
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--border);
}
#search-results a {
    font-weight: 650;
    color: var(--fg);
}
#search-results p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

/* Responsive */
@media (max-width: 720px) {
    body > header {
        position: relative;
    }
    body > header > div {
        flex-wrap: wrap;
        gap: 0 1.5rem;
    }
    /* Expandable menu */
    .menu-toggle {
        display: block;
        order: 2;
    }
    nav {
        display: flex;
        width: 100%;
        flex-direction: column;
        padding: 0;
        order: 3;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.2s ease, opacity 0.2s ease;
    }
    .menu-state:checked ~ nav {
        max-height: 18rem;
        opacity: 1;
    }
    /* Header and nav bar in vertical mode */
    nav a:hover,
    nav a.active {
        border-bottom-color: transparent; /* No underline */
    }
    .brand:hover,
    nav a:hover > span {
        transform: translateX(2px); /* Horizontal movement */
    }
}

/* Reduce motions */
@media (prefers-reduced-motion: reduce) {
    * {
        .hero-image:hover,
        .social-links a:hover,
        .social-links a:hover:nth-of-type(odd) {
            transform: none; /* No silly spinning */
        }
    }
}
