/* ===================================================================
   "NOTRE MAISON" PAGE — D'hier à aujourd'hui + Notre Histoire timeline
   Rendered by the larnicolhistoire module at /notre-maison.
   Scoped under .histoire-page so it never affects other pages.
   Registered globally via config/themes/larnicol/shop1.json (+ theme.yml).
   =================================================================== */

.histoire-page {
  font-family: var(--font-sans);
  color: var(--dark);

  /* Timeline sizing — tweak these to control the layout & spacing:
     --tl-gap          horizontal space between items in a row
     --tl-offset       how far the LOWER row is shifted right (the zigzag)
     --tl-upper-space  vertical gap between the UPPER cards and the line
     --tl-lower-space  vertical gap between the line and the LOWER cards
     --tl-row-h        height of each row (upper / lower)
     --tl-img-h        height of the card images (they share the card width) */
  --tl-item-w: 300px;
  --tl-gap: 40px;
  --tl-offset: calc((var(--tl-item-w) + var(--tl-gap)) / 2);
  --tl-upper-space: 24px;
  --tl-lower-space: 24px;
  --tl-row-h: 250px;
  --tl-img-h: 137px;
}

/* ===================================================================
   1) HERO — "D'hier à aujourd'hui"
   =================================================================== */
.histoire-page .histoire-hero {
  background: var(--white);
  padding: 60px 0 50px;
}
.histoire-page .histoire-hero__title {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  margin-bottom: 40px;
}
.histoire-page .histoire-hero__cols {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 50px;
  align-items: start;
}
.histoire-page .histoire-hero__text p {
  font-size: 18px;
  line-height: 27px;
  color: #333;
}
.histoire-page .histoire-hero__text p + p {
  margin-top: 18px;
}
.histoire-page .histoire-hero__lead {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 28px;
  color: #222;
  margin-bottom: 22px;
}
.histoire-page .histoire-hero__portrait {
  margin: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 3px;
  background: var(--light-gray);
}
.histoire-page .histoire-hero__portrait img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

/* ===================================================================
   2) NOTRE HISTOIRE — horizontal-scroll timeline
   =================================================================== */
.histoire-page .histoire-story {
  background: var(--white);
  padding: 30px 0 80px;
}
.histoire-page .histoire-story .lcontainer > h2,
.histoire-page .histoire-story .lcontainer > p {
  text-align: center;
}
.histoire-page .histoire-story__title {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.histoire-page .histoire-story__intro {
  font-size: 15px;
  line-height: 26px;
  color: #555;
  max-width: 620px;
  margin: 0 auto;
  margin-bottom: 26px;
}

/* ---- the scroller: horizontal, hidden scrollbar ---- */
.histoire-page .histoire-scroller {
  overflow-x: auto;
  overflow-y: hidden;
  -ms-overflow-style: none;      /* IE / old Edge */
  scrollbar-width: none;          /* Firefox */
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.histoire-page .histoire-scroller::-webkit-scrollbar {  /* Chrome / Safari */
  display: none;
  width: 0;
  height: 0;
}
.histoire-page .histoire-scroller.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;         /* free-scroll while dragging */
  user-select: none;
}

/* ---- the track: UPPER row / axis <hr> / LOWER row, stacked ---- */
.histoire-page .histoire-track {
  display: flex;
  flex-direction: column;
  width: max-content;
  min-width: 100%;
  /* padding: 10px 5vw 20px; */
  padding: 10px 0 20px;
}

/* a row of cards */
.histoire-page .histoire-row {
  display: flex;
  gap: 70px;
  min-height: var(--tl-row-h);
  padding: 0 5vw;
}
.histoire-page .histoire-row--upper {
  align-items: stretch;                   /* equal-height items so every card TOP aligns */
  padding-bottom: 5px;  /* <-- UPPER distance to the line */
}
.histoire-page .histoire-row--lower {
  align-items: flex-start;                /* cards sit below; years rise to the line */
  padding-top: 5px;     /* <-- LOWER distance to the line */
  margin-left: var(--tl-offset);          /* <-- interleave lower items between upper */
}

/* the timeline axis line */
.histoire-page .histoire-axis {
  border: 0;
  border-top: 1px solid #000;
  margin: 0;
  width: 100%;
}

/* ---- each timeline entry (card + year) ---- */
.histoire-page .histoire-item {
  flex: 0 0 var(--tl-item-w);
  width: var(--tl-item-w);
  display: flex;
  flex-direction: column;
  scroll-snap-align: center;
  min-width: 545px;
}

/* year marker (near the line) */
.histoire-page .histoire-item__year {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--dark);
  letter-spacing: 0.03em;
  line-height: 1;
}
/* .histoire-page .histoire-row--upper .histoire-item__year {
  margin-top: 14px;
}
.histoire-page .histoire-row--lower .histoire-item__year {
  margin-bottom: 14px;
} */

/* ---- card ---- */
.histoire-page .histoire-card {
  display: flex;
  flex-direction: column;
}
.histoire-page .histoire-card__imgs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.histoire-page .histoire-card__img {
  flex: 1 1 0;
  min-width: 0;                 /* let images shrink so ANY count fits the card */
  height: var(--tl-img-h);      /* fixed height, regardless of how many images */
  overflow: hidden;
  border-radius: 2px;
  background: var(--light-gray);
}
.histoire-page .histoire-card__img img {
  width: 100%;
  height: var(--tl-img-h);
  object-fit: cover;
  display: block;
}
.histoire-page .histoire-card__title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 8px;
}
.histoire-page .histoire-card__text {
  font-size: 14px;
  line-height: 22px;
  color: #555;
}
.histoire-page .histoire-btn {
  display: inline-block;
  align-self: flex-start;
  margin-top: 14px;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-decoration: none;
  color: var(--dark);
  background: transparent;
  border: 1px solid var(--dark);
  padding: 9px 22px;
  border-radius: 10px;
  transition: background 0.25s, color 0.25s;
}
.histoire-page .histoire-btn:hover {
  background: var(--dark);
  color: var(--white);
}
.dashed-spacer {
  width: 1px;
  height: 70px;
  border-left: 2px dashed rgba(60, 25, 16, .5);
  margin: 10px 0;
}
/* UPPER: cards top-align and the dashed line stretches to fill the leftover
   space, so the year always lands on the axis no matter the card height. */
.histoire-page .histoire-row--upper .histoire-card { flex: 0 0 auto; }
.histoire-page .histoire-row--upper .dashed-spacer {
  flex: 1 1 auto;
  height: auto;
  min-height: 14px;
}

.postuler-btn {
  width: 100%;
  background-color: var(--cream);
  padding-bottom: 20px;
}
.postuler-btn a {
  text-align: center;
  padding: 0 40px;
  text-transform: uppercase;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #B0896C;
  color: #fff;
  width: fit-content;
  margin: 0 auto;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 16px;
}

/* timeline */
:root{
  --cream:#faf6ef;
  --ink:#2b2620;
  --ink-soft:#7a7266;
  --line:#e4ddcf;
  --accent:#8c5a3c;
  --serif: "Georgia", "Iowan Old Style", "Times New Roman", serif;
}

.timeline{
  display: flex;
  gap:50px;
  width:100%;
}

/* ===== LEFT: YEAR LIST ===== */
.years-wrap{
  position:relative;
  height:340px; /* fixed viewport for the year rail */
  overflow:hidden;
  width: 340px;
}
/* soft fade top & bottom so the scroll effect looks intentional */
/* .years-wrap::before,
.years-wrap::after{
  content:"";
  position:absolute;
  left:0; right:0;
  height:70px;
  pointer-events:none;
  z-index:2;
}
.years-wrap::before{ top:0; background:linear-gradient(var(--cream), transparent); }
.years-wrap::after{ bottom:0; background:linear-gradient(transparent, var(--cream)); } */

.years-track{
  position:absolute;
  top:50%; /* active item gets translated to align with this center line */
  left:0; right:0;
  transition: transform .5s cubic-bezier(.65,0,.35,1);
  will-change:transform;
}

.year-item{
  display:block;
  width:100%;
  text-align:left;
  background:none;
  border:none;
  padding-left: 0;
  padding:10px 0;
  font-family:var(--serif);
  font-size:28px;
  color:var(--ink-soft);
  cursor:pointer;
  transition: color .35s ease, font-size .35s ease, opacity .35s ease, padding-left .35s ease;
  opacity:.55;
}
.year-item:hover{ color:var(--ink); opacity:.85; }
.year-item:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; }

.year-item.is-active{
  color:var(--ink);
  font-size:36px;
  opacity:1;
  padding-left: 10px;
}
/* neighbours slightly more present than far-away years */
.year-item.is-near{ opacity:.8; }

/* ===== RIGHT: CONTENT PANEL ===== */
.content-wrap{
  position:relative;
  width: calc(100% - 390px);
  overflow:hidden;
}

.panel{
  position:absolute;
  top:0; left:0; width:100%;
  opacity:0;
}
.panel.is-current{
  position:relative;
  opacity:1;
}

/* enter: starts off-screen right, slides to center */
.panel.enter-from-right{
  animation: slideInFromRight .5s cubic-bezier(.65,0,.35,1) forwards;
}
/* exit: current content slides out to the left */
.panel.exit-to-left{
  animation: slideOutToLeft .5s cubic-bezier(.65,0,.35,1) forwards;
}

@keyframes slideInFromRight{
  from{ transform:translateX(48px); opacity:0; }
  to{ transform:translateX(0); opacity:1; }
}
@keyframes slideOutToLeft{
  from{ transform:translateX(0); opacity:1; }
  to{ transform:translateX(-48px); opacity:0; }
}


.panel h2{
  font-size: 32px;
  margin:0 0 8px;
  font-weight:400;
  display: flex;
  justify-content: space-between;
  gap: 50px;
}
.panel h2 p {
  font-size: 42px;
  color: #000;
  font-weight: 500;
}
.panel p.lede{
  color: #000;
  font-size: 18px;
  line-height:1.6;
  margin:0 0 18px;
}
.panel .cta{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  height: 40px;
  width: fit-content;
  border:1px solid var(--ink);
  border-radius:20px;
  font-size:13px;
  color:var(--ink);
  text-decoration:none;
  margin-bottom:22px;
  border-radius: 10px;
}
.panel .cta:hover{ background:var(--ink); color:var(--cream); }

.photos{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}
.photos img{
  width:100%;
  object-fit:cover;
  display:block;
  border:1px solid var(--line);
}

@media (max-width:640px){
  .timeline{ grid-template-columns:90px 1fr; gap:24px; }
  .years-wrap{ height:260px; }
  .year-item{ font-size:14px; }
  .year-item.is-active{ font-size:22px; }
  .photos{ grid-template-columns:1fr; }
  .photos img{ height:160px; }
}

/* timeline mobile */
.mobile-list{ display:none; } /* shown only under the breakpoint below */

.mobile-item{
  display:block;
  width:100%;
  text-align:left;
  background:none;
  border:none;
  border-bottom:1px dashed var(--line);
  padding:16px 4px;
  cursor:pointer;
  font-family:var(--serif);
}
.mobile-item:first-child{ border-top:1px dashed var(--line); }
.mobile-item:active{ background:rgba(140,90,60,.06); }

.mobile-item .m-year{
  font-size:13px;
  color:var(--accent);
  margin:0 0 2px;
}
.mobile-item .m-title{
  font-size:17px;
  color:var(--ink);
  margin:0 0 4px;
}
.mobile-item .m-text{
  font-size:13.5px;
  line-height:1.5;
  color:var(--ink-soft);
  margin:0;
}

/* ===== MOBILE: MODAL ===== */
.modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(20,16,10,.45);
  display:flex;
  align-items:flex-end;
  justify-content:center;
  z-index:1000;
  opacity:0;
  pointer-events:none;
  transition:opacity .3s ease;
}
.modal-overlay.is-open{
  opacity:1;
  pointer-events:auto;
  display: flex;
  align-items: center;
}

.modal-card{
  background:var(--cream);
  width:100%;
  max-width:480px;
  max-height:92vh;
  overflow-y:auto;
  padding:22px 20px 32px;
  position:relative;
  border-top:1px solid var(--line);
  transform:translateY(24px);
  transition:transform .35s cubic-bezier(.65,0,.35,1);
}
.modal-overlay.is-open .modal-card{
  transform:translateY(0);
}

.modal-close{
  position:absolute;
  top:14px; right:16px;
  width:28px; height:28px;
  border:none;
  background:none;
  font-size:20px;
  line-height:1;
  color:var(--ink-soft);
  cursor:pointer;
}
.modal-close:hover{ color:var(--ink); }

.modal-card .year-label{
  font-size:22px;
  color:var(--ink);
  font-weight:400;
  margin:0 0 14px;
}

/* images inside the modal always stack full-width, regardless of count */
.modal-photos{
  display:flex;
  flex-direction:column;
  gap:14px;
}
.modal-photos img{
  width:100%;
  height:200px;
  object-fit:cover;
  display:block;
  border:1px solid var(--line);
}

/* the only line that decides desktop vs. mobile */
@media (max-width:767px){
  .timeline{ display:none; }
  .mobile-list{ display:block; max-width:480px; width: 95%; margin: 0 auto;}
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 1200px) {
  .years-wrap {
    width: 200px;
  }
  .timeline {
    gap: 30px;
  }
  .content-wrap {
    width: calc(100% - 230px);
  }

}

@media (max-width: 900px) {
  .histoire-page .histoire-hero__cols {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .histoire-page .histoire-hero__aside {
    order: -1;                    /* portrait/intro first on mobile */
  }
  .histoire-page .histoire-hero__portrait img { aspect-ratio: 16 / 10; }
}

@media (max-width: 768px) {
  .histoire-page .histoire-hero { padding: 45px 0 35px; }
  .histoire-page .histoire-hero__title { font-size: 28px; margin-bottom: 26px; }
  .histoire-page .histoire-story__title { font-size: 25px; }

  .histoire-page {
    --tl-item-w: 260px;
    --tl-gap: 30px;
    --tl-row-h: 215px;
  }
  .histoire-page .histoire-item__year { font-size: 19px; }
  .histoire-page .histoire-card__title { font-size: 17px; }
  .histoire-page .histoire-track { padding: 10px 24px 20px; }

  .histoire-page .histoire-story .lcontainer {
    flex-direction: column;
    gap: 5px;
  }
}

@media (max-width: 460px) {
  .histoire-page {
    --tl-item-w: 78vw;
    --tl-gap: 22px;
    --tl-row-h: 200px;
  }
  .histoire-page .histoire-track { padding: 10px 16px 16px; }
  .histoire-page .histoire-hero__text p { font-size: 14px; line-height: 25px; }
}
