/* ==========================================================================
   Michael Abid — Portfolio motion design
   ========================================================================== */

:root {
    --bg: #0a0a0c;
    --bg-2: #121216;
    --fg: #f2f0ea;
    --muted: #8a8a93;
    --line: rgba(242, 240, 234, .12);
    --accent: #ff3343;
    --accent-rgb: 255, 51, 67;
    --accent-2: #ff8a4c;
    --success: #36f1a5;
    --font: 'Space Grotesk', system-ui, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --gutter: clamp(16px, 4vw, 56px);
    --ease: cubic-bezier(.77, 0, .175, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.55;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
}
body.is-loading { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: .95; letter-spacing: -.03em; }
::selection { background: var(--accent); color: var(--bg); }
.mono { font-family: var(--mono); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.split { display: inline; }
.word { display: inline-block; white-space: nowrap; }
.ch { display: inline-block; will-change: transform; }

/* --- Accessibilité ------------------------------------------------------- */
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 400; padding: .7rem 1rem; border-radius: 8px; background: var(--accent); color: var(--bg); font-weight: 700; transform: translateY(-160%); transition: transform .3s; }
.skip-link:focus { transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.pcard:focus-visible { outline-offset: 4px; border-radius: 16px; }
main:focus { outline: none; }
[tabindex="-1"]:focus { outline: none; }

/* --- Grain + progress ----------------------------------------------------- */
.grain {
    position: fixed; inset: -50%; z-index: 90; pointer-events: none; opacity: .06;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 1s steps(6) infinite;
}
@keyframes grain {
    0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-5%, 4%); }
    40% { transform: translate(4%, -6%); } 60% { transform: translate(-3%, 7%); } 80% { transform: translate(6%, -2%); }
}
.scroll-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 95;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transform-origin: 0 50%; transform: scaleX(0);
}

/* --- Preloader ----------------------------------------------------------- */
.preloader {
    position: fixed; inset: 0; z-index: 200; background: var(--bg);
    display: grid; place-items: end start; padding: var(--gutter);
}
.preloader__count { font-size: clamp(5rem, 22vw, 18rem); font-weight: 700; line-height: .8; letter-spacing: -.06em; display: flex; }
.preloader__count span:last-child { color: var(--accent); font-size: .35em; }
.preloader__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--line); }
.preloader__bar span { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; }
.preloader__label { position: absolute; top: var(--gutter); right: var(--gutter); font-family: var(--mono); font-size: .8rem; color: var(--muted); text-transform: uppercase; }

/* --- Page transition ----------------------------------------------------- */
.transition { position: fixed; inset: 0; z-index: 150; display: flex; pointer-events: none; }
.transition span { flex: 1; background: var(--accent); transform: scaleY(0); transform-origin: 50% 100%; }
.transition span:nth-child(even) { background: var(--fg); }

/* --- Cursor -------------------------------------------------------------- */
.cursor { position: fixed; top: 0; left: 0; z-index: 300; opacity: 0; pointer-events: none; }
.cursor__dot, .cursor__ring { position: absolute; border-radius: 50%; transform: translate(-50%, -50%); }
.cursor__dot { width: 6px; height: 6px; background: var(--accent); }
.cursor__ring { width: 40px; height: 40px; border: 1.5px solid rgba(242, 240, 234, .55); transition: width .35s var(--ease-out), height .35s var(--ease-out), background .35s, border-color .35s; }
.cursor__label { position: absolute; transform: translate(-50%, -50%) scale(0); font-family: var(--mono); font-size: .7rem; text-transform: uppercase; color: #0a0a0c; font-weight: 600; transition: transform .35s var(--ease-out); white-space: nowrap; }
.cursor.is-hover .cursor__ring { width: 64px; height: 64px; border-color: var(--accent); }
.cursor.has-label .cursor__ring { width: 88px; height: 88px; background: var(--accent); border-color: var(--accent); }
.cursor.has-label .cursor__label { transform: translate(-50%, -50%) scale(1); }
.cursor.has-label .cursor__dot { opacity: 0; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }
@media (hover: hover) and (pointer: fine) { body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; } }
body.has-cursor input, body.has-cursor textarea { cursor: text; }
body.has-cursor select { cursor: pointer; }
.cursor.is-native { opacity: 0 !important; }

/* --- Nav ----------------------------------------------------------------- */
.nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; gap: 2rem;
    padding: 20px var(--gutter);
    mix-blend-mode: difference;
    transition: transform .6s var(--ease);
}
.nav::before {
    content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: rgba(10, 10, 12, .72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line); opacity: 0; transition: opacity .4s;
}
.nav.is-scrolled { mix-blend-mode: normal; padding-block: 12px; }
.nav.is-scrolled::before { opacity: 1; }
.nav { transition: transform .5s var(--ease), padding .4s var(--ease); }
.nav.is-hidden { transform: translateY(-110%); }
.nav__logo { display: flex; align-items: center; gap: .7rem; font-weight: 700; }
.nav__logo-mark { display: grid; place-items: center; width: 40px; height: 40px; border: 1.5px solid currentColor; border-radius: 50%; font-size: .85rem; }
.nav__logo-txt { font-size: .95rem; }
.nav__links { display: flex; gap: 1.8rem; margin-left: auto; }
.nav__link { overflow: hidden; display: block; height: 1.4em; line-height: 1.4; font-size: .9rem; }
.nav__link span { display: block; position: relative; transition: transform .5s var(--ease); }
.nav__link span::after { content: attr(data-text); position: absolute; left: 0; top: 100%; }
.nav__link:hover span { transform: translateY(-100%); }
.nav__link { transition: color .3s; }
.nav__link.is-current { color: var(--accent); }
.nav__link--cv { display: none; }
.nav__cta { padding: .55rem 1.1rem; border: 1.5px solid currentColor; border-radius: 99px; font-size: .85rem; font-weight: 500; }
.nav__burger { display: none; background: none; border: 0; width: 40px; height: 40px; position: relative; color: inherit; }
.nav__burger span { position: absolute; left: 8px; right: 8px; height: 2px; background: currentColor; transition: transform .4s var(--ease); }
.nav__burger span:first-child { top: 15px; } .nav__burger span:last-child { top: 23px; }
.nav.is-open .nav__burger span:first-child { transform: translateY(4px) rotate(45deg); }
.nav.is-open .nav__burger span:last-child { transform: translateY(-4px) rotate(-45deg); }

@media (max-width: 760px) {
    .nav { mix-blend-mode: normal; }
    .nav__logo-txt, .nav__cta { display: none; }
    .nav__burger { display: block; margin-left: auto; }
    .nav__links {
        position: fixed; inset: 0; z-index: -1; background: var(--bg);
        flex-direction: column; justify-content: center; padding: var(--gutter); gap: 1rem;
        clip-path: circle(0 at calc(100% - 40px) 40px); transition: clip-path .8s var(--ease);
    }
    .nav.is-open .nav__links { clip-path: circle(150% at calc(100% - 40px) 40px); }
    .nav__link { font-size: 2.6rem; height: 1.25em; line-height: 1.25; font-weight: 700; }
    .nav__link--cv { display: block; color: var(--accent); }
    .nav.is-open { mix-blend-mode: normal; }
    .nav.is-open::before { opacity: 0; }
    .nav:not(.is-open) .nav__links { visibility: hidden; transition: clip-path .8s var(--ease), visibility 0s .8s; }
}
body.menu-open { overflow: hidden; }

/* --- Sections ------------------------------------------------------------ */
.section { padding: clamp(80px, 14vw, 180px) var(--gutter); position: relative; }
.section__head { display: flex; align-items: baseline; gap: 1.2rem; margin-bottom: clamp(40px, 7vw, 90px); }
.section__num { color: var(--accent); }
.section__title { font-size: clamp(2.6rem, 8vw, 7rem); }
.section__title em { font-style: normal; color: transparent; -webkit-text-stroke: 1.5px var(--fg); }
.reveal-title { overflow: hidden; padding-bottom: .08em; }

/* --- Hero ---------------------------------------------------------------- */
.hero {
    position: relative; min-height: 100svh; display: flex; align-items: center;
    padding: 120px var(--gutter) 80px; overflow: hidden;
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__inner { position: relative; z-index: 2; width: 100%; }
.hero__eyebrow { display: flex; align-items: center; gap: .6rem; color: var(--muted); margin: 0 0 1.5rem; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 12px rgba(var(--accent-rgb), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); } }
.hero__title { font-size: clamp(4.2rem, 19vw, 17rem); line-height: .82; letter-spacing: -.06em; }
.hero__line { display: block; overflow: hidden; padding-bottom: .04em; }
.hero__line--outline { color: transparent; -webkit-text-stroke: 2px var(--fg); padding-left: 8vw; }
.hero__role { margin: 2rem 0 1rem; font-size: clamp(.9rem, 1.6vw, 1.2rem); color: var(--accent); min-height: 1.5em; }
.hero__chips { display: flex; flex-wrap: wrap; gap: .6rem; }
.hero__chips li { padding: .45rem .9rem; border: 1px solid var(--line); border-radius: 99px; font-size: .85rem; color: var(--muted); backdrop-filter: blur(6px); background: rgba(10, 10, 12, .4); }
.hero__ctas { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.hero__scroll { position: absolute; bottom: 30px; left: var(--gutter); display: flex; align-items: center; gap: 1rem; z-index: 2; color: var(--muted); }
.hero__scroll-line { width: 80px; height: 1px; background: var(--line); position: relative; overflow: hidden; }
.hero__scroll-line::after { content: ''; position: absolute; inset: 0; background: var(--accent); animation: scrollLine 2s var(--ease) infinite; }
@keyframes scrollLine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.hero__hud { position: absolute; right: var(--gutter); bottom: 30px; display: flex; gap: 1.2rem; color: var(--muted); z-index: 2; }
.hero__hud b { color: var(--fg); font-weight: 600; display: inline-block; min-width: 3ch; }
@media (max-width: 760px) { .hero__hud { display: none; } }

/* --- Marquee ------------------------------------------------------------- */
.marquee { overflow: hidden; border-block: 1px solid var(--line); padding: 1.4rem 0; white-space: nowrap; }
.marquee__track { display: inline-flex; gap: 2rem; align-items: center; will-change: transform; }
.marquee span { font-size: clamp(2rem, 5vw, 4rem); font-weight: 700; letter-spacing: -.03em; }
.marquee__star { color: var(--accent); font-size: 1.5rem !important; }
.marquee--skills { transform: rotate(-2deg) scale(1.04); background: var(--accent); color: var(--bg); border: 0; }
.marquee--skills .marquee__star { color: var(--bg); }

/* --- About --------------------------------------------------------------- */
.about__grid { display: grid; grid-template-columns: minmax(0, min(28vw, 400px)) minmax(0, 1fr); gap: clamp(30px, 6vw, 100px); align-items: start; max-width: 1360px; }
.about__lead { max-width: 30ch; }
.about__photo { margin: 0; position: sticky; top: 100px; }
.about__photo-inner { aspect-ratio: 4 / 5; overflow: hidden; border-radius: 6px; background: linear-gradient(135deg, var(--accent-2), var(--accent)); clip-path: inset(100% 0 0 0); }
.about__photo img { width: 100%; height: 120%; object-fit: cover; }
.about__photo.no-img img { display: none; }
.about__photo figcaption { margin-top: .8rem; color: var(--muted); }
.about__lead { font-size: clamp(1.6rem, 3.2vw, 2.8rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 2rem; font-weight: 500; }
.about__lead .w { opacity: .2; transition: none; }
.about__sub { color: var(--muted); max-width: 40ch; font-size: 1.1rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 3rem; border-top: 1px solid var(--line); padding-top: 2rem; }
.stat__n { display: block; font-size: clamp(2.5rem, 5vw, 4.5rem); font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.stat__l { color: var(--muted); }
@media (max-width: 860px) {
    .about__grid { grid-template-columns: 1fr; }
    .about__photo { position: relative; top: 0; max-width: 360px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
}

.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: clamp(60px, 10vw, 140px); perspective: 1000px; }
.skill-card {
    position: relative; overflow: hidden; padding: 2rem; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2);
    transform-style: preserve-3d; --mx: 50%; --my: 50%;
}
.skill-card__title { color: var(--accent); margin-bottom: 1.4rem; }
.skill-card__list { display: flex; flex-wrap: wrap; gap: .5rem; transform: translateZ(30px); }
.skill-card__list li { padding: .35rem .75rem; border-radius: 6px; background: rgba(255, 255, 255, .05); font-size: .95rem; transition: background .3s, color .3s; }
.skill-card__list li:hover { background: var(--accent); color: var(--bg); }
.skill-card__glow { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(400px circle at var(--mx) var(--my), rgba(var(--accent-rgb), .15), transparent 40%); opacity: 0; transition: opacity .4s; }
.skill-card:hover .skill-card__glow { opacity: 1; }
@media (max-width: 860px) { .skills { grid-template-columns: 1fr; } }

/* --- Journey ------------------------------------------------------------- */
.timeline { position: relative; max-width: 1100px; margin: 0 auto; }
.timeline__svg { position: absolute; left: 50%; top: 0; width: 4px; height: 100%; transform: translateX(-50%); overflow: visible; }
.timeline__track { stroke: var(--line); stroke-width: 2; }
.timeline__fill { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 100; stroke-dashoffset: 100; }
.tl-item { position: relative; width: 50%; padding: 0 3.5rem 4rem; }
.tl-item--left { margin-right: auto; text-align: right; }
.tl-item--right { margin-left: auto; }
.tl-item__node { position: absolute; top: .4rem; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--muted); transition: background .4s, border-color .4s, transform .4s var(--ease-out); }
.tl-item--left .tl-item__node { right: -8px; } .tl-item--right .tl-item__node { left: -8px; }
.tl-item.is-active .tl-item__node { background: var(--accent); border-color: var(--accent); transform: scale(1.3); }
.tl-item__date { color: var(--accent); }
.tl-item__title { font-size: clamp(1.5rem, 2.6vw, 2.2rem); margin: .6rem 0; line-height: 1.05; }
.tl-item__place { color: var(--muted); margin: 0 0 .6rem; }
.tl-item__text { color: var(--muted); margin: 0; }
.tl-item--school .tl-item__date { color: var(--accent-2); }
@media (max-width: 760px) {
    .timeline__svg { left: 8px; }
    .tl-item, .tl-item--left, .tl-item--right { width: 100%; text-align: left; padding: 0 0 3rem 2.5rem; }
    .tl-item--left .tl-item__node, .tl-item--right .tl-item__node { left: 0; right: auto; }
}

/* --- Projects (grille filtrable) ----------------------------------------- */
.projects__head { margin-bottom: 2rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: clamp(28px, 4vw, 48px); }
.filter {
    padding: .6rem 1.1rem; border-radius: 99px; border: 1px solid var(--line); background: none; color: var(--muted);
    cursor: pointer; transition: color .3s, border-color .3s, background .3s;
}
.filter sup { font-size: .65em; margin-left: .15em; opacity: .7; }
.filter:hover { color: var(--fg); border-color: var(--fg); }
.filter.is-active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.projects__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 24px); }
.pcard {
    position: relative; display: flex; flex-direction: column; min-width: 0;
    border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden;
    transition: border-color .4s, box-shadow .6s; transform-style: preserve-3d;
}
.pcard[hidden] { display: none; }
.pcard:hover, .pcard:focus-visible { border-color: var(--accent); }
.pcard.is-flash { box-shadow: 0 0 0 2px var(--accent), 0 0 60px -10px var(--accent); }
.pcard__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: linear-gradient(135deg, var(--accent), #15151a 90%); }
.pcard__media img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); transition: transform 1s var(--ease-out); }
.pcard:hover .pcard__media img { transform: scale(1); }
.pcard__media::after { content: ''; position: absolute; inset: 0; background: var(--accent); mix-blend-mode: color; opacity: 0; transition: opacity .5s; }
.pcard:hover .pcard__media::after { opacity: .3; }
.pcard__fallback { display: none; position: absolute; inset: 0; place-items: center; font-size: 7rem; font-weight: 700; color: var(--bg); }
.no-img img { display: none; }
.no-img .pcard__fallback { display: grid; }
.pcard__body { padding: 1.4rem 1.5rem 1.5rem; display: flex; flex-direction: column; gap: .7rem; flex: 1; }
.pcard__num { color: var(--accent); }
.pcard__title { font-size: clamp(1.5rem, 2.1vw, 2.1rem); display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.pcard__arrow { font-size: .7em; color: var(--muted); transition: transform .5s var(--ease), color .3s; }
.pcard:hover .pcard__arrow { transform: rotate(45deg); color: var(--accent); }
.pcard__desc { color: var(--muted); margin: 0; flex: 1; font-size: .98rem; }
.pcard--end { justify-content: center; align-items: center; gap: 1.4rem; text-align: center; border-style: dashed; padding: 2.5rem 1.5rem; }
.pcard--end p { font-size: 1.8rem; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.pcard--end__btns { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; padding: .3rem .6rem; border: 1px solid var(--line); border-radius: 99px; color: var(--fg); }
@media (min-width: 1500px) { .projects__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .pcard__media { aspect-ratio: 2 / 1; } }
@media (min-width: 2200px) { .projects__grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .projects__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .projects__grid { grid-template-columns: 1fr; } }

/* --- Buttons ------------------------------------------------------------- */
.btn {
    position: relative; display: inline-flex; align-items: center; gap: .8rem; overflow: hidden;
    padding: 1rem 1.6rem; border-radius: 99px; border: 1.5px solid var(--fg); background: none; color: var(--fg);
    font: 500 1rem var(--font); cursor: pointer; isolation: isolate;
}
.btn::before { content: ''; position: absolute; inset: 0; background: var(--accent); border-radius: inherit; transform: translateY(101%); transition: transform .5s var(--ease); z-index: -1; }
.btn:hover { color: var(--bg); border-color: var(--accent); }
.btn:hover::before { transform: translateY(0); }
.btn i { font-style: normal; transition: transform .4s var(--ease); }
.btn:hover i { transform: translateX(5px) rotate(-45deg); }
.btn--solid { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn--solid::before { background: var(--fg); }
.btn--solid:hover { border-color: var(--fg); }
.btn--big { font-size: 1.15rem; padding: 1.2rem 2.2rem; }

/* --- Contact ------------------------------------------------------------- */
.contact__big { font-size: clamp(4rem, 17vw, 15rem); line-height: .85; letter-spacing: -.06em; margin-bottom: clamp(50px, 8vw, 100px); }
.contact__big-line { display: block; overflow: hidden; }
.contact__big-line--outline { color: transparent; -webkit-text-stroke: 2px var(--accent); text-align: right; }
.contact__grid { display: grid; grid-template-columns: 7fr 4fr; gap: clamp(30px, 6vw, 100px); }
@media (max-width: 860px) { .contact__grid { grid-template-columns: 1fr; } }
.form { display: flex; flex-direction: column; gap: 1.8rem; }
.form__hp { position: absolute; left: -9999px; }
.form__flash { margin: 0; padding: 1rem 1.2rem; border-radius: 10px; font-weight: 500; }
.form__flash--success { background: rgba(54, 241, 165, .1); color: var(--success); border: 1px solid var(--success); }
.form__flash--error { background: rgba(255, 170, 60, .1); color: #ffb35c; border: 1px solid #ffb35c; }
.field { position: relative; }
.field input, .field textarea {
    width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--fg);
    font: 400 1.3rem var(--font); padding: 1.4rem 0 .6rem; outline: none; resize: vertical;
}
.field label { position: absolute; left: 0; top: 1.4rem; color: var(--muted); pointer-events: none; transition: transform .4s var(--ease-out), color .4s; transform-origin: 0 0; font-size: 1.3rem; }
.field::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform .6s var(--ease); }
.field:focus-within::after { transform: scaleX(1); }
.field input:focus + label, .field input:not(:placeholder-shown) + label,
.field textarea:focus + label, .field textarea:not(:placeholder-shown) + label { transform: translateY(-1.4rem) scale(.6); color: var(--accent); }
.form .btn { align-self: flex-start; }
.contact__side p { color: var(--muted); margin-top: 0; }
.contact__links li { border-bottom: 1px solid var(--line); }
.hover-line { display: flex; justify-content: space-between; padding: 1.1rem 0; font-size: 1.5rem; font-weight: 500; position: relative; transition: padding .5s var(--ease), color .4s; }
.hover-line:hover { padding-left: 1rem; color: var(--accent); }
.hover-line span { transition: transform .5s var(--ease); }
.hover-line:hover span { transform: rotate(45deg); }

/* --- Footer -------------------------------------------------------------- */
.footer { border-top: 1px solid var(--line); }
.marquee--footer { border: 0; }
.marquee--footer .marquee__track { animation: marquee 30s linear infinite; }
@keyframes marquee { to { transform: translateX(-50%); } }
.footer__bottom { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; align-items: center; justify-content: space-between; padding: 2rem var(--gutter); color: var(--muted); font-size: .9rem; }
.footer__socials { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.footer__socials a:hover, .footer__top:hover { color: var(--accent); }
.footer__clock { font-family: var(--mono); }

/* --- Project page -------------------------------------------------------- */
.project__hero { padding: 120px var(--gutter) 50px; }
.project__bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; padding-bottom: 1.2rem; margin-bottom: clamp(2rem, 5vw, 3.5rem); border-bottom: 1px solid var(--line); color: var(--muted); }
.project__bar a { padding: .4rem 0; transition: color .3s; }
.project__bar a:hover { color: var(--accent); }
.project__pager { display: flex; align-items: center; gap: 1.4rem; }
.project__meta { color: var(--fg); }
.project__status { color: var(--accent); margin: 0 0 1rem; }
.project__lead { font-size: clamp(1.2rem, 1.9vw, 1.6rem); line-height: 1.4; letter-spacing: -.01em; margin: 0 0 2.5rem; font-weight: 500; max-width: 60ch; }
.project__ext { font-size: 1.1rem; margin-top: 1.6rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--accent); }
.project__col { position: sticky; top: 100px; align-self: start; }
@media (max-width: 860px) { .project__col { position: static; } }
.project__title { font-size: clamp(3rem, 9.5vw, 10rem); line-height: .85; letter-spacing: -.06em; overflow: hidden; padding-bottom: .05em; }
.tags--hero { margin-top: 2rem; }
.project__media { margin: 0 var(--gutter); }
.project__media-inner { position: relative; overflow: hidden; border-radius: 14px; aspect-ratio: 16 / 8; background: linear-gradient(135deg, var(--accent), #15151a 85%); clip-path: inset(15% 10% 15% 10% round 14px); }
.project__media img { width: 100%; height: 130%; object-fit: cover; }
.project__body { display: grid; grid-template-columns: 4fr 8fr; gap: clamp(30px, 6vw, 100px); }
.project__col dl { margin: 0; display: grid; gap: .3rem; }
.project__col dt { color: var(--muted); margin-top: 1rem; }
.project__col dd { margin: 0; color: var(--fg); text-transform: none; font-size: .95rem; }
.project__desc .btn { margin-top: 1rem; }
@media (max-width: 860px) { .project__body { grid-template-columns: 1fr; } }
.project__next { display: block; position: relative; padding: clamp(80px, 12vw, 160px) var(--gutter); border-top: 1px solid var(--line); overflow: hidden; }
.project__next .mono { color: var(--muted); }
.project__next-title { display: block; font-size: clamp(3rem, 11vw, 10rem); font-weight: 700; letter-spacing: -.05em; line-height: .9; margin-top: 1rem; transition: transform .8s var(--ease), color .5s; }
.project__next:hover .project__next-title { transform: translateX(3vw); color: var(--accent); }
.project__next-bar { position: absolute; left: 0; bottom: 0; height: 6px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform .9s var(--ease); }
.project__next:hover .project__next-bar { transform: scaleX(1); }

/* --- 404 ----------------------------------------------------------------- */
.notfound { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2rem; text-align: center; padding: var(--gutter); }
.notfound__code { font-size: clamp(8rem, 35vw, 26rem); line-height: .8; position: relative; }
.notfound__txt { color: var(--muted); }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; inset: 0; }
.glitch::before { color: var(--accent); animation: glitch 2.5s infinite steps(1); clip-path: inset(10% 0 60% 0); transform: translate(-4px); }
.glitch::after { color: var(--accent-2); animation: glitch 2s infinite reverse steps(1); clip-path: inset(55% 0 15% 0); transform: translate(4px); }
@keyframes glitch {
    0% { clip-path: inset(10% 0 60% 0); } 20% { clip-path: inset(40% 0 30% 0); } 40% { clip-path: inset(80% 0 5% 0); }
    60% { clip-path: inset(5% 0 85% 0); } 80% { clip-path: inset(60% 0 20% 0); } 100% { clip-path: inset(25% 0 50% 0); }
}

/* --- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .about__photo-inner, .project__media-inner { clip-path: none; }
    .about__lead .w { opacity: 1; }
    .preloader { display: none; }
}
/* Sans JS : tout reste visible. */
.no-js .preloader { display: none; }
.no-js .about__photo-inner, .no-js .project__media-inner { clip-path: none; }

/* --- Liste de fonctionnalités (pages projet) ----------------------------- */
.features { margin: 0 0 2.5rem; border-top: 1px solid var(--line); counter-reset: f; }
.features li { counter-increment: f; display: grid; grid-template-columns: 3.2rem 1fr; padding: 1rem 0; border-bottom: 1px solid var(--line); color: var(--muted); transition: color .4s, padding .5s var(--ease); }
.features li::before { content: counter(f, decimal-leading-zero); font-family: var(--mono); font-size: .75rem; color: var(--accent); padding-top: .25em; }
.features li:hover { color: var(--fg); padding-left: .6rem; }


/* ==========================================================================
   Contenu repris de michaelabid.com : fiches projet, galeries, blog
   ========================================================================== */
.ilink { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ilink:hover { text-decoration-thickness: 2px; }
sup { font-size: .6em; color: var(--muted); margin-left: .2em; }

/* --- Fiche projet -------------------------------------------------------- */
.project__subtitle { margin: 1.4rem 0 0; color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.25rem); }
.project__h { color: var(--accent); margin: 3.2rem 0 1.2rem; font-weight: 600; }
.project__links { margin-top: 1.6rem; border-top: 1px solid var(--line); }
.project__links li { border-bottom: 1px solid var(--line); }
.project__links .project__ext { margin: 0; border: 0; font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 1rem; padding: .9rem 0; }
.project__gallery, .project__devlog, .project__team { padding-top: 0; }
.project__gallery .project__h, .project__devlog .project__h, .project__team .project__h { margin-top: 0; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: .5rem; }
.metric { background: var(--bg); padding: 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .4rem; }
.metric__v { font-size: clamp(1.4rem, 2.4vw, 2.1rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; color: var(--accent); }
.metric__l { color: var(--muted); }

.systems { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.system { padding: 1.4rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.system h3 { font-size: 1.15rem; letter-spacing: -.01em; line-height: 1.2; margin-bottom: .6rem; }
.system p { margin: 0; color: var(--muted); font-size: .97rem; }

/* --- Médias -------------------------------------------------------------- */
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1.4vw, 20px); }
.gallery--small { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 1.2rem; max-width: 760px; }
.media { margin: 0; display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.media__frame { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); padding: 0; }
.media__frame img, .media__frame video, .media__frame iframe { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; }
.media figcaption { color: var(--muted); font-size: .68rem; }
.media__zoom { cursor: zoom-in; }
.media__zoom img { transition: transform .8s var(--ease-out); }
.media__zoom:hover img { transform: scale(1.04); }
.media__zoom::after { content: '⤢'; position: absolute; right: .6rem; bottom: .6rem; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; background: rgba(10, 10, 12, .7); color: var(--fg); font-size: .9rem; opacity: 0; transition: opacity .3s; }
.media__zoom:hover::after, .media__zoom:focus-visible::after { opacity: 1; }
.media--youtube .media__frame, .media--video .media__frame { aspect-ratio: 16 / 9; }
.gallery:not(.gallery--small) .media--youtube, .gallery:not(.gallery--small) .media--video { grid-column: span 2; }
.gallery--small .media--youtube, .gallery--small .media--video { grid-column: 1 / -1; }
.yt { position: absolute; inset: 0; border: 0; padding: 0; background: #000; cursor: pointer; }
.yt img { width: 100%; height: 100%; object-fit: cover; opacity: .75; transition: opacity .3s; }
.yt:hover img { opacity: 1; }
.yt__play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--bg); font-size: 1.4rem; padding-left: 4px; transition: transform .4s var(--ease-out); }
.yt:hover .yt__play { transform: translate(-50%, -50%) scale(1.1); }
@media (max-width: 860px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .gallery { grid-template-columns: 1fr; } .gallery:not(.gallery--small) .media--youtube, .gallery:not(.gallery--small) .media--video { grid-column: auto; } }

/* --- Journal de dev ------------------------------------------------------ */
.devlog { position: relative; margin: 0; padding: 0; list-style: none; max-width: 1000px; }
.devlog::before { content: ''; position: absolute; left: 7.4rem; top: .5rem; bottom: 0; width: 1px; background: var(--line); }
.devlog__item { display: grid; grid-template-columns: 6.6rem 1fr; gap: 2rem; padding-bottom: 2.4rem; position: relative; }
.devlog__item::before { content: ''; position: absolute; left: calc(7.4rem - 4px); top: .45rem; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.devlog__date { color: var(--muted); padding-top: .15rem; text-align: right; }
.devlog__body h3 { font-size: 1.25rem; letter-spacing: -.01em; line-height: 1.2; margin-bottom: .5rem; }
.devlog__body p { margin: 0 0 .7rem; color: var(--muted); max-width: 70ch; }
.devlog--collapsed .devlog__item[data-extra] { display: none; }
.devlog--collapsed { -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
@media (max-width: 640px) {
    .devlog::before { left: 4px; }
    .devlog__item { grid-template-columns: 1fr; gap: .4rem; padding-left: 1.6rem; }
    .devlog__item::before { left: 0; }
    .devlog__date { text-align: left; }
}

/* --- Équipe -------------------------------------------------------------- */
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.team li { background: var(--bg); padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .25rem; }
.team__name { font-weight: 500; }
.team__role { color: var(--muted); font-size: .68rem; }
.team li.is-me { background: var(--bg-2); }
.team li.is-me .team__name { color: var(--accent); }

/* --- Visionneuse --------------------------------------------------------- */
.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(6, 6, 8, .95); color: var(--fg); }
.lightbox::backdrop { background: transparent; }
.lightbox[open] { display: grid; place-items: center; animation: lbIn .3s var(--ease-out); }
@keyframes lbIn { from { opacity: 0; } }
.lightbox__fig { margin: 0; max-width: min(92vw, 1600px); display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.lightbox__fig img { max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: 8px; }
.lightbox__fig figcaption { color: var(--muted); text-align: center; }
.lightbox__btn { position: fixed; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: rgba(18, 18, 22, .8); color: var(--fg); font-size: 1.1rem; cursor: pointer; transition: background .3s, color .3s; }
.lightbox__btn:hover { background: var(--accent); color: var(--bg); }
.lightbox__close { top: 20px; right: 20px; }
.lightbox__prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 20px; top: 50%; transform: translateY(-50%); }
.lightbox.is-single .lightbox__prev, .lightbox.is-single .lightbox__next { display: none; }
.lightbox__count { position: fixed; top: 34px; left: 24px; color: var(--muted); }
body.lb-open .cursor { display: none; }
body.has-cursor.lb-open, body.lb-open .lightbox, body.lb-open .lightbox button { cursor: auto; }

/* --- Blog ---------------------------------------------------------------- */
.blog__head { padding-top: 40px; margin-bottom: clamp(40px, 6vw, 80px); }
.blog__head .section__num { display: block; margin-bottom: 1rem; }
.blog__title { font-size: clamp(4rem, 15vw, 13rem); line-height: .85; letter-spacing: -.06em; overflow: hidden; padding-bottom: .05em; }
.blog__intro { color: var(--muted); font-size: 1.15rem; max-width: 46ch; margin: 1.5rem 0 0; }
.posts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 24px); }
.post-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--bg-2); transition: border-color .4s; }
.post-card:hover { border-color: var(--accent); }
.post-card__media { aspect-ratio: 16 / 8; overflow: hidden; background: linear-gradient(135deg, var(--accent-2), var(--bg-2) 80%); }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease-out); }
.post-card:hover .post-card__media img { transform: scale(1.04); }
.post-card__body { padding: 1.5rem; display: flex; flex-direction: column; gap: .8rem; flex: 1; }
.post-card__meta { color: var(--accent); }
.post-card__title { font-size: clamp(1.3rem, 2vw, 1.8rem); line-height: 1.12; letter-spacing: -.02em; }
.post-card__excerpt { color: var(--muted); margin: 0; flex: 1; }
.post-card--lead { grid-column: 1 / -1; flex-direction: row; }
.post-card--lead .post-card__media { flex: 0 0 55%; aspect-ratio: auto; min-height: 320px; }
.post-card--lead .post-card__body { padding: 2.2rem; justify-content: center; }
.post-card--lead .post-card__title { font-size: clamp(1.8rem, 3vw, 2.8rem); }
@media (max-width: 860px) { .posts { grid-template-columns: 1fr; } .post-card--lead { flex-direction: column; } .post-card--lead .post-card__media { min-height: 0; aspect-ratio: 16 / 8; } }

/* --- Article ------------------------------------------------------------- */
.post__hero { padding: 120px var(--gutter) 40px; }
.post__meta { color: var(--accent); margin: 0 0 1.2rem; }
.post__title { font-size: clamp(2.2rem, 5.2vw, 4.6rem); line-height: 1; letter-spacing: -.04em; max-width: 22ch; }
.post__cover { margin: 0 var(--gutter); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.post__cover img { width: 100%; max-height: 70vh; object-fit: cover; }
.post__layout { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 720px); justify-content: center; gap: clamp(30px, 5vw, 80px); padding: clamp(50px, 7vw, 90px) var(--gutter); }
.post__layout--single { grid-template-columns: minmax(0, 720px); }
.post__toc { position: sticky; top: 100px; align-self: start; color: var(--muted); }
.post__toc p { color: var(--fg); margin: 0 0 1rem; }
.post__toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: .7rem; border-left: 1px solid var(--line); }
.post__toc a { display: block; padding-left: 1rem; text-transform: none; letter-spacing: 0; line-height: 1.35; transition: color .3s; }
.post__toc a:hover { color: var(--accent); }
.post__content { font-size: 1.08rem; line-height: 1.75; color: #d8d6cf; min-width: 0; }
.post__content > * + * { margin-top: 1.2em; }
.post__content > * { margin-bottom: 0; }
.post__content h2, .post__content h3, .post__content h4 { color: var(--fg); line-height: 1.15; letter-spacing: -.02em; margin-top: 2.2em; scroll-margin-top: 110px; }
.post__content h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); }
.post__content h3 { font-size: 1.35rem; }
.post__content h4 { font-size: 1.1rem; }
.post__content ul, .post__content ol { padding-left: 1.3em; }
.post__content ul li { position: relative; }
.post__content ul li::before { content: ''; position: absolute; left: -1.1em; top: .72em; width: 6px; height: 6px; background: var(--accent); border-radius: 1px; }
.post__content ol { list-style: decimal; }
.post__content li + li { margin-top: .45em; }
.post__content strong { color: var(--fg); }
.post__content code { font-family: var(--mono); font-size: .86em; padding: .12em .4em; border-radius: 5px; background: rgba(255, 255, 255, .07); }
.post__code { padding: 1.2rem 1.4rem; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); overflow-x: auto; font-size: .86rem; line-height: 1.5; }
.post__code code { padding: 0; background: none; white-space: pre; }
.post__brief { padding: 1.2rem 1.4rem; border-radius: 10px; border: 1px solid var(--accent); background: rgba(var(--accent-rgb), .06); }
.post__brief strong { color: var(--accent); display: block; margin-bottom: .4rem; }
.post__brief p { margin: 0; }
.post__content blockquote { margin-left: 0; margin-right: 0; padding-left: 1.4rem; border-left: 3px solid var(--accent); font-size: 1.2rem; color: var(--fg); }
.post__content blockquote p { margin: 0; }
.post__content cite { display: block; margin-top: .5rem; color: var(--muted); font-size: .9rem; }
.post__content hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.post__figure .media__frame { aspect-ratio: auto; }
.post__figure .media__frame img { height: auto; object-fit: contain; }
.post__pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.post__pager > * { background: var(--bg); padding: clamp(30px, 5vw, 60px) var(--gutter); display: flex; flex-direction: column; gap: .6rem; font-size: clamp(1.1rem, 2vw, 1.6rem); font-weight: 500; line-height: 1.2; transition: color .3s; }
.post__pager a:hover { color: var(--accent); }
.post__pager .mono { color: var(--muted); }
.post__pager-next { text-align: right; align-items: flex-end; }
@media (max-width: 860px) {
    .post__layout { grid-template-columns: 1fr; }
    .post__toc { position: static; }
    .post__pager { grid-template-columns: 1fr; }
    .post__pager-next { text-align: left; align-items: flex-start; }
}

/* --- Accueil : articles récents + langues -------------------------------- */
.writing__list { border-top: 1px solid var(--line); }
.writing__item { display: grid; grid-template-columns: 9rem 1fr auto; gap: 2rem; align-items: baseline; padding: 1.6rem 0; border-bottom: 1px solid var(--line); transition: padding .5s var(--ease), color .3s; }
.writing__item:hover { padding-left: 1rem; color: var(--accent); }
.writing__date { color: var(--muted); }
.writing__title { font-size: clamp(1.2rem, 2.2vw, 1.9rem); font-weight: 500; letter-spacing: -.02em; line-height: 1.2; }
.writing__arrow { font-size: 1.4rem; transition: transform .5s var(--ease); }
.writing__item:hover .writing__arrow { transform: translateX(6px); }
.writing__all { margin-top: 2rem; }
@media (max-width: 640px) { .writing__item { grid-template-columns: 1fr auto; gap: .4rem 1rem; } .writing__date { grid-column: 1 / -1; } }
.about__extra { margin-top: 2rem; color: var(--muted); font-size: .98rem; max-width: 52ch; }
.about__extra strong { color: var(--fg); font-weight: 500; }
.tl-item__details { margin: .8rem 0 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.tl-item--left .tl-item__details { justify-content: flex-end; }
.tl-item__details li { font-size: .78rem; padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); }
@media (max-width: 760px) { .tl-item--left .tl-item__details { justify-content: flex-start; } }
.metric__v--long { font-size: clamp(1.05rem, 1.5vw, 1.3rem); line-height: 1.2; }

/* --- Transitions entre pages (navigateurs compatibles) -------------------- */
@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .45s; }
    ::view-transition-group(*) { animation-duration: .6s; animation-timing-function: cubic-bezier(.77, 0, .175, 1); }
}
