/* ============================================================
   MOBILE / RESPONSIVE OVERRIDES FOR 2PIC
   Place this file next to styles.css and load it AFTER.
   ============================================================ */


/* ------------------------------------------------------------
   1. TABLETS & SMALL LAPTOPS  (viewport ≤ 1300px)
   ------------------------------------------------------------ */
@media (max-width: 1300px) {

  /* Stop vertical centering and fixed background issues */
  body {
    align-items: flex-start;
    background-attachment: scroll;
    background-size: cover;
  }

  /* Make main container behave like a normal page block */
    .container {
        position: static;      /* on supprime le mode absolute du desktop */
        transform: none;

        width: auto;           /* largeur naturelle, jamais figée */
        max-width: 1200px;     /* limite propre pour grands écrans */
        margin: 20px auto;     /* centré automatiquement */
        padding: 20px;         /* confort visuel */

        max-height: none;      /* laisse respirer sur mobile/tablette */
    }
  
  /* Make Math / Log buttons span the full screen width like Calculate / Refresh */
  .explanation-container {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }  

  /* Form and results stack vertically instead of side by side */
  .content {
    flex-direction: column;
    gap: 20px;
  }

  .form-container,
  .results-container {
    width: 100%;
  }

  /* Results a bit narrower than the full container on tablets */
  .results-container {
    max-width: 95%;
    margin: 0 auto;
  }

  /* Header layout simplified */
  .header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .logo-right {
    display: none;       /* hide the two right logos on smaller screens */
  }

  h1 {
    margin: 0;
    text-align: center;
    font-size: 24px;
  }

  /* Charts: allow wrapping and centering */
  .chart-row {
    flex-wrap: wrap;
    justify-content: center;
  }

  #proteinAChartNoLigandContainer,
  #proteinAChartContainer {
    max-width: 260px;
    min-width: 0;
  }

  #complexRemainingChartContainer,
  #complexVsInhibitorChartContainer {
    max-width: 100%;
  }
  /* Make the detailed math explanation fully responsive */
  #detailedExplanation {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  #detailedExplanation p,
  #detailedExplanation li {
    white-space: normal;
    word-break: break-word;  /* long formulas / words wrap instead of overflowing */
  }

  /* Override the inline width=600px on the image */
  #detailedExplanation img {
    max-width: 100% !important;  /* never larger than its container */
    height: auto !important;
    display: block;
    margin-left: auto;
    margin-right: auto;
  }


}


/* ------------------------------------------------------------
   2. PHONES  (viewport ≤ 650px)
   ------------------------------------------------------------ */
@media (max-width: 650px) {

  /* Use the full screen width, no rounded card edges */
  .container {
    width: 100%;
    border-radius: 0;
    padding: 10px;
  }

  /* Header stacked vertically */
  .header {
    flex-direction: column;
    align-items: center;
  }

  .logo-left {
    height: 60px;
  }

  h1 {
    font-size: 20px;
    line-height: 1.2;
  }

  /* Form elements: full width and touch-friendly */
  .form-container input,
  .form-container select {
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;  /* avoids iOS zoom on focus */
  }

  label {
    font-size: 16px;
  }

  button {
    width: 100%;
    font-size: 18px;
  }

  .button-container {
    flex-direction: column;
    gap: 10px;
  }

  /* Charts stacked vertically */
  .chart-row {
    flex-direction: column;
    align-items: center;
  }

  .chart-row canvas {
    max-width: 220px;
  }

  /* Hide the tall vertical complex image on tiny screens */
  .complex {
    display: none !important;
  }

  /* Example image: no horizontal scroll */
  .example-image img {
    width: 100%;
    max-width: 360px;
  }

  /* Stats chart layout on phones */
  #statsWrapper {
    width: 100%;
    height: 320px;
  }

  /* Your preferred narrow results column on phones */
  .results-container {
    max-width: 90%;   /* yes, small on desktop, perfect on phones */
    margin: 0 auto;
  }

  /* Make the long math explanation fit on small screens */
  #detailedExplanation {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  #detailedExplanation p,
  #detailedExplanation li {
    white-space: normal;
    word-break: break-word;   /* break long LaTeX/words if needed */
  }

  /* Override the inline 600px image width in the math section */
  #detailedExplanation img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin-left: auto;
    margin-right: auto;
  }

  .math-line {
    white-space: normal;
    word-break: break-word;
}

}
