:root {
    --ink: #1c2430;
    --muted: #5c6570;
    --line: #e3ddd2;
    --paper: #f4f1ea;
    --surface: #fffcf8;
    --accent: #0c6b63;
    --accent-dark: #084f49;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: system-ui, "Segoe UI", sans-serif;
    font-size: 1.0625rem;
    line-height: 1.6;
}

.wrap {
    width: min(40rem, calc(100% - 4rem));
    margin: 0 auto;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.1rem 0;
}

.brand {
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}

nav {
    display: flex;
    gap: 1.25rem;
}

nav a {
    color: var(--muted);
    text-decoration: none;
}

nav a[aria-current="page"],
nav a:hover {
    color: var(--accent-dark);
}

main {
    padding: 3rem 0 4rem;
}

h1 {
    margin: 0 0 0.75rem;
    font-size: 2.25rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

h2 {
    margin: 0 0 0.6rem;
    font-size: 1.25rem;
}

p,
ul {
    margin: 0 0 1rem;
}

section,
.note {
    margin-top: 2.5rem;
}

.lede {
    font-size: 1.25rem;
    line-height: 1.45;
}

.meta,
.download-note {
    color: var(--muted);
}

.download-row {
    display: flex;
    align-items: center;
    gap: 1rem 1.25rem;
    margin: 1.5rem 0 0.5rem;
}

.download-note {
    margin: 0;
}

.filename {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.92rem;
}

.button {
    display: inline-block;
    padding: 0.7rem 1.15rem;
    border-radius: 0.4rem;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.button:hover {
    background: var(--accent-dark);
}

.note {
    padding: 1.25rem 1.35rem 0.35rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface);
}

section .note {
    margin-top: 1.25rem;
}

.site-footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.92rem;
}

.site-footer .wrap {
    padding: 1.25rem 0 1.75rem;
}

.site-footer p {
    margin: 0;
}

a {
    color: var(--accent-dark);
}

.back-to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 2;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(28, 36, 48, 0.16);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(1.75rem, 2rem, 0) rotate(12deg) scale(0.82);
    transition:
        opacity 0.35s ease,
        transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0s linear 0.35s,
        background 0.15s ease;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, var(--fly-y, 0px), 0) rotate(var(--fly-r, 0deg)) scale(1);
    transition:
        opacity 0.35s ease,
        transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0s,
        background 0.15s ease;
}

.back-to-top.is-flying {
    transition:
        opacity 0.35s ease,
        transform 0.16s ease-out,
        visibility 0s,
        background 0.15s ease;
}

.back-to-top:hover,
.back-to-top:focus-visible {
    background: var(--accent-dark);
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .back-to-top,
    .back-to-top.is-visible,
    .back-to-top.is-flying {
        transform: none;
        transition: none;
    }
}
