
/* ==========================================================
   INFATHON 2026
   Mobile Responsive + Arabic RTL / English LTR
   Load this CSS file LAST.
   ========================================================== */

/* General */
html,
body.student-page {
  max-width: 100%;
  overflow-x: clip;
}

body.student-page,
body.student-page main,
body.student-page section,
body.student-page form {
  box-sizing: border-box;
}

body.student-page .wrap,
body.student-page #listing,
body.student-page #apply {
  max-width: 100%;
  min-width: 0;
}

body.student-page img {
  max-width: 100%;
}

/* ==========================================================
   LANGUAGE DIRECTION
   ========================================================== */

html[lang="en"] body.student-page {
  direction: ltr !important;
  text-align: left;
}

html[lang="ar"] body.student-page {
  direction: rtl !important;
  text-align: right;
}

html[lang="en"] body.student-page :is(
  .v4hero,
  .infathon-intro,
  .section-title,
  .challenge-body,
  .challenge-body h3,
  .challenge-summary,
  .toolbar,
  .panel,
  .field,
  .field label,
  .notice,
  .interest-section,
  .consent-section,
  .consent-item,
  .member-row,
  .event-facts,
  .infathon-download-note,
  .foot
) {
  direction: ltr !important;
  text-align: left !important;
}

html[lang="ar"] body.student-page :is(
  .v4hero,
  .infathon-intro,
  .section-title,
  .challenge-body,
  .challenge-body h3,
  .challenge-summary,
  .toolbar,
  .panel,
  .field,
  .field label,
  .notice,
  .interest-section,
  .consent-section,
  .consent-item,
  .member-row,
  .event-facts,
  .infathon-download-note,
  .foot
) {
  direction: rtl !important;
  text-align: right !important;
}

html[lang="en"] body.student-page :is(
  input,
  textarea,
  select
) {
  direction: ltr !important;
  text-align: left !important;
}

html[lang="ar"] body.student-page :is(
  input,
  textarea,
  select
) {
  direction: rtl !important;
  text-align: right !important;
}

/* Preserve original logo and button styling */
body.student-page .premium-logos,
body.student-page .infathon-hero-brand {
  text-align: center !important;
}

body.student-page .lang-toggle {
  direction: ltr !important;
}

body.student-page #cases .challenge-body button {
  text-align: center !important;
}

/* Five challenges in one vertical list */
html body.student-page
#listing #cases.v4challenges.hack-challenges {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* ==========================================================
   MOBILE ONLY
   ========================================================== */

@media (max-width: 767px) {

  /* Main container */
  html body.student-page .wrap {
    width: 100% !important;
    padding-inline: 14px !important;
    margin-inline: auto !important;
  }

  /* ========================================================
     HEADER: Logos first, language selector below
     ======================================================== */

  html body.student-page .hackathon-logo-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: center !important;

    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    height: auto !important;
    min-height: 0 !important;

    padding: 18px 14px !important;
    gap: 16px !important;

    box-sizing: border-box !important;
  }

  /* Keep both logos on the same row */
  html body.student-page
  .hackathon-logo-header .premium-logos {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;

    justify-content: center !important;
    align-items: center !important;

    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    gap: 12px !important;
    margin: 0 !important;
  }

  html body.student-page
  .hackathon-logo-header .premium-partner {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: 45% !important;
  }

  html body.student-page
  .hackathon-logo-header .premium-partner img {
    display: block !important;

    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 75px !important;

    object-fit: contain !important;
    margin-inline: auto !important;
  }

  /* Language selector in a separate row */
  html body.student-page
  .hackathon-logo-header > .lang-toggle {
    position: static !important;

    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;

    transform: none !important;

    align-self: flex-start !important;

    width: max-content !important;
    max-width: 100% !important;

    margin: 0 !important;
    flex-shrink: 0 !important;

    z-index: 1 !important;
  }

  /* ========================================================
     HERO
     ======================================================== */

  html body.student-page .v4hero {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    padding: 25px 17px !important;

    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  html body.student-page .v4hero :is(h1, h2, p) {
    max-width: 100% !important;
    overflow-wrap: anywhere;
  }

  html body.student-page .v4hero h1 {
    font-size: clamp(25px, 7vw, 38px) !important;
    line-height: 1.45 !important;
  }

  html body.student-page .v4hero p {
    font-size: clamp(13px, 3.8vw, 16px) !important;
    line-height: 1.85 !important;
  }

  html body.student-page .infathon-hero-brand img {
    max-width: min(100%, 300px) !important;
    height: auto !important;
    object-fit: contain !important;
  }

  /* ========================================================
     CHALLENGES
     ======================================================== */

  html body.student-page #listing {
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 26px !important;
  }

  html body.student-page #listing .section-title h2 {
    font-size: clamp(23px, 6.5vw, 31px) !important;
  }

  html body.student-page #cases {
    width: 100% !important;
    min-width: 0 !important;
    gap: 14px !important;
  }

  html body.student-page #cases > .v4challenge {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  html body.student-page #cases .challenge-photo {
    height: clamp(155px, 46vw, 215px) !important;
    overflow: hidden !important;
  }

  html body.student-page #cases .challenge-photo img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  html body.student-page #cases .challenge-body {
    padding: 16px !important;
    min-height: 0 !important;
    gap: 12px !important;
  }

  html body.student-page #cases .challenge-body h3 {
    font-size: 16px !important;
    line-height: 1.6 !important;
  }

  /* ========================================================
     REGISTRATION FORM
     ======================================================== */

  html body.student-page #apply {
    width: 100% !important;
    padding: 18px 14px !important;
  }

  html body.student-page #apply .cols {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
  }

  html body.student-page #apply :is(
    .field,
    input,
    textarea,
    select
  ) {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  html body.student-page #apply :is(
    input,
    textarea,
    select
  ) {
    width: 100% !important;
    font-size: 16px !important;
  }

  /* Do not stretch checkboxes */
  html body.student-page #apply input[type="checkbox"],
  html body.student-page #apply input[type="radio"] {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    flex: 0 0 20px !important;
    margin: 3px 0 0 !important;
  }

  /* Checkbox rows */
  html body.student-page .consent-item,
  html body.student-page .interest-choices label {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    text-align: start !important;
  }

  html body.student-page .consent-item {
    min-width: 0 !important;
  }

  html body.student-page .toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
  }

  html body.student-page :is(
    .event-facts,
    .infathon-download,
    .infathon-download-note,
    .interest-choices
  ) {
    max-width: 100% !important;
    min-width: 0 !important;
    flex-wrap: wrap !important;
  }

  html body.student-page .infathon-download a {
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  /* Footer */
  html body.student-page .foot {
    padding-inline: 14px !important;
  }
}
