/* ==========================================================================
   CASE STUDY — styles for the project detail pages (projets/*.html)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Intro: breadcrumb, title, key facts
   -------------------------------------------------------------------------- */
.case-hero {
  max-width: 72rem;
  margin: 0 auto;
  padding: calc(var(--header-height) + 3rem) var(--gutter) 4rem;
}

/* Breadcrumb: Bootstrap structure, our own look */
.breadcrumb-nav {
  margin-bottom: 3.5rem;
}

.breadcrumb {
  margin: 0;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.breadcrumb-item a {
  color: var(--color-muted-dark);
  transition: color var(--duration) var(--ease-out);
}

.breadcrumb-item a:hover {
  color: var(--color-black);
}

.breadcrumb-item.active {
  color: var(--color-black);
}

/* Separator between items (Bootstrap reads this variable) */
.breadcrumb {
  --bs-breadcrumb-divider: "/";
  --bs-breadcrumb-divider-color: var(--color-pink);
}

.case-hero h1 {
  margin-bottom: 2rem;
  font-size: clamp(2.25rem, 5vw, 4rem);
}

.case-hero__lead {
  max-width: 44rem;
  margin-bottom: 3.5rem;
  color: var(--color-muted-dark);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
}

/* Key facts: 4 columns on desktop, 2 on tablet, 1 on mobile */
.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin: 0;
  padding-top: 2rem;
  border-top: 1px solid var(--color-line-dark);
}

.facts dt {
  margin-bottom: .5rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
  color: var(--color-muted-dark);
  font-size: .92rem;
}

@media (max-width: 991.98px) {
  .facts { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
  .facts { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   2. Main visual
   -------------------------------------------------------------------------- */
.case-visual {
  margin: 0;
  padding: clamp(2rem, 7vw, 6rem) var(--gutter);
  background-color: var(--color-black);
}

.case-visual img {
  max-width: 64rem;
  width: 100%;
  margin: 0 auto;
  box-shadow: 0 40px 80px rgba(0, 0, 0, .35);
}

/* --------------------------------------------------------------------------
   3. Numbered sections: title on the left, text on the right
   -------------------------------------------------------------------------- */
.case-section {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 1.5rem clamp(2rem, 6vw, 6rem);
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) var(--gutter);
  border-bottom: 1px solid var(--color-line-dark);
}

/* The dark section spans the full width of the screen */
.case-section--dark {
  max-width: none;
  padding-left: max(var(--gutter), calc((100% - 72rem) / 2 + var(--gutter)));
  padding-right: max(var(--gutter), calc((100% - 72rem) / 2 + var(--gutter)));
  border-bottom: 0;
}

.case-section__number {
  margin-bottom: .75rem;
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 1.25rem;
}

.section--dark .case-section__number {
  color: var(--color-pink);
}

.case-section h2 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
}

.case-section__body {
  color: var(--color-muted-dark);
}

.section--dark .case-section__body {
  color: var(--color-muted-light);
}

.case-section__body strong {
  color: var(--color-black);
}

.section--dark .case-section__body strong {
  color: var(--color-white);
}

.case-section__body code {
  color: inherit;
  font-size: .9em;
}

/* Features: 2 sub-columns */
.case-section__body--columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.case-section__body h3 {
  margin-bottom: 1.25rem;
  color: var(--color-black);
  font-size: 1rem;
  letter-spacing: .06em;
}

/* List with pink check marks */
.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding: .6rem 0 .6rem 1.75rem;
  border-bottom: 1px solid var(--color-line-dark);
  font-size: .92rem;
}

.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--color-pink);
  font-weight: 900;
}

/* Figures (diagrams, screenshots) span both columns */
.case-figure {
  grid-column: 1 / -1;
  margin: 2.5rem 0 0;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--color-line-dark);
  background-color: var(--color-white);
}

.case-figure img {
  margin: 0 auto;
}

.case-figure figcaption {
  margin-top: 1rem;
  color: var(--color-muted-dark);
  font-size: .8rem;
  font-style: italic;
  text-align: center;
}

/* Phone screenshot: narrow, with a phone-like frame */
.case-figure--phone {
  border: 0;
  padding: 0;
}

.case-figure--phone img {
  width: 280px;
  border: 10px solid var(--color-black);
  border-radius: 28px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .2);
}

@media (max-width: 991.98px) {
  .case-section,
  .case-section__body--columns {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   4. Key figures (dark section)
   -------------------------------------------------------------------------- */
.stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin: 2.5rem 0 0;
  padding: 2.5rem 0 0;
  list-style: none;
  border-top: 1px solid var(--color-line-light);
}

.stats__number {
  display: block;
  margin-bottom: .5rem;
  color: var(--color-pink);
  font-family: var(--font-heading);
  font-size: clamp(2.25rem, 4vw, 3rem);
  font-weight: 900;
  line-height: 1;
}

.stats__label {
  color: var(--color-muted-light);
  font-size: .85rem;
}

@media (max-width: 767.98px) {
  .stats { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   5. Final call to action
   -------------------------------------------------------------------------- */
.case-cta {
  padding: clamp(4rem, 8vw, 6rem) var(--gutter);
  text-align: center;
}

.case-cta__text {
  margin-bottom: 2rem;
  font-family: var(--font-accent);
  font-style: italic;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.case-cta__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.5rem 2.5rem;
}

/* White version of the main button, for dark backgrounds */
.btn-main--light {
  border-color: var(--color-white);
  background-color: var(--color-white);
  color: var(--color-black);
}

.btn-main--light::before {
  background-color: var(--color-black);
}

.btn-main--light:hover,
.btn-main--light:focus-visible {
  color: var(--color-white);
}

/* --------------------------------------------------------------------------
   6. Horizontal scroll (desktop, activated by animations.js)
   Without the .is-horizontal class, the panels stay normal vertical sections.
   -------------------------------------------------------------------------- */
.h-scroll__progress {
  display: none;
}

.h-scroll.is-horizontal {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--color-line-dark);
}

.h-scroll.is-horizontal .h-scroll__track {
  display: flex;
  width: max-content;                     /* as wide as all the panels side by side */
  will-change: transform;                 /* tells the browser it will move: smoother */
}

.h-scroll.is-horizontal .h-scroll__panel {
  flex: 0 0 100vw;                        /* each panel = full screen width */
  max-width: none;
  height: 100vh;
  margin: 0;
  padding: calc(var(--header-height) + 3rem) max(var(--gutter), calc((100vw - 72rem) / 2 + var(--gutter))) 4rem;
  grid-template-columns: 1fr 1.25fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "head   figure"
    "body   figure";
  align-content: center;
  border-bottom: 0;
  border-right: 1px solid var(--color-line-dark);
}

.h-scroll.is-horizontal .case-section__head { grid-area: head; }
.h-scroll.is-horizontal .case-section__body { grid-area: body; }

.h-scroll.is-horizontal .case-figure {
  grid-area: figure;
  align-self: center;
  margin: 0;
}

/* The diagram must fit in the screen height */
.h-scroll.is-horizontal .case-figure img {
  max-height: calc(100vh - var(--header-height) - 14rem);
  width: auto;
  max-width: 100%;
}

/* Panel without image: the text uses the whole width */
.h-scroll.is-horizontal .h-scroll__panel:not(:has(.case-figure)) {
  grid-template-columns: 1fr 1.6fr;
  grid-template-areas: "head body";
  grid-template-rows: auto;
  align-items: start;
}

/* Progress bar at the bottom of the pinned section */
.h-scroll.is-horizontal .h-scroll__progress {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 2rem;
  display: block;
  height: 2px;
  background-color: var(--color-line-dark);
}

.h-scroll__progress span {
  display: block;
  height: 100%;
  background-color: var(--color-pink);
  transform: scaleX(0);
  transform-origin: left;
}
