/* ---------------------------------------------------------------------- */
/*	Motion layer: cursor, preloader, ticker, 3D canvases and effects
/*	Loaded next to app.css, everything here is progressive enhancement
/* ---------------------------------------------------------------------- */

:root {
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------------------------------------------------------------------- */
/*	Lenis smooth scroll
/* ---------------------------------------------------------------------- */

html.lenis,
html.lenis body {
    height: auto;
}

.lenis:not(.lenis-autoToggle).lenis-stopped {
    overflow: clip;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-smooth iframe {
    pointer-events: none;
}

html.is-loading {
    overflow: hidden;
}

/* ---------------------------------------------------------------------- */
/*	Reading progress bar
/* ---------------------------------------------------------------------- */

.progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 110;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--blue-deep), var(--blue));
    transform: scaleX(0);
    transform-origin: left;
    pointer-events: none;
}

html:not(.motion) .progress {
    display: none;
}

/* ---------------------------------------------------------------------- */
/*	Hero intro: hidden until the timeline plays (fallback after 3s if JS never runs)
/* ---------------------------------------------------------------------- */

html.js:not(.motion) [data-intro] {
    opacity: 0;
    animation: intro-fallback 0s 3s forwards;
}

@keyframes intro-fallback {
    to {
        opacity: 1;
    }
}

/* ---------------------------------------------------------------------- */
/*	Preloader: terminal boot sequence
/* ---------------------------------------------------------------------- */

.preloader {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: grid;
    place-items: center;
    padding: var(--gutter);
    background: var(--navy);
    color: var(--white);
    font-family: var(--mono);
    font-size: 0.9rem;
}

html:not(.js) .preloader,
html.is-booted .preloader {
    display: none;
}

.preloader__terminal {
    width: 100%;
    max-width: 520px;
    padding: 18px 20px 22px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.preloader__bar {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.78rem;
}

.preloader__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
}

.preloader__dot:first-child {
    background: var(--blue);
}

.preloader__host {
    margin-left: 8px;
}

.preloader__line {
    display: flex;
    gap: 10px;
    min-height: 1.7em;
    opacity: 0;
}

.preloader__prompt {
    color: var(--blue);
}

.preloader__command {
    flex: 1;
    white-space: pre;
}

.preloader__ok {
    color: #7ee787;
    opacity: 0;
}

.preloader__ok::before {
    content: "✓ ";
}

.preloader__boot {
    margin-top: 14px;
    color: var(--blue);
    opacity: 0;
}

.preloader__caret {
    display: inline-block;
    width: 0.6em;
    height: 1.1em;
    margin-left: 6px;
    background: var(--blue);
    vertical-align: text-bottom;
    animation: caret-blink 0.9s steps(2, start) infinite;
}

.preloader__progress {
    height: 3px;
    margin-top: 16px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.preloader__progress-bar {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--blue-deep), var(--blue), var(--blue-pale));
    transform: scaleX(0);
    transform-origin: left;
}

@keyframes caret-blink {
    to {
        visibility: hidden;
    }
}

/* ---------------------------------------------------------------------- */
/*	Terminal cursor (fine pointers only)
/* ---------------------------------------------------------------------- */

.cursor,
.cursor-trail {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    color: var(--navy);
    font-family: var(--mono);
    font-weight: 600;
    line-height: 1;
    pointer-events: none;
    will-change: transform;
}

.cursor {
    font-size: 15px;
    opacity: 0;
}

.cursor__inner {
    display: flex;
    align-items: center;
    gap: 3px;
    transform: translate(-2px, -9px);
    transition: transform 0.15s;
}

.cursor.is-down .cursor__inner {
    transform: translate(-2px, -9px) scale(0.8);
}

.cursor__prompt {
    transition: opacity 0.15s, transform 0.2s;
}

.cursor__caret {
    width: 9px;
    height: 18px;
    background: currentColor;
    animation: caret-blink 1s steps(2, start) infinite;
    transition: width 0.15s;
}

.cursor__label {
    display: none;
    padding: 2px 6px;
    border: 1.5px solid currentColor;
    border-radius: 6px;
    font-size: 13px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    animation: label-pop 0.25s var(--motion-ease);
}

.cursor[data-state] .cursor__caret {
    display: none;
}

.cursor[data-state] .cursor__prompt {
    opacity: 0;
    transform: translateX(-6px);
}

.cursor[data-state] .cursor__label {
    display: block;
}

.cursor[data-state="brackets"] .cursor__label::before {
    content: "[ ]";
}

.cursor[data-state="braces"] .cursor__label::before {
    content: "{ }";
}

.cursor[data-state="code"] .cursor__label::before {
    content: "</>";
}

.cursor[data-state="text"] .cursor__label::before {
    content: "|";
}

.cursor.is-light,
.cursor-trail.is-light {
    color: var(--white);
}

.cursor-trail {
    z-index: 999;
    font-size: 12px;
    opacity: 0;
}

@keyframes label-pop {
    from {
        transform: scale(0.6);
        opacity: 0;
    }
}

@media (pointer: fine) and (hover: hover) {
    body.has-cursor,
    body.has-cursor * {
        cursor: none !important;
    }
}

/* ---------------------------------------------------------------------- */
/*	Hero: WebGL aurora and 3D portrait
/* ---------------------------------------------------------------------- */

.hero__background {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: none;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hero.has-webgl .hero__background {
    display: block;
}

.hero .wave {
    z-index: 1;
}

.hero__canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    border: 5px solid var(--white);
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, var(--blue), var(--blue-deep) 70%, var(--navy));
    touch-action: pan-y;
}

.hero__photo.is-3d {
    cursor: pointer;
}

.hero__photo.is-3d > img {
    visibility: hidden;
}

/* Small tilted print of the source photo, shown once the 3D bust is live */
.hero__origin {
    position: absolute;
    right: -14px;
    bottom: -10px;
    z-index: 2;
    display: none;
    width: 64px;
    margin: 0;
    padding: 4px 4px 18px;
    background: var(--white);
    border-radius: 3px;
    box-shadow: 0 10px 24px rgba(13, 50, 70, 0.35);
    transform: rotate(8deg);
    transform-origin: 50% 100%;
    pointer-events: none;
}

.hero__photo.is-3d .hero__origin {
    display: block;
}

.hero__origin img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 2px;
    background: var(--blue-deep);
}

.hero__origin figcaption {
    position: absolute;
    right: 0;
    bottom: 2px;
    left: 0;
    padding: 0 2px;
    font: 500 6px/1.25 var(--mono);
    color: var(--navy);
    text-align: center;
    text-transform: lowercase;
}

/* ---------------------------------------------------------------------- */
/*	Technology ticker
/* ---------------------------------------------------------------------- */

.ticker-wrap {
    position: relative;
    z-index: 2;
    margin: -22px 0 -10px;
    padding: 40px 0;
    overflow: hidden;
}

.ticker-wrap--flip {
    margin: -10px 0 -22px;
}

.ticker {
    overflow: hidden;
    background: var(--navy);
    color: var(--white);
    transform: rotate(-1.5deg) scale(1.04);
}

.ticker-wrap--flip .ticker {
    transform: rotate(1.5deg) scale(1.04);
}

.ticker__track {
    display: flex;
    width: max-content;
    padding: 12px 0;
    animation: ticker-scroll 32s linear infinite;
    will-change: transform;
}

.ticker__list {
    display: flex;
    flex: none;
}

.ticker__item {
    display: flex;
    align-items: center;
    padding: 0 22px;
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ticker__item::after {
    content: "";
    width: 6px;
    height: 6px;
    margin-left: 44px;
    border-radius: 50%;
    background: var(--blue);
}

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

/* ---------------------------------------------------------------------- */
/*	Headings: underline drawn once the title is revealed
/* ---------------------------------------------------------------------- */

.motion .title::after {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.9s var(--motion-ease) 0.45s;
}

.motion .heading--center .title::after {
    transform-origin: center;
}

.motion .title.is-visible::after {
    transform: scaleX(1);
}

/* ---------------------------------------------------------------------- */
/*	About: decorative background text
/* ---------------------------------------------------------------------- */

.band--clip {
    overflow: hidden;
}

.about__since {
    position: absolute;
    top: 10px;
    left: 0;
    z-index: 0;
    color: var(--blue-pale);
    font-size: clamp(5rem, 22vw, 18rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.05em;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
}

.band--clip .container {
    position: relative;
    z-index: 1;
}

/* ---------------------------------------------------------------------- */
/*	Ventures: 3D tilt and spotlight following the pointer
/* ---------------------------------------------------------------------- */

.motion .ventures {
    perspective: 1400px;
}

.motion .venture {
    transform-style: preserve-3d;
    will-change: transform;
}

.venture::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.35), transparent 55%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s;
}

.venture > * {
    position: relative;
    z-index: 1;
}

@media (hover: hover) {
    .venture:hover::before {
        opacity: 1;
    }

    .venture:hover {
        background: rgba(255, 255, 255, 0.92);
    }
}

/* ---------------------------------------------------------------------- */
/*	Journey: progress line and desktop pinned horizontal scroll
/* ---------------------------------------------------------------------- */

.timeline__progress {
    height: 2px;
    margin-bottom: 8px;
    background: var(--line);
}

.timeline__progress-bar {
    display: block;
    height: 100%;
    background: var(--blue);
    transform: scaleX(0);
    transform-origin: left;
}

.timeline.is-pinned {
    overflow: clip;
}

.timeline.is-pinned .timeline__controls {
    display: none;
}

.timeline.is-pinned .timeline__track,
.js .timeline.is-pinned:not(.is-end) .timeline__track {
    margin: 0;
    padding: 12px 0 20px;
    overflow: visible;
    scroll-snap-type: none;
    -webkit-mask-image: none;
    mask-image: none;
    will-change: transform;
}

.timeline.is-pinned .timeline__item {
    flex-basis: 400px;
}

/* ---------------------------------------------------------------------- */
/*	Skills: chips reacting to hover
/* ---------------------------------------------------------------------- */

.motion .skills__list li {
    transform-origin: left center;
    transition: color 0.2s, padding-left 0.3s var(--motion-ease), border-color 0.3s;
}

@media (hover: hover) {
    .skills__list li:hover {
        padding-left: 12px;
        border-color: var(--blue);
        color: var(--blue-deep);
    }
}

/* ---------------------------------------------------------------------- */
/*	Books: shine sweeping across the cover
/* ---------------------------------------------------------------------- */

.motion .books {
    perspective: 1200px;
}

.book__frame::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
    transform: translateX(-120%);
    pointer-events: none;
}

@media (hover: hover) {
    .book:hover .book__frame::after {
        transition: transform 0.9s var(--motion-ease);
        transform: translateX(120%);
    }
}

/* ---------------------------------------------------------------------- */
/*	Contact: floating code glyphs
/* ---------------------------------------------------------------------- */

.contact {
    overflow: hidden;
}

.contact__glyphs {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.contact .container {
    position: relative;
    z-index: 1;
}

.contact__glyph {
    position: absolute;
    color: rgba(255, 255, 255, 0.18);
    font-family: var(--mono);
    font-size: 1.4rem;
    font-weight: 600;
    animation: glyph-float 10s ease-in-out infinite alternate;
}

@keyframes glyph-float {
    from {
        transform: translateY(0) rotate(-6deg);
    }

    to {
        transform: translateY(-40px) rotate(8deg);
    }
}

/* ---------------------------------------------------------------------- */
/*	Footer: rocket launch on back to top
/* ---------------------------------------------------------------------- */

.site-footer__top .icon {
    transition: transform 0.3s;
}

.site-footer__top.is-launching .icon {
    animation: rocket-launch 0.7s var(--motion-ease);
}

@keyframes rocket-launch {
    40% {
        transform: translateY(-14px) scale(1.2);
    }

    60% {
        transform: translateY(14px) scale(0.8);
        opacity: 0;
    }

    61% {
        transform: translateY(14px);
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ---------------------------------------------------------------------- */
/*	Easter eggs: Matrix rain and terminal toast
/* ---------------------------------------------------------------------- */

.matrix {
    position: fixed;
    inset: 0;
    z-index: 950;
    background: var(--navy);
}

.matrix__canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.matrix__hint {
    position: absolute;
    bottom: 24px;
    left: 50%;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    background: rgba(13, 50, 70, 0.8);
    color: var(--white);
    font-family: var(--mono);
    font-size: 0.8rem;
    white-space: nowrap;
    transform: translateX(-50%);
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    z-index: 960;
    max-width: calc(100% - var(--gutter) * 2);
    padding: 12px 18px;
    border-left: 3px solid var(--blue);
    border-radius: 8px;
    background: var(--navy);
    color: var(--white);
    font-family: var(--mono);
    font-size: 0.85rem;
    box-shadow: 0 20px 50px rgba(13, 50, 70, 0.4);
    transform: translateX(-50%);
}

.toast::before {
    content: "$ ";
    color: var(--blue);
}

/* Easter egg walkthrough popin, opened by typing soluce */
.soluce {
    position: fixed;
    inset: 0;
    z-index: 955;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--gutter);
    background: rgba(13, 50, 70, 0.55);
    backdrop-filter: blur(3px);
}

.soluce__window {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    padding: 28px 24px;
    border-radius: 14px;
    background: var(--white);
    color: var(--navy);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
    overflow: auto;
}

.soluce__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #eaf6fc;
    color: var(--navy);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.soluce__close:hover,
.soluce__close:focus-visible {
    background: var(--blue);
    color: var(--white);
}

.soluce__title {
    margin: 0 40px 8px 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.soluce__intro {
    margin: 0 0 20px;
    color: rgba(13, 50, 70, 0.7);
    font-size: 0.95rem;
}

.soluce__list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px 16px;
    margin: 0;
}

.soluce__list dt {
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--navy);
    color: var(--white);
    font-family: var(--mono);
    font-size: 0.8rem;
    white-space: nowrap;
    justify-self: start;
}

.soluce__list dd {
    margin: 0 0 10px;
    font-size: 0.95rem;
}

@media (min-width: 640px) {
    .soluce__list {
        grid-template-columns: auto 1fr;
        align-items: center;
    }

    .soluce__list dd {
        margin: 0;
    }
}

/* Snow canvas over the page */
.snow {
    position: fixed;
    inset: 0;
    z-index: 930;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Party mode: hue cycling on the page content */
@keyframes party-hue {
    from {
        filter: hue-rotate(0deg) saturate(1.3);
    }

    to {
        filter: hue-rotate(360deg) saturate(1.3);
    }
}

.is-party main,
.is-party .site-header,
.is-party .site-footer {
    animation: party-hue 1.6s linear infinite;
}

/* Mini terminal opened by typing help */
.terminal {
    position: fixed;
    inset: 0;
    z-index: 955;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: var(--gutter);
    background: rgba(13, 50, 70, 0.55);
    backdrop-filter: blur(3px);
}

.terminal__window {
    width: 100%;
    max-width: 640px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    background: var(--navy);
    color: var(--white);
    font-family: var(--mono);
    font-size: 0.85rem;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.terminal__title {
    margin: 0;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}

.terminal__output {
    flex: 1;
    min-height: 120px;
    padding: 12px 16px 0;
    overflow: auto;
}

.terminal__line {
    margin: 0 0 6px;
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal__line--input {
    color: var(--blue);
}

.terminal__line--error {
    color: #ff8a80;
}

.terminal__form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 14px;
}

.terminal__prompt {
    color: var(--blue);
}

.terminal__input {
    flex: 1;
    min-width: 0;
    padding: 6px 0;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--white);
    font: inherit;
    outline: none;
}

.terminal__input:focus {
    border-bottom-color: var(--blue);
}

/* ---------------------------------------------------------------------- */
/*	Tablet and desktop
/* ---------------------------------------------------------------------- */

@media (min-width: 640px) {
    .ticker-wrap {
        margin: -30px 0 -14px;
    }

    .ticker-wrap--flip {
        margin: -14px 0 -30px;
    }

    .ticker__item {
        font-size: 0.95rem;
    }
}

@media (min-width: 1000px) {
    .hero__canvas {
        border-width: 8px;
    }

    .hero__origin {
        right: -24px;
        bottom: -4px;
        width: 112px;
        padding: 6px 6px 22px;
        border-radius: 4px;
    }

    .hero__origin figcaption {
        bottom: 5px;
        font-size: 9px;
        line-height: 1.2;
    }

    .ticker-wrap {
        margin: -44px 0 -20px;
    }

    .ticker-wrap--flip {
        margin: -20px 0 -44px;
    }

    .ticker__track {
        padding: 16px 0;
    }

    .about__since {
        top: 30px;
    }
}

/* ---------------------------------------------------------------------- */
/*	Reduced motion: everything static and visible
/* ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .preloader,
    .progress,
    .cursor,
    .cursor-trail {
        display: none !important;
    }

    html.js:not(.motion) [data-intro] {
        opacity: 1;
        animation: none;
    }

    .ticker__track,
    .contact__glyph,
    .preloader__caret {
        animation: none;
    }

    .motion .title::after {
        transform: none;
        transition: none;
    }

    .book__frame::after {
        display: none;
    }
}
