/* =====================================================================
 * FreePDFTools — design system (modern SaaS, light + dark)
 * Self-contained: covers the standalone marketing + tool pages that run
 * WITHOUT the upstream SPA. Keyed off <html data-theme="light|dark">.
 * ===================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;

  /* brand accent (kept in sync with site.config.json themeColor) */
  --brand-50:  #fff1f2;
  --brand-100: #ffe4e6;
  --brand-200: #fecdd3;
  --brand-300: #fda4af;
  --brand-400: #fb7185;
  --brand-500: #e11d48;
  --brand-600: #be123c;
  --brand-700: #9f1239;

  /* neutral scale */
  --n-0:   #ffffff;
  --n-25:  #fcfcfd;
  --n-50:  #f9fafb;
  --n-100: #f3f4f6;
  --n-200: #e5e7eb;
  --n-300: #d1d5db;
  --n-400: #9ca3af;
  --n-500: #6b7280;
  --n-600: #4b5563;
  --n-700: #374151;
  --n-800: #1f2937;
  --n-900: #111827;
  --n-950: #030712;

  --success: #16a34a;
  --warning: #d97706;
  --danger:  #dc2626;
  --info:    #2563eb;

  /* category accents */
  --cat-organise: #2563eb; /* blue   */
  --cat-optimise: #7c3aed; /* violet */
  --cat-convert:  #0d9488; /* teal   */
  --cat-secure:   #e11d48; /* rose   */

  /* semantic (light) */
  --bg:            var(--n-50);
  --bg-elevated:   var(--n-0);
  --surface:       var(--n-0);
  --surface-2:     var(--n-50);
  --surface-hover: var(--n-100);
  --border:        var(--n-200);
  --border-strong: var(--n-300);
  --text:          var(--n-900);
  --text-2:        var(--n-600);
  --text-3:        var(--n-500);
  --text-invert:   var(--n-0);
  --accent:        var(--brand-500);
  --accent-hover:  var(--brand-600);
  --accent-soft:   var(--brand-50);
  --ring:          rgba(225, 29, 72, 0.35);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
  --header-bg: rgba(255, 255, 255, 0.85);

  /* shape + rhythm */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --maxw: 1200px;
  --header-h: 64px;
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg:            #0b0f17;
  --bg-elevated:   #111725;
  --surface:       #141b29;
  --surface-2:     #1a2233;
  --surface-hover: #1f2937;
  --border:        #263041;
  --border-strong: #374151;
  --text:          #e8ecf3;
  --text-2:        #9aa4b6;
  --text-3:        #6b7280;
  --text-invert:   #0b0f17;
  --accent:        #fb7185;
  --accent-hover:  #fda4af;
  --accent-soft:   #2a1420;
  --ring:          rgba(251, 113, 133, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --header-bg: rgba(11, 15, 23, 0.82);
}

/* ------------------------------------------------------------- base reset */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background-color .2s ease, color .2s ease;
}

/* The upstream SPA stylesheet pins html/body to the viewport with
   `height:100%; overflow:hidden` and expects the SPA's own #root to scroll.
   Our standalone pages are ordinary documents, so restore normal scrolling. */
html { height: auto; overflow-x: hidden; overflow-y: auto; }
body { height: auto; min-height: 100vh; overflow: visible; }

img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }

h1, h2, h3, h4 {
  margin: 0 0 .5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  font-weight: 700;
}
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.25rem; font-weight: 600; }
p  { margin: 0 0 1rem; color: var(--text-2); }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* --------------------------------------------------------- header / nav bar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  font-weight: 800; font-size: 15px;
}
.brand__name b { color: var(--accent); }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav a {
  color: var(--text-2);
  font-weight: 500;
  font-size: .94rem;
  padding: 8px 12px;
  border-radius: var(--r-sm);
}
.nav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  margin-left: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-hover); color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
[data-theme='dark'] .theme-toggle .icon-sun  { display: none; }
[data-theme='dark'] .theme-toggle .icon-moon { display: block; }

.nav-toggle { display: none; }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .05s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-hover); }
.btn--lg { height: 52px; padding: 0 28px; font-size: 1.05rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* --------------------------------------------------------------- hero */
.hero {
  position: relative;
  padding: 72px 0 56px;
  text-align: center;
  background:
    radial-gradient(1000px 380px at 50% -10%, var(--accent-soft), transparent 70%);
}
.hero h1 { max-width: 18ch; margin: 0 auto .75rem; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero__lede { font-size: 1.15rem; max-width: 56ch; margin: 0 auto 1.75rem; color: var(--text-2); }
.hero__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.badges {
  display: flex; flex-wrap: wrap; gap: 10px 20px;
  justify-content: center;
  margin-top: 28px;
  color: var(--text-3);
  font-size: .9rem;
}
.badges span { display: inline-flex; align-items: center; gap: 7px; }
.badges span::before {
  content: '';
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--success);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ------------------------------------------------------------- sections */
.section { padding: 44px 0; }
.section__head { margin-bottom: 20px; }
.section__head p { margin: 0; }
.section--organise .section__head h2 { color: var(--cat-organise); }
.section--optimise .section__head h2 { color: var(--cat-optimise); }
.section--convert  .section__head h2 { color: var(--cat-convert); }
.section--secure   .section__head h2 { color: var(--cat-secure); }

/* ------------------------------------------------------------ tool grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tool-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.tool-card__icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 700;
  color: #fff;
  background: var(--cat, var(--accent));
  margin-bottom: 4px;
}
.tool-card__title { font-weight: 600; font-size: 1.05rem; color: var(--text); }
.tool-card__desc {
  font-size: .9rem;
  color: var(--text-3);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cat-organise { --cat: var(--cat-organise); }
.cat-optimise { --cat: var(--cat-optimise); }
.cat-convert  { --cat: var(--cat-convert); }
.cat-secure   { --cat: var(--cat-secure); }

/* --------------------------------------------------------------- FAQ */
.faq { display: grid; gap: 10px; max-width: 820px; margin: 0 auto; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px 18px;
}
.faq details[open] { border-color: var(--border-strong); }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 0;
  font-weight: 600;
  color: var(--text);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  font-size: 1.4rem;
  color: var(--text-3);
  font-weight: 400;
}
.faq details[open] summary::after { content: '\2212'; }
.faq p { padding-bottom: 14px; margin: 0; }

/* --------------------------------------------------------------- footer */
.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 40px 0 32px;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 32px;
}
.site-footer h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 12px; }
.site-footer a { display: block; color: var(--text-2); padding: 4px 0; font-size: .92rem; }
.site-footer a:hover { color: var(--accent); }
.site-footer__brand p { max-width: 34ch; font-size: .9rem; color: var(--text-3); }
.site-footer__bottom {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: .85rem;
  color: var(--text-3);
}

/* ---------------------------------------------------- tool page (app) */
.tool-head { padding: 40px 0 8px; }
.breadcrumb { font-size: .85rem; color: var(--text-3); margin-bottom: 10px; }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--accent); }
.tool-head h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.tool-head__lede { max-width: 70ch; font-size: 1.05rem; }

.tool-app {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 20px 0 8px;
}
.tool-app__main { min-width: 0; }
.tool-app__aside {
  display: flex; flex-direction: column; gap: 16px;
}
@media (min-width: 960px) {
  .tool-app.has-options { grid-template-columns: 1fr 320px; align-items: start; }
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone__icon {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 16px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.dropzone__icon svg { width: 28px; height: 28px; }
.dropzone strong { display: block; font-size: 1.15rem; color: var(--text); margin-bottom: 4px; }
.dropzone span { color: var(--text-3); font-size: .9rem; }
.dropzone input[type=file] { display: none; }

.file-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.file-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: .92rem;
}
.file-item__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.file-item__size { color: var(--text-3); font-variant-numeric: tabular-nums; }
.file-item__remove {
  border: none; background: transparent; color: var(--text-3);
  cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 4px 6px; border-radius: 6px;
}
.file-item__remove:hover { background: var(--surface-hover); color: var(--danger); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}
.panel h3 { font-size: 1rem; margin-bottom: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field .input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: .95rem;
}
.field .input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring);
}
.field--row { display: flex; align-items: center; gap: 10px; }
.field--row label { margin: 0; }

.tool-note { font-size: .82rem; color: var(--text-3); margin: 12px 0 0; }

.progress { margin-top: 16px; }
.progress__bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-hover); overflow: hidden; }
.progress__fill { height: 100%; width: 0%; background: var(--accent); transition: width .2s; }
.progress__label { font-size: .85rem; color: var(--text-3); margin-top: 6px; }
.progress--indeterminate .progress__fill { width: 40%; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: 0; } 100% { margin-left: 100%; } }

.result {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.result__icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.result strong { display: block; color: var(--text); }
.result span { font-size: .85rem; color: var(--text-3); }
.result .btn { margin-left: auto; }

.alert { padding: 12px 14px; border-radius: var(--r-sm); font-size: .9rem; margin-top: 14px; }
.alert--error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.alert--info { background: var(--accent-soft); color: var(--text); }
.field select[multiple] { height: auto; min-height: 120px; }

/* hidden helper for JS toggling */
[hidden] { display: none !important; }

/* ------------------------------------------------ prose (policy pages) */
.prose { max-width: 760px; margin: 0 auto; padding: 32px 0 8px; }
.prose h2 { margin-top: 32px; }
.prose h3 { margin-top: 20px; }
.prose ul { color: var(--text-2); }
.prose .section { padding: 0; }

/* link hub of all tools (crawlable + footer of every rebuilt tool page) */
.fpt-hub { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; }
.fpt-hub a { color: var(--text-2); font-size: .9rem; }
.fpt-hub a:hover { color: var(--accent); }

/* --------------------------------------------------- in-app theme vars
 * When the upstream SPA shell DOES mount (not used on rebuilt pages) we still
 * want the accent to match. Harmless no-ops otherwise. */
html[data-app-theme='custom'] {
  --mantine-primary-color-filled: var(--accent);
}

/* ------------------------------------------------ hero "love" hook line */
.hero__love { margin-top: 10px; font-size: 1.05rem; color: var(--text-2); }

/* --------------------------------------------- ad-block support notice */
.fpt-adblock {
  position: fixed; inset: 0; z-index: 999;
  display: grid; place-items: center; padding: 16px;
  background: rgba(10, 13, 20, 0.6);
  backdrop-filter: blur(4px);
}
.fpt-adblock__card {
  max-width: 460px; width: 100%;
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.fpt-adblock__card h2 { font-size: 1.15rem; margin: 0 0 10px; }
.fpt-adblock__card p { font-size: .92rem; color: var(--text-2); line-height: 1.55; }
.fpt-adblock__card .fpt-adblock__how { margin-top: 10px; font-size: .85rem; color: var(--text-3); }
.fpt-adblock__actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.fpt-adblock__actions .btn { margin: 0; }

/* --------------------------------------- bookmark / install-app nudge ---
 * Dismissible corner card, shown once per visitor by site.js. Sits below the
 * ad-block dialog (z-index 999) so it never covers it. Shifts up when the
 * bottom ad bar is mounted (html.fpt-ads-on) so the two never overlap. */
.fpt-tip {
  position: fixed;
  left: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 60;
  width: min(340px, calc(100vw - 32px));
  display: flex;
  gap: 12px;
  padding: 16px 34px 16px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .22s ease, transform .22s ease;
}
.fpt-tip--in { opacity: 1; transform: translateY(0); }
.fpt-tip__badge {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.fpt-tip__badge svg { width: 20px; height: 20px; }
.fpt-tip__text { min-width: 0; }
.fpt-tip__text strong { display: block; font-size: .98rem; margin-bottom: 3px; color: var(--text); }
.fpt-tip__text p { margin: 0 0 8px; font-size: .85rem; color: var(--text-2); line-height: 1.5; }
.fpt-tip__hint { color: var(--text-3) !important; }
.fpt-tip__hint kbd {
  font-family: var(--font);
  font-size: .8rem;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
}
.fpt-tip__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.fpt-tip__btn { height: 34px; padding: 0 14px; font-size: .85rem; }
.fpt-tip__close {
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border: none; background: transparent;
  color: var(--text-3); font-size: 1.25rem; line-height: 1;
  border-radius: 6px; cursor: pointer;
}
.fpt-tip__close:hover { background: var(--surface-hover); color: var(--text); }
.fpt-ads-on .fpt-tip { bottom: 96px; }

/* ------------------------------------------------- upstream SPA branding ---
 * Remaining (not-yet-rebuilt) tool pages still boot the upstream React app,
 * whose navbar draws its own brand mark from /assets/ behind a content hash
 * that changes every release. Replacing the file is not an option, so we
 * repaint the same boxes. Selectors key off stable alt/aria-label and
 * data-mantine-color-scheme attributes, not the hashed filenames.
 *
 * opacity:0 (not display:none) keeps the original boxes' layout, so nothing
 * shifts when the paint changes. This block is inert on our standalone pages.
 */
.sui-logo__wordmark,
.sui-brandmark {
  opacity: 0 !important;
}
.sui-logo {
  background: url('/brand/wordmark-on-light.svg') no-repeat center / contain;
}
.quick-nav-brand {
  background: url('/brand/mark-on-light.svg') no-repeat center / contain;
}
[data-mantine-color-scheme='dark'] .sui-logo {
  background-image: url('/brand/wordmark-on-dark.svg');
}
[data-mantine-color-scheme='dark'] .quick-nav-brand {
  background-image: url('/brand/mark-on-dark.svg');
}

/* -------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .nav { display: none; }
  .nav-toggle { display: inline-grid; place-items: center; margin-left: auto; }
  .site-header.nav-open .nav {
    display: flex;
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 12px;
  }
  .site-header.nav-open .nav a { padding: 12px; }
}
@media (max-width: 560px) {
  .site-footer__grid { grid-template-columns: 1fr; }
  .dropzone { padding: 40px 16px; }
  .fpt-tip { left: 16px; right: 16px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
