/* ============================================================
   MODE CARDS - Home Page
   Design principles:
   - Emil Kowalski: Clear hierarchy, purposeful motion
   - Impeccable: No side-stripe borders, strong contrast, breathing room
   ============================================================ */

/* Screen-reader only utility (for accessible labels) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   HOME LAYOUT ATMOSPHERE
   ============================================================ */

.home-shell {
  background:
    radial-gradient(1200px 500px at 8% -12%, color-mix(in oklch, var(--color-primary-200) 26%, white), transparent 60%),
    radial-gradient(1000px 420px at 96% 112%, color-mix(in oklch, var(--color-success-200) 24%, white), transparent 62%),
    linear-gradient(180deg, var(--color-bg-primary) 0%, color-mix(in oklch, var(--color-bg-primary) 88%, white) 100%);
}

.home-header {
  background: color-mix(in oklch, var(--color-surface) 90%, var(--color-primary-50));
  border-bottom: 1px solid color-mix(in oklch, var(--color-primary-200) 28%, var(--color-border));
}

.home-brand-title {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--color-text-primary);
  margin-bottom: 0;
}

.home-main {
  position: relative;
}

/* Wrap qui aligne le grid en haut sur desktop pour rester proche du hero.
   Le vide restant (bas) reste discret, meilleure lecture que grid étiré. */
.home-mode-wrap {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.home-hero-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Grid : cards prennent leur hauteur naturelle (pas d'étirement forcé).
   Sur mobile, le grid en 1 col reste `auto`. Sur desktop, on centre verticalement
   le grid dans son conteneur pour éviter les cards écrasées ou étirées. */
.home-mode-grid {
  align-items: start;
  align-content: center;
}

@media (min-width: 640px) {
  .home-mode-grid {
    /* Le grid ne prend que sa hauteur naturelle sur desktop */
    height: auto;
    align-self: center;
  }
}

.home-footer {
  background:
    linear-gradient(180deg, color-mix(in oklch, white 92%, var(--color-primary-50)) 0%, white 100%);
  border-top-color: color-mix(in oklch, var(--color-primary-200) 26%, var(--color-border));
}

.home-footer-cta {
  transition:
    transform 180ms var(--ease-out),
    box-shadow 220ms var(--ease-out),
    background-color 180ms var(--ease-out);
}

.home-footer-cta:hover {
  transform: translateY(-1px);
}

.home-footer-cta:active {
  transform: scale(0.98);
}

/* Mobile : padding réduit + font size compact pour éviter la troncature */
@media (max-width: 480px) {
  .home-footer-cta {
    padding: 0.5rem 0.7rem !important;
    font-size: 0.78rem !important;
    gap: 0.3rem !important;
    min-height: 40px !important;
    flex-shrink: 0;
  }
  .home-footer-cta svg {
    width: 0.75rem;
    height: 0.75rem;
  }
  /* Meta infos gauche : compresser sur très petit */
  .home-footer dl {
    gap: 0.75rem !important;
    font-size: 0.7rem;
    flex-wrap: wrap;
  }
}

@media (max-width: 360px) {
  .home-footer-cta span:not(.sr-only) {
    /* Trop étroit : garder juste "Config" */
    font-size: 0.75rem;
  }
}

.mode-card {
  /* Layout - Vertical rhythm avec breathing room */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;

  /* Sizing - Compact mais avec espace pour le texte */
  width: 100%;
  padding: 1.2rem 1.05rem;
  min-height: 182px;

  /* Le reset button { overflow: hidden } de micro-interactions.css
     écrase le contenu quand la card est prise dans un grid trop court
     (cas mobile avec .h-full). On garantit ici la visibilité. */
  overflow: visible;

  /* Visual */
  background:
    linear-gradient(168deg, rgba(255, 255, 255, 0.96) 0%, rgba(250, 252, 255, 0.98) 100%);
  border: 1px solid color-mix(in oklch, var(--color-primary-200) 24%, var(--color-border));
  border-radius: 16px;
  text-align: left;
  cursor: pointer;
  
  /* Typography reset */
  font-family: inherit;
  
  /* Interaction */
  transition: 
    transform 200ms var(--ease-out),
    border-color 200ms var(--ease-out),
    box-shadow 200ms var(--ease-out),
    background-color 200ms var(--ease-out),
    filter 200ms var(--ease-out);
  
  /* Performance */
  will-change: transform;
}

.mode-card:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 16px 28px -22px rgba(15, 23, 42, 0.5),
    0 8px 12px -9px rgba(37, 99, 235, 0.25);
}

.mode-card:active {
  transform: translateY(-2px) scale(0.97);
  transition-duration: 100ms;
}

@media (hover: hover) and (pointer: fine) {
  .mode-card:hover {
    transform: translateY(-3px);
  }
}

.mode-card:focus-visible {
  outline: none;
  box-shadow: 
    0 0 0 2px white,
    0 0 0 4px color-mix(in oklch, var(--color-primary-500) 62%, white),
    0 10px 24px -14px rgba(30, 64, 175, 0.55);
}

/* ============================================================
   ICON WRAPPER - Distinct visual anchor
   ============================================================ */

.mode-card__icon-wrapper {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  
  transition: 
    transform 300ms var(--ease-out),
    background-color 200ms var(--ease-out);
}

.mode-card:hover .mode-card__icon-wrapper {
  transform: translateY(-1px) scale(1.05);
}

.mode-card__icon {
  font-size: 28px;
  line-height: 1;
  filter: saturate(1.1);
}

/* SVG icon - Replaces emoji for professional feel */
.mode-card__icon-svg {
  width: 27px;
  height: 27px;
  stroke-width: 2;
  transition: transform 300ms var(--ease-out), opacity 180ms ease-out;
}

/* ============================================================
   CONTENT - Typography hierarchy
   ============================================================ */

.mode-card__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-height: 0;
}

.mode-card__title {
  /* Strong hierarchy */
  font-size: 1.0625rem;    /* 17px */
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

.mode-card__description {
  /* Body text - readable, high contrast */
  font-size: 0.825rem;    /* 13.2px */
  font-weight: 400;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
  text-wrap: pretty;
}

/* ============================================================
   META INFOS - Progressive disclosure des caractéristiques
   ============================================================ */

.mode-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0;
  padding: 0.625rem 0 0;
  list-style: none;
  border-top: 1px solid var(--color-border-light);
  width: 100%;
}

.mode-card__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  font-size: 0.6875rem;    /* 11px - discret mais lisible */
  font-weight: 500;
  color: var(--color-text-secondary);
  line-height: 1;
  letter-spacing: 0.01em;
}

.mode-card__meta-item svg {
  width: 12px;
  height: 12px;
  stroke-width: 2;
  flex-shrink: 0;
  opacity: 0.75;
}

/* ============================================================
   CTA - Always visible, no hidden-until-hover
   ============================================================ */

.mode-card__cta {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  margin-top: auto;
  padding-top: 0.375rem;
}

.mode-card__arrow {
  width: 16px;
  height: 16px;
  transition: transform 200ms var(--ease-out);
}

.mode-card:hover .mode-card__arrow {
  transform: translateX(4px);
}

.mode-card:nth-child(1) {
  animation: mode-card-enter 260ms var(--ease-out) both;
  animation-delay: 0ms;
}

.mode-card:nth-child(2) {
  animation: mode-card-enter 260ms var(--ease-out) both;
  animation-delay: 40ms;
}

.mode-card:nth-child(3) {
  animation: mode-card-enter 260ms var(--ease-out) both;
  animation-delay: 80ms;
}

@keyframes mode-card-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================================
   VARIANTS - Each mode has its own color identity
   Using background tint (not side-stripe) - Impeccable compliant
   ============================================================ */

/* --- Mode Examen (Blue - Serious, Professional) --- */
.mode-card--exam:hover {
  border-color: var(--color-primary-400);
  background: linear-gradient(to bottom right,
    color-mix(in oklch, var(--color-primary-50) 92%, white) 0%,
    var(--color-surface) 60%);
}

.mode-card--exam .mode-card__icon-wrapper {
  background-color: color-mix(in oklch, var(--color-primary-100) 78%, white);
}

.mode-card--exam .mode-card__icon-svg {
  color: var(--color-primary-700);
}

.mode-card--exam:hover .mode-card__icon-wrapper {
  background-color: color-mix(in oklch, var(--color-primary-200) 82%, white);
}

.mode-card--exam .mode-card__cta {
  color: var(--color-primary-700);
}

.mode-card--exam:focus-visible {
  color: var(--color-primary-500);
}

/* --- Mode Apprentissage (Amber - Warm, Encouraging)
   CTA amber-700 (#b45309) au lieu de amber-600 pour atteindre AA (~5.2:1). --- */
.mode-card--learning:hover {
  border-color: #d97706;
  background: linear-gradient(to bottom right, #fffbeb 0%, var(--color-surface) 60%);
}

.mode-card--learning .mode-card__icon-wrapper {
  background-color: #fef3c7;
}

.mode-card--learning .mode-card__icon-svg {
  color: #b45309;
}

.mode-card--learning:hover .mode-card__icon-wrapper {
  background-color: #fde68a;
}

.mode-card--learning .mode-card__cta {
  color: #b45309;
}

.mode-card--learning:focus-visible {
  color: #b45309;
}

/* --- Mode Revision (Teal - Reflective, Focused)
   CTA teal-800 pour atteindre AA (~5.6:1). --- */
.mode-card--review:hover {
  border-color: #0d9488;
  background: linear-gradient(to bottom right, #f0fdfa 0%, var(--color-surface) 60%);
}

.mode-card--review .mode-card__icon-wrapper {
  background-color: #ccfbf1;
}

.mode-card--review .mode-card__icon-svg {
  color: #115e59;
}

.mode-card--review:hover .mode-card__icon-wrapper {
  background-color: #99f6e4;
}

.mode-card--review .mode-card__cta {
  color: #115e59;
}

.mode-card--review:focus-visible {
  color: #0d9488;
}

/* ============================================================
   RESPONSIVE - Mobile-first refinements
   ============================================================ */

@media (max-width: 640px) {
  /* Sur mobile, le grid est en 1 colonne : ne pas contraindre sa hauteur
     à celle du parent (.h-full de Tailwind), sinon les cards sont écrasées.
     Le parent scrollable prend le relais. */
  .home-mode-grid {
    height: auto;
  }

  .mode-card {
    padding: 0.92rem 0.78rem;
    min-height: auto;
    gap: 0.75rem;
    border-radius: 14px;
  }
  
  .mode-card__icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }
  
  .mode-card__icon {
    font-size: 22px;
  }
  
  .mode-card__icon-svg {
    width: 22px;
    height: 22px;
  }
  
  .mode-card__title {
    font-size: 0.95rem;   /* 15.2px on mobile */
  }
  
  .mode-card__description {
    font-size: 0.765rem;     /* 12.24px on mobile */
  }
  
  .mode-card__meta {
    padding-top: 0.5rem;
    gap: 0.375rem 0.625rem;
  }
  
  .mode-card__meta-item {
    font-size: 0.625rem;    /* 10px on mobile */
  }
  
  .mode-card__cta {
    font-size: 0.75rem;
    padding-top: 0.375rem;
  }
}

/* ============================================================
   ACCESSIBILITY - Reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .mode-card:nth-child(1),
  .mode-card:nth-child(2),
  .mode-card:nth-child(3) {
    animation: none;
  }

  .mode-card,
  .mode-card__icon-wrapper,
  .mode-card__arrow {
    transition: 
      border-color 100ms linear,
      background-color 100ms linear;
    transform: none !important;
  }
  
  .mode-card:hover {
    transform: none;
  }
}
