/*
 * THE FORTRESS OF MEMORIES
 * Base commune à tous les chapitres
 *
 * Important :
 * conserver ici uniquement les règles réellement communes.
 * Chaque chapitre possède son propre fichier dans :
 * /assets/css/chapters/{slug}.css
 */

#fortress-chapter {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

#fortress-chapter,
#fortress-chapter * {
  box-sizing: border-box;
}

#fortress-chapter img {
  display: block;
  max-width: 100%;
  height: auto;
}

#fortress-chapter a {
  color: inherit;
}

#fortress-chapter [dir="rtl"],
#fortress-chapter .fortress-chapter[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

/* ==========================================================
   MOBILE CHAPTER HEADER
   One shared rule for every Fortress chapter.

   Goal:
   keep the complete Grand Salon navigation pattern on mobile:
   - MESKI / The House of Meski
   - Journal
   - Honey Atlas
   - The Fortress of Memories
   - The House of Meski
   - language switch
   ========================================================== */

@media (max-width: 900px) {

  #fortress-chapter [class*="-topbar"] {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto !important;
    column-gap: 14px !important;
    row-gap: 28px !important;
    align-items: start !important;
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 24px !important;
    border-bottom: 1px solid rgba(255,255,255,.22) !important;
  }

  /* Logo and language form the first row, nav occupies the full second row. */
  #fortress-chapter [class*="-topbar"] > a[class*="-brand"],
  #fortress-chapter [class*="-topbar"] > a[class*="-language"] {
    align-self: start !important;
  }

  #fortress-chapter [class*="-topbar"] > a[class*="-brand"] {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    align-self: start !important;
    margin: 0 !important;
  }

  #fortress-chapter [class*="-topbar"] > nav[class*="-nav"] {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 10px !important;
    overflow: visible !important;
    align-items: start !important;
    justify-content: stretch !important;
  }

  #fortress-chapter [class*="-topbar"] > nav[class*="-nav"] > a {
    display: block !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 0 10px !important;
    color: rgba(255,255,255,.90) !important;
    font-size: 8px !important;
    font-weight: 600 !important;
    line-height: 1.55 !important;
    letter-spacing: .12em !important;
    text-decoration: none !important;
    text-transform: uppercase !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    text-align: left !important;
  }

  #fortress-chapter [class*="-topbar"] > nav[class*="-nav"] > a.is-current {
    color: #e7d191 !important;
  }

  #fortress-chapter [class*="-topbar"] > a[class*="-language"] {
    grid-column: 2 !important;
    grid-row: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: start !important;
    justify-self: end !important;
    min-width: 70px !important;
    max-width: 86px !important;
    min-height: 43px !important;
    margin: 0 !important;
    padding: 9px 10px !important;
    border: 1px solid rgba(231,209,145,.62) !important;
    color: #e7d191 !important;
    background: transparent !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    letter-spacing: .04em !important;
    text-align: center !important;
    text-decoration: none !important;
    text-transform: none !important;
    white-space: normal !important;
  }

  #fortress-chapter[dir="rtl"] [class*="-topbar"],
  #fortress-chapter [dir="rtl"] [class*="-topbar"] {
    direction: rtl !important;
  }

  #fortress-chapter[dir="rtl"] [class*="-topbar"] > a[class*="-brand"],
  #fortress-chapter [dir="rtl"] [class*="-topbar"] > a[class*="-brand"] {
    justify-self: end !important;
    text-align: right !important;
  }

  #fortress-chapter[dir="rtl"] [class*="-topbar"] > nav[class*="-nav"] > a,
  #fortress-chapter [dir="rtl"] [class*="-topbar"] > nav[class*="-nav"] > a {
    text-align: right !important;
  }

  #fortress-chapter[dir="rtl"] [class*="-topbar"] > a[class*="-language"],
  #fortress-chapter [dir="rtl"] [class*="-topbar"] > a[class*="-language"] {
    justify-self: start !important;
    direction: ltr !important;
  }
}

@media (max-width: 390px) {
  #fortress-chapter [class*="-topbar"] {
    column-gap: 10px !important;
    row-gap: 23px !important;
  }

  #fortress-chapter [class*="-topbar"] > nav[class*="-nav"] {
    gap: 7px !important;
  }

  #fortress-chapter [class*="-topbar"] > nav[class*="-nav"] > a {
    font-size: 7.4px !important;
    letter-spacing: .09em !important;
  }

  #fortress-chapter [class*="-topbar"] > a[class*="-language"] {
    min-width: 64px !important;
    max-width: 72px !important;
    padding-inline: 7px !important;
    font-size: 9px !important;
  }
}

