/* One continuous reading direction, with distinct project groups. */
.project-library {
    --library-muted: #929aab;
    --library-rule: rgba(194, 206, 228, 0.14);
    --rail-x: 6px;
    --rail-indent: 30px;
    width: min(100%, 536px);
    margin: 3.4rem auto 6rem;
    text-align: left;
}
.library-section + .library-section { margin-top: 3rem; }
.library-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.library-heading h2 {
    margin: 0;
    font: 500 11px/1.5 'Inter', sans-serif;
    letter-spacing: 0.16em;
    color: #bec5d2;
}
.library-heading::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--library-rule);
}
.library-count {
    order: 1;
    color: #7e879a;
    font: 10px/1.5 'Menlo', monospace;
}
.app-shelf, .website-index, .side-shelf {
    position: relative;
    padding-left: var(--rail-indent);
}
.app-shelf::before, .website-index::before, .side-shelf::before {
    content: '';
    position: absolute;
    left: var(--rail-x);
    top: 24px;
    bottom: 24px;
    width: 1px;
    background: linear-gradient(var(--library-rule) 85%, transparent);
}
.library-item {
    position: relative;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: start;
    gap: 14px;
    min-width: 0;
    min-height: 76px;
    padding: 13px 0 25px;
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: rgba(221, 232, 249, 0.1);
}
.library-item::before {
    content: '';
    position: absolute;
    left: calc(var(--rail-x) - var(--rail-indent));
    top: 24px;
    width: 4px;
    height: 4px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #d5dce9;
    box-shadow: 0 0 0 3px #00030d;
}
.library-item:focus-visible {
    outline: 1px solid #c8d3e5;
    outline-offset: 6px;
    border-radius: 4px;
}
.library-item .timeline-icon {
    width: 30px;
    height: 30px;
    margin-top: 1px;
    border-radius: 8px;
    transition: transform 180ms ease;
}
.library-item .timeline-title {
    font-size: 14px;
    line-height: 1.45;
    margin: 0 0 5px;
    letter-spacing: -0.015em;
}
.library-item .timeline-desc {
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--library-muted);
    margin: 0;
}
.library-item .timeline-chip {
    display: block;
    border: 0;
    background: none;
    padding: 4px 0 0;
    margin: 0;
    font: 9px/1.5 'Menlo', monospace;
    color: #8a93a5;
}
.library-item .timeline-chip::before { content: none; }
.library-contact { margin-top: 4rem; text-align: center; }
.library-contact .library-heading::before {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--library-rule);
}
.contact-line {
    margin: 0 auto 12px;
    max-width: 360px;
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--library-muted);
}
.contact-link {
    font: 11px/1.5 'Menlo', monospace;
    color: #d5dce9;
    text-decoration: none;
    border-bottom: 1px solid var(--library-rule);
    padding-bottom: 2px;
    transition: color 180ms ease, border-color 180ms ease;
}
.contact-link:hover { color: #fff; border-color: #c8d3e5; }
.contact-link:focus-visible { outline: 1px solid #c8d3e5; outline-offset: 6px; border-radius: 4px; }
/* The rail is a path of light: it fills as you read, and each project is a star on it. */
.app-shelf::after, .website-index::after, .side-shelf::after {
    content: '';
    position: absolute;
    left: var(--rail-x);
    top: 24px;
    width: 1px;
    height: calc((100% - 48px) * var(--lit, 0));
    background: linear-gradient(rgba(226, 233, 246, 0.08), rgba(238, 242, 250, 0.7));
    pointer-events: none;
}
.rail-comet {
    position: absolute;
    left: var(--rail-x);
    top: calc(24px + (100% - 48px) * var(--lit, 0));
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px 1px rgba(236, 241, 252, 0.8), 0 0 18px 3px rgba(214, 226, 248, 0.25);
    opacity: var(--comet, 0);
    pointer-events: none;
    transition: opacity 300ms ease;
}
.library-item::before {
    background: #5d6679;
    transition: background 400ms ease, box-shadow 400ms ease, width 300ms ease, height 300ms ease;
}
.library-item.is-lit::before {
    background: #e3e9f5;
    box-shadow: 0 0 0 3px #00030d, 0 0 7px rgba(222, 232, 250, 0.55);
}
.library-item.is-current::before {
    width: 5px;
    height: 5px;
    background: #fff;
    box-shadow: 0 0 0 3px #00030d, 0 0 10px rgba(232, 240, 255, 0.85);
}
/* A four-point sparkle over the current star, like the flares in the sky. */
.library-item::after {
    content: '';
    position: absolute;
    left: calc(var(--rail-x) - var(--rail-indent));
    top: 24px;
    width: 15px;
    height: 15px;
    transform: translate(-50%, -50%) scale(0.3);
    background:
        linear-gradient(to right, transparent, rgba(244, 247, 253, 0.9), transparent) center / 100% 1px no-repeat,
        linear-gradient(to bottom, transparent, rgba(244, 247, 253, 0.9), transparent) center / 1px 100% no-repeat;
    opacity: 0;
    pointer-events: none;
    transition: opacity 400ms ease, transform 400ms ease;
}
.library-item.is-current::after { opacity: 0.9; transform: translate(-50%, -50%) scale(1); animation: rail-twinkle 2.6s ease-in-out infinite; }
@keyframes rail-twinkle {
    0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 0.9; }
    50% { transform: translate(-50%, -50%) scale(0.7) rotate(45deg); opacity: 0.5; }
}
@media (hover: hover) {
    .library-item:hover .timeline-icon { transform: translateY(-2px); }
    .library-item:hover .timeline-title { color: #fff; }
    .library-item:hover .timeline-desc { color: #bec6d5; }
    .library-item:hover::before { background: #fff; box-shadow: 0 0 0 3px #00030d, 0 0 9px #c7d6ef; }
}
@media (max-width: 640px) {
    .project-library { width: 100%; margin-top: 2.8rem; padding: 0 4px; --rail-indent: 24px; --rail-x: 3px; }
    .library-item { grid-template-columns: 26px minmax(0, 1fr); gap: 12px; }
    .library-item .timeline-icon { width: 26px; height: 26px; border-radius: 7px; }
    .library-item .timeline-chip { display: none; }
    .library-section + .library-section { margin-top: 38px; }
}
@media (prefers-reduced-motion: reduce) {
    .library-item.is-current::after { animation: none; }
    .library-item::before, .library-item::after, .rail-comet { transition: none; }
    .project-library .timeline-icon { transition: none; transform: none; }
}

/* The voyage: scroll past either end of the log to drift out through the scales. */
/* Pulling down at the top would otherwise reload the page on Android. */
html { overscroll-behavior-y: contain; }
html.voyage-open, html.voyage-open body { overflow: hidden; }
.voyage-warning {
    position: fixed;
    left: 50%;
    bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
    z-index: 55;
    display: grid;
    gap: 5px;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 12px 20px;
    border: 1px solid rgba(226, 233, 246, 0.16);
    border-radius: 14px;
    background: rgba(0, 3, 13, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    text-align: center;
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    transition: opacity 350ms ease, transform 350ms ease;
}
.voyage-warning.is-top { top: max(24px, calc(env(safe-area-inset-top) + 16px)); bottom: auto; transform: translate(-50%, -12px); }
.voyage-warning.is-visible { opacity: 1; transform: translate(-50%, 0); }
.voyage-warning strong { color: #eef1f7; font-size: 13px; font-weight: 600; }
.voyage-warning span { color: #8e98ab; font: 10px/1.6 Menlo, monospace; letter-spacing: 0.14em; }
.voyage {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: #00030d;
    touch-action: none;
    overscroll-behavior: contain;
}
.voyage[hidden] { display: none; }
.voyage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.voyage button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.voyage-close {
    position: absolute;
    top: max(18px, env(safe-area-inset-top));
    right: 20px;
    padding: 7px 12px !important;
    border: 1px solid rgba(226, 233, 246, 0.16) !important;
    border-radius: 999px;
    color: #c6cfdf !important;
    font: 10px/1.4 Menlo, monospace !important;
    letter-spacing: 0.14em;
    transition: border-color 200ms ease, color 200ms ease;
}
.voyage-close:hover, .voyage-close:focus-visible { border-color: rgba(238, 242, 250, 0.5) !important; color: #fff !important; outline: none; }
.voyage-steps {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.voyage-steps button {
    position: relative;
    display: block;
    width: 18px;
    height: 18px;
}
.voyage-steps button::before {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #4f586b;
    transition: background 300ms ease, box-shadow 300ms ease;
}
.voyage-steps button[aria-current]::before { background: #fff; box-shadow: 0 0 8px rgba(232, 240, 255, 0.8); }
.voyage-steps span {
    position: absolute;
    right: 26px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    color: #aab4c7;
    font: 10px/1 Menlo, monospace;
    letter-spacing: 0.14em;
    opacity: 0;
    transition: opacity 200ms ease;
}
.voyage-steps button:hover span, .voyage-steps button:focus-visible span { opacity: 1; }
.voyage-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: max(56px, calc(env(safe-area-inset-bottom) + 40px));
    display: grid;
    gap: 6px;
    text-align: center;
    pointer-events: none;
    transition: opacity 300ms ease;
}
.voyage-label strong { color: #eef1f7; font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.voyage-label span { color: #8e98ab; font: 10px/1.4 Menlo, monospace; letter-spacing: 0.16em; }
.voyage-hint, .voyage-end {
    position: absolute;
    left: 0;
    right: 0;
    margin: 0;
    text-align: center;
    color: #8e98ab;
    font: 10px/1.8 Menlo, monospace;
    letter-spacing: 0.16em;
    pointer-events: none;
    transition: opacity 500ms ease;
}
.voyage-hint { bottom: max(22px, env(safe-area-inset-bottom)); padding: 0 16px; }
.voyage-hint span + span::before { content: ' · '; }
.voyage-end { top: 18%; color: #c6cfdf; opacity: 0; }
@media (max-width: 640px) {
    .voyage-steps { right: 12px; }
    .voyage-steps span { display: none; }
    .voyage-label { bottom: max(84px, calc(env(safe-area-inset-bottom) + 68px)); }
    .voyage-hint span { display: block; }
    .voyage-hint span + span::before { content: none; }
}

/* The cue at the end of the log: a tilted orbit and two words, seen only after a pause. */
.voyage-cue {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    margin: 52px auto 0;
    padding-bottom: 40px;
    opacity: 0;
    pointer-events: none;
    /* Fade only: a transform here would push the page's scrollable area past the body,
       and the first scroll would go to the body instead of the page. */
    transition: opacity 1200ms ease;
}
.voyage-cue[hidden] { display: none; }
.voyage-cue.is-visible { opacity: 1; }
.voyage-cue svg { overflow: visible; }
.cue-ring { stroke: rgba(226, 233, 246, 0.26); stroke-width: 0.8; stroke-dasharray: 1.4 3; }
.cue-sun { fill: #cfd6e6; opacity: 0.85; }
.cue-planet { fill: #fff; filter: drop-shadow(0 0 3px rgba(232, 240, 255, 0.9)); }
.voyage-cue span {
    color: #7d8799;
    font: 9.5px/1 Menlo, monospace;
    letter-spacing: 0.24em;
    text-indent: 0.24em;
    animation: cue-breathe 4.2s ease-in-out infinite;
}
@keyframes cue-breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* The rail on the left already shows where you are, so the browser's own scrollbar steps aside.
   Wheel, touch, trackpad and keyboard scrolling all work as before. */
html, body { scrollbar-width: none; -ms-overflow-style: none; }
/* The page's rules make <body> its own scroll container (overflow-x: hidden). Anything that pokes past
   its bottom edge would then catch the first wheel scroll. Clipping keeps the page the only scroller. */
body { overflow-x: clip; overflow-y: visible; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* The notice fills as you keep scrolling past the end; full means the trip opens. */
.voyage-pull { display: block; height: 2px; margin-top: 7px; border-radius: 2px; background: rgba(226, 233, 246, 0.12); overflow: hidden; }
.voyage-pull b { display: block; height: 100%; background: #eef1f7; transform: scaleX(0); transform-origin: left; transition: transform 120ms linear; }
