:root {
    --bg: #f5f2ec;
    --ink: #1c1a17;
    --muted: #6f6a61;
    --line: #dcd6cb;
    --accent: #b4532a;
    --serif: 'Instrument Serif', Georgia, serif;
    --sans: 'Geist', system-ui, sans-serif;
    --mono: 'Geist Mono', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #141311;
        --ink: #ece7de;
        --muted: #948d82;
        --line: #2c2a26;
        --accent: #e08356;
    }
}

:root[data-theme="dark"] {
    --bg: #141311;
    --ink: #ece7de;
    --muted: #948d82;
    --line: #2c2a26;
    --accent: #e08356;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease, color 0.25s ease;
}

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--line);
    text-underline-offset: 3px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

.page {
    max-width: 680px;
    margin: 0 auto;
    padding: 48px 24px 64px;
}

.mono {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.muted {
    color: var(--muted);
    font-weight: 400;
}

/* Intro */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    margin-bottom: 72px;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 999px;
    padding: 4px 12px;
    cursor: pointer;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.avatar {
    display: block;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--line);
    margin-bottom: 28px;
}

.name {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(3rem, 10vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.01em;
}

.role {
    font-family: var(--serif);
    font-size: clamp(1.4rem, 4vw, 1.75rem);
    color: var(--muted);
    margin-top: 8px;
}

.role em {
    color: var(--accent);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Rotating role: lines roll upward around a drum */
.roller {
    display: inline-grid;
    perspective: 600px;
}

.roll {
    grid-area: 1 / 1;
    white-space: nowrap;
    transform-origin: 50% 50% -0.6em;
    transform: rotateX(-90deg);
    opacity: 0;
    backface-visibility: hidden;
    transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.5s ease;
}

.roll.is-active {
    transform: rotateX(0deg);
    opacity: 1;
}

.roll.is-leaving {
    transform: rotateX(90deg);
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    .roll {
        transition: opacity 0.3s ease;
        transform: none !important;
    }
}

.lede {
    margin-top: 28px;
    font-size: 1.05rem;
    max-width: 56ch;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin-top: 24px;
    font-weight: 500;
}

/* Sections */

section {
    margin-top: 80px;
}

.label {
    color: var(--muted);
    font-weight: 400;
    text-transform: uppercase;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.rows {
    list-style: none;
}

.row {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 16px;
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
}

.when {
    color: var(--muted);
    padding-top: 3px;
}

.row h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.row h3 a {
    text-decoration: none;
}

.row p {
    color: var(--ink);
}

.row p.muted {
    color: var(--muted);
}

.stack {
    color: var(--muted) !important;
    margin-top: 8px;
}

.actions {
    display: flex;
    gap: 18px;
    margin-top: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.media {
    margin-top: 16px;
}

.media img,
.media video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.media-light img {
    background: #f9fbfd;
}

.media-dark img,
.media-dark video {
    background: #0c1220;
}

.media figcaption {
    color: var(--muted);
    margin-top: 8px;
}

.status {
    display: inline-block;
    vertical-align: 2px;
    margin-left: 8px;
    padding: 1px 9px;
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 999px;
}

.cite {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 4px 12px;
    margin-top: 12px;
    color: var(--muted);
}

.cite dd {
    color: var(--ink);
}

.plain {
    list-style: none;
}

.plain li {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.toolkit {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 0 16px;
}

.toolkit dt,
.toolkit dd {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.toolkit dt {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--muted);
    padding-top: 17px;
}

/* Last played songs: a crate of records. The front one plays; hovering fans
   the rest out to the left so a visitor can pick another. */

.tagline {
    font-family: var(--serif);
    font-size: clamp(1.5rem, 5vw, 2rem);
    line-height: 1.2;
    margin-top: 22px;
}

.tagline em {
    color: var(--accent);
}

.player {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
}

.track-info {
    min-width: 0;
    transition: opacity 0.3s ease;
}

.track-info h3 {
    font-size: 1rem;
    font-weight: 600;
}

.play-btn {
    margin-top: 10px;
    background: none;
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: 999px;
    padding: 4px 14px;
    cursor: pointer;
}

.play-btn:hover,
.play-btn[aria-pressed="true"] {
    color: var(--accent);
    border-color: var(--accent);
}

.crate-hint {
    color: var(--muted);
    margin-top: 12px;
    font-size: 0.68rem;
}

.hint-touch {
    display: none;
}

@media (hover: none) {
    .hint-hover { display: none; }
    .hint-touch { display: inline; }
}

.crate {
    --size: 104px;
    --step: calc(var(--size) + 12px);
    --pile: 10px;
    --peek: 0.3;
    position: relative;
    z-index: 1;
    flex: none;
    width: calc(var(--size) * 1.55);
    height: var(--size);
}

/* Invisible pad under the fan so the gaps between records keep it open */
.crate::before {
    content: '';
    position: absolute;
    top: -12px;
    bottom: -12px;
    right: 0;
    width: 100%;
}

.crate.is-open::before {
    width: calc(var(--size) * 1.55 + var(--step) * 3);
}

.sleeve {
    --k: 0;
    position: absolute;
    top: 0;
    left: 0;
    z-index: calc(10 - var(--k));
    width: var(--size);
    height: var(--size);
    padding: 0;
    overflow: hidden;
    border-radius: 4px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--accent) 10%, var(--bg));
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    /* Tucked behind the front record, edges showing so it reads as a pile */
    transform: translateX(calc(var(--k) * var(--pile) * -1)) rotate(calc(var(--k) * -3deg));
    transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.2s ease;
    transition-delay: calc(var(--k) * 30ms);
}

/* Until someone opens the crate, the back records keep peeking out as a hint */
.crate.is-teasing:not(.is-open) .sleeve:not(.is-active) {
    animation: peek 3.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: calc(1s + var(--k) * 70ms);
}

@keyframes peek {
    0%, 55%, 100% {
        transform: translateX(calc(var(--k) * var(--pile) * -1)) rotate(calc(var(--k) * -3deg));
    }
    70%, 82% {
        transform: translateX(calc(var(--k) * var(--step) * var(--peek) * -1)) rotate(calc(var(--k) * -5deg));
    }
}

.sleeve img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.crate.is-open .sleeve:not(.is-active) {
    transform: translateX(calc(var(--k) * var(--step) * -1));
}

.crate.is-open .sleeve:not(.is-active):hover,
.crate.is-open .sleeve:not(.is-active):focus-visible {
    transform: translateX(calc(var(--k) * var(--step) * -1)) translateY(-8px);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.25);
}

.sleeve:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* The fanned records slide over the text, so hide it while choosing */
.player:has(.crate.is-open) .track-info {
    opacity: 0;
}

.vinyl {
    position: absolute;
    top: 4px;
    left: calc(var(--size) * 0.25);
    width: calc(var(--size) - 8px);
    height: calc(var(--size) - 8px);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        conic-gradient(from 30deg, rgba(255, 255, 255, 0.1), transparent 18%, rgba(255, 255, 255, 0.1) 50%, transparent 68%),
        repeating-radial-gradient(circle, #121212 0 1px, #1e1e1e 1px 3px);
    transition: left 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.vinyl-label {
    position: relative;
    width: 38%;
    height: 38%;
    overflow: hidden;
    border-radius: 50%;
    background: var(--accent);
}

.vinyl-label img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Spindle hole */
.vinyl-label::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: var(--bg);
}

.crate.is-playing .vinyl {
    left: calc(var(--size) * 0.55 - 8px);
    animation: spin 1.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 560px) {
    .crate {
        --size: 64px;
        --step: calc(var(--size) + 8px);
        --pile: 7px;
        --peek: 0.14;
    }
}

/* Smallest phones: shrink the records so the open fan stays on screen */
@media (max-width: 360px) {
    .crate {
        --size: 56px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sleeve {
        transition: none;
    }

    .crate.is-teasing .sleeve {
        animation: none !important;
    }

    .crate.is-playing .vinyl {
        animation: none;
    }
}

/* GitHub activity */

.gh {
    --cell: 9px;
    --gap: 2px;
    padding-top: 20px;
}

.gh-total {
    color: var(--muted);
    margin-bottom: 14px;
}

.gh-total strong {
    color: var(--ink);
    font-weight: 500;
}

.gh-scroll {
    overflow-x: auto;
    padding-bottom: 4px;
}

.gh-months,
.gh-graph {
    display: grid;
    grid-auto-columns: var(--cell);
    column-gap: var(--gap);
    width: max-content;
}

.gh-months {
    grid-auto-flow: column;
    height: 18px;
    font-size: 0.68rem;
    color: var(--muted);
}

.gh-months span {
    white-space: nowrap;
}

.gh-graph {
    grid-template-rows: repeat(7, var(--cell));
    grid-auto-flow: column;
    row-gap: var(--gap);
}

.gh-graph i,
.gh-legend i {
    display: block;
    width: var(--cell);
    height: var(--cell);
    border-radius: 2px;
}

.gh i[data-level="0"] { background: var(--line); }
.gh i[data-level="1"] { background: color-mix(in srgb, var(--accent) 30%, var(--bg)); }
.gh i[data-level="2"] { background: color-mix(in srgb, var(--accent) 55%, var(--bg)); }
.gh i[data-level="3"] { background: color-mix(in srgb, var(--accent) 80%, var(--bg)); }
.gh i[data-level="4"] { background: var(--accent); }

.gh-graph i.gh-pad {
    background: none;
}

.gh-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 14px;
    color: var(--muted);
}

.gh-legend {
    display: flex;
    align-items: center;
    gap: var(--gap);
}

.gh-legend i:first-child {
    margin-left: 4px;
}

.gh-legend i:last-child {
    margin-right: 4px;
}

/* Contact */

.contact {
    margin-top: 96px;
}

.email {
    display: inline-block;
    font-family: var(--serif);
    font-size: clamp(1.6rem, 6.5vw, 2.6rem);
    line-height: 1.2;
    margin-top: 28px;
    text-decoration: none;
    word-break: break-word;
}

.fineprint {
    color: var(--muted);
    margin-top: 64px;
}

@media (max-width: 560px) {
    .page {
        padding: 32px 16px 48px;
    }

    .topbar {
        margin-bottom: 48px;
    }

    section {
        margin-top: 60px;
    }

    .row,
    .toolkit {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .toolkit dt {
        border-bottom: none;
        padding-bottom: 0;
    }
}
