/* ==========================================================================
   home-languages.css — home "اللغات" section: category tabs, live search,
   language grid (column count from data-cols), show more / less.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Section frame
   -------------------------------------------------------------------------- */
.hlangs {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--color-white);
}

.hlangs__pad {
  padding: 80px 0 112px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hlangs__wrap {
  max-width: var(--cw, 1180px);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hlangs__title {
  margin: 0;
  font-family: 'Almarai', 'Cairo', sans-serif;
  font-weight: 800;
  font-size: var(--fs-section-title);
  line-height: 1.2;
  color: var(--color-navy-700);
  text-align: center;
  /* the «اللغات» breadcrumb of the inner pages opens guidance-portal-home.html#langs-title:
     the browser stops 80px above the title, clear of the header bar (47–64px) —
     the section's own top space is too small for that on tablets and phones */
  scroll-margin-top: 80px;
}

/* Panel holding the bar and the grid */
.hlangs__shell {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(180deg, var(--color-cream-200) 0%, var(--color-sky-50) 100%);
  border-radius: 42px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hlangs__ornament {
  position: absolute;
  z-index: -1;
  top: -70px;
  left: -70px;
  width: 300px;
  height: auto;
  opacity: 0.07;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 25%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 25%, transparent 100%);
}

.hlangs__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
}

/* --------------------------------------------------------------------------
   Category tabs (desktop bar inside the panel, phone bar above it)
   -------------------------------------------------------------------------- */
.hlangs__tabs {
  display: flex;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-white);
  box-sizing: border-box;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.hlangs__tabs--m {
  display: none;
  width: 100%;
  max-width: 560px;
  margin: -10px auto 0;
}

.hlangs__tab {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  height: 42px;
  padding: 0 20px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-navy-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  flex: none;
  transition: background .2s ease, color .2s ease;
}

.hlangs__tab:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

.hlangs__tab[aria-selected="false"]:hover {
  background: var(--color-blue-100);
  color: var(--color-blue-500);
}

.hlangs__tab[aria-selected="true"] {
  background: var(--color-blue-500);
  border-color: var(--color-blue-500);
  color: var(--color-white);
}

/* --------------------------------------------------------------------------
   Search box
   -------------------------------------------------------------------------- */
.hlangs__search {
  width: min(100%, 300px);
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 16px;
  box-sizing: border-box;
  background: var(--color-white);
  border: 1px solid var(--color-line);
  border-radius: 999px;
}

.hlangs__search > svg {
  display: inline-block;
  flex: none;
  vertical-align: middle;
  fill: none;
  stroke: var(--color-blue-500);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hlangs__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  color: var(--color-navy-700);
}

/* the custom × button replaces the browser's own clear icon */
.hlangs__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.hlangs__clear {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--color-blue-50);
  color: var(--color-navy-700);
  font-family: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.hlangs__clear:hover {
  background: var(--color-ink-800);
  color: var(--color-white);
}

/* --------------------------------------------------------------------------
   Language grid
   -------------------------------------------------------------------------- */
.hlangs__inner {
  border-radius: 38px;
  background: var(--color-white);
  box-shadow: 0 6px 20px -14px rgba(26, 43, 69, 0.12);
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hlangs__list {
  display: contents;
}

.hlangs__row {
  display: grid;
  grid-template-columns: repeat(var(--hlangs-cols, 5), minmax(0, 1fr));
  gap: 12px;
}

/* column count chosen by home-languages.js for the viewport width */
.hlangs__list[data-cols="2"] { --hlangs-cols: 2; }
.hlangs__list[data-cols="3"] { --hlangs-cols: 3; }
.hlangs__list[data-cols="4"] { --hlangs-cols: 4; }
.hlangs__list[data-cols="5"] { --hlangs-cols: 5; }
.hlangs__list[data-cols="6"] { --hlangs-cols: 6; }
.hlangs__list[data-cols="7"] { --hlangs-cols: 7; }

/* The newest batch of rows fades in, one row after the other */
.hlangs__row.is-new {
  animation: hlangs-row-in .5s ease both;
}

.hlangs__row.is-new[data-stagger="1"] {
  animation-delay: .12s;
}

@keyframes hlangs-row-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hlangs__row.is-new {
    animation: none;
  }
}

/* One language pill */
.hlangs__item {
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  background: var(--color-mist-50);
  border: 1px solid var(--color-mist-200);
  color: var(--color-navy-700);
  text-decoration: none;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.hlangs__code {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--color-line-soft);
  color: var(--color-blue-600) /* 5:1 on the badge */;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  transition: background .2s ease, color .2s ease;
}

.hlangs__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.hlangs__name {
  font-family: 'Almarai', 'Cairo', sans-serif;
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hlangs__sub {
  font-size: 13px;
  color: var(--color-ink-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .2s ease;
}

.hlangs__arr {
  display: inline-block;
  flex: none;
  fill: none;
  stroke: var(--color-blue-500);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .2s ease;
}

/* check mark for the current language, arrow for the others */
.hlangs__item.is-current .hlangs__arr--go,
.hlangs__item:not(.is-current) .hlangs__arr--cur {
  display: none;
}

/* Hover + current language */
.hlangs__item:hover,
.hlangs__item.is-current {
  background: var(--color-blue-500);
  border-color: var(--color-blue-500);
  color: var(--color-white);
}

.hlangs__item:hover .hlangs__code,
.hlangs__item.is-current .hlangs__code {
  background: var(--color-cream-200);
  color: var(--color-navy-700);
}

.hlangs__item:hover .hlangs__sub,
.hlangs__item.is-current .hlangs__sub {
  color: rgba(255, 255, 255, .8);
}

.hlangs__item:hover .hlangs__arr,
.hlangs__item.is-current .hlangs__arr {
  stroke: var(--color-white);
}

/* Empty search result */
.hlangs__empty {
  margin: 0;
  padding: 18px 0;
  text-align: center;
  font-size: 15px;
  color: var(--color-ink-500);
}

.hlangs__empty a {
  color: var(--color-blue-500);
  font-weight: 700;
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Show more / show less
   -------------------------------------------------------------------------- */
.hlangs__more-row {
  display: flex;
  justify-content: center;
  padding: 8px 0 2px;
}

.hlangs__more {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  height: 44px;
  box-sizing: border-box;
  padding: 0 16px 0 18px;
  border-radius: 999px;
  /* outline button, same family as the other "more" buttons of the page */
  border: 1.5px solid var(--color-blue-500);
  background: transparent;
  color: var(--color-blue-500);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.hlangs__more:hover {
  background: var(--color-blue-500);
  color: var(--color-white);
}

.hlangs__more:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(59, 117, 150, .25);
}

.hlangs__more svg {
  display: inline-block;
  flex: none;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hlangs__more[aria-expanded="false"] .hlangs__chev--up,
.hlangs__more[aria-expanded="true"] .hlangs__chev--down {
  display: none;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .hlangs__pad {
    padding-top: 60px;
    padding-bottom: 88px;
  }
}

/* Bar stacks: tabs and search take the full width */
@media (max-width: 859px) {
  .hlangs__tabs--d,
  .hlangs__search {
    width: 100%;
  }

  .hlangs__tab {
    flex: 1 1 0;
  }
}

/* Phones: the tab bar moves above the panel */
@media (max-width: 760px) {
  .hlangs__tabs--d {
    display: none;
  }

  .hlangs__tabs--m {
    display: flex;
    max-width: none;
    gap: 4px;
  }

  .hlangs__tabs--m .hlangs__tab {
    flex: 1 1 0;
    height: 44px;
    font-size: 15px;
    font-weight: 800;
    padding: 0 24px;
  }
}

/* Two columns: compact pills without the arrow */
@media (max-width: 719px) {
  .hlangs__item {
    padding: 7px 7px 7px 12px;
  }

  .hlangs__code {
    width: 38px;
    height: 38px;
  }

  .hlangs__name {
    font-size: 15px;
  }

  .hlangs__arr {
    display: none;
  }
}

@media (max-width: 640px) {
  .hlangs__pad {
    padding-top: 48px;
    padding-bottom: 72px;
  }
}

@media (max-width: 560px) {
  .hlangs__shell {
    padding: 10px;
    margin: 0 -8px;
  }

  .hlangs__inner {
    padding: 10px;
  }

  .hlangs__tabs--m .hlangs__tab {
    font-size: 13px;
    padding: 0 10px;
  }
}

@media (max-width: 400px) {
  .hlangs__wrap {
    padding: 0 10px;
  }

  .hlangs__shell {
    margin: 0;
    padding: 8px;
  }

  .hlangs__tabs--m {
    gap: 6px;
  }

  .hlangs__tabs--m .hlangs__tab {
    flex: 1 1 auto;
    padding: 0 8px;
  }
}

@media (max-width: 399px) {
  .hlangs__item {
    gap: 8px;
    padding: 6px 6px 6px 10px;
  }

  .hlangs__code {
    width: 34px;
    height: 34px;
  }

  .hlangs__name {
    font-size: 14px;
  }
}
