/* Home page only, loaded by home.html */

/* ----------# Theme tokens #---------- */

/* Only what the home tiles and illustrations add to the shared tokens in site.css */
:root {
    --hp-ink-bg: #000;
    --hp-ink-border: transparent;
    --hp-win: #fff;
    --hp-win-2: #f0f0f3;
    --hp-win-line: rgba(0, 0, 0, 0.09);
    --hp-win-shadow: 0 24px 60px rgba(0, 0, 0, 0.14);
    --hp-accent: #7c5cff;
}

[data-bs-theme='dark'] {
    --hp-ink-bg: #0b0b0d;
    --hp-ink-border: rgba(255, 255, 255, 0.1);
    --hp-win: #2c2c2e;
    --hp-win-2: #232325;
    --hp-win-line: rgba(255, 255, 255, 0.11);
    --hp-win-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.site-footer {
    margin-top: 0;
}

.hp {
    --fg: var(--bs-body-color);
    --muted: var(--bs-secondary-color);
    --link: var(--bs-link-color);
    color: var(--fg);
    overflow-x: clip;
}

.hp-soft {
    --fg: var(--bs-body-color);
    --muted: var(--bs-secondary-color);
    --link: var(--bs-link-color);
    background-color: var(--bs-tertiary-bg);
    color: var(--fg);
}

.hp-ink {
    --fg: #f5f5f7;
    --muted: #a1a1a6;
    --link: #2997ff;
    --hp-win: #1c1c1e;
    --hp-win-2: #141416;
    --hp-win-line: rgba(255, 255, 255, 0.13);
    --hp-win-shadow: 0 24px 80px rgba(124, 92, 255, 0.22);
    background-color: var(--hp-ink-bg);
    color: var(--fg);
    box-shadow: inset 0 0 0 1px var(--hp-ink-border);
}

/* ----------# Shared elements #---------- */

.hp h1,
.hp h2,
.hp h3 {
    font-family: inherit;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
}

.hp-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

.hp a:focus-visible,
.hp button:focus-visible {
    outline: 2px solid var(--site-accent);
    outline-offset: 3px;
}

.hp-link {
    color: var(--link);
    font-size: 17px;
    text-decoration: none;
    white-space: nowrap;
}

.hp-link::after {
    content: '\203A';
    display: inline-block;
    margin-left: 5px;
    transition: transform 200ms;
}

a:hover > .hp-tile-copy .hp-link,
a.hp-link:hover {
    text-decoration: underline;
}

a:hover > .hp-tile-copy .hp-link::after,
a.hp-link:hover::after {
    transform: translateX(3px);
}

.hp-eyebrow {
    display: block;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* ----------# Hero #---------- */

.hp-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(48px, 8vw, 88px) 20px clamp(48px, 7vw, 80px);
    text-align: center;
}

.hp-hero-photo {
    width: 136px;
    height: 136px;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 22%;
    margin-bottom: 28px;
}

.hp-hero h1 {
    font-size: clamp(48px, 8.4vw, 104px);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.03;
}

.hp-hero-tagline {
    font-size: clamp(24px, 3.6vw, 40px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 14px 0 12px;
    text-wrap: balance;
    background: linear-gradient(90deg, #0071e3, #7c5cff 55%, #e0569b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hp-hero-role {
    max-width: 38ch;
    color: var(--muted);
    font-size: clamp(17px, 2vw, 21px);
    line-height: 1.45;
    margin-bottom: 28px;
}

.hp-social {
    display: flex;
    gap: 20px;
    margin-top: 26px;
}

.hp-social a {
    color: var(--muted);
    transition: color 150ms;
}

.hp-social a:hover {
    color: var(--fg);
}

/* ----------# Tiles #---------- */

.hp-tiles {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 12px;
}

.hp-tiles-last {
    margin-top: 12px;
    padding-bottom: 12px;
}

.hp-grid {
    display: grid;
    gap: 12px;
}

.hp-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hp-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hp-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 580px;
    overflow: hidden;
    padding: 48px 24px 0;
    border-radius: 22px;
    text-align: center;
    text-decoration: none;
    transition: opacity 700ms ease, transform 700ms ease;
}

.hp-tile:hover {
    color: var(--fg);
    text-decoration: none;
}

.hp-tile-copy {
    max-width: 560px;
}

.hp-tile h2 {
    font-size: clamp(30px, 3.4vw, 44px);
    line-height: 1.08;
}

.hp-tile p {
    color: var(--muted);
    font-size: clamp(17px, 1.6vw, 20px);
    line-height: 1.4;
    margin: 10px 0 14px;
}

.hp-tile-art {
    display: flex;
    flex: 1;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    margin-top: 36px;
}

.hp-tile-wide {
    min-height: 720px;
    padding-top: 64px;
}

.hp-tile-wide h2 {
    font-size: clamp(38px, 5.4vw, 72px);
}

.hp-tile-wide .hp-tile-copy {
    max-width: 680px;
}

.hp-github-mark {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    padding-bottom: 40px;
}

.hp-tile-small {
    min-height: 0;
    padding: 0 28px 32px;
    text-align: left;
    align-items: stretch;
}

.hp-tile-small .hp-tile-art {
    flex: 0 0 auto;
    align-items: center;
    height: 190px;
    margin: 0;
}

.hp-tile-small h3 {
    font-size: 24px;
}

.hp-tile-small p {
    font-size: 17px;
    margin-bottom: 0;
}

/* Tiles below the fold wait here until they scroll into view, see home.js */
.hp-pending {
    opacity: 0;
    transform: translateY(28px);
}

/* ----------# Stats #---------- */

.hp-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    padding: 52px 32px;
    border-radius: 22px;
    text-align: center;
    transition: opacity 700ms ease, transform 700ms ease;
}

.hp-stats strong {
    display: block;
    font-size: clamp(40px, 5.6vw, 72px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.hp-stats span {
    display: block;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.35;
    margin-top: 6px;
}

/* ----------# Sections #---------- */

.hp-section {
    padding-top: clamp(56px, 7vw, 96px);
}

.hp-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 24px;
    padding: 0 clamp(20px, 3vw, 40px) 24px;
    transition: opacity 700ms ease, transform 700ms ease;
}

.hp-section-header h2 {
    font-size: clamp(32px, 4.2vw, 56px);
}

/* ----------# Blog carousel #---------- */

.hp-carousel-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 4px clamp(20px, 3vw, 40px) 24px;
    scroll-padding: 0 clamp(20px, 3vw, 40px);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.hp-carousel-track::-webkit-scrollbar {
    display: none;
}

.hp-post {
    flex: 0 0 min(380px, 80vw);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    background-color: var(--bs-tertiary-bg);
    color: var(--fg);
    text-decoration: none;
    scroll-snap-align: start;
    transition: transform 250ms ease;
}

.hp-post:hover {
    color: var(--fg);
    text-decoration: none;
    transform: scale(1.015);
}

.hp-post-image {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, #0071e3, #7c5cff 55%, #e0569b);
}

/* Out of the flow, so a tall cover image can't stretch the 16:10 box */
.hp-post-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hp-post-body {
    display: block;
    padding: 18px 22px 24px;
}

.hp-post-body time {
    display: block;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 6px;
}

.hp-post-body strong {
    display: block;
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.22;
}

.hp-carousel-nav {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 clamp(20px, 3vw, 40px);
}

.hp-carousel-nav[hidden] {
    display: none;
}

.hp-carousel-nav button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background-color: var(--bs-tertiary-bg);
    color: var(--fg);
    font-size: 24px;
    line-height: 1;
    padding: 0 0 4px;
}

.hp-carousel-nav button:disabled {
    opacity: 0.35;
}

/* ----------# Publications #---------- */

.hp-publications {
    padding: 8px clamp(20px, 3vw, 40px);
    border-radius: 22px;
    transition: opacity 700ms ease, transform 700ms ease;
}

.hp-publication {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 12px;
    padding: 22px 0;
    color: var(--fg);
    text-decoration: none;
}

.hp-publication + .hp-publication {
    border-top: 1px solid var(--hp-win-line);
}

.hp-publication:hover {
    color: var(--link);
    text-decoration: none;
}

.hp-publication-year {
    color: var(--muted);
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.hp-publication-text strong {
    display: block;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.hp-publication-text em,
.hp-publication-text small {
    display: block;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.4;
    margin-top: 3px;
}

.hp-publication-arrow {
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
    text-align: right;
    transition: transform 200ms;
}

.hp-publication:hover .hp-publication-arrow {
    transform: translateX(3px);
}

/* ----------# Closing tile #---------- */

.hp-closing {
    padding: clamp(64px, 9vw, 120px) 24px;
    border-radius: 22px;
    text-align: center;
    transition: opacity 700ms ease, transform 700ms ease;
}

.hp-closing h2 {
    font-size: clamp(40px, 6vw, 80px);
    font-weight: 700;
}

.hp-closing p {
    color: var(--muted);
    font-size: clamp(18px, 2vw, 24px);
    margin: 12px 0 26px;
}

/* ----------# Illustrations #---------- */

.art-window {
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    border: 1px solid var(--hp-win-line);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    background-color: var(--hp-win);
    box-shadow: var(--hp-win-shadow);
    color: var(--fg);
    font-size: 14px;
    text-align: left;
    transition: transform 500ms ease;
}

a:hover .art-window {
    transform: translateY(-6px);
}

.art-line {
    display: block;
    height: 9px;
    border-radius: 5px;
    background-color: var(--hp-win-line);
    margin-top: 11px;
}

.art-line.is-gap {
    margin-top: 28px;
}

/* File tree */
.art-tree {
    max-width: 1040px;
}

.art-titlebar {
    position: relative;
    display: flex;
    gap: 7px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--hp-win-line);
    background-color: var(--hp-win-2);
}

.art-titlebar i {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ff5f57;
}

.art-titlebar i:nth-child(2) {
    background-color: #febc2e;
}

.art-titlebar i:nth-child(3) {
    background-color: #28c840;
}

.art-titlebar span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.art-panes {
    display: grid;
    grid-template-columns: 210px 270px minmax(0, 1fr);
    min-height: 380px;
}

.art-folders {
    padding: 14px 10px;
    border-right: 1px solid var(--hp-win-line);
    background-color: var(--hp-win-2);
}

.art-folder {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 15px;
}

.art-folder::before {
    content: '';
    flex: none;
    width: 16px;
    height: 12px;
    border-radius: 3px;
    background-color: var(--hp-accent);
    clip-path: polygon(0 0, 42% 0, 54% 20%, 100% 20%, 100% 100%, 0 100%);
}

.art-folder.is-nested {
    margin-left: 14px;
}

.art-folder.is-active {
    background-color: var(--hp-accent);
    color: #fff;
}

.art-folder.is-active::before {
    background-color: #fff;
}

.art-files {
    padding: 14px 10px;
    border-right: 1px solid var(--hp-win-line);
}

.art-file {
    padding: 10px 12px;
    border-radius: 8px;
    border-bottom: 1px solid transparent;
}

.art-file b {
    display: block;
    font-size: 15px;
    font-weight: 600;
}

.art-file span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.art-file.is-active {
    background-color: rgba(124, 92, 255, 0.18);
}

.art-note {
    padding: 26px 30px;
}

.art-note h4 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 18px;
}

/* Image in editor */
.art-editor-body {
    padding: 24px 26px 26px;
}

.art-heading {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.art-embed {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    background-color: rgba(124, 92, 255, 0.16);
    color: var(--hp-accent);
    font-size: 14px;
}

.art-picture {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin-top: 12px;
}

/* Clear unused images */
.art-cleaner {
    padding: 22px;
}

.art-thumbs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.art-thumb {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
}

.t1 { background: linear-gradient(135deg, #38bdf8, #2563eb); }
.t2 { background: linear-gradient(135deg, #fb7185, #f59e0b); }
.t3 { background: linear-gradient(135deg, #34d399, #0d9488); }
.t4 { background: linear-gradient(135deg, #a78bfa, #ec4899); }
.t5 { background: linear-gradient(135deg, #fbbf24, #ea580c); }
.t6 { background: linear-gradient(135deg, #94a3b8, #475569); }

.art-thumb.is-unused {
    outline: 2px solid #ff453a;
    outline-offset: 2px;
    opacity: 0.55;
}

.art-thumb.is-unused::after {
    content: '\00D7';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: #ff453a;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 21px;
    text-align: center;
}

.art-cleaner-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 18px;
    padding-bottom: 6px;
}

.art-cleaner-bar span {
    color: var(--muted);
    font-size: 15px;
}

.art-cleaner-bar b {
    padding: 6px 16px;
    border-radius: 980px;
    background-color: #ff453a;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

/* Link converter */
.art-converter {
    display: flex;
    flex-direction: column;
    align-items: center;
    align-self: center;
    gap: 16px;
    width: 100%;
    padding-bottom: 48px;
}

.art-chip {
    max-width: 100%;
    padding: 14px 20px;
    border: 1px solid var(--hp-win-line);
    border-radius: 12px;
    background-color: var(--hp-win);
    color: var(--fg);
    font-size: clamp(14px, 1.5vw, 18px);
    overflow-wrap: anywhere;
}

.art-chip.is-result {
    border-color: rgba(124, 92, 255, 0.6);
    color: #b7a5ff;
    box-shadow: 0 0 40px rgba(124, 92, 255, 0.28);
}

.art-converter-arrow {
    color: var(--muted);
    line-height: 0;
}

/* What I do */
.art-bars {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
    max-width: 260px;
    height: 120px;
}

.art-bars span {
    flex: 1;
    border-radius: 6px 6px 2px 2px;
    background: linear-gradient(180deg, #2997ff, #0071e3);
}

.art-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.art-flow i {
    flex: 0 1 44px;
    height: 3px;
    background-color: var(--hp-win-line);
}

.art-node {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: 2px solid var(--hp-accent);
    border-radius: 16px;
    background-color: rgba(124, 92, 255, 0.14);
}

.art-node.is-done {
    border-color: #28c840;
    background-color: #28c840;
    color: #fff;
}

.art-code {
    width: 100%;
    margin: 0;
    padding: 18px 20px;
    border-radius: 14px;
    background-color: #1c1c1e;
    color: #f5f5f7;
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
    white-space: pre;
}

.art-code b {
    color: #ff7ab2;
    font-weight: 500;
}

.art-code u {
    color: #6bdfff;
    text-decoration: none;
}

/* ----------# Smaller screens #---------- */

@media (max-width: 1099px) {
    .art-panes {
        grid-template-columns: 180px minmax(0, 1fr);
        min-height: 320px;
    }

    .art-note {
        display: none;
    }

    .art-files {
        border-right: 0;
    }

    .hp-tile {
        min-height: 540px;
    }

    .hp-tile-small {
        min-height: 0;
    }

    .hp-grid-3 {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 767px) {
    .hp-grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }

    .hp-tile,
    .hp-tile-wide {
        min-height: 0;
        padding-top: 44px;
    }

    .hp-tile-small {
        padding-top: 0;
    }

    .hp-tile-github {
        padding-bottom: 8px;
    }

    .hp-github-mark {
        padding: 32px 0;
    }

    .hp-stats {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
        padding: 40px 24px;
    }

    .art-panes {
        grid-template-columns: 124px minmax(0, 1fr);
        min-height: 280px;
    }

    .art-folders,
    .art-files {
        padding: 10px 6px;
    }

    .art-folder {
        font-size: 13px;
        padding: 6px;
        gap: 6px;
    }

    .art-folder.is-nested {
        margin-left: 6px;
    }

    .art-file {
        padding: 8px;
    }

    .art-file b {
        font-size: 14px;
    }

    .hp-publication {
        grid-template-columns: 48px minmax(0, 1fr) 14px;
    }

    .hp-publication-year {
        font-size: 15px;
    }

    .hp-publication-text strong {
        font-size: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hp *,
    .hp *::after {
        transition: none !important;
    }
}
