/* ============================================
   E-KOULIBA — HOME-MOBILE.CSS  (MOBILE ≤ 768px)
   Refonte mobile — Direction "Mécanique"
   ✅ Aucune couleur en dur — variables uniquement
   ============================================ */


/* ============================================
   ANIMATIONS LOCALES MOBILE
   ============================================ */

@keyframes mFadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes mFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes mScaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes mTickerScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}


/* ============================================
   MOBILE ≤ 768px
   ============================================ */
@media (max-width: 768px) {

  /* ============================================
     TOGGLE GLOBAL
     ============================================ */
  .desktop-only { display: none  !important; }
  .mobile-only  { display: block !important; }


  /* ============================================
     1. HERO MOBILE — refonte ÉDITORIALE
     Ordre : TITRE → BOUTONS → CHIPS
     (photo + "À la une" masqués sur mobile)
     ============================================ */

  /* On transforme .hero en flex column pour pouvoir réordonner
     ses enfants dans un ordre maîtrisé */
  .hero {
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding: 28px 18px 44px;
    border-radius: 0 0 36px 36px;
    overflow: hidden;
  }

  /* "E-Kouliba" italique en haut à droite */
  .hero__tape {
    top: 18px;
    right: 18px;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    opacity: 0.6;
  }

  /* Le container devient transparent : ses enfants (.hero__left,
     .hero__right) remontent au niveau de .hero pour être ordonnés
     avec .hero__chips entre les deux */
  .hero__container {
    display: contents;
  }

  /* === Réordonnancement === */
  .hero__left {
    order: 1;
    padding: 0;
    margin: 0;
    text-align: left;
    animation: mFadeUp 0.6s ease both;
  }

  .hero__chips {
    order: 2;
    animation: mFadeIn 0.6s ease 0.25s both;
  }

  /* ===== Photo + article à la une — masqués sur mobile ===== */
  .hero__right {
    display: none !important;
  }

  .hero__stats-pill {
    display: none !important;
  }


  /* ============================================
     1.1  COLONNE GAUCHE — TITRE FORT EN PREMIER
     ============================================ */
  .hero__name {
    font-size: clamp(46px, 14vw, 68px);
    line-height: 0.88;
    letter-spacing: -0.025em;
    margin-top: 14px;
  }

  .hero__subtitle {
    margin-top: 20px;
    font-size: 14.5px;
    line-height: 1.5;
    max-width: 100%;
  }

  /* ===== Badge rotatif ===== */
  .hero__badge-row {
    margin-top: 22px;
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .hero__badge-key { padding: 8px 12px; }
  .hero__badge-val { padding: 8px 14px; gap: 8px; }
  .hero__badge-dot { width: 6px; height: 6px; }

  /* ===== Boutons hero — empilés pleine largeur ===== */
  .hero__buttons {
    margin-top: 26px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }

  .hero__buttons-row {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .hero .btn {
    padding: 15px 20px;
    font-size: 10.5px;
    justify-content: center;
    width: 100%;
    letter-spacing: 0.14em;
  }

  .hero .btn--portfolio {
    margin-left: 0;
    font-size: 10px;
  }

  .hero .btn__ico {
    width: 22px;
    height: 22px;
  }


  /* ============================================
     1.2  CHIPS — TICKER SOUS LES BOUTONS
     ============================================ */
  .hero__chips {
    margin: 0 -18px;
    padding: 0 18px;
    max-width: none;
    overflow-x: auto;
    flex-wrap: nowrap;
    -ms-overflow-style: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
  }

  @supports (scrollbar-width: none) {
    .hero__chips {
      scrollbar-width: none;
    }
  }

  .hero__chips::-webkit-scrollbar { display: none; }

  .hero__chip {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 10px;
    letter-spacing: 0.14em;
  }


  /* ============================================
     1.3  COLONNE DROITE (photo + une) — MASQUÉE
     Tous les styles internes laissés inertes
     ============================================ */
  .hero__disc-wrap {
    display: grid;
    grid-template-rows: 220px auto;
    justify-items: center;
    gap: 18px;
    width: 100%;
    max-width: 360px;
    height: auto;
    margin: 4px auto 0;
    padding: 0;
    position: relative;
  }

  /* Engrenages + texte courbé : trop chargés en mobile */
  .hero__gear,
  .hero__curve {
    display: none;
  }

  /* Anneaux + photo : tous dans la rangée 1 du grid (empilés) */
  .hero__ring--1,
  .hero__ring--2,
  .hero__ring--3,
  .hero__photo {
    grid-row: 1;
    grid-column: 1;
    position: relative;
    inset: auto;
    align-self: center;
    justify-self: center;
  }

  .hero__ring--1 { width: 220px; height: 220px; }
  .hero__ring--2 { width: 198px; height: 198px; }
  .hero__ring--3 { width: 174px; height: 174px; }

  .hero__photo {
    width: 174px;
    height: 174px;
  }

  .hero__photo-img { inset: 0; }


  /* ===== Article à la une — rangée 2 du grid, pleine largeur ===== */
  .hero__une {
    grid-row: 2;
    grid-column: 1;
    position: relative;
    inset: auto;
    width: 100%;
    margin: 0;
    padding: 16px 18px;
    border-radius: 18px;
    transform: rotate(-1.2deg);
    box-shadow: 0 18px 38px -16px rgba(0,0,0,0.55);
    z-index: 10;
  }

  .hero__une:hover {
    transform: rotate(0deg) translateY(-2px);
  }

  .hero__une-label {
    font-size: 9px;
    padding: 5px 10px;
    margin-bottom: 10px;
  }

  .hero__une-title {
    font-size: 14px;
    margin-bottom: 12px;
  }

  .hero__une-foot {
    font-size: 10px;
  }

  .hero__une-btn {
    width: 32px;
    height: 32px;
  }

  .hero__une-btn svg { width: 13px; height: 13px; }


  /* ============================================
     2. SECTIONS — RÉAJUSTEMENTS GLOBAUX
     ============================================ */
  .section {
    padding: 60px 0 40px;
  }

  .section--bienvenue { padding-top: 72px; }
  .section--articles  { padding-top: 8px; }
  .section--archives  { padding-top: 8px; }

  .section .container {
    padding: 0 18px;
  }

  /* En-tête section : numéro + titre, aside masquée */
  .section__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 26px;
  }

  .section__head-left {
    gap: 14px;
    align-items: center;
  }

  .section__mark {
    width: 42px;
    height: 42px;
    font-size: 15px;
  }

  .section__label {
    font-size: 9.5px;
    letter-spacing: 0.18em;
    margin-bottom: 4px;
  }

  .section__title {
    font-size: clamp(24px, 7vw, 30px);
    line-height: 1.05;
  }

  .section__aside {
    display: none;
  }


  /* ============================================
     3. WELCOME CARDS — 1 colonne, compactes
     ============================================ */
  .welcome-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .welcome-card {
    padding: 24px 22px;
    border-radius: 22px;
    animation: mFadeUp 0.5s ease both;
  }

  .welcome-card:nth-child(2) { animation-delay: 0.1s; }

  .welcome-card__cog {
    width: 130px;
    height: 130px;
    right: -32px;
    top: -32px;
    opacity: 0.20;
  }

  .welcome-card__head {
    margin-bottom: 22px;
  }

  .welcome-card__icon {
    width: 44px;
    height: 44px;
  }

  .welcome-card__icon svg { width: 18px; height: 18px; }

  .welcome-card__num    { font-size: 10.5px; gap: 6px; }
  .welcome-card__num b  { font-size: 15px; }

  /* Annule le décalage desktop sur mobile */
  .welcome-card--dark .welcome-card__num { transform: none; }

  .welcome-card__label {
    font-size: 9.5px;
    margin-bottom: 8px;
  }

  .welcome-card__title {
    font-size: 32px;
    margin-bottom: 12px;
  }

  .welcome-card__desc {
    font-size: 13.5px;
    margin-bottom: 22px;
  }

  .welcome-card__foot {
    padding-top: 20px;
  }

  .welcome-card__count {
    font-size: 13px;
  }

  .welcome-card__count b {
    font-size: 24px;
  }

  .welcome-card__link {
    padding: 10px 14px;
    font-size: 9.5px;
    letter-spacing: 0.12em;
    gap: 8px;
  }

  .welcome-card__link svg { width: 12px; height: 12px; }


  /* ============================================
     4. ARTICLES — Cards verticales compactes
     ============================================ */
  .articles-list {
    gap: 10px;
  }

  .article-row {
    grid-template-columns: 48px 1fr auto;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "num cat   arrow"
      "num title arrow"
      "num date  arrow";
    column-gap: 14px;
    row-gap: 4px;
    padding: 14px 16px 14px 14px;
    border-radius: 18px;
    animation: mFadeUp 0.5s ease both;
  }

  .article-row:nth-child(2) { animation-delay: 0.06s; }
  .article-row:nth-child(3) { animation-delay: 0.12s; }
  .article-row:nth-child(4) { animation-delay: 0.18s; }

  .article-row:hover,
  .article-row:active {
    transform: none;
  }

  .article-row__num {
    grid-area: num;
    width: 44px;
    height: 44px;
    font-size: 16px;
    align-self: center;
  }

  .article-row__cat {
    grid-area: cat;
    font-size: 8.5px;
    padding: 3px 9px 3px 8px;
    letter-spacing: 0.12em;
    gap: 6px;
    justify-self: start;
    align-self: end;
  }

  .article-row__cat::before {
    width: 5px;
    height: 5px;
  }

  .article-row__title {
    grid-area: title;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    /* Limite à 2 lignes max */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .article-row__date {
    grid-area: date;
    font-size: 9.5px;
    letter-spacing: 0.05em;
    gap: 5px;
  }

  .article-row__date svg { width: 11px; height: 11px; }

  .article-row__arrow {
    grid-area: arrow;
    width: 34px;
    height: 34px;
    align-self: center;
  }

  .article-row__arrow svg { width: 13px; height: 13px; }


  /* ============================================
     5. ARCHIVES MOBILE — Cards avec aperçu PDF
     Même rendu visuel que desktop, en plus compact
     ============================================ */
  .archives-grid-mobile {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .arch-card {
    background-color: var(--color-bg-secondary);
    border: 1px solid var(--color-separator);
    border-radius: 18px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-decoration: none;
    color: var(--color-text-primary);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    animation: mScaleIn 0.5s ease both;
  }

  .arch-card:nth-child(2) { animation-delay: 0.08s; }
  .arch-card:nth-child(3) { animation-delay: 0.16s; }
  .arch-card:nth-child(4) { animation-delay: 0.24s; }

  .arch-card:active {
    transform: scale(0.98);
  }

  /* ===== Vignette teal + badge or + aperçu PDF ===== */
  .arch-card__thumb {
    position: relative;
    height: 130px;
    border-radius: 12px;
    background-color: var(--color-teal);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .arch-card__thumb::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
      circle at 30% 30%,
      rgba(212, 168, 67, 0.15),
      transparent 60%
    );
    pointer-events: none;
    z-index: 2;
  }

  /* Badge PDF doré en haut à gauche */
  .arch-card__stamp {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    background-color: var(--color-or);
    color: var(--color-text-primary);
    font-family: var(--font-code);
    font-size: 8.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
  }

  .arch-card__stamp svg {
    width: 10px;
    height: 10px;
  }

  /* Canvas — l'aperçu PDF généré par PDF.js */
  .arch-card .archive-card__pdf-canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 1;
    object-fit: cover;
  }

  /* Fallback icône si non-PDF */
  .arch-card__icon {
    position: relative;
    z-index: 1;
    width: 60%;
    height: 75%;
    border-radius: 4px;
    background-color: var(--color-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-teal);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  }

  .arch-card__icon svg {
    width: 36px;
    height: 36px;
  }

  /* ===== Corps : catégorie + titre + bouton ===== */
  .arch-card__body {
    padding: 4px 6px 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
  }

  .arch-card__cat {
    font-family: var(--font-code);
    font-size: 8.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-or-hover);
    margin: 0;
  }

  .arch-card__title {
    font-family: var(--font-titre);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    color: var(--color-text-primary);
    /* limite à 2 lignes */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
  }

  .arch-card__btn {
    margin-top: 6px;
    padding: 8px 12px;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    background-color: var(--color-teal);
    color: var(--color-bg-primary);
    font-family: var(--font-code);
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    border: 0;
  }

  .arch-card__btn svg {
    width: 11px;
    height: 11px;
  }


  /* ============================================
     6. PHILOSOPHIE + CTA MOBILE
     ============================================ */
  .section--bottom {
    padding: 60px 0 50px;
    margin-top: 30px;
  }

  .bottom__stars {
    font-size: 10px;
    letter-spacing: 0.9em;
    top: 18px;
    opacity: 0.5;
  }

  .bottom-grid {
    grid-template-columns: 1fr;
    gap: 36px;
    margin-top: 30px;
  }

  /* ===== Philosophie ===== */
  .philosophie__icon {
    width: 54px;
    height: 54px;
    margin-bottom: 20px;
  }

  .philosophie__icon svg {
    width: 22px;
    height: 22px;
  }

  .philosophie__icon::after {
    inset: -8px;
  }

  .philosophie__label {
    font-size: 9.5px;
    margin-bottom: 14px;
  }

  .philosophie__quote {
    font-size: 22px;
    line-height: 1.25;
    margin-bottom: 20px;
  }

  .philosophie__author {
    font-size: 9.5px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .philosophie__author::before {
    width: 28px;
  }

  /* ===== CTA ===== */
  .cta-block {
    padding: 26px 22px;
    border-radius: 22px;
  }

  .cta-block::before {
    width: 130px;
    height: 130px;
    right: -40px;
    top: -40px;
  }

  .cta-block__label {
    font-size: 9.5px;
    margin-bottom: 12px;
  }

  .cta-block__title {
    font-size: 20px;
    margin-bottom: 10px;
  }

  .cta-block__desc {
    font-size: 12.5px;
    line-height: 1.55;
    margin-bottom: 18px;
  }

  .cta-block__actions {
    flex-direction: row;
    gap: 8px;
  }

  .cta-block__btn {
    padding: 12px 16px;
    font-size: 9.5px;
    letter-spacing: 0.12em;
  }

  .cta-block__btn--fill {
    flex: 1;
    justify-content: center;
  }

  .cta-block__btn--out {
    width: 46px;
    height: 46px;
    padding: 0;
    justify-content: center;
  }


  /* ============================================
     7. NEWSLETTER — popup adaptée mobile
     ============================================ */
  .nl-modal {
    padding: 38px 24px 28px;
    border-radius: 22px;
    max-width: 100%;
  }

  .nl-close {
    width: 32px;
    height: 32px;
    top: 12px;
    right: 12px;
  }
  .nl-close svg { width: 14px; height: 14px; }

  .nl-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
  }
  .nl-icon svg { width: 24px; height: 24px; }

  .nl-pretitle { font-size: 9.5px; }

  .nl-title {
    font-size: 22px;
    line-height: 1.15;
    margin-bottom: 12px;
  }

  .nl-desc {
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 22px;
  }

  .nl-input {
    padding: 12px 12px 12px 38px;
    font-size: 13px;
  }
  .nl-input-wrap svg { width: 14px; height: 14px; left: 12px; }

  .nl-submit {
    padding: 13px 18px;
    font-size: 10.5px;
    letter-spacing: 0.12em;
  }

  .nl-success {
    padding: 12px;
    font-size: 13px;
  }

  .nl-legal {
    font-size: 10px;
    margin-top: 14px;
  }

  /* FAB plus petit */
  .nl-fab {
    bottom: 22px;
    right: 22px;
    padding: 11px 16px;
    font-size: 9.5px;
    letter-spacing: 0.1em;
    gap: 8px;
  }

  .nl-fab svg { width: 14px; height: 14px; }


  /* ============================================
     8. EMPTY STATES
     ============================================ */
  .empty-state {
    padding: 22px 14px;
    font-size: 13px;
  }

  /* ============================================
     9. DESACTIVATION HOVER (tactile)
     ============================================ */
  @media (hover: none) {
    .welcome-card:hover  { transform: none; box-shadow: none; }
    .article-row:hover   { transform: none; border-color: var(--color-separator); }
    .archive-card:hover  { transform: none; box-shadow: none; }
    .hero__une:hover     { transform: rotate(-1.2deg); }
    .hero .btn:hover     { transform: none; }
    .arch-card:hover     { transform: none; }
  }

} /* === fin @media (max-width: 768px) === */


/* ============================================
   PETITS TÉLÉPHONES (≤ 380px)
   ============================================ */
@media (max-width: 380px) {

  .hero {
    padding: 24px 14px 0;
  }

  .hero__tape {
    font-size: 0.7rem;
    right: 14px;
  }

  .hero__name {
    font-size: clamp(34px, 11vw, 44px);
  }

  .hero__subtitle {
    font-size: 13px;
  }

  .hero__disc-wrap {
    width: 230px;
    height: 230px;
  }

  .hero__photo { inset: 28px; }

  .hero__chips {
    margin-left: -14px;
    margin-right: -14px;
    padding: 0 14px;
  }

  .hero__chip {
    font-size: 9px;
    padding: 6px 12px;
  }

  .hero__stats-pill {
    margin: -24px 10px 0;
    padding: 18px 16px;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hero__stats-label {
    padding-bottom: 12px;
  }

  .hero__stat,
  .hero__stat:nth-of-type(3) {
    grid-column: 1;
    border-top: 0;
    padding-top: 0;
  }

  .hero__stat-num { font-size: 26px; }

  .section .container { padding: 0 14px; }

  .section__title { font-size: 22px; }

  .welcome-card__title { font-size: 28px; }

  .article-row {
    grid-template-columns: 42px 1fr auto;
    padding: 12px 14px;
  }

  .article-row__num { width: 40px; height: 40px; font-size: 14px; }
  .article-row__title { font-size: 13px; }

  .archives-grid-mobile {
    grid-template-columns: 1fr;
  }

  .arch-card { min-height: 130px; }

  .philosophie__quote { font-size: 19px; }
  .cta-block__title   { font-size: 18px; }

  .cta-block__btn { font-size: 9px; padding: 11px 14px; }
}


/* ============================================
   TABLETTE (769px – 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {

  .hero {
    padding: 60px 32px 0;
  }

  .hero__container {
    gap: 32px;
  }

  .hero__disc-wrap {
    width: 420px;
    height: 420px;
  }

  .hero__right {
    height: 480px;
  }

  .hero__une {
    width: 270px;
    right: -16px;
  }

  .hero__chips {
    margin-top: -80px;
    max-width: 480px;
  }

  .hero__stats-pill {
    margin: -36px 28px 0;
    padding: 22px 26px;
    gap: 20px;
  }

  .welcome-card {
    padding: 30px 28px;
  }

  .welcome-card__title {
    font-size: 42px;
  }

  /* Articles : plus compact */
  .article-row {
    grid-template-columns: 60px 150px 1fr 130px 42px;
    gap: 18px;
    padding: 18px 24px;
  }

  .article-row__title {
    font-size: 17px;
  }

  /* Archives : 2 colonnes */
  .archives-grid {
    grid-template-columns: 1fr 1fr;
  }

  .bottom-grid {
    gap: 50px;
  }

  .cta-block {
    padding: 30px 28px;
  }
}
