/* 7 · Send over Konto (round 8, a loan). Prefix sd-.
   A conversation across the Tigris told with speech bubbles. Ammar (east bank)
   asks Noor (west bank) for a loan; she says yes and records it on the live
   phone, sends it over Konto, the route crosses the Suspension Bridge, and the
   loan arrives in Ammar's Konto (a simplified incoming review: Don't add / Add
   loan). He adds it as a debt he owes her and thanks her. The map never
   mirrors; in Arabic the two people trade banks. */
.ks.sd { --sky1: #F2E2BD; --sky2: #F2E2BD; }
.ks .sd-bleed { background: #F2E2BD; }

/* ---------- the map: a simplified, flat map of central Baghdad, north up ----------
   It never mirrors (it is real geography). The 2600 x 1000 sheet (sd_map, made by
   agentB/r4/mkmap.py) is shifted so the Tigris runs between the two people: in
   English Noor is in Karkh (west bank) and Ammar in Karada (east bank), in Arabic
   the other way round, so each stays beside their own side of the page. The route
   crosses the Suspension Bridge. */
.ks .sd-geo { position: absolute; left: 0; top: 0; width: 1440px; height: 900px; pointer-events: none; }
.ks .sd-geo-in { position: absolute; left: -170px; top: -50px; width: 2600px; height: 1000px; }
.ks[dir="rtl"] .sd-geo-in { left: -725px; }
.ks .sd-map { position: absolute; left: 0; top: 0; width: 2600px; height: 1000px; }
.ks .sd-veil { position: absolute; left: -400px; top: -60px; width: 1060px; height: 1020px; pointer-events: none;
  background: radial-gradient(52% 58% at 52% 42%, rgba(251,240,214,.95) 30%, rgba(251,240,214,.72) 62%, rgba(251,240,214,0) 100%); }
.ks[dir="rtl"] .sd-veil { left: auto; right: -400px; }
.ks .sd-route { position: absolute; left: 0; top: 0; width: 2600px; height: 1000px; overflow: visible; z-index: 1; }
.ks .sd-route path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ks .sd-route .r-rtl, .ks[dir="rtl"] .sd-route .r-ltr { display: none; }
.ks[dir="rtl"] .sd-route .r-rtl { display: inline; }
.ks .sd-r-base { stroke: rgba(9,154,179,.55); stroke-width: 4; stroke-dasharray: 2 12; }
.ks .sd-r-glow { stroke: rgba(11,186,216,.38); stroke-width: 20; filter: blur(6px); stroke-dasharray: 100; stroke-dashoffset: 100; }
.ks .sd-r-line { stroke: #0BBAD8; stroke-width: 6; stroke-dasharray: 100; stroke-dashoffset: 100; }
.ks .sd-chip { position: absolute; left: 0; top: 0; z-index: 2; offset-rotate: 0deg; offset-distance: 0%; opacity: 0; }
.ks .sd-chip.c-ltr { offset-path: path('M1080 572 C 1082 470 1092 380 1105 346 L 1222 352 C 1250 353 1275 351 1300 350'); }
.ks .sd-chip.c-rtl { offset-path: path('M1255 572 C 1252 470 1238 380 1222 352 L 1105 344 C 1080 346 1058 348 1035 350'); display: none; }
.ks[dir="rtl"] .sd-chip.c-ltr { display: none; }
.ks[dir="rtl"] .sd-chip.c-rtl { display: block; }
.ks .sd-chip > span { display: grid; place-items: center; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: #0BBAD8;
  box-shadow: 0 0 0 6px rgba(11,186,216,.25), 0 0 26px 6px rgba(11,186,216,.45); }
.ks .sd-chip img { width: 24px; height: 24px; }
/* place names: districts, bridges, the expressway and the river (centred on their point) */
.ks .sd-lbl { position: absolute; z-index: 2; margin: 0; padding: 3px 9px; border-radius: 8px; background: rgba(255,255,255,.86); font-size: 13px; font-weight: 800; letter-spacing: .02em; color: #4A3B22; white-space: nowrap; transform: translate(-50%, -50%); }
.ks[lang="ar"] .sd-lbl { letter-spacing: 0; font-size: 14px; }
.ks .sd-lbl.rd { background: #FFFDF6; color: #7A6236; font-weight: 700; font-size: 12px; box-shadow: 0 0 0 1px #E2CFA4; }
.ks[lang="ar"] .sd-lbl.rd { font-size: 13px; }
.ks .sd-lbl.river { background: none; color: #2E7E94; font-style: italic; font-weight: 700; font-size: 15px; }
.ks[lang="ar"] .sd-lbl.river { font-style: normal; }
.ks .l-sus { left: 1163px; top: 312px; }
.ks .l-two { left: 1348px; top: 880px; }
.ks .l-qad { left: 950px; top: 862px; }
.ks .l-tig { left: 1232px; top: 566px; }
.ks .l-allawi { left: 1050px; top: 130px; }
.ks[dir="rtl"] .l-allawi { left: 880px; }
.ks .l-jad { left: 1500px; top: 772px; }
.ks[dir="rtl"] .l-jad { left: 1660px; top: 690px; }


/* ---------- copy ---------- */
.ks .sd-copy { position: absolute; inset-inline-start: 80px; top: 92px; width: 452px; z-index: 6; }
.ks .sd-copy .eyebrow { margin-bottom: 16px; }
.ks .sd-eb { padding: 5px; border-radius: 50%; background: var(--c500); }
.ks .sd-h { font-size: 50px; line-height: 1.04; letter-spacing: 0; }
.ks[dir="rtl"] .sd-h { font-size: 46px; line-height: 1.28; }
.ks .sd-lead { margin-top: 16px; font-size: 17px; line-height: 1.55; }
.ks .sd-facts { list-style: none; margin: 16px 0 0; padding: 0; }
.ks .sd-facts li { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; font-size: 15px; font-weight: 700; color: var(--ink); border-top: 1px solid rgba(74,59,34,.16); }
.ks .sd-facts li:last-child { border-bottom: 1px solid rgba(74,59,34,.16); }
.ks .sd-facts li::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--c500); transform: translateY(-2px); }
.ks .sd-plan { margin: 12px 0 0; font-size: 14px; font-weight: 700; color: var(--c700); }
.ks .sd-beats { margin-top: 18px; }

/* ---------- Noor: the live phone and her pin ---------- */
.ks .sd-noor, .ks .sd-karim { transition: opacity .5s var(--ease), filter .5s var(--ease); }
.ks .sd-phone { position: absolute; inset-inline-start: 556px; top: 150px; z-index: 5; }
.ks .sd-phone::after { content: ""; position: absolute; left: 8%; right: 8%; bottom: -12px; height: 24px; border-radius: 50%; background: rgba(70,50,20,.28); filter: blur(10px); z-index: -1; }
/* ---------- the people on the map (inside the sheet, so they stay on their banks) ----------
   Their feet are on the route's two ends; a person is about as tall as a few blocks.
   Poses follow the beat (Send.dc.html noorPose / karimPose). */
.ks .sd-fig { position: absolute; z-index: 4; width: 132px; height: 150px; margin: -146px 0 0 -66px; transition: opacity .5s var(--ease), filter .5s var(--ease); }
.ks .sd-fig > svg { display: block; width: 132px !important; height: 150px !important; overflow: visible; }
.ks .sd-fig.n { left: 1080px; top: 572px; }
.ks .sd-fig.k { left: 1300px; top: 352px; }
.ks[dir="rtl"] .sd-fig.n { left: 1255px; }
.ks[dir="rtl"] .sd-fig.k { left: 1035px; }
.ks[dir="rtl"] .sd-fig > svg { transform: scaleX(-1); }
.ks .sd-fig > b { position: absolute; left: 50%; top: 152px; transform: translateX(-50%); display: grid; justify-items: center; padding: 3px 11px 4px; border-radius: 13px;
  background: #fff; color: var(--ink); font-size: 14px; font-weight: 800; line-height: 1.15; white-space: nowrap; box-shadow: 0 4px 12px rgba(60,40,10,.16); }
.ks .sd-fig > b small { font-size: 11.5px; font-weight: 700; color: #8A6A34; }
.ks.sd.is-leading.b-receive .sd-fig.n, .ks.sd.is-leading.b-added .sd-fig.n { filter: saturate(.35) brightness(1.06); }

/* what they say: a bubble beside the speaker's head, on the side away from the phone
   (the geo sheet is LTR, so the sides are set for each direction) */
.ks .sd-say { position: absolute; left: 96px; bottom: 98px; margin: 0; width: max-content; max-width: 206px; padding: 9px 14px 10px;
  border-radius: 16px; border-bottom-left-radius: 4px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 700; line-height: 1.35; text-align: start;
  box-shadow: 0 2px 6px rgba(10,25,41,.08), 0 12px 26px rgba(60,40,10,.2);
  opacity: 0; transform: translateY(8px) scale(.9); transform-origin: 0 100%; transition: opacity .25s var(--ease), transform .4s var(--spring); pointer-events: none; }
.ks .sd-say::after { content: ""; position: absolute; left: -7px; bottom: 0; width: 14px; height: 12px; background: #fff; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.ks[dir="rtl"] .sd-say { left: auto; right: 96px; border-bottom-left-radius: 16px; border-bottom-right-radius: 4px; transform-origin: 100% 100%; }
.ks[dir="rtl"] .sd-say::after { left: auto; right: -7px; clip-path: polygon(0 0, 100% 100%, 0 100%); }
.ks[lang="ar"] .sd-say { font-size: 17px; line-height: 1.45; }
/* Ammar asks; Noor answers while he waits; he thanks her once it is in his books */
.ks.sd.b-ask .sd-say.ask, .ks.sd.b-lend .sd-say.ask,
.ks.sd.b-lend .sd-say.yes, .ks.sd.b-send .sd-say.yes,
.ks.sd.r-added .sd-say.thx { opacity: 1; transform: none; }
.ks.sd.b-ask .sd-say.ask { transition-delay: .4s; }
.ks.sd.b-lend .sd-say.yes { transition-delay: .35s; }
.ks.sd.b-added .sd-say.thx { transition-delay: 1.5s; }
.ks.sd.b-lend .sd-say.ask { opacity: .8; }

/* ---------- Ammar: the loan arrives over Konto, below him ---------- */
.ks .sd-recv { position: absolute; inset-inline-start: 1116px; top: 376px; width: 290px; z-index: 5; }
.ks .sd-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 18px; background: rgba(255,255,255,.96);
  box-shadow: 0 2px 6px rgba(10,25,41,.08), 0 14px 30px rgba(60,40,10,.18); opacity: 0; transform: translateY(-10px) scale(.96); transition: opacity .35s var(--ease), transform .45s var(--spring); }
.ks .sd-note-ic { flex: none; width: 34px; height: 34px; border-radius: 9px; background: #0BBAD8; display: grid; place-items: center; }
.ks .sd-note-ic img { width: 20px; height: 20px; }
.ks .sd-note-b { display: grid; gap: 1px; min-width: 0; }
.ks .sd-note-b b { font-size: 13px; font-weight: 800; color: var(--ink); }
.ks .sd-note-b span { font-size: 13px; line-height: 1.35; font-weight: 500; color: var(--ink-2); }
.ks .sd-card { margin-top: 12px; width: 390px; zoom: .7436; border-radius: 24px; overflow: hidden; box-shadow: 0 4px 10px rgba(10,25,41,.10), 0 30px 70px rgba(60,40,10,.26);
  opacity: 0; transform: translateY(30px); transition: opacity .45s var(--ease), transform .6s var(--ease); }
.ks .sd-app { width: 390px; height: auto; background: transparent; }
.ks .sd-app .a-sheet { position: relative; transform: none; max-height: none; border-radius: 0; box-shadow: none; }
.ks .sd-app .a-sheet-b { padding-bottom: 18px; }
.ks .sd-ini { background: #F7E1EA; color: #8E3A5C; font-size: 14px; font-weight: 800; }
.ks .sd-tile { background: #FDECEA; }
.ks .sd-tile > svg { width: 28px; height: 28px; }
.ks .sd-owe { color: #C0392B; font-weight: 600; }
.ks .sd-foot { display: grid; }
.ks .sd-f1, .ks .sd-f2 { grid-area: 1 / 1; display: flex; gap: 12px; align-items: center; transition: opacity .3s var(--ease), transform .4s var(--ease); }
.ks .sd-f2 { justify-content: center; opacity: 0; transform: translateY(8px); }
.ks .sd-done { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 20px; border-radius: 16px; background: var(--ok-surface); color: var(--ok-content); font-size: 15px; font-weight: 700; }
.ks .sd-done svg { width: 20px; height: 20px; }
.ks .sd-app .a-dbtn { transition: transform .15s, filter .15s; }
.ks .sd-whose { margin: 12px 0 0; text-align: center; font-size: 14px; font-weight: 800; color: #6B5530; opacity: 0; transition: opacity .4s; }

/* the received state: shown whenever the receive beat has been reached (or all is calm) */
.ks.sd.r-receive .sd-note { opacity: 1; transform: none; }
.ks.sd.r-receive .sd-card { opacity: 1; transform: none; }
.ks.sd.r-receive .sd-whose { opacity: 1; }
.ks.sd.b-receive .sd-note { transition-delay: .2s; }
.ks.sd.b-receive .sd-card { transition-delay: 1s; }
.ks.sd.b-receive .sd-whose { transition-delay: 1.3s; }
.ks.sd.b-receive .sd-note-ic { animation: k-ring 1.4s .5s ease-out 2; }
/* added: Add loan is pressed, the check lands on the tile, the footer says so */
.ks.sd.b-added .sd-add { animation: sd-press .5s .35s both; }
.ks.sd.r-added .sd-ok i { animation: a-ok-pop .52s .7s cubic-bezier(.34,1.56,.64,1) both; }
.ks.sd.r-added .sd-ok svg path { animation: a-ok-draw .36s .96s cubic-bezier(.65,0,.35,1) both; }
.ks.sd.r-added .sd-f1 { opacity: 0; transform: translateY(-8px); transition-delay: .9s; }
.ks.sd.r-added .sd-f2 { opacity: 1; transform: none; transition-delay: 1.1s; }
.ks.sd.is-calm .sd-f1, .ks.sd.is-calm .sd-f2, .ks.sd.is-calm .sd-note, .ks.sd.is-calm .sd-card, .ks.sd.is-calm .sd-whose { transition-delay: 0s; }
@keyframes sd-press { 0%, 100% { transform: none; filter: none; } 40% { transform: scale(.94); filter: brightness(.9); } }

/* ---------- one side in focus at a time ---------- */
.ks.sd.is-leading.b-travel .sd-noor, .ks.sd.is-leading.b-travel .sd-karim { opacity: .72; }
.ks.sd.is-leading.b-receive .sd-noor, .ks.sd.is-leading.b-added .sd-noor { opacity: .45; filter: saturate(.5); }
/* the route: drawn while the payment travels, then it stays */
.ks.sd.b-travel .sd-r-line, .ks.sd.b-travel .sd-r-glow { animation: sd-draw 1.9s .1s cubic-bezier(.6,0,.3,1) both; }
.ks.sd.r-receive .sd-r-line, .ks.sd.r-receive .sd-r-glow { stroke-dashoffset: 0; }
.ks.sd.r-receive .sd-r-glow { opacity: .55; }
.ks.sd.b-travel .sd-chip { animation: sd-travel 1.9s .1s cubic-bezier(.6,0,.3,1) both; }
@keyframes sd-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes sd-travel { 0% { offset-distance: 0%; opacity: 0; transform: scale(.4); } 10% { opacity: 1; transform: scale(1); } 90% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; transform: scale(.6); } }


/* ---------- narrow screens, before the story takes over (kphone-story.js) ----------
   The map is a banner at the top with Noor, Ammar and the route, then the copy. */
html.kp-narrow .ks.sd .kframe { padding: 0 20px 48px; display: flex; flex-direction: column; }
html.kp-narrow .ks .sd-geo { position: relative; order: -1; flex: none; width: auto; height: 340px; margin: 64px -20px 6px; overflow: hidden; }
html.kp-narrow .ks .sd-geo-in, html.kp-narrow .ks[dir="rtl"] .sd-geo-in { left: calc(50% - 722px); top: -110px; transform: scale(.62); transform-origin: 0 0; }
html.kp-narrow .ks .sd-veil, html.kp-narrow .ks .sd-lbl, html.kp-narrow .ks .sd-noor, html.kp-narrow .ks .sd-karim { display: none; }
html.kp-narrow .ks .sd-lbl.river { display: block; }
html.kp-narrow .ks .sd-copy { position: relative; inset: auto; width: auto; order: 1; }
html.kp-narrow .ks .sd-h { font-size: 36px; }
html.kp-narrow .ks .sd-lead { font-size: 16px; }

/* ---------- phones, told full screen (kphone-story.js, story/send.js) ----------
   The whole map at its wide-page size (.sd-art, 1440 x 900; it takes no box anywhere
   else), moved by the story's camera. The people stand at their places with their
   bubbles above their heads, and Ammar's Konto lies on the map beside him. */
.ks .sd-art { display: contents; }
html.kp-narrow .sd[data-kst] .sd-art { display: block !important; }
html.kp-narrow .sd[data-kst] .sd-geo { position: absolute !important; left: 0; top: 0; width: 1440px !important; height: 900px !important; margin: 0 !important; overflow: visible !important; }
html.kp-narrow .sd[data-kst] .sd-geo-in { left: -170px !important; top: -50px !important; transform: none !important; }
html.kp-narrow .sd[dir="rtl"][data-kst] .sd-geo-in { left: -725px !important; }
html.kp-narrow .sd[data-kst] .sd-veil, html.kp-narrow .sd[data-kst] .sd-noor { display: none !important; }
html.kp-narrow .sd[data-kst] .sd-lbl { display: block; }
html.kp-narrow .sd[data-kst] .sd-lbl.rd { display: none; }
html.kp-narrow .sd[data-kst] .sd-karim { display: block; opacity: 1 !important; filter: none !important; }
html.kp-narrow .sd[data-kst] .sd-fig > b { font-size: 18px; top: 154px; }
html.kp-narrow .sd[data-kst] .sd-fig > b small { font-size: 14px; }
/* bubbles above the speaker's head, large enough to read on a phone */
html.kp-narrow .sd[data-kst] .sd-say, html.kp-narrow .sd[dir="rtl"][data-kst] .sd-say {
  left: -60px; right: auto; bottom: 160px; width: 252px; max-width: none; padding: 11px 15px 12px; border-radius: 18px;
  font-size: 20px; line-height: 1.3; text-align: center; transform-origin: 50% 100%; }
html.kp-narrow .sd[data-kst] .sd-say::after, html.kp-narrow .sd[dir="rtl"][data-kst] .sd-say::after {
  left: 50%; right: auto; bottom: -9px; width: 18px; height: 10px; margin-left: -9px; clip-path: polygon(0 0, 100% 0, 50% 100%); }
html.kp-narrow .sd[data-kst][lang="ar"] .sd-say { font-size: 21px; line-height: 1.45; }
/* Ammar's bubble leans toward his Konto (beside him), away from the river (mirrored in Arabic) */
html.kp-narrow .sd[data-kst] .sd-fig.k .sd-say { left: -32px; }
html.kp-narrow .sd[data-kst] .sd-fig.k .sd-say::after { left: 98px; }
html.kp-narrow .sd[dir="rtl"][data-kst] .sd-fig.k .sd-say { left: -88px; }
html.kp-narrow .sd[dir="rtl"][data-kst] .sd-fig.k .sd-say::after { left: 154px; }
/* Ammar's Konto beside him (the map's east side in English, west in Arabic) */
html.kp-narrow .sd[data-kst] .sd-recv {
  position: absolute; inset: auto; inset-inline-start: 1186px; top: 150px; width: 351px; zoom: 1; margin: 0; z-index: 5; order: 0; opacity: 1 !important; transform: none; }
html.kp-narrow .sd[data-kst] .sd-card { zoom: .9; }
html.kp-narrow .sd[data-kst] .sd-note-b b, html.kp-narrow .sd[data-kst] .sd-note-b span { font-size: 16px; }
html.kp-narrow .sd[data-kst] .sd-whose { font-size: 17px; }
html.kp-narrow .sd[data-kst]:not(.r-receive) .sd-whose { opacity: 0; }
