/*
 * Qualia Design Boost
 * Enhancements ciblees : espacement, typographie, transitions,
 * parallaxe, Nayo, About, contenus CKEditor.
 * Ne remplace pas le theme existant — il le complete.
 */

/* ============================================================
   2. SEPARATION DES SECTIONS
   ============================================================ */

.q-section {
  position: relative;
}

.q-section + .q-section {
  border-top: 1px solid var(--border-light);
}

.q-section--dark + .q-section--dark,
.q-hero + .q-section,
.q-newsletter + .q-section,
.q-section + .q-newsletter,
.q-section + .manifesto-section,
.manifesto-section + .q-section,
.manifesto-section + .manifesto-section {
  border-top-color: transparent;
}

/* Repere editeuriel subtil entre sections alternees */
.q-section:nth-of-type(even):not(.q-section--dark):not(.q-hero) {
  background-color: rgba(247, 245, 240, 0.35);
}

/* ============================================================
   3. TRANSITIONS AU SCROLL — staccato elegant
   ============================================================ */

[data-q-reveal] > .q-caption,
[data-q-reveal] > .q-title-1,
[data-q-reveal] > .q-title-2,
[data-q-reveal] > .q-manifesto__title,
[data-q-reveal] > .q-pull-quote,
[data-q-reveal] > .q-body-large,
[data-q-reveal] > p,
[data-q-reveal] > .q-button,
[data-q-reveal] > .q-nayo__body > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-q-reveal].is-visible > .q-caption,
[data-q-reveal].is-visible > .q-title-1,
[data-q-reveal].is-visible > .q-title-2,
[data-q-reveal].is-visible > .q-manifesto__title,
[data-q-reveal].is-visible > .q-pull-quote,
[data-q-reveal].is-visible > .q-body-large,
[data-q-reveal].is-visible > p,
[data-q-reveal].is-visible > .q-button,
[data-q-reveal].is-visible > .q-nayo__body > * {
  opacity: 1;
  transform: translateY(0);
}

[data-q-reveal].is-visible > .q-caption { transition-delay: 0ms; }
[data-q-reveal].is-visible > .q-title-1 { transition-delay: 100ms; }
[data-q-reveal].is-visible > .q-title-2 { transition-delay: 120ms; }
[data-q-reveal].is-visible > .q-manifesto__title { transition-delay: 120ms; }
[data-q-reveal].is-visible > .q-pull-quote { transition-delay: 160ms; }
[data-q-reveal].is-visible > .q-body-large,
[data-q-reveal].is-visible > p { transition-delay: 180ms; }
[data-q-reveal].is-visible > .q-button { transition-delay: 240ms; }

/* ============================================================
   4. REVELATION DES IMAGES
   ============================================================ */

.q-case-study__media img,
.q-journal-card__media img,
.q-team-card__media img,
.q-value-card__media img,
.q-nayo__media img {
  transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1),
              clip-path 1s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, clip-path;
}

.q-case-study__media img,
.q-journal-card__media img,
.q-team-card__media img,
.q-value-card__media img {
  clip-path: inset(6% 0);
  transform: scale(1.05);
}

.q-case-study.is-visible .q-case-study__media img,
.q-journal-card.is-visible .q-journal-card__media img,
.q-team-card.is-visible .q-team-card__media img,
.q-value-card.is-visible .q-value-card__media img,
.q-nayo--home.is-visible .q-nayo__media img,
.q-nayo--home.is-visible .q-nayo__media video {
  transform: translateY(0) scale(1);
}

/* ============================================================
   4B. HERO — overlay renforce
   ============================================================ */

.q-hero--flagship .q-hero__overlay {
  background:
    linear-gradient(90deg, rgba(5, 13, 25, .96) 0%, rgba(7, 18, 34, .88) 40%, rgba(7, 18, 34, .78) 100%),
    linear-gradient(0deg, rgba(5, 13, 25, .85) 0%, transparent 55%);
}

/* ============================================================
   5. BLOC NAYO — HOME
   ============================================================ */

.q-nayo--home {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: center;
  overflow: visible;
  background: linear-gradient(
    135deg,
    var(--q-ivory-100) 0%,
    var(--q-ivory-200) 100%
  );
}

.q-nayo--home::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 85%, rgba(201, 169, 98, 0.08) 0%, transparent 45%);
  pointer-events: none;
  z-index: 0;
}

.q-nayo--home::after {
  content: '';
  position: absolute;
  top: 0;
  left: 8%;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--q-gold) 20%,
    var(--q-gold) 80%,
    transparent 100%
  );
  opacity: 0.25;
  z-index: 0;
}

.q-nayo--home .q-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
}

.q-nayo--home .q-nayo__inner {
  position: relative;
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  min-height: 70vh;
}

.q-nayo--home .q-nayo__body {
  padding-right: 8%;
  z-index: 2;
}

.q-nayo--home .q-nayo__eyebrow {
  display: inline-block;
  color: var(--q-gold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: var(--text-xs);
  margin-bottom: var(--space-4);
}

.q-nayo--home .q-nayo__title {
  font-size: clamp(2rem, 3.5vw, 3.75rem);
  line-height: 1.05;
  color: var(--q-navy);
  margin-bottom: var(--space-6);
  max-width: 16ch;
}

.q-nayo--home .q-nayo__text {
  max-width: 52ch;
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
}

.q-nayo--home .q-nayo__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-8);
}

.q-nayo--home .q-nayo__links a {
  color: var(--q-navy);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--q-gold);
  padding-bottom: 2px;
  transition: color 0.25s, border-color 0.25s;
}

.q-nayo--home .q-nayo__links a:hover {
  color: var(--q-gold);
  border-color: var(--q-navy);
}

.q-nayo--home .q-nayo__media {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

.q-nayo--home .q-nayo__media img,
.q-nayo--home .q-nayo__media video {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  object-position: center bottom;
  clip-path: none;
  will-change: transform;
  transform: translateY(30px) scale(0.96);
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.q-nayo--home.is-visible .q-nayo__media img,
.q-nayo--home.is-visible .q-nayo__media video {
  transform: translateY(0) scale(1);
}

@media (max-width: 1100px) {
  .q-nayo--home .q-nayo__inner {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: var(--space-24) 0;
  }

  .q-nayo--home .q-nayo__media {
    position: relative;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: 520px;
    margin: 0 auto var(--space-10);
    order: -1;
  }

  .q-nayo--home .q-nayo__body {
    padding-right: 0;
    text-align: center;
  }

  .q-nayo--home .q-nayo__title,
  .q-nayo--home .q-nayo__text {
    margin-left: auto;
    margin-right: auto;
  }

  .q-nayo--home .q-nayo__links {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .q-nayo--home {
    min-height: auto;
  }

  .q-nayo--home .q-nayo__inner {
    padding: var(--space-16) 0;
  }

  .q-nayo--home .q-nayo__media {
    max-width: 360px;
  }

  .q-nayo--home .q-nayo__title {
    font-size: clamp(1.75rem, 7vw, 2.25rem);
  }

  .q-nayo--home .q-nayo__links {
    flex-direction: column;
    gap: var(--space-4);
  }
}

/* ============================================================
   6. NAYO — apparences secondaires
   ============================================================ */

.page-about .q-nayo,
.page-404 .q-nayo,
body.careers .q-nayo {
  position: relative;
}

.page-about .q-nayo__media,
.page-404 .q-nayo__media,
body.careers .q-nayo__media {
  max-width: 180px;
  margin: 0 auto var(--space-6);
  overflow: visible;
}

.page-about .q-nayo__media img,
.page-404 .q-nayo__media img,
body.careers .q-nayo__media img {
  transform: translateY(12px);
  transition: transform 0.8s ease-out;
}

.page-about .q-nayo.is-visible .q-nayo__media img,
.page-404 .q-nayo.is-visible .q-nayo__media img,
body.careers .q-nayo.is-visible .q-nayo__media img {
  transform: translateY(0);
}

/* ============================================================
   6. MANIFESTO — arrière-plan média, composition éditoriale
   ============================================================ */

.manifesto-section {
  position: relative;
  min-height: clamp(44rem, 92svh, 60rem);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
  padding: 0;
  background-color: var(--bg-dark);
  color: var(--text-inverse);
}

.manifesto-section__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background-color: var(--bg-dark);
}

.manifesto-section__media img,
.manifesto-section__media video {
  position: absolute;
  top: -5%;
  left: 0;
  width: 100%;
  height: 110%;
  object-fit: cover;
  object-position: center;
  filter: saturate(.88) brightness(.92);
  will-change: transform;
}

.manifesto-section__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(5, 13, 25, .90) 0%, rgba(5, 13, 25, .72) 52%, rgba(5, 13, 25, .38) 100%),
    linear-gradient(0deg, rgba(5, 13, 25, .82) 0%, rgba(5, 13, 25, .22) 50%, rgba(5, 13, 25, .10) 100%);
  pointer-events: none;
}

.manifesto-section__content {
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr);
  align-items: end;
  gap: clamp(2rem, 5vw, 5rem);
  padding: clamp(8rem, 18vh, 14rem) clamp(1.5rem, 7vw, 7rem) clamp(4rem, 10vh, 8rem);
}

.manifesto-section__main {
  max-width: 62ch;
}

.manifesto-section__label {
  display: inline-block;
  color: var(--q-gold);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}

.manifesto-section__title {
  font-size: clamp(2.25rem, 4.8vw, 5rem);
  line-height: 1.02;
  font-weight: 650;
  color: var(--text-inverse);
  margin-bottom: var(--space-6);
  text-wrap: balance;
  letter-spacing: -0.04em;
}

.manifesto-section__body {
  font-size: clamp(1.0625rem, 1.3vw, 1.25rem);
  line-height: 1.7;
  color: var(--text-inverse-muted);
  margin-bottom: var(--space-8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

.manifesto-section__quote {
  position: relative;
  margin: 0;
  padding-left: var(--space-6);
  border-left: 1px solid var(--q-gold);
  align-self: end;
  max-width: 28ch;
}

.manifesto-section__quote blockquote {
  margin: 0;
  padding: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.4;
  font-style: italic;
  color: var(--text-inverse);
}

.manifesto-section .q-button {
  display: inline-flex;
  margin-top: var(--space-2);
}

/* Apparition progressive au scroll */
.manifesto-section .manifesto-section__label,
.manifesto-section .manifesto-section__title,
.manifesto-section .manifesto-section__body,
.manifesto-section .manifesto-section__quote,
.manifesto-section .q-button {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.manifesto-section.is-visible .manifesto-section__label,
.manifesto-section.is-visible .manifesto-section__title,
.manifesto-section.is-visible .manifesto-section__body,
.manifesto-section.is-visible .manifesto-section__quote,
.manifesto-section.is-visible .q-button {
  opacity: 1;
  transform: translateY(0);
}

.manifesto-section.is-visible .manifesto-section__label { transition-delay: 0ms; }
.manifesto-section.is-visible .manifesto-section__title { transition-delay: 120ms; }
.manifesto-section.is-visible .manifesto-section__body { transition-delay: 220ms; }
.manifesto-section.is-visible .manifesto-section__quote { transition-delay: 320ms; }
.manifesto-section.is-visible .q-button { transition-delay: 400ms; }

@media (max-width: 1024px) {
  .manifesto-section__content {
    grid-template-columns: 1fr;
    gap: var(--space-10);
    padding: clamp(7rem, 14vh, 10rem) var(--space-6) clamp(3rem, 8vh, 6rem);
  }

  .manifesto-section__quote {
    max-width: 45ch;
    margin-top: var(--space-6);
    order: -1;
    align-self: auto;
  }

  .manifesto-section__media img,
  .manifesto-section__media video {
    top: 0;
    height: 100%;
  }
}

@media (max-width: 640px) {
  .manifesto-section__title {
    font-size: clamp(1.75rem, 8vw, 2.75rem);
  }

  .manifesto-section__body {
    font-size: 1rem;
  }

  .manifesto-section__quote blockquote {
    font-size: clamp(1.0625rem, 4.5vw, 1.25rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .manifesto-section .manifesto-section__label,
  .manifesto-section .manifesto-section__title,
  .manifesto-section .manifesto-section__body,
  .manifesto-section .manifesto-section__quote,
  .manifesto-section .q-button {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .manifesto-section__media img,
  .manifesto-section__media video {
    transform: none;
  }
}

/* ============================================================
   7. SECTION ABOUT
   ============================================================ */

.q-about-story {
  position: relative;
}

.q-about-story .q-caption {
  color: var(--q-gold);
  margin-bottom: var(--space-4);
}

.q-about-story__title {
  font-size: clamp(2rem, 3vw, 3.25rem);
  line-height: 1.08;
  color: var(--q-navy);
  margin-bottom: var(--space-8);
  max-width: 18ch;
}

.q-about-story__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.q-about-story__quote {
  position: relative;
  margin: var(--space-16) 0 0;
  padding: var(--space-8) 0 var(--space-8) var(--space-8);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.5rem, 2.5vw, 2.25rem);
  line-height: 1.4;
  color: var(--q-navy);
  border-left: 2px solid var(--q-gold);
}

.q-about-story__quote::before {
  content: '"';
  position: absolute;
  top: 0.1em;
  left: 0.15em;
  font-size: 4rem;
  color: var(--q-gold);
  opacity: 0.35;
  line-height: 1;
  font-family: Georgia, serif;
}

@media (max-width: 900px) {
  .q-about-story__title {
    font-size: clamp(1.625rem, 5vw, 2.25rem);
  }

  .q-about-story__quote {
    padding-left: var(--space-6);
    font-size: clamp(1.25rem, 4vw, 1.5rem);
  }
}

/* ============================================================
   8. CKEditor / contenus enrichis
   ============================================================ */

.ckeditor-content,
.q-article-body {
  color: var(--text-primary);
}

.ckeditor-content p,
.q-article-body p {
  margin-bottom: var(--space-6);
}

.ckeditor-content h2,
.q-article-body h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
  color: var(--q-navy);
}

.ckeditor-content h3,
.q-article-body h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  margin-top: var(--space-10);
  margin-bottom: var(--space-3);
  color: var(--q-navy);
}

.ckeditor-content h4,
.q-article-body h4 {
  font-size: clamp(1.0625rem, 2vw, 1.25rem);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  color: var(--q-navy);
}

.ckeditor-content ul,
.q-article-body ul,
.ckeditor-content ol,
.q-article-body ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-6);
}

.ckeditor-content li,
.q-article-body li {
  margin-bottom: var(--space-2);
  line-height: 1.65;
}

.ckeditor-content blockquote,
.q-article-body blockquote {
  position: relative;
  margin: var(--space-10) 0;
  padding: var(--space-4) var(--space-6);
  border-left: 2px solid var(--q-gold);
  font-style: italic;
  background: rgba(201, 169, 98, 0.05);
}

.ckeditor-content img,
.q-article-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: var(--space-6) 0;
}

.ckeditor-content figure,
.q-article-body figure {
  margin: var(--space-8) 0;
}

.ckeditor-content figcaption,
.q-article-body figcaption {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--space-2);
}

.ckeditor-content table,
.q-article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-6) 0;
}

.ckeditor-content th,
.q-article-body th,
.ckeditor-content td,
.q-article-body td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-medium);
  text-align: left;
}

.ckeditor-content th,
.q-article-body th {
  background: var(--q-ivory-200);
  font-weight: 600;
}

.ckeditor-content iframe,
.q-article-body iframe,
.ckeditor-content video,
.q-article-body video {
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  margin: var(--space-6) 0;
}

.ckeditor-content a,
.q-article-body a {
  color: var(--q-gold);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.ckeditor-content a:hover,
.q-article-body a:hover {
  color: var(--q-navy);
}

/* ============================================================
   9. PARALLAXE — classes pour JS
   ============================================================ */

.q-boost-parallax {
  will-change: transform;
}

/* ============================================================
   10. MOTIONS REDUITES
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .q-nayo--home .q-nayo__media img,
  .q-case-study__media img,
  .q-journal-card__media img,
  .q-team-card__media img,
  .q-value-card__media img,
  .q-boost-parallax {
    transform: none !important;
    transition: opacity 0.2s ease-out;
  }

  [data-q-reveal] > * {
    transition: opacity 0.2s ease-out;
    transition-delay: 0ms !important;
  }
}
