/* WandFile design system — one source of truth for every page.
   Tokens → base → components. Light theme only (deliberate, consistent). */

:root {
  --brand: #4f35d6;        /* violet: the "wand" */
  --brand-ink: #3a24a6;
  --brand-soft: #eeeafc;
  --accent: #f08a24;       /* spark */
  --ok: #157f4b;
  --ok-soft: #e4f5ec;
  --warn: #a35a00;
  --warn-soft: #fff3df;
  --danger: #b3261e;
  --text: #17162b;
  --muted: #5d5b74;
  --line: #e4e2ef;
  --bg: #fbfaff;
  --surface: #ffffff;
  --maxw: 72rem;
  --maxw-prose: 46rem;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(23, 22, 43, 0.06), 0 8px 24px -12px rgba(79, 53, 214, 0.18);
  --sp-1: 0.5rem; --sp-2: 1rem; --sp-3: 1.5rem; --sp-4: 2.5rem; --sp-5: 4rem;
  --fs-xs: 0.8125rem; --fs-sm: 0.9375rem; --fs-md: 1.0625rem; --fs-lg: 1.375rem; --fs-xl: 2rem; --fs-xxl: 2.75rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: 1.6; color: var(--text); background: var(--bg); }
img, svg, video, canvas { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--sp-2); letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 4vw, var(--fs-xxl)); font-weight: 800; }
h2 { font-size: var(--fs-lg); font-weight: 700; margin-top: var(--sp-4); }
h3 { font-size: var(--fs-md); font-weight: 700; }
p { margin: 0 0 var(--sp-2); }
a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 0.15em; }
a:hover { color: var(--brand); }
.state-grid a, .site-nav a, .card a, .site-footer nav a, .btn, .tool-grid a { text-decoration: none; }
small, .fineprint { font-size: var(--fs-xs); color: var(--muted); }
code { font-family: var(--mono); background: var(--brand-soft); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--sp-3); }
.prose { max-width: var(--maxw-prose); }
.prose ol, .prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: 0.35em; }

/* ---------- header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: var(--sp-3); min-height: 3.5rem; flex-wrap: wrap; }
.wordmark { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.wordmark:hover { color: var(--brand); }
.site-nav { margin-left: auto; display: flex; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; align-items: center; }
.site-nav a { color: var(--text); font-size: var(--fs-sm); font-weight: 600; }
.site-nav a:hover { color: var(--brand); }
.lang-switch { position: relative; }
.lang-switch summary { list-style: none; cursor: pointer; font-size: var(--fs-sm); font-weight: 600; border: 1px solid var(--line); border-radius: 999px; padding: 0.2em 0.8em; background: var(--surface); }
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch ul { position: absolute; right: 0; top: 2.2rem; margin: 0; padding: 0.4rem; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 11rem; display: grid; gap: 0.1rem; z-index: 20; }
.lang-switch li a { display: block; padding: 0.35rem 0.7rem; border-radius: 8px; font-size: var(--fs-sm); color: var(--text); text-decoration: none; }
.lang-switch li a:hover, .lang-switch li a[aria-current] { background: var(--brand-soft); color: var(--brand-ink); }

/* ---------- breadcrumbs / hero ---------- */
.breadcrumbs { font-size: var(--fs-xs); color: var(--muted); margin: var(--sp-3) 0 var(--sp-2); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs span[aria-hidden] { margin: 0 0.4em; }
.hero { padding: var(--sp-4) 0 var(--sp-3); }
.hero .lede { font-size: 1.15rem; color: var(--muted); max-width: var(--maxw-prose); }
.badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: var(--sp-2) 0 0; }
.badge { display: inline-flex; align-items: center; gap: 0.35em; font-size: var(--fs-xs); font-weight: 600; color: var(--ok); background: var(--ok-soft); border-radius: 999px; padding: 0.2em 0.7em; }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3); box-shadow: var(--shadow); }
.card h3 { margin-bottom: 0.4rem; }
.card p { color: var(--muted); font-size: var(--fs-sm); margin-bottom: 0.5rem; }
.grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.tool-grid { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); padding: 0; margin: var(--sp-2) 0 var(--sp-4); list-style: none; }
.tool-grid a { display: flex; gap: 0.7rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem 0.9rem; color: var(--text); font-weight: 600; font-size: var(--fs-sm); transition: border-color 0.15s, transform 0.15s; }
.tool-grid a:hover { border-color: var(--brand); color: var(--brand-ink); transform: translateY(-1px); }
.tool-grid .ic { width: 2rem; height: 2rem; border-radius: 8px; display: grid; place-items: center; font-size: 0.7rem; font-weight: 800; color: #fff; background: var(--brand); flex: none; letter-spacing: 0.02em; }
.ic.image { background: #2a7de1; } .ic.pdf { background: #d1413a; } .ic.audio { background: #0f9d75; } .ic.video { background: #8b3ad6; } .ic.text { background: #5d5b74; }

/* ---------- the tool ---------- */
.tool { margin: var(--sp-3) 0 var(--sp-4); }
.dropzone { border: 2px dashed var(--brand); border-radius: var(--radius); background: var(--surface); padding: var(--sp-4) var(--sp-3); text-align: center; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.dropzone:hover, .dropzone.is-over { background: var(--brand-soft); }
.dropzone.is-over { border-style: solid; }
.dropzone .big { font-size: 1.15rem; font-weight: 700; margin: 0.5rem 0 0.25rem; }
.dropzone .hint { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.dropzone input[type="file"] { display: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5em; border: 0; border-radius: 10px; padding: 0.7em 1.4em; font: inherit; font-weight: 700; cursor: pointer; background: var(--brand); color: #fff; transition: background 0.15s; }
.btn:hover { background: var(--brand-ink); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--ghost { background: var(--surface); color: var(--brand-ink); border: 1px solid var(--line); }
.btn--ghost:hover { background: var(--brand-soft); color: var(--brand-ink); }
.btn--sm { padding: 0.45em 0.9em; font-size: var(--fs-sm); }
.options { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3); margin-top: var(--sp-2); }
.field label { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: 0.3rem; }
.field input[type="number"], .field input[type="text"], .field select, .field textarea { width: 100%; font: inherit; padding: 0.55em 0.7em; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.field input[type="range"] { width: 100%; accent-color: var(--brand); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); margin: 0.25rem 0 0; }
.field--check { display: flex; align-items: center; gap: 0.6rem; }
.field--check label { margin: 0; }
.actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; margin-top: var(--sp-2); }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; flex: 1; min-width: 8rem; }
.progress > span { display: block; height: 100%; width: 0; background: var(--brand); transition: width 0.2s; }
.status { font-size: var(--fs-sm); color: var(--muted); margin: 0; }
.status.is-error { color: var(--danger); }
.files { list-style: none; padding: 0; margin: var(--sp-2) 0 0; display: grid; gap: 0.5rem; }
.files li { display: grid; grid-template-columns: 3rem 1fr auto; gap: 0.8rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.8rem; }
.files .thumb { width: 3rem; height: 3rem; border-radius: 6px; background: var(--brand-soft); object-fit: cover; display: grid; place-items: center; font-size: 0.65rem; font-weight: 800; color: var(--brand-ink); }
.files .name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .meta { font-size: var(--fs-xs); color: var(--muted); }
.files .meta .saved { color: var(--ok); font-weight: 700; }
.files .rm { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0.3rem; }
.files .rm:hover { color: var(--danger); }
.files .order { display: inline-flex; gap: 0.2rem; }
.files .order button { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; cursor: pointer; font: inherit; padding: 0.1rem 0.45rem; }
.results { margin-top: var(--sp-3); background: var(--ok-soft); border: 1px solid #bfe3cf; border-radius: var(--radius); padding: var(--sp-3); }
.results h2 { margin-top: 0; font-size: var(--fs-md); }
.results .files li { background: var(--surface); }
.textarea-tool textarea { min-height: 12rem; font-family: var(--mono); font-size: var(--fs-sm); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: var(--sp-2); margin-top: var(--sp-2); }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.9rem; }
.stats b { display: block; font-size: 1.4rem; }
.stats span { font-size: var(--fs-xs); color: var(--muted); }
.qr-out { display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3); margin-top: var(--sp-2); }

/* ---------- notices, faq, tables ---------- */
.notice { border-left: 4px solid var(--accent); background: var(--warn-soft); padding: var(--sp-2) var(--sp-3); border-radius: 0 var(--radius) var(--radius) 0; margin: var(--sp-2) 0; font-size: var(--fs-sm); }
.notice--privacy { border-left-color: var(--ok); background: var(--ok-soft); }
.faq details { border-bottom: 1px solid var(--line); padding: 0.75rem 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 0.6rem 0 0; color: var(--muted); }
.table-scroll { overflow-x: auto; margin: var(--sp-3) 0; }
table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 2.4rem; margin-bottom: 0.6rem; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0.05rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: var(--fs-sm); display: grid; place-items: center; }

/* ---------- footer ---------- */
.site-footer { margin-top: var(--sp-5); padding: var(--sp-4) 0; border-top: 1px solid var(--line); background: var(--surface); font-size: var(--fs-sm); color: var(--muted); }
.site-footer nav { display: flex; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.site-footer nav a { color: var(--text); font-weight: 600; }
.site-footer nav a:hover { color: var(--brand); }
.site-footer .langs a { font-weight: 500; }

@media (max-width: 40rem) {
  .site-header .wrap { min-height: 3rem; }
  .site-nav { gap: var(--sp-2); font-size: var(--fs-xs); }
  .files li { grid-template-columns: 2.5rem 1fr auto; }
  .hero { padding-top: var(--sp-3); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
