/**
 * Coffre artefacts — layout mobile dédié (body.page-artefacts).
 * Fichier chargé en dernier + miroir des styles critiques inline dans artefacts.html.
 */

/* Contenu visible même sans classe page-enter */
body.page-artefacts .page-content {
  opacity: 1;
}

@media screen and (max-width: 768px) {
  body.page-artefacts {
    overflow-x: clip;
  }

  body.page-artefacts main.page-content.page-section {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  body.page-artefacts .section.section-artefacts {
    padding: 0.25rem 0 max(1.5rem, env(safe-area-inset-bottom));
    align-items: stretch;
    min-height: 0;
  }

  body.page-artefacts .container-artefacts {
    width: 100%;
    max-width: 100%;
    padding: 0;
    box-sizing: border-box;
  }

  body.page-artefacts .page-logo {
    display: none;
  }

  body.page-artefacts .artefacts-title {
    text-align: center;
    font-size: clamp(1.75rem, 8vw, 2.4rem);
    margin-bottom: 0.35rem;
  }

  body.page-artefacts .section-intro {
    text-align: center;
    font-size: 0.9rem;
    max-width: 100%;
    margin: 0 auto 1rem;
    padding: 0 0.25rem;
  }

  /* Code redeem */
  body.page-artefacts .artefacts-redeem-hero {
    width: 100%;
    max-width: 100%;
    margin: 0 0 1rem;
    padding: 1rem 0.9rem;
    box-sizing: border-box;
  }

  body.page-artefacts .artefacts-redeem-hero-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    width: 100%;
    text-align: center;
  }

  body.page-artefacts .artefacts-redeem-hero-text {
    width: 100%;
    text-align: center;
  }

  body.page-artefacts .artefacts-redeem-hero-desc {
    max-width: 100%;
    margin: 0 auto;
  }

  body.page-artefacts .artefacts-redeem-hero-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    width: 100%;
    max-width: 100%;
    flex: none;
  }

  body.page-artefacts .artefacts-redeem-hero-form input,
  body.page-artefacts .artefacts-redeem-submit {
    width: 100%;
    max-width: 100%;
    min-height: 48px;
    box-sizing: border-box;
    font-size: 16px;
  }

  body.page-artefacts .artefacts-instruction {
    font-size: 0.84rem;
    margin-bottom: 0.85rem;
  }

  /* Layout : filtres puis grille */
  body.page-artefacts .artefacts-layout {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
    margin-top: 0.5rem;
  }

  body.page-artefacts .artefacts-sidebar,
  body.page-artefacts .artefacts-main {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  body.page-artefacts .artefacts-filters {
    padding: 0.75rem;
  }

  body.page-artefacts .artefacts-cat-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.15rem;
  }

  body.page-artefacts .artefacts-cat-list > li {
    flex: 0 0 auto;
    list-style: none;
  }

  body.page-artefacts .artefacts-cat-btn {
    width: auto;
    min-height: 44px;
    padding: 0.5rem 0.85rem;
    white-space: nowrap;
    text-align: center;
  }

  body.page-artefacts .artefacts-hud {
    width: 100%;
    box-sizing: border-box;
  }

  /* Grille cartes */
  body.page-artefacts #artefacts-grid.artefacts-grid,
  body.page-artefacts .artefacts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    justify-items: stretch;
    align-items: stretch;
  }

  /* Carte af-card — structure neuve, sans héritage foireux */
  body.page-artefacts .af-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0.75rem 0.5rem 0.65rem;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    float: none;
    left: auto;
    right: auto;
    transform: none;
    direction: ltr;
    text-align: center;
    border-radius: 12px;
    border: 2px solid rgba(0, 245, 212, 0.35);
    background: linear-gradient(165deg, rgba(20, 28, 40, 0.95), rgba(10, 14, 20, 0.98));
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  body.page-artefacts .af-card.artefacts-slot-malus {
    border-color: rgba(248, 113, 113, 0.75);
  }

  body.page-artefacts .af-card__media {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    max-width: 56px;
    max-height: 56px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 0 0 56px;
  }

  body.page-artefacts .af-card__media img {
    width: 56px !important;
    height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 !important;
    position: static !important;
    transform: none !important;
  }

  body.page-artefacts .af-card__body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 0.15rem;
    box-sizing: border-box;
  }

  body.page-artefacts .af-card__title {
    display: block;
    width: 100%;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    color: #f3f4f6;
    text-align: center;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  body.page-artefacts .af-card__meta {
    display: block;
    width: 100%;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
    text-align: center;
  }

  body.page-artefacts .af-card__qty {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(0, 245, 212, 0.9);
    color: #0a0e14;
    margin: 0;
  }

  body.page-artefacts .af-card__modes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.2rem;
    width: 100%;
    margin: 0.15rem 0 0;
  }

  body.page-artefacts .section-nav {
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
  }

  body.page-artefacts .section-nav .btn {
    width: 100%;
    max-width: 22rem;
    min-height: 48px;
    justify-content: center;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  body.page-artefacts .artefact-modal-box {
    width: min(100%, 26rem);
    max-width: calc(100vw - 1.25rem);
    max-height: min(90dvh, 720px);
    overflow-y: auto;
    box-sizing: border-box;
  }

  body.page-artefacts .artefact-modal-close,
  body.page-artefacts .artefact-modal-btn-close {
    min-width: 44px;
    min-height: 44px;
  }
}
