/* ==========================================================================
   Features page (features.html, i18n/ar/features.html)

   Loaded after site.css. Page top on a dotted background with "Jump to"
   pills, then the feature sections grouped Build / Backtest / Analyse /
   Deploy. From 992px a section list sits beside them: it scrolls with the
   page until it reaches the header, then sticks; toc.js highlights the
   section being read.
   Phones: each section stacks kick, title, screenshot, then the text.
   ========================================================================== */

/* ---------- Page top ---------- */

.ft-top {
  border-bottom: 1px solid var(--line);
  background-color: var(--bg-alt);
  background-image: radial-gradient(rgba(var(--gold-rgb), 0.13) 1px, transparent 1px);
  background-size: 18px 18px;
}

.ft-top__inner {
  padding-top: 28px;
  padding-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ft-top__title {
  max-width: 860px;
  font-size: 30px;
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.ft-top__lead {
  max-width: 720px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-5);
}

/* Jump pills: one row that scrolls sideways on phones. */
.ft-jumps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline: calc(var(--pad) * -1);
  padding-inline: var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
}

.ft-jumps::-webkit-scrollbar {
  display: none;
}

.ft-jumps__label,
.ft-jump__n {
  display: none;
}

.ft-jump {
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(var(--gold-rgb), 0.3);
  border-radius: 18px;
  background: rgba(10, 9, 6, 0.6);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.ft-jump:hover {
  border-color: rgba(var(--gold-rgb), 0.6);
  color: var(--text);
}

@media (min-width: 768px) {
  .ft-top__inner {
    padding-top: 44px;
    padding-bottom: 30px;
  }

  .ft-top__title {
    font-size: 40px;
    line-height: 1.1;
  }

  .ft-top__lead {
    font-size: 17px;
  }

  .ft-jumps {
    margin: 12px 0 0;
    padding: 0;
    overflow: visible;
    flex-wrap: wrap;
  }

  .ft-jumps__label {
    display: inline;
    margin-inline-end: 6px;
    font-size: 12px;
    color: var(--text-6);
  }

  .ft-jump__n {
    display: inline;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-6);
  }
}

@media (min-width: 992px) {
  .ft-top__inner {
    padding-top: 52px;
  }

  .ft-top__title {
    font-size: 48px;
    line-height: 1.08;
    letter-spacing: -0.025em;
  }
}

/* ---------- Layout: section list + features ---------- */

.ft {
  padding-top: 8px;
  padding-bottom: 40px;
}

.ft__toc {
  display: none;
}

.ft__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

@media (min-width: 992px) {
  .ft {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
    padding-top: 48px;
    padding-bottom: 80px;
  }

  .ft__toc {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 24px);
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
    scrollbar-width: none;
  }
}

@media (min-width: 1200px) {
  .ft {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 56px;
  }
}

/* ---------- Section list (toc.js) ---------- */

.toc__panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toc__title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-6);
}

.toc__list {
  display: flex;
  flex-direction: column;
  border-inline-start: 1px solid rgba(var(--gold-rgb), 0.16);
}

.toc__group {
  display: block;
  padding: 14px 0 4px;
  padding-inline-start: 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-6);
}

.toc__list a {
  display: block;
  margin-inline-start: -1px;
  padding: 6px 0;
  padding-inline-start: 14px;
  border-inline-start: 2px solid transparent;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-5);
  transition: color 0.2s ease;
}

.toc__list a:hover {
  color: var(--text);
}

.toc__list a.is-active {
  border-inline-start-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

/* ---------- Group dividers (jump targets) ---------- */

.ft-kick {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.ft-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 28px 0 8px;
}

.ft-group__tagline {
  font-size: 14px;
  color: var(--text-6);
}

.ft-group__rule {
  display: none;
}

@media (min-width: 768px) {
  .ft-kick {
    font-size: 12px;
  }

  .ft-group {
    flex-direction: row;
    align-items: baseline;
    gap: 16px;
    padding-top: 24px;
  }

  .ft-group__rule {
    display: block;
    flex-grow: 1;
    min-width: 24px;
    height: 1px;
    background: linear-gradient(90deg, rgba(var(--gold-rgb), 0.35), transparent);
  }

  /* RTL: the rule fades out towards its far (left) end. */
  [dir="rtl"] .ft-group__rule {
    background: linear-gradient(270deg, rgba(var(--gold-rgb), 0.35), transparent);
  }
}

@media (min-width: 992px) {
  .ft-group:first-child {
    padding-top: 0;
  }
}

/* ---------- Feature sections ---------- */

/* Phones and tablets: one column; the text wrapper dissolves so the
   screenshot can sit between the title and the paragraphs. */
.ft-feature {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px 0;
  border-top: 1px solid rgba(var(--gold-rgb), 0.1);
}

.ft-feature__text {
  display: contents;
}

.ft-feature__text > * {
  order: 4;
}

.ft-feature__text > .ft-kick {
  order: 1;
}

.ft-feature__text > .ft-feature__title {
  order: 2;
}

.ft-feature__media {
  order: 3;
  display: flex;
  justify-content: center;
}

.ft-feature__title {
  font-size: 24px;
  line-height: 1.22;
  font-weight: 600;
}

.ft-feature__lead {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-2);
}

.ft-feature__body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-5);
}

.ft-feature__link {
  align-self: flex-start;
  font-size: 14px;
  font-weight: 600;
}

.ft-feature__link:hover {
  color: var(--gold-hi);
}

.ft-phone {
  display: block;
  width: 250px;
  max-width: 100%;
  height: auto;
}

.ft-wide {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: var(--surface-hi);
}

.ft-ticks {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px 24px;
}

.ft-ticks li {
  position: relative;
  padding-inline-start: 24px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-3);
}

.ft-ticks li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(var(--gold-rgb), 0.6);
  background: radial-gradient(circle, var(--gold) 0 2.5px, transparent 3px);
}

@media (min-width: 600px) {
  .ft-ticks {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 768px) {
  .ft-feature__title {
    font-size: 28px;
  }

  .ft-wide {
    max-width: 560px;
    margin-inline: auto;
  }
}

/* Desktop: text beside the screenshot, alternating sides. */
@media (min-width: 992px) {
  .ft-feature {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    grid-template-areas: "text media";
    gap: 32px;
    align-items: center;
    padding: 40px 0;
  }

  .ft-feature--flip {
    grid-template-columns: 240px minmax(0, 1fr);
    grid-template-areas: "media text";
  }

  .ft-feature--wide {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .ft-feature--wide.ft-feature--flip {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .ft-feature__text {
    grid-area: text;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .ft-feature__media {
    grid-area: media;
  }

  .ft-feature__title {
    font-size: 30px;
    line-height: 1.2;
    letter-spacing: -0.015em;
  }

  .ft-feature__lead {
    font-size: 17px;
  }

  .ft-feature__body {
    line-height: 1.75;
  }

  .ft-ticks {
    margin-top: 6px;
    grid-template-columns: 1fr;
  }

  .ft-phone {
    width: 220px;
  }

  .ft-wide {
    max-width: none;
  }
}

@media (min-width: 1200px) {
  .ft-feature {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 48px;
  }

  .ft-feature--flip {
    grid-template-columns: 340px minmax(0, 1fr);
  }

  .ft-feature--wide {
    grid-template-columns: minmax(0, 1fr) 460px;
  }

  .ft-feature--wide.ft-feature--flip {
    grid-template-columns: 460px minmax(0, 1fr);
  }

  .ft-ticks {
    grid-template-columns: 1fr 1fr;
  }

  .ft-phone {
    width: 300px;
  }
}

/* ---------- Arabic ---------- */

/* IBM Plex Mono has no Arabic letters; labels use the Arabic sans. */
:lang(ar) .ft-kick,
:lang(ar) .toc__group,
:lang(ar) .toc__title {
  font-family: var(--sans);
}

/* Arabic has no capitals to carry the small labels; set them larger. */
:lang(ar) .ft-kick {
  font-size: 13px;
  font-weight: 500;
}

:lang(ar) .toc__group,
:lang(ar) .toc__title {
  font-size: 12px;
}

:lang(ar) .toc__list a {
  font-size: 14px;
}

:lang(ar) .ft-jump__n {
  font-family: var(--mono);
}
