/* =========================================================
   Pia.Dev — Motion layer
   Adds transitions/animations on top of the existing design.
   No layout or color changes; everything here is motion.
   ========================================================= */

:root {
    --m-purple: #E325D0;
    --m-blue: #66A6D6;
    --m-green: #56C196;
    --m-yellow: #D5D666;
    --m-bg: #0f0f0f;
    --m-ease-out: cubic-bezier(.16, 1, .3, 1);
    --m-ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

html { scroll-behavior: smooth; }

::selection { background: rgba(227, 37, 208, .35); color: #fff; }

/* ---------- Page transition curtain ---------- */
.m-curtain {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: var(--m-bg);
    pointer-events: none;
    /* Plays automatically on load, so the page is never stuck covered even if JS fails. */
    animation: m-curtain-out .5s var(--m-ease-out) .05s both;
}
.m-curtain::before,
.m-curtain::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
}
.m-curtain::before {
    top: 0;
    background: linear-gradient(90deg, var(--m-purple), var(--m-blue), var(--m-green), var(--m-yellow));
    transform-origin: left;
    animation: m-bar .35s var(--m-ease-out) both;
}
.m-curtain__logo {
    font-family: 'Inconsolata', monospace;
    font-weight: 700;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    display: flex;
    gap: .6rem;
    align-items: center;
    animation: m-logo-out .3s var(--m-ease-out) .05s both;
}
.m-curtain__logo .tag { color: var(--m-purple); }
.m-curtain__logo .name { color: #fff; }
.m-curtain__logo .caret {
    display: inline-block;
    width: .55em;
    height: 1.05em;
    background: var(--m-green);
    animation: m-blink .8s steps(1) infinite;
}

@keyframes m-curtain-out {
    from { clip-path: inset(0 0 0 0); }
    to   { clip-path: inset(0 0 100% 0); visibility: hidden; }
}
@keyframes m-curtain-in {
    from { clip-path: inset(100% 0 0 0); }
    to   { clip-path: inset(0 0 0 0); }
}
@keyframes m-logo-out {
    to { opacity: 0; transform: translateY(-24px); filter: blur(6px); }
}
@keyframes m-logo-in {
    from { opacity: 0; transform: translateY(24px); filter: blur(6px); }
    to   { opacity: 1; transform: none; filter: none; }
}
@keyframes m-bar {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}
@keyframes m-blink { 50% { opacity: 0; } }

/* Leaving the page: curtain wipes back up from the bottom */
html.m-leaving .m-curtain {
    visibility: visible;
    pointer-events: all;
    animation: m-curtain-in .3s var(--m-ease-out) both;
}
html.m-leaving .m-curtain__logo {
    animation: m-logo-in .25s var(--m-ease-out) .05s both;
}

/* ---------- Ambient background ---------- */
.m-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
/* Soft brand-colour corners (static: painted once, no animation) */
.m-bg__vignette {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60vmax 45vmax at 0% 0%, rgba(227, 37, 208, .10), transparent 70%),
        radial-gradient(55vmax 45vmax at 100% 100%, rgba(86, 193, 150, .08), transparent 70%);
}

/* ---------- Code wall: Sophia's own code scrolling behind the page ---------- */
.m-code {
    position: absolute;
    inset: 0;
    overflow: hidden;
    user-select: none;
}
/* Inner layer is taller than the screen so it can drift up with scroll (parallax) */
.m-code__inner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: -40vh;
    display: flex;
    gap: 48px;
    padding: 0 32px;
    will-change: transform;
}
.m-code__col { flex: 1 1 0; min-width: 0; overflow: hidden; }

/* Cinematic edges: code fades into darkness at the top and bottom */
.m-code--far, .m-code--dim {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 82%, transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 82%, transparent 100%);
}

/* Far layer: smaller, fainter, slower — gives the wall depth */
.m-code--far { opacity: .02; }
.m-code--far .m-code__inner { gap: 36px; padding: 40px 24px 0; }
.m-code--far .m-code__pre { font-size: 10.5px; line-height: 1.9; }
.m-code--far .m-code__pre span { color: inherit; }
.m-code__pre {
    margin: 0;
    font-family: 'Inconsolata', monospace;
    font-size: 14px;
    line-height: 1.75;
    white-space: pre;
    color: #cbd5e1;
    will-change: transform;           /* scrolls on the GPU only */
    animation: m-code-scroll 140s linear infinite;
}
.m-code__col:nth-child(even) .m-code__pre { animation-delay: -45s; } /* offset neighbours */
@keyframes m-code-scroll { from { transform: translateY(0); } to { transform: translateY(-33.3333%); } }

/* Always-on faint layer */
.m-code--dim { opacity: .04; }
.m-code--dim .m-code__pre span { color: inherit; }

/* Syntax-coloured layer, revealed only around the cursor/finger ("flashlight") */
.m-code--lit {
    opacity: 0;
    transition: opacity .5s;
    /* A 460px light that JS moves via mask-position (cheap: touches only this element) */
    -webkit-mask-image: radial-gradient(circle 230px at 230px 230px, #000 0%, rgba(0, 0, 0, .55) 40%, transparent 72%);
            mask-image: radial-gradient(circle 230px at 230px 230px, #000 0%, rgba(0, 0, 0, .55) 40%, transparent 72%);
    -webkit-mask-size: 460px 460px;
            mask-size: 460px 460px;
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-position: 50vw 25vh;
            mask-position: 50vw 25vh;
}
.m-code--lit.is-on { opacity: .62; }

/* Lens ring around the flashlight (moved with transform → GPU only) */
.m-lens {
    position: absolute;
    top: 0;
    left: 0;
    width: 470px;
    height: 470px;
    margin: -235px 0 0 -235px;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(255, 255, 255, .025) 0%, transparent 44%),
        radial-gradient(circle, transparent 46%, rgba(227, 37, 208, .10) 49%, rgba(86, 193, 150, .07) 52%, transparent 57%);
    opacity: 0;
    transition: opacity .6s;
    will-change: transform;
}
.m-lens.is-on { opacity: 1; }

/* "Live coding" line: types itself, highlighted like a git-diff addition */
.m-live {
    position: absolute;
    max-width: calc(100vw - 48px);
    padding: 3px 12px 3px 8px;
    border-left: 2px solid var(--m-green);
    border-radius: 0 6px 6px 0;
    background: linear-gradient(90deg, rgba(86, 193, 150, .13), rgba(86, 193, 150, .02));
    font-family: 'Inconsolata', monospace;
    font-size: 14px;
    line-height: 1.75;
    white-space: nowrap;
    overflow: hidden;
    color: #e5e7eb;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .6s, transform .6s var(--m-ease-out);
    will-change: transform, opacity; /* own GPU layer: avoids re-layering the code wall every frame */
    contain: layout paint;
}
.m-live.is-on { opacity: .75; transform: none; }
.m-live .k { color: var(--m-purple); }
.m-live .s { color: var(--m-green); }
.m-live .t { color: var(--m-blue); }
.m-live .n { color: var(--m-yellow); }
.m-live .y { color: #f3f4f6; }
.m-live .c { color: #9ca3af; font-style: italic; }
.m-live__plus { color: var(--m-green); font-weight: 400; }
.m-live__text {
    display: inline-block;
    vertical-align: bottom;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
}
.m-live__caret {
    display: inline-block;
    width: .55em;
    height: 1.05em;
    margin-left: 1px;
    vertical-align: -.15em;
    background: var(--m-green);
    will-change: opacity;
    /* linear keyframes (not steps) so the blink runs on the GPU; paused while hidden */
    animation: m-caret-blink 1s linear infinite paused;
}
.m-live.is-on .m-live__caret { animation-play-state: running; }
@keyframes m-caret-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
.m-code--lit .m-code__pre { color: #6b7280; }
.m-code .k { color: var(--m-purple); }   /* keywords */
.m-code .s { color: var(--m-green); }    /* strings */
.m-code .t { color: var(--m-blue); }     /* HTML tags */
.m-code .a { color: var(--m-yellow); }   /* @annotations */
.m-code .n { color: var(--m-yellow); }   /* numbers */
.m-code .y { color: #e5e7eb; }           /* Types / Classes */
.m-code .c { color: #6b7280; font-style: italic; } /* comments, shell */

@media (max-width: 639px) {
    .m-code__inner { padding: 0 16px; }
    .m-code__pre { font-size: 12px; }
    .m-live { font-size: 12px; }
    .m-lens { width: 340px; height: 340px; margin: -170px 0 0 -170px; }
}

/* ---------- Cursor ring (fine pointers only) ---------- */
.m-ring { display: none; }
@media (pointer: fine) {
    .m-ring {
        display: block;
        position: fixed;
        top: 0; left: 0;
        width: 34px; height: 34px;
        margin: -17px 0 0 -17px;
        border: 1.5px solid rgba(86,193,150,.7);
        border-radius: 50%;
        pointer-events: none;
        z-index: 10000;
        will-change: transform;
        transition: width .3s var(--m-ease-out), height .3s var(--m-ease-out), margin .3s var(--m-ease-out),
                    border-color .3s, background-color .3s, opacity .3s;
        mix-blend-mode: difference;
    }
    .m-ring.is-hover {
        width: 64px; height: 64px;
        margin: -32px 0 0 -32px;
        border-color: var(--m-purple);
        background: rgba(227,37,208,.12);
    }
    .m-ring.is-down { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
    .m-ring.is-hidden { opacity: 0; }
}

/* ---------- Scroll progress ---------- */
.m-progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 60;
    transform-origin: left;
    transform: scaleX(0);
    background: linear-gradient(90deg, var(--m-purple), var(--m-blue), var(--m-green));
    box-shadow: 0 0 12px rgba(227,37,208,.6);
    pointer-events: none;
}

/* ---------- Navbar ---------- */
nav.m-nav { transition: background-color .4s, box-shadow .4s, border-color .4s; }
/* Performance: a near-solid background instead of a heavy blur that had to be
   recomputed on every scroll frame (the nav keeps its original light blur). */
nav.m-nav.is-scrolled {
    background-color: rgba(10,10,10,.9);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,.8);
    border-color: rgba(86,193,150,.25);
}
.m-navlink { position: relative; }
.m-navlink::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -6px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--m-purple), var(--m-green));
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .45s var(--m-ease-out);
}
.m-navlink:hover::after,
.m-navlink.is-active::after { transform: scaleX(1); transform-origin: left; }
.m-navlink.is-active { color: #fff !important; }

.m-logo .tag { display: inline-block; transition: transform .5s var(--m-ease-spring), color .3s; }
.m-logo:hover .tag { transform: rotate(-12deg) scale(1.15); }

/* ---------- Scroll reveal ---------- */
html.m-on .m-rv {
    opacity: 0;
    translate: 0 42px;
    filter: blur(10px);
    transition: opacity .65s var(--m-ease-out), translate .75s var(--m-ease-out), filter .65s var(--m-ease-out) !important;
    transition-delay: var(--m-delay, 0ms) !important;
}
html.m-on .m-rv.m-rv--left  { translate: -60px 0; }
html.m-on .m-rv.m-rv--right { translate: 60px 0; }
html.m-on .m-rv.m-rv--pop   { translate: 0 0; scale: .6; transition-property: opacity, scale, filter !important; transition-timing-function: var(--m-ease-spring) !important; }
html.m-on .m-rv.is-in {
    opacity: 1;
    translate: 0 0;
    scale: 1;
    filter: none;
}

/* Divider lines grow in */
html.m-on .m-line { transform: scaleX(0); transition: transform 1.1s var(--m-ease-out) .2s; }
html.m-on .m-line.is-in { transform: scaleX(1); }

/* ---------- Cards: tilt + spotlight ---------- */
.m-card { position: relative; isolation: isolate; }
.m-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity .4s;
    background: radial-gradient(420px circle at var(--px, 50%) var(--py, 50%), rgba(86,193,150,.16), rgba(227,37,208,.06) 40%, transparent 65%);
    z-index: 1;
}
.m-card:hover::after { opacity: 1; }
:where(.m-card) { transition: rotate .25s ease-out; }
.m-card.is-tilting { rotate: var(--rx, 0) var(--ry, 0) 0 var(--ra, 0deg); }

/* Project card images: show the whole picture (never cropped), zoom slightly on hover. */
.m-card img { transition: transform .9s var(--m-ease-out), filter .6s; }
.m-card img.m-zoomable { object-fit: contain; object-position: center; }
.m-card:hover img.m-zoomable.m-zoomable { transform: none; filter: brightness(1.1); }
.m-card:hover img.object-cover { transform: scale(1.04); }

/* Chrome can stop honouring overflow:hidden + rounded corners on a tilting (3D) card,
   letting the picture spill past the card's border. clip-path clips reliably. */
.m-card > .overflow-hidden:has(> img) { clip-path: inset(0); }
.m-card.rounded-xl > .overflow-hidden:has(> img) { clip-path: inset(0 round .75rem .75rem 0 0); }
.m-card.rounded-lg > .overflow-hidden:has(> img) { clip-path: inset(0 round .5rem .5rem 0 0); }

/* ---------- Magnetic buttons + shine ---------- */
.m-mag {
    position: relative;
    overflow: hidden;
    translate: var(--mx, 0px) var(--my, 0px);
    transition: translate .35s var(--m-ease-out), background-color .2s, color .2s, border-color .2s, transform .2s, box-shadow .3s !important;
}
.m-mag::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    left: -75%;
    width: 50%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
    transform: skewX(-20deg);
    pointer-events: none;
}
.m-mag:hover::before { animation: m-shine .8s var(--m-ease-out); }
.m-mag:hover { box-shadow: 0 10px 30px -8px rgba(86,193,150,.55); }
@keyframes m-shine { to { left: 130%; } }

/* ---------- Hero portrait ---------- */
.m-portrait {
    position: relative;
    width: clamp(240px, 68vw, 380px);
    aspect-ratio: 1;
    margin: 18px;
}
/* Spinning brand-color ring */
.m-portrait__ring {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--m-purple), var(--m-blue), var(--m-green), var(--m-yellow), var(--m-purple));
    animation: m-spin 8s linear infinite;
}
/* Soft glow behind the ring. Performance: a static shadow instead of a blurred
   copy of the ring that had to be re-blurred on every frame as it spun. */
.m-portrait::before {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    box-shadow: -18px -10px 50px 4px rgba(227, 37, 208, .35),
                 18px 12px 50px 4px rgba(86, 193, 150, .3),
                 0 0 80px 10px rgba(102, 166, 214, .15);
    pointer-events: none;
}
.m-portrait__img {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 30%;
    border: 6px solid var(--m-bg);
    transition: transform .6s var(--m-ease-out);
}
.m-portrait:hover .m-portrait__img { transform: scale(1.03); }

/* Floating code tags around the photo */
.m-portrait__badge {
    position: absolute;
    z-index: 2;
    padding: .35rem .75rem;
    border-radius: 999px;
    font-family: 'Inconsolata', monospace;
    font-weight: 700;
    font-size: clamp(.75rem, 2.6vw, .95rem);
    white-space: nowrap;
    background: rgba(10, 10, 10, .92); /* solid instead of backdrop blur: these bob constantly */
    border: 1px solid currentColor;
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .8);
    animation: m-bob 5s ease-in-out infinite;
}
.m-portrait__badge--1 { top: 6%;     left: -8%;  color: var(--m-purple); }
.m-portrait__badge--2 { top: 46%;    right: -6%;  color: var(--m-green); animation-delay: -1.6s; }
.m-portrait__badge--3 { bottom: 4%;  left: 4%;   color: var(--m-blue);  animation-delay: -3.2s; }

@keyframes m-spin { to { transform: rotate(1turn); } }
@keyframes m-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

/* ---------- Hero ---------- */
.m-hero-img {
    animation: m-float 6s ease-in-out infinite;
    filter: drop-shadow(0 0 0 rgba(86,193,150,0));
    transition: filter .6s;
}
.m-hero-img:hover { filter: drop-shadow(0 0 28px rgba(227,37,208,.45)); }
@keyframes m-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-14px) rotate(.6deg); }
}

.m-shine-text {
    background: linear-gradient(110deg, currentColor 40%, #b8f5dc 50%, currentColor 60%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: m-text-shine 4.5s linear infinite;
}
@keyframes m-text-shine {
    from { background-position: 150% 0; }
    to   { background-position: -100% 0; }
}

/* "ASPIRING" above FULL-STACK DEVELOPER: outlined, wide-spaced, fills in on hover */
.m-aspiring {
    margin: 0 0 .1em;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: clamp(1.6rem, 4.2vw, 2.6rem);
    line-height: 1;
    letter-spacing: .32em;
    color: transparent;
    -webkit-text-stroke: 1.5px var(--m-purple);
    text-shadow: 0 0 24px rgba(227, 37, 208, .35);
    transition: color .5s var(--m-ease-out), letter-spacing .6s var(--m-ease-out), text-shadow .5s;
    cursor: default;
}
.m-aspiring:hover {
    color: var(--m-purple);
    letter-spacing: .38em;
    text-shadow: 0 0 30px rgba(227, 37, 208, .6);
}

.m-scramble-char { color: var(--m-purple); opacity: .85; }

/* ---------- Terminal ---------- */
.m-term-line { opacity: 0; translate: -8px 0; transition: opacity .35s, translate .35s var(--m-ease-out); }
.m-term-line.is-on { opacity: 1; translate: 0 0; }
.m-caret { display: inline-block; animation: m-blink 1s steps(1) infinite; }

/* ---------- Form fields ---------- */
main input, main textarea, main select {
    transition: border-color .3s, box-shadow .3s, background-color .3s !important;
}
main input:focus, main textarea:focus, main select:focus {
    box-shadow: 0 0 0 3px rgba(86,193,150,.18), 0 0 24px -6px rgba(86,193,150,.6);
}

/* ---------- Footer links ---------- */
footer a { transition: color .2s, transform .3s var(--m-ease-spring) !important; display: inline-block; }
footer a:hover { transform: translateY(-3px); }

/* ---------- Decorative HTML tags (<h1>, <p>, <li> …) ---------- */
.m-tag {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0 .3em;
    padding: .14em .55em .16em;
    border-radius: 999px;
    border: 1px solid rgba(102, 166, 214, .4);
    background: linear-gradient(135deg, rgba(102, 166, 214, .16), rgba(227, 37, 208, .07));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
    font-family: 'Inconsolata', monospace;
    font-weight: 600;
    font-style: normal;
    font-size: clamp(.78rem, .5em, 1.6rem);
    line-height: 1.15;
    letter-spacing: .03em;
    text-transform: lowercase;
    white-space: nowrap;
    vertical-align: .18em;
    color: var(--m-blue);
    -webkit-text-fill-color: currentColor; /* stay solid inside gradient-text headings */
    cursor: default;
    transition: translate .5s var(--m-ease-spring), opacity .5s var(--m-ease-out),
                border-color .3s, box-shadow .3s, background-color .3s;
}
.m-tag--close {
    border-color: rgba(227, 37, 208, .4);
    background: linear-gradient(135deg, rgba(227, 37, 208, .14), rgba(102, 166, 214, .06));
}
.m-tag__b { opacity: .45; }
.m-tag__s { color: var(--m-purple); -webkit-text-fill-color: var(--m-purple); }
.m-tag__n { color: var(--m-blue); }
.m-tag--close .m-tag__n { color: #d7a6f0; -webkit-text-fill-color: #d7a6f0; }

/* Hovering the text: the tags step aside to make room for the content */
.m-tagged:hover .m-tag--open  { translate: -5px 0; }
.m-tagged:hover .m-tag--close { translate: 5px 0; }

/* Hovering a tag: it glows */
.m-tag:hover {
    border-color: var(--m-purple);
    box-shadow: 0 0 20px -4px rgba(227, 37, 208, .65), inset 0 1px 0 rgba(255, 255, 255, .08);
}

/* Entrance: opening tags slide in from the left, closing tags from the right */
.m-tag.is-armed { opacity: 0; transition-delay: .25s; }
.m-tag--open.is-armed  { translate: -16px 0; }
.m-tag--close.is-armed { translate: 16px 0; }
.m-tag.is-armed.is-in  { opacity: 1; translate: 0 0; }

/* ---------- FYI about the visible HTML tags ---------- */
.m-fyi__text code { color: var(--m-blue); font-family: inherit; }

/* Footer "build log" terminal */
.m-buildlog {
    margin: 1.5rem auto 0;
    max-width: 640px;
    text-align: left;
    border-radius: 12px;
    border: 1px solid rgba(86, 193, 150, .3);
    background: rgba(5, 5, 5, .65);
    box-shadow: 0 20px 50px -25px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .02) inset, 0 0 40px -18px rgba(227, 37, 208, .45);
    font-family: 'Inconsolata', monospace;
    overflow: hidden;
    transition: border-color .4s, box-shadow .4s;
}
.m-buildlog:hover { border-color: rgba(227, 37, 208, .5); }
.m-buildlog__bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, .04);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.m-buildlog__dot { width: 10px; height: 10px; border-radius: 50%; }
.m-buildlog__dot--r { background: #ff5f57; }
.m-buildlog__dot--y { background: #febc2e; }
.m-buildlog__dot--g { background: #28c840; }
.m-buildlog__title { margin-left: auto; margin-right: auto; padding-right: 36px; color: #9ca3af; font-size: .8rem; }
.m-buildlog__body { padding: 12px 16px 14px; font-size: .9rem; line-height: 1.7; color: #d1d5db; }
.m-buildlog__body p { margin: 0; }
.m-c-green  { color: var(--m-green); }
.m-c-yellow { color: var(--m-yellow); }
.m-c-purple { color: var(--m-purple); }
.m-buildlog__chips { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 4px; vertical-align: middle; }
.m-tagchip {
    display: inline-block;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid rgba(102, 166, 214, .5);
    background: rgba(102, 166, 214, .1);
    color: var(--m-blue);
    font-size: .85rem;
    line-height: 1.5;
    cursor: default;
    transition: transform .3s var(--m-ease-spring), background-color .2s, color .2s;
}
.m-tagchip:hover { animation: m-wiggle .45s ease-in-out; background: var(--m-blue); color: #0f0f0f; }
@keyframes m-wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-8deg) scale(1.1); }
    75% { transform: rotate(8deg) scale(1.1); }
}

/* Lines print one by one once the log scrolls into view (JS adds is-armed / is-on) */
.m-buildlog.is-armed [data-line] { opacity: 0; transform: translateX(-8px); transition: opacity .3s, transform .35s var(--m-ease-out); }
.m-buildlog.is-armed [data-line].is-on { opacity: 1; transform: none; }

.m-fyi {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 70;
    width: min(380px, calc(100vw - 32px));
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(86, 193, 150, .45);
    background: rgba(12, 12, 12, .92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .9), 0 0 30px -12px rgba(227, 37, 208, .5);
    font-family: 'Inconsolata', monospace;
    color: #e5e7eb;
    opacity: 0;
    transform: translateY(24px) scale(.97);
    pointer-events: none;
    transition: opacity .45s var(--m-ease-out), transform .55s var(--m-ease-spring);
}
.m-fyi.is-in { opacity: 1; transform: none; pointer-events: auto; }
.m-fyi__tag { display: block; color: var(--m-purple); font-weight: 700; font-size: .85rem; margin-bottom: 4px; }
.m-fyi__text { margin: 0 0 10px; font-size: .95rem; line-height: 1.5; }
.m-fyi__btn {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--m-green);
    background: transparent;
    color: var(--m-green);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .2s, color .2s;
}
.m-fyi__btn:hover, .m-fyi__btn:focus-visible { background: var(--m-green); color: #0f0f0f; outline: none; }

/* ---------- Lightbox (project pictures) ---------- */
img.m-zoomable { cursor: zoom-in; }
html.m-lb-open { overflow: hidden; }

.m-lb {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    background: rgba(5, 5, 5, 0);
    transition: background-color .4s, backdrop-filter .4s;
}
.m-lb.is-open {
    background: rgba(5, 5, 5, .9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.m-lb__stage {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: auto;
    padding: 64px 16px 8px;
    overscroll-behavior: contain;
}
.m-lb__img {
    margin: auto;               /* centers, and still scrolls correctly when larger than the stage */
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 10px;
    border: 1px solid rgba(86, 193, 150, .35);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .9), 0 0 40px -10px rgba(227, 37, 208, .35);
    transform-origin: center;
}
.m-lb.can-zoom .m-lb__img { cursor: zoom-in; }
.m-lb.is-actual .m-lb__img { max-width: none; max-height: none; cursor: zoom-out; }

.m-lb__bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .25rem 1rem;
    padding: 12px 16px 20px;
    font-family: 'Inconsolata', monospace;
    text-align: center;
}
.m-lb__title { color: var(--m-green); font-weight: 700; }
.m-lb__hint { color: #9ca3af; font-size: .9rem; }

.m-lb__close {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 1;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(20, 20, 20, .8);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: transform .35s var(--m-ease-spring), border-color .2s, background-color .2s;
}
.m-lb__close:hover, .m-lb__close:focus-visible {
    transform: rotate(90deg);
    border-color: var(--m-purple);
    background: rgba(227, 37, 208, .2);
    outline: none;
}
.m-lb__bar, .m-lb__close { opacity: 0; transition: opacity .35s .1s, transform .35s var(--m-ease-spring), border-color .2s, background-color .2s; }
.m-lb.is-open .m-lb__bar, .m-lb.is-open .m-lb__close { opacity: 1; }

/* ---------- Reduced motion: keep everything static ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .m-curtain, .m-code__pre, .m-ring, .m-hero-img, .m-shine-text, .m-portrait__ring, .m-portrait__badge { animation: none !important; }
    .m-curtain { display: none; }
    .m-ring { display: none !important; }
    html.m-on .m-rv, html.m-on .m-line, .m-term-line { opacity: 1 !important; translate: none !important; scale: none !important; filter: none !important; transform: none !important; }
}
