/* ───────────────────────────────────────────────────────────────────────────
   Onofit — single stylesheet. Dark, calm, utilitarian.
   ─────────────────────────────────────────────────────────────────────────── */
:root {
  --bg:        #0e0f13;
  --bg-2:      #15171d;
  --surface:   #1a1d25;
  --surface-2: #21252f;
  --line:      #2b303b;
  --text:      #e8eaf0;
  --muted:     #9aa1b1;
  --faint:     #6b7385;
  --accent:    #6d5efc;
  --accent-2:  #8b7bff;
  --ok:        #2f9e74;
  --err:       #e3514a;
  --radius:    14px;
  --radius-sm: 10px;
  --maxw:      1080px;
  --shadow:    0 10px 40px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.02em; }
code { font-family: 'JetBrains Mono', monospace; font-size: .9em; background: var(--bg-2); padding: .1em .4em; border-radius: 6px; }
.muted { color: var(--muted); }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 99; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; }

main { flex: 1 0 auto; }

/* ── Nav ──────────────────────────────────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 40; background: rgba(14,15,19,.82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.nav__inner { max-width: var(--maxw); margin: 0 auto; padding: 12px 22px; display: flex; align-items: center; gap: 18px; }
.nav__brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.03em; font-size: 18px; }
.nav__brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 800; }
.nav__search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; color: var(--faint); }
.nav__search:focus-within { border-color: var(--accent); color: var(--muted); }
.nav__search input { flex: 1; background: none; border: 0; color: var(--text); font: inherit; font-size: 14px; outline: none; }
.nav__links { display: flex; gap: 4px; }
.nav__link { color: var(--muted); font-size: 14px; font-weight: 500; padding: 7px 11px; border-radius: 8px; white-space: nowrap; }
.nav__link:hover { color: var(--text); background: var(--surface); }
@media (max-width: 820px) { .nav__links { display: none; } }
@media (max-width: 540px) { .nav__brand-name { display: none; } }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero { padding: 64px 22px 36px; text-align: center; }
.hero__inner { max-width: 720px; margin: 0 auto; }
.hero__title { font-size: clamp(30px, 5vw, 46px); font-weight: 800; background: linear-gradient(120deg, #fff, #b9b3ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__sub { color: var(--muted); font-size: clamp(15px, 2vw, 18px); margin: 16px auto 0; max-width: 560px; }
.hero__sub strong { color: var(--text); }
.hero__stat { display: flex; gap: 22px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.hero__stat span { font-size: 13px; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.hero__stat span::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ── Tool grid ────────────────────────────────────────────────────────── */
.tools { max-width: var(--maxw); margin: 0 auto; padding: 12px 22px 60px; }
.cat { margin-top: 38px; scroll-margin-top: 90px; }
.cat__head { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.cat__dot { width: 11px; height: 11px; border-radius: 50%; }
.cat__title { font-size: 19px; }
.cat__count { font-size: 12px; color: var(--faint); background: var(--surface); border: 1px solid var(--line); padding: 2px 9px; border-radius: 999px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 14px; }
.card { position: relative; display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; transition: transform .15s, border-color .15s, background .15s; }
.card:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--surface-2); }
.card__icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; color: var(--tint, var(--accent)); background: color-mix(in srgb, var(--tint, var(--accent)) 16%, transparent); }
.card__title { display: block; font-weight: 600; font-size: 15px; }
.card__blurb { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.card__badge { position: absolute; top: 12px; right: 12px; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.tools__empty { text-align: center; color: var(--faint); padding: 40px; }

/* ── Tool page chrome ─────────────────────────────────────────────────── */
.tool-wrap { max-width: 860px; margin: 0 auto; padding: 26px 22px 70px; }
.tool-head { margin-bottom: 26px; }
.tool-head__back { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 18px; }
.tool-head__back:hover { color: var(--text); }
.tool-head__main { display: flex; gap: 15px; align-items: center; }
.tool-head__icon { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; color: var(--tint, var(--accent)); background: color-mix(in srgb, var(--tint, var(--accent)) 16%, transparent); }
.tool-head__title { font-size: 26px; }
.tool-head__blurb { color: var(--muted); margin: 4px 0 0; font-size: 15px; }

/* ── Panels / drop zones / controls ───────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel + .panel { margin-top: 16px; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 40px 22px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.is-drag { border-color: var(--accent); background: var(--surface-2); }
.drop__icon { color: var(--faint); margin-bottom: 10px; }
.drop__title { font-weight: 600; }
.drop__hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.input, select, textarea {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text); font: inherit; font-size: 14px; padding: 10px 13px; outline: none; width: 100%;
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 130px; font-family: 'JetBrains Mono', monospace; line-height: 1.5; }
input[type=range] { accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

.btn { display: inline-flex; align-items: center; gap: 8px; justify-content: center; background: var(--accent); color: #fff; font: inherit; font-weight: 600; font-size: 14px; border: 0; border-radius: var(--radius-sm); padding: 11px 20px; cursor: pointer; transition: filter .15s, transform .1s; }
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn--ghost:hover { border-color: var(--accent); filter: none; }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 13px; font-size: 13px; }

/* file list */
.files { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 13px; }
.file-item__name { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item__size { color: var(--faint); font-size: 12px; }
.file-item__btn { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.file-item__btn:hover { color: var(--err); background: var(--surface-2); }
.file-item__handle { cursor: grab; color: var(--faint); }
.file-item.is-dragging { opacity: .4; }

.hint { color: var(--muted); font-size: 13px; }
.notice { background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 14px; color: var(--text); }
.notice--warn { background: color-mix(in srgb, var(--err) 10%, transparent); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.notice code { background: rgba(0,0,0,.3); }

.result-img { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 640px) { .preview-grid { grid-template-columns: 1fr; } }
.stat-line { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.stat-line b { color: var(--text); font-weight: 600; }

/* ── Prose (about / errors) ───────────────────────────────────────────── */
.prose { max-width: 680px; margin: 0 auto; padding: 50px 22px 70px; }
.prose--center { text-align: center; }
.prose h1 { font-size: 30px; margin-bottom: 14px; }
.prose h2 { font-size: 19px; margin: 30px 0 8px; }
.prose p { color: var(--muted); }
.prose .btn { margin-top: 22px; }
.error__code { font-size: 72px; font-weight: 800; color: var(--accent); }

/* ── Footer ───────────────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--line); background: var(--bg-2); margin-top: auto; }
.footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 28px 22px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.footer__brand { font-weight: 800; }
.footer__tag { color: var(--faint); font-size: 13px; margin: 2px 0 0; }
.footer__links { display: flex; gap: 18px; }
.footer__links a { color: var(--muted); font-size: 14px; }
.footer__links a:hover { color: var(--text); }
.footer__note { width: 100%; color: var(--faint); font-size: 12px; margin: 4px 0 0; }

/* ── Toasts ───────────────────────────────────────────────────────────── */
.toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: 11px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; }
.toast.is-in { opacity: 1; transform: translateY(0); }
.toast--ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.toast--err { border-color: color-mix(in srgb, var(--err) 50%, var(--line)); }

.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
