/* "How Wasla works" diagrams. Builds on site.css tokens; no scripts. */
:root {
  --violet: #6B4FE0;
  --violet-tint: #EFEBFF;
  --violet-line: #D6CCFF;
  --blue-line: #C9D6FF;
  --mint-line: #B9E9D6;
  --amber-line: #F6D9A8;
  --code-bg: #0B1220;
  --code-ink: #DCE5FF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --violet: #A996FF;
    --violet-tint: #221B45;
    --violet-line: #3B3170;
    --blue-line: #2B3A6E;
    --mint-line: #1E5444;
    --amber-line: #5A3F17;
    --code-bg: #070C16;
    --code-ink: #C9D6FF;
  }
}
:root[data-theme="dark"] {
  --violet: #A996FF;
  --violet-tint: #221B45;
  --violet-line: #3B3170;
  --blue-line: #2B3A6E;
  --mint-line: #1E5444;
  --amber-line: #5A3F17;
  --code-bg: #070C16;
  --code-ink: #C9D6FF;
}

/* Page */
.hiw-hero { padding: 64px 0 28px; }
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.jump a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; font-weight: 800; font-size: 14.5px; }
.jump a span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 11px; background: var(--signal); color: #fff; font-size: 12px; }
.jump a:hover { color: var(--signal); }

/* One feature = one infographic */
.fx { padding: 28px 0 44px; scroll-margin-top: 80px; }
.fx-head { display: flex; gap: 18px; align-items: center; background: var(--code-bg); color: #fff; border-radius: 24px; padding: 22px 26px; }
.fx-head .badge { flex: none; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--signal); color: #fff; }
.fx-head .badge svg { width: 28px; height: 28px; }
.fx-head h2 { color: #fff; margin: 0 0 4px; font-size: clamp(24px, 3vw, 32px); }
.fx-head p { margin: 0; color: rgba(255,255,255,.75); font-size: 15.5px; }
.fx-head .uses { margin-left: auto; max-width: 300px; font-size: 13px; color: rgba(255,255,255,.72); border-left: 1px solid rgba(255,255,255,.18); padding-left: 18px; }
.fx-head .uses b { color: #7CF0C6; }
@media (max-width: 860px) { .fx-head { flex-wrap: wrap; } .fx-head .uses { margin-left: 0; max-width: none; border-left: 0; padding-left: 0; } }

.panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
@media (max-width: 1000px) { .panels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .panels { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.panel h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 17.5px; line-height: 1.25; color: var(--signal-ink); }
.panel h3 .n { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 16px; background: var(--signal); color: #fff; font-size: 15px; font-weight: 800; font-family: var(--body); }
.panel > p { margin: 0; color: var(--slate); font-size: 14px; line-height: 1.5; }
.panel.wide { grid-column: span 2; }
@media (max-width: 640px) { .panel.wide { grid-column: auto; } }

/* Drawing area inside a panel */
.viz { background: var(--ground); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; flex-wrap: nowrap; }
.col { display: grid; gap: 8px; justify-items: center; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.box { background: var(--surface); border: 1.5px solid var(--blue-line); border-radius: 12px; padding: 8px 10px; text-align: center; font-size: 13px; font-weight: 700; line-height: 1.35; color: var(--ink); min-width: 0; }
.box small { display: block; font-weight: 600; font-size: 11.5px; color: var(--muted); }
.box.blue { background: var(--signal-tint); border-color: var(--blue-line); }
.box.mint { background: var(--mint-tint); border-color: var(--mint-line); color: var(--mint-deep); }
.box.violet { background: var(--violet-tint); border-color: var(--violet-line); }
.box.amber { background: var(--amber-tint); border-color: var(--amber-line); color: var(--amber-ink); }
.box.dash { border-style: dashed; background: transparent; }
.box b { color: var(--signal-ink); }
.box.violet b { color: var(--violet); }
.arr { color: var(--signal); font-weight: 800; font-size: 18px; line-height: 1; flex: none; }
.arr.mint { color: var(--mint); }
.arr small { display: block; font-size: 10.5px; font-weight: 800; color: var(--muted); text-align: center; }
.down { text-align: center; color: var(--signal); font-weight: 800; line-height: 1; }
.down small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; margin-top: 2px; }

/* People and devices */
.dev { display: grid; justify-items: center; gap: 4px; font-size: 12.5px; font-weight: 800; color: var(--ink); text-align: center; flex: none; }
.dev svg { width: 40px; height: 40px; }
.dev .ph { color: var(--signal); }
.dev.sara .ph { color: var(--violet); }
.dev.srv .ph { color: var(--slate); }
.dev small { font-weight: 600; font-size: 11px; color: var(--muted); }
.wire { flex: 1; min-width: 28px; height: 0; border-top: 2.5px solid var(--signal); position: relative; }
.wire::after { content: ""; position: absolute; right: -2px; top: -6.5px; border: 5.5px solid transparent; border-left: 8px solid var(--signal); border-right: 0; }
.wire.both::before { content: ""; position: absolute; left: -2px; top: -6.5px; border: 5.5px solid transparent; border-right: 8px solid var(--signal); border-left: 0; }
.wire.mint { border-top: 4px solid var(--mint); }
.wire.mint::after { border-left-color: var(--mint); top: -7.5px; }
.wire.mint.both::before { border-right-color: var(--mint); top: -7.5px; }
.wire.dash { border-top-style: dashed; }
.wire-label { font-size: 11px; font-weight: 800; color: var(--muted); text-align: center; }

/* Notes, formulas, lists */
.note { border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.45; background: var(--signal-tint); color: var(--signal-ink); display: flex; gap: 8px; align-items: flex-start; }
.note svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.note.ok { background: var(--mint-tint); color: var(--mint-deep); }
.note.warn { background: var(--amber-tint); color: var(--amber-ink); }
.formula { background: var(--code-bg); color: var(--code-ink); border-radius: 12px; padding: 10px 12px; font: 12.5px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.formula .c { color: #7CF0C6; }
.formula .k { color: #A9BCFF; }
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--slate); }
.ticks li { position: relative; padding-left: 22px; line-height: 1.45; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 8px; height: 5px; border-left: 2.5px solid var(--mint); border-bottom: 2.5px solid var(--mint); transform: rotate(-45deg); }
.ticks.no li::before { width: 10px; height: 2.5px; border: 0; background: var(--muted); transform: none; top: 9px; }
.steps-n { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 6px; font-size: 13px; color: var(--slate); }
.steps-n li { counter-increment: s; display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; }
.steps-n li::before { content: counter(s); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 11px; background: var(--signal-tint); color: var(--signal-ink); font-weight: 800; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip { padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; background: var(--surface); border: 1px solid var(--line); color: var(--slate); }
.chip.mint { background: var(--mint-tint); border-color: var(--mint-line); color: var(--mint-deep); }
.chip.no { text-decoration: line-through; color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }

/* Yes / no decision rows */
.decide { display: grid; gap: 6px; }
.decide .q { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); gap: 6px; align-items: center; }
.decide .ask { border: 2px solid var(--signal); background: var(--surface); border-radius: 12px; padding: 7px 9px; font-weight: 800; font-size: 12.5px; text-align: center; }
.decide .yes { font-size: 10.5px; font-weight: 800; color: var(--mint-deep); text-align: center; border-bottom: 2.5px solid var(--mint); padding-bottom: 2px; }
.decide .no { font-size: 10.5px; font-weight: 800; color: var(--muted); padding-left: 22%; }

/* "The result" strip under each feature */
.result { margin-top: 14px; background: var(--signal-tint); border: 1px solid var(--blue-line); border-radius: 20px; padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.result div { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; font-size: 13px; color: var(--slate); line-height: 1.4; }
.result svg { width: 28px; height: 28px; color: var(--signal); }
.result b { display: block; color: var(--ink); font-size: 14px; }

/* Link card on the security page */
.diagram-link { display: flex; gap: 16px; align-items: center; background: var(--code-bg); color: #fff; border-radius: 20px; padding: 18px 20px; text-decoration: none; margin-top: 18px; }
.diagram-link:hover { color: #fff; filter: brightness(1.08); }
.diagram-link .badge { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--signal); }
.diagram-link .badge svg { width: 24px; height: 24px; }
.diagram-link b { display: block; font-size: 17px; }
.diagram-link span { color: rgba(255,255,255,.75); font-size: 14.5px; }

/* Flows with arrows run top to bottom: panels are too narrow for three boxes in a row. */
.row:has(> .arr) { flex-direction: column; flex-wrap: nowrap; gap: 4px; }
.row:has(> .arr) > .arr { transform: rotate(90deg); }
.row:has(> .arr) > .arr.eq { transform: none; }
.row:has(> .arr) > .box { max-width: 100%; }
.qr svg { width: 44px; height: 44px; color: var(--ink); display: block; }

/* Wide panels have room for a flow left to right. */
@media (min-width: 1001px) {
  .panel.wide .row:has(> .arr) { flex-direction: row; gap: 8px; }
  .panel.wide .row:has(> .arr) > .arr { transform: none; }
}

/* A panel across the whole row (desktop). */
@media (min-width: 1001px) { .panel.full { grid-column: 1 / -1; } }

/* Arabic pages: the flow reads right to left. */
[dir="rtl"] .fx-head .uses { margin-left: 0; margin-right: auto; border-left: 0; border-right: 1px solid rgba(255,255,255,.18); padding-left: 0; padding-right: 18px; }
@media (max-width: 860px) { [dir="rtl"] .fx-head .uses { margin-right: 0; border-right: 0; padding-right: 0; } }
[dir="rtl"] .wire::after { right: auto; left: -2px; border-left: 0; border-right: 8px solid var(--signal); }
[dir="rtl"] .wire.both::before { left: auto; right: -2px; border-right: 0; border-left: 8px solid var(--signal); }
[dir="rtl"] .wire.mint::after { border-right-color: var(--mint); }
[dir="rtl"] .wire.mint.both::before { border-left-color: var(--mint); }
[dir="rtl"] .ticks li { padding-left: 0; padding-right: 22px; }
[dir="rtl"] .ticks li::before { left: auto; right: 2px; }
[dir="rtl"] .decide .no { padding-left: 0; padding-right: 22%; }
[dir="rtl"] .formula, [dir="rtl"] .box.mono { direction: ltr; text-align: left; }
