/* PubToPDF — shared styles. Vanilla CSS, no framework. Mobile-first. */

:root {
  --bg: #ffffff;
  --surface: #f4f6f9;
  --surface2: #eaeef4;
  --border: #d6dde6;
  --text: #1a2433;
  --muted: #4d5a6c;
  --faint: #8b96a5;
  --primary: #1a56c4;
  --primary-hover: #12409b;
  --primary-soft: #e9f0fc;
  --on-primary: #ffffff;
  --link: #164cad;
  --ok: #1b7f4d;
  --warn-bg: #fdf6dc;
  --warn-border: #d5b53e;
  --warn-text: #5f4f0e;
  --poor-bg: #fdecda;
  --poor-border: #d98636;
  --poor-text: #6e3d0c;
  --err-bg: #fdeaea;
  --err-border: #d66;
  --err-text: #7a1f1f;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --surface: #161d27;
    --surface2: #1e2733;
    --border: #2c3747;
    --text: #e8edf4;
    --muted: #a8b3c2;
    --faint: #74808f;
    --primary: #2f6ede;
    --primary-hover: #4d86ec;
    --primary-soft: #1a2942;
    --on-primary: #ffffff;
    --link: #85acf0;
    --ok: #4cc38a;
    --warn-bg: #332b10;
    --warn-border: #8f7623;
    --warn-text: #ecd27c;
    --poor-bg: #38260f;
    --poor-border: #9d5f21;
    --poor-text: #f2b877;
    --err-bg: #3a1a1a;
    --err-border: #8f3b3b;
    --err-text: #f0a3a3;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; }

a { color: var(--link); }
a:hover { text-decoration: none; }

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.8rem, 5vw, 2.7rem); margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.35rem, 3.5vw, 1.7rem); margin: 2em 0 .6em; }
h3 { font-size: 1.12rem; margin: 1.6em 0 .4em; }

p { margin: 0 0 1em; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--primary); color: var(--on-primary);
  padding: 10px 16px; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 60px; gap: 16px;
}
.logo {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text);
}
.logo svg { color: var(--primary); flex: none; }
.logo em { font-style: normal; color: var(--primary); }
.site-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: .95rem; padding: 6px 0; }
.site-nav a:hover { color: var(--text); text-decoration: underline; }

/* ---------- Hero (homepage) ---------- */

.hero {
  padding: 44px 0 56px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}
@media (min-width: 720px) {
  .hero { min-height: calc(100vh - 61px); display: flex; align-items: center; padding: 32px 0 48px; }
  .hero .wrap { width: 100%; }
}
.hero h1 { margin-bottom: .35em; }
.hero .tagline {
  font-size: clamp(1.02rem, 2.4vw, 1.22rem);
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 30px;
}

/* ---------- Page intro (SEO pages) ---------- */

.page-head { padding: 40px 0 8px; }
.page-head h1 { margin-bottom: .4em; }
.page-head .intro p { color: var(--muted); font-size: 1.05rem; }
.page-head .intro p strong { color: var(--text); }

/* ---------- Converter widget ---------- */

.converter { margin: 8px 0 24px; }
.converter noscript p {
  padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone svg { color: var(--primary); margin-bottom: 10px; }
.dz-title { font-size: 1.3rem; font-weight: 600; margin: 0 0 4px; }
.dz-or { color: var(--faint); margin: 6px 0 14px; }
.dz-hint { color: var(--muted); font-size: .92rem; margin: 18px 0 0; }

.converter-hero .dropzone { padding: 60px 24px; box-shadow: var(--shadow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 600; font-size: 1.08rem;
  border: 0; border-radius: 10px; cursor: pointer;
  padding: 14px 30px; min-height: 52px;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-lg { font-size: 1.15rem; padding: 16px 36px; }
.btn-link {
  background: none; border: 0; color: var(--link); text-decoration: underline;
  font: inherit; cursor: pointer; padding: 8px;
}

/* Busy state */
.cv-busy {
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  padding: 56px 24px; text-align: center;
}
.spinner {
  width: 44px; height: 44px; margin: 0 auto 18px;
  border-radius: 50%;
  border: 4px solid var(--surface2);
  border-top-color: var(--primary);
  animation: cv-spin .9s linear infinite;
}
@keyframes cv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.5s; }
}
.cv-status { font-size: 1.15rem; font-weight: 600; margin: 0 0 6px; }
.cv-substatus { color: var(--muted); margin: 0; }

/* Done state */
.cv-done {
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  padding: 24px; text-align: center;
}
.cv-ready {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 1.15rem; font-weight: 600; margin: 4px 0 18px;
}
.cv-ready svg { color: var(--ok); flex: none; }
.cv-actions { margin: 0 0 22px; }
.cv-actions.bottom { margin: 22px 0 4px; }

.fidelity {
  display: flex; align-items: flex-start; gap: 10px;
  text-align: left; font-size: .98rem; line-height: 1.45;
  border: 1px solid; border-radius: 10px;
  padding: 12px 14px; margin: 0 0 18px;
}
.fidelity svg { flex: none; margin-top: 2px; }
.fidelity-partial { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.fidelity-poor { background: var(--poor-bg); border-color: var(--poor-border); color: var(--poor-text); }

.preview-strip {
  display: flex; flex-direction: column; gap: 18px;
  max-height: 70vh; overflow-y: auto;
  padding: 6px;
  background: var(--surface2);
  border-radius: 12px;
}
.preview-strip figure { margin: 0; }
.preview-strip img {
  display: block; width: 100%;
  background: #fff;
  border: 1px solid var(--border); border-radius: 6px;
  box-shadow: var(--shadow);
}
.preview-strip figcaption { color: var(--muted); font-size: .88rem; padding: 6px 0 2px; }

/* Error state */
.cv-error {
  border: 1px solid var(--err-border); border-radius: 16px; background: var(--err-bg);
  color: var(--err-text);
  padding: 36px 24px; text-align: center;
}
.cv-error svg { margin-bottom: 8px; }
.cv-error-title { font-weight: 700; font-size: 1.1rem; margin: 0 0 8px; }
.cv-error p { margin: 0 auto 16px; max-width: 480px; }

/* ---------- Content sections ---------- */

.section { padding: 36px 0; }
.section-alt { background: var(--surface); }

.steps { display: grid; gap: 22px; padding: 0; margin: 24px 0 0; list-style: none; counter-reset: step; }
@media (min-width: 720px) { .steps { grid-template-columns: 1fr 1fr 1fr; } }
.steps li {
  counter-increment: step;
  background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px;
}
.steps li::before {
  content: counter(step);
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary);
  font-weight: 700; margin-bottom: 12px;
}
.steps h3 { margin: 0 0 6px; }
.steps p { margin: 0; color: var(--muted); font-size: .97rem; }

.checklist { list-style: none; padding: 0; margin: 16px 0; }
.checklist li {
  position: relative; padding: 0 0 14px 34px;
}
.checklist li svg { position: absolute; left: 0; top: 4px; color: var(--ok); }

/* FAQ */
.faq h3 { margin: 1.5em 0 .3em; }
.faq p { color: var(--muted); }

/* Comparison table */
.table-scroll { overflow-x: auto; margin: 20px 0; -webkit-overflow-scrolling: touch; }
table.compare { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .97rem; }
table.compare th, table.compare td {
  border: 1px solid var(--border); padding: 12px 14px; text-align: left; vertical-align: top;
}
table.compare th { background: var(--surface); }
table.compare td:first-child { font-weight: 600; }
table.compare .good { color: var(--ok); font-weight: 600; }

/* Related links */
.related ul { padding-left: 1.2em; }
.related li { margin-bottom: .4em; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 40px 0 32px;
  font-size: .95rem;
}
.footer-cols { display: grid; gap: 28px; margin-bottom: 28px; }
@media (min-width: 640px) { .footer-cols { grid-template-columns: repeat(3, 1fr); } }
.footer-cols h3 { margin: 0 0 10px; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin-bottom: 8px; }
.footer-cols a { color: var(--muted); text-decoration: none; }
.footer-cols a:hover { color: var(--text); text-decoration: underline; }
.footnote { color: var(--faint); font-size: .88rem; margin: 0; }
