/* ============================================================
   Kashida Online — "Diwan Console" theme
   Independent design system: navy/gold, utility-console layout.
   ============================================================ */
:root {
  --bg: #0b1220;
  --surface: #121c2e;
  --surface-2: #1a2740;
  --surface-3: #223252;
  --line: rgba(201, 162, 39, 0.16);
  --line-soft: rgba(139, 150, 168, 0.14);

  --gold: #c9a227;
  --gold-bright: #e4c55c;
  --gold-dim: #7a621c;

  --text: #eef1f6;
  --text-muted: #8b96a8;
  --text-faint: rgba(139, 150, 168, 0.6);

  --danger: #d9695f;
  --success: #5fae82;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-arabic: 'IBM Plex Sans Arabic', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-ui: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  /* The hero title's per-word stretch animation is purely a visual
     transform (never affects layout/wrapping), but this is kept as a
     safety net so no peak of the motion can ever introduce a page-level
     horizontal scrollbar. */
  overflow-x: hidden;
}

body {
  background-image:
    radial-gradient(900px 380px at 8% -8%, rgba(201, 162, 39, 0.09), transparent 55%),
    radial-gradient(700px 340px at 100% 4%, rgba(34, 50, 82, 0.55), transparent 55%);
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 20px 40px;
}

/* ---------- Hero ---------- */
.hero {
  margin-bottom: 36px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 28px;
}

.eyebrow {
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 12px;
}

/* ---------- Kinetic hero-title stage ----------
   The heading is real, live DOM text throughout — never rasterized —
   so it is always accessible, selectable and SEO-visible, and it's what
   drives the responsive clamp() font-size below. KashidaKineticTitle
   (see Kashida-scripts.js) splits it into one <span class="word"> per
   Arabic word — each word stays a single, unbroken shaping unit so
   joining/ligatures are never disturbed — and animates each word's own
   horizontal stretch, float and micro-rotation independently. If JS
   doesn't run, the heading is simply left as plain, fully legible text. */
.hero-stage {
  position: relative;
  isolation: isolate;
}

.hero-glow {
  position: absolute;
  inset: -46px -24px;
  background: radial-gradient(ellipse at center, rgba(201, 162, 39, 0.24), transparent 65%);
  filter: blur(34px);
  z-index: -1;
  pointer-events: none;
  animation: hero-glow-pulse 7.5s ease-in-out infinite;
}

@keyframes hero-glow-pulse {

  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-glow {
    animation: none;
    opacity: 0.7;
  }
}

.hero-title {
  position: relative;
  font-family: var(--font-arabic);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  line-height: 1.55;
  letter-spacing: 0.002em;
  margin: 0 0 12px;
  color: var(--gold-bright);
  text-align: center;
  /* Keep logical Arabic character/word order intact regardless of how
     the script re-parents words into <span> units. */
  direction: rtl;
  unicode-bidi: plaintext;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.35));
}

/* One block per kashida-balanced line (built by KashidaHeroTitle in JS).
   nowrap keeps the browser from re-wrapping mid-line after kashida has
   already widened a word — line breaks are decided once, deliberately,
   not left to reflow around the stretched glyphs. */
.hero-title-line {
  display: block;
  white-space: nowrap;
}

/* Each word is one Arabic shaping unit (never split mid-word), animated
   as a whole so contextual letterforms and ligatures stay correct. */
.hero-title .word {
  display: inline-block;
  transform-origin: center center;
  /* Generous, size-aware gap: kashida stretches a word up to ~15% wider
     from its own center, so the gap has to stay comfortably larger than
     that growth or adjacent words can visually merge mid-animation. */
  margin-inline: clamp(0.4em, 1.8vw, 0.7em);
  will-change: transform, letter-spacing;
}

@media (prefers-reduced-motion: reduce) {
  .hero-title .word {
    animation: none !important;
    transform: none !important;
    letter-spacing: 0 !important;
  }
}

.hero-sub {
  font-family: var(--font-mono);
  direction: ltr;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
}

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}

.panel:hover {
  border-color: rgba(201, 162, 39, 0.28);
}

@keyframes panel-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results.is-revealed .results-col {
  animation: panel-rise 0.5s var(--ease) both;
}

.results.is-revealed .results-col:nth-of-type(2) {
  animation-delay: 0.08s;
}

@media (prefers-reduced-motion: reduce) {
  .results.is-revealed .results-col {
    animation: none;
  }
}

.console-panel {
  padding: 24px;
}

/* ---------- Form layout ---------- */
.input-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 900px) {
  .input-grid {
    grid-template-columns: 1.3fr 1fr;
  }
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.field-label {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.field-label span {
  display: block;
  font-size: 10.5px;
  color: var(--text-faint);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}

textarea#paragraph-input {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-arabic);
  font-size: 18px;
  line-height: 1.9;
  padding: 16px 18px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

textarea#paragraph-input:focus,
input:focus-visible,
button:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
}

/* ---------- Live preview ---------- */
.preview-col {
  display: flex;
  flex-direction: column;
}

.live-preview {
  flex: 1;
  min-height: 170px;
  background: var(--surface-2);
  border: 1px dashed var(--line-soft);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-family: var(--font-arabic);
  font-size: 18px;
  line-height: 1.9;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.live-preview.is-empty::before {
  content: 'ستظهر المعاينة هنا…';
  color: var(--text-faint);
}

.preview-hint {
  font-size: 11.5px;
  direction: ltr;
  color: var(--text-faint);
  margin: 8px 2px 0;
}

/* ---------- Chip buttons ---------- */
.btn-chip {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
  white-space: nowrap;
}

.btn-chip:hover {
  border-color: var(--gold-dim);
}

.btn-chip.is-active {
  background: var(--gold-dim);
  border-color: var(--gold);
}

.btn-chip-ghost {
  background: transparent;
}

.chip-icon {
  font-size: 13px;
}

/* ---------- Virtual keyboard ---------- */
.keyboard-panel {
  margin-top: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 16px;
  max-height: 420px;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0) scaleY(1);
  transform-origin: top;
  transition: max-height 0.36s var(--ease), opacity 0.26s var(--ease),
    transform 0.36s var(--ease), padding-block 0.32s var(--ease), margin-top 0.32s var(--ease),
    border-color 0.26s var(--ease);
}

.keyboard-panel.is-collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px) scaleY(0.98);
  padding-block: 0;
  margin-top: 0;
  border-color: transparent;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .keyboard-panel {
    transition: opacity 0.15s linear, max-height 0.15s linear;
    transform: none;
  }
}

.keyboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.keyboard-head h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  margin: 0;
  font-family: var(--font-mono);
}

.keyboard-head h2 span {
  display: block;
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.kb-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kb-marks {
  margin-top: 10px;
}

.kb-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.kb-key {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  min-width: 34px;
  height: 38px;
  flex: 1;
  font-family: var(--font-arabic);
  font-size: 17px;
  cursor: pointer;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), transform 0.08s var(--ease);
}

.kb-key:hover {
  border-color: var(--gold-dim);
  background: var(--surface-2);
}

.kb-key:active {
  background: var(--gold-dim);
  color: var(--bg);
  transform: scale(0.96);
}

.kb-key-mark {
  font-size: 19px;
  color: var(--gold-bright);
}

.kb-utility {
  margin-top: 10px;
}

.kb-key-wide {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.kb-key-wide span {
  color: var(--text-faint);
}

/* ---------- Params + submit ---------- */
.param-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.param {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 190px;
}

.param label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.param label span {
  color: var(--text-faint);
  text-transform: none;
  letter-spacing: 0;
}

.param input {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 10px 12px;
  width: 100%;
}

.param-toggle {
  justify-content: center;
  min-width: 210px;
}

.param-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text-muted);
  text-transform: none;
  font-size: 12.5px;
  padding: 9px 4px;
}

.param-toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
}

.param-toggle-sub {
  display: block;
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 2px;
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-family: var(--font-arabic);
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
  margin-inline-start: auto;
  box-shadow: 0 6px 18px -6px rgba(201, 162, 39, 0.5);
  transition: filter 0.15s var(--ease), transform 0.08s var(--ease);
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -8px rgba(201, 162, 39, 0.6);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px -6px rgba(201, 162, 39, 0.5);
}

.btn-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  opacity: 0.75;
  text-transform: uppercase;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin: 12px 0 0;
  min-height: 1em;
  font-family: var(--font-mono);
}

/* ---------- Results ---------- */
.results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.raw-panel {
  grid-column: 1 / -1;
}

.col-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  margin: 0 0 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.col-title span {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-faint);
  text-transform: none;
  letter-spacing: 0;
}

.lines .line {
  font-family: var(--font-arabic);
  font-size: 20px;
  line-height: 2.1;
  margin: 0 0 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line-soft);
  text-align: justify;
  text-align-last: justify;
  text-justify: inter-word;
  opacity: 0;
  animation: panel-rise 0.42s var(--ease) forwards;
  transition: border-color 0.2s var(--ease);
}

.lines .line:hover {
  border-color: var(--gold-dim);
}

.lines .line:last-child {
  border-bottom: none;
}

@media (prefers-reduced-motion: reduce) {
  .lines .line {
    opacity: 1;
    animation: none;
  }
}

.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.col-head .col-title {
  margin-bottom: 0;
}

.kashida {
  color: var(--gold-bright);
  transition: color 0.2s var(--ease);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-soft);
  color: var(--gold);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.btn-ghost:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.btn-ghost:active {
  transform: translateY(0);
}

.btn-ghost span {
  color: var(--text-faint);
  margin-inline-start: 4px;
}

.btn-ghost.is-active {
  border-color: var(--success);
  color: var(--success);
}

/* ---------- Footer ---------- */
.site-footer {
  direction: ltr;
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  color: var(--text-faint);
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px 32px;
  margin-bottom: 18px;
}

.footer-brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  max-width: 520px;
}

.footer-mark {
  font-family: var(--font-arabic);
  direction: rtl;
  font-weight: 700;
  font-size: 15px;
  color: var(--gold);
  flex-shrink: 0;
}

.footer-tagline {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-faint);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 11.5px;
}

.footer-links a {
  position: relative;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  padding-bottom: 3px;
  transition: color 0.2s var(--ease);
}

.footer-links a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--gold);
  transition: right 0.25s var(--ease);
}

.footer-links a:hover {
  color: var(--gold-bright);
}

.footer-links a:hover::after {
  right: 0;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 24px;
  padding-top: 16px;
  font-size: 11px;
}

.footer-bottom p {
  margin: 0;
}

.footer-bottom a {
  color: var(--text-muted);
  transition: color 0.2s var(--ease);
}

.footer-bottom a:hover {
  color: var(--gold-bright);
}

@media (max-width: 640px) {
  .footer-brand {
    flex-direction: column;
    gap: 6px;
  }

  .footer-links {
    gap: 16px;
    flex-wrap: wrap;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .results {
    grid-template-columns: 1fr;
  }

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

  .btn-primary {
    margin-inline-start: 0;
    align-items: center;
  }

  .kb-key {
    min-width: 28px;
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .page {
    padding: 32px 14px 28px;
  }

  .panel {
    padding: 18px;
  }

  .field-head {
    flex-wrap: wrap;
  }

  .kb-row {
    gap: 4px;
  }

  .kb-key {
    min-width: 24px;
    height: 34px;
    font-size: 14px;
  }

  .kb-key-wide {
    font-size: 11px;
  }

  .col-head {
    flex-wrap: wrap;
  }

  textarea#paragraph-input,
  .live-preview {
    font-size: 16px;
  }

  .hero-glow {
    inset: -30px -12px;
    filter: blur(24px);
  }
}

/* Unauthorized Copying Warning */

#ays_tooltip {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;

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

  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;

  transform: scale(0.96);
}

#ays_tooltip.is-visible {
  opacity: 1;
  transform: scale(1);
}

#ays_tooltip_block {
  max-width: min(90vw, 500px);
  padding: 18px 28px;

  border-radius: 12px;
  background: rgba(20, 20, 20, 0.96);
  color: #fff;

  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08);

  font-size: 15px;
  line-height: 1.5;

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#ays_tooltip_block p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  #ays_tooltip {
    transition: none;
  }
}

/*--------------------------------------------------------------
# by: Gamal Nabih |  1LineArt Studio | https://1lineart.com
--------------------------------------------------------------*/