/* =========================================================
   CodeLo — responsive layer. Load after style.css and
   adminPanel.css. Desktop is untouched above 1320px.
   ========================================================= */

/* -- Fluid sections ------------------------------------- */
@media (max-width: 1320px) {
  section {
    box-sizing: border-box;
    width: 100%;
    max-width: 1265px;
    padding-inline: 24px;
  }
}

/* -- Guide: notes reflow from side callouts to inline ---- */
@media (max-width: 1150px) {
  .admin-ui {
    width: 100%;
    align-items: center;
  }
  .admin-ui .ap-row {
    flex-direction: column;
  }
  .admin-ui .ap-note,
  .admin-ui .ap-w-full > .ap-note {
    position: static;
    transform: none;
    width: 100%;
    flex-direction: row;
    margin-top: 4px;
    pointer-events: auto;
  }
  .admin-ui .ap-note-line {
    display: none;
  }
  .admin-ui .ap-note p {
    text-align: left;
    padding: 8px 10px;
    border-left: 3px solid var(--ap-accent);
    -webkit-user-select: text;
    user-select: text;
  }
}

/* -- Tablet --------------------------------------------- */
@media (max-width: 1024px) {
  .hide-phone {
    display: none !important;
  }
  .show-phone {
    display: flex !important;
  }
  section {
    padding-block: 100px;
  }
  hr {
    width: 90%;
  }

  /* Hero */
  #hero {
    padding-top: 100px;
    padding-bottom: 110px;
  }
  #hero-container {
    flex-direction: column;
    gap: 3rem;
  }
  #hero-left {
    text-align: center;
  }
  #hero-left,
  #hero-right {
    align-items: center;
    justify-content: center;
    width: 100%;
  }
  #hero-links {
    justify-content: center;
  }
  #hero-badges {
    align-items: stretch;
  }
  .hero-badge {
    width: auto;
    text-align: left;
  }
  #hero-phrase,
  #editor-showcase h1,
  #seb-explanation h1,
  #how-it-works h1,
  #supported-languages h1 {
    text-align: center;
    font-size: 2.6rem;
  }

  /* Editor showcase */
  #editor-container,
  #editor-badges {
    width: 100%;
  }
  #editor-container {
    height: 430px;
  }

  /* SEB section */
  #seb-file-generation {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  #seb-explanation p {
    width: 100%;
  }
  #seb-features {
    justify-content: stretch;
  }
  .seb-feature {
    font-size: 1.2rem;
    height: auto;
    i {
      font-size: 2rem;
    }
  }

  /* Steps */
  #instructions {
    gap: 1.5rem;
  }
  .instruction {
    padding: 24px;
  }

  /* Languages */
  #supported-languages h1,
  #supported-languages-container {
    width: 100%;
  }

  /* Guide */
  #admin-panel {
    margin-top: 25px;
    padding-top: 60px;
  }
  .admin-ui {
    gap: 2.5rem;
  }
}

/* -- Phone ---------------------------------------------- */
@media (max-width: 768px) {
  section {
    padding: 70px 18px;
  }
  .button-link {
    padding: 9px 11px;
    font-size: 0.95rem;
  }

  /* Hero */
  #hero {
    padding-bottom: 80px;
  }
  #hero-phrase,
  #editor-showcase h1,
  #seb-explanation h1,
  #how-it-works h1,
  #supported-languages h1 {
    font-size: 2.1rem;
  }
  /* line breaks are tuned for a wide screen — let text flow */
  #hero-phrase br,
  #hero-sub-phrase br,
  #seb-explanation h1 br {
    display: none;
  }

  /* Editor showcase */
  #editor-container {
    height: 380px;
  }
  .editor {
    font-size: 0.72rem;
  }
  #editor-code {
    padding-left: 12px;
  }
  #editor-badges {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }
  .editor-badge {
    font-size: 0.9rem;
    i {
      font-size: 1.2rem;
    }
  }

  /* SEB section */
  .seb-feature {
    font-size: 1rem;
    padding: 10px;
    i {
      font-size: 1.7rem;
    }
  }

  /* Steps */
  #instructions {
    grid-template-columns: 1fr;
  }
  .instruction h1 {
    font-size: 2.6rem;
  }

  /* Languages */
  #supported-languages-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }
  #supported-languages-container div:empty {
    display: none;
  }
  .language-icon {
    font-size: 3rem;
  }
  .language-status {
    font-size: 1.8rem;
  }

  /* About */
  #about p {
    font-size: 1.05rem;
  }

  /* Guide */
  #admin-panel {
    padding-top: 45px;
    align-items: stretch;
  }
  .admin-ui {
    gap: 2rem;
  }
  .admin-ui .ap-panel {
    max-width: none;
    padding: 12px;
  }
  .admin-ui .ap-fields {
    gap: 11px;
  }
  .admin-ui .ap-fields h1 {
    font-size: 11px;
    line-height: 1.5;
  }
  .admin-ui .ap-start,
  .admin-ui .ap-end {
    font-size: 16px;
    padding: 18px;
  }
  .admin-ui .ap-list-header,
  .admin-ui .ap-list-row {
    padding: 6px 8px;
  }
  .admin-ui .ap-list-header,
  .admin-ui .ap-folder,
  .admin-ui .ap-btn-file,
  .admin-ui .ap-note p {
    font-size: 11px;
  }
  .admin-ui .ap-list-row {
    font-size: 12px;
  }

  /* Download page */
  #download-menu {
    text-align: center;
  }
  #download-menu h1 {
    font-size: 2.2rem;
  }
  #download-options {
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 1rem;
  }
  .download-option {
    box-sizing: border-box;
    width: 100%;
    max-width: 320px;
    height: auto;
    padding: 20px;
    header {
      i {
        font-size: 2.2rem;
      }
      p {
        font-size: 1.2rem;
      }
    }
    div .button-link {
      font-size: 1.1rem;
    }
  }

  /* Support page */
  #support > h1 {
    font-size: 2.4rem;
  }
  #support-options {
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Footer — logo above centered text links */
  footer {
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
    gap: 1rem;
  }
  #footer-info {
    padding: 24px 18px;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.9rem;
  }
  #footer-info > h1 {
    font-size: 1.6rem;
  }
  /* margin-left:auto pushes to the right once the row becomes a column */
  #footer-links {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1.15rem;
  }
  footer hr {
    width: 100%;
  }
}

/* -- Narrow phones -------------------------------------- */
@media (max-width: 480px) {
  .button-link {
    padding: 8px 10px;
    font-size: 0.85rem;
  }
  #hero-phrase,
  #editor-showcase h1,
  #seb-explanation h1,
  #how-it-works h1,
  #supported-languages h1 {
    font-size: 1.8rem;
  }

  /* Editor showcase */
  #editor-container {
    height: 320px;
  }
  .editor {
    font-size: 0.62rem;
  }
  #editor-badges {
    grid-template-columns: 1fr;
  }

  /* SEB section */
  .seb-feature {
    font-size: 0.9rem;
    i {
      font-size: 1.5rem;
    }
  }

  /* Languages */
  #supported-languages-container {
    grid-template-columns: 1fr;
  }
  .language-icon {
    font-size: 2.6rem;
  }

  /* About */
  #about p {
    font-size: 1rem;
  }

  /* Guide */
  .admin-ui .ap-panel {
    padding: 10px;
  }
  .admin-ui .ap-fields h1 {
    font-size: 10px;
    letter-spacing: 0.04em;
  }
  .admin-ui .ap-start,
  .admin-ui .ap-end {
    font-size: 14px;
  }
  .admin-ui .ap-list-header,
  .admin-ui .ap-list-row {
    grid-template-columns: 42% 33% 25%;
    padding: 5px 7px;
  }
  .admin-ui .ap-list-header,
  .admin-ui .ap-field p {
    font-size: 10px;
  }
  .admin-ui .ap-list-row {
    font-size: 11px;
  }

  /* Footer */
  #footer-info {
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  #footer-info > h1 {
    font-size: 1.45rem;
  }
  #footer-links {
    font-size: 0.9rem;
    gap: 0.5rem 0.9rem;
  }
}
