:root {
    --void: #020618;
    --panel: #080e21;
    --slate: #0f172b;
    --outline: #1d293d;
    --steel: #314158;
    --fog: #90a1b9;
    --frost: #e2e8f0;
    --white: #ffffff;
    --signal: #00dc82;

    --sans: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --gutter: clamp(16px, 4vw, 48px);
    --max: 1280px;
    --ring: 0 0 0 1px var(--outline);
    --ring-inset: inset 0 0 0 1px var(--steel);

    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 80px;
}

body {
    margin: 0;
    background: var(--void);
    color: var(--fog);
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.5;
}

img,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 3px;
    border-radius: 6px;
}

h1,
h2,
h3,
h4 {
    color: var(--white);
}

.wrap {
    width: 100%;
    max-width: calc(var(--max) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.panel {
    background: var(--panel);
    border-radius: 8px;
    box-shadow: var(--ring);
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(2, 6, 24, 0.8);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--outline);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--frost);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.brand .logo {
    width: 26px;
    flex: none;
}

.logo .lobes {
    fill: var(--frost);
}

.logo .dot {
    fill: var(--signal);
}

.site-nav {
    display: flex;
    gap: clamp(16px, 2.5vw, 24px);
    font-size: 0.875rem;
    font-weight: 500;
}

.site-nav a {
    color: var(--fog);
    text-decoration: none;
}

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

@media (max-width: 559px) {
    .header-inner .brand span {
        display: none;
    }
}

/* Buttons and pills */

.button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border: 0;
    border-radius: 6px;
    font: 500 1rem/1.5 var(--sans);
    text-decoration: none;
    cursor: pointer;
}

.button-signal {
    background: var(--signal);
    color: var(--slate);
}

.button-signal:hover {
    background: #00c574;
}

.button-outline {
    background: transparent;
    color: var(--frost);
    box-shadow: var(--ring-inset);
}

.button-outline:hover {
    background: var(--slate);
}

.pill,
.tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    color: var(--signal);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.6;
    text-decoration: none;
    box-shadow: inset 0 0 0 1px rgba(0, 220, 130, 0.25);
}

.pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--signal);
}

/* Hero */

.hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    align-items: center;
    padding-top: clamp(56px, 9vw, 128px);
    padding-bottom: clamp(64px, 9vw, 128px);
}

@media (min-width: 1024px) {
    .hero {
        grid-template-columns: 6fr 5fr;
        gap: 64px;
    }
}

.hero h1 {
    margin: 20px 0 0;
    font-size: clamp(2.75rem, 7vw, 4.5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.025em;
}

.clock {
    margin: 4px 0 0;
    color: var(--signal);
    font-size: clamp(2.75rem, 7vw, 4.5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.clock-sep {
    color: var(--steel);
}

.clock.is-ticking .clock-sep:last-of-type {
    animation: tick 1s steps(1) infinite;
}

@keyframes tick {
    50% {
        opacity: 0.3;
    }
}

.date {
    margin: 20px 0 0;
    font-size: 1.125rem;
}

.date::first-letter {
    text-transform: uppercase;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

/* Editor pane */

.editor {
    min-width: 0;
    margin: 0;
    background: var(--panel);
    border-radius: 8px;
    box-shadow: var(--ring);
    overflow: hidden;
}

.editor-tabs {
    display: flex;
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid var(--outline);
}

.editor-tab {
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--fog);
    font-size: 0.875rem;
    font-weight: 500;
}

.editor-tab.is-selected {
    background: var(--slate);
    color: var(--white);
}

.editor-code {
    margin: 0;
    padding: 16px 16px 20px 0;
    overflow-x: auto;
    color: var(--frost);
    font: 400 0.875rem/1.71 var(--mono);
    counter-reset: line;
}

.editor-code .line {
    white-space: pre;
}

.editor-code .line::before {
    counter-increment: line;
    content: counter(line);
    display: inline-block;
    width: 3em;
    margin-right: 16px;
    color: var(--steel);
    text-align: right;
}

.editor-code .k { color: var(--frost); }
.editor-code .s { color: var(--signal); }
.editor-code .n { color: var(--white); }
.editor-code .p { color: var(--fog); }

/* Load sequence */

.hero-text > *,
.hero-editor {
    animation: rise 0.6s cubic-bezier(.2, .7, .1, 1) both;
}

.hero-text > :nth-child(2) { animation-delay: 0.06s; }
.hero-text > :nth-child(3) { animation-delay: 0.12s; }
.hero-text > :nth-child(4) { animation-delay: 0.18s; }
.hero-text > :nth-child(5) { animation-delay: 0.24s; }
.hero-editor { animation-delay: 0.3s; }

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

/* Sections */

.section {
    padding-top: clamp(64px, 8vw, 96px);
    padding-bottom: clamp(64px, 8vw, 96px);
    border-top: 1px solid var(--outline);
}

.section h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.025em;
}

.subhead {
    margin: 64px 0 20px;
    font-size: 1.125rem;
    font-weight: 600;
}

/* About */

.about-intro {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px 64px;
}

@media (min-width: 960px) {
    .about-intro {
        grid-template-columns: 1fr 1fr;
        align-items: end;
    }
}

.lead {
    max-width: 34ch;
    margin: 20px 0 0;
    color: var(--frost);
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.56;
}

.about-text {
    max-width: 62ch;
    margin: 0;
}

/* Route: the career drawn as a line. Vertical stops on small screens, a two-track timeline on wide ones. */

.route-panel {
    margin-top: 48px;
    padding: 20px;
}

.route-panel h3 {
    margin: 0 0 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.route-year,
.route-label {
    display: none;
}

.route-stops {
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
}

.route-stops::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 30px;
    left: 5px;
    width: 1px;
    background: var(--steel);
}

.stop {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 0 24px 28px;
}

.stop::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--frost);
    box-shadow: 0 0 0 4px var(--panel);
}

.stop.is-edu::before {
    background: var(--panel);
    border: 1.5px solid var(--fog);
}

.stop.is-current::before {
    background: var(--signal);
}

.stop-when {
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.stop-bar {
    color: var(--frost);
    font-weight: 600;
}

.stop-role {
    font-size: 0.875rem;
}

@media (min-width: 1280px) {
    /* One column per month from January 2016. Rows: years, work label, work, education label, education. */
    .route {
        position: relative;
        display: grid;
        grid-template-columns: repeat(132, minmax(0, 1fr));
    }

    .route::before {
        content: "";
        grid-column: 1 / -1;
        grid-row: 1 / 6;
        background-image: repeating-linear-gradient(to right, var(--outline) 0 1px, transparent 1px calc(100% / 11));
        pointer-events: none;
    }

    .route-year {
        display: block;
        grid-row: 1;
        grid-column: var(--y) / span 12;
        padding-left: 8px;
        font-size: 0.75rem;
        font-variant-numeric: tabular-nums;
    }

    .route-label {
        display: block;
        grid-row: var(--row);
        grid-column: 1 / -1;
        padding: 24px 0 8px 8px;
        font-size: 0.75rem;
    }

    .route-stops {
        display: contents;
    }

    .route-stops::before,
    .stop::before {
        display: none;
    }

    .stop {
        grid-column: var(--s) / var(--e);
        grid-row: var(--row);
        min-width: 0;
        gap: 8px;
        margin: 0 2px;
        padding: 0;
    }

    .stop-when {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .stop-bar {
        position: relative;
        padding: 6px 10px;
        border-radius: 6px;
        background: var(--slate);
        box-shadow: var(--ring-inset);
        font-size: 0.875rem;
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .is-edu .stop-bar {
        background: transparent;
        color: var(--fog);
    }

    /* The teacher education started before the chart does, so it fades in from the left edge. */
    .is-earlier .stop-bar {
        border-radius: 0 6px 6px 0;
        text-align: right;
        -webkit-mask-image: linear-gradient(to right, transparent, #000 45%);
        mask-image: linear-gradient(to right, transparent, #000 45%);
    }

    .is-earlier .stop-role {
        text-align: right;
    }

    .is-current .stop-bar {
        background: var(--signal);
        box-shadow: none;
        color: var(--slate);
        font-weight: 600;
    }

    .is-current .stop-bar::after {
        content: "";
        position: absolute;
        top: 50%;
        right: 12px;
        width: 8px;
        height: 8px;
        margin-top: -4px;
        border-radius: 50%;
        background: var(--slate);
        animation: pulse 2s ease-out infinite;
    }

    .stop-role {
        padding: 0 4px;
        font-size: 0.75rem;
        line-height: 1.33;
    }
}

@keyframes pulse {
    from {
        box-shadow: 0 0 0 0 rgba(15, 23, 43, 0.5);
    }

    to {
        box-shadow: 0 0 0 10px rgba(15, 23, 43, 0);
    }
}

/* Drawn when scrolled into view; main.js only arms this when motion is allowed. */
.route.is-armed .stop-bar {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.9s cubic-bezier(.3, .7, .2, 1);
    transition-delay: calc(var(--i) * 110ms);
}

.route.is-armed .stop-role,
.route.is-armed .stop-when {
    opacity: 0;
    transition: opacity 0.5s ease-out;
    transition-delay: calc(var(--i) * 110ms + 300ms);
}

/* On the wide timeline the line is drawn left to right, so the delay follows the start month instead. */
@media (min-width: 1280px) {
    .route.is-armed .stop-bar {
        transition-delay: calc(var(--s) * 9ms);
    }

    .route.is-armed .stop-role,
    .route.is-armed .stop-when {
        transition-delay: calc(var(--s) * 9ms + 450ms);
    }
}

.route.is-armed.is-drawn .stop-bar {
    clip-path: inset(0);
}

.route.is-armed.is-drawn .stop-role,
.route.is-armed.is-drawn .stop-when {
    opacity: 1;
}

/* Feature grid */

.features {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 32px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.features .icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: var(--signal);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.features h4 {
    margin: 12px 0 0;
    color: var(--frost);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.43;
}

.features p {
    margin: 8px 0 0;
    font-size: 0.875rem;
    line-height: 1.71;
}

/* Tools */

.tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tools li {
    padding: 16px;
}

.tools h4 {
    margin: 0 0 8px;
    color: var(--frost);
    font-size: 1rem;
    font-weight: 500;
}

.tools p {
    margin: 0;
    font: 400 0.875rem/1.71 var(--mono);
}

/* Projects */

.projects {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 40px 0 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 820px) {
    .projects {
        grid-template-columns: 1fr 1fr;
    }
}

.project {
    display: block;
    height: 100%;
    padding: 12px;
    text-decoration: none;
}

.project:hover {
    box-shadow: inset 0 0 0 1px var(--steel);
}

.project img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: top center;
    border-radius: 6px;
    box-shadow: var(--ring);
}

.project-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 4px 0;
}

.project h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.project-link {
    margin: 4px 4px 4px;
    font-size: 0.875rem;
}

.project-link span {
    color: var(--frost);
    text-decoration: underline;
    text-decoration-color: var(--steel);
    text-underline-offset: 3px;
}

.project:hover .project-link span {
    color: var(--white);
    text-decoration-color: var(--signal);
}

/* Footer */

.site-footer {
    border-top: 1px solid var(--outline);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 24px;
    padding-bottom: 24px;
    font-size: 0.875rem;
}

.site-footer .brand {
    color: var(--fog);
    font-weight: 500;
}

.site-footer .brand .logo {
    width: 20px;
}

.footer-nav a {
    color: var(--fog);
    font-weight: 500;
    text-decoration: none;
}

.footer-nav a:hover {
    color: var(--frost);
}

/* Terminal */

.terminal {
    margin-top: 32px;
    background: var(--panel);
    border-radius: 8px;
    box-shadow: var(--ring);
    overflow: hidden;
}

.terminal:focus-within {
    box-shadow: 0 0 0 1px rgba(0, 220, 130, 0.5);
}

.terminal-output {
    height: 300px;
    overflow-y: auto;
    padding: 16px 20px 4px;
    color: var(--frost);
    font: 400 0.875rem/1.71 var(--mono);
}

.t-line {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.t-echo {
    margin-top: 10px;
    color: var(--white);
}

.t-echo:first-child {
    margin-top: 0;
}

.t-prompt,
.t-cmd {
    color: var(--signal);
}

.t-dim,
.t-error {
    color: var(--fog);
}

.t-line a {
    color: var(--frost);
    text-decoration-color: var(--steel);
    text-underline-offset: 3px;
}

.t-line a:hover {
    text-decoration-color: var(--signal);
}

.terminal-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px 16px;
    font-family: var(--mono);
}

.terminal-prompt {
    color: var(--signal);
    font-size: 0.875rem;
}

/* 16px keeps iOS from zooming in when the field gets focus. */
.terminal-input {
    flex: 1;
    min-width: 0;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--white);
    caret-color: var(--signal);
    font: 400 1rem/1.5 var(--mono);
}

.terminal-input:focus {
    outline: none;
}

.terminal-input::placeholder {
    color: var(--steel);
}

.terminal-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.terminal-chips .button {
    padding: 6px 10px;
    font: 400 0.875rem/1.43 var(--mono);
}

/* Contact */

.contact {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px 64px;
}

@media (min-width: 960px) {
    .contact {
        grid-template-columns: 1fr auto;
        align-items: end;
    }
}

.contact-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.snippet {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
    padding: 6px 6px 6px 12px;
    border-radius: 6px;
    box-shadow: var(--ring);
    color: var(--frost);
    font: 400 0.875rem/1.71 var(--mono);
}

.snippet code {
    min-width: 0;
    overflow: hidden;
    font: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.snippet-copy {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--fog);
    font: 500 0.75rem/1.33 var(--sans);
    cursor: pointer;
}

.snippet-copy:hover {
    background: var(--slate);
    color: var(--frost);
}

.snippet-copy svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
}

/* Madplan */

.plan {
    padding-top: clamp(48px, 7vw, 96px);
    padding-bottom: clamp(64px, 8vw, 96px);
}

.plan-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px 48px;
    margin-bottom: 32px;
}

.plan h1 {
    margin: 0;
    font-size: clamp(2.75rem, 7vw, 4.5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.025em;
}

.plan-intro {
    margin: 16px 0 0;
    font-size: 1.125rem;
}

.dishes {
    margin: 0;
    padding: 0;
    list-style: none;
}

.dish {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px 24px;
    align-items: center;
    padding: 14px 20px;
}

.dish + .dish {
    border-top: 1px solid var(--outline);
}

@media (min-width: 720px) {
    .dish {
        grid-template-columns: 7rem 1fr auto;
    }
}

.dish-day {
    font-size: 0.875rem;
}

.dish-name {
    color: var(--frost);
    font-size: 1.125rem;
    font-weight: 500;
}

.dish-kind {
    justify-self: start;
    padding: 2px 10px;
    border-radius: 999px;
    box-shadow: var(--ring-inset);
    font-size: 0.75rem;
    font-weight: 500;
}

.dish-kind:empty {
    display: none;
}

.dishes.is-shuffling .dish-name,
.dishes.is-shuffling .dish-kind {
    animation: swap 0.35s ease-out both;
    animation-delay: calc(var(--i) * 40ms);
}

@keyframes swap {
    from {
        opacity: 0;
        transform: translateY(0.3em);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-text > *,
    .hero-editor,
    .clock.is-ticking .clock-sep:last-of-type,
    .is-current .stop-bar::after,
    .dishes.is-shuffling .dish-name,
    .dishes.is-shuffling .dish-kind {
        animation: none;
    }
}
