/* =========================================================
   GIEL COLAS — Portfolio v2
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

:root {
  --bg: #0a0a0a;
  --fg: #ececec;
  --muted: #6a6a6a;
  --accent: #ff5d3b;
  --accent-2: #ffb499;
  --line: rgba(255,255,255,.08);
  --card: #111;

  /* 🎨 Palette multicolore */
  --c-orange: #ff5d3b;
  --c-pink:   #ff3da8;
  --c-violet: #7c5cff;
  --c-cyan:   #2de2ff;
  --c-lime:   #b8ff3a;
  --c-yellow: #ffd23f;
  --c-magenta:#e542ff;

  --serif: 'Instrument Serif', ui-serif, Georgia, serif;
  --sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --pad: clamp(16px, 3vw, 40px);
}

[data-theme="light"] {
  --bg: #f1ede4;
  --fg: #0a0a0a;
  --muted: #777;
  --accent: #ff3b1f;
  --accent-2: #b32a13;
  --line: rgba(0,0,0,.1);
  --card: #e6e0d3;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
  transition: background .5s ease, color .5s ease;
  cursor: none;
}

@media (pointer: coarse) {
  body { cursor: auto; }
  .cursor { display: none !important; }
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #000; }
.muted { color: var(--muted); }
img, svg { display: block; max-width: 100%; }

/* ============ GRAIN ============ */
.noise {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.7'/></svg>");
}

/* ============ WEBGL ============ */
#gl {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: .55;
}
[data-theme="light"] #gl { opacity: .35; }

/* ============ CURSOR ============ */
.cursor {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 200;
  mix-blend-mode: difference;
}
.cursor__dot {
  position: absolute;
  width: 6px; height: 6px;
  background: #fff;
  border-radius: 50%;
}
.cursor__ring {
  position: absolute;
  width: 36px; height: 36px;
  border: 1px solid #fff;
  border-radius: 50%;
  transition: width .25s ease, height .25s ease;
}
.cursor.is-link .cursor__ring { width: 56px; height: 56px; }
.cursor.is-view .cursor__ring {
  width: 90px; height: 90px;
  background: var(--accent);
  border-color: var(--accent);
}
.cursor.is-view .cursor__dot { opacity: 0; }

/* ============ LOADER ============ */
.loader {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  display: flex;
  align-items: flex-end;
  padding: var(--pad);
}
.loader__inner {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
}
.loader__name { font-weight: 700; }
.loader__bar { height: 1px; background: var(--line); position: relative; overflow: hidden; }
.loader__bar span { position: absolute; inset: 0; width: 0%; background: var(--fg); }
.loader__count { font-variant-numeric: tabular-nums; }

/* ============ TOPBAR ============ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px var(--pad);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .05em;
  mix-blend-mode: difference;
  color: #fff;
}
.topbar__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.3 } }

.topbar__nav { display: flex; gap: 22px; }
.topbar__nav a { opacity: .8; transition: opacity .2s; }
.topbar__nav a:hover { opacity: 1; }

.btn-ghost {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 12px;
  cursor: none;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  letter-spacing: .1em;
}

/* Topbar right group + contact me button */
.topbar__right { display: flex; align-items: center; gap: 10px; }
.btn-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 12px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: linear-gradient(90deg,
    var(--c-orange), var(--c-pink), var(--c-violet),
    var(--c-cyan), var(--c-lime), var(--c-yellow), var(--c-orange));
  background-size: 300% 100%;
  color: #000;
  border: none;
  cursor: none;
  animation: shiftBand 4s linear infinite;
  transition: transform .25s, box-shadow .25s;
}
.btn-contact:hover {
  color: #000;
  box-shadow: 0 8px 30px -8px var(--c-pink);
}
.btn-contact__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #000;
  animation: pulse 1.4s infinite;
}
@media (max-width: 720px) { .btn-ghost { display: none; } }
@media (max-width: 720px) { .topbar__nav { display: none; } }

/* ============ HERO ============ */
main { position: relative; z-index: 1; }

.hero {
  min-height: 100vh;
  padding: 100px var(--pad) 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.hero__top {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
}

.hero__title {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-family: var(--sans);
  font-weight: 900;
  font-size: clamp(56px, 14vw, 220px);
  line-height: .92;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  margin: 30px 0;
}
.hero__title .line { display: block; overflow: hidden; }
.hero__title .word { display: inline-block; }
.hero__title .italic {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  text-transform: lowercase;
  color: var(--accent);
}
.hero__title .small {
  font-family: var(--mono);
  font-size: clamp(11px, 1.1vw, 16px);
  font-weight: 400;
  letter-spacing: .25em;
  margin-top: 16px;
  color: var(--muted);
  text-transform: uppercase;
}

.hero__bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 24px;
  font-family: var(--mono);
  font-size: 12px;
  flex-wrap: wrap;
  gap: 16px;
}
.hero__meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.badge {
  border: 1px solid currentColor;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
}
.badge__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.4s infinite;
}
.hero__scroll {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 999px;
}
.hero__scroll svg { animation: bobUp 1.4s ease-in-out infinite; }
@keyframes bobUp { 0%,100%{transform: translateY(0)} 50%{transform: translateY(4px)} }

/* ============ MARQUEE ============ */
.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0 calc(-1 * var(--pad));
  overflow: hidden;
  background: color-mix(in oklab, var(--bg) 80%, transparent);
}
.marquee__track {
  display: inline-flex;
  gap: 36px;
  padding: 14px 0;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 13px;
  animation: scroll 40s linear infinite;
}
.marquee__track span { color: var(--muted); }
@keyframes scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ============ SECTIONS ============ */
.section {
  padding: 140px var(--pad);
  max-width: 1440px;
  margin: 0 auto;
  position: relative;
}
.section__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 60px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 18px;
  font-family: var(--mono);
}
.section__title {
  font-family: var(--mono);
  font-size: clamp(22px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: -.01em;
}
.section__head .muted { font-size: 12px; }

/* ABOUT */
.about-grid { display: grid; gap: 40px; max-width: 920px; }
.lead {
  font-family: var(--serif);
  font-size: clamp(28px, 3.6vw, 56px);
  line-height: 1.15;
  font-weight: 400;
}
.lead em { color: var(--accent); font-style: italic; }
.about-grid p:not(.lead) { font-size: clamp(16px, 1.4vw, 19px); max-width: 720px; color: var(--muted); }
.about-grid p strong { color: var(--fg); font-weight: 600; }
.about-grid p em { color: var(--accent); font-style: normal; font-weight: 600; }

.about-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 32px;
}
.stat__num {
  font-family: var(--mono);
  font-size: clamp(32px, 4vw, 56px);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat__lbl {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
}
@media (max-width: 720px) { .about-stats { grid-template-columns: repeat(2, 1fr); } }

/* WORK */
.work-list { list-style: none; }
.work-item {
  position: relative;
  border-top: 1px solid var(--line);
}
.work-item:last-child { border-bottom: 1px solid var(--line); }
.work-item__link {
  display: grid;
  grid-template-columns: 60px 1fr auto 40px;
  align-items: center;
  gap: 24px;
  padding: 36px 8px;
  transition: padding .35s ease, color .35s;
  font-family: var(--mono);
  font-size: 13px;
}
.work-item__link:hover { padding-left: 24px; color: var(--accent); }
.work-item__col.title {
  font-family: var(--sans);
  font-weight: 900;
  font-size: clamp(28px, 5vw, 72px);
  letter-spacing: -.03em;
  text-transform: uppercase;
  line-height: 1;
}
.work-item__col.idx { font-size: 12px; color: var(--muted); }
.work-item__col.tag { text-align: right; }
.work-item__col.arrow { font-size: 22px; transition: transform .35s; }
.work-item:hover .work-item__col.arrow { transform: rotate(45deg); }

.work-item__preview {
  position: fixed;
  top: 0; left: 0;
  width: 320px;
  height: 220px;
  pointer-events: none;
  border-radius: 8px;
  overflow: hidden;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.85);
  transition: opacity .25s ease, transform .25s ease;
  z-index: 60;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.work-item__preview-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 14px;
  color: rgba(255,255,255,.85);
  letter-spacing: .15em;
  text-transform: uppercase;
  background: repeating-linear-gradient(45deg, rgba(0,0,0,.2) 0 6px, transparent 6px 12px);
}
.work-item.is-active .work-item__preview {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
@media (max-width: 720px) {
  .work-item__link { grid-template-columns: 40px 1fr 32px; }
  .work-item__col.tag { display: none; }
  .work-item__preview { display: none; }
}

/* STACK */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.stack-col {
  border: 1px solid var(--line);
  padding: 28px 22px;
  border-radius: 6px;
  background: color-mix(in oklab, var(--card) 60%, transparent);
  backdrop-filter: blur(8px);
  transition: transform .35s, border-color .35s;
}
.stack-col:hover { transform: translateY(-4px); border-color: var(--accent); }
.stack-col__title {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--accent);
  margin-bottom: 18px;
}
.stack-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.stack-col li {
  font-family: var(--mono);
  font-size: 13px;
  padding-left: 18px;
  position: relative;
}
.stack-col li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--muted);
}
@media (max-width: 920px) { .stack-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stack-grid { grid-template-columns: 1fr; } }

/* CTA BIG */
.cta-big {
  padding: 160px var(--pad);
  border-top: 1px solid var(--line);
  position: relative;
}
.cta-big__inner { max-width: 1440px; margin: 0 auto; }
.cta-big__title {
  font-family: var(--sans);
  font-size: clamp(48px, 10vw, 180px);
  font-weight: 900;
  line-height: .9;
  letter-spacing: -.04em;
  text-transform: uppercase;
  margin: 30px 0 60px;
}
.cta-big__title em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  text-transform: lowercase;
}
.cta-big__mail {
  font-family: var(--mono);
  font-size: clamp(28px, 6vw, 100px);
  font-weight: 400;
  text-transform: lowercase;
  color: var(--accent);
  border-bottom: 4px solid var(--accent);
  display: inline-block;
  line-height: 1.1;
}
.cta-big__row {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  font-family: var(--mono);
  font-size: 14px;
  border-top: 1px solid var(--line);
  padding-top: 30px;
}
.cta-big__row a { transition: color .25s; }
.cta-big__row a:hover { color: var(--accent); }

/* FOOTER */
.footer {
  padding: 30px var(--pad);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ============ HELPERS ============ */
[data-split] .char,
[data-split-words] .word-anim { display: inline-block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  #gl { display: none; }
  .marquee__track { animation: none; }
}

/* =========================================================
   🎨 COLOR LAYER — Orbs, dividers, rainbow effects
   ========================================================= */

/* Giant conic-gradient orb in background, follows scroll */
.color-orb {
  position: fixed;
  top: 50%; left: 50%;
  width: 80vmin;
  height: 80vmin;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  opacity: .35;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    from 0deg,
    var(--c-orange),
    var(--c-pink),
    var(--c-violet),
    var(--c-cyan),
    var(--c-lime),
    var(--c-yellow),
    var(--c-orange)
  );
  animation: spinOrb 18s linear infinite;
  mix-blend-mode: screen;
}
[data-theme="light"] .color-orb { opacity: .25; mix-blend-mode: multiply; }

@keyframes spinOrb {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Rainbow divider band between sections */
.rainbow-band {
  position: relative;
  height: 4px;
  margin: 0 calc(-1 * var(--pad));
  background: linear-gradient(90deg,
    var(--c-orange), var(--c-pink), var(--c-violet),
    var(--c-cyan), var(--c-lime), var(--c-yellow), var(--c-orange)
  );
  background-size: 200% 100%;
  animation: shiftBand 6s linear infinite;
  opacity: .85;
}
@keyframes shiftBand {
  to { background-position: -200% 0; }
}

/* Marquee text gets a rainbow gradient */
.marquee__track span:nth-child(7n+1) { color: var(--c-orange); }
.marquee__track span:nth-child(7n+2) { color: var(--c-pink); }
.marquee__track span:nth-child(7n+3) { color: var(--c-violet); }
.marquee__track span:nth-child(7n+4) { color: var(--c-cyan); }
.marquee__track span:nth-child(7n+5) { color: var(--c-lime); }
.marquee__track span:nth-child(7n+6) { color: var(--c-yellow); }
.marquee__track span:nth-child(7n+7) { color: var(--c-magenta); }

/* Hero title chars cycling colors (driven by JS via --hue) */
.hero__title .word span { transition: color .4s; }

/* Stack cards: each col its own color */
.stack-col:nth-child(1) { --col: var(--c-orange); }
.stack-col:nth-child(2) { --col: var(--c-cyan); }
.stack-col:nth-child(3) { --col: var(--c-lime); }
.stack-col:nth-child(4) { --col: var(--c-pink); }
.stack-col .stack-col__title { color: var(--col); }
.stack-col:hover { border-color: var(--col); box-shadow: 0 10px 50px -10px var(--col); }
.stack-col:hover .stack-col__title { text-shadow: 0 0 18px var(--col); }

/* Stat numbers cycle palette */
.stat:nth-child(1) .stat__num { color: var(--c-orange); }
.stat:nth-child(2) .stat__num { color: var(--c-cyan); }
.stat:nth-child(3) .stat__num { color: var(--c-lime); }
.stat:nth-child(4) .stat__num { color: var(--c-pink); }

/* Work item titles get hover color cycling */
.work-item:nth-child(1):hover { color: var(--c-orange); }
.work-item:nth-child(2):hover { color: var(--c-pink); }
.work-item:nth-child(3):hover { color: var(--c-violet); }
.work-item:hover .work-item__col.title {
  background: linear-gradient(90deg, currentColor, var(--c-yellow));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Optical "moiré" stripe panel — pinned section */
.optic {
  position: relative;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.optic__bg {
  position: absolute; inset: -10%;
  background:
    repeating-conic-gradient(
      from 0deg at 50% 50%,
      var(--c-orange) 0deg 6deg,
      var(--c-pink)   6deg 12deg,
      var(--c-violet) 12deg 18deg,
      var(--c-cyan)   18deg 24deg,
      var(--c-lime)   24deg 30deg,
      var(--c-yellow) 30deg 36deg
    );
  filter: blur(.5px);
  opacity: .55;
  transform-origin: center;
  mix-blend-mode: screen;
}
[data-theme="light"] .optic__bg { mix-blend-mode: multiply; opacity: .45; }
.optic__overlay {
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, transparent 30%, var(--bg) 75%);
}
.optic__content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 var(--pad);
}
.optic__kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .25em;
  color: var(--muted);
  text-transform: uppercase;
}
.optic__title {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(48px, 10vw, 180px);
  font-weight: 400;
  line-height: .95;
  letter-spacing: -.02em;
  margin: 20px 0;
  background: linear-gradient(90deg,
    var(--c-orange), var(--c-pink), var(--c-violet),
    var(--c-cyan), var(--c-lime), var(--c-yellow));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shiftBand 8s linear infinite;
}

/* Color tiles grid (section optical) */
.tiles {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 80px var(--pad);
  max-width: 1440px;
  margin: 0 auto;
}
.tile {
  aspect-ratio: 1;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}
.tile::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--col, #fff);
  opacity: .9;
  transition: transform .6s cubic-bezier(.6,0,.2,1);
}
.tile:nth-child(6n+1) { --col: var(--c-orange); }
.tile:nth-child(6n+2) { --col: var(--c-pink); }
.tile:nth-child(6n+3) { --col: var(--c-violet); }
.tile:nth-child(6n+4) { --col: var(--c-cyan); }
.tile:nth-child(6n+5) { --col: var(--c-lime); }
.tile:nth-child(6n+6) { --col: var(--c-yellow); }
@media (max-width: 720px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

/* Skewable wrapper (driven by JS scroll velocity) */
.skewable { will-change: transform; }

/* Section headings get a colored bar underline driven by scroll */
.section__head {
  position: relative;
}
.section__head::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: var(--prog, 0%);
  height: 2px;
  background: linear-gradient(90deg,
    var(--c-orange), var(--c-pink), var(--c-violet),
    var(--c-cyan), var(--c-lime), var(--c-yellow));
  transition: width .1s linear;
}

/* Parallax helpers */
[data-parallax] { will-change: transform; }

/* Glow pulse on hero accent word */
.hero__title .italic {
  text-shadow:
    0 0 30px color-mix(in oklab, var(--accent) 60%, transparent),
    0 0 80px color-mix(in oklab, var(--accent) 30%, transparent);
  animation: hueRotate 12s linear infinite;
}
@keyframes hueRotate {
  to { filter: hue-rotate(360deg); }
}

/* Magnetic mail link rainbow border */
.cta-big__mail {
  background: linear-gradient(90deg,
    var(--c-orange), var(--c-pink), var(--c-violet),
    var(--c-cyan), var(--c-lime), var(--c-yellow), var(--c-orange));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  border-bottom: 4px solid;
  border-image: linear-gradient(90deg,
    var(--c-orange), var(--c-pink), var(--c-violet),
    var(--c-cyan), var(--c-lime), var(--c-yellow)) 1;
  animation: shiftBand 5s linear infinite;
}

/* =========================================================
   🎯 CONTACT FINAL — pinned scroll-reveal section
   ========================================================= */
.contact-final {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 120px var(--pad);
  border-top: 1px solid var(--line);
  isolation: isolate;
}

/* Floating colored orbits (blurred) */
.cf-orbits { position: absolute; inset: 0; pointer-events: none; }
.cf-orbit {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .6;
  mix-blend-mode: screen;
}
.cf-orbit--1 {
  width: 480px; height: 480px;
  top: -10%; left: -8%;
  background: radial-gradient(circle, var(--c-pink), transparent 70%);
  animation: orbitFloat1 14s ease-in-out infinite;
}
.cf-orbit--2 {
  width: 520px; height: 520px;
  bottom: -15%; right: -10%;
  background: radial-gradient(circle, var(--c-cyan), transparent 70%);
  animation: orbitFloat2 18s ease-in-out infinite;
}
.cf-orbit--3 {
  width: 380px; height: 380px;
  top: 40%; left: 50%;
  background: radial-gradient(circle, var(--c-yellow), transparent 70%);
  animation: orbitFloat3 12s ease-in-out infinite;
}
@keyframes orbitFloat1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(60px,40px) scale(1.15); } }
@keyframes orbitFloat2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-50px,-60px) scale(1.2); } }
@keyframes orbitFloat3 { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-40%,-60%) scale(1.3); } }
[data-theme="light"] .cf-orbit { mix-blend-mode: multiply; opacity: .35; }

/* Floating words around */
.cf-floats {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.cf-float {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 3vw, 44px);
  color: var(--c);
  opacity: .85;
  text-shadow: 0 0 20px color-mix(in oklab, var(--c) 50%, transparent);
  white-space: nowrap;
  user-select: none;
}

/* Rotating ring SVG */
.cf-ring {
  position: absolute;
  width: clamp(360px, 45vmin, 600px);
  aspect-ratio: 1;
  color: var(--fg);
  opacity: .55;
  animation: ringSpin 22s linear infinite;
  pointer-events: none;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }

/* Content */
.cf-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}
.cf-kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--muted);
  text-transform: uppercase;
}
.cf-title {
  font-family: var(--sans);
  font-size: clamp(48px, 9vw, 140px);
  font-weight: 900;
  line-height: .95;
  letter-spacing: -.04em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cf-line { display: block; overflow: hidden; }
.cf-line--italic {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  text-transform: lowercase;
  background: linear-gradient(90deg,
    var(--c-orange), var(--c-pink), var(--c-violet),
    var(--c-cyan), var(--c-lime), var(--c-yellow));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shiftBand 6s linear infinite;
}

/* Big CONTACT ME button */
.cf-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 26px 48px;
  border-radius: 999px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: clamp(16px, 1.6vw, 22px);
  font-weight: 700;
  letter-spacing: .2em;
  color: #000;
  cursor: none;
  isolation: isolate;
  margin-top: 20px;
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.cf-btn__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg,
    var(--c-orange), var(--c-pink), var(--c-violet),
    var(--c-cyan), var(--c-lime), var(--c-yellow), var(--c-orange));
  background-size: 300% 100%;
  animation: shiftBand 4s linear infinite;
}
.cf-btn__label {
  position: relative;
  display: inline-block;
  height: 1.1em;
  overflow: hidden;
}
.cf-btn__text {
  display: block;
  transition: transform .5s cubic-bezier(.7,0,.2,1);
}
.cf-btn__text--hover {
  position: absolute;
  inset: 0;
  transform: translateY(110%);
}
.cf-btn:hover .cf-btn__text { transform: translateY(-110%); }
.cf-btn:hover .cf-btn__text--hover { transform: translateY(0); }
.cf-btn:hover { transform: scale(1.05); box-shadow: 0 30px 80px -20px var(--c-pink); }
.cf-btn__arrow {
  font-size: 1.4em;
  transition: transform .4s cubic-bezier(.4,0,.2,1);
}
.cf-btn:hover .cf-btn__arrow { transform: translateX(8px) rotate(-45deg); }

.cf-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 13px;
  margin-top: 10px;
}
.cf-meta a:hover { color: var(--accent); }

/* Shockwave rings around the CONTACT button (triggered when scrolling past end) */
.cf-btn-wrap {
  position: relative;
  display: inline-block;
  isolation: isolate;
}
.cf-shock {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  border: 2px solid var(--accent);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.6);
  opacity: 0;
  z-index: -1;
  box-shadow: 0 0 40px var(--accent);
}

@media (max-width: 720px) {
  .cf-float { font-size: 16px; opacity: .6; }
  .cf-btn { padding: 22px 36px; }
}

/* =========================================================
   🌀 PORTAL TRANSITION — pinned scrub between CTA & contact
   ========================================================= */
.portal {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}
.portal__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Concentric rings */
.portal__rings {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.portal__ring {
  position: absolute;
  width: calc(120px + var(--i) * 110px);
  height: calc(120px + var(--i) * 110px);
  border-radius: 50%;
  border: 2px solid;
  opacity: .55;
  pointer-events: none;
}
.portal__ring:nth-child(1) { border-color: var(--c-orange); }
.portal__ring:nth-child(2) { border-color: var(--c-pink); }
.portal__ring:nth-child(3) { border-color: var(--c-violet); }
.portal__ring:nth-child(4) { border-color: var(--c-cyan); }
.portal__ring:nth-child(5) { border-color: var(--c-lime); }
.portal__ring:nth-child(6) { border-color: var(--c-yellow); }
.portal__ring:nth-child(7) { border-color: var(--c-magenta); }
.portal__ring:nth-child(8) { border-color: var(--c-orange); border-style: dashed; }

/* Orbiting satellites */
.portal__satellites {
  position: absolute;
  width: 1px; height: 1px;
}
.portal__sat {
  position: absolute;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 2.4vw, 36px);
  color: var(--c);
  text-shadow: 0 0 18px color-mix(in oklab, var(--c) 50%, transparent);
  white-space: nowrap;
  /* Place on a circle of radius 280px from center */
  transform:
    rotate(var(--a))
    translate(280px)
    rotate(calc(-1 * var(--a)));
  transform-origin: 0 0;
  will-change: transform;
}

/* Big scaling text */
.portal__title {
  position: relative;
  z-index: 3;
  font-family: var(--sans);
  font-size: clamp(60px, 12vw, 200px);
  font-weight: 900;
  text-transform: uppercase;
  line-height: .9;
  letter-spacing: -.04em;
  text-align: center;
  color: var(--fg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  will-change: transform;
}
.portal__word--italic {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  text-transform: lowercase;
  background: linear-gradient(90deg,
    var(--c-orange), var(--c-pink), var(--c-violet),
    var(--c-cyan), var(--c-lime), var(--c-yellow));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shiftBand 4s linear infinite;
}

/* Center hole — grows to reveal next section */
.portal__hole {
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    var(--c-orange), var(--c-pink), var(--c-violet),
    var(--c-cyan), var(--c-lime), var(--c-yellow), var(--c-orange));
  transform: translate(-50%, -50%);
  z-index: 2;
  filter: blur(0px);
  pointer-events: none;
  will-change: width, height, filter;
  animation: spinOrb 8s linear infinite;
}

/* Bottom hint */
.portal__hint {
  position: absolute;
  bottom: 30px; left: 50%;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .25em;
  color: var(--muted);
  text-transform: uppercase;
  z-index: 4;
  animation: portalHintBob 1.4s ease-in-out infinite;
}
@keyframes portalHintBob {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, 6px); }
}

/* =========================================================
   🖥️ MATRIX TERMINAL TRANSITION
   ========================================================= */
.matrix {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: #050505;
  isolation: isolate;
  color: #c8ffd2;
  font-family: var(--mono);
}

.matrix__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .85;
  z-index: 0;
}

/* CRT scanlines */
.matrix__scan {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,.35) 3px,
    rgba(0,0,0,0) 4px
  );
  mix-blend-mode: multiply;
  opacity: .6;
}

.matrix__vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 30%, #000 95%);
}

/* RGB glitch bars */
.matrix__glitch {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: .35;              /* baseline visible, JS amplifies on scroll */
}
.matrix__bar {
  position: absolute;
  left: 0; right: 0;
  top: var(--t);
  height: var(--h);
  background:
    linear-gradient(90deg,
      rgba(255,0,80,.7) 0%,
      rgba(0,200,255,.7) 50%,
      rgba(180,255,60,.7) 100%);
  transform: translateX(0);
  filter: blur(1px);
  animation: glitchBar 1.2s steps(12) infinite var(--d);
}
@keyframes glitchBar {
  0%   { transform: translateX(0) scaleY(1); }
  10%  { transform: translateX(-40px) scaleY(2); }
  20%  { transform: translateX(30px) scaleY(.5); }
  35%  { transform: translateX(-10px) scaleY(1.5); }
  50%  { transform: translateX(60px) scaleY(1); }
  70%  { transform: translateX(-20px) scaleY(.7); }
  100% { transform: translateX(0) scaleY(1); }
}

.matrix__stage {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
}

/* Corner labels */
.matrix__label {
  position: absolute;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #8aff9d;
  opacity: .7;
  padding: 6px 10px;
  border: 1px solid rgba(138,255,157,.35);
  border-radius: 4px;
  background: rgba(0,20,5,.4);
  font-variant-numeric: tabular-nums;
}
.matrix__label--tl { top: 24px; left: 24px; }
.matrix__label--tr { top: 24px; right: 24px; }
.matrix__label--bl { bottom: 24px; left: 24px; color: #ff6a6a; border-color: rgba(255,106,106,.45); background: rgba(25,0,0,.4); }
.matrix__label--bl::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ff3838;
  margin-right: 6px;
  vertical-align: middle;
  animation: pulse 1.2s infinite;
}
.matrix__label--br { bottom: 24px; right: 24px; }

/* Terminal window */
.term {
  width: min(720px, 92%);
  background: rgba(0, 8, 4, .82);
  border: 1px solid rgba(138, 255, 157, .35);
  border-radius: 10px;
  box-shadow:
    0 30px 100px rgba(0,255,120,.12),
    0 0 0 1px rgba(0,0,0,.6) inset;
  backdrop-filter: blur(8px);
  overflow: hidden;
  transform: perspective(900px) rotateX(4deg);
}
.term__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(0, 20, 8, .9);
  border-bottom: 1px solid rgba(138,255,157,.2);
}
.term__dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.term__title {
  margin-left: 12px;
  font-size: 11px;
  color: #8aff9d;
  opacity: .7;
  letter-spacing: .05em;
}
.term__body {
  padding: 22px 22px 28px;
  font-size: clamp(13px, 1.4vw, 16px);
  line-height: 1.8;
  min-height: 340px;
}
.term__line {
  color: #c8ffd2;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.8em;
}
.term__line::before {
  content: attr(data-typed);
  text-shadow: 0 0 8px rgba(180, 255, 190, .35);
}
.term__line--out { color: #7fe8a0; opacity: .85; }
.term__line--out::before { text-shadow: 0 0 6px rgba(127, 232, 160, .4); }
.term__line--ok { color: var(--c-lime); }
.term__line--ok::before { text-shadow: 0 0 10px var(--c-lime); }
.term__line--blink.is-live::after {
  content: "";
  display: inline-block;
  width: .6em;
  height: 1em;
  background: #c8ffd2;
  vertical-align: -2px;
  margin-left: 2px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Big glitch title */
.matrix__title {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.7);
  font-family: var(--sans);
  font-weight: 900;
  font-size: clamp(44px, 9vw, 140px);
  letter-spacing: -.04em;
  color: transparent;
  pointer-events: none;
  z-index: 6;
  opacity: 0;     /* driven by scroll */
  mix-blend-mode: screen;
  white-space: nowrap;
}
.matrix__title span {
  display: inline-block;
  color: #e7ffe9;
  position: relative;
  text-shadow:
    3px 0 0 rgba(255, 0, 80, .75),
    -3px 0 0 rgba(0, 200, 255, .75),
    0 0 30px rgba(180, 255, 160, .35);
}

@media (max-width: 720px) {
  .term__body { min-height: 280px; padding: 16px; }
  .matrix__label { font-size: 9px; padding: 4px 8px; }
}

/* =========================================================
   🇫🇷 🇬🇧 LANGUAGE SWITCHER
   ========================================================= */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(6px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  transition: color .25s ease, background .25s ease, transform .2s ease;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.lang-btn:hover {
  color: var(--fg);
  transform: translateY(-1px);
}
.lang-btn.is-active {
  color: var(--fg);
  background: color-mix(in oklab, var(--fg) 12%, transparent);
}
.lang-flag {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  display: block;
  box-shadow: 0 0 0 1px rgba(0,0,0,.18) inset;
  overflow: hidden;
  flex-shrink: 0;
}
.lang-sep {
  color: var(--muted);
  opacity: .5;
}

/* =========================================================
   📱 MOBILE OPTIMIZATIONS (≤ 768px)
   - Touch-friendly UI, lighter visuals, no broken pinned scrolls
   - Desktop behavior is untouched above this breakpoint
   ========================================================= */
@media (max-width: 768px) {

  :root {
    --pad: 18px;
  }

  body {
    cursor: auto;
    font-size: 14px;
    line-height: 1.55;
    -webkit-tap-highlight-color: transparent;
  }

  /* Kill custom cursor + heavy fixed visuals on mobile */
  .cursor { display: none !important; }
  .noise  { opacity: .035; }
  #gl     { opacity: .35; }
  .color-orb { display: none; }

  /* ---- Topbar ---- */
  .topbar {
    padding: 12px var(--pad);
    gap: 10px;
    flex-wrap: wrap;
  }
  .topbar__brand { font-size: 13px; }
  .topbar__brand .muted { display: none; }
  .topbar__right { gap: 8px; }
  .btn-contact {
    padding: 8px 14px;
    font-size: 11px;
    letter-spacing: .12em;
  }
  .btn-contact span:not(.btn-contact__dot) {
    display: inline;
  }

  /* ---- Hero ---- */
  .hero {
    padding-top: 80px;
    min-height: auto;
    padding-bottom: 40px;
  }
  .hero__top {
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
  }
  .hero__title { font-size: clamp(48px, 14vw, 90px) !important; line-height: .95; }
  .hero__title .word { font-size: inherit; }
  .hero__title .small { font-size: 14px; margin-top: 12px; }
  .hero__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    margin-top: 30px;
  }
  .hero__meta { flex-wrap: wrap; gap: 8px; font-size: 12px; }
  .badge { font-size: 11px; padding: 4px 8px; }

  /* ---- Marquee: faster, smaller ---- */
  .marquee { margin-top: 24px; }
  .marquee__track { font-size: 18px; gap: 22px; }

  /* ---- Lang switch: compact ---- */
  .lang-switch { padding: 3px 6px; font-size: 10px; }
  .lang-btn { padding: 3px 6px; gap: 4px; }
  .lang-flag { width: 14px; height: 10px; }

  /* ---- Sections general ---- */
  .section { padding: 60px var(--pad) !important; }
  .section__head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .section__title { font-size: clamp(32px, 9vw, 56px); }
  .lead { font-size: 18px; }
  .about-grid { gap: 24px; }

  /* ---- Optic + Tiles: smaller ---- */
  .optic { min-height: 70vh; }
  .optic__title { font-size: clamp(28px, 8vw, 56px); }
  .tiles {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 60px;
  }

  /* ---- Work list: simplified ---- */
  .work-item__link {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 18px 0;
    align-items: center;
  }
  .work-item__col.idx { font-size: 11px; }
  .work-item__col.title { font-size: clamp(22px, 6vw, 32px); }
  .work-item__col.tag { display: none; }
  .work-item__col.arrow { font-size: 18px; }
  .work-item__preview { display: none; } /* hover preview useless on touch */

  /* ---- Stack ---- */
  .stack-grid { gap: 14px; }
  .stack-col { padding: 18px; transform: none !important; }
  .stack-col__title { font-size: 14px; }
  .stack-col ul { font-size: 13px; }

  /* ---- Matrix transition: unpin, simplify ---- */
  .matrix {
    height: auto;
    min-height: 70vh;
    padding: 60px 0;
  }
  .matrix__canvas { opacity: .4; }
  .matrix__glitch { opacity: .15; }
  .matrix__title {
    font-size: clamp(28px, 9vw, 60px);
    white-space: normal;
    text-align: center;
    width: 92%;
  }
  .term {
    width: 92%;
    transform: none;
  }
  .term__head { padding: 8px 12px; }
  .term__title { font-size: 9px; }
  .term__body { padding: 14px; min-height: 240px; font-size: 12px; line-height: 1.7; }
  .matrix__label { font-size: 9px; padding: 4px 7px; letter-spacing: .12em; }
  .matrix__label--tl, .matrix__label--tr { top: 16px; }
  .matrix__label--bl, .matrix__label--br { bottom: 16px; }
  .matrix__label--tl, .matrix__label--bl { left: 16px; }
  .matrix__label--tr, .matrix__label--br { right: 16px; }

  /* ---- CTA Big ---- */
  .cta-big { padding: 80px var(--pad); }
  .cta-big__title { font-size: clamp(36px, 11vw, 72px); line-height: 1.05; }
  .cta-big__row { flex-direction: column; gap: 10px; font-size: 14px; }

  /* ---- Portal: unpin completely on mobile (broken with touch) ---- */
  .portal {
    height: auto;
    min-height: 80vh;
    padding: 60px 0;
  }
  .portal__title { font-size: clamp(60px, 18vw, 120px) !important; }
  .portal__satellites { display: none; }
  .portal__hint { font-size: 11px; bottom: 24px; }

  /* ---- Contact-final: compact ---- */
  .contact-final {
    min-height: auto;
    padding: 80px var(--pad);
  }
  .cf-title { font-size: clamp(38px, 11vw, 72px); line-height: 1.05; }
  .cf-ring { width: 240px; height: 240px; opacity: .35; }
  .cf-orbit { transform: scale(.6) !important; opacity: .25 !important; }
  .cf-floats { display: none; } /* too cluttered on small screens */
  .cf-btn {
    padding: 18px 28px;
    font-size: 14px;
    letter-spacing: .15em;
    gap: 12px;
    cursor: pointer;
  }
  .cf-meta {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    text-align: center;
  }

  /* ---- Footer ---- */
  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 24px var(--pad);
    font-size: 11px;
  }

  /* ---- Anywhere: cursor:none → pointer ---- */
  *, *::before, *::after { cursor: auto !important; }
  a, button, .magnetic { cursor: pointer !important; }

  /* Disable any heavy 3D transforms / blends that are taxing on phones */
  .stack-col, .work-item, .cf-content {
    transform: none !important;
  }
  .matrix__title, .matrix__bar { mix-blend-mode: normal; }
}

/* Very small phones (≤ 380px) */
@media (max-width: 380px) {
  .hero__title { font-size: clamp(40px, 13vw, 64px) !important; }
  .topbar__brand span:not(.dot) { font-size: 11px; }
  .btn-contact { padding: 6px 10px; font-size: 10px; }
  .btn-contact span:not(.btn-contact__dot) { display: none; } /* keep just the dot icon */
}
