/* ==========================================================================
   PDFBee — Design System
   A calm, white-and-red toolkit UI. Typography carries the brand: Manrope
   for display/headings (a little geometric warmth — nods to the honeycomb
   without being literal about it), Inter for body copy and UI.
   ========================================================================== */

:root {
  /* Brand palette */
  --red: #ED2929;
  --red-dark: #C81E1E;
  --red-light: #FDEAEA;
  --ink: #292A32;
  --ink-soft: #55555F;
  --white: #FFFFFF;
  --bg: #F6F6FA;
  --border: #E5E5EB;

  /* Status accents (used sparingly — amber for "coming soon", green for success) */
  --amber: #B06A00;
  --amber-bg: #FFF4E0;
  --green: #0E7A4D;
  --green-bg: #E6F5EE;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(41, 42, 50, 0.06);
  --shadow-md: 0 6px 20px rgba(41, 42, 50, 0.08);
  --shadow-lg: 0 16px 40px rgba(41, 42, 50, 0.12);

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;

  /* Type */
  --font-display: "Manrope", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;

  /* Layout */
  --max-w: 1180px;
  --header-h: 72px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F1F1F4;
    --ink-soft: #B9B9C4;
    --white: #201F26;
    --bg: #17161C;
    --border: #35343D;
    --red-light: #3A2020;
  }
}
:root[data-theme="dark"] {
  --ink: #F1F1F4;
  --ink-soft: #B9B9C4;
  --white: #201F26;
  --bg: #17161C;
  --border: #35343D;
  --red-light: #3A2020;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}
h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-weight: 800;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 1.3rem + 1vw, 2.1rem); }
h3 { font-size: 1.3rem; font-weight: 700; }
h4 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; max-width: 68ch; color: var(--ink-soft); }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
ul, ol { padding-left: 1.3em; color: var(--ink-soft); }
li { margin-bottom: 0.4em; }
code, pre { font-family: "SFMono-Regular", Consolas, Menlo, monospace; }
hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}
.section { padding: 64px 0; }
.section-tight { padding: 40px 0; }
.text-center { text-align: center; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: var(--r-sm); z-index: 200; transition: top .15s;
}
.skip-link:focus { top: 12px; }

/* --------------------------- Buttons --------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
  text-decoration: none;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); text-decoration: none; }
.btn-primary:disabled { background: #F0A6A6; cursor: not-allowed; }
.btn-secondary { background: var(--white); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--ink-soft); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--red-light); text-decoration: none; }
.btn-lg { padding: 15px 28px; font-size: 1.05rem; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* --------------------------- Header --------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.brand img { height: 32px; width: 32px; border-radius: 8px; }
.brand:hover { text-decoration: none; }
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav > li { position: relative; list-style: none; }
.main-nav ul { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; }
.nav-link {
  display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: var(--r-sm);
  color: var(--ink); font-weight: 600; font-size: 0.93rem; white-space: nowrap;
}
.nav-link:hover { background: var(--bg); text-decoration: none; }
.nav-dropdown { position: relative; }
.dropdown-panel {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: 10px; display: none; z-index: 50;
}
.dropdown-panel.wide { min-width: 560px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.nav-dropdown.open .dropdown-panel { display: grid; }
.dropdown-panel a {
  display: block; padding: 9px 12px; border-radius: var(--r-sm); color: var(--ink); font-size: 0.9rem; font-weight: 500;
}
.dropdown-panel a:hover { background: var(--bg); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--r-sm); color: var(--ink-soft);
  border: 1px solid transparent;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.hamburger { display: none; }
.mobile-nav { display: none; }

@media (max-width: 980px) {
  .main-nav { display: none; }
  .header-actions .btn-secondary, .header-actions .btn-primary { display: none; }
  .hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--r-sm); background: none;
  }
  .mobile-nav.open {
    display: block; position: fixed; inset: var(--header-h) 0 0 0; background: var(--white);
    overflow-y: auto; z-index: 99; padding: 16px;
  }
  .mobile-nav-section { margin-bottom: 18px; }
  .mobile-nav-section h4 { color: var(--ink-soft); text-transform: none; font-size: 0.8rem; margin-bottom: 8px; }
  .mobile-nav-section a {
    display: block; padding: 12px 10px; border-radius: var(--r-sm); color: var(--ink); font-weight: 600; font-size: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .mobile-nav .btn { margin-top: 10px; }
}

/* --------------------------- Hero --------------------------- */
.hero { padding: 72px 0 40px; text-align: center; background: linear-gradient(180deg, var(--red-light) 0%, var(--bg) 70%); }
.hero p.lead { font-size: 1.15rem; margin: 0 auto 28px; }
.hero h1 { margin-bottom: 16px; }
.search-box {
  max-width: 640px; margin: 0 auto 22px; position: relative;
}
.search-box input {
  width: 100%; padding: 16px 20px 16px 50px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 1rem; background: var(--white); box-shadow: var(--shadow-sm);
}
.search-box svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 8px; }
.chip {
  border: 1px solid var(--border); background: var(--white); color: var(--ink); font-weight: 600;
  font-size: 0.85rem; padding: 8px 16px; border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--red); color: var(--red); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* --------------------------- Tool grid / cards --------------------------- */
.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px;
  margin-top: 28px;
}
.tool-card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 20px; display: flex; flex-direction: column; gap: 10px; text-decoration: none;
  color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .1s;
  position: relative;
}
.tool-card:hover { border-color: var(--red); box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.tool-card .tool-icon {
  width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--red-light); color: var(--red);
  display: flex; align-items: center; justify-content: center;
}
.tool-card h3 { font-size: 1rem; margin-bottom: 2px; }
.tool-card p { font-size: 0.87rem; margin: 0; color: var(--ink-soft); }
.tool-card .badge { position: absolute; top: 16px; right: 16px; }
.no-results { display: none; text-align: center; padding: 40px 0; color: var(--ink-soft); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; letter-spacing: 0.01em;
}
.badge-live { background: var(--green-bg); color: var(--green); }
.badge-basic { background: #EAF1FD; color: #1D5FC2; }
.badge-soon { background: var(--amber-bg); color: var(--amber); }

/* --------------------------- Feature / info sections --------------------------- */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 24px; margin-top: 32px; }
.feature { padding: 4px; }
.feature .icon-wrap {
  width: 48px; height: 48px; border-radius: var(--r-sm); background: var(--red-light); color: var(--red);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.steps-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 32px; }
.step-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-md); padding: 26px; }
.step-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px; font-family: var(--font-display);
}
@media (max-width: 760px) { .steps-row { grid-template-columns: 1fr; } }

.panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 32px; }
.panel-muted { background: var(--bg); border: 1px dashed var(--border); border-radius: var(--r-md); padding: 20px; }

.two-col { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* --------------------------- Discord / CTA band --------------------------- */
.cta-band {
  background: var(--ink); color: #fff; border-radius: var(--r-lg); padding: 48px; text-align: center;
  margin: 0 auto;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: #D6D6DE; margin-left: auto; margin-right: auto; }
.cta-band .btn-primary { background: var(--red); }

/* --------------------------- Breadcrumbs --------------------------- */
.breadcrumbs { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 18px; }
.breadcrumbs a { color: var(--ink-soft); font-weight: 600; }
.breadcrumbs a:hover { color: var(--red); }
.breadcrumbs .sep { margin: 0 6px; color: var(--border); }

/* --------------------------- Tool page layout --------------------------- */
.tool-hero { padding: 40px 0 8px; }
.tool-hero .meta-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.tool-workspace { padding: 8px 0 56px; }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--r-lg); background: var(--white);
  padding: 48px 24px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--red); background: var(--red-light); }
.dropzone svg { color: var(--red); margin-bottom: 14px; }
.dropzone .hint { font-size: 0.85rem; color: var(--ink-soft); margin-top: 8px; }
.dropzone input[type="file"] { display: none; }

.file-list { margin: 18px 0 0; display: flex; flex-direction: column; gap: 10px; }
.file-row {
  display: flex; align-items: center; gap: 12px; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 14px;
}
.file-row .file-icon { color: var(--red); flex-shrink: 0; }
.file-row .file-name { flex: 1; font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .file-size { font-size: 0.78rem; color: var(--ink-soft); flex-shrink: 0; }
.file-row button { background: none; border: none; color: var(--ink-soft); cursor: pointer; display: flex; padding: 4px; }
.file-row button:hover { color: var(--red); }
.file-row[draggable="true"] { cursor: grab; }

.page-thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px,1fr)); gap: 12px; margin-top: 16px; }
.page-thumb { border: 2px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: #fff; position: relative; cursor: grab; }
.page-thumb.selected { border-color: var(--red); }
.page-thumb img, .page-thumb canvas { width: 100%; display: block; }
.page-thumb .page-num { position: absolute; bottom: 4px; right: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 0.68rem; padding: 1px 6px; border-radius: 4px; }
.page-thumb .page-check { position: absolute; top: 4px; left: 4px; }

.options-panel { margin-top: 20px; display: grid; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 0.88rem; }
.field .help { font-size: 0.8rem; color: var(--ink-soft); margin-top: -2px; }
input[type="text"], input[type="number"], input[type="password"], input[type="email"], select, textarea {
  padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 0.95rem;
  background: var(--white); color: var(--ink); width: 100%; font-family: inherit;
}
textarea { resize: vertical; min-height: 90px; }
input[type="range"] { width: 100%; accent-color: var(--red); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--red); width: 16px; height: 16px; }
.radio-row, .check-row { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--ink); font-weight: 500; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

.progress-wrap { margin: 20px 0; }
.progress-track { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--red); width: 0%; transition: width .2s ease; }
.progress-label { font-size: 0.85rem; color: var(--ink-soft); margin-top: 8px; }

.result-panel { text-align: center; padding: 36px 24px; }
.result-panel .success-icon {
  width: 60px; height: 60px; border-radius: 50%; background: var(--green-bg); color: var(--green);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.notice { border-radius: var(--r-sm); padding: 14px 16px; font-size: 0.88rem; display: flex; gap: 10px; align-items: flex-start; }
.notice svg { flex-shrink: 0; margin-top: 2px; }
.notice-info { background: #EAF1FD; color: #164A94; }
.notice-amber { background: var(--amber-bg); color: #7A4A00; }
.notice-green { background: var(--green-bg); color: #0A5C3B; }
.notice-red { background: var(--red-light); color: var(--red-dark); }

.privacy-strip {
  display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--ink-soft); margin-top: 14px;
}
.privacy-strip svg { color: var(--green); flex-shrink: 0; }

.related-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 12px; margin-top: 20px; }
.related-tools a {
  display: block; padding: 14px 16px; background: var(--white); border: 1px solid var(--border); border-radius: var(--r-sm);
  font-weight: 600; font-size: 0.9rem; color: var(--ink);
}
.related-tools a:hover { border-color: var(--red); color: var(--red); text-decoration: none; }

/* --------------------------- FAQ --------------------------- */
.faq-list { margin-top: 18px; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; padding: 18px 4px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; font-weight: 700;
  font-size: 1rem; color: var(--ink); font-family: var(--font-body);
}
.faq-q svg { flex-shrink: 0; transition: transform .15s; color: var(--ink-soft); }
.faq-item.open .faq-q svg { transform: rotate(180deg); }
.faq-a { display: none; padding: 0 4px 18px; color: var(--ink-soft); }
.faq-item.open .faq-a { display: block; }
.faq-search { margin-bottom: 10px; }

/* --------------------------- Editor (canvas-based) --------------------------- */
.editor-shell { display: grid; grid-template-columns: 230px 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 860px) { .editor-shell { grid-template-columns: 1fr; } }
.editor-tools { display: flex; flex-direction: column; gap: 8px; }
.editor-tool-btn {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--white); cursor: pointer; font-weight: 600; font-size: 0.9rem;
  color: var(--ink); text-align: left;
}
.editor-tool-btn.active { border-color: var(--red); background: var(--red-light); color: var(--red-dark); }
.editor-canvas-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; overflow: auto; text-align: center; }
.editor-page-stage { position: relative; display: inline-block; margin: 0 auto; }
.editor-page-stage canvas.page-bg { display: block; }
.editor-page-stage .overlay-layer { position: absolute; inset: 0; cursor: crosshair; }
.page-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }

/* --------------------------- Blog --------------------------- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 22px; margin-top: 30px; }
.blog-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-md); padding: 22px; color: var(--ink); }
.blog-card:hover { border-color: var(--red); text-decoration: none; }
.blog-card .eyebrow { font-size: 0.8rem; color: var(--ink-soft); margin-bottom: 8px; }
.blog-card h3 { margin-bottom: 8px; }
.article-meta { color: var(--ink-soft); font-size: 0.88rem; display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 24px; }
.article-body h2 { margin-top: 2em; }
.article-body h3 { margin-top: 1.5em; }
.article-body ul, .article-body ol { margin-bottom: 1.2em; }
.toc { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px 24px; margin: 24px 0; }
.toc ol { margin: 10px 0 0; padding-left: 1.2em; }
.toc a { color: var(--ink); font-weight: 600; }
.author-box { display: flex; gap: 14px; align-items: center; background: var(--bg); border-radius: var(--r-md); padding: 18px; margin-top: 40px; }
.author-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-family: var(--font-display); flex-shrink: 0; }

/* --------------------------- Footer --------------------------- */
.site-footer { background: var(--white); border-top: 1px solid var(--border); margin-top: 60px; }
.footer-cta { padding: 48px 0; border-bottom: 1px solid var(--border); }
.footer-cta .inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; background: var(--red-light); border-radius: var(--r-lg); padding: 32px 36px; }
.footer-cta h3 { margin-bottom: 4px; }
.footer-cta p { margin: 0; max-width: 46ch; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(5, 1fr); gap: 24px; padding: 48px 0 28px; }
.footer-col h4 { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 14px; letter-spacing: 0.01em; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: var(--ink); font-size: 0.9rem; font-weight: 500; }
.footer-col a:hover { color: var(--red); }
.footer-brand p { font-size: 0.88rem; }
.footer-bottom {
  border-top: 1px solid var(--border); padding: 20px 0 32px; display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 12px; font-size: 0.85rem; color: var(--ink-soft);
}
.footer-bottom ul { display: flex; gap: 18px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.footer-bottom a { color: var(--ink-soft); }
@media (max-width: 980px) { .footer-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 620px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-cta .inner { flex-direction: column; text-align: center; } }

/* --------------------------- 404 --------------------------- */
.error-page { text-align: center; padding: 90px 0; }
.error-page .bee { margin: 0 auto 24px; }
.error-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

/* --------------------------- Misc --------------------------- */
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
table.diff-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.diff-table td { vertical-align: top; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: pre-wrap; }
.diff-add { background: var(--green-bg); }
.diff-del { background: var(--red-light); text-decoration: line-through; opacity: .8; }
.sig-pad-wrap canvas { border: 1px solid var(--border); border-radius: var(--r-sm); background: #fff; touch-action: none; width: 100%; max-width: 420px; height: 160px; }
