/* Same tokens and self-hosted fonts as miladmobaseri.ir (globals.css); the /fonts/ files
   exist on the site, locally the system font is used instead. */
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Medium.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/Poppins-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/fonts/Vazirmatn-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/fonts/Vazirmatn-Bold.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "AzarMehr"; src: url("/fonts/AzarMehr-Bold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #141414;
  --card: #1c1c1c;
  --text: #d9d9d9;
  --contrast: #ffffff;
  --muted: #8f8f8f;
  --border: #2c2c2c;
  --accent: #ff4d4f;
  --accent-strong: #d8302f;
  --accent-text: #ffffff;
  --radius: 14px;
  --heading: "Poppins", "Inter", system-ui, sans-serif;
  font-family: "Inter", system-ui, sans-serif;
}
:lang(fa) { font-family: "Vazirmatn", system-ui, sans-serif; --heading: "AzarMehr", "Vazirmatn", system-ui, sans-serif; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--accent); }
h1, h2 { font-family: var(--heading); color: var(--contrast); }
h1 { margin: 0 0 4px; font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { margin: 0 0 12px; font-size: 1.05rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
.muted { color: var(--muted); }
.credit { margin: 8px 0 0; font-size: .9rem; }
.back { display: inline-block; margin-bottom: 16px; font-size: .9rem; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--accent); }
.center { text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid .card { margin-bottom: 0; }
#editor > .grid { margin-bottom: 20px; }
@media (max-width: 800px) { .grid { grid-template-columns: 1fr; } }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 48px 16px; border: 2px dashed var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color .2s, background .2s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.drop-icon { font-size: 2.5rem; }

.view { position: relative; display: grid; place-items: center; min-height: 220px; background: var(--bg); border-radius: 8px; padding: 8px; }
.view img { max-width: 100%; max-height: 460px; border-radius: 4px; }
#art { image-rendering: pixelated; width: 100%; height: auto; object-fit: contain; }   /* art is tiny (true size); scale it up with hard edges */
#busy { position: absolute; }
.field { margin-bottom: 14px; }
.field label { display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: 6px; color: var(--contrast); }
.field output { color: var(--muted); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--accent); }
select { width: 100%; font: inherit; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 14px; }
.swatches span { width: 22px; height: 22px; border-radius: 4px; border: 1px solid rgb(255 255 255 / .12); }
.hint { font-size: .85rem; color: var(--muted); margin: -6px 0 14px; }

.btn {
  font: inherit; padding: 10px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--text); flex: 1;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, .segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { width: 100%; border-style: dashed; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 800px) { .controls { grid-template-columns: 1fr; } }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--bg); border-radius: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.segmented button {
  font: inherit; font-size: .9rem; flex: 1; padding: 8px 6px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.segmented button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }

textarea {
  width: 100%; font: inherit; padding: 10px; border-radius: 10px; margin-bottom: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical;
}
[data-vote].active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

.spinner {
  width: 36px; height: 36px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
footer p { margin: 4px 0; font-size: .85rem; }

/* background-removal specifics */
.checker { background: repeating-conic-gradient(#2a2a2a 0 25%, #1f1f1f 0 50%) 0 0 / 20px 20px; }
#result-canvas { max-width: 100%; max-height: 460px; border-radius: 4px; display: block; }
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 12px auto 0; max-width: 320px; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
input[type=color] { width: 44px; height: 36px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; }
.note { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }
