/*
 * luan.cx visual theme for BentoPDF Simple 2.8.8 (pdf.luan.cx).
 * A local stylesheet layered over the unmodified upstream build. BentoPDF itself
 * is (c) the BentoPDF contributors, AGPL-3.0: https://github.com/alam00000/bentopdf
 * This file is part of the corresponding source published at /source/.
 *
 * Upstream compiles Tailwind v4 utilities to var(--color-*) and var(--radius-*),
 * so the token block below restyles every route and dynamically built dialog.
 * Rules are unlayered on purpose: unlayered CSS beats every Tailwind layer, which
 * is what lets the contrast fixes win over utilities such as .text-white.
 * Images, canvases, iframes and video are never filtered or recoloured.
 */

/* ?direct opts out of the upstream service worker, which serves cached files by name alone. */
@font-face {
  font-family: 'Space Grotesk Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url(fonts/space-grotesk-vietnamese-wght-normal.woff2?direct) format('woff2-variations');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: 'Space Grotesk Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url(fonts/space-grotesk-latin-ext-wght-normal.woff2?direct) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Space Grotesk Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url(fonts/space-grotesk-latin-wght-normal.woff2?direct) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(fonts/jetbrains-mono-latin-ext-wght-normal.woff2?direct) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(fonts/jetbrains-mono-latin-wght-normal.woff2?direct) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* ---------------------------------------------------------------- tokens */

:root {
  --luan-ink: #ffffff;
  --luan-lead: #d4d4d4;
  --luan-text: #bdbdbd;
  --luan-muted: #aaaaaa;
  --luan-faint: #929292;
  --luan-void: #000000;
  --luan-line: rgba(255, 255, 255, .17);
  --luan-line-strong: rgba(255, 255, 255, .42);
  --luan-field: #454545;
  --luan-raise: #0d0d0d;
  --luan-sans: 'Space Grotesk Variable', 'Helvetica Neue', Arial, sans-serif;
  --luan-mono: 'JetBrains Mono Variable', ui-monospace, SFMono-Regular, Menlo, monospace;
  --luan-width: min(1240px, calc(100% - 2 * max(20px, env(safe-area-inset-left), env(safe-area-inset-right))));

  --font-sans: var(--luan-sans);
  --font-mono: var(--luan-mono);
  --font-weight-bold: 600;
  --font-weight-semibold: 500;
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;
  --radius-xl: 0;
  --radius-2xl: 0;
  --radius-3xl: 0;

  /* One neutral ramp. Lightness order matches upstream, so light panels stay legible. */
  --color-gray-50: #f7f7f7;
  --color-gray-100: #ededed;
  --color-gray-200: #d4d4d4;
  --color-gray-300: #bdbdbd;
  --color-gray-400: #aaaaaa;
  --color-gray-500: #929292;
  --color-gray-600: #454545;
  --color-gray-700: #2b2b2b;
  --color-gray-800: #070707;
  --color-gray-900: #000000;
  --color-gray-950: #000000;
  --color-slate-200: #d4d4d4;

  /* Accent hues collapse to white: links, rings, progress, primary fills. */
  --color-indigo-50: #f7f7f7;
  --color-indigo-100: #ededed;
  --color-indigo-200: #d4d4d4;
  --color-indigo-300: #d4d4d4;
  --color-indigo-400: #ffffff;
  --color-indigo-500: #ffffff;
  --color-indigo-600: #ffffff;
  --color-indigo-700: #d4d4d4;
  --color-indigo-800: #454545;
  --color-indigo-900: #1c1c1c;
  --color-blue-50: #f7f7f7;
  --color-blue-100: #ededed;
  --color-blue-200: #d4d4d4;
  --color-blue-300: #d4d4d4;
  --color-blue-400: #ffffff;
  --color-blue-500: #ffffff;
  --color-blue-600: #ffffff;
  --color-blue-700: #d4d4d4;
  --color-blue-800: #454545;
  --color-blue-900: #1c1c1c;
  --color-purple-100: #ededed;
  --color-purple-300: #d4d4d4;
  --color-purple-400: #ffffff;
  --color-purple-500: #ffffff;
  --color-purple-600: #ffffff;
  --color-purple-700: #d4d4d4;
  --color-violet-300: #d4d4d4;
  --color-teal-300: #d4d4d4;
  --color-rose-300: #d4d4d4;
  --color-pink-500: #ffffff;
  --color-orange-600: #ffffff;
  --color-orange-700: #d4d4d4;

  /* Semantic hues read as full-strength ink; shape and border style carry the meaning. */
  --color-red-100: #ededed;
  --color-red-200: #ffffff;
  --color-red-300: #ededed;
  --color-red-400: #ffffff;
  --color-red-500: #ffffff;
  --color-red-600: #ffffff;
  --color-red-700: #d4d4d4;
  --color-red-900: #1c1c1c;
  --color-green-100: #ededed;
  --color-green-200: #ededed;
  --color-green-300: #ededed;
  --color-green-400: #ffffff;
  --color-green-500: #ffffff;
  --color-green-600: #ffffff;
  --color-green-700: #d4d4d4;
  --color-green-900: #1c1c1c;
  --color-yellow-100: #ededed;
  --color-yellow-200: #ededed;
  --color-yellow-300: #ededed;
  --color-yellow-400: #ffffff;
  --color-yellow-500: #ffffff;
  --color-yellow-600: #ffffff;
  --color-yellow-700: #d4d4d4;
  --color-yellow-900: #1c1c1c;
  --color-amber-200: #ededed;
  --color-amber-300: #ededed;
  --color-amber-400: #ffffff;
  --color-amber-500: #ffffff;
  --color-amber-700: #d4d4d4;
  --color-amber-900: #1c1c1c;
}

/* Bookmark colours are the user's own labels, written into the PDF outline. Keep them. */
#bookmark-tree-list {
  --color-red-100: oklch(93.6% .032 17.717);
  --color-red-300: oklch(80.8% .114 19.571);
  --color-red-600: oklch(57.7% .245 27.325);
  --color-blue-100: oklch(93.2% .032 255.585);
  --color-blue-300: oklch(80.9% .105 251.813);
  --color-blue-500: oklch(62.3% .214 259.815);
  --color-blue-600: oklch(54.6% .245 262.881);
  --color-green-100: oklch(96.2% .044 156.743);
  --color-green-300: oklch(87.1% .15 154.449);
  --color-green-600: oklch(62.7% .194 149.214);
  --color-yellow-100: oklch(97.3% .071 103.193);
  --color-yellow-300: oklch(90.5% .182 98.111);
  --color-yellow-600: oklch(68.1% .162 75.834);
  --color-purple-100: oklch(94.6% .033 307.174);
  --color-purple-300: oklch(82.7% .119 306.383);
  --color-purple-600: oklch(55.8% .288 302.321);
}

/* ------------------------------------------------------------- document */

/* The attribute excludes pdf.js viewer documents should this file ever be injected there. */
html:not([mozdisallowselectionprint]) {
  color-scheme: dark;
  background: var(--luan-void);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  scrollbar-color: var(--luan-field) var(--luan-void);
}
html:not([mozdisallowselectionprint]) body {
  background-color: var(--luan-void);
  color: var(--luan-text);
  font-family: var(--luan-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html:not([mozdisallowselectionprint]) ::selection { color: var(--luan-void); background: var(--luan-ink); }
html:not([mozdisallowselectionprint]) :is(input, select, textarea, button) { font-family: inherit; }
html:not([mozdisallowselectionprint]) :is(input[type='checkbox'], input[type='radio'], input[type='range'], progress) { accent-color: var(--luan-ink); }

html:not([mozdisallowselectionprint]) ::-webkit-scrollbar { width: 10px; height: 10px; }
html:not([mozdisallowselectionprint]) ::-webkit-scrollbar-track { background: var(--luan-void); }
html:not([mozdisallowselectionprint]) ::-webkit-scrollbar-thumb { background: var(--luan-field); border: 2px solid var(--luan-void); border-radius: 0; }
html:not([mozdisallowselectionprint]) ::-webkit-scrollbar-thumb:hover { background: #6b6b6b; }

/* The black halo keeps the ring legible on white buttons and over thumbnails. */
html:not([mozdisallowselectionprint]) :focus-visible {
  outline: 2px solid var(--luan-ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--luan-void);
}
html:not([mozdisallowselectionprint]) :is(input, select, textarea):focus-visible { outline-offset: 0; }
/* Upstream switches hide the real checkbox; show its focus on the visible track. */
.peer:focus-visible + div { outline: 2px solid var(--luan-ink); outline-offset: 3px; }

/* ------------------------------------------------------------ geometry */

.rounded, .rounded-full, .rounded-sm, .rounded-md, .rounded-lg, .rounded-xl, .rounded-2xl { border-radius: 0; }
.after\:rounded-full::after { border-radius: 0; }
.solid-spinner, .animate-spin { border-radius: 50%; }
.shadow, .shadow-sm, .shadow-md, .shadow-lg, .shadow-xl, .shadow-2xl, .hover\:shadow-lg:hover { --tw-shadow: 0 0 #0000; }
.backdrop-blur-sm { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

/* ---------------------------------------------------------- typography */

/* Layered so heading colour utilities inside light panels still win. */
@layer components {
  :is(h1, h2) { letter-spacing: -.035em; text-wrap: balance; }
  :is(h3, h4) { letter-spacing: -.01em; }
}
html:not([mozdisallowselectionprint]) :is(h1, h2) { font-weight: 470; }
html:not([mozdisallowselectionprint]) :is(h3, h4) { font-weight: 500; }
html:not([mozdisallowselectionprint]) :is(kbd, code, .font-mono) { font-family: var(--luan-mono); }

/* --------------------------------------------------------- fill contrast */

/* Accent and success/warning fills are now white, so their ink flips to black. */
:is(
  [class~='bg-indigo-400'], [class~='bg-indigo-500'], [class~='bg-indigo-600'], [class~='bg-indigo-700'],
  [class~='bg-blue-400'], [class~='bg-blue-500'], [class~='bg-blue-600'], [class~='bg-blue-700'],
  [class~='bg-purple-500'], [class~='bg-purple-600'], [class~='bg-purple-700'],
  [class~='bg-green-400'], [class~='bg-green-500'], [class~='bg-green-600'], [class~='bg-green-700'],
  [class~='bg-yellow-400'], [class~='bg-yellow-500'], [class~='bg-yellow-600'], [class~='bg-yellow-700'],
  [class~='bg-amber-500'], [class~='bg-orange-600'], [class~='bg-orange-700'],
  [class~='hover:bg-indigo-600']:hover, [class~='hover:bg-indigo-700']:hover,
  [class~='hover:bg-blue-600']:hover, [class~='hover:bg-blue-700']:hover,
  [class~='hover:bg-green-600']:hover, [class~='hover:bg-green-700']:hover,
  [class~='hover:bg-yellow-700']:hover, [class~='hover:bg-orange-700']:hover,
  [class*='bg-gradient-'][class*='from-indigo-'], [class*='bg-gradient-'][class*='from-blue-'], [class*='bg-gradient-'][class*='from-purple-']
) { color: var(--luan-void); }
:is(
  [class~='bg-indigo-500'], [class~='bg-indigo-600'], [class~='bg-blue-500'], [class~='bg-blue-600'],
  [class~='bg-purple-600'], [class~='bg-green-600'], [class~='bg-yellow-600'], [class~='bg-amber-500'], [class~='bg-orange-600'],
  [class*='bg-gradient-'][class*='from-indigo-'], [class*='bg-gradient-'][class*='from-blue-']
) :is(i, svg, span, strong, p, small, .text-white) { color: inherit; }

/* Destructive fills become outlined black, so they never read as the primary action. */
:is([class~='bg-red-500'], [class~='bg-red-600'], [class~='bg-red-700']) {
  background-color: var(--luan-void);
  box-shadow: inset 0 0 0 1px var(--luan-ink);
  color: var(--luan-ink);
}
:is([class~='hover:bg-red-500'], [class~='hover:bg-red-600'], [class~='hover:bg-red-700']):hover { background-color: #1c1c1c; }
/* Marked-for-deletion veil on page thumbnails: dim the page instead of washing it white. */
.bg-red-500\/50 { background-color: rgba(0, 0, 0, .62); }

/* Grey fills: gray-700/600 double as rule colours, so their surfaces sit lower. */
[class~='bg-gray-700']:not([class*='peer-checked:bg-']) { background-color: #141414; }
[class~='bg-gray-600']:not([class*='peer-checked:bg-']) { background-color: #1f1f1f; }
[class~='hover:bg-gray-800']:hover { background-color: var(--luan-raise); }
[class~='hover:bg-gray-700']:hover { background-color: #141414; }
[class~='hover:bg-gray-600']:hover { background-color: #1f1f1f; }
/* Secondary buttons are outlined, like the portfolio's quiet actions. */
:is(button, a, label, .btn)[class~='bg-gray-700'] { background-color: transparent; box-shadow: inset 0 0 0 1px var(--luan-field); }
:is(button, a, label, .btn)[class~='bg-gray-700']:hover { background-color: #141414; box-shadow: inset 0 0 0 1px var(--luan-ink); }

/* Switch: the checked track is white, so its knob turns black. */
.peer:checked + [class*='peer-checked:bg-']::after { background-color: var(--luan-void); border-color: var(--luan-void); }
.peer + [class*='after:bg-white'] { box-shadow: inset 0 0 0 1px var(--luan-field); }

/* Error, warning and info boxes keep distinct shapes once hue is gone. */
:is([class*='bg-red-900'], [class*='bg-red-500/']) { border-inline-start: 3px solid var(--luan-ink); }
:is([class*='border-yellow-'], [class*='border-amber-']) { border-style: dashed; }
:is([class*='bg-yellow-900'], [class*='bg-amber-900'], [class*='bg-yellow-500/'], [class*='bg-amber-500/']) { border-inline-start: 3px dashed var(--luan-ink); }
:is([class*='bg-indigo-900/'], [class*='bg-blue-900/']) { border-inline-start: 1px solid var(--luan-line-strong); }

[class~='bg-gray-500'] { background-color: #5c5c5c; }

/* Inside light upstream panels a white fill would vanish, so primaries invert to black. */
.bg-white :is([class~='bg-indigo-500'], [class~='bg-indigo-600'], [class~='bg-blue-500'], [class~='bg-blue-600'], [class~='bg-green-600'], [class~='bg-purple-600'], .btn-gradient) { background-color: var(--luan-void); border-color: var(--luan-void); color: var(--luan-ink); }
.bg-white .btn-gradient:hover { background-color: #2b2b2b; border-color: #2b2b2b; }
/* Muted greys are tuned for black; on white they step darker to stay legible. */
.bg-white { --color-gray-400: #8a8a8a; --color-gray-500: #6b6b6b; --color-gray-600: #4f4f4f; }
.bg-white :is([class~='hover:bg-indigo-700'], [class~='hover:bg-blue-600'], [class~='hover:bg-blue-700'], [class~='hover:bg-green-700']):hover { background-color: #2b2b2b; color: var(--luan-ink); }

/* Light upstream panels (bookmarks, signatures, form builder) keep dark ink. */
@layer components {
  .bg-white { color: #1c1c1c; }
}

/* --------------------------------------------------------------- fields */

:is(input:not([type='checkbox'], [type='radio'], [type='range'], [type='color'], [type='file']), select, textarea):is([class*='bg-gray-7'], [class*='bg-gray-8'], [class*='bg-gray-9'], [class*='bg-gray-6']) {
  background-color: var(--luan-void);
  border-color: var(--luan-field);
}
:is(input, select, textarea):is([class*='bg-gray-7'], [class*='bg-gray-8'], [class*='bg-gray-9'], [class*='bg-gray-6']):hover { border-color: #6b6b6b; }
:is(input, select, textarea):is([class*='bg-gray-7'], [class*='bg-gray-8'], [class*='bg-gray-9'], [class*='bg-gray-6']):focus { border-color: var(--luan-ink); --tw-ring-color: transparent; }
html:not([mozdisallowselectionprint]) ::placeholder { color: var(--luan-faint); opacity: 1; }
html:not([mozdisallowselectionprint]) input[type='file']::file-selector-button {
  min-height: 40px;
  padding-inline: 16px;
  background-color: var(--luan-ink);
  border: 1px solid var(--luan-ink);
  border-radius: 0;
  color: var(--luan-void);
  font: 500 14px var(--luan-sans);
}
html:not([mozdisallowselectionprint]) input[type='file']::file-selector-button:hover { background-color: var(--luan-lead); }
input[type='color'] { border: 1px solid var(--luan-field); border-radius: 0; }
input[type='color']::-webkit-color-swatch { border-radius: 0; }
input[type='color']::-moz-color-swatch { border-radius: 0; }
html:not([mozdisallowselectionprint]) label.block.text-sm.font-medium {
  font: 500 11px/1.5 var(--luan-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* -------------------------------------------------------------- actions */

.btn-gradient {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  background: var(--luan-ink);
  border: 1px solid var(--luan-ink);
  border-radius: 0;
  color: var(--luan-void);
  font: 500 16px/1.2 var(--luan-sans);
  letter-spacing: -.005em;
  transform: none;
  transition: background-color .18s ease, border-color .18s ease;
}
.btn-gradient:hover { background: var(--luan-lead); border-color: var(--luan-lead); box-shadow: none; }
.btn-gradient:focus { box-shadow: none; }
.btn-gradient:focus-visible { box-shadow: 0 0 0 3px var(--luan-void); }
.btn-gradient:disabled { background: #2b2b2b; border-color: #2b2b2b; color: var(--luan-faint); opacity: 1; }
.btn:active, .btn-gradient:active { transform: none; }
html:not([mozdisallowselectionprint]) :is(button, .btn):disabled { opacity: .45; }
.cta-button { background-color: var(--luan-ink); border-radius: 0; color: var(--luan-void); }
.cta-button:hover { background-color: var(--luan-lead); }
.pill { background-color: transparent; border: 1px solid var(--luan-line); border-radius: 0; color: var(--luan-lead); font-family: var(--luan-mono); }

/* Primary buttons that upstream sizes with small padding still get a touch-sized target. */
:is(.btn, button)[class~='bg-indigo-600'] { min-height: 44px; }

/* ------------------------------------------------------------------ nav */

body > nav:first-of-type {
  position: sticky;
  top: 0;
  background-color: rgba(0, 0, 0, .9);
  border-bottom: 1px solid var(--luan-line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
body > nav:first-of-type > .container { width: var(--luan-width); max-width: none; padding-inline: 0; }
body > nav:first-of-type > .container > div { gap: 8px 28px; min-height: 64px; }
body > nav:first-of-type img[src*='favicon'] { width: 18px; height: 18px; filter: grayscale(1); }
body > nav:first-of-type .flex-shrink-0 { gap: 8px; }
body > nav:first-of-type .flex-shrink-0 > span:not(.luan-powered) { margin-inline-start: 0; color: var(--luan-ink); font-size: 15px; font-weight: 500; letter-spacing: -.01em; }
body > nav:first-of-type .flex-shrink-0 > span > a { display: inline-flex; align-items: center; min-height: 44px; color: inherit; text-decoration: none; text-underline-offset: 5px; }
body > nav:first-of-type .flex-shrink-0 > span > a:hover { text-decoration: underline; }
body > nav:first-of-type .flex-shrink-0 > span.text-gray-400 { color: var(--luan-muted); font: 500 11px var(--luan-mono); letter-spacing: .08em; text-transform: uppercase; }

/* Added by theme.js: luan.cx identity, upstream credit and quiet text links. */
.luan-identity { display: flex; flex-wrap: nowrap; gap: 0 12px; align-items: center; margin-inline-end: auto; color: var(--luan-muted); font: 500 11px/1.5 var(--luan-mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.luan-identity a { display: inline-flex; align-items: center; min-height: 44px; color: var(--luan-ink); text-decoration: none; text-underline-offset: 5px; }
.luan-identity a:hover { text-decoration: underline; }
.luan-identity span[aria-hidden] { color: #454545; }
.luan-powered { color: var(--luan-faint); font: 500 11px var(--luan-mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.luan-links { display: flex; gap: 0 22px; align-items: center; }
.luan-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--luan-muted); font: 500 11px var(--luan-mono); letter-spacing: .08em; text-decoration: none; text-transform: uppercase; text-underline-offset: 5px; white-space: nowrap; }
.luan-links a:hover { color: var(--luan-ink); text-decoration: underline; }
.luan-theme body > nav:first-of-type .flex-shrink-0 { order: 2; }
.luan-theme body > nav:first-of-type .luan-links { order: 3; }
.luan-theme body > nav:first-of-type #close-tool-btn { order: 4; }

/* ---------------------------------------------------------- home layout */

#app.container { width: var(--luan-width); max-width: none; padding-inline: 0; }
#tools-header { margin-bottom: clamp(36px, 5vw, 64px); padding-top: clamp(32px, 7vw, 96px); text-align: start; }
#tools-header h1 { max-width: 12ch; margin: 0; font-size: clamp(52px, 7.4vw, 104px); letter-spacing: -.048em; line-height: .94; }
#tools-header h1 + p { max-width: 44ch; margin-top: clamp(18px, 2vw, 28px); color: var(--luan-lead); font-size: clamp(17px, .5vw + 12px, 20px); line-height: 1.6; }
.luan-eyebrow { display: flex; gap: 12px; align-items: center; margin: 0 0 22px; color: var(--luan-muted); font: 500 12px/1.5 var(--luan-mono); letter-spacing: .1em; text-transform: uppercase; }
.luan-eyebrow::before { width: 24px; height: 1px; flex: none; content: ''; background: var(--luan-ink); }

#grid-view > .mb-8 { max-width: 44rem; margin-inline: 0; margin-bottom: clamp(40px, 5vw, 64px); }
#search-bar { min-height: 56px; padding-block: 14px; padding-inline-end: 6.75rem; background-color: var(--luan-void); border: 1px solid var(--luan-field); border-radius: 0; color: var(--luan-ink); font-size: 17px; }
#search-bar:hover { border-color: #6b6b6b; }
#search-bar:focus { border-color: var(--luan-ink); --tw-ring-color: transparent; }
#search-bar + span #shortcut { padding: 3px 7px; background: transparent; border: 1px solid var(--luan-line); border-radius: 0; color: var(--luan-muted); font: 500 11px var(--luan-mono); }
#search-bar + span #shortcut:empty { display: none; }
#open-shortcuts-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; color: var(--luan-muted); }
#open-shortcuts-btn:hover { background: #141414; color: var(--luan-ink); }

/* Categories: numbered rules, like the portfolio's chapter index. */
#tool-grid { counter-reset: luan-category; }
.category-group { counter-increment: luan-category; }
.category-header {
  gap: 16px;
  min-height: 64px;
  padding: 18px 0 14px;
  margin: clamp(40px, 5vw, 64px) 0 0;
  border-top: 1px solid var(--luan-line);
  color: var(--luan-ink);
  font: 470 clamp(22px, 2vw, 28px)/1.15 var(--luan-sans);
  letter-spacing: -.03em;
}
.category-header::before { align-self: baseline; min-width: 2.4em; content: counter(luan-category, decimal-leading-zero); color: var(--luan-faint); font: 500 11px var(--luan-mono); letter-spacing: .08em; }
.category-header > span { flex: 1 1 auto; }
.category-group:first-child .category-header, #search-results + .category-group .category-header { margin-top: 0; }
.category-header:hover, .category-header:hover .category-chevron { color: var(--luan-ink); }
.category-header:hover > span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.category-chevron { color: var(--luan-muted); }

/* Tools sit in a ruled grid: overlapping 1px borders give single rules between cells. */
.category-tools, #search-results { gap: 0 !important; padding: 0 1px 1px 0; }
.category-tools { margin-top: 6px; }
.tool-card {
  position: relative;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 9.5rem;
  padding: 20px 18px 22px;
  margin: 0 -1px -1px 0;
  background-color: var(--luan-void);
  border: 1px solid var(--luan-line);
  border-radius: 0;
  color: var(--luan-text);
  text-align: start;
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease;
}
.tool-card:hover { z-index: 1; background-color: var(--luan-raise); border-color: var(--luan-ink); box-shadow: none; transform: none; }
.tool-card:focus-visible { z-index: 2; }
.tool-card > i, .tool-card > svg { width: 22px; height: 22px; margin-bottom: 22px; color: var(--luan-ink); font-size: 22px; }
.tool-card h3 { color: var(--luan-ink); font-size: 16px; font-weight: 500; letter-spacing: -.01em; line-height: 1.3; }
.tool-card p { padding: 0; margin-top: 6px; color: var(--luan-muted); font-size: 13px; line-height: 1.5; }
.compact-mode .tool-card { min-height: 52px; padding: 12px 16px; margin: 0; background-color: transparent; border-bottom-color: var(--luan-line); }
.compact-mode .tool-card > :is(i, svg) { width: 18px; height: 18px; margin-bottom: 0; font-size: 18px; }
.compact-mode .tool-card:hover { background-color: var(--luan-raise); border-color: var(--luan-line); border-bottom-color: var(--luan-ink); }

/* ---------------------------------------------------------- tool pages */

#uploader { padding-top: clamp(28px, 5vw, 64px); padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right)); }
#tool-uploader, #tool-interface {
  padding-inline: 0;
  padding-top: 0;
  background-color: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--luan-text);
}
#tool-uploader.max-w-2xl, #tool-interface.max-w-4xl { width: min(100%, 46rem); max-width: none; }
#tool-interface.max-w-4xl { width: min(100%, 56rem); }
#back-to-tools, #back-to-grid {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  margin-bottom: 18px;
  color: var(--luan-muted);
  font: 500 11px var(--luan-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
#back-to-tools:hover, #back-to-grid:hover { color: var(--luan-ink); }
#back-to-tools:hover span, #back-to-grid:hover span { text-decoration: underline; text-underline-offset: 5px; }
#back-to-tools svg, #back-to-grid svg, #back-to-tools > i, #back-to-grid > i { width: 16px; height: 16px; }
[data-bentopdf-breadcrumb] { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: 18px; color: var(--luan-faint); font: 500 11px/1.6 var(--luan-mono); letter-spacing: .08em; text-transform: uppercase; }
[data-bentopdf-breadcrumb] a { color: var(--luan-muted); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .3); text-underline-offset: 5px; }
[data-bentopdf-breadcrumb] a:hover { color: var(--luan-ink); text-decoration-color: currentColor; }
[data-bentopdf-breadcrumb] [aria-current] { color: var(--luan-lead); }
:is(#tool-uploader, #tool-interface) h1 { margin-bottom: 14px; font-size: clamp(38px, 5vw, 64px); letter-spacing: -.05em; line-height: 1; }
:is(#tool-uploader, #tool-interface) h1 + p { max-width: 52ch; margin-bottom: clamp(28px, 3vw, 40px); color: var(--luan-lead); font-size: 17px; line-height: 1.6; text-wrap: pretty; }
#tool-interface { color: var(--luan-text); }

/* Drop zone: the one framed surface on the page. */
:is(#drop-zone, [id$='drop-zone'], [id$='-dropzone']) {
  background-color: var(--luan-void);
  border: 1px dashed var(--luan-field);
  border-radius: 0;
  transition: background-color .18s ease, border-color .18s ease;
}
:is(#drop-zone, [id$='drop-zone'], [id$='-dropzone']):hover { background-color: var(--luan-raise); border-color: var(--luan-ink); }
:is(#drop-zone, [id$='drop-zone'], [id$='-dropzone']):focus-within { border-style: solid; border-color: var(--luan-ink); }
:is(#drop-zone, [id$='drop-zone'], [id$='-dropzone']) > div > i:first-child { margin-bottom: 18px; color: var(--luan-ink); font-size: 32px; }
:is(#drop-zone, [id$='drop-zone'], [id$='-dropzone']) p { color: var(--luan-muted); }
:is(#drop-zone, [id$='drop-zone'], [id$='-dropzone']) p .font-semibold { color: var(--luan-ink); font-weight: 500; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .4); text-underline-offset: 5px; }
:is(#drop-zone, [id$='drop-zone'], [id$='-dropzone']) p.text-xs { color: var(--luan-faint); font-family: var(--luan-mono); letter-spacing: .02em; }
#file-controls .btn, #file-controls button { min-height: 44px; }
/* "Add more" sits beside the real primary action, so it steps down to an outline. */
#file-controls [class~='bg-indigo-600'] { background-color: transparent; box-shadow: inset 0 0 0 1px var(--luan-ink); color: var(--luan-ink); }
#file-controls [class~='bg-indigo-600']:hover { background-color: #141414; }
#file-list > li, #file-display-area > div { border-radius: 0; }
.sortable-ghost { border: 1px dashed var(--luan-ink); }
.saved-signature.selected { border-color: var(--luan-ink); box-shadow: 0 0 0 1px var(--luan-ink); }
.pdf-panel { background-color: var(--luan-raise); border: 1px solid var(--luan-line); border-radius: 0; }
.compare-viewer-wrapper[class*='border-slate'] { border-color: var(--luan-line); }

/* EmbedPDF (PDF editor) themes itself through --ep-* tokens on its shadow host;
   declarations on the host element outrank its own :host defaults. Page rendering is untouched. */
embedpdf-container {
  --font-sans: var(--luan-sans);
  --font-mono: var(--luan-mono);
  --radius-md: 0;
  --radius-lg: 0;
  --radius-xl: 0;
  --radius-2xl: 0;
  --ep-background-app: #000000;
  --ep-background-surface: #070707;
  --ep-background-surface-alt: #141414;
  --ep-background-elevated: #0a0a0a;
  --ep-background-overlay: rgba(0, 0, 0, .8);
  --ep-background-input: #000000;
  --ep-foreground-primary: #ffffff;
  --ep-foreground-secondary: #d4d4d4;
  --ep-foreground-muted: #aaaaaa;
  --ep-foreground-disabled: #6b6b6b;
  --ep-foreground-on-accent: #000000;
  --ep-border-default: #454545;
  --ep-border-subtle: #2b2b2b;
  --ep-border-strong: #6b6b6b;
  --ep-accent-primary: #ffffff;
  --ep-accent-primary-hover: #d4d4d4;
  --ep-accent-primary-active: #bdbdbd;
  --ep-accent-primary-light: #262626;
  --ep-accent-primary-foreground: #000000;
  --ep-interactive-hover: #1c1c1c;
  --ep-interactive-active: #2b2b2b;
  --ep-interactive-selected: #262626;
  --ep-interactive-focus: #ffffff;
  --ep-interactive-focus-ring: #ffffff;
  --ep-state-error: #ffffff;
  --ep-state-error-light: #1c1c1c;
  --ep-state-warning: #ededed;
  --ep-state-warning-light: #1c1c1c;
  --ep-state-success: #ffffff;
  --ep-state-success-light: #1c1c1c;
  --ep-state-info: #ffffff;
  --ep-state-info-light: #1c1c1c;
  --ep-tooltip-background: #ffffff;
  --ep-tooltip-foreground: #000000;
  --ep-scrollbar-track: #000000;
  --ep-scrollbar-thumb: #454545;
  --ep-scrollbar-thumb-hover: #6b6b6b;
  font-family: var(--luan-sans);
}

/* Secondary content: steps, related tools and FAQ (hidden by Simple mode in English). */
section.max-w-4xl, section.max-w-6xl { width: var(--luan-width); max-width: 56rem; }
section.max-w-6xl { max-width: 1240px; }
:is(section.max-w-4xl, section.max-w-6xl) > h2 { padding-top: 18px; border-top: 1px solid var(--luan-line); font-size: clamp(26px, 2.6vw, 36px); text-align: start; }
section.max-w-4xl .flex-shrink-0.w-10.h-10 { width: 36px; height: 36px; background: transparent; box-shadow: inset 0 0 0 1px var(--luan-line-strong); color: var(--luan-ink); font: 500 12px var(--luan-mono); }
section.max-w-6xl a.block { padding: 18px; background: var(--luan-void); border-color: var(--luan-line); }
section.max-w-6xl a.block:hover { background: var(--luan-raise); border-color: var(--luan-ink); }
details[class*='bg-gray-800'] { padding: 0; background: transparent; border-width: 1px 0 0; border-color: var(--luan-line); }
details[class*='bg-gray-800'] > summary { display: flex; min-height: 56px; padding: 14px 0; align-items: center; color: var(--luan-ink); font-weight: 500; }
details[class*='bg-gray-800'] > summary:hover { text-decoration: underline; text-underline-offset: 5px; }
details[class*='bg-gray-800'] > p { margin: 0 0 18px; color: var(--luan-text); }

/* --------------------------------------------------------------- modals */

:is(#loader-modal, #alert-modal, #preview-modal, #shortcuts-modal, #warning-modal) { background-color: rgba(0, 0, 0, .86); }
:is(#loader-modal, #alert-modal, #shortcuts-modal, #warning-modal) > div {
  background-color: var(--luan-void);
  border: 1px solid var(--luan-line-strong);
  border-radius: 0;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .66);
}
:is(#alert-modal, #warning-modal, #shortcuts-modal) h3 { color: var(--luan-ink); font-size: 22px; font-weight: 470; letter-spacing: -.02em; }
:is(#alert-modal, #warning-modal) :is(#alert-message, #warning-message) { color: var(--luan-lead); font-size: 15px; line-height: 1.6; }
:is(#alert-ok, #warning-confirm-btn, #warning-cancel-btn) { min-height: 44px; }
#alert-modal > div { text-align: start; }
#warning-icon { width: 40px; height: 40px; background: transparent; box-shadow: inset 0 0 0 1px var(--luan-ink); }
#warning-modal .bg-gray-850, #shortcuts-modal .bg-gray-850 { background-color: var(--luan-raise); }
#shortcuts-tab-btn, #preferences-tab-btn { min-height: 48px; }
.shortcut-key { min-width: 1.6rem; height: 1.6rem; background-color: transparent; border: 1px solid var(--luan-field); border-radius: 0; box-shadow: none; color: var(--luan-lead); font-family: var(--luan-mono); }
.shortcut-input { font-family: var(--luan-mono); }
.shortcut-input:focus { border-color: var(--luan-ink); box-shadow: none; }
#shortcuts-list::-webkit-scrollbar-track { background: var(--luan-void); }
#shortcuts-list::-webkit-scrollbar-thumb { background: var(--luan-field); border-radius: 0; }
#preview-modal > div { border-radius: 0; }

/* Loading: a thin ring and plain text, no colour wash. */
.solid-spinner { width: 44px; height: 44px; border: 2px solid #2b2b2b; border-top-color: var(--luan-ink); border-bottom-color: #2b2b2b; }
#loader-text { color: var(--luan-ink); font-size: 16px; font-weight: 500; }
.loader-progress-text { font-family: var(--luan-mono); }

#scroll-to-top-btn { right: max(20px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom)); width: 48px; height: 48px; padding: 0; display: grid; place-items: center; }

/* --------------------------------------------------------------- footer */

footer[data-simple-footer] {
  margin-top: clamp(72px, 9vw, 128px);
  padding: 28px 0 max(36px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--luan-line);
}
footer[data-simple-footer] > .container { width: var(--luan-width); max-width: none; padding-inline: 0; }
footer[data-simple-footer] > .container > .flex { align-items: flex-start; gap: 24px 48px; }
footer[data-simple-footer] img { width: 20px; height: 20px; filter: grayscale(1); }
footer[data-simple-footer] .text-lg { color: var(--luan-ink); font-size: 16px; font-weight: 500; }
footer[data-simple-footer] .text-sm { color: var(--luan-muted); font-size: 13px; }
footer[data-simple-footer] .text-xs { color: var(--luan-faint); font: 500 11px var(--luan-mono); letter-spacing: .08em; text-transform: uppercase; }
.luan-credit { max-width: 62ch; margin: 14px 0 0; color: var(--luan-muted); font-size: 13px; line-height: 1.6; }
.luan-credit a { display: inline-flex; align-items: center; min-height: 32px; color: var(--luan-ink); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .4); text-underline-offset: 5px; }
.luan-credit a:hover { text-decoration-color: currentColor; }
#simple-mode-lang-switcher button { min-height: 44px; }

/* ---------------------------------------------------------- legal pages */

.legal-content h2 { color: var(--luan-ink); font-weight: 470; }
.legal-content h3 { color: var(--luan-lead); font-weight: 500; }
.legal-content :is(p, ul) { color: var(--luan-text); }
.legal-content a, .legal-content a:hover { color: var(--luan-ink); text-decoration-color: rgba(255, 255, 255, .4); text-underline-offset: 5px; }
.marker::after, .marker-slanted::before { background: var(--luan-line-strong); }
.marker-text { background-color: rgba(255, 255, 255, .16); }
.section-divider { background: var(--luan-line); }
.bg-grid-pattern { display: none; }

/* --------------------------------------------------------------- mobile */

@media (max-width: 760px) {
  .luan-links { display: none; }
}
@media (max-width: 640px) {
  body > nav:first-of-type > .container > div { gap: 8px 14px; }
  .luan-powered { display: none; }
  #tools-header { padding-top: 28px; }
  #tools-header h1 { font-size: clamp(46px, 13vw, 60px); }
  .tool-card { min-height: 8.5rem; padding: 16px 14px 18px; }
  .tool-card > i, .tool-card > svg { margin-bottom: 16px; }
  /* Two columns on a phone: long upstream blurbs would make every row a screen tall. */
  .tool-card p { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; }
  .category-header { min-height: 56px; }
  :is(#tool-uploader, #tool-interface) h1 { font-size: clamp(34px, 10vw, 44px); }
  :is(#tool-uploader, #tool-interface) h1 + p { font-size: 16px; }
  #search-bar { font-size: 16px; }
  footer[data-simple-footer] > .container > .flex { flex-direction: column; }
}
@media (max-width: 400px) {
  body > nav:first-of-type .flex-shrink-0 > span:not(.luan-powered) { font-size: 14px; }
  body > nav:first-of-type .flex-shrink-0 > span.text-gray-400 { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html:not([mozdisallowselectionprint]) { scroll-behavior: auto; }
}
