:root {
  --paper: #ffffff;
  --ink: #13203a;
  --muted: #56607a;
  --rule: #e4e7ec;
  --seal: #e5482c;
  --seal-tint: #fdf0ec;
  --display: "Alexandria", "Readex Pro", sans-serif;
  --kufi: "Reem Kufi", "Readex Pro", sans-serif;
  --text: "Readex Pro", system-ui, sans-serif;
  --measure: 34rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--text);
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }

.wrap { max-width: 72rem; margin-inline: auto; padding-inline: 1.75rem; }

.mark { width: 2rem; height: 2rem; display: block; }

/* header */

.top { display: flex; align-items: center; justify-content: space-between; padding-block: 1.5rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; }
.brand-ar { font-family: var(--kufi); font-size: 1.6rem; line-height: 1; }
.brand-en { font-size: 1rem; font-weight: 400; color: var(--muted); }
.top nav { display: flex; align-items: center; gap: 1.75rem; font-weight: 400; font-size: 0.95rem; }
.top nav a { text-decoration: none; }
.top nav a:hover { color: var(--seal); }
.top nav .lang { font-family: var(--kufi); font-size: 1.05rem; }
.top nav .lang:lang(en) { font-family: var(--text); }

/* hero */

.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 4.5rem; align-items: center;
  padding-block: 4.5rem 6rem;
}
.hero h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(3rem, 7.5vw, 5.6rem); line-height: 1.02; letter-spacing: -0.01em;
}
[dir="rtl"] .hero h1 { line-height: 1.3; letter-spacing: 0; }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: var(--measure); margin-top: 1.75rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.25rem; }

.btn {
  display: inline-block; padding: 0.85rem 1.4rem; border-radius: 3px;
  font-weight: 500; text-decoration: none;
  background: var(--ink); color: var(--paper); border: 1.5px solid var(--ink);
}
.btn:hover { background: var(--seal); border-color: var(--seal); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-quiet:hover { background: transparent; color: var(--ink); border-color: var(--ink); }

/* the slip */

.slip {
  position: relative; padding: 2rem 2.1rem 2.4rem;
  border: 1px solid var(--rule); border-radius: 2px; background: var(--paper);
  box-shadow: 0 1px 0 var(--rule), 0 24px 48px -28px rgba(19, 32, 58, 0.35);
}
.slip-to { color: var(--muted); font-size: 0.95rem; }
.slip-amount {
  font-family: var(--display); font-size: 3.4rem; line-height: 1.1; margin: 0.35rem 0 1.4rem;
  font-variant-numeric: tabular-nums;
}
.slip-amount span { font-family: var(--text); font-size: 1.1rem; color: var(--muted); font-weight: 400; }

.leaders { list-style: none; font-variant-numeric: tabular-nums; }
.leaders li { display: flex; align-items: baseline; gap: 0.6rem; padding-block: 0.45rem; }
.leaders li::before { content: none; }
.leaders .k { color: var(--muted); white-space: nowrap; }
.leaders .v { white-space: nowrap; font-weight: 400; order: 3; }
.leaders li::after {
  content: ""; flex: 1; order: 2; border-bottom: 1.5px dotted #c3c8d2; transform: translateY(-0.3em);
}

.seal {
  position: absolute; inset-inline-end: -1.6rem; top: -2rem; width: 6.5rem; height: 6.5rem;
  transform: rotate(-9deg); mix-blend-mode: multiply;
}
[dir="rtl"] .seal { transform: rotate(9deg); }
.seal img { width: 100%; height: 100%; opacity: 0.92; }

@media (prefers-reduced-motion: no-preference) {
  .seal { animation: stamp 520ms cubic-bezier(0.2, 0.9, 0.3, 1.25) 700ms both; }
  [dir="rtl"] .seal { animation-name: stamp-rtl; }
}
@keyframes stamp {
  from { opacity: 0; transform: scale(1.9) rotate(-2deg); }
  to { opacity: 1; transform: scale(1) rotate(-9deg); }
}
@keyframes stamp-rtl {
  from { opacity: 0; transform: scale(1.9) rotate(2deg); }
  to { opacity: 1; transform: scale(1) rotate(9deg); }
}

/* sections */

.block { padding-block: 5.5rem; border-top: 1px solid var(--rule); }
.block h2 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2rem, 4.2vw, 3rem); line-height: 1.12; max-width: 40rem;
}
[dir="rtl"] .block h2 { line-height: 1.35; }
.block .intro { color: var(--muted); max-width: var(--measure); margin-top: 1rem; font-size: 1.1rem; }
h3 { font-size: 1.1rem; font-weight: 500; }

/* the ledger calculator */

.calc { display: grid; grid-template-columns: 1fr 1.15fr; gap: 3rem; margin-top: 3rem; align-items: start; }
.controls { display: grid; gap: 2rem; }
.control label { display: flex; justify-content: space-between; gap: 1rem; font-weight: 400; }
.control output { font-family: var(--display); font-size: 1.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
.control input[type="range"] { width: 100%; margin-top: 0.9rem; accent-color: var(--seal); }
.control .hint { font-size: 0.9rem; color: var(--muted); margin-top: 0.35rem; }

.book { border: 1px solid var(--rule); border-radius: 2px; }
.book-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; padding: 1.1rem 1.4rem; border-top: 1px solid var(--rule); align-items: baseline; }
.book-row:first-child { border-top: 0; }
.book-row .v { font-variant-numeric: tabular-nums; font-weight: 400; white-space: nowrap; }
.book-row.loss .v { font-family: var(--display); font-size: 2.2rem; line-height: 1; color: var(--seal); }
.book-row.ours { background: var(--seal-tint); }
.book-row.ours .v { font-family: var(--display); font-size: 1.6rem; line-height: 1; }
.book-note { font-size: 0.85rem; color: var(--muted); margin-top: 0.9rem; }

/* steps: a real sequence */

.steps { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; margin-top: 3rem; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step); display: block; font-family: var(--display); font-size: 2.6rem; line-height: 1;
  color: var(--seal); margin-bottom: 0.9rem;
}
[dir="rtl"] .steps li::before { content: counter(step, arabic-indic); }
.steps p { color: var(--muted); margin-top: 0.4rem; }

/* product: small specimens of the real thing */

.specimens { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.25rem; margin-top: 3rem; }
.spec { grid-column: span 2; border: 1px solid var(--rule); border-radius: 2px; padding: 1.25rem 1.25rem 1.4rem; }
.spec:nth-child(4), .spec:nth-child(5) { grid-column: span 3; }
.spec h3 { margin-top: 1.25rem; }
.spec p { color: var(--muted); font-size: 0.98rem; margin-top: 0.25rem; }

.spec-art {
  height: 9.5rem; padding: 1rem; display: flex; flex-direction: column; justify-content: center; gap: 0.55rem;
  background: #f6f7f9; border-radius: 2px; font-size: 0.82rem; font-weight: 400; overflow: hidden;
}
.mini-field { background: var(--paper); border: 1px solid var(--rule); border-radius: 2px; padding: 0.45rem 0.6rem; color: var(--muted); font-variant-numeric: tabular-nums; flex: 1; }
.mini-row { display: flex; gap: 0.55rem; }
.mini-pay { background: var(--ink); color: var(--paper); border-radius: 2px; padding: 0.5rem; text-align: center; font-weight: 500; }

.mini-link { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 2px; padding: 0.55rem 0.7rem; }
.mini-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-link b { color: var(--seal); font-weight: 500; }
.mini-share { display: flex; gap: 0.4rem; }
.mini-share span { border: 1px solid var(--rule); background: var(--paper); border-radius: 99px; padding: 0.2rem 0.7rem; color: var(--muted); }

.mini-table { background: var(--paper); border: 1px solid var(--rule); border-radius: 2px; }
.mini-table div { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.7rem; border-top: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.mini-table div:first-child { border-top: 0; }
.mini-table i { font-style: normal; font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 99px; }
.mini-table .ok { background: #e7f4ec; color: #1d6b3f; }
.mini-table .wait { background: #eef0f4; color: var(--muted); }
.mini-table .bad { background: var(--seal-tint); color: #b5341c; }

.mini-toggle { display: flex; border: 1px solid var(--rule); border-radius: 2px; background: var(--paper); align-self: flex-start; }
.mini-toggle span { padding: 0.4rem 0.9rem; color: var(--muted); }
.mini-toggle .on { background: var(--ink); color: var(--paper); }
.mini-banner { background: #fff3cd; color: #7a5a00; border-radius: 2px; padding: 0.45rem 0.7rem; }

.mini-code { font-family: ui-monospace, monospace; background: var(--ink); color: #dfe4ee; border-radius: 2px; padding: 0.7rem 0.8rem; font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.mini-code span { color: var(--seal); }
.mini-license { align-self: flex-start; border: 1.5px solid var(--ink); border-radius: 2px; padding: 0.15rem 0.55rem; font-weight: 500; }

/* roadmap: clearly not built yet */

.roadmap { margin-top: 3.5rem; border: 1.5px dashed #c3c8d2; border-radius: 2px; padding: 1.75rem 1.75rem 0.75rem; }
.roadmap-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.roadmap-head h3 { font-size: 1.25rem; }
.roadmap-head p { color: var(--muted); }
.roadmap ul { list-style: none; margin-top: 1rem; display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 2.5rem; }
.roadmap li { padding: 0.9rem 0 0.9rem 1.6rem; border-top: 1px dashed var(--rule); position: relative; color: var(--muted); }
[dir="rtl"] .roadmap li { padding: 0.9rem 1.6rem 0.9rem 0; }
.roadmap li::before { content: ""; position: absolute; inset-inline-start: 0; top: 1.25rem; width: 0.8rem; height: 0.8rem; border: 1.5px dashed var(--muted); border-radius: 50%; }
.roadmap li strong { display: block; color: var(--ink); font-weight: 500; }
.roadmap li span { font-size: 0.95rem; }

/* the name */

.name { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 4rem; align-items: start; }
.name .word { font-family: var(--kufi); font-size: clamp(4.5rem, 11vw, 8rem); line-height: 1; color: var(--seal); }
.name .say { color: var(--muted); margin-top: 0.9rem; }
.name p { max-width: var(--measure); }
.name p + p { margin-top: 1.1rem; }
.name .by { color: var(--muted); }

/* contact */

.ask { display: flex; justify-content: space-between; align-items: end; gap: 2rem; flex-wrap: wrap; }

footer { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding-block: 2rem 3rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.92rem; }
footer .mark { width: 1.4rem; height: 1.4rem; }
footer .grow { margin-inline-end: auto; }
footer a { text-decoration: none; }
footer a:hover { color: var(--seal); }

@media (max-width: 860px) {
  .top nav a:not(.lang) { display: none; }
  .hero, .calc, .name, .roadmap ul { grid-template-columns: 1fr; }
  .specimens { grid-template-columns: 1fr; }
  .spec, .spec:nth-child(4), .spec:nth-child(5) { grid-column: auto; }
  .hero { gap: 4rem; padding-block: 2.5rem 4rem; }
  .steps { grid-template-columns: 1fr; gap: 2rem; }
  .block { padding-block: 4rem; }
  .seal { width: 5rem; height: 5rem; }
}

.hl { color: var(--seal); font-weight: 400; }

.control input[type="range"] { cursor: grab; }
.control input[type="range"]:active { cursor: grabbing; }

.slip-amount, .control output, .book-row.loss .v, .book-row.ours .v, .sheet .leaders .v { font-variant-numeric: proportional-nums; }

/* 404 */

.lost h1 { font-size: clamp(2.4rem, 5.5vw, 4rem); }
.lost .lead + .lead { margin-top: 0.75rem; }
.returned {
  position: absolute; inset-inline-end: -1.8rem; top: -2.2rem; transform: rotate(-11deg); background: var(--paper);
  display: flex; flex-direction: column; align-items: center; line-height: 1.1;
  font-family: var(--kufi); font-size: 2.4rem; color: var(--seal);
  border: 3px double var(--seal); border-radius: 4px; padding: 0.3rem 0.9rem 0.4rem;
  opacity: 0.92;
}
.returned small { font-family: var(--text); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; }
@media (prefers-reduced-motion: no-preference) {
  .returned { animation: returned 520ms cubic-bezier(0.2, 0.9, 0.3, 1.25) 600ms both; }
}
@keyframes returned {
  from { opacity: 0; transform: scale(1.9) rotate(-3deg); }
  to { opacity: 0.9; transform: scale(1) rotate(-11deg); }
}

.roadmap li.soon strong em {
  font-style: normal; font-size: 0.75rem; font-weight: 500; color: var(--seal);
  border: 1.5px solid var(--seal); border-radius: 99px; padding: 0.05rem 0.55rem; margin-inline-start: 0.5rem;
  vertical-align: 0.15em;
}
.roadmap li.soon::before { border-style: solid; border-color: var(--seal); }

/* illustrations behave like images: no text selection, no hover or click */
.slip, .spec-art, .seal, .returned { -webkit-user-select: none; user-select: none; }
.spec-art, .seal, .returned { pointer-events: none; }
.slip { cursor: default; }
