.jawi-page {
  background: #f5f7fa;
  color: #172033;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.jawi-main {
  width: min(100% - 2rem, 1120px);
  margin: auto;
  padding: clamp(2rem, 6vw, 4.5rem) 0;
}

.jawi-hero {
  max-width: 820px;
  margin-bottom: 1.75rem;
}

.jawi-hero h1 {
  margin: .25rem 0 .75rem;
  font-size: clamp(2.25rem, 6vw, 4rem);
  line-height: 1.06;
  letter-spacing: -.035em;
}

.jawi-hero > p:last-of-type {
  margin: 0;
  color: #536174;
  font-size: 1.08rem;
}

.dictionary-state {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: 1rem;
  border-radius: 999px;
  padding: .35rem .7rem;
  background: #e9f3ff;
  color: #07549f;
  font-size: .85rem;
  font-weight: 750;
}

.dictionary-state::before {
  content: "";
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: #df8a00;
}

.dictionary-state[data-state="ready"]::before {
  background: #16803b;
}

.dictionary-state[data-state="error"] {
  background: #fff0f0;
  color: #9c1c1c;
}

.dictionary-state[data-state="error"]::before {
  background: #c62828;
}

.converter-card,
.jawi-notes {
  border: 1px solid #d5dce4;
  border-radius: 14px;
  padding: clamp(1rem, 3vw, 1.6rem);
  background: #fff;
  box-shadow: 0 8px 28px #1720330d;
}

.converter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.panel-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .5rem;
  color: #35445a;
  font-weight: 800;
}

.panel-label span:last-child {
  color: #637083;
  font-size: .82rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.text-panel textarea,
.jawi-output {
  display: block;
  width: 100%;
  height: 280px;
  border: 1px solid #aeb9c7;
  border-radius: 10px;
  padding: 1rem;
  background: #fff;
  color: #172033;
  line-height: 1.75;
}

.text-panel textarea {
  resize: vertical;
  font: inherit;
}

.jawi-output {
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "Scheherazade New", "Noto Naskh Arabic", serif;
  font-size: clamp(2rem, 4vw, 2.7rem);
  font-weight: 400;
  line-height: 1.9;
  text-align: right;
}

.jawi-output.is-empty {
  color: #788391;
  font-family: inherit;
  font-size: 1rem;
  direction: ltr;
  text-align: left;
}

.conversion-arrow {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: #e9f3ff;
  color: #075fc6;
  font-size: 1.25rem;
  font-weight: 900;
}

.converter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: 1rem;
}

.converter-actions button,
.examples button {
  min-height: 44px;
  border: 1px solid #aeb9c7;
  border-radius: 8px;
  padding: .55rem .9rem;
  background: #fff;
  color: #24344a;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.converter-actions .primary-button {
  border-color: #075fc6;
  background: #075fc6;
  color: #fff;
}

.converter-actions button:hover:not(:disabled),
.examples button:hover {
  border-color: #075fc6;
  color: #075fc6;
}

.converter-actions .primary-button:hover:not(:disabled) {
  background: #064f9f;
  color: #fff;
}

.converter-actions button:disabled {
  cursor: wait;
  opacity: .55;
}

.examples {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid #e2e7ed;
}

.examples > span {
  margin-right: .25rem;
  color: #536174;
  font-size: .88rem;
  font-weight: 750;
}

.examples button {
  min-height: 36px;
  padding: .35rem .65rem;
  border-color: #b9d5f4;
  background: #f5f9ff;
  color: #07549f;
  font-size: .82rem;
}

.jawi-notes {
  margin-top: 1.5rem;
}

.jawi-notes h2 {
  margin: 0 0 .6rem;
  font-size: 1.3rem;
}

.jawi-notes p {
  max-width: 900px;
  margin: .35rem 0;
  color: #536174;
}

.jawi-sources {
  font-size: .86rem;
}

.jawi-page textarea:focus,
.jawi-page button:focus-visible,
.jawi-page a:focus-visible,
.jawi-output:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 2px;
}

@media (max-width: 800px) {
  .converter-grid {
    grid-template-columns: 1fr;
  }

  .conversion-arrow {
    margin: auto;
    transform: rotate(90deg);
  }

  .text-panel textarea,
  .jawi-output {
    height: 230px;
  }
}

@media (max-width: 560px) {
  .jawi-main {
    width: min(100% - 1.25rem, 1120px);
    padding-top: 1.5rem;
  }

  .converter-actions button {
    flex: 1;
  }

  .examples {
    align-items: stretch;
    flex-direction: column;
  }

  .examples > span {
    margin-bottom: .15rem;
  }

  .landing-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    width: 100%;
    padding-bottom: .25rem;
  }

  .landing-nav a {
    white-space: nowrap;
  }
}
