/* Lawha (لوحة) — site and editor styles. Font faces for the text tool are generated by build.mjs into fonts.css. */
@font-face { font-family: 'Readex Pro'; font-weight: 160 700; font-display: swap; src: url(/fonts/readex-arabic.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Readex Pro'; font-weight: 160 700; font-display: swap; src: url(/fonts/readex-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Readex Pro'; font-weight: 160 700; font-display: swap; src: url(/fonts/readex-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --brand: #6d5efc; --brand-2: #8b7dff; --brand-ink: #fff; --accent: #ffd166;
  --bg: #f7f6fb; --surface: #ffffff; --surface-2: #f0eef8; --ink: #17151f; --muted: #5d5a6b; --line: #e4e1ef;
  --radius: 14px; --gutter: 16px; --shadow: 0 10px 30px rgba(30, 20, 80, .08);
  --font: 'Readex Pro', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0f0e15; --surface: #17161f; --surface-2: #1f1d2a; --ink: #f1effa; --muted: #a7a3b8; --line: #2c2a3a; --shadow: 0 10px 30px rgba(0, 0, 0, .35); color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0f0e15; --surface: #17161f; --surface-2: #1f1d2a; --ink: #f1effa; --muted: #a7a3b8; --line: #2c2a3a; --shadow: 0 10px 30px rgba(0, 0, 0, .35); color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.65 var(--font); }
a { color: var(--brand); }
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.wrap { width: min(1120px, 100% - var(--gutter) * 2); margin-inline: auto; }
.skip { position: absolute; inset-inline-start: -9999px; }
.skip:focus { inset-inline-start: 8px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* ---------- site header and footer ---------- */
.site-top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.logo svg { width: 32px; height: 32px; }
.logo small { font-weight: 500; font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.site-top nav { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.site-top nav a { color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.site-top nav a:hover { background: var(--surface-2); }
.lang-sel { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 8px; font-size: .9rem; }
footer.site { border-top: 1px solid var(--line); margin-top: 64px; padding: 32px 0; color: var(--muted); font-size: .92rem; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
footer.site a { color: var(--muted); }

/* ---------- landing ---------- */
.hero { padding: 40px 0 8px; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.2; margin: 0 0 12px; letter-spacing: -.01em; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero .lead { font-size: clamp(1rem, 2.4vw, 1.2rem); color: var(--muted); max-width: 720px; margin: 0 auto 24px; }
.drop { position: relative; border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); background: var(--surface); border-radius: 22px; padding: 36px 20px; text-align: center; box-shadow: var(--shadow); transition: .15s; }
.drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); transform: scale(1.01); }
.drop h2 { margin: 8px 0 4px; font-size: 1.35rem; }
.drop .row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px 0 10px; }
.drop .art { width: 72px; height: 72px; margin: 0 auto; }
.badges { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; color: var(--muted); font-size: .9rem; margin-top: 14px; }
.badges span::before { content: '✓ '; color: #22a06b; font-weight: 700; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 10px 18px; cursor: pointer; font-weight: 600; text-decoration: none; min-height: 44px; }
.btn:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-lg { padding: 14px 26px; font-size: 1.08rem; border-radius: 14px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 28px 0; }
.tcard { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: .15s; }
.tcard:hover { border-color: var(--brand); transform: translateY(-1px); }
.tcard .ti { flex: none; width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); display: grid; place-items: center; }
.tcard .ti svg { width: 22px; height: 22px; }
.tcard b { display: block; font-size: .98rem; }
.tcard small { color: var(--muted); font-size: .82rem; line-height: 1.4; display: block; }
.seo { display: grid; gap: 28px; margin-top: 36px; }
.seo h2 { font-size: 1.4rem; margin: 0 0 10px; }
.seo ol { padding-inline-start: 22px; } .seo li { margin: 6px 0; }
.feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.feat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.feat h3 { margin: 0 0 6px; font-size: 1.02rem; }
.feat p { margin: 0; color: var(--muted); font-size: .94rem; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 8px 0; }
summary { cursor: pointer; font-weight: 600; }
.crumbs { font-size: .88rem; color: var(--muted); margin-top: 18px; }
.crumbs a { color: var(--muted); }
.prose { max-width: 760px; }
html.editing body { overflow: hidden; }
html.editing body > :not(#lw-editor):not(dialog) { visibility: hidden; }

/* ---------- editor (always dark, like most image editors) ---------- */
.ed { --e-bg: #121119; --e-panel: #1b1a24; --e-panel-2: #24222f; --e-line: #2f2d3d; --e-ink: #ecebf5; --e-muted: #9a97ad;
  position: fixed; inset: 0; z-index: 40; display: grid; grid-template-rows: 52px 1fr; background: var(--e-bg); color: var(--e-ink); color-scheme: dark; font-size: 14px; }
.ed[hidden] { display: none; }
.ed button { cursor: pointer; }
.ed-top { display: flex; align-items: center; gap: 6px; padding: 0 10px; background: var(--e-panel); border-bottom: 1px solid var(--e-line); min-width: 0; }
.ed-logo { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--e-ink); font-weight: 700; padding: 4px 6px; border-radius: 8px; }
.ed-logo svg { width: 28px; height: 28px; }
.ed-menus { display: flex; gap: 2px; min-width: 0; overflow: hidden; }
.ed-top svg, .ed-top .ib, .ed-logo, .ed-save { flex: none; }
.menu-all, .ed-sheet-bar { display: none; }
.menu { position: relative; }
.menu-btn { background: none; border: 0; color: var(--e-ink); padding: 7px 10px; border-radius: 8px; }
.menu-btn:hover, .menu.open .menu-btn { background: var(--e-panel-2); }
.menu-pop { display: none; position: absolute; top: calc(100% + 4px); inset-inline-start: 0; min-width: 230px; background: var(--e-panel-2); border: 1px solid var(--e-line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); z-index: 5; }
.menu.open .menu-pop { display: block; }
.menu-pop button { display: block; width: 100%; text-align: start; background: none; border: 0; color: var(--e-ink); padding: 8px 10px; border-radius: 8px; }
.menu-pop button:hover { background: var(--brand); color: #fff; }
.menu-pop hr { border: 0; border-top: 1px solid var(--e-line); margin: 4px 2px; }
.ed-zoom { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; }
.ed .sep { width: 1px; height: 22px; background: var(--e-line); margin: 0 4px; display: inline-block; }
.ib { display: inline-grid; place-items: center; width: 36px; height: 36px; background: none; border: 0; border-radius: 9px; color: var(--e-ink); }
.ib:hover { background: var(--e-panel-2); } .ib.on { background: var(--brand); color: #fff; }
.ib:disabled { opacity: .35; cursor: default; }
.ib svg { width: 19px; height: 19px; }
.zoom-val { background: none; border: 0; color: var(--e-muted); min-width: 56px; padding: 6px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.ed-save { min-height: 36px; padding: 6px 14px; margin-inline-start: 6px; }
.ed-body { display: grid; grid-template-columns: 56px 1fr 300px; min-height: 0; }
.ed-tools { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; background: var(--e-panel); border-inline-end: 1px solid var(--e-line); }
.tool { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: none; border: 0; color: var(--e-ink); }
.tool:hover { background: var(--e-panel-2); } .tool.on { background: var(--brand); color: #fff; }
.tool svg { width: 21px; height: 21px; }
.swatch { margin-top: 8px; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--e-line); cursor: pointer; }
.swatch input { width: 150%; height: 150%; margin: -25%; border: 0; padding: 0; cursor: pointer; }
.ed-stage { position: relative; overflow: hidden; background: #0c0b11; touch-action: none; }
.ed-stage canvas { position: absolute; inset: 0; }
.toast { position: absolute; inset-inline-start: 50%; bottom: 18px; transform: translate(-50%, 20px); background: rgba(20, 18, 30, .92); color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; max-width: 90%; text-align: center; border: 1px solid var(--e-line); }
[dir="rtl"] .toast { transform: translate(50%, 20px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); } [dir="rtl"] .toast.on { transform: translate(50%, 0); }
.ed-side { background: var(--e-panel); border-inline-start: 1px solid var(--e-line); display: grid; grid-template-rows: minmax(0, auto) minmax(180px, 1fr); min-height: 0; }
.ed-props { padding: 12px 14px; overflow: auto; max-height: 58vh; border-bottom: 1px solid var(--e-line); }
.ed-props h2, .ed-layers h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--e-muted); margin: 0 0 10px; }
.ed-props h3 { font-size: 13px; margin: 6px 0 8px; color: var(--e-muted); }
.ed-props .hint { margin: 0 0 12px; font-size: 13px; color: var(--e-muted); }
.field { display: grid; gap: 4px; margin: 0 0 10px; font-size: 13px; color: var(--e-muted); }
.field b { color: var(--e-ink); font-weight: 600; }
.field input[type="range"] { width: 100%; accent-color: var(--brand); }
.ed input[type="number"], .ed input[type="text"], .ed select, .ed textarea { background: var(--e-panel-2); border: 1px solid var(--e-line); border-radius: 8px; padding: 7px 9px; color: var(--e-ink); width: 100%; }
.ed textarea { resize: vertical; font-size: 15px; margin-bottom: 10px; }
.ed input[type="color"] { width: 100%; height: 34px; border: 1px solid var(--e-line); border-radius: 8px; background: var(--e-panel-2); padding: 2px; }
.row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; } .row > .field { flex: 1; min-width: 90px; }
.row.seg { gap: 2px; margin-bottom: 10px; } .row.sticky { position: sticky; bottom: -12px; background: var(--e-panel); padding: 10px 0 2px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0; color: var(--e-ink); }
.check input[type="color"] { width: 40px; height: 26px; margin-inline-start: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { background: var(--e-panel-2); border: 1px solid var(--e-line); border-radius: 99px; padding: 5px 11px; color: var(--e-ink); font-size: 13px; display: inline-flex; gap: 6px; align-items: baseline; }
.chip small { color: var(--e-muted); font-size: 11px; } .chip.on, .chip:hover { border-color: var(--brand); }
.chip.on { background: color-mix(in srgb, var(--brand) 30%, var(--e-panel-2)); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ed .btn { background: var(--e-panel-2); border-color: var(--e-line); color: var(--e-ink); font-size: 13px; padding: 8px 12px; min-height: 38px; }
.ed .btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.looks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.look { background: none; border: 2px solid transparent; border-radius: 10px; padding: 3px; color: var(--e-ink); font-size: 11.5px; display: grid; gap: 3px; justify-items: center; }
.look canvas { width: 100%; height: auto; aspect-ratio: 1; border-radius: 7px; background: #000; }
.look.on { border-color: var(--brand); }
.ed-layers { display: flex; flex-direction: column; min-height: 0; padding: 12px 10px 8px; }
.ed-layers header { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.ed-layers header h2 { margin: 0; }
.layer-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 4px; }
.layer-opts label { display: grid; gap: 3px; font-size: 12px; color: var(--e-muted); } .layer-opts.off { opacity: .4; pointer-events: none; }
.layer-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.layer { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.layer:hover { background: var(--e-panel-2); } .layer.on { background: color-mix(in srgb, var(--brand) 22%, var(--e-panel)); border-color: color-mix(in srgb, var(--brand) 60%, transparent); }
.layer .thumb { width: 44px; height: 44px; border-radius: 6px; background: repeating-conic-gradient(#3a3848 0 25%, #2a2836 0 50%) 0 0 / 10px 10px; flex: none; }
.layer .lname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.show-sm { display: none !important; }

/* dialogs */
.dlg { border: 1px solid var(--e-line, #2f2d3d); border-radius: 18px; padding: 0; background: #1b1a24; color: #ecebf5; width: min(460px, 100% - 24px); box-shadow: 0 30px 80px rgba(0, 0, 0, .55); color-scheme: dark; font-size: 14px; }
.dlg::backdrop { background: rgba(8, 6, 16, .6); backdrop-filter: blur(3px); }
.dlg header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.dlg h2 { margin: 0; font-size: 17px; }
.dlg-body { padding: 8px 16px; }
.dlg footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 16px; }
.dlg .btn { background: #24222f; border-color: #2f2d3d; color: #ecebf5; }
.dlg .btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.dlg .field { color: #9a97ad; } .dlg input, .dlg select { background: #24222f; border: 1px solid #2f2d3d; border-radius: 8px; padding: 8px 10px; color: #ecebf5; width: 100%; }
.dlg .chip { background: #24222f; border: 1px solid #2f2d3d; color: #ecebf5; }
.dlg .muted { color: #9a97ad; }
.seg.fmt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #24222f; padding: 4px; border-radius: 10px; margin-bottom: 12px; }
.seg.fmt button { border: 0; background: none; color: #ecebf5; padding: 8px; border-radius: 7px; font-weight: 600; }
.seg.fmt button.on { background: var(--brand); color: #fff; }
.est { background: #24222f; border-radius: 10px; padding: 10px 12px; margin: 4px 0 0; }
.est b { font-size: 16px; } .est small { color: #9a97ad; margin-inline-start: 8px; }
.warn { color: #ffb86b; font-size: 13px; }

/* ---------- phones and narrow windows ---------- */
@media (max-width: 860px) {
  /* Phone layout: canvas on top, the panel as a sheet under it (the canvas shrinks and refits, so the photo stays in view), tools at the bottom. */
  .ed-menus .menu { display: none; } .ed-menus .menu-all { display: block; }
  .menu-all .menu-pop { max-height: 70vh; overflow: auto; }
  .ed[data-sheet="props"] .ed-layers, .ed[data-sheet="layers"] .ed-props { display: none; }
  .ed-sheet-bar { display: flex; justify-content: flex-end; position: sticky; top: 0; height: 0; z-index: 2; overflow: visible; }
  .ed-sheet-bar .ib { margin: 6px 6px 0; background: var(--e-panel-2); }
  .hide-sm { display: none !important; } .show-sm { display: inline-grid !important; }
  .ed-save span { display: none; } .ed-save { padding: 6px 10px; }
  .ed-logo span { display: none; }
  .ed-body { display: flex; flex-direction: column; }
  .ed-stage { order: 1; flex: 1 1 auto; min-height: 140px; }
  .ed-side { order: 2; display: none; flex: 0 1 auto; max-height: 48%; overflow: auto; border: 0; border-top: 1px solid var(--e-line); border-radius: 16px 16px 0 0; margin-top: -8px; position: relative; z-index: 1; }
  .ed.side-open .ed-side { display: block; }
  .ed-props { max-height: none; }
  .ed-layers { min-height: 0; }
  .ed-tools { order: 3; flex: 0 0 60px; flex-direction: row; justify-content: center; border: 0; border-top: 1px solid var(--e-line); padding: 0 6px; overflow-x: auto; }
  .swatch { margin: 0 6px; }
}
@media (max-width: 420px) { .tool { width: 40px; height: 40px; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
