/* ============================================================
   COLETTE — FRISES MYSTÈRES  |  style.css  v2
   ============================================================ */

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

:root {
  --gold:      #d4a853;
  --gold-lite: #f2d07a;
  --gold-dark: #9a6f2a;
  --ink:       #0c0906;
  --serif:     'Playfair Display', Georgia, serif;
  --sans:      'Inter', system-ui, sans-serif;
  --ease:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html, body {
  height: 100%; overflow: hidden;
  background: var(--ink);
  color: var(--gold);
  -webkit-font-smoothing: antialiased;
}

/* shared page layer */
.page {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.hidden { display: none !important; }

/* ============================================================
   LOADER
   ============================================================ */
#loader {
  z-index: 1000;
  background: var(--ink);
  transition: opacity .5s ease;
  display: flex; align-items: center; justify-content: center;
  position: fixed; inset: 0;
}
#loader.out { opacity: 0; pointer-events: none; }

.loader-inner { width: 48px; animation: floatQ 2s ease-in-out infinite; }
.loader-quill  { width: 100%; height: auto; display: block; }

.qs {
  stroke-dasharray: 260; stroke-dashoffset: 260;
  animation: drawIt 1.4s var(--ease) .2s forwards;
}
.qi {
  stroke-dasharray: 14; stroke-dashoffset: 14;
  animation: drawIt .4s ease 1.5s forwards;
}
@keyframes drawIt  { to { stroke-dashoffset: 0; } }
@keyframes floatQ  {
  0%,100% { transform: translateY(0)   rotate(-3deg); }
  50%     { transform: translateY(-7px) rotate(3deg); }
}

/* ============================================================
   SPLASH
   ============================================================ */
#splash { z-index: 500; overflow: hidden; }
#splash.out { animation: splashOut .85s var(--ease) forwards; }
@keyframes splashOut { to { opacity: 0; transform: scale(1.04); } }

#bg-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}

.splash-inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; gap: 2rem;
  padding: 2rem;
}

/* "Travaux de Français" label */
.splash-label {
  display: flex; align-items: center; gap: 1rem;
  opacity: 0; transform: translateY(14px);
  animation: fadeUp .7s var(--ease) .2s forwards;
}
.label-line {
  width: 50px; height: 1px;
  background: rgba(212,168,83,.35);
}
.label-text {
  font-family: var(--sans); font-weight: 300;
  font-size: .72rem; letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(212,168,83,.82);
}

/* Signature block */
.splash-sig {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  opacity: 0; transform: translateY(20px);
  animation: fadeUp .9s var(--ease) .45s forwards;
}
.splash-sig svg { width: 320px; height: auto; }
.sig-text {
  font-family: var(--serif); font-size: 82px; font-style: italic;
  fill: var(--gold); letter-spacing: -2px;
}
.sig-rule {
  width: 220px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.splash-subtitle {
  font-family: var(--sans); font-weight: 300;
  font-size: .75rem; letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(212,168,83,.85);
  margin-top: .3rem;
}

/* ? ? ? ? ? */
.q-marks {
  display: flex; gap: 1.1rem;
  opacity: 0; animation: fadeUp .7s var(--ease) .95s forwards;
}
.q-marks span {
  font-family: var(--serif); font-style: italic; font-size: 2.2rem;
  color: var(--gold); opacity: .2;
  animation: qPulse 2.6s ease-in-out infinite;
}
.q-marks span:nth-child(1) { animation-delay: 0s; }
.q-marks span:nth-child(2) { animation-delay: .28s; }
.q-marks span:nth-child(3) { animation-delay: .56s; }
.q-marks span:nth-child(4) { animation-delay: .84s; }
.q-marks span:nth-child(5) { animation-delay: 1.12s; }
@keyframes qPulse {
  0%,100% { opacity: .15; transform: scale(1); }
  50%     { opacity: .85; transform: scale(1.14); }
}

/* Enter button */
#enter-btn {
  width: 68px; height: 68px; border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--gold); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; animation: fadeUp .7s var(--ease) 1.45s forwards;
  transition: background .3s, transform .3s, box-shadow .3s;
  position: relative;
}
#enter-btn::before {
  content: ''; position: absolute; inset: -10px; border-radius: 50%;
  border: 1px solid rgba(212,168,83,.2);
  animation: ringPulse 2.2s ease-in-out infinite;
}
#enter-btn:hover {
  background: var(--gold); color: var(--ink);
  transform: scale(1.1);
  box-shadow: 0 0 40px rgba(212,168,83,.5);
}
#enter-btn svg { width: 32px; }

@keyframes ringPulse {
  0%   { transform: scale(1);   opacity: .7; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* Author sig on splash */
.author-sig {
  font-family: var(--serif); font-style: italic;
  font-size: .95rem; color: rgba(212,168,83,.8);
  letter-spacing: .08em;
  opacity: 0; animation: fadeUp .6s var(--ease) 1.8s forwards;
}

/* Challenge sig on splash */
.challenge-sig {
  font-family: var(--sans);
  font-size: .62rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(212,168,83, 0.78);
  margin-top: -0.6rem;
  opacity: 0;
  animation: fadeUp .6s var(--ease) 1.95s forwards;
  border: 1px solid rgba(212,168,83, 0.3);
  padding: 5px 14px;
  border-radius: 20px;
  background: rgba(212,168,83, 0.02);
  backdrop-filter: blur(2px);
  text-align: center;
  transition: border-color .3s ease, color .3s ease, background-color .3s ease;
}
.challenge-sig:hover {
  border-color: rgba(212,168,83, 0.4);
  color: rgba(212,168,83, 0.7);
  background: rgba(212,168,83, 0.05);
}

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   APP SHELL
   ============================================================ */
#app {
  z-index: 10; flex-direction: column;
  align-items: stretch; justify-content: flex-start;
  background: var(--ink);
}

/* ---- TOP BAR ---- */
#top-bar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 52px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: linear-gradient(to bottom, rgba(12,9,6,.95) 0%, transparent 100%);
  pointer-events: none;
}
.top-title {
  display: flex; align-items: baseline; gap: .6rem;
}
.top-label {
  font-family: var(--sans); font-weight: 300;
  font-size: .65rem; letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(212,168,83,.8);
}
.top-colette {
  font-family: var(--serif); font-style: italic; font-size: 1.2rem;
  color: var(--gold-lite);
  letter-spacing: .02em;
}
.top-author {
  font-family: var(--serif); font-style: italic;
  font-size: .85rem; color: rgba(212,168,83,.7);
}

/* ---- PROGRESS BAR ---- */
#progress-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
  background: rgba(212,168,83,.08);
}
#progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-lite));
  box-shadow: 0 0 8px rgba(212,168,83,.6);
  transition: width .6s var(--ease);
  width: 20%;
}

/* ---- DOTS NAV ---- */
#dots-nav {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px; z-index: 50;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%; padding: 0;
  background: rgba(212,168,83,.2);
  border: 1px solid rgba(212,168,83,.4);
  cursor: pointer;
  transition: background .3s, transform .3s, box-shadow .3s;
}
.dot.active {
  background: var(--gold); transform: scale(1.6);
  box-shadow: 0 0 10px rgba(212,168,83,.7);
}
.dot:hover:not(.active) { background: rgba(212,168,83,.5); transform: scale(1.3); }

/* ============================================================
   SLIDES
   ============================================================ */
#slides {
  position: absolute; inset: 0; overflow: hidden;
}

.slide {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transform: translateX(70px);
  transition: opacity .65s var(--ease), transform .65s var(--ease);
  overflow: hidden;
}
.slide.active   { opacity: 1; pointer-events: all; transform: translateX(0); }
.slide.exit-l   { opacity: 0; transform: translateX(-70px); }
.slide.exit-r   { opacity: 0; transform: translateX(70px); }

/* background gradient per hue */
.slide-bg {
  position: absolute; inset: 0; z-index: 0;
  transition: background 1s ease;
}

/* corner ornaments — via dedicated divs to avoid pseudo-element conflicts */
.slide-deco { position: absolute; z-index: 2; width: 40px; height: 40px; pointer-events: none; }
.slide-deco.top-left  { top: 18px; left: 18px; }
.slide-deco.bot-right { bottom: 18px; right: 18px; }
.slide-deco svg { width: 100%; height: 100%; }

.slide-num {
  position: absolute; bottom: 22px; left: 32px;
  font-family: var(--serif); font-style: italic; font-size: 6.5rem;
  color: rgba(212,168,83,.05); line-height: 1; pointer-events: none;
  z-index: 2; letter-spacing: -5px; user-select: none;
}

/* ============================================================
   FRISE IMAGE
   ============================================================ */
.frise-wrap {
  position: relative; z-index: 10;
  width: min(86vw, 1060px);
  margin-top: 20px; /* clear top bar */
  display: flex; align-items: center; justify-content: center;
}
.frise-img {
  width: 100%; height: auto;
  max-height: 68vh;
  object-fit: contain; border-radius: 3px; display: block;
  filter: contrast(1.1) brightness(.97);
  box-shadow:
    0 0 0 1px rgba(212,168,83,.2),
    0 20px 70px rgba(0,0,0,.85),
    0 4px 16px rgba(0,0,0,.6);
  cursor: zoom-in;
  transition: transform .35s ease, filter .3s ease;
}
.frise-img:hover { transform: scale(1.012); filter: contrast(1.16) brightness(1.02); }

/* ============================================================
   REVEAL BUTTON (on slide, bottom-right)
   ============================================================ */
.reveal-btn {
  position: absolute; bottom: 32px; right: 48px; z-index: 20;
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(12,9,6,.55);
  border: 1.5px solid rgba(212,168,83,.4);
  color: var(--gold); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
  transition: background .3s, border-color .3s, transform .3s, box-shadow .3s;
}
.reveal-btn svg { width: 28px; }
.reveal-btn:hover {
  background: rgba(212,168,83,.12);
  border-color: var(--gold);
  transform: scale(1.14);
  box-shadow: 0 0 22px rgba(212,168,83,.35);
}

/* ============================================================
   SLIDE NAV ARROWS (prev / next story)
   ============================================================ */
.nav-arr {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 50px; height: 100px;
  background: transparent; border: none;
  color: var(--gold); cursor: pointer;
  font-size: 2.8rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  z-index: 20;
  opacity: 0; transition: opacity .3s ease;
  user-select: none;
}
.slide:hover .nav-arr { opacity: .4; }
.nav-arr:hover { opacity: 1 !important; }
.nav-arr.prev { left: 0; background: linear-gradient(90deg,rgba(12,9,6,.4),transparent); }
.nav-arr.next { right: 0; background: linear-gradient(-90deg,rgba(12,9,6,.4),transparent); }

/* ============================================================
   REVEAL MODAL (global layer, above everything)
   ============================================================ */
#reveal-modal {
  position: fixed; inset: 0; z-index: 800;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; visibility: hidden;
}
#reveal-modal.open { pointer-events: all; visibility: visible; }

#reveal-backdrop {
  position: absolute; inset: 0;
  background: rgba(6,4,2,0);
  backdrop-filter: blur(0px);
  transition: background .55s ease, backdrop-filter .55s ease;
}
#reveal-modal.open #reveal-backdrop {
  background: rgba(6,4,2,.92);
  backdrop-filter: blur(22px);
}

#reveal-panel {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: 1.6rem;
  transform: scale(.7) translateY(30px);
  opacity: 0;
  transition: transform .6s var(--ease-back), opacity .5s ease;
}
#reveal-modal.open #reveal-panel {
  transform: scale(1) translateY(0); opacity: 1;
}

/* Floating particles in modal */
#reveal-particles {
  position: absolute; inset: -80px; pointer-events: none; overflow: hidden;
}
.rp {
  position: absolute; border-radius: 50%;
  background: var(--gold);
  animation: rParticle linear both;
}
@keyframes rParticle {
  from { transform: translateY(0) scale(1); opacity: .8; }
  to   { transform: translateY(-160px) scale(0); opacity: 0; }
}

/* Big icon */
#reveal-icon-wrap {
  position: relative;
}
#reveal-icon {
  font-size: 7.5rem; line-height: 1;
  filter: drop-shadow(0 0 40px rgba(212,168,83,.7));
  animation: none;
}
#reveal-modal.open #reveal-icon {
  animation: iconPop .55s var(--ease-back) .15s both;
}
@keyframes iconPop {
  from { transform: scale(0) rotate(-30deg); opacity: 0; }
  70%  { transform: scale(1.3) rotate(8deg); }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}

/* Glow ring behind icon */
#reveal-icon-wrap::before {
  content: '';
  position: absolute; inset: -24px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,168,83,.18) 0%, transparent 70%);
  animation: ringGlow 2s ease-in-out infinite;
}
@keyframes ringGlow {
  0%,100% { transform: scale(1);    opacity: .5; }
  50%      { transform: scale(1.15); opacity: 1; }
}

/* Story name */
#reveal-title-wrap {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  overflow: hidden;
}
#reveal-article {
  font-family: var(--sans); font-weight: 300;
  font-size: .7rem; letter-spacing: .3em; text-transform: uppercase;
  color: rgba(212,168,83,.78);
  transform: translateY(20px); opacity: 0;
  transition: transform .5s var(--ease) .3s, opacity .5s ease .3s;
}
#reveal-name {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(2rem, 6vw, 4rem);
  color: var(--gold-lite);
  letter-spacing: -.02em; line-height: 1.1;
  text-align: center;
  transform: translateY(28px); opacity: 0;
  transition: transform .55s var(--ease) .42s, opacity .5s ease .42s;
}
/* letter-by-letter */
#reveal-name .letter {
  display: inline-block;
  opacity: 0; transform: translateY(16px);
}
#reveal-modal.open #reveal-name .letter {
  animation: letterDrop .4s var(--ease-back) both;
}
@keyframes letterDrop {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
#reveal-modal.open #reveal-article {
  transform: translateY(0); opacity: 1;
}
#reveal-modal.open #reveal-name {
  transform: translateY(0); opacity: 1;
}

/* Golden rule */
#reveal-name::before {
  content: '';
  display: block; margin: 0 auto .6rem;
  width: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transition: width .5s ease .6s;
}
#reveal-modal.open #reveal-name::before { width: 160px; }

/* Summary */
#reveal-summary {
  max-width: min(520px, 82vw);
  text-align: center;
  font-family: var(--serif); font-style: italic;
  font-size: clamp(.82rem, 1.8vw, 1rem);
  line-height: 1.75;
  color: rgba(242, 208, 122, 0.85);
  letter-spacing: .02em;
  padding: 0 1rem;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s ease, transform .7s var(--ease);
  border-top: 1px solid rgba(212,168,83,.12);
  padding-top: .9rem;
}
#reveal-summary.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Close button */
#reveal-close {
  padding: 10px 32px; border-radius: 100px;
  background: transparent;
  border: 1px solid rgba(212,168,83,.5);
  color: rgba(212,168,83,.85); cursor: pointer;
  font-family: var(--sans); font-size: .9rem; font-weight: 300;
  letter-spacing: .06em;
  transition: all .2s ease;
  transform: translateY(16px); opacity: 0;
  transition: transform .5s var(--ease) .65s, opacity .5s ease .65s,
              background .2s ease, border-color .2s ease, color .2s ease;
}
#reveal-modal.open #reveal-close {
  transform: translateY(0); opacity: 1;
}
#reveal-close:hover {
  color: var(--gold); border-color: var(--gold);
  background: rgba(212,168,83,.09);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
#lightbox {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,.97);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
#lightbox.open { opacity: 1; pointer-events: all; }
#lb-img {
  max-width: 96vw; max-height: 96vh;
  object-fit: contain; border-radius: 2px;
  filter: contrast(1.14);
  transform: scale(.93); transition: transform .45s var(--ease);
}
#lightbox.open #lb-img { transform: scale(1); }

/* App challenge badge (bottom center) */
.app-challenge {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
  font-family: var(--sans);
  font-size: .58rem;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(212,168,83, 0.75);
  text-align: center;
  border: 1px solid rgba(212,168,83, 0.3);
  padding: 5px 14px;
  border-radius: 20px;
  background: rgba(12,9,6, 0.6);
  backdrop-filter: blur(6px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 680px) {
  .frise-wrap  { width: 98vw; margin-top: 40px; }
  .frise-img   { max-height: 58vh; }
  .reveal-btn  { bottom: 18px; right: 18px; width: 46px; height: 46px; }
  .slide-num   { font-size: 4rem; bottom: 16px; left: 20px; }
  #top-bar     { padding: 0 16px; }
  #reveal-name { font-size: 2rem; }
  .app-challenge { font-size: .52rem; padding: 4px 10px; bottom: 12px; width: max-content; max-width: 90vw; }
}
