/* Developers page (developers/), ported from the standalone «المطورون» section
   in the site's colours. The page banner carries the h1. */

.developers {
  display: grid;
  gap: 40px;
}

.dev-hero {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--green-900);
  color: #fff;
}

.dev-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 32px;
  min-height: 400px;
  padding: 40px;
}

.dev-hero__text {
  display: grid;
  justify-items: start;
  gap: 24px;
}

.dev-hero__title {
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 700;
  line-height: 1.6;
}

.dev-hero__btn {
  gap: 8px;
  max-width: 100%;
  background: #fff;
  color: var(--green-900);
}

.dev-hero__btn:hover {
  background: var(--green-100);
}

.dev-hero__btn:active {
  background: var(--green-200);
}

.dev-hero__btn:focus-visible {
  outline-color: #fff;
}

.dev-hero__art {
  position: relative;
  display: flex;
  justify-content: center;
}

/* The illustration was drawn for the old purple theme: shifted to the green scale. */
.dev-hero__img,
.dev-hero__apis {
  filter: hue-rotate(-108deg) saturate(0.9);
}

.dev-hero__img {
  width: min(100%, 380px);
  height: auto;
}

.dev-hero__apis {
  position: absolute;
  bottom: 8%;
  inset-inline-end: 0;
  width: min(45%, 200px);
  height: auto;
  opacity: 0.45;
}

/* ---------- Features ---------- */

/* Hero, list and form card share the page's start edge. */
.dev-features {
  width: 100%;
}

.dev-features__list {
  display: grid;
  gap: 24px;
  margin: 0;
}

.dev-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.dev-feature__icon {
  margin-top: 9px;
}

.dev-feature__title {
  margin: 0 0 4px;
  color: var(--green-700);
  font-size: 20px;
  font-weight: 700;
  line-height: 30px;
}

.dev-feature__text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 26px;
}

/* ---------- Form ---------- */

.dev-card {
  width: 100%;
  max-width: 800px;
  padding: 31px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
}

.dev-card__title {
  margin: 0 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 20px;
  font-weight: 700;
  line-height: 30px;
}

.dev-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.dev-form[hidden] {
  display: none;
}

.dev-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.dev-field--full,
.dev-form__status {
  grid-column: 1 / -1;
}

/* Same field pattern as add/ and contact/. */
.dev-field__label {
  display: flex;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.dev-field__required {
  color: #b42318;
}

.dev-field__input {
  display: block;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-neutral);
  color: var(--text-default);
  font-size: 16px;
  line-height: 24px;
}

.dev-field__input::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.dev-field__input:focus-visible {
  outline: 2px solid var(--text-default);
  outline-offset: 0;
}

.dev-field__input[aria-invalid='true'] {
  box-shadow: inset 0 -2px 0 #b42318;
}

/* Typed left-to-right values still line up with the right-aligned form. */
.dev-field__input[dir='ltr']:placeholder-shown {
  text-align: right;
}

select.dev-field__input {
  padding-inline-end: 40px;
  background: var(--bg-neutral) url('../img/contact/i-arrow-down-01.svg') left 20.4px center /
    11.25px 6.25px no-repeat;
  appearance: none;
  cursor: pointer;
}

select.dev-field__input:has(option[value='']:checked) {
  color: var(--text-secondary);
}

select.dev-field__input option {
  color: var(--text-default);
}

textarea.dev-field__input {
  height: 120px;
  min-height: 96px;
  padding: 12px 16px;
  background: var(--bg-neutral) url('../img/contact/resize-handler.svg') left 2px bottom 2px / 12px
    12px no-repeat;
  resize: vertical;
}

textarea.dev-field__input::-webkit-resizer {
  background: transparent;
}

.dev-field__hint {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 20px;
}

.dev-field__error,
.dev-form__status {
  margin: 0;
  color: #b42318;
  font-size: 14px;
  line-height: 20px;
}

.dev-form__status {
  padding: 12px 16px;
  border: 1px solid #fecdca;
  border-radius: var(--radius-md);
  background: #fef3f2;
}

.dev-form__status[hidden],
.dev-field__error[hidden] {
  display: none;
}

.dev-terms {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}

.dev-terms__check {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--green-600);
}

.dev-terms__link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--green-600);
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
}

.dev-form__actions {
  align-items: flex-start;
  margin-top: 8px;
}

/* ---------- Result ---------- */

.dev-result {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
}

.dev-result[hidden] {
  display: none;
}

.dev-result:focus {
  outline: none;
}

.dev-result__icon {
  color: var(--success-text);
  font-size: 36px;
}

.dev-result__title {
  margin: 0;
  color: var(--success-text);
  font-size: 20px;
  line-height: 30px;
}

.dev-result p {
  margin: 0;
  line-height: 1.8;
}

.dev-result a {
  color: var(--green-600);
  font-weight: 500;
}

.dev-key {
  display: flex;
  gap: 8px;
  width: 100%;
}

.dev-key__input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg-neutral);
}

.dev-key__copy {
  flex-shrink: 0;
}

.dev-key__copied {
  min-height: 1.2em;
  margin: 0;
  color: var(--success-text);
  font-size: 14px;
}

/* ---------- Terms dialog ---------- */

.dev-terms-dialog {
  width: min(760px, calc(100vw / var(--site-zoom, 1) - 2rem));
  max-height: calc(100vh / var(--site-zoom, 1) - 2rem);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.3);
}

.dev-terms-dialog[open] {
  display: flex;
  flex-direction: column;
}

.dev-terms-dialog::backdrop {
  background: rgba(16, 24, 40, 0.55);
}

.dev-terms-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.dev-terms-dialog__head h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 30px;
}

.dev-terms-dialog__close {
  display: inline-flex;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-neutral);
  color: var(--text-default);
  font-size: 20px;
  cursor: pointer;
}

.dev-terms-dialog__body {
  flex: 1;
  min-height: 0;
  max-height: 60vh;
  overflow-y: auto;
  padding: 16px 24px;
  color: var(--text-paragraph);
  font-size: 16px;
  line-height: 28px;
  white-space: pre-line;
}

.dev-terms-dialog__body:focus-visible {
  outline: 2px solid var(--text-default);
  outline-offset: -2px;
}

.dev-terms-dialog__actions {
  display: flex;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .dev-hero__inner {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    text-align: center;
  }

  .dev-hero__text {
    justify-items: center;
  }

  .dev-hero__art {
    order: -1;
  }

  .dev-hero__img {
    width: min(60%, 260px);
  }
}

@media (max-width: 600px) {
  .developers {
    gap: 32px;
  }

  .dev-hero__inner {
    padding: 24px 16px 32px;
  }

  /* The long label wraps instead of overflowing the panel. */
  .dev-hero__btn {
    height: auto;
    min-height: 40px;
    padding-block: 8px;
    white-space: normal;
  }

  .dev-card {
    padding: 23px 15px;
  }

  .dev-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .dev-key {
    flex-direction: column;
  }
}

/* The high-contrast filter washes the grey field surface out to white: outline the fields. */
html[data-contrast='high'] .dev-field__input {
  box-shadow: inset 0 0 0 1px var(--text-default);
}

html[data-contrast='high'] .dev-field__input[aria-invalid='true'] {
  box-shadow: inset 0 0 0 2px #b42318;
}
