/* OperaPDF — plain CSS, no preprocessor. Tokens first, then base, layout, components. */

:root {
  --primary: #e0352c;
  --primary-dark: #c52c24;
  --primary-tint: #fdeceb;
  --text: #2f2f38;
  --muted: #666674;
  --bg: #f2eff9;
  --surface: #fff;
  --border: #ddd8ec;
  --focus: #2f6fe0;
  --radius: 6px;
  --shadow: 0 2px 6px rgba(40, 30, 80, 0.08);
  --shadow-lg: 0 8px 24px rgba(40, 30, 80, 0.14);
  --header-h: 68px;
  --container: 1180px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* per-category accent, used by tool cards and tool heroes */
.cat-organize { --cat: #e0463b; }
.cat-optimize { --cat: #3ea34c; }
.cat-to-pdf { --cat: #ee9f1d; }
.cat-from-pdf { --cat: #2f7fe6; }
.cat-edit { --cat: #8a4ed4; }
.cat-security { --cat: #2c3a56; }
.cat-ocr { --cat: #13a38b; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--text); background: var(--bg); }
img, svg { max-width: 100%; }
a { color: var(--primary-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.8rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: var(--radius); }
.skip-link:focus { left: 8px; }
.icon { width: 1.25em; height: 1.25em; flex: none; }
.center { text-align: center; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--surface); box-shadow: 0 1px 0 var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 1.45rem; letter-spacing: -.02em; }
.logo strong { color: var(--primary); }
.logo-mark { width: 32px; height: 32px; color: var(--primary); }
.site-nav { display: flex; align-items: center; gap: 4px; }
.nav-link { font: inherit; font-size: .84rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--text); text-decoration: none; background: none; border: 0; padding: 10px 12px; border-radius: var(--radius); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.nav-link:hover, .nav-menu-btn[aria-expanded="true"] { color: var(--primary); background: var(--primary-tint); }
.nav-link .icon { width: 1em; height: 1em; }
.nav-item { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 18px; display: flex; gap: 28px; min-width: 240px; }
.nav-item-static { position: static; }
.header-inner { position: relative; }
.menu-wide { left: auto; right: 20px; top: calc(100% - 6px); width: min(1000px, calc(100vw - 40px)); flex-wrap: wrap; }
.menu-col { display: flex; flex-direction: column; min-width: 150px; flex: 1; }
.menu-heading { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; margin: 0 0 6px; }
.menu-col a { color: var(--text); text-decoration: none; padding: 5px 0; font-size: .92rem; }
.menu-col a:hover { color: var(--primary); }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; color: var(--text); cursor: pointer; }
.nav-toggle .icon { width: 28px; height: 28px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 1rem; padding: 11px 22px; border-radius: var(--radius); border: 2px solid transparent; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s, box-shadow .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: rgba(0,0,0,.05); }
.btn-lg { font-size: 1.1rem; padding: 14px 30px; }
.btn-xl { font-size: 1.4rem; padding: 20px 52px; box-shadow: 0 4px 14px rgba(224, 53, 44, .3); }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.is-busy:disabled { opacity: .85; cursor: progress; }
.btn.is-busy::before { content: ""; width: 1em; height: 1em; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.field-label { font-size: .88rem; font-weight: 600; padding: 0; }
.field-hint { font-size: .82rem; color: var(--muted); margin: 0; }
.input { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
input.input[type="color"] { height: 44px; padding: 4px; cursor: pointer; }
.input:hover { border-color: #b9b1d3; }
.input:focus-visible { border-color: var(--focus); outline-offset: 0; }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea.input { resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.radio-group { border: 0; padding: 0; margin: 0; gap: 8px; }
.range { display: flex; align-items: center; gap: 12px; }
.range input { flex: 1; accent-color: var(--primary); }
.range output { min-width: 2.5em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Feedback ---------- */
.notice { padding: 12px 16px; border-radius: var(--radius); margin: 0 0 16px; font-size: .95rem; border-left: 4px solid; }
.notice-info { background: #e8f0fd; border-color: #2f6fe0; color: #1f3f7a; }
.notice-warning { background: #fff4e0; border-color: #e09a1a; color: #6b4300; }
.notice-success { background: #e3f5ea; border-color: #2c9a56; color: #14522c; }
.badge { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.badge-neutral { background: #ebe8f5; color: var(--muted); }
.badge-soon { background: #fff1d6; color: #8a5a00; }
.progress { margin: 16px 0; display: flex; flex-direction: column; gap: 6px; }
.progress progress { width: 100%; height: 10px; accent-color: var(--primary); }
.progress-label { font-size: .88rem; color: var(--muted); }

/* ---------- Breadcrumb / chips ---------- */
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 14px; font-size: .85rem; color: var(--muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--border); }
.breadcrumb a { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 28px; }
.chip { font: inherit; font-size: .9rem; font-weight: 600; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--text); }
.chip[aria-selected="true"] { background: var(--text); border-color: var(--text); color: #fff; }

/* ---------- Home ---------- */
.hero { text-align: center; padding: 56px 0 28px; }
.hero h1 { max-width: 880px; margin: 0 auto 16px; }
.hero-sub { max-width: 720px; margin: 0 auto 22px; font-size: 1.15rem; color: var(--muted); }
.pill-row { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pill-row li { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: .92rem; box-shadow: var(--shadow); }
.pill-row .icon { color: #1d8a4a; }
.tools-section { padding: 16px 0 56px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 18px; }
.tool-card { display: block; background: var(--surface); border-radius: var(--radius); padding: 24px 22px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); border-top: 3px solid transparent; transition: transform .15s, box-shadow .15s, border-color .15s; min-height: 170px; }
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-top-color: var(--cat, var(--primary)); }
.tool-card { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-content: start; }
.tool-card-icon { display: inline-flex; align-items: center; color: var(--cat, var(--primary)); margin-bottom: 10px; }
.tool-card-icon .icon { width: 36px; height: 36px; }
.tool-card-title { align-self: center; margin: 0 0 10px; font-size: 1.05rem; line-height: 1.25; }
.tool-card-desc { grid-column: 1 / -1; margin: 0; font-size: .9rem; color: var(--muted); }
.tool-card.is-hidden { display: none; }
/* Home page grid: 5 columns on wide screens, stepping down on smaller ones */
#tool-grid { grid-template-columns: repeat(5, 1fr); }
#tool-grid .tool-card { padding: 22px 18px; }
@media (max-width: 1100px) { #tool-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 860px) { #tool-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) { #tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 400px) { #tool-grid { grid-template-columns: 1fr; } }
.info-section { background: var(--surface); padding: 56px 0; }
.info-section h2 { text-align: center; margin-bottom: 28px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.info-card .icon { width: 38px; height: 38px; color: var(--primary); margin-bottom: 8px; }
.info-card p { color: var(--muted); margin: 0; }

/* ---------- Tool page ---------- */
.tool-hero { padding: 36px 0 44px; text-align: center; }
.tool-hero .breadcrumb ol { justify-content: center; }
.tool-lead { max-width: 720px; margin: 0 auto 28px; font-size: 1.12rem; color: var(--muted); }
.workspace { max-width: 860px; margin: 0 auto; text-align: left; }
.dropzone { display: block; background: var(--surface); border: 2px dashed #c9c2e0; border-radius: 10px; padding: 52px 20px; text-align: center; transition: border-color .15s, background-color .15s; }
.dropzone.is-dragover { border-color: var(--primary); background: var(--primary-tint); }
.dropzone-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.dropzone-icon .icon { width: 44px; height: 44px; color: var(--cat, var(--primary)); }
.dropzone-hint { margin: 0; color: var(--muted); }
.dropzone-private { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: .85rem; color: #1d6b3a; }
.dropzone-private .icon { width: 1em; height: 1em; }
.workspace-privacy { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 18px 0 0; font-size: .9rem; color: var(--muted); }
.workspace-privacy .icon { color: #1d8a4a; }
.panel { background: var(--surface); border-radius: 10px; padding: 24px; box-shadow: var(--shadow); margin-top: 16px; }
.panel-title { font-size: 1.05rem; margin: 0 0 12px; }
.file-list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; }
.file-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg); border-radius: var(--radius); }
.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-size { color: var(--muted); font-size: .85rem; }
.file-remove { background: none; border: 0; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 2px 8px; border-radius: 4px; }
.file-remove:hover { color: var(--primary); background: var(--primary-tint); }
.options { margin-bottom: 20px; }
.options-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; align-items: start; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; }
.steps-section { background: var(--surface); padding: 48px 0; }
.steps-section h2, .related-section h2 { text-align: center; margin-bottom: 28px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; }
.steps li { text-align: center; }
.steps p { color: var(--muted); margin: 0; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--cat, var(--primary)); color: #fff; font-weight: 700; margin-bottom: 10px; }
.related-section { padding: 48px 0 56px; }

/* ---------- Content pages ---------- */
.doc { padding: 48px 20px 64px; max-width: 800px; }
.doc h2 { margin-top: 1.6em; }
.doc .tool-lead { margin-left: 0; }
.doc.center .tool-lead { margin-left: auto; }
.demo-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 20px; }

/* ---------- Footer ---------- */
.site-footer { background: #26262e; color: #cfcbe0; padding: 36px 0 28px; margin-top: 0; }
.footer-privacy { display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,.07); padding: 14px 18px; border-radius: var(--radius); margin-bottom: 28px; }
.footer-privacy .icon { width: 30px; height: 30px; color: #6fd39a; }
.footer-privacy p { margin: 0; }
.footer-privacy strong { color: #fff; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 24px; margin-bottom: 24px; }
.footer-heading { color: #fff; font-weight: 700; margin: 0 0 8px; }
.footer-grid a { display: block; color: #cfcbe0; text-decoration: none; padding: 3px 0; font-size: .92rem; }
.footer-grid a:hover { color: #fff; text-decoration: underline; }
.footer-legal { font-size: .85rem; color: #928ea8; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .site-nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); padding: 12px 20px 20px; box-shadow: var(--shadow-lg); max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
  .site-nav.is-open { display: flex; }
  .nav-link { padding: 12px; }
  .nav-item { position: static; }
  .menu, .menu-wide { position: static; box-shadow: none; padding: 4px 12px 12px; flex-direction: column; gap: 14px; width: auto; min-width: 0; }
}
@media (max-width: 560px) {
  .hero { padding: 36px 0 20px; }
  .dropzone { padding: 36px 14px; }
  .btn-xl { font-size: 1.15rem; padding: 16px 28px; }
  .panel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Visual tool stage (page grid, page editor) ---------- */
.stage { margin: 0 0 20px; }
.stage-hint { color: var(--muted); font-size: .92rem; margin: 0 0 12px; }
.page-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.page-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; background: var(--bg); border: 2px solid transparent; border-radius: var(--radius); cursor: grab; }
.page-card.is-dragging { opacity: .4; }
.page-card.is-target { border-color: var(--primary); }
.page-frame { width: 130px; height: 170px; display: flex; align-items: center; justify-content: center; }
.page-thumb { max-width: 130px; max-height: 170px; background: #fff; box-shadow: var(--shadow); }
.page-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.page-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.page-btn { min-width: 30px; height: 30px; border: 1px solid var(--border); background: var(--surface); border-radius: 4px; cursor: pointer; font: inherit; line-height: 1; }
.page-btn:hover { border-color: var(--text); }
.page-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.editor-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-bottom: 12px; }
.editor-bar label { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; }
.editor-bar input[type="text"], .editor-bar input[type="number"], .editor-bar select { font: inherit; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.editor-bar input[type="color"] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.editor-bar .btn { padding: 7px 14px; font-size: .95rem; }
.editor-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.editor-nav output { font-weight: 600; min-width: 90px; text-align: center; }
.editor-scroll { overflow: auto; background: var(--bg); padding: 12px; border-radius: var(--radius); }
.editor-page { position: relative; margin: 0 auto; background: #fff; box-shadow: var(--shadow); touch-action: none; user-select: none; }
.editor-page canvas { display: block; }
.editor-layer { position: absolute; inset: 0; cursor: crosshair; }
.ed-item { position: absolute; border: 1px dashed transparent; cursor: move; touch-action: none; }
.ed-item:hover, .ed-item.is-selected { border-color: var(--focus); }
.ed-item.is-selected::after { content: ""; position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: var(--focus); border-radius: 2px; cursor: nwse-resize; }
.ed-item.is-text { white-space: pre; line-height: 1.15; font-family: Helvetica, Arial, sans-serif; }
.ed-item img, .ed-item svg, .ed-item canvas { width: 100%; height: 100%; display: block; pointer-events: none; }
.sig-pad { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); touch-action: none; cursor: crosshair; max-width: 100%; }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.cmp-grid figure { margin: 0; text-align: center; font-size: .85rem; color: var(--muted); }
.cmp-grid canvas { max-width: 100%; height: auto; background: #fff; box-shadow: var(--shadow); }
.ed-item .mark-line { position: absolute; left: 0; right: 0; height: 2px; pointer-events: none; }
