/* Section Portfolio de la page d'accueil (s'appuie sur style.css) */
.portfolio {
  margin-top: 14px; min-height: 0;
  padding: clamp(40px, 5.5vw, 80px) 36px clamp(40px, 5vw, 72px);
}
.port-head { border-top: 1px solid var(--line-strong); padding-top: 18px; display: grid; gap: 0; }
.port-title {
  margin: 0; font-weight: 700; letter-spacing: -0.045em; line-height: .9;
  font-size: clamp(3.2rem, 8.5vw, 7.5rem); color: var(--ink);
}
.port-lede { margin-top: clamp(14px, 1.8vw, 22px); max-width: 40ch; font-size: clamp(1.02rem, 1.3vw, 1.2rem); line-height: 1.4; font-weight: 400; color: var(--ink); }

.reels {
  counter-reset: reel;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(14px, 1.8vw, 24px);
  max-width: 1400px; margin-top: clamp(28px, 3.6vw, 48px); align-items: start;
}
.reel { counter-increment: reel; display: grid; gap: 10px; min-width: 0; }

.reel-frame { position: relative; aspect-ratio: 9 / 17; border-radius: var(--r); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.reel-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }

.reel-poster {
  position: absolute; inset: 0; width: 100%; display: block; padding: 0; cursor: pointer;
  border: 0; color: var(--ink); font: inherit; text-align: left;
  background: var(--surface); background-size: cover; background-position: center;
}
/* Numéro de vignette, tant qu'il n'y a pas de couverture */
.reel-poster::before {
  content: counter(reel, decimal-leading-zero);
  position: absolute; left: 16px; top: 14px; font-size: .8rem; font-weight: 600; letter-spacing: .14em; color: var(--muted);
}
.reel-poster.has-cover::before { display: none; }
/* Avec une couverture, le texte est déjà dans l'image : on ne garde que le bouton lecture */
.reel-poster.has-cover .reel-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.reel-poster.has-cover .reel-play { bottom: 16px; width: 48px; height: 48px; box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 6px 16px rgba(0,0,0,.35); }
.reel-play {
  position: absolute; left: 16px; bottom: 56px;
  width: 52px; height: 52px; border-radius: 50%; background: var(--ink); color: var(--surface);
  display: grid; place-items: center; padding-left: 3px; transition: background-color .2s;
}
.reel-poster:hover .reel-play { background: var(--accent); }
.reel-label { position: absolute; left: 16px; right: 16px; bottom: 16px; font-weight: 600; font-size: 1rem; line-height: 1.2; text-wrap: balance; }
.reel-badge {
  position: absolute; right: 12px; top: 12px; padding: 4px 8px; border-radius: 4px;
  font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: var(--ink); color: var(--surface);
}

.reel-open { justify-self: start; font-weight: 500; font-size: .92rem; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }
.reel-open:hover { color: var(--ink); }

.port-more {
  display: inline-flex; margin-top: clamp(22px, 3vw, 36px); padding: 12px 20px; border-radius: var(--r);
  background: var(--ink); color: var(--hero); font-weight: 600; transition: opacity .2s;
}
.port-more:hover { opacity: .85; }

@media (max-width: 960px) {
  .portfolio { padding: 36px 18px 30px; }
  .reels {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px;
    margin-left: -18px; margin-right: -18px; padding: 4px 18px 10px; scrollbar-width: none;
  }
  .reels::-webkit-scrollbar { display: none; }
  .reel { flex: 0 0 min(76vw, 320px); scroll-snap-align: center; }
}

/* Deuxième bouton (TikTok) : contour */
.port-more-alt { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); margin-left: 8px; }
@media (max-width: 960px) { .port-more { display: flex; justify-content: center; } .port-more-alt { margin-left: 0; margin-top: 10px; } }

/* ---------- Dossiers en verre ---------- */
:root { --fold-a: #c9d8f6; --fold-b: #aebfe6; --fold-tab: #c1d1f2; }
:root[data-theme="dark"] { --fold-a: #25325e; --fold-b: #1b2547; --fold-tab: #212d57; }
.folders {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(26px, 3.4vw, 48px);
  max-width: 1060px; margin-top: clamp(40px, 5vw, 64px); padding-top: 14px;
}
.folder {
  position: relative; display: block; width: 100%; aspect-ratio: 1.22; margin-top: 30px; padding: 0;
  border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: transform .25s ease;
}
a.folder { text-decoration: none; }
.folder:hover:not(:disabled) { transform: translateY(-4px); }
.folder:disabled { cursor: default; }
.fb { position: absolute; inset: 0; border-radius: 24px; background: linear-gradient(160deg, var(--fold-a), var(--fold-b)); }
.fb::before { content: ""; position: absolute; left: 0; top: -28px; width: 46%; height: 44px; border-radius: 18px 24px 0 0; background: linear-gradient(160deg, var(--fold-a), var(--fold-tab)); }
.covers { position: absolute; left: 7%; right: 7%; top: -8%; height: 70%; display: flex; gap: 3%; justify-content: center; transition: transform .25s ease; }
.folder:hover:not(:disabled) .covers { transform: translateY(-8px); }
.covers i { flex: 1; border-radius: 12px; background-size: cover; background-position: center; box-shadow: 0 8px 20px rgba(15, 26, 58, .28); transform-origin: bottom center; }
.covers i:nth-child(1) { transform: rotate(-5deg) translateY(10px); }
.covers i:nth-child(2) { transform: translateY(-6px); }
.covers i:nth-child(3) { transform: rotate(5deg) translateY(10px); }
.covers i:only-child { transform: translateY(-4px); max-width: 38%; }
.ff {
  position: absolute; left: 0; right: 0; bottom: 0; height: 60%; border-radius: 22px; padding: 16px 18px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  background: var(--lg-fill); -webkit-backdrop-filter: blur(20px) saturate(190%); backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid var(--lg-edge); box-shadow: inset 0 1px 0 var(--lg-hi), var(--lg-shadow);
}
.ff-text { min-width: 0; }
.ff b { display: block; font-size: clamp(1.25rem, 1.9vw, 1.55rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.ff small { display: block; margin-top: 4px; color: var(--muted); font-size: .92rem; }
.go { flex: none; width: 48px; height: 48px; border-radius: 15px; background: var(--ink); color: var(--hero); display: grid; place-items: center; box-shadow: 0 8px 18px rgba(15, 26, 58, .3); }
.folder[aria-pressed="true"] .ff { box-shadow: inset 0 1px 0 var(--lg-hi), var(--lg-shadow), 0 0 0 2px var(--ink); }
.folder.is-dark .fb { background: linear-gradient(160deg, #27315a, #141b38); }
.folder.is-dark .fb::before { background: linear-gradient(160deg, #27315a, #222c52); }
.folder.is-dark .ff { background: linear-gradient(135deg, rgba(20, 24, 40, .82), rgba(10, 14, 28, .92)); border-color: rgba(255, 255, 255, .18); color: #fff; }
.folder.is-dark .ff small { color: #aab6d6; }
.folder.is-dark .go { background: #fff; color: #0f1a3a; }
.folder.is-soon .ff { height: 56%; }
.folder.is-soon .go { opacity: .35; }
.reels { margin-top: clamp(32px, 4vw, 52px); }

@media (max-width: 960px) {
  .folders {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 18px; margin-left: -18px; margin-right: -18px;
    padding: 14px 18px 8px; scrollbar-width: none;
  }
  .folders::-webkit-scrollbar { display: none; }
  .folder { flex: 0 0 min(78vw, 320px); scroll-snap-align: center; }
}

/* ---------- Ouverture du portfolio : dégradé bleu + typo large ---------- */
@font-face { font-family: "Unbounded"; font-weight: 900; font-display: swap; src: url("fonts/unbounded-latin-900-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); }

.port-hero {
  --ph-ink: #0b1533; --ph-ghost: rgba(255,255,255,.42); --ph-grid: rgba(255,255,255,.35);
  margin-top: 14px; min-height: min(760px, 100svh); color: var(--ph-ink);
  background: radial-gradient(120% 120% at 0% 100%, #fff 0%, rgba(255,255,255,0) 45%), linear-gradient(100deg, #dbeafe 0%, #9fd0ff 45%, #4aa3f5 100%);
}
:root[data-theme="dark"] .port-hero {
  --ph-ink: #eef3ff; --ph-ghost: rgba(127,164,255,.14); --ph-grid: rgba(127,164,255,.14);
  background: radial-gradient(110% 110% at 0% 100%, rgba(127,164,255,.14) 0%, rgba(127,164,255,0) 45%), linear-gradient(100deg, #0c1530 0%, #14254f 50%, #233f86 100%);
}
.port-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .6;
  background-image: linear-gradient(var(--ph-grid) 1px, transparent 1px), linear-gradient(90deg, var(--ph-grid) 1px, transparent 1px); background-size: 48px 48px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 60%); mask-image: linear-gradient(90deg, transparent 0%, #000 60%);
}
.corner { position: absolute; z-index: 3; font-weight: 600; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; line-height: 1.35; color: var(--ph-ink); }
a.corner:hover { opacity: .7; }
.corner.tl { top: 30px; left: 36px; } .corner.tr { top: 30px; right: 36px; }
.corner.bl { bottom: 30px; left: 36px; } .corner.br { bottom: 30px; right: 36px; text-align: right; }
.corner.tc, .corner.bc { left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; text-align: center; white-space: nowrap; }
.corner.tc { top: 30px; } .corner.bc { bottom: 30px; }
.star { width: 14px; height: 14px; display: inline-block; background: var(--ph-ink); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); flex: none; }
.ph-ghost {
  position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); z-index: 0; pointer-events: none; white-space: nowrap;
  font: italic 400 clamp(7rem, 24vw, 22rem)/1 "Instrument Serif", Georgia, serif; letter-spacing: -.02em; color: var(--ph-ghost);
}
.ph-center { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; text-align: center; padding: 0 24px; }
.ph-hi { display: flex; align-items: center; gap: 18px; font: italic 400 clamp(1.7rem, 3.6vw, 3.2rem)/1 "Instrument Serif", Georgia, serif; }
.ph-big { margin: .12em 0 0; font: 900 clamp(2.4rem, 9.2vw, 9rem)/1 "Unbounded", var(--font); letter-spacing: -.02em; text-transform: uppercase; color: var(--ph-ink); }
.ph-sub { margin-top: 22px; max-width: 44ch; font-size: 1.1rem; line-height: 1.4; }
.ph-cta { display: inline-flex; align-items: center; gap: 10px; margin-top: 26px; padding: 13px 22px; border-radius: var(--r); background: var(--ph-ink); color: #dce7fb; font-weight: 600; transition: opacity .2s; }
:root[data-theme="dark"] .ph-cta { background: #eef3ff; color: #0b1533; }
.ph-cta:hover { opacity: .85; }

@media (max-width: 960px) {
  .port-hero { min-height: 640px; }
  .corner { font-size: .68rem; }
  .corner.tl, .corner.bl { left: 18px; } .corner.tr, .corner.br { right: 18px; }
  .corner.tl, .corner.tr { top: 22px; } .corner.tc { display: none; }
  .corner.bl, .corner.br { bottom: 22px; } .corner.bc { bottom: 74px; }
}

/* ---------- Animations d'ouverture (jouées par hero.js) ---------- */
.port-hero.anim .ph-hi {
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 25%, transparent 31%, transparent 100%); mask-image: linear-gradient(90deg, #000 0%, #000 25%, transparent 31%, transparent 100%);
  -webkit-mask-size: 400% 100%; mask-size: 400% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0; mask-position: 100% 0;
  transition: -webkit-mask-position 2.4s cubic-bezier(.45,.05,.35,1) .15s, mask-position 2.4s cubic-bezier(.45,.05,.35,1) .15s;
}
.port-hero.anim .ph-hi .star { opacity: 0; transform: scale(.2) rotate(-90deg); transition: opacity .6s ease, transform .8s cubic-bezier(.2,1.2,.3,1); }
.port-hero.anim.is-in .ph-hi { -webkit-mask-position: 0 0; mask-position: 0 0; }
.port-hero.anim.is-in .ph-hi .star { opacity: 1; transform: none; transition-delay: 0s; }
.port-hero.anim.is-in .ph-hi .star:last-child { transition-delay: 2.3s; }
.port-hero.anim.is-in .ph-hi .star:first-child { transition-delay: .1s; }

.port-hero.anim .ph-big { opacity: 0; transform: translateY(70px); filter: blur(22px); will-change: transform, filter, opacity; }
.port-hero.anim.is-in .ph-big {
  opacity: 1; transform: none; filter: blur(0);
  transition: opacity 1.5s cubic-bezier(.16,1,.3,1) .9s, transform 1.7s cubic-bezier(.16,1,.3,1) .9s, filter 1.5s cubic-bezier(.16,1,.3,1) .9s;
}
.port-hero.anim .ph-sub, .port-hero.anim .ph-cta { opacity: 0; transform: translateY(18px); }
.port-hero.anim.is-in .ph-sub { opacity: 1; transform: none; transition: opacity .9s ease 2s, transform .9s cubic-bezier(.16,1,.3,1) 2s; }
.port-hero.anim.is-in .ph-cta { opacity: 1; transform: none; transition: opacity .9s ease 2.3s, transform .9s cubic-bezier(.16,1,.3,1) 2.3s, background-color .2s; }
.port-hero.anim .ph-ghost { opacity: 0; transition: opacity 2s ease; }
.port-hero.anim.is-in .ph-ghost { opacity: 1; transition-delay: 1.2s; }

/* Les vidéos arrivent une à une quand on ouvre un dossier */
@keyframes reelIn { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
.reels.enter .reel { animation: reelIn .8s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(.45s + var(--i, 0) * .12s); }
@media (prefers-reduced-motion: reduce) { .reels.enter .reel { animation: none; } }
