// Rôle : contient les adaptations responsive et préférences d'accessibilité.
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .sidebar {
    width: 72px;
    padding: var(--space-4) 10px;
  }

  .brand span:last-child,
  .nav-item strong,
  .sidebar-about-link strong,
  .sidebar-note {
    display: none;
  }

  .brand,
  .nav-item,
  .sidebar-about-link {
    justify-content: center;
  }

  .about-story-section,
  .about-contribute-section {
    grid-template-columns: 1fr;
  }

  .about-section-heading {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    padding-bottom: 76px;
  }

  .sidebar {
    display: none;
  }

  .topbar,
  .page-heading,
  .toolbox-head,
  .module header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: var(--space-4);
  }

  .topbar-actions {
    display: flex;
  }

  .topbar-actions > * {
    width: 100%;
  }

  .hero,
  .game-hero,
  .page-hero,
  .origin-section,
  .about-story-section,
  .about-contribute-section,
  .about-tools-list,
  .section-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .about-tool-item:nth-last-child(-n + 2) {
    border-bottom: 1px solid rgba(165, 180, 252, 0.1);
  }

  .about-tool-item:last-child {
    border-bottom: 0;
  }

  .about-storage-reminders {
    padding-left: 0;
  }

  .hero,
  .game-hero,
  .page-hero {
    min-height: auto;
    padding: var(--space-6);
  }

  .game-hero::after {
    left: 0;
    opacity: 0.42;
    background:
      linear-gradient(90deg, rgba(5, 7, 17, 0.28), rgba(5, 7, 17, 0.72)),
      var(--game-hero-image);
    background-position:
      center,
      right center;
    background-size:
      cover,
      cover;
    mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.14) 30%, #000 70%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.14) 30%, #000 70%);
  }

  .home-visual {
    justify-self: center;
    width: min(320px, 100%);
    min-height: 240px;
  }

  .home-visual img {
    object-fit: contain;
  }

  .origin-section {
    padding: var(--space-5);
  }

  .home-dialogue {
    padding-left: 0;
  }

  .origin-copy {
    padding-right: 0;
    padding-bottom: var(--space-5);
    border-right: 0;
    border-bottom: 2px solid rgba(246, 196, 83, 0.66);
  }

  .dialogue-line {
    max-width: 92%;
  }

  .dialogue-line-app {
    max-width: 92%;
  }

  .home-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  main {
    width: min(100% - 24px, 1180px);
    padding-top: var(--space-5);
  }

  .modules,
  .modules[data-layout-cols="1"],
  .modules[data-layout-cols="2"] {
    grid-template-columns: 1fr;
  }

  .image-viewer-body.has-annotation-side {
    grid-template-columns: 1fr;
  }

  .image-viewer-side {
    height: min(280px, 32vh);
  }

  .module-column {
    display: contents;
  }

  .game-home-grid,
  .game-layout,
  .library-doc-layout {
    grid-template-columns: 1fr;
  }

  .game-filters {
    position: static;
  }

  .library-doc-nav {
    position: static;
    max-height: none;
  }

  .library-example-layout,
  .library-tool-feature-list dl > div {
    grid-template-columns: 1fr;
  }

  .filter-options {
    max-height: none;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .calculator-form {
    grid-template-columns: 1fr;
  }

  .calculator-module,
  .timer-module {
    grid-template-columns: 1fr;
  }

  .task-planner-settings,
  .task-planner-task-settings {
    grid-template-columns: 1fr;
  }

  .task-planner-line {
    grid-template-columns: 30px 24px minmax(0, 1fr) auto;
  }

  .task-planner-type-select,
  .task-planner-warning {
    grid-column: 3 / -1;
  }

  .task-planner-actions {
    grid-column: 4;
    grid-row: 1;
  }

  .task-planner-description-panel,
  .task-planner-task-settings {
    margin-left: 0;
  }

  .calculator-form {
    grid-row: auto;
  }

  .combos-device-row,
  .combos-form-grid,
  .combos-palette {
    grid-template-columns: 1fr;
  }

  .combo-card {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .combo-card-main {
    grid-template-columns: 1fr;
  }

  .combo-card-actions {
    grid-column: 2;
    justify-content: flex-end;
  }

  .toolbox-actions-row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbox-actions-row > div,
  .toolbox-actions-row > div:last-child {
    justify-content: flex-start;
  }

  .toolbox-preferences-row {
    max-width: none;
    justify-self: stretch;
  }

  .tool-add-modal {
    width: min(420px, calc(100vw - 32px));
  }

  .tool-add-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-nav {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 60;
    display: grid;
    grid-template-columns: 1fr 1fr 52px 1fr;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: rgba(11, 14, 27, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
  }

  .mobile-nav a,
  .mobile-nav button {
    min-height: 44px;
    padding: 0 8px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
  }

  .mobile-nav a {
    display: grid;
    place-items: center;
    color: var(--color-text-secondary);
  }

  .mobile-nav a.active {
    background: var(--color-primary-soft);
    color: var(--color-text-primary);
  }

  .drawer-panel {
    min-width: 0;
    width: min(720px, 94vw);
  }

  .drawer-resize-handle {
    display: none;
  }
}

@media (max-width: 480px) {
  .home-stats {
    grid-template-columns: 1fr;
  }

  .tool-add-grid {
    grid-template-columns: 1fr;
  }
}
