/* Shared styles: the site written as code, set in bold electric blue on white,
   with a scrolling ticker along the bottom and a live system readout in the corner. */

:root {
    --blue: #1200ff;
    --bar: #0010ff;
    --bg: #ffffff;
    --dim: rgba(18, 0, 255, 0.5);
    --cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M2 2 L2 20 L7 15.5 L10.5 23 L14 21.5 L10.5 14 L17 14 Z' fill='%231200ff' stroke='white' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 2 2, auto;
    --cursor-hover: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M2 2 L2 20 L7 15.5 L10.5 23 L14 21.5 L10.5 14 L17 14 Z' fill='white' stroke='%231200ff' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") 2 2, pointer;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--blue);
    overscroll-behavior: none;
}

body {
    min-height: 100vh;
    font-family: "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-weight: 620;
    font-size: clamp(17px, 0.9vw + 10px, 24px);
    line-height: 1.2;
    letter-spacing: 0.038em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    cursor: var(--cursor);
}

a {
    color: inherit;
    text-decoration: none;
    outline: 2px solid transparent;
    cursor: var(--cursor-hover);
}

a:hover,
a:focus-visible {
    outline-color: var(--blue);
}

a:active {
    opacity: 0.7;
}

::selection {
    background: var(--blue);
    color: #fff;
}

/* ---------- Ticker ---------- */

.ticker {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: var(--bar);
    color: #fff;
    padding: 5px 0;
    overflow: hidden;
    white-space: nowrap;
}

.ticker-track {
    display: inline-flex;
    animation: ticker 70s linear infinite;
}

.ticker:hover .ticker-track {
    animation-play-state: paused;
}

.ticker-track > span {
    padding-right: 0.5em;
}

.ticker a:hover {
    outline-color: #fff;
}

@keyframes ticker {
    to { transform: translateX(-50%); }
}

/* ---------- Code body ---------- */

main.code {
    padding: 10px 20px 30vh;
    max-width: 46em;
    overflow-wrap: anywhere;
}

main.code > .l,
main.code .l {
    display: block;
    min-height: 1.2em;
}

.i1 { padding-left: 1.6em; }
.i2 { padding-left: 3.2em; }

.dim { color: var(--dim); }

.soon { color: var(--dim); }

.blink {
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* CV and other prose pages: headings read as labels, dates as comments */

main.code h2 {
    font: inherit;
    margin: 1.2em 0 0;
}

main.code h2::before {
    content: "def ";
}

main.code h2::after {
    content: "():";
}

main.code .entry {
    padding-left: 1.6em;
    margin: 0.25em 0 0.8em;
}

main.code .meta {
    color: var(--dim);
    white-space: nowrap;
}

main.code .meta::before {
    content: "# ";
}

main.code .entry > .meta {
    margin-left: 0.4em;
}

main.code em {
    font-style: normal;
}

/* ---------- Project pages ---------- */

/* .in nests: each level indents one step, like a Python block */
main.code .in {
    padding-left: 1.6em;
}

main.code p {
    margin: 0;
}

main.code p + p {
    margin-top: 1em;
}

/* the last paragraph of a def block leaves a blank line before the next def */
main.code .in > p:last-child {
    margin-bottom: 1.2em;
}

/* A call that acts as a button: play(), open(), listen() */
.btn {
    outline: 2px solid var(--blue);
    padding: 0 0.25em;
}

.btn:hover,
.btn:focus-visible {
    background: var(--blue);
    color: #fff;
}

.gallery,
.tracks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 0.4em 0 0.4em 1.6em;
}

.gallery img {
    display: block;
    width: 100%;
    height: auto;
}

.gallery .full {
    grid-column: 1 / -1;
}

.tracks {
    gap: 0.8em 16px;
}

.tracks iframe {
    display: block;
    width: 100%;
    height: 166px;
    border: 0;
    margin-top: 0.25em;
}

/* ---------- System readout (bottom right) ---------- */

.sys {
    position: fixed;
    right: 20px;
    bottom: calc(1.2em + 26px);
    z-index: 5;
    text-align: right;
    pointer-events: none;
    font-size: 0.8em;
}

.sys a {
    pointer-events: auto;
}

/* ---------- Hover preview image (projects page) ---------- */

.preview {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 900;
    width: 260px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
    outline: 2px solid var(--blue);
    background: var(--bg);
}

.preview.visible {
    opacity: 1;
}

.preview img {
    display: block;
    width: 100%;
    height: auto;
}

/* ---------- Small screens ---------- */

@media (max-width: 1100px) {
    .sys {
        position: static;
        padding: 0 16px 24px;
    }

    main.code {
        padding-bottom: 40px;
    }

    .sys {
        padding-bottom: calc(1.2em + 40px);
    }
}

@media (max-width: 600px) {
    main.code {
        padding: 10px 16px 32px;
    }

    .i1 { padding-left: 1em; }
    .i2 { padding-left: 2em; }

    main.code .entry,
    main.code .in {
        padding-left: 1em;
    }

    .gallery,
    .tracks {
        grid-template-columns: 1fr;
        margin-left: 1em;
    }

    main.code .meta {
        white-space: normal;
    }

    .sys .coords {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ticker-track,
    .blink {
        animation: none;
    }
}
