/* ==========================================================================
   quickPDFs — Design tokens
   Two named themes sharing one brand hue (red/crimson):
     - Default (no class needed)  : "Crimson Vault" — a dark, secure vault:
                                    near-black charcoal warmed with maroon,
                                    glowing crimson accents.
     - body.theme-light           : "Rose Paper"    — warm paper-white with a
                                    faint rose blush and deep ruby ink.

   Every color used anywhere in this project MUST be one of the tokens below.
   Never hard-code a hex value inside a component rule — see
   docs/UNIVERSAL_DESIGN_PLAYBOOK.md §3.

   Two-tier accent (same convention as the sibling sites): --accent is the
   fill/border/icon red, always paired with --accent-contrast-text on top.
   --accent-ink is what text/links use sitting directly on the page
   background — in "Crimson Vault" it is a brighter coral-red (≈6.3:1 on the
   near-black page), in "Rose Paper" a deep ruby (≈6.9:1 on the warm white).
   ========================================================================== */

:root {
  /* Layered backgrounds */
  --bg-page: #150f11;
  --bg-surface: #1d1519;
  --bg-elevated: #261b20;
  --bg-overlay: rgba(10, 6, 8, 0.74);

  /* Brand accent (red/crimson) */
  --accent: #e5484d;
  --accent-hover: #f2555a;
  --accent-ink: #ff7075;
  --accent-ink-hover: #ff9296;
  --accent-dim: rgba(229, 72, 77, 0.14);
  --accent-contrast-text: #ffffff;

  /* Semantic status */
  --success: #57c77c;
  --success-dim: rgba(87, 199, 124, 0.14);
  --warning: #ffa53e;
  --warning-dim: rgba(255, 165, 62, 0.14);
  --danger: #ff6a5e;
  --danger-dim: rgba(255, 106, 94, 0.14);
  --info: #59b8e8;
  --info-dim: rgba(89, 184, 232, 0.14);

  /* Extended palette — one hover/accent identity per tool tab */
  --tool-teal: #3fc9c0;
  --tool-purple: #a78bfa;
  --tool-rose: #f472a0;
  --tool-blue: #59a6e8;
  --tool-green: #6fcf7a;
  --tool-amber: #ffb84a;

  /* Text */
  --text-1: #f4edee;
  --text-2: #b5a8ab;
  --text-3: #7d6e72;

  /* Borders / shadows */
  --border: #382b30;
  --border-subtle: #291f23;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);

  /* Per-component */
  --navbar-bg: #1a1215;
  --card-bg: var(--bg-surface);
  --modal-bg: var(--bg-elevated);
  --modal-hdr-bg: var(--bg-surface);
  --input-bg: #120d0f;
  --input-border: var(--border);
  --toolbar-btn-bg: #241a1e;
  --scrollbar-thumb: #4a383e;
  --scrollbar-track: transparent;

  /* PDF page stage — the neutral backdrop rendered pages sit on, and the
     paper color of the page canvas itself (always white, like real paper) */
  --stage-bg: #0e0a0c;
  --paper: #ffffff;

  color-scheme: dark;
}

body.theme-light {
  /* Layered backgrounds */
  --bg-page: #fffaf8;
  --bg-surface: #fbf1ee;
  --bg-elevated: #ffffff;
  --bg-overlay: rgba(60, 20, 20, 0.35);

  /* Brand accent */
  --accent: #c62f35;
  --accent-hover: #a8262b;
  --accent-ink: #a42329;
  --accent-ink-hover: #7f1a1f;
  --accent-dim: rgba(178, 36, 42, 0.1);
  --accent-contrast-text: #ffffff;

  /* Semantic status */
  --success: #1e8449;
  --success-dim: rgba(30, 132, 73, 0.1);
  --warning: #b15c00;
  --warning-dim: rgba(177, 92, 0, 0.1);
  --danger: #c23b32;
  --danger-dim: rgba(194, 59, 50, 0.1);
  --info: #1d6fa5;
  --info-dim: rgba(29, 111, 165, 0.1);

  /* Extended palette */
  --tool-teal: #0e8a82;
  --tool-purple: #6e4fd1;
  --tool-rose: #c23572;
  --tool-blue: #1d6fa5;
  --tool-green: #1e8449;
  --tool-amber: #9a6a00;

  /* Text */
  --text-1: #241418;
  --text-2: #5f4b50;
  --text-3: #948186;

  /* Borders / shadows */
  --border: #eed9d3;
  --border-subtle: #f5e8e3;
  --shadow-sm: 0 2px 8px rgba(120, 40, 30, 0.1);
  --shadow-md: 0 8px 24px rgba(120, 40, 30, 0.14);
  --shadow-lg: 0 24px 60px rgba(120, 40, 30, 0.2);

  /* Per-component */
  --navbar-bg: #fdf3f0;
  --card-bg: var(--bg-surface);
  --modal-bg: var(--bg-elevated);
  --modal-hdr-bg: #fbf1ee;
  --input-bg: #ffffff;
  --input-border: var(--border);
  --toolbar-btn-bg: #ffffff;
  --scrollbar-thumb: #e3c9c1;
  --scrollbar-track: transparent;

  --stage-bg: #f0e3de;
  --paper: #ffffff;

  color-scheme: light;
}

/* ==========================================================================
   Base / reset
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text-1);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  transition: background-color 0.25s ease, color 0.25s ease;
}

p {
  color: var(--text-2);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-1);
}

a {
  color: var(--accent-ink);
}

a:hover {
  color: var(--accent-ink-hover);
}

code, pre, .mono {
  font-family: "JetBrains Mono", "Consolas", monospace;
}

button {
  font-weight: 600;
}

hr {
  border-color: var(--border);
  opacity: 1;
}

::selection {
  background: var(--accent-dim);
  color: var(--text-1);
}

/* Consistent, visible keyboard-focus ring everywhere (accessibility) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 96px 16px 48px;
}

.visually-hidden-focusable-skip {
  position: absolute;
  left: -9999px;
  top: 0;
}
.visually-hidden-focusable-skip:focus {
  left: 16px;
  top: 8px;
  z-index: 2000;
  background: var(--accent);
  color: var(--accent-contrast-text);
  padding: 8px 14px;
  border-radius: 8px;
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
