@font-face { font-family: "Instrument Sans"; src: url("fonts/instrument-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }
@font-face { font-family: "Unbounded"; src: url("fonts/unbounded-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Naskh"; src: url("fonts/noto-naskh-arabic-arabic-wght-normal.woff2") format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFC; }

:root {
  --ground: #e2f0f3;
  --panel: #ffffff;
  --ink: #10262c;
  --soft: rgb(16 38 44 / 0.6);
  --line: rgb(16 38 44 / 0.14);
  --grid: rgb(16 38 44 / 0.14);
  --accent: #d7263d;
  --on-accent: #ffffff;
  --ui: "Instrument Sans", "Plex Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ground: #0f1a1d; --panel: #16252a; --ink: #e2f0f3; --soft: rgb(226 240 243 / 0.62); --line: rgb(226 240 243 / 0.14); --grid: rgb(226 240 243 / 0.16); --accent: #ff5a6e; --on-accent: #1a0509; color-scheme: dark; }
}
:root[data-theme="dark"] { --ground: #0f1a1d; --panel: #16252a; --ink: #e2f0f3; --soft: rgb(226 240 243 / 0.62); --line: rgb(226 240 243 / 0.14); --grid: rgb(226 240 243 / 0.16); --accent: #ff5a6e; --on-accent: #1a0509; color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 500 15px/1.45 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.bar { display: flex; align-items: baseline; gap: 4px 20px; flex-wrap: wrap; padding: 14px 24px 10px; }
.brand { margin: 0; font: 700 24px/1 var(--ui); letter-spacing: -0.03em; }
.brand span { color: var(--accent); }
.purpose { flex: 1; margin: 0; color: var(--soft); }
.bar-meta { color: var(--soft); font-size: 13px; }
.bar-meta .lang { margin-inline-start: 12px; unicode-bidi: isolate; }
.app { display: flex; flex-direction: column; min-height: 100dvh; }

.bench { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; gap: 16px; padding: 0 24px 20px; }
.controls, .place, .grid-wrap { min-height: 0; border-radius: 4px; background: var(--panel); }
.controls, .place { display: flex; flex-direction: column; gap: 14px; padding: 16px; overflow-y: auto; }
.label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); }
.label small, .label output { font-weight: 500; letter-spacing: 0; text-transform: none; }
.field input[type="text"] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; background: transparent; }
.text-row { display: flex; gap: 8px; }
.text-row input { flex: 1; min-width: 0; font-size: 26px !important; font-weight: 700; text-align: center; }
.text-row input:disabled { opacity: 0.35; }
.ghost { display: inline-flex; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; background: transparent; font-weight: 600; white-space: nowrap; cursor: pointer; }
.ghost:hover { border-color: var(--ink); }
.upload:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: 8px; }
.actions .ghost { flex: 1; justify-content: center; }
.help { margin: 6px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--soft); }
.grid-help { margin: -6px 0 0; justify-self: stretch; }
.using { margin: 6px 0 0; font-size: 13.5px; }
.link { padding: 0; border: 0; background: none; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 6px; border: 0; background: none; font-weight: 600; }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.seg.small button { padding: 4px 10px; font-size: 13px; white-space: nowrap; }
.seg.small button { direction: ltr; } /* "16 px" stays in that order inside Arabic */
.seg i { width: 12px; height: 12px; background: currentColor; }
.s-rounded { border-radius: 3px; }
.s-circle { border-radius: 50%; }
.fonts button { font-size: 16px; }
.f-sans { font-family: "Instrument Sans", sans-serif !important; font-weight: 700 !important; }
.f-serif { font-family: "Fraunces", serif !important; font-weight: 700 !important; }
.f-mono { font-family: "JetBrains Mono", monospace !important; font-weight: 800 !important; font-size: 14px !important; }
.f-display { font-family: "Unbounded", sans-serif !important; font-weight: 800 !important; font-size: 13px !important; }

.colours { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.swatch { display: flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.swatch input { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; }
.check { display: flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.check input { accent-color: var(--accent); }
.presets { display: flex; gap: 6px; margin-top: 8px; }
.preset { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 4px; font-weight: 800; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

/* The pixel grid is the hero */
.grid-wrap { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; justify-items: center; gap: 12px; padding: 16px; }
.grid-wrap > .step, .grid-wrap > .warn { justify-self: stretch; }
.grid-head { display: flex; align-items: center; gap: 10px; justify-self: stretch; }
.grid-head .label { margin: 0; }
.grid { width: auto; height: 100%; max-width: 100%; aspect-ratio: 1; min-height: 0; image-rendering: pixelated;
  background: repeating-conic-gradient(var(--line) 0 25%, transparent 0 50%) 0 0 / 32px 32px; }
.step { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 16px/1.2 var(--ui); }
.step b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; }
/* Under the grid: the same icon where people will see it, each size once */
.live { display: grid; grid-template-columns: minmax(0, 260px) 120px; align-items: end; gap: 16px; justify-self: stretch; justify-content: center; }
.live figure { display: grid; gap: 6px; margin: 0; }
.tabs { gap: 4px !important; }
.where { font-size: 12px; color: var(--soft); text-align: center; }

/* In place */
.tab { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px 8px 0 0; font: 400 13px system-ui, sans-serif; }
.tab img { width: 16px; height: 16px; }
.tab span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab i { font-style: normal; opacity: 0.6; }
.tab.light { background: #ffffff; color: #202124; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.1); }
.tab.dark { background: #202124; color: #e8eaed; }
.warn { margin: 0; padding: 8px 10px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 14%, transparent); font-size: 13.5px; font-weight: 600; }
.phone { display: grid; justify-items: center; gap: 6px; padding: 14px 0 10px; border-radius: 4px; background: linear-gradient(160deg, #6d8fd8, #c96fa8); color: #fff; font: 500 12px system-ui, sans-serif; }
.phone img { width: 60px; height: 60px; border-radius: 14px; }
.phone span { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.primary { padding: 11px 16px; border: 0; border-radius: 4px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.snippet-head { display: flex; justify-content: space-between; align-items: baseline; }
.snippet-head .label { margin: 0; }
pre { direction: ltr; text-align: left; margin: 6px 0 0; padding: 10px; border-radius: 4px; background: var(--ground); font: 11.5px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.toast { position: fixed; left: 50%; bottom: 24px; margin: 0; padding: 10px 16px; border-radius: 4px; background: var(--ink); color: var(--ground); font-weight: 700; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { margin-inline-start: 8px; padding: 0; border: 0; background: none; color: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
@media (min-width: 1100px) and (min-height: 700px) { .app { height: 100dvh; } }
@media (max-width: 1099px) {
  .bench { grid-template-columns: 1fr; padding: 0 16px 20px; }
  .bar { padding-inline: 16px; }
  .purpose { flex-basis: 100%; order: 3; }
  .grid { width: 100%; height: auto; }
  .grid-wrap { order: -1; } /* see the icon first, then change it */
  .step b { display: none; } /* the order changes here, so the numbers would read 2, 1, 3 */
  .controls, .place { overflow: visible; }
}

/* Questions under the tool: for people who scroll, and for search engines */
.faq { max-width: 920px; margin: 0 auto; padding: 56px 20px 64px; }
.faq h2 { margin: 0 0 20px; font: 700 22px/1.2 var(--ui); letter-spacing: -0.02em; }
.faq-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px 32px; }
.faq h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.faq p { margin: 0; color: var(--soft); line-height: 1.6; }

/* Light/dark button (theme.js): follows the device until the visitor picks */
.theme { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-inline-start: 8px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; vertical-align: middle; }
.theme:hover { background: var(--line); }
.theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme .sun, .theme[data-dark="true"] .moon { display: none; }
.theme[data-dark="true"] .sun { display: block; }
