/* PDFano — design system. Logical properties = full RTL/LTR support. */
:root {
  color-scheme: light;
  --accent: #e5322d;
  --accent-dark: #c4261f;
  --accent-soft: rgba(229, 50, 45, .09);
  --bg: #f7f7f9;
  --card: #ffffff;
  --text: #1c1e21;
  --muted: #65676b;
  --line: #e4e6eb;
  --ok: #1f8a4c;
  --ok-soft: rgba(31, 138, 76, .1);
  --shadow: 0 1px 3px rgba(0, 0, 0, .07);
  --radius: 14px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1015;
  --card: #181a20;
  --text: #e9eaee;
  --muted: #a2a6ad;
  --line: #2a2d35;
  --accent-soft: rgba(229, 50, 45, .16);
  --ok-soft: rgba(31, 138, 76, .18);
  --shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.header-in {
  max-width: 1080px; margin-inline: auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; }
.brand img { width: 30px; height: 30px; display: block; }
.brand .accent { color: var(--accent); }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; margin-inline-start: 4px; }
.nav-links a {
  padding: 7px 10px; border-radius: 9px; font-size: 14px; color: var(--muted); font-weight: 600;
}
.nav-links a:hover { background: var(--accent-soft); color: var(--accent); }
.controls { margin-inline-start: auto; display: flex; gap: 8px; }
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 6px 12px; font-size: 13px; font-weight: 700;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- layout ---------- */
main { max-width: 1080px; margin-inline: auto; padding: 22px 16px 48px; }
.hero { text-align: center; padding: 26px 0 8px; }
.hero h1 { font-size: clamp(26px, 5vw, 40px); margin: 0 0 10px; line-height: 1.25; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 640px; font-size: 17px; }
.badge {
  display: inline-block; background: var(--ok-soft); color: var(--ok);
  font-weight: 800; font-size: 13px; padding: 5px 14px; border-radius: 999px; margin-bottom: 14px;
}
h2.section { font-size: 22px; margin: 34px 0 6px; }
p.section-sub { color: var(--muted); margin: 0 0 18px; }

/* ---------- tool grid ---------- */
.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px;
}
.tool-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; gap: 14px; align-items: flex-start;
  box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease;
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.tool-ico {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 900; font-size: 12px;
}
.tool-card h3 { margin: 0 0 4px; font-size: 16px; }
.tool-card p { margin: 0; color: var(--muted); font-size: 13.5px; }

.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.why-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.why-card b { display: block; margin-bottom: 4px; }
.why-card span { color: var(--muted); font-size: 14px; }

/* ---------- tool page ---------- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--accent); font-weight: 700; }
.tool-head h1 { font-size: clamp(23px, 4vw, 32px); margin: 0 0 8px; }
.tool-head p { color: var(--muted); margin: 0 0 18px; max-width: 720px; }
.dropzone {
  background: var(--card); border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 38px 18px; text-align: center; transition: border-color .12s ease, background .12s ease;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .big { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.dropzone .or { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0;
  padding: 11px 22px; border-radius: 10px; font-weight: 800; font-size: 15px;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #17703c; }
.btn[hidden] { display: none; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 10px; font-size: 15px; }
.panel .hint { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }

.file-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--bg);
}
.file-row .nm { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.file-row .sz { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.file-row .grow { flex: 1 1 auto; min-width: 0; }
.icon-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 8px; width: 30px; height: 30px; font-size: 14px; line-height: 1;
}
.icon-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 5px 9px; font-size: 13.5px; font-weight: 700;
}
.chip .icon-btn { width: 24px; height: 24px; font-size: 12px; border: 0; background: transparent; }

label.field { display: block; font-weight: 700; font-size: 14px; margin: 0 0 6px; }
input[type="text"], select {
  width: 100%; max-width: 460px; padding: 10px 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text);
}
input[type="file"] { display: none; }
label.btn { cursor: pointer; }
.mt { margin-top: 12px; }
.radios { display: flex; gap: 10px; flex-wrap: wrap; }
.radios label {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; font-weight: 700; font-size: 14px;
  background: var(--bg); cursor: pointer;
}
.radios input { accent-color: var(--accent); }
.radios label:has(input:checked) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.privacy-note { color: var(--muted); font-size: 13.5px; margin-top: 14px; }

.result { background: var(--ok-soft); border: 1px solid transparent; border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.result h3 { margin: 0 0 10px; color: var(--ok); font-size: 16px; }
.result .dl-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.result .fname { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.error-box { background: var(--accent-soft); color: var(--accent); border-radius: var(--radius); padding: 14px 16px; margin-top: 14px; font-weight: 700; font-size: 14.5px; }

.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.img-cell { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.img-cell canvas { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); }
.img-cell .btn { padding: 6px 10px; font-size: 12.5px; margin-top: 8px; }

.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.step-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.step-card .num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff;
  display: inline-grid; place-items: center; font-weight: 900; font-size: 14px; margin-bottom: 6px;
}
.step-card b { display: block; font-size: 14.5px; }

.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; }
.faq summary { font-weight: 800; cursor: pointer; font-size: 14.5px; }
.faq p { color: var(--muted); margin: 8px 0 0; font-size: 14px; }

/* ---------- static pages / footer ---------- */
.page-body { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.page-body p { margin: 0 0 12px; font-size: 15px; }
.site-footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 30px; }
.footer-in {
  max-width: 1080px; margin-inline: auto; padding: 22px 16px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px;
}
.footer-in h4 { margin: 0 0 8px; font-size: 14px; }
.footer-in a { display: block; color: var(--muted); font-size: 13.5px; padding: 3px 0; }
.footer-in a:hover { color: var(--accent); }
.footer-base {
  max-width: 1080px; margin-inline: auto; padding: 12px 16px 20px;
  color: var(--muted); font-size: 13px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}

.nf { text-align: center; padding: 60px 0; }
.nf h1 { font-size: 42px; margin-bottom: 8px; }

@media (max-width: 640px) {
  .header-in { gap: 8px; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .nav-links a { white-space: nowrap; }
  .hero { padding-top: 14px; }
  .dropzone { padding: 26px 12px; }
}

/* ---------- v1.1: icons, a11y, responsive ---------- */
.tool-ico svg { width: 26px; height: 26px; display: block; }
.ico-red    { color: #e5322d; background: rgba(229, 50, 45, .09); }
.ico-amber  { color: #d97706; background: rgba(217, 119, 6, .11); }
.ico-green  { color: #0f8a5f; background: rgba(15, 138, 95, .10); }
.ico-blue   { color: #2563c4; background: rgba(37, 99, 196, .10); }
.ico-violet { color: #7c3aed; background: rgba(124, 58, 237, .10); }
.ico-teal   { color: #0e7f8f; background: rgba(14, 127, 143, .10); }
[data-theme="dark"] .ico-red    { background: rgba(229, 50, 45, .18); }
[data-theme="dark"] .ico-amber  { background: rgba(217, 119, 6, .20); }
[data-theme="dark"] .ico-green  { background: rgba(15, 138, 95, .20); }
[data-theme="dark"] .ico-blue   { background: rgba(37, 99, 196, .20); }
[data-theme="dark"] .ico-violet { background: rgba(124, 58, 237, .20); }
[data-theme="dark"] .ico-teal   { background: rgba(14, 127, 143, .20); }
.tool-glyph { margin-bottom: 10px; }
.tool-glyph svg { width: 46px; height: 46px; display: block; }
body[data-page="merge"]    .tool-glyph { color: #e5322d; }
body[data-page="split"]    .tool-glyph { color: #d97706; }
body[data-page="rotate"]   .tool-glyph { color: #0f8a5f; }
body[data-page="organize"] .tool-glyph { color: #2563c4; }
body[data-page="jpg2pdf"]  .tool-glyph { color: #7c3aed; }
body[data-page="pdf2jpg"]  .tool-glyph { color: #0e7f8f; }
.noscript { background: #b3261e; color: #fff; padding: 10px 16px; text-align: center; font-weight: 700; font-size: 14px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone { cursor: pointer; }
@media (max-width: 900px) {
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (max-width: 640px) {
  .btn-ghost { padding: 8px 12px; }
  .icon-btn { width: 34px; height: 34px; }
  .actions .btn { flex: 1 1 auto; text-align: center; }
  .img-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .footer-base { flex-direction: column; align-items: center; text-align: center; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .tool-glyph svg { width: 38px; height: 38px; }
}
@media (max-width: 400px) {
  .tool-card { padding: 14px; gap: 10px; }
  .tool-ico { width: 40px; height: 40px; border-radius: 10px; }
  .tool-ico svg { width: 22px; height: 22px; }
  .dropzone { padding: 22px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
