/* ==========================================================================
   PixelPress — style.css
   Modern, responsive, light/dark, RTL-aware stylesheet.
   No frameworks. No external fonts required (uses system font stack).
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --maxw: 1120px;
  --gap: 24px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06),
    0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.08),
    0 2px 6px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, 0.18);

  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Light theme palette (default) */
  --bg: #f6f8fc;
  --bg-grad-1: #eef2ff;
  --bg-grad-2: #f7f9ff;
  --bg-grad-3: #fef2f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e6eaf1;
  --border-strong: #d3dae6;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --muted: #94a3b8;

  --brand: #6d4aff;
  --brand-2: #a855f7;
  --brand-ink: #ffffff;
  --brand-soft: #efeaff;
  --brand-ring: rgba(109, 74, 255, 0.32);

  --accent: #ec4899;
  --success: #10b981;
  --success-soft: #e7f8f1;
  --warning: #f59e0b;
  --warning-soft: #fff4e0;
  --danger: #ef4444;
  --danger-soft: #fdecec;

  --overlay: rgba(15, 23, 42, 0.55);
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
}

/* Dark theme palette */
:root[data-theme="dark"] {
  --bg: #0b1020;
  --bg-grad-1: #131a33;
  --bg-grad-2: #0d1226;
  --bg-grad-3: #1a1330;
  --surface: #141a2e;
  --surface-2: #1a2137;
  --surface-3: #212a44;
  --border: #263048;
  --border-strong: #33405e;
  --text: #eef2fb;
  --text-2: #b6c2dc;
  --text-3: #93a1c0;
  --muted: #71809f;

  --brand: #8b6dff;
  --brand-2: #c084fc;
  --brand-ink: #0b1020;
  --brand-soft: #211a44;
  --brand-ring: rgba(139, 109, 255, 0.4);

  --accent: #f472b6;
  --success: #34d399;
  --success-soft: #10241d;
  --warning: #fbbf24;
  --warning-soft: #2a2010;
  --danger: #f87171;
  --danger-soft: #2a1414;

  --overlay: rgba(2, 6, 18, 0.7);
  --code-bg: #060a16;
  --code-text: #cbd5e1;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 28px 60px -16px rgba(0, 0, 0, 0.6);
}

/* ---------- Reset / base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(
      1200px 600px at 12% -8%,
      var(--bg-grad-1),
      transparent 60%
    ),
    radial-gradient(1000px 520px at 92% 0%, var(--bg-grad-3), transparent 55%),
    linear-gradient(180deg, var(--bg-grad-2), var(--bg));
  background-attachment: fixed;
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

img {
  max-width: 100%;
  display: block;
}

/* The hidden attribute must always win, even over flex/grid display rules. */
[hidden] {
  display: none !important;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--brand-2);
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}

p {
  margin: 0 0 1em;
  color: var(--text-2);
}

ul,
ol {
  color: var(--text-2);
}

code,
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface-3);
  padding: 0.12em 0.4em;
  border-radius: 6px;
  font-size: 0.9em;
  color: var(--text);
}

:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 1000;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: top var(--transition);
}
.skip-link:focus {
  top: 12px;
  color: var(--brand-ink);
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition),
    background var(--transition), border-color var(--transition),
    color var(--transition), opacity var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn:active {
  transform: translateY(0);
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn-primary {
  --btn-bg: linear-gradient(135deg, var(--brand), var(--brand-2));
  --btn-fg: var(--brand-ink);
  --btn-bd: transparent;
  box-shadow: 0 8px 20px -8px var(--brand-ring);
}
.btn-primary:hover {
  box-shadow: 0 12px 26px -8px var(--brand-ring);
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-bd: transparent;
}
.btn-soft {
  --btn-bg: var(--brand-soft);
  --btn-fg: var(--brand);
  --btn-bd: transparent;
}
.btn-danger {
  --btn-bg: transparent;
  --btn-fg: var(--danger);
  --btn-bd: var(--border-strong);
}
.btn-danger:hover {
  --btn-bg: var(--danger-soft);
  border-color: var(--danger);
}
.btn-block {
  width: 100%;
}
.btn-lg {
  padding: 15px 26px;
  font-size: 1.02rem;
}
.btn-sm {
  padding: 9px 14px;
  font-size: 0.88rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
    border-color var(--transition), transform var(--transition);
}
.icon-btn:hover {
  color: var(--brand);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 1.22rem;
  letter-spacing: -0.03em;
  color: var(--text);
}
.brand:hover {
  color: var(--text);
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex: none;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 16px -6px var(--brand-ring);
}
.brand-logo svg {
  width: 22px;
  height: 22px;
}
.brand b {
  font-weight: 800;
}
.brand span {
  color: var(--brand);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: 10px;
}
.main-nav a {
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
}
.main-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.main-nav a[aria-current="page"] {
  color: var(--brand);
  background: var(--brand-soft);
}

.header-tools {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-select {
  position: relative;
}
.lang-select > button {
  gap: 6px;
  padding-inline: 12px;
  height: 42px;
}
.lang-current {
  font-weight: 700;
  font-size: 0.9rem;
}
.lang-menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  min-width: 168px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 60;
}
.lang-menu.open {
  display: flex;
  animation: pop-in 160ms ease;
}
.lang-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: start;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.lang-menu button:hover {
  background: var(--surface-2);
}
.lang-menu button[aria-current="true"] {
  color: var(--brand);
  background: var(--brand-soft);
}
.lang-menu .flag {
  font-size: 1.1rem;
  line-height: 1;
}

.nav-toggle {
  display: none;
}

/* Mobile nav */
@media (max-width: 860px) {
  .main-nav {
    position: fixed;
    inset: 68px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 12px;
    margin: 0;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition);
    max-height: calc(100vh - 68px);
    overflow-y: auto;
  }
  .main-nav.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .main-nav a {
    padding: 13px 14px;
    font-size: 1rem;
  }
  .nav-toggle {
    display: inline-flex;
  }
}

/* ---------- Layout sections ---------- */
main {
  display: block;
}
.section {
  padding-block: clamp(48px, 7vw, 88px);
}
.section-tight {
  padding-block: clamp(32px, 5vw, 56px);
}
.section-head {
  max-width: 720px;
  margin-inline: auto;
  text-align: center;
  margin-bottom: 44px;
}
.section-head.left {
  text-align: start;
  margin-inline: 0;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
}
.section h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
}
.section-head p {
  font-size: 1.06rem;
  color: var(--text-2);
}

/* ---------- Hero ---------- */
.hero {
  padding-top: clamp(40px, 6vw, 72px);
  padding-bottom: clamp(24px, 4vw, 40px);
  text-align: center;
}
.hero .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.hero .badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}
.hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  letter-spacing: -0.035em;
  margin-bottom: 18px;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--brand), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero-lede {
  max-width: 640px;
  margin: 0 auto 18px;
  font-size: 1.14rem;
  color: var(--text-2);
}
.hero-privacy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--success);
  margin-bottom: 8px;
}
.hero-privacy svg {
  width: 18px;
  height: 18px;
}

/* ---------- Tool card ---------- */
.tool {
  margin-top: 30px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: clamp(18px, 3vw, 30px);
  text-align: start;
}

/* Dropzone */
.dropzone {
  position: relative;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  padding: clamp(28px, 5vw, 52px) 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition),
    transform var(--transition);
}
.dropzone:hover {
  border-color: var(--brand);
}
.dropzone:focus-visible {
  border-color: var(--brand);
}
.dropzone.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: scale(1.005);
}
.dropzone .dz-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.dropzone .dz-icon svg {
  width: 32px;
  height: 32px;
}
.dropzone h3 {
  font-size: 1.2rem;
  margin-bottom: 6px;
}
.dropzone p {
  color: var(--text-3);
  margin-bottom: 18px;
}
.dz-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 16px;
  margin-bottom: 0;
}

/* Global settings bar */
.settings-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 22px;
  padding: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field > label,
.field-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.field .hint {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 500;
}
input[type="text"],
input[type="number"],
input[type="email"],
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-inline-end: 38px;
}
:root[dir="rtl"] select {
  background-position: left 12px center;
  padding-inline-end: 13px;
  padding-inline-start: 38px;
}

/* Presets */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.preset {
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
}
.preset:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.preset.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

/* Toggle switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch .track {
  width: 42px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  position: relative;
  transition: background var(--transition);
  flex: none;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
.switch input:checked + .track {
  background: var(--brand);
}
.switch input:checked + .track::after {
  transform: translateX(18px);
}
:root[dir="rtl"] .switch input:checked + .track::after {
  transform: translateX(-18px);
}
.switch input:focus-visible + .track {
  box-shadow: 0 0 0 4px var(--brand-ring);
}
.switch .switch-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-2);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
}
.settings-actions .spacer {
  flex: 1;
}

/* ---------- Image queue ---------- */
.queue {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}
.img-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: rise 240ms ease both;
}
.img-card-body {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 18px;
  padding: 16px;
  align-items: start;
}
.thumb {
  width: 128px;
  height: 128px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--border);
}
.img-meta {
  min-width: 0;
}
.img-name {
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 8px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.chip {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-3);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
}
.chip.ok {
  color: var(--success);
  background: var(--success-soft);
}
.chip.warn {
  color: var(--warning);
  background: var(--warning-soft);
}

.img-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  padding: 0 16px 12px;
}
.dim-row {
  display: flex;
  align-items: end;
  gap: 8px;
}
.dim-row .field {
  flex: 1;
}
.lock-btn {
  height: 42px;
  width: 42px;
  flex: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all var(--transition);
}
.lock-btn.locked {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-soft);
}
.lock-btn svg {
  width: 18px;
  height: 18px;
}

.img-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  align-items: center;
}

/* Progress bar */
.progress {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
  margin: 4px 16px 12px;
}
.progress .bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 200ms ease;
}
.processing-note {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-2);
  padding: 0 16px 12px;
}

/* Result comparison */
.result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 16px 16px;
}
.result .stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.result .stat .k {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}
.result .stat .v {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.result .stat.highlight .v {
  color: var(--success);
}
.result .stat.full {
  grid-column: 1 / -1;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--brand-soft);
  border-top-color: var(--brand);
  animation: spin 0.7s linear infinite;
  flex: none;
}

/* Alerts / messages */
.alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  margin: 8px 16px 14px;
  border: 1px solid transparent;
}
.alert svg {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
}
.alert.info {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: transparent;
}
.alert.warn {
  background: var(--warning-soft);
  color: var(--warning);
}
.alert.error {
  background: var(--danger-soft);
  color: var(--danger);
}
.alert.success {
  background: var(--success-soft);
  color: var(--success);
}

.queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.queue-toolbar .count {
  font-weight: 700;
  color: var(--text);
}
.queue-toolbar .grp {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Toast */
.toast-wrap {
  position: fixed;
  inset-block-end: 22px;
  inset-inline-end: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 44px));
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--brand);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 0.9rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: rise 220ms ease both;
}
.toast.success {
  border-inline-start-color: var(--success);
}
.toast.error {
  border-inline-start-color: var(--danger);
}
.toast svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ---------- Feature grid / cards ---------- */
.grid {
  display: grid;
  gap: var(--gap);
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition),
    border-color var(--transition);
}
.card.hoverable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.card .ic {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 16px;
}
.card .ic svg {
  width: 24px;
  height: 24px;
}
.card h3 {
  font-size: 1.14rem;
  margin-bottom: 8px;
}
.card p {
  color: var(--text-3);
  font-size: 0.96rem;
  margin: 0;
}

.step {
  position: relative;
  padding-top: 8px;
}
.step .num {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--brand);
  background: var(--brand-soft);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

/* Tool link cards */
.tool-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.tool-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition),
    border-color var(--transition);
  color: var(--text);
}
.tool-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand);
  color: var(--text);
}
.tool-link .ic {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  flex: none;
}
.tool-link .ic svg {
  width: 21px;
  height: 21px;
}
.tool-link b {
  display: block;
  font-size: 0.98rem;
}
.tool-link small {
  color: var(--muted);
  font-size: 0.82rem;
}
.tool-link .arrow {
  margin-inline-start: auto;
  color: var(--muted);
  transition: transform var(--transition);
}
:root[dir="rtl"] .tool-link .arrow {
  transform: scaleX(-1);
}
.tool-link:hover .arrow {
  transform: translateX(3px);
  color: var(--brand);
}
:root[dir="rtl"] .tool-link:hover .arrow {
  transform: scaleX(-1) translateX(3px);
}

/* Preset tiles */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.preset-tile {
  text-align: center;
  padding: 26px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition),
    border-color var(--transition);
  color: var(--text);
}
.preset-tile:hover {
  transform: translateY(-4px);
  border-color: var(--brand);
  box-shadow: var(--shadow);
  color: var(--text);
}
.preset-tile .kb {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--brand), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.preset-tile small {
  display: block;
  color: var(--text-3);
  margin-top: 4px;
  font-size: 0.86rem;
}

/* ---------- FAQ ---------- */
.faq {
  max-width: 800px;
  margin-inline: auto;
  display: grid;
  gap: 12px;
}
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition);
}
.faq details[open] {
  border-color: var(--border-strong);
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  padding: 16px 0;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary .plus {
  width: 24px;
  height: 24px;
  flex: none;
  position: relative;
  transition: transform var(--transition);
  color: var(--brand);
}
.faq details[open] summary .plus {
  transform: rotate(45deg);
}
.faq details > div {
  padding-bottom: 18px;
  color: var(--text-2);
}
.faq details > div p:last-child {
  margin-bottom: 0;
}

/* ---------- Article ---------- */
.article {
  max-width: 760px;
  margin-inline: auto;
}
.article h2 {
  font-size: 1.7rem;
  margin-top: 1.4em;
}
.article h3 {
  font-size: 1.28rem;
  margin-top: 1.4em;
}
.article p,
.article li {
  color: var(--text-2);
  font-size: 1.02rem;
}
.article ul,
.article ol {
  padding-inline-start: 22px;
  margin-bottom: 1.2em;
}
.article li {
  margin-bottom: 0.5em;
}
.article strong {
  color: var(--text);
}
.prose-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 44px);
  box-shadow: var(--shadow-sm);
}

/* Legal / content pages */
.doc {
  max-width: 800px;
  margin-inline: auto;
}
.doc .prose-card h2 {
  font-size: 1.4rem;
  margin-top: 1.5em;
}
.doc .prose-card h2:first-child {
  margin-top: 0;
}
.doc .updated {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2em;
}
.page-hero {
  text-align: center;
  padding-block: clamp(40px, 6vw, 64px) 20px;
}
.page-hero h1 {
  font-size: clamp(2rem, 5vw, 2.9rem);
}
.page-hero p {
  max-width: 620px;
  margin-inline: auto;
  font-size: 1.08rem;
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 900px;
  margin-inline: auto;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.form-row {
  margin-bottom: 16px;
}
.form-row label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 7px;
}

/* ---------- Ad slots ---------- */
.ad-slot {
  margin-inline: auto;
  max-width: var(--maxw);
  padding: 14px 20px;
}
.ad-box {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  min-height: 90px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.ad-box span {
  opacity: 0.7;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 40px;
  padding-block: 52px 28px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 36px;
}
.footer-brand p {
  color: var(--text-3);
  font-size: 0.94rem;
  max-width: 280px;
  margin-top: 12px;
}
.footer-col h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 14px;
}
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 9px;
}
.footer-col a {
  color: var(--text-2);
  font-size: 0.94rem;
}
.footer-col a:hover {
  color: var(--brand);
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.9rem;
}
.footer-bottom .made {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* ---------- Animations ---------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 26px;
  }
}
@media (max-width: 720px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .img-card-body {
    grid-template-columns: 1fr;
  }
  .thumb {
    width: 100%;
    height: 200px;
  }
  .result {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .header-tools .label-text {
    display: none;
  }
}
@media (max-width: 420px) {
  .container {
    padding-inline: 16px;
  }
  .settings-bar {
    grid-template-columns: 1fr;
  }
}

/* Print */
@media print {
  .site-header,
  .site-footer,
  .ad-slot,
  .dropzone,
  .toast-wrap {
    display: none !important;
  }
}
