/* =============================================================
   Portfolio Motion Design — style "timeline de montage"
   Couleurs des catégories : modifier --adv / --mus / --web
   ============================================================= */

:root {
  --bg: #0b0b0d;
  --bg-2: #141418;
  --line: #26262c;
  --text: #edeae3;
  --muted: #8b8a90;
  --adv: #ff5a36;   /* Advertising */
  --mus: #c6ff3d;   /* Music */
  --web: #3dd6ff;   /* Internet */
  --accent: var(--adv);

  --font: "Bricolage Grotesque", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --ruler: clamp(28px, 5vw, 72px);
  --top: 56px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

[data-cat="advertising"] { --c: var(--adv); }
[data-cat="music"]       { --c: var(--mus); }
[data-cat="internet"]    { --c: var(--web); }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 64px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

/* Grain de pellicule (image statique, coût quasi nul) */
.grain {
  position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== Barre du haut ===== */
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--top);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 var(--gutter);
  background: linear-gradient(var(--bg) 40%, transparent);
}
.logo { font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.tc { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 13px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2); }
.tc__value { font-variant-numeric: tabular-nums; }
.tc__rec { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.topnav { justify-self: end; display: flex; gap: clamp(12px, 2vw, 28px); font-family: var(--mono); font-size: 12px; text-transform: uppercase; }
.topnav a { opacity: .7; transition: opacity .2s; }
.topnav a:hover { opacity: 1; }

/* ===== Intro ===== */
.hero {
  min-height: 100svh;
  padding: calc(var(--top) + 6vh) var(--gutter) 6vh;
  display: flex; flex-direction: column; justify-content: center; gap: 3vh;
  position: relative;
}
.hero__kicker { color: var(--muted); margin: 0; }
.hero__title {
  margin: 0; font-weight: 700; line-height: .86; letter-spacing: -.045em;
  font-size: clamp(64px, 15vw, 250px); text-transform: uppercase;
  font-variation-settings: "opsz" 96;
}
.hero__line { display: block; overflow: hidden; }
.hero__line > span { display: inline-block; animation: rise 1.1s var(--ease) both; animation-delay: calc(var(--i) * .12s); }
.hero__line--out > span { -webkit-text-stroke: 1.5px var(--text); color: transparent; margin-left: 12vw; }
.hero__line sup { font-size: .25em; vertical-align: top; letter-spacing: 0; }
@keyframes rise { from { transform: translateY(105%); } }
.hero__lede { margin: 0; max-width: 34ch; font-size: clamp(18px, 2vw, 26px); color: var(--muted); }

.hero__tracks { display: grid; gap: 6px; margin-top: 2vh; max-width: 900px; }
.htrack { display: flex; gap: 6px; height: 22px; align-items: stretch; }
.htrack b { font: 600 10px/22px var(--mono); width: 32px; text-align: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px; }
.htrack i { border-radius: 4px; background: var(--c); opacity: .85; transform-origin: left; animation: grow 1.2s var(--ease) both; }
.htrack i:nth-of-type(1) { flex: 3; animation-delay: .3s; }
.htrack i:nth-of-type(2) { flex: 1.4; animation-delay: .45s; }
.htrack i:nth-of-type(3) { flex: 2.2; animation-delay: .6s; }
.htrack:nth-child(2) i:nth-of-type(1) { margin-left: 12%; }
@keyframes grow { from { transform: scaleX(0); } }

.hero__cue { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); align-self: flex-start; }
.play-ico { width: 0; height: 0; border-left: 9px solid var(--accent); border-block: 6px solid transparent; }

/* ===== Pistes / filtres ===== */
.tracks {
  position: sticky; top: var(--top); z-index: 40;
  padding: 10px var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-block: 1px solid var(--line);
}
.tracks__inner { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.track-btn {
  flex: none; display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  background: var(--bg-2); transition: border-color .2s, background .2s, opacity .2s;
}
.track-btn .sw { width: 10px; height: 10px; border-radius: 2px; background: var(--c, var(--text)); }
.track-btn .id { color: var(--muted); }
.track-btn .n { color: var(--muted); }
.track-btn:hover { border-color: var(--c, var(--text)); }
.track-btn[aria-pressed="true"] { border-color: var(--c, var(--text)); background: color-mix(in srgb, var(--c, var(--text)) 14%, var(--bg-2)); }

/* ===== Timeline ===== */
.timeline { position: relative; padding: 0 var(--gutter) 10vh calc(var(--gutter) + var(--ruler)); }

/* Règle verticale avec graduations + tête de lecture */
.ruler {
  position: absolute; top: 0; bottom: 0; left: var(--gutter); width: calc(var(--ruler) - 16px);
  background:
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 12px) right / 8px 100% no-repeat,
    repeating-linear-gradient(to bottom, #3a3a42 0 1px, transparent 1px 60px) right / 16px 100% no-repeat;
  border-right: 1px solid var(--line);
}
.ruler__fill {
  position: sticky; top: 0; height: 100vh; width: 2px; margin-left: auto; margin-right: -1.5px;
  background: linear-gradient(transparent, var(--accent) 50%, transparent 50.5%);
}
.ruler__fill::after { /* la tête de lecture */
  content: ""; position: absolute; top: 50%; right: -6px; width: 14px; height: 14px;
  background: var(--accent); clip-path: polygon(0 0, 100% 0, 50% 100%); transform: translateY(-100%);
}

/* Séquences (catégories) */
.seq { padding-top: 14vh; transition: opacity .4s; }
.seq__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 8vh; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.seq__marker { display: flex; align-items: center; gap: 10px; color: var(--c); margin-bottom: 14px; }
.seq__marker::before { content: ""; width: 12px; height: 12px; background: var(--c); clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%); }
.seq__title {
  margin: 0; font-weight: 700; text-transform: uppercase; letter-spacing: -.04em; line-height: .85;
  font-size: clamp(54px, 11vw, 190px);
}
.seq__count { text-align: right; color: var(--muted); white-space: nowrap; }

body[data-filter]:not([data-filter="all"]) .seq { display: none; }
body[data-filter="advertising"] .seq[data-cat="advertising"],
body[data-filter="music"] .seq[data-cat="music"],
body[data-filter="internet"] .seq[data-cat="internet"] { display: block; }

/* Grille décalée des clips */
.seq__grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: clamp(16px, 2.5vw, 40px); row-gap: 10vh; }
.clip { grid-column: 1 / 8; }
.clip.pos-1 { grid-column: 8 / 13; margin-top: 22vh; }
.clip.pos-2 { grid-column: 3 / 10; margin-top: -4vh; }
.clip.is-tall { grid-column: 2 / 6; }
.clip.is-tall.pos-1 { grid-column: 9 / 13; }
.clip.is-tall.pos-2 { grid-column: 5 / 9; }

/* Carte projet = un clip sur la timeline */
.clip__link { display: block; position: relative; cursor: none; }
.clip__head {
  display: flex; align-items: center; gap: 10px; height: 26px; padding: 0 10px;
  background: var(--c); color: #0b0b0d; border-radius: 6px 6px 0 0;
  font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em;
}
.clip__file { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; }
.clip__in { opacity: .65; font-variant-numeric: tabular-nums; }
.clip__media {
  position: relative; overflow: hidden; aspect-ratio: var(--ratio, 16/9);
  background: var(--bg-2); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-top: 0;
  border-radius: 0 0 6px 6px;
}
.clip__media img, .clip__media video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .9s var(--ease), opacity .35s;
}
.clip__media video { opacity: 0; z-index: 1; }
.clip.is-playing .clip__media video { opacity: 1; }
.clip__link:hover .clip__media img, .clip__link:hover .clip__media video { transform: scale(1.04); }
/* Bandes "pellicule" sur les bords */
.clip__media::before, .clip__media::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 10px; z-index: 2; opacity: 0; transition: opacity .3s;
  background: repeating-linear-gradient(to bottom, transparent 0 6px, rgba(0,0,0,.55) 6px 12px);
}
.clip__media::before { left: 0; } .clip__media::after { right: 0; }
.clip__link:hover .clip__media::before, .clip__link:hover .clip__media::after { opacity: 1; }
/* Barre de progression de l'aperçu */
.clip__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 3; background: rgba(255,255,255,.12); opacity: 0; transition: opacity .3s; }
.clip__bar i { display: block; height: 100%; width: 100%; background: var(--c); transform-origin: left; transform: scaleX(0); }
.clip.is-playing .clip__bar { opacity: 1; }
.clip__hint {
  position: absolute; left: 12px; bottom: 14px; z-index: 3; padding: 4px 8px; border-radius: 4px;
  background: rgba(0,0,0,.6); font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: .06em;
  opacity: 0; transform: translateY(6px); transition: .3s var(--ease);
}
.clip__link:hover .clip__hint { opacity: 1; transform: none; }

.clip__meta { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding-top: 16px; }
.clip__title { margin: 0; font-size: clamp(24px, 2.6vw, 40px); font-weight: 650; letter-spacing: -.03em; line-height: 1; }
.clip__dur { font: 400 13px var(--mono); color: var(--muted); align-self: start; padding-top: 6px; font-variant-numeric: tabular-nums; }
.clip__client { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 15px; }
.clip__role { grid-column: 1 / -1; margin: 0; font: 400 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--c); }

/* ===== Animations liées au scroll =====
   Navigateurs récents : animation-timeline (aucun JS).
   Autres : classe .is-in ajoutée par un IntersectionObserver. */
.clip__frame { clip-path: inset(0 100% 0 0 round 6px); transition: clip-path 1.1s var(--ease); }
.clip__meta  { opacity: 0; transform: translateY(20px); transition: 1s var(--ease) .15s; }
.clip.is-in .clip__frame { clip-path: inset(0 0 0 0 round 6px); }
.clip.is-in .clip__meta  { opacity: 1; transform: none; }

@supports (animation-timeline: view()) {
  .clip__frame, .clip__meta { transition: none; }
  .clip__frame { animation: wipe linear both; animation-timeline: view(); animation-range: entry 0% cover 35%; }
  .clip__meta  { animation: fadeUp linear both; animation-timeline: view(); animation-range: entry 20% cover 40%; }
  .clip__media img { animation: settle linear both; animation-timeline: view(); animation-range: entry 0% exit 100%; }
  .seq__title { animation: slide linear both; animation-timeline: view(); animation-range: entry 0% exit 60%; }
  .hero__title { animation: heroOut linear both; animation-timeline: scroll(root); animation-range: 0 90vh; }
  @keyframes wipe   { from { clip-path: inset(0 100% 0 0 round 6px); } to { clip-path: inset(0 0 0 0 round 6px); } }
  @keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
  @keyframes settle { from { scale: 1.18; } to { scale: 1; } }
  @keyframes slide  { from { translate: 8vw 0; } to { translate: -4vw 0; } }
  @keyframes heroOut { to { translate: 0 -12vh; opacity: .15; filter: blur(6px); } }
}

/* ===== Curseur personnalisé ===== */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none;
  width: 86px; height: 86px; margin: -43px 0 0 -43px; border-radius: 50%;
  display: grid; place-items: center; background: var(--text); color: var(--bg);
  font: 600 11px var(--mono); letter-spacing: .08em;
  transform: translate3d(var(--x, -200px), var(--y, -200px), 0) scale(0); transition: transform .35s var(--ease);
  will-change: transform;
}
.cursor.is-on { transform: translate3d(var(--x), var(--y), 0) scale(1); }
@media (hover: none) { .cursor { display: none; } .clip__link { cursor: pointer; } }

/* ===== À propos & contact ===== */
.about { padding: 18vh var(--gutter) 12vh calc(var(--gutter) + var(--ruler)); border-top: 1px solid var(--line); }
.about__label, .contact__label { color: var(--muted); margin: 0 0 24px; }
.about__text { margin: 0; max-width: 22ch; font-size: clamp(32px, 5vw, 76px); font-weight: 600; letter-spacing: -.035em; line-height: 1.02; }
.about__skills { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 40px 0 0; list-style: none; }
.about__skills li { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }

.contact { padding: 14vh var(--gutter) 40px; background: var(--text); color: var(--bg); }
.contact__label { color: #6c6a66; }
.contact__mail { display: block; font-size: clamp(54px, 12vw, 210px); font-weight: 750; letter-spacing: -.05em; line-height: .88; text-transform: uppercase; }
.contact__mail span { display: block; transition: transform .6s var(--ease); }
.contact__mail span + span { padding-left: 8vw; }
.contact__mail:hover span:first-child { transform: translateX(3vw); }
.contact__mail:hover span + span { transform: translateX(-3vw); }
.contact__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-top: 12vh; padding-top: 20px; border-top: 1px solid rgba(0,0,0,.15); }
.contact__socials { display: flex; gap: 20px; padding: 0; margin: 0; list-style: none; }
.contact__socials a:hover { text-decoration: underline; }

/* ===== Lecteur (popup) ===== */
.player {
  width: min(1280px, 94vw); max-width: none; max-height: 94vh; padding: 0; border: 0; background: transparent; color: var(--text);
  overflow: visible;
}
.player::backdrop { background: rgba(5,5,7,.88); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.player[open] { animation: pop .45s var(--ease); }
.player[open]::backdrop { animation: fade .35s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }
.player__frame { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.player__head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--c); color: #0b0b0d; font-weight: 600; }
.player__file { flex: 1; text-transform: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player__close { padding: 4px 8px; border-radius: 4px; background: rgba(0,0,0,.12); font-weight: 600; }
.player__close:hover { background: rgba(0,0,0,.25); }
.player__screen { background: #000; display: grid; place-items: center; }
.player__screen video { width: 100%; max-height: 70vh; aspect-ratio: var(--ratio, 16/9); object-fit: contain; background: #000; }
.player__info { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 24px; align-items: start; padding: 20px 22px 22px; }
.player__info h2 { margin: 0 0 6px; font-size: clamp(22px, 2.4vw, 34px); letter-spacing: -.03em; line-height: 1; }
.player__info p { margin: 0; color: var(--muted); }
.player__nav { display: flex; gap: 8px; }
.player__nav button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; }
.player__nav button:hover { border-color: var(--c); }

/* ===== Mobile ===== */
@media (max-width: 760px) {
  :root { --top: 52px; --ruler: 22px; }
  .topnav { display: none; }
  .topbar { grid-template-columns: 1fr auto; }
  .seq__grid { row-gap: 9vh; }
  .clip, .clip.pos-1, .clip.pos-2 { grid-column: 1 / -1; margin-top: 0; }
  .clip.is-tall, .clip.is-tall.pos-1, .clip.is-tall.pos-2 { grid-column: 2 / 12; }
  .seq__head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .seq__count { text-align: left; }
  .seq__title { font-size: 13.5vw; animation: none !important; }
  .ruler { width: 14px; }
  .player { width: 100vw; max-height: 100svh; }
  .player__info { grid-template-columns: 1fr; gap: 12px; }
  .hero__line--out > span { margin-left: 0; }
}

/* Mouvement réduit : on coupe tout ce qui bouge tout seul */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .clip__frame { clip-path: none; } .clip__meta { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

.noscript { padding: 10vh 0; color: var(--muted); }

/* ===== Showreel de l'intro ===== */
.hero { isolation: isolate; overflow: hidden; }
.reel { position: absolute; inset: 0; z-index: -1; background: var(--bg); }
.reel video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.06); transition: opacity .45s ease, transform 3.2s linear;
}
.reel video.is-on { opacity: .55; transform: scale(1); }
.reel__shade { /* assombrit le bas/gauche pour garder le texte lisible */
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(11,11,13,.88) 0%, rgba(11,11,13,.35) 55%, rgba(11,11,13,.1) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 30%, transparent 75%, rgba(11,11,13,.7) 100%);
}
.reel.is-cut::after { /* flash de coupe très bref, façon raccord */
  content: ""; position: absolute; inset: 0; background: var(--accent); mix-blend-mode: overlay; opacity: .5;
  animation: cutflash .25s ease-out forwards;
}
@keyframes cutflash { to { opacity: 0; } }

.hero__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.reel-hud {
  --c: var(--accent);
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: rgba(20,20,24,.75);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: border-color .2s;
}
.reel-hud:hover { border-color: var(--c); }
.reel-hud__label { color: var(--muted); }
.reel-hud__track { padding: 2px 6px; border-radius: 3px; background: var(--c); color: #0b0b0d; font-weight: 600; }
.reel-hud__name { text-transform: none; min-width: 12ch; text-align: left; }
.reel-hud__bar { width: 64px; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.reel-hud__bar i { display: block; height: 100%; background: var(--c); transform-origin: left; transform: scaleX(0); }
.reel-hud__bar i.is-run { transform: scaleX(1); transition: transform var(--d, 3s) linear; }
.htrack { transition: opacity .3s; }
.hero__tracks.has-active .htrack { opacity: .35; }
.hero__tracks.has-active .htrack.is-active { opacity: 1; }

@media (max-width: 760px) {
  .reel video.is-on { opacity: .4; }
  .reel__shade { background: linear-gradient(0deg, var(--bg) 0%, rgba(11,11,13,.55) 45%, rgba(11,11,13,.75) 100%); }
  .reel-hud__name { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { .reel video { transition: none; } }

/* Logo image (si renseigné dans data/projects.js) */
.logo img { height: 28px; width: auto; display: block; }
.contact__logo { height: 40px; width: auto; }

/* Ajustements intro : tient dans un écran, HUD du showreel visible dès l'arrivée */
.hero__title { font-size: clamp(64px, 12.5vw, 220px); }
.hero { gap: 2.6vh; }
@media (min-width: 761px) {
  .reel-hud { position: absolute; top: calc(var(--top) + 28px); right: var(--gutter); }
}

/* Titre de l'intro : "ClydeCreator / Artistic Director / & Motion Designer" */
.hero__title { font-size: clamp(36px, 6.4vw, 118px); line-height: .92; }
.hero__line--name { font-size: 1.8em; line-height: .86; margin-bottom: .06em; }
.hero__line--out > span { margin-left: 0; -webkit-text-stroke-width: 1.2px; }
@media (max-width: 760px) {
  .hero__title { font-size: 7.6vw; }
  .hero__line--name { font-size: 1.45em; }
}
.contact__email { font-weight: 600; text-transform: none; font-size: 14px; }
.contact__email:hover { text-decoration: underline; }
