/* ==========================================================================
   TrustPDF design
   Light only. Bootstrap 5 with a small set of overrides.
   ========================================================================== */

:root {
  --tp-primary: #2f5bea;
  --tp-primary-dark: #2448c0;
  --tp-primary-soft: #e9efff;
  --tp-accent: #0ea5a4;
  --tp-ink: #111827;
  --tp-muted: #6b7280;
  --tp-bg: #f6f8fc;
  --tp-surface: #ffffff;
  --tp-border: #e5e9f2;
  --tp-radius: 1rem;
  --tp-shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 8px 24px rgba(17, 24, 39, 0.06);
  --tp-shadow-lg: 0 2px 4px rgba(17, 24, 39, 0.05), 0 20px 40px rgba(47, 91, 234, 0.12);

  --bs-primary: var(--tp-primary);
  --bs-primary-rgb: 47, 91, 234;
  --bs-link-color: var(--tp-primary);
  --bs-link-color-rgb: 47, 91, 234;
  --bs-link-hover-color: var(--tp-primary-dark);
  --bs-link-hover-color-rgb: 36, 72, 192;
  --bs-body-bg: var(--tp-bg);
  --bs-body-color: var(--tp-ink);
  --bs-secondary-color: var(--tp-muted);
  --bs-border-color: var(--tp-border);
  --bs-border-radius: 0.75rem;
  --bs-border-radius-lg: var(--tp-radius);
  --bs-font-sans-serif: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background:
    radial-gradient(900px 500px at 10% -10%, #e9efff 0%, transparent 60%),
    radial-gradient(800px 400px at 95% 0%, #e6f7f6 0%, transparent 55%),
    var(--tp-bg);
  color: var(--tp-ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display-5, .display-6 {
  letter-spacing: -0.02em;
  font-weight: 700;
}

.lead {
  color: var(--tp-muted);
  font-weight: 400;
}

code {
  color: var(--tp-primary-dark);
  background: var(--tp-primary-soft);
  padding: 0.1em 0.4em;
  border-radius: 0.35rem;
}

/* Buttons --------------------------------------------------------------- */

.btn {
  --bs-btn-border-radius: 0.75rem;
  --bs-btn-font-weight: 600;
  --bs-btn-padding-x: 1.1rem;
  --bs-btn-padding-y: 0.6rem;
}

.btn-primary {
  --bs-btn-bg: var(--tp-primary);
  --bs-btn-border-color: var(--tp-primary);
  --bs-btn-hover-bg: var(--tp-primary-dark);
  --bs-btn-hover-border-color: var(--tp-primary-dark);
  --bs-btn-active-bg: var(--tp-primary-dark);
  --bs-btn-active-border-color: var(--tp-primary-dark);
  --bs-btn-disabled-bg: #9db3f5;
  --bs-btn-disabled-border-color: #9db3f5;
  box-shadow: 0 6px 16px rgba(47, 91, 234, 0.25);
}

.btn-success {
  --bs-btn-bg: #16a34a;
  --bs-btn-border-color: #16a34a;
  --bs-btn-hover-bg: #15803d;
  --bs-btn-hover-border-color: #15803d;
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.25);
}

.btn-outline-secondary {
  --bs-btn-color: #374151;
  --bs-btn-border-color: #d6dbe6;
  --bs-btn-hover-bg: #f3f5fa;
  --bs-btn-hover-color: #111827;
  --bs-btn-hover-border-color: #c3cad9;
  --bs-btn-active-bg: #eceff6;
  --bs-btn-active-border-color: #c3cad9;
  --bs-btn-active-color: #111827;
}

.btn-sm {
  --bs-btn-padding-x: 0.8rem;
  --bs-btn-padding-y: 0.35rem;
  --bs-btn-border-radius: 0.6rem;
}

.btn-lg {
  --bs-btn-padding-x: 1.5rem;
  --bs-btn-padding-y: 0.8rem;
  --bs-btn-border-radius: 0.9rem;
}

/* Forms ----------------------------------------------------------------- */

.form-control, .form-select {
  border-radius: 0.7rem;
  border-color: #d6dbe6;
  padding: 0.6rem 0.9rem;
  background-color: #fff;
}

.form-control:focus, .form-select:focus {
  border-color: var(--tp-primary);
  box-shadow: 0 0 0 0.25rem rgba(47, 91, 234, 0.15);
}

.form-check-input:checked {
  background-color: var(--tp-primary);
  border-color: var(--tp-primary);
}

.form-label {
  font-weight: 600;
  color: #374151;
}

/* Cards ----------------------------------------------------------------- */

.card {
  --bs-card-border-color: var(--tp-border);
  --bs-card-border-radius: var(--tp-radius);
  --bs-card-bg: var(--tp-surface);
  box-shadow: var(--tp-shadow);
}

.card.shadow-sm, .card.shadow {
  box-shadow: var(--tp-shadow) !important;
}

.alert {
  border-radius: 0.8rem;
  border-width: 0;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--tp-border);
}

.site-header .navbar {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.brand-icon {
  border-radius: 0.6rem;
}

.brand-text {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--tp-ink);
}

.brand-accent {
  color: var(--tp-primary);
}

.site-header .nav-link {
  color: #374151;
  font-weight: 500;
  border-radius: 0.6rem;
  padding: 0.45rem 0.8rem;
}

.site-header .nav-link:hover,
.site-header .nav-link:focus {
  color: var(--tp-primary);
  background: var(--tp-primary-soft);
}

.site-header .nav-link.active {
  color: var(--tp-primary);
  font-weight: 600;
}

.dropdown-menu {
  --bs-dropdown-border-color: var(--tp-border);
  --bs-dropdown-border-radius: 0.9rem;
  --bs-dropdown-padding-y: 0.5rem;
  --bs-dropdown-link-active-bg: var(--tp-primary-soft);
  --bs-dropdown-link-active-color: var(--tp-primary);
  --bs-dropdown-link-hover-bg: #f3f5fa;
  box-shadow: var(--tp-shadow-lg);
}

.tools-menu {
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

.tools-menu .dropdown-header {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tp-muted);
  padding: 0.5rem 1rem 0.25rem;
}

@media (min-width: 992px) {
  .tools-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    column-gap: 0.25rem;
    padding: 0 0.25rem;
  }
}

.tools-menu .dropdown-item {
  border-radius: 0.6rem;
  margin: 0 0.4rem;
  width: auto;
  padding: 0.45rem 0.6rem;
}

/* Hero ------------------------------------------------------------------ */

.hero {
  padding: 3.5rem 0 2.5rem;
  text-align: center;
}

.hero-logo {
  width: 120px;
  height: 120px;
  border-radius: 2rem;
  background: #fff;
  box-shadow: var(--tp-shadow-lg);
  padding: 0.75rem;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero h1 .highlight {
  background: linear-gradient(90deg, var(--tp-primary), var(--tp-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .lead {
  max-width: 640px;
  margin: 0 auto 1.5rem;
  font-size: 1.15rem;
}

.trust-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--tp-border);
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  box-shadow: var(--tp-shadow);
}

.trust-badge i {
  color: var(--tp-accent);
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tp-muted);
  text-align: center;
  margin-bottom: 1.25rem;
}

/* Tool cards ------------------------------------------------------------ */

.tool-card {
  display: block;
  height: 100%;
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  padding: 1.5rem 1.25rem;
  text-align: center;
  text-decoration: none;
  color: var(--tp-ink);
  box-shadow: var(--tp-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.tool-card:hover,
.tool-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(47, 91, 234, 0.35);
  box-shadow: var(--tp-shadow-lg);
  color: var(--tp-ink);
  outline: none;
}

.tool-card .tool-group {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tp-primary);
  background: var(--tp-primary-soft);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.tool-card .tool-icon {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  margin: 1rem auto 1rem;
  background: #fff;
  border: 1px solid var(--tp-border);
  padding: 0.3rem;
  transition: transform 0.2s ease;
}

.tool-card:hover .tool-icon {
  transform: scale(1.05);
}

.tool-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.tool-card p {
  color: var(--tp-muted);
  font-size: 0.925rem;
  margin: 0;
}

.tool-card .tool-cta {
  display: inline-block;
  margin-top: 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--tp-primary);
}

/* Feature strip (home) -------------------------------------------------- */

.feature {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.feature-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tp-primary-soft);
  color: var(--tp-primary);
  font-size: 1.25rem;
}

.feature h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.feature p {
  color: var(--tp-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* Tool pages ------------------------------------------------------------ */

.tool-header {
  text-align: center;
  margin-bottom: 2rem;
}

.tool-header .tool-icon-lg {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--tp-border);
  box-shadow: var(--tp-shadow);
  margin-bottom: 1rem;
}

.tool-header h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
}

.tool-header .lead {
  max-width: 600px;
  margin: 0 auto 0.75rem;
}

.tool-note {
  color: var(--tp-muted);
  font-size: 0.85rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--tp-muted);
  margin-bottom: 1rem;
}

.back-link:hover {
  color: var(--tp-primary);
}

.tool-panel {
  padding: 1.75rem;
}

@media (max-width: 575.98px) {
  .tool-panel {
    padding: 1.25rem;
  }
}

/* File list (merge, images to pdf) */
#fileList {
  --bs-list-group-border-color: var(--tp-border);
  --bs-list-group-border-radius: 0.75rem;
}

#fileList li {
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

#fileList li .file-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

#totalSize {
  font-size: 0.9rem;
  color: var(--tp-muted);
}

/* Drop zone */
.drop-zone {
  border: 2px dashed #c9d3ea;
  border-radius: var(--tp-radius);
  background: linear-gradient(180deg, #fbfcff 0%, #f3f6fd 100%);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--tp-primary);
  background: var(--tp-primary-soft);
  outline: none;
}

.drop-zone.border-primary {
  border-color: var(--tp-primary) !important;
  background: var(--tp-primary-soft);
  transform: scale(1.01);
  box-shadow: 0 0 0 6px rgba(47, 91, 234, 0.12);
}

.drop-zone-content {
  pointer-events: none;
}

.drop-zone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem auto;
  border-radius: 1.2rem;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--tp-shadow);
}

.drop-zone-icon i {
  font-size: 2rem;
  color: var(--tp-primary);
}

.drop-zone-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--tp-ink);
}

.drop-zone-subtitle {
  font-size: 0.95rem;
  color: var(--tp-muted);
  margin-top: 0.25rem;
}

.drop-zone-note {
  font-size: 0.8rem;
  color: #9aa3b5;
  margin-top: 0.75rem;
}

/* Page picker (split, rotate, remove, reorder) */
.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.page-grid li {
  position: relative;
  border: 2px solid var(--tp-border);
  border-radius: 0.75rem;
  background: #fff;
  padding: 0.5rem 0.5rem 0.25rem;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.page-grid li:hover,
.page-grid li:focus-visible {
  border-color: var(--tp-primary);
  transform: translateY(-2px);
  outline: none;
}

.page-grid li.selected {
  border-color: var(--tp-primary);
  background: var(--tp-primary-soft);
}

.page-grid li.selected::after {
  content: "\2713";
  position: absolute;
  top: 0.3rem;
  right: 0.35rem;
  width: 1.4rem;
  height: 1.4rem;
  line-height: 1.4rem;
  border-radius: 50%;
  background: var(--tp-primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.page-grid.sortable li {
  cursor: grab;
}

.page-grid .sortable-ghost {
  opacity: 0.4;
}

.page-grid canvas,
.page-grid img {
  display: block;
  max-width: 100%;
  height: 120px;
  object-fit: contain;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--tp-border);
  border-radius: 0.35rem;
  transition: transform 0.2s ease;
}

.page-grid .page-label {
  display: block;
  font-size: 0.8rem;
  margin-top: 0.35rem;
  color: var(--tp-muted);
}

.page-grid li.selected .page-label {
  color: var(--tp-primary);
  font-weight: 600;
}

.page-grid li.rotate-90 canvas { transform: rotate(90deg) scale(0.8); }
.page-grid li.rotate-180 canvas { transform: rotate(180deg); }
.page-grid li.rotate-270 canvas { transform: rotate(270deg) scale(0.8); }

/* Result area */
.result-panel {
  background: #fff;
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  box-shadow: var(--tp-shadow);
  padding: 1.75rem;
  text-align: center;
}

.result-panel .result-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}

/* Busy state */
.is-busy {
  opacity: 0.7;
  pointer-events: none;
}

/* Content pages (about, privacy, terms) --------------------------------- */

.page-header {
  text-align: center;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: clamp(1.9rem, 3.5vw, 2.6rem);
}

.content-card {
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  box-shadow: var(--tp-shadow);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1rem;
}

.content-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.content-card ul {
  padding-left: 1.2rem;
}

.content-card li + li {
  margin-top: 0.3rem;
}

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

.site-footer {
  background: #fff;
  border-top: 1px solid var(--tp-border);
  padding: 2.5rem 0 2rem;
  margin-top: 3rem;
}

.footer-heading {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tp-muted);
  margin-bottom: 0.75rem;
}

.footer-link {
  color: #374151;
  text-decoration: none;
  line-height: 1.9;
}

.footer-link:hover {
  color: var(--tp-primary);
  text-decoration: underline;
}

/* Error pages */
.error-code {
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(90deg, var(--tp-primary), var(--tp-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Home: tool categories -------------------------------------------------- */

.group-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1.5rem;
}

.group-nav a {
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  color: #374151;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--tp-border);
  background: #fff;
}

.group-nav a:hover {
  color: var(--tp-primary);
  border-color: rgba(47, 91, 234, 0.35);
}

.tool-group-section {
  scroll-margin-top: 80px;
}

.tool-group-section + .tool-group-section {
  margin-top: 2.5rem;
}

.tool-card-body {
  display: block;
}

/* Phones: compact horizontal cards so 13 tools do not need endless scrolling. */
@media (max-width: 575.98px) {
  .tool-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-align: left;
    padding: 0.85rem 1rem;
  }

  .tool-card .tool-icon {
    width: 60px;
    height: 60px;
    margin: 0;
    flex: 0 0 auto;
  }

  .tool-card h3 {
    font-size: 1.05rem;
    margin-bottom: 0.15rem;
  }

  .tool-card p {
    font-size: 0.85rem;
  }

  .tool-card .tool-cta {
    display: none;
  }

  .tool-group-section + .tool-group-section {
    margin-top: 1.75rem;
  }
}

.how-it-works {
  counter-reset: how;
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 900px;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.how-it-works li {
  counter-increment: how;
  background: #fff;
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  padding: 1.1rem 1.2rem 1.1rem 3.4rem;
  position: relative;
  color: var(--tp-muted);
  font-size: 0.925rem;
}

.how-it-works li strong {
  display: block;
  color: var(--tp-ink);
}

.how-it-works li::before {
  content: counter(how);
  position: absolute;
  left: 1rem;
  top: 1.05rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--tp-primary-soft);
  color: var(--tp-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* FAQ (home and tool pages) */
.faq {
  max-width: 820px;
}

.faq details {
  background: #fff;
  border: 1px solid var(--tp-border);
  border-radius: 0.85rem;
  padding: 0.85rem 1.1rem;
}

.faq details + details {
  margin-top: 0.6rem;
}

.faq summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  color: var(--tp-primary);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1;
}

.faq details[open] summary::after {
  content: "\2212";
}

.faq details p {
  margin: 0.6rem 0 0;
  color: #374151;
}

/* Tool pages: breadcrumb, badges, about section ----------------------- */

.tp-breadcrumb {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  --bs-breadcrumb-divider-color: #9aa3b5;
}

.tp-breadcrumb a {
  color: var(--tp-muted);
  text-decoration: none;
}

.tp-breadcrumb a:hover {
  color: var(--tp-primary);
}

.tp-breadcrumb .active {
  color: #374151;
}

.trust-badges-sm .trust-badge {
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  box-shadow: none;
}

.tool-info h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.75rem;
  scroll-margin-top: 80px;
}

.tool-info h2:first-child {
  margin-top: 0;
}

.tool-info > p {
  color: #374151;
}

.tool-info .steps {
  padding-left: 1.25rem;
  color: #374151;
}

.tool-info .steps li + li {
  margin-top: 0.35rem;
}

.related-tools {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.related-tool {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid var(--tp-border);
  border-radius: 0.85rem;
  padding: 0.75rem;
  text-decoration: none;
  color: var(--tp-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.related-tool:hover {
  border-color: rgba(47, 91, 234, 0.35);
  box-shadow: var(--tp-shadow);
  color: var(--tp-ink);
}

.related-tool img {
  border-radius: 50%;
  border: 1px solid var(--tp-border);
  flex: 0 0 auto;
}

.related-tool strong {
  display: block;
  font-size: 0.95rem;
}

.related-tool span span {
  display: block;
  color: var(--tp-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

#textPreview {
  white-space: pre-wrap;
}

.footer-tools {
  columns: 2;
  column-gap: 1.5rem;
}

/* Page preview with an overlay (crop, sign) ----------------------------- */

.preview-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  border: 1px solid var(--tp-border);
  border-radius: 0.5rem;
  box-shadow: var(--tp-shadow);
  background: #fff;
  line-height: 0;
  overflow: hidden;
}

.preview-stage canvas {
  display: block;
  max-width: 100%;
  border-radius: 0.5rem;
}

.preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.crop-box {
  position: absolute;
  border: 2px dashed var(--tp-primary);
  background: rgba(47, 91, 234, 0.08);
  box-shadow: 0 0 0 9999px rgba(17, 24, 39, 0.35);
  cursor: move;
  box-sizing: border-box;
}

.crop-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border: 2px solid var(--tp-primary);
  border-radius: 50%;
}

.crop-handle[data-handle="nw"] { top: -9px; left: -9px; cursor: nwse-resize; }
.crop-handle[data-handle="ne"] { top: -9px; right: -9px; cursor: nesw-resize; }
.crop-handle[data-handle="sw"] { bottom: -9px; left: -9px; cursor: nesw-resize; }
.crop-handle[data-handle="se"] { bottom: -9px; right: -9px; cursor: nwse-resize; }

.redact-box {
  position: absolute;
  background: #000;
  outline: 2px solid var(--tp-primary);
  box-sizing: border-box;
}

.redact-draft {
  opacity: 0.6;
}

.redact-remove {
  position: absolute;
  top: -11px;
  right: -11px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid var(--tp-primary);
  border-radius: 50%;
  background: #fff;
  color: var(--tp-primary);
  font-size: 15px;
  line-height: 16px;
  cursor: pointer;
}

.signature-overlay {
  position: absolute;
  cursor: move;
  outline: 2px dashed var(--tp-primary);
  outline-offset: 4px;
  background: rgba(255, 255, 255, 0.3);
}

.signature-pad-wrapper {
  border: 2px dashed #c9d3ea;
  border-radius: 0.75rem;
  background: #fff;
  overflow: hidden;
}

.signature-pad {
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* Small helpers that replace inline style attributes (the CSP allows none). */
.author-photo { width: 120px; height: 120px; object-fit: cover; }
.promo-img { max-height: 220px; object-fit: contain; }
.narrow-page { max-width: 40rem; }

/* Home page: tool search --------------------------------------------------- */
.tool-search {
  position: relative;
  max-width: 420px;
  margin: 0 auto 1rem;
}

.tool-search .bi-search {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tp-muted);
  pointer-events: none;
}

.tool-search .form-control {
  border-radius: 999px;
  padding-left: 2.6rem;
  box-shadow: var(--tp-shadow);
}

/* Phones: get to the tools quickly, and keep Save within reach ------------- */
@media (max-width: 575.98px) {
  main.container {
    padding-top: 1.25rem !important;
  }

  .hero {
    padding: 0.5rem 0 1.25rem;
  }

  .hero-logo {
    display: none;
  }

  .hero .lead {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  .hero .trust-badge {
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
  }

  /* The Save / Start again buttons stay at the bottom of the screen while the
     result panel is on the page, however far the visitor has scrolled. */
  #downloadArea:not(.d-none) .result-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    margin: 0;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--tp-border);
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
    flex-wrap: nowrap !important;
  }

  #downloadArea:not(.d-none) .result-actions .btn {
    flex: 1 1 0;
    font-size: 1rem;
    padding: 0.6rem 0.5rem;
    white-space: nowrap;
  }

  body:has(#downloadArea:not(.d-none)) .site-footer {
    padding-bottom: 5.5rem;
  }
}
