/* EQUI Index Page Responsive Styles */

/* =========================== */
/*      INDEX RESPONSIVE       */
/* =========================== */

/* Desktop/Mobile Content Control */
.mobile-text {
  display: none;
}

.desktop-text {
  display: inline;
}

.desktop-only {
  display: block;
}

/* Tablette Portrait (768px-1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
  body.index-page {
    padding: var(--space-4) var(--space-2);
    gap: calc(var(--space-16) * 0.8);
  }
  
  .logo-section {
    margin-bottom: calc(var(--space-12) * 0.9);
  }
  
  .logo-main img {
    max-height: 45px;
  }
  
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 700px;
  }
  
  .auto-flip-card {
    width: 100%;
    height: 340px;
  }
  
  .card-front,
  .card-back {
    padding: 1.2rem 1.8rem;
  }
  
  .competency-icon {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
  }
  
  .competency-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }
  
  .competency-info p {
    font-size: 0.9rem;
    line-height: 1.5;
  }
  
  .card-back-content h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
  }
  
  .card-back-content ul li {
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
  }
  
  .instructions {
    margin-top: calc(var(--space-10) * 0.9);
  }
  
  .instructions p {
    font-size: 1.1rem;
  }
  
  .click-hint {
    padding: 0.9rem 2rem;
    font-size: 1rem;
  }
}

/* Tablette Portrait et Mobile Large (481px-768px) */
@media (max-width: 768px) and (min-width: 481px) {
  body.index-page {
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    padding: 0;
    gap: 0;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: 
      "logo"
      "cards"
      "instructions";
  }
  
  .logo-section {
    grid-area: logo;
    margin: 0;
    padding: 2.5vh 5vw 1.5vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  .logo-main img {
    max-height: clamp(36px, 4.5vh, 42px);
  }
  
  .logo-underline {
    width: clamp(70px, 18vw, 90px);
    height: 2px;
    margin-top: 1.2vh;
  }
  
  .cards-grid {
    grid-area: cards;
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2.5vh, 1.5rem);
    padding: 0 8vw;
    max-width: none;
    height: 100%;
    justify-content: center;
    align-items: center;
  }
  
  .auto-flip-card {
    width: min(84vw, 380px);
    height: clamp(240px, 20vh, 280px);
    flex-shrink: 0;
  }
  
  .card-front,
  .card-back {
    padding: clamp(0.8rem, 3vh, 1.2rem) clamp(1rem, 5vw, 1.5rem);
    grid-template-rows: clamp(60px, 9vh, 80px) 1fr;
  }
  
  .competency-icon {
    width: clamp(36px, 7vh, 44px);
    height: clamp(36px, 7vh, 44px);
    font-size: clamp(1rem, 3vh, 1.2rem);
  }
  
  .competency-info h3 {
    font-size: clamp(0.9rem, 2.5vh, 1.1rem);
    margin-bottom: clamp(0.4rem, 1.2vh, 0.7rem);
    line-height: 1.25;
  }
  
  .competency-info p {
    font-size: clamp(0.75rem, 2vh, 0.9rem);
    line-height: 1.3;
  }
  
  .card-back-content {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  
  .card-back-content h4 {
    font-size: clamp(0.8rem, 2.2vh, 0.95rem);
    margin-bottom: clamp(0.5rem, 1.8vh, 0.9rem);
  }
  
  .card-back-content ul {
    margin: 0;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
  }
  
  .card-back-content ul li {
    font-size: clamp(0.7rem, 1.8vh, 0.85rem);
    margin-bottom: clamp(0.2rem, 1vh, 0.4rem);
    line-height: 1.25;
    padding: 0;
  }
  
  .back-icon {
    width: clamp(32px, 6vh, 40px);
    height: clamp(32px, 6vh, 40px);
    font-size: clamp(0.9rem, 2.5vh, 1.1rem);
    margin-bottom: clamp(0.4rem, 1.2vh, 0.8rem);
  }
  
  .instructions {
    grid-area: instructions;
    margin: 0;
    padding: 2vh 8vw 3.5vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  .instructions p {
    font-size: clamp(0.9rem, 2.5vh, 1.1rem);
    text-align: center;
    margin-bottom: clamp(1rem, 2.5vh, 1.6rem);
    line-height: 1.35;
  }
  
  .click-hint {
    padding: clamp(0.7rem, 2vh, 0.9rem) clamp(1.4rem, 7vw, 2rem);
    font-size: clamp(0.85rem, 2.2vh, 1rem);
    min-width: auto;
  }
  
  .click-hint i {
    font-size: clamp(0.85rem, 2.2vh, 1rem);
  }
}

/* Mobile Responsive - Écrans moyens (321px-480px) */
@media (max-width: 480px) and (min-width: 321px) {
  /* Content switching for mobile */
  .mobile-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
  }
  
  .desktop-text {
    display: none;
  }
  
  .desktop-only {
    display: none;
  }
  
  body.index-page {
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    padding: 2.5rem;
    gap: 0;
    overflow: hidden;
    display: grid;
    /* grid-template-rows: clamp(35px, 6vh, 45px) 1fr clamp(40px, 7vh, 50px); */
    grid-template-areas: 
      "logo"
      "cards"
      "instructions";
    position: relative;
  }
  
  .logo-section {
    grid-area: logo;
    margin: 0;
    padding: clamp(6px, 1.5vh, 10px) clamp(8px, 2vw, 12px) clamp(2px, 0.5vh, 4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
  }
  
  .logo-main img {
    max-height: clamp(20px, 3vh, 28px);
    transition: all 0.3s ease;
  }
  
  .logo-underline {
    width: clamp(32px, 10vw, 50px);
    height: clamp(1px, 0.3vh, 2px);
    margin-top: clamp(3px, 0.8vh, 6px);
    transition: all 0.3s ease;
  }
  
  .cards-grid {
    grid-area: cards;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: clamp(3px, 0.8vh, 6px);
    padding: clamp(2px, 0.5vw, 4px);
    max-width: none;
    height: 100%;
    justify-content: center;
    align-items: stretch;
    place-items: stretch;
  }
  
  .auto-flip-card {
    width: 100%;
    height: 100%;
    min-height: clamp(60px, 10vh, 80px);
    max-width: none;
    flex-shrink: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }
  
  .auto-flip-card:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
  
  .card-front,
  .card-back {
    padding: clamp(4px, 1.2vh, 8px) clamp(6px, 1.8vw, 10px);
    grid-template-rows: 1fr;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 0;
    transition: all 0.3s ease;
  }
  
  .card-front {
    background: var(--primary-charcoal);
    border: 1px solid rgba(198, 222, 205, 0.3);
  }
  
  .card-back {
    background: var(--accent-sage);
    border: 1px solid var(--primary-green);
  }
  
  .competency-icon {
    display: none;
  }
  
  .competency-info h3 {
    font-size: clamp(0.6rem, 1.8vh, 0.8rem);
    margin-bottom: clamp(2px, 0.6vh, 4px);
    line-height: 1.15;
    text-align: center;
    font-weight: 600;
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
  }
  
  .competency-info p {
    font-size: clamp(0.45rem, 1.2vh, 0.6rem);
    line-height: 1.2;
    text-align: center;
    color: var(--text-inverse);
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
  }
  
  .card-back-content {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    text-align: center;
    justify-content: center;
    align-items: center;
  }
  
  .card-back-content h4 {
    font-size: clamp(0.55rem, 1.5vh, 0.7rem);
    margin-bottom: clamp(2px, 0.6vh, 4px);
    color: var(--primary-dark);
    font-weight: 600;
    line-height: 1.15;
  }
  
  .card-back-content h4 .mobile-text {
    font-size: clamp(0.9rem, 2.5vh, 1.1rem);
    font-weight: 700;
  }
  
  .card-back-content ul {
    margin: 0;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    list-style: none;
    gap: clamp(1px, 0.4vh, 2px);
  }
  
  .card-back-content ul li {
    font-size: clamp(0.4rem, 1.1vh, 0.55rem);
    line-height: 1.1;
    padding: 0;
    text-align: center;
    position: relative;
    color: var(--primary-dark);
    opacity: 0.95;
    font-weight: 500;
  }
  
  .card-back-content li:before {
    display: none;
  }
  
  .back-icon {
    display: none;
  }
  
  .instructions {
    grid-area: instructions;
    margin: 0;
    padding: clamp(4px, 1vh, 6px) clamp(8px, 2vw, 12px) clamp(6px, 1.5vh, 8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
  }
  
  .instructions p {
    font-size: clamp(0.85rem, 2.2vh, 1rem);
    text-align: center;
    margin-bottom: clamp(8px, 2vh, 12px);
    line-height: 1.35;
    color: var(--text-inverse);
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
  
  .click-hint {
    padding: clamp(8px, 2vh, 12px) clamp(16px, 5vw, 24px);
    font-size: clamp(0.85rem, 2.2vh, 1rem);
    min-height: clamp(36px, 6vh, 44px);
    border: 2px solid var(--brand-primary);
    background: var(--accent-sage);
    color: var(--primary-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(4px, 1vw, 8px);
    box-shadow: 0 2px 8px rgba(45, 57, 49, 0.2);
  }
  
  .click-hint:hover {
    background: var(--neutral-white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 57, 49, 0.3);
  }
  
  .click-hint i {
    font-size: clamp(0.75rem, 2vh, 0.9rem);
    animation: pulse 2s ease-in-out infinite;
  }
  
  @keyframes pulse {
    0%, 100% { 
      transform: scale(1);
      opacity: 1; 
    }
    50% { 
      transform: scale(1.1);
      opacity: 0.8; 
    }
  }
}

/* Mobile Portrait très petit (max 320px) - Ultra Compact */
@media (max-width: 320px) {
  /* Content switching for mobile */
  .mobile-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
  }
  
  .desktop-text {
    display: none;
  }
  
  .desktop-only {
    display: none;
  }
  
  body.index-page {
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    padding: 0.4rem;
    overflow: hidden;
    display: grid;
    /* grid-template-rows: clamp(30px, 5vh, 40px) 1fr clamp(35px, 6vh, 45px); */
    grid-template-areas: 
      "logo"
      "cards"
      "instructions";
  }
  
  .logo-section {
    grid-area: logo;
    margin: 0;
    padding: clamp(4px, 1vh, 6px) clamp(6px, 2vw, 8px) clamp(1px, 0.3vh, 2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
  }
  
  .logo-main img {
    max-height: clamp(16px, 2.5vh, 22px);
    transition: all 0.3s ease;
  }
  
  .logo-underline {
    width: clamp(24px, 8vw, 36px);
    height: 1px;
    margin-top: clamp(1px, 0.3vh, 2px);
    transition: all 0.3s ease;
  }
  
  .cards-grid {
    grid-area: cards;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: clamp(2px, 0.5vh, 4px);
    padding: clamp(1px, 0.3vw, 2px);
    height: 100%;
    justify-content: center;
    align-items: stretch;
    place-items: stretch;
  }
  
  .auto-flip-card {
    width: 100%;
    height: 100%;
    min-height: clamp(50px, 8vh, 70px);
    max-width: none;
    flex-shrink: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }
  
  .auto-flip-card:hover {
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .card-front,
  .card-back {
    padding: clamp(3px, 1vh, 6px) clamp(4px, 1.5vw, 8px);
    grid-template-rows: 1fr;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 0;
    transition: all 0.3s ease;
  }
  
  .card-front {
    background: var(--primary-charcoal);
    border: 1px solid rgba(198, 222, 205, 0.3);
  }
  
  .card-back {
    background: var(--accent-sage);
    border: 1px solid var(--primary-green);
  }
  
  .competency-icon {
    display: none;
  }
  
  .competency-info h3 {
    font-size: clamp(0.5rem, 1.4vh, 0.65rem);
    margin-bottom: clamp(1px, 0.3vh, 2px);
    line-height: 1.05;
    text-align: center;
    font-weight: 600;
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
  }
  
  .competency-info p {
    font-size: clamp(0.35rem, 0.9vh, 0.5rem);
    line-height: 1.05;
    text-align: center;
    color: var(--text-inverse);
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
  }
  
  .card-back-content {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    text-align: center;
    justify-content: center;
    align-items: center;
  }
  
  .card-back-content h4 {
    font-size: clamp(0.45rem, 1.2vh, 0.6rem);
    margin-bottom: clamp(1px, 0.3vh, 2px);
    color: var(--primary-dark);
    font-weight: 600;
    line-height: 1.05;
  }
  
  .card-back-content h4 .mobile-text {
    font-size: clamp(0.8rem, 2vh, 0.95rem);
    font-weight: 700;
  }
  
  .card-back-content ul {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: clamp(0.5px, 0.2vh, 1px);
  }
  
  .card-back-content ul li {
    font-size: clamp(0.3rem, 0.8vh, 0.45rem);
    line-height: 1;
    padding: 0;
    text-align: center;
    position: relative;
    color: var(--primary-dark);
    opacity: 0.95;
    font-weight: 500;
    margin-bottom: 0;
  }
  
  .card-back-content li:before {
    display: none;
  }
  
  .back-icon {
    display: none;
  }
  
  .instructions {
    grid-area: instructions;
    margin: 0;
    padding: clamp(3px, 0.8vh, 5px) clamp(6px, 1.5vw, 10px) clamp(4px, 1vh, 6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
  }
  
  .instructions p {
    font-size: clamp(0.8rem, 2.2vh, 0.95rem);
    text-align: center;
    margin-bottom: clamp(6px, 1.5vh, 8px);
    line-height: 1.3;
    color: var(--text-inverse);
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
  
  .click-hint {
    padding: clamp(6px, 1.8vh, 8px) clamp(12px, 4vw, 16px);
    font-size: clamp(0.8rem, 2vh, 0.95rem);
    min-height: clamp(32px, 5vh, 38px);
    border: 2px solid var(--brand-primary);
    background: var(--accent-sage);
    color: var(--primary-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(3px, 0.8vw, 6px);
    box-shadow: 0 1px 4px rgba(45, 57, 49, 0.2);
  }
  
  .click-hint:hover {
    background: var(--neutral-white);
    transform: translateY(-0.5px);
    box-shadow: 0 2px 8px rgba(45, 57, 49, 0.3);
  }
  
  .click-hint i {
    font-size: clamp(0.65rem, 1.6vh, 0.8rem);
    animation: pulse 2s ease-in-out infinite;
  }
  
  @keyframes pulse {
    0%, 100% { 
      transform: scale(1);
      opacity: 1; 
    }
    50% { 
      transform: scale(1.05);
      opacity: 0.8; 
    }
  }
}

/* =========================== */
/*   TOUCH & ACCESSIBILITY     */
/* =========================== */

/* Amélioration de l'accessibilité tactile */
@media (max-width: 480px) {
  /* Zones tactiles plus grandes */
  .auto-flip-card {
    position: relative;
    cursor: pointer;
  }
  
  .auto-flip-card::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    z-index: -1;
    border-radius: 0;
  }
  
  /* Animation améliorée pour le feedback tactile */
  .auto-flip-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .click-hint:active {
    transform: translateY(0px) scale(0.98);
    transition: transform 0.1s ease;
  }
  
  /* Indicateur visuel pour les cartes interactives */
  .auto-flip-card .card-front::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--accent-sage);
    opacity: 0.6;
    border-radius: 0;
    animation: breathe 2s ease-in-out infinite;
  }
  
  @keyframes breathe {
    0%, 100% { 
      opacity: 0.6;
      transform: scale(1);
    }
    50% { 
      opacity: 0.3;
      transform: scale(0.8);
    }
  }
}

/* iPhone spécifique - Dimensions réelles */
@media (max-width: 414px) and (max-height: 896px) {
  /* iPhone 6/7/8 Plus, iPhone XR, iPhone 11 */
  body.index-page {
    padding: 0.5rem;
    /* grid-template-rows: 35px 1fr 40px; */
  }
  
  .cards-grid {
    gap: 2px;
    padding: 1px;
  }
  
  .auto-flip-card {
    min-height: 55px;
  }
  
  .instructions {
    padding: 2px 8px 4px;
  }
}

@media (max-width: 375px) and (max-height: 812px) {
  /* iPhone X/XS/11 Pro */
  body.index-page {
    padding: 0.4rem;
    /* grid-template-rows: 30px 1fr 40px; */
  }
  
  .cards-grid {
    gap: 1px;
    padding: 0px;
  }
  
  .auto-flip-card {
    min-height: 50px;
  }
  
  .instructions {
    padding: 3px 8px 4px;
  }
  
  .instructions p {
    font-size: 0.8rem;
    margin-bottom: 4px;
    line-height: 1.2;
  }
  
  .click-hint {
    padding: 6px 12px;
    font-size: 0.8rem;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 320px) and (max-height: 568px) {
  /* iPhone SE/5s */
  body.index-page {
    padding: 0.3rem;
    /* grid-template-rows: 25px 1fr 35px; */
  }
  
  .cards-grid {
    gap: 1px;
    padding: 0px;
  }
  
  .auto-flip-card {
    min-height: 45px;
  }
  
  .instructions {
    padding: 2px 6px 3px;
  }
  
  .instructions p {
    font-size: 0.75rem;
    margin-bottom: 3px;
    line-height: 1.15;
  }
  
  .click-hint {
    padding: 5px 10px;
    font-size: 0.75rem;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
  }
}

/* Optimisation pour écrans à haute densité */
@media (max-width: 480px) and (-webkit-min-device-pixel-ratio: 2) {
  .logo-main img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  .card-front,
  .card-back {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}