/* =================================================================
   celianghelid.com — Refonte v2
   Front sur-mesure, vanilla. Design: dark editorial audacieux.
   ================================================================= */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100%; }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ---------- Tokens ---------- */
:root {
  --bg: #07070a;
  --bg-2: #0c0c11;
  --bg-3: #121219;
  --fg: #f4f3f7;
  --muted: #8d8d9b;
  --muted-2: #5e5e6b;
  --line: rgba(255,255,255,0.10);
  --line-2: rgba(255,255,255,0.06);
  --accent: #6c63ff;                  /* signature, surchargé par projet */
  --accent-soft: rgba(108,99,255,0.16);

  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;

  --container: min(1320px, 92vw);
  --gutter: clamp(20px, 5vw, 64px);

  --t-fast: .35s cubic-bezier(.22,1,.36,1);
  --t: .6s cubic-bezier(.22,1,.36,1);
  --t-slow: 1s cubic-bezier(.22,1,.36,1);

  --nav-h: 84px;
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: .01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.is-locked { overflow: hidden; }

::selection { background: var(--accent); color: #fff; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.26); background-clip: content-box; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }

/* ---------- Decorative overlays ---------- */
#grain, #vignette { position: fixed; inset: 0; pointer-events: none; }
#vignette { z-index: 2; background: radial-gradient(ellipse at center, transparent 56%, rgba(0,0,0,.55) 100%); }
#grain {
  z-index: 3; opacity: .045; mix-blend-mode: overlay;
  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='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Aurora backdrop (fixed, very subtle) */
#aurora { position: fixed; inset: -20vh -10vw; z-index: 0; pointer-events: none; filter: blur(90px); opacity: .5; }
#aurora .blob { position: absolute; border-radius: 50%; mix-blend-mode: screen; opacity: .35;
  animation: drift 26s ease-in-out infinite; }
#aurora .b1 { width: 46vw; height: 46vw; left: -6vw; top: -8vh; background: radial-gradient(circle, var(--accent), transparent 60%); }
#aurora .b2 { width: 40vw; height: 40vw; right: -8vw; top: 18vh; background: radial-gradient(circle, #ff5c8a, transparent 60%); animation-delay: -8s; }
#aurora .b3 { width: 38vw; height: 38vw; left: 24vw; bottom: -16vh; background: radial-gradient(circle, #4facfe, transparent 60%); animation-delay: -16s; }
@keyframes drift {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(6vw,4vh) scale(1.12); }
  66% { transform: translate(-4vw,-3vh) scale(.94); }
}

/* App layer above decoration */
#app { position: relative; z-index: 4; }

/* ---------- Custom cursor ---------- */
#cursor, #cursor-dot { position: fixed; top: 0; left: 0; z-index: 9000; pointer-events: none; border-radius: 50%;
  transform: translate(-50%, -50%); mix-blend-mode: difference; }
#cursor { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.6); transition: width .25s, height .25s, background .25s, border-color .25s; }
#cursor-dot { width: 5px; height: 5px; background: #fff; }
body.cursor-hover #cursor { width: 64px; height: 64px; background: rgba(255,255,255,.12); border-color: transparent; }

/* ---------- Preloader ---------- */
#preloader { position: fixed; inset: 0; z-index: 9500; background: var(--bg);
  display: grid; place-items: center; transition: opacity .8s ease, visibility .8s; }
#preloader.done { opacity: 0; visibility: hidden; }
#preloader .pl-inner { text-align: center; }
#preloader .pl-name { font-family: var(--serif); font-size: clamp(28px, 6vw, 64px); letter-spacing: .01em; }
#preloader .pl-bar { width: 220px; max-width: 60vw; height: 1px; background: var(--line); margin: 22px auto 0; overflow: hidden; }
#preloader .pl-bar i { display: block; height: 100%; width: 0; background: var(--fg); transition: width .4s ease; }
#preloader .pl-pct { margin-top: 12px; font-size: 12px; letter-spacing: .3em; color: var(--muted); }

/* ---------- Scroll progress ---------- */
#progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 9100; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent)); box-shadow: 0 0 16px var(--accent); }

/* ---------- Layout helpers ---------- */
.container { width: var(--container); margin-inline: auto; }
.eyebrow { font-size: 12px; letter-spacing: .35em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.section { padding-block: clamp(90px, 14vh, 200px); position: relative; }
.section-head { display: flex; align-items: baseline; gap: 18px; margin-bottom: clamp(40px, 6vw, 84px); }
.section-head .idx { font-family: var(--serif); font-style: italic; color: var(--accent); font-size: 20px; }

/* ---------- Header / nav ---------- */
.nav { position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 8000;
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--gutter); transition: background .4s ease, backdrop-filter .4s ease, border-color .4s ease;
  border-bottom: 1px solid transparent; }
.nav.scrolled { background: rgba(7,7,10,.72); backdrop-filter: blur(14px); border-color: var(--line-2); }
.nav .brand { font-family: var(--serif); font-size: 22px; letter-spacing: .01em; }
.nav .brand b { font-weight: 500; }
.nav-links { display: flex; gap: clamp(18px, 3vw, 44px); align-items: center; }
.nav-links a { position: relative; font-size: 14px; letter-spacing: .04em; color: var(--muted); transition: color var(--t-fast); }
.nav-links a:hover, .nav-links a.active { color: var(--fg); }
.nav-links a::after { content: ""; position: absolute; left: 0; bottom: -6px; height: 1px; width: 0; background: var(--accent); transition: width var(--t-fast); }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-burger { display: none; width: 30px; height: 18px; position: relative; }
.nav-burger span { position: absolute; left: 0; height: 1.5px; width: 100%; background: var(--fg); transition: var(--t-fast); }
.nav-burger span:nth-child(1) { top: 0; } .nav-burger span:nth-child(2) { top: 50%; } .nav-burger span:nth-child(3) { bottom: 0; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(38px); transition: opacity var(--t-slow), transform var(--t-slow); }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .08s; } .reveal.d2 { transition-delay: .16s; }
.reveal.d3 { transition-delay: .24s; } .reveal.d4 { transition-delay: .32s; }

/* line mask reveal */
.line-mask { display: block; overflow: hidden; }
.line-mask > span { display: block; transform: translateY(110%); transition: transform 1s cubic-bezier(.22,1,.36,1); }
.line-mask.in > span { transform: none; }

/* ---------- Hero ---------- */
.hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
  padding: var(--nav-h) var(--gutter) 0; position: relative; }
.hero .eyebrow { margin-bottom: clamp(20px, 3vw, 34px); }
.hero h1 { font-family: var(--serif); font-weight: 400; line-height: .98;
  font-size: clamp(54px, 13vw, 220px); letter-spacing: -0.02em; }
.hero h1 em { font-style: italic; color: transparent;
  background: linear-gradient(120deg, var(--accent), #ff7eb3 60%, #4facfe); -webkit-background-clip: text; background-clip: text; }
.hero .sub { margin-top: clamp(24px, 4vw, 46px); display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: clamp(15px, 1.4vw, 19px); }
.hero .sub::before { content: ""; width: 46px; height: 1px; background: var(--muted-2); }
.hero .scroll-cue { position: absolute; left: var(--gutter); bottom: 34px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; letter-spacing: .3em; }
.hero .scroll-cue .ln { width: 1px; height: 40px; background: linear-gradient(var(--fg), transparent); animation: cue 2s ease-in-out infinite; transform-origin: top; }
@keyframes cue { 0%,100% { transform: scaleY(.3); opacity: .4; } 50% { transform: scaleY(1); opacity: 1; } }

/* ---------- Marquee ---------- */
.marquee { border-block: 1px solid var(--line-2); padding-block: 22px; overflow: hidden; white-space: nowrap; }
.marquee .track { display: inline-flex; gap: 0; animation: marq 32s linear infinite; }
.marquee:hover .track { animation-play-state: paused; }
.marquee span { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 3vw, 40px); color: var(--muted); padding-inline: 28px; }
.marquee span::after { content: "✦"; color: var(--accent); margin-left: 56px; font-style: normal; font-size: .5em; vertical-align: middle; }
@keyframes marq { to { transform: translateX(-50%); } }

/* ---------- Selected work ---------- */
.work-list { display: flex; flex-direction: column; }
.work-item { position: relative; display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--line-2); padding-block: clamp(26px, 3vw, 40px); }
.work-item:last-child { border-bottom: 1px solid var(--line-2); }
.work-link { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: clamp(16px, 3vw, 50px); }
.work-item .num { font-family: var(--serif); font-style: italic; color: var(--muted-2); font-size: 18px; transition: color var(--t); }
.work-item .meta { display: flex; flex-direction: column; gap: 10px; }
.work-item .cat { font-size: 12px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); }
.work-item .cat b { color: var(--accent); font-weight: 500; }
.work-item h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 5vw, 72px); line-height: 1.02; letter-spacing: -.01em; transition: transform var(--t); }
.work-item .go { font-size: 13px; letter-spacing: .1em; color: var(--muted); display: flex; align-items: center; gap: 10px; transition: color var(--t), gap var(--t); white-space: nowrap; }
.work-item .go svg { width: 18px; height: 18px; transition: transform var(--t); }
/* floating preview image follows cursor on hover (desktop) */
.work-item .thumb { position: fixed; top: 0; left: 0; width: 320px; height: 220px; pointer-events: none; z-index: 7000;
  opacity: 0; transform: translate(-50%,-50%) scale(.85); transition: opacity .4s ease, transform .4s ease; overflow: hidden; border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.work-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.work-item.peek .thumb { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.work-item:hover .num { color: var(--accent); }
.work-item:hover h3 { transform: translateX(14px); }
.work-item:hover .go { color: var(--fg); gap: 16px; }
.work-item:hover .go svg { transform: translateX(4px); }
.work-item::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 0; background: var(--accent); transition: width var(--t); }
.work-item:hover::after { width: 100%; }

/* mobile: inline image */
.work-item .thumb-inline { display: none; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(40px, 6vw, 100px); align-items: start; }
.about .statement { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 4.4vw, 60px); line-height: 1.08; letter-spacing: -.01em; }
.about .statement em { font-style: italic; color: var(--accent); }
.about .body p { color: var(--muted); font-size: clamp(15px, 1.3vw, 18px); margin-bottom: 22px; max-width: 46ch; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 54px; }
.stats .stat .n { font-family: var(--serif); font-size: clamp(34px, 5vw, 68px); line-height: 1; font-variant-numeric: tabular-nums; }
.stats .stat .l { margin-top: 10px; font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); }

/* ---------- Contact ---------- */
.contact h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 11vw, 170px); line-height: .98; letter-spacing: -.02em; }
.contact h2 em { font-style: italic; color: var(--accent); }
.contact .cta { display: inline-flex; align-items: center; gap: 18px; margin-top: clamp(28px, 4vw, 50px); font-size: clamp(18px, 2.4vw, 30px); }
.contact .cta svg { width: 28px; height: 28px; transition: transform var(--t); }
.contact .cta:hover svg { transform: translate(6px,-6px); }
.contact .details { display: flex; flex-wrap: wrap; gap: clamp(30px,6vw,90px); margin-top: clamp(50px,8vw,110px); }
.contact .details .blk .k { font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.contact .details .blk .v { font-size: clamp(16px,1.6vw,20px); }
.contact .details .blk .v small { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line-2); padding: 40px var(--gutter); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 13px; }
.footer .to-top { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); transition: color var(--t-fast); }
.footer .to-top:hover { color: var(--fg); }

/* ================= Project detail ================= */
.pd-hero { position: relative; min-height: 100svh; display: flex; align-items: flex-end; padding: var(--nav-h) var(--gutter) clamp(40px,7vh,90px); overflow: hidden; }
.pd-hero .bg { position: absolute; inset: 0; z-index: -1; }
.pd-hero .bg img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.05); }
.pd-hero .bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 4%, rgba(7,7,10,.35) 45%, rgba(7,7,10,.55) 100%); }
.pd-back { position: fixed; top: calc(var(--nav-h) + 6px); left: var(--gutter); z-index: 100; font-size: 13px; letter-spacing: .08em; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.pd-back:hover { color: var(--fg); }
.pd-hero .pd-cat { color: var(--accent); letter-spacing: .25em; text-transform: uppercase; font-size: 13px; }
.pd-hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 8vw, 124px); line-height: 1; letter-spacing: -.02em; margin-top: 18px; max-width: 16ch; }
.pd-hero .pd-year { margin-top: 18px; color: var(--muted); letter-spacing: .1em; }

.pd-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; border-block: 1px solid var(--line-2); }
.pd-stats .s { padding: clamp(30px,5vw,60px) 0; }
.pd-stats .s .n { font-family: var(--serif); font-size: clamp(30px,4.4vw,60px); line-height: 1; color: var(--accent); }
.pd-stats .s .l { margin-top: 10px; font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); }

.pd-body { display: grid; grid-template-columns: 1fr 1.4fr; gap: clamp(30px,6vw,90px); }
.pd-body .lead { font-family: var(--serif); font-size: clamp(20px,2.2vw,30px); line-height: 1.3; }
.pd-body .rich p { color: var(--muted); font-size: clamp(15px,1.3vw,18px); margin-bottom: 22px; max-width: 60ch; }
.pd-figure { margin-top: clamp(40px,7vw,90px); overflow: hidden; border-radius: 10px; }
.pd-figure img { width: 100%; }

.pd-nav { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line-2); margin-top: clamp(40px,7vw,90px); }
.pd-nav a { padding: clamp(30px,5vw,60px) 0; transition: background var(--t); }
.pd-nav a:last-child { text-align: right; }
.pd-nav .k { font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.pd-nav .t { font-family: var(--serif); font-size: clamp(20px,2.6vw,38px); transition: color var(--t); }
.pd-nav a:hover .t { color: var(--accent); }

/* ---------- Loading / error ---------- */
.state { min-height: 70vh; display: grid; place-items: center; text-align: center; color: var(--muted); gap: 18px; }
.spinner { width: 34px; height: 34px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- View transitions ---------- */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .5s; }
}

/* ================= Responsive ================= */
@media (max-width: 900px) {
  :root { --nav-h: 70px; }
  .nav-links { position: fixed; inset: 0; flex-direction: column; justify-content: center; gap: 30px;
    background: rgba(7,7,10,.96); backdrop-filter: blur(20px); transform: translateY(-100%); transition: transform var(--t); }
  .nav-links.open { transform: none; }
  .nav-links a { font-size: 26px; font-family: var(--serif); color: var(--fg); }
  .nav-burger { display: block; z-index: 8100; }
  body.menu-open .nav-burger span:nth-child(1) { top: 50%; transform: rotate(45deg); }
  body.menu-open .nav-burger span:nth-child(2) { opacity: 0; }
  body.menu-open .nav-burger span:nth-child(3) { bottom: 50%; transform: rotate(-45deg); }

  .about { grid-template-columns: 1fr; }
  .pd-body { grid-template-columns: 1fr; }
  .work-link { grid-template-columns: 38px 1fr; }
  .work-item .go { display: none; }
  .work-item .thumb { display: none; }
  .work-item .thumb-inline { display: block; margin-top: 20px; border-radius: 8px; overflow: hidden; aspect-ratio: 16/10; }
  .work-item .thumb-inline img { width: 100%; height: 100%; object-fit: cover; }
  .stats { grid-template-columns: 1fr 1fr; gap: 26px; }
  #cursor, #cursor-dot { display: none; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .pd-stats { grid-template-columns: 1fr; }
  .pd-nav { grid-template-columns: 1fr; }
  .pd-nav a:last-child { text-align: left; border-top: 1px solid var(--line-2); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
  .line-mask > span { transform: none; }
  #aurora, #grain { display: none; }
  #cursor, #cursor-dot { display: none; }
}
