/* ══════════════════════════════════════════════════════════════════
   PDFcrest — Shared Base Stylesheet
   Source of truth: split-pdf.html / merge-pdf.html (byte-identical
   between the two before extraction). Every tool page links this
   file for the design tokens, reset, and shared components below.
   ══════════════════════════════════════════════════════════════════ */

:root {
    --indigo: #6366f1;
    --violet: #7c3aed;
    --blue: #2563eb;
    --grad-primary: linear-gradient(135deg, var(--indigo), var(--violet));
    --grad-heading: linear-gradient(135deg, var(--blue), var(--violet));
    --slate-900: #0f172a;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-100: #f1f5f9;
    --border: #e2e8f0;
    --green: #10b981;
    --red: #ef4444;
    --amber: #f59e0b;
}

/* ── Inter @font-face — self-hosted, no external CDN ── */
@font-face {
    font-family: 'Inter';
    src: url('/fonts/inter/inter-v20-latin-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('/fonts/inter/inter-v20-latin-500.woff2') format('woff2');
    font-weight: 500 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('/fonts/inter/inter-v20-latin-700.woff2') format('woff2');
    font-weight: 700 900;
    font-style: normal;
    font-display: swap;
}

/* ── Reset & base ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #ffffff;
    color: var(--slate-900);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 72rem;
    margin: 0 auto;
}

/* ── Cards ── */
.glass-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9));
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 1.5rem;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    transition: all 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.12);
}

.tool-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    border-color: var(--indigo);
}

/* ── Animations ── */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes ping {

    75%,
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: 200% 0
    }

    100% {
        background-position: -200% 0
    }
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ── Grid system ── */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-cols-6 {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1024px) {
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-cols-6 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-cols-3 {
        grid-template-columns: repeat(1, 1fr);
    }
}

@media (max-width: 640px) {
    .grid-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Page-picker thumbnail grid (split/rotate/crop/delete-pages/etc.) ── */
.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.page-thumbnail {
    position: relative;
    border: 3px solid var(--border);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    overflow: hidden;
}

.page-thumbnail:hover {
    border-color: var(--indigo);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2);
}

.page-thumbnail.selected {
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.page-thumbnail canvas {
    width: 100%;
    display: block;
    animation: fadeIn .25s ease;
}

.page-number {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: var(--grad-primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.page-checkmark {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--indigo);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.page-thumbnail.selected .page-checkmark {
    display: flex;
}

.page-thumb-skeleton {
    width: 100%;
    aspect-ratio: 1/1.414;
    background: linear-gradient(90deg, #f1f5f9 25%, #e8edf5 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@media (max-width: 1024px) {
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (max-width: 768px) {
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* ── Upload Zone ── */
.uz {
    position: relative;
    background: #f5f9ff;
    border: 2px dashed #bfdbfe;
    border-radius: 1.75rem;
    padding: 2.75rem 2rem 1.875rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .25s, background .25s, box-shadow .25s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center
}

.uz:hover,
.uz.drag-over {
    border-color: var(--indigo);
    background: #eff6ff;
    box-shadow: 0 0 0 5px rgba(99, 102, 241, .07)
}

.uz-cloud {
    width: 3.625rem;
    height: 3.625rem;
    margin-bottom: .9rem;
    flex-shrink: 0
}

.uz-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--slate-900);
    margin: 0 0 .3rem
}

.uz-hint {
    font-size: .8125rem;
    color: var(--slate-500);
    margin: 0
}

.uz-deco {
    position: absolute;
    width: 2.625rem;
    height: 2.625rem;
    border-radius: .625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .07)
}

.uz-deco-tl {
    top: 1.125rem;
    left: 1.125rem
}

.uz-deco-tr {
    top: 1.125rem;
    right: 1.125rem
}

.uz-deco-bl {
    bottom: 1.375rem;
    left: 1.125rem
}

.uz-deco-br {
    bottom: 1.375rem;
    right: 1.125rem
}

.uz-trust {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem 1rem;
    justify-content: center;
    margin-top: 1.375rem;
    font-size: .6875rem;
    font-weight: 600;
    color: var(--slate-400)
}

.uz-trust span {
    display: inline-flex;
    align-items: center;
    gap: .275rem
}

@media(max-width:540px) {
    .uz-deco {
        display: none
    }

    .uz {
        padding: 2.25rem 1.25rem 1.375rem
    }
}

/* ── TL;DR box + References list ── */
.tldr-box {
    background: #fafafe;
    border: 1px solid #c7d2fe;
    border-radius: 1.25rem;
    padding: 1.5rem 1.75rem;
}

.tldr-box li {
    margin-bottom: .5rem;
    font-size: .9rem;
    color: var(--slate-700);
    line-height: 1.7;
}

.ref-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin: 0;
    padding: 0;
}

.ref-list li {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: .875rem;
    padding: .875rem 1.125rem;
    font-size: .85rem;
    color: var(--slate-600);
    line-height: 1.6;
}

.ref-list a {
    color: var(--indigo);
    font-weight: 600;
    text-decoration: none;
}

.ref-list a:hover {
    text-decoration: underline;
}

/* ── Rich Content sections (TL;DR / How-To / Comparison / FAQ preset) ── */
.rc-section {
    padding: 3.5rem 1.5rem;
}

.rc-section-alt {
    background: #f8faff;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.rc-wrap {
    max-width: 72rem;
    margin: 0 auto;
}

.rc-wrap-md {
    max-width: 60rem;
    margin: 0 auto;
}

.rc-wrap-sm {
    max-width: 48rem;
    margin: 0 auto;
}

.rc-eyebrow {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--indigo);
    margin-bottom: .5rem;
}

.rc-h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--slate-900);
    letter-spacing: -.02em;
    line-height: 1.2;
    margin: 0 0 .75rem;
}

.rc-h2-grad {
    background: var(--grad-heading);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rc-sub {
    font-size: .9375rem;
    color: var(--slate-500);
    line-height: 1.7;
    margin: 0 0 2.5rem;
}

.rc-grid3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.rc-grid2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.rc-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.75rem 1.5rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
    transition: transform .25s, box-shadow .25s;
}

.rc-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, .1);
}

.rc-feat-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.rc-step-num {
    width: 2.25rem;
    height: 2.25rem;
    background: var(--grad-heading);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}

.rc-cmp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.rc-cmp-table th {
    background: var(--grad-primary);
    color: #fff;
    padding: .75rem 1rem;
    text-align: left;
    font-weight: 700;
}

.rc-cmp-table th:first-child {
    border-radius: .75rem 0 0 0;
}

.rc-cmp-table th:last-child {
    border-radius: 0 .75rem 0 0;
}

.rc-cmp-table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--slate-700);
}

.rc-cmp-table tr:last-child td {
    border-bottom: none;
}

.rc-cmp-table tr:nth-child(even) td {
    background: #f8faff;
}

.rc-yes {
    color: var(--green);
    font-weight: 700;
}

.rc-no {
    color: var(--red);
}

.rc-usecase-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.375rem 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transition: border-color .2s, box-shadow .2s;
}

.rc-usecase-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 4px 14px rgba(99, 102, 241, .09);
}

.rc-usecase-ic {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1.3;
}

.rc-testimonial {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}

.rc-stars {
    color: var(--amber);
    margin-bottom: .75rem;
    font-size: 1rem;
}

.rc-kw-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.rc-kw-chip {
    background: var(--slate-100);
    color: var(--slate-700);
    border-radius: 9999px;
    padding: .35rem 1rem;
    font-size: .78rem;
    font-weight: 500;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.rc-faq-item {
    background: #fff;
    border: 1.5px solid #e8edf5;
    border-radius: 1.125rem;
    margin-bottom: .75rem;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}

.rc-faq-item:hover {
    border-color: #bfdbfe;
    box-shadow: 0 4px 16px rgba(99, 102, 241, .08);
}

.rc-faq-q {
    font-size: .9375rem;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    transition: background .15s;
}

.rc-faq-q:hover {
    background: #f8faff;
}

.rc-faq-a {
    font-size: .875rem;
    color: var(--slate-600);
    line-height: 1.78;
    display: none;
    padding: .125rem 1.5rem 1.25rem;
    border-top: 1px solid #eff4ff;
    background: #f8faff;
}

.rc-faq-a.open {
    display: block;
}

.rc-faq-chevron {
    flex-shrink: 0;
    transition: transform .25s;
    color: var(--slate-400);
}

.rc-faq-chevron.open {
    transform: rotate(180deg);
    color: #3b82f6;
}

.rc-prose {
    font-size: .9375rem;
    color: var(--slate-600);
    line-height: 1.85;
}

.rc-prose p+p {
    margin-top: 1rem;
}

.rc-tip {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: .5rem;
    padding: 1.25rem 1.5rem;
    font-size: .875rem;
    color: #1e40af;
    line-height: 1.75;
    margin-top: 1.5rem;
}

.rc-flow-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}

.rc-flow-steps {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .9rem;
    font-size: .8rem;
    font-weight: 600;
}

.rc-flow-step {
    background: var(--slate-100);
    color: var(--slate-700);
    border-radius: .5rem;
    padding: .4rem .75rem;
}

.rc-flow-step a {
    color: var(--indigo);
    text-decoration: none;
}

.rc-flow-step a:hover {
    text-decoration: underline;
}

.rc-flow-arrow {
    color: var(--slate-400);
    font-weight: 400;
}

.formula-card {
    background: var(--slate-900);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.formula-card code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .8125rem;
    color: #e2e8f0;
    line-height: 1.9;
    white-space: pre;
    display: block;
}

.formula-card code b {
    color: #a5b4fc;
    font-weight: 700;
}

.rc-param-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

.rc-param-table th {
    background: var(--slate-900);
    color: #fff;
    padding: .65rem .9rem;
    text-align: left;
    font-weight: 700;
}

.rc-param-table td {
    padding: .65rem .9rem;
    border-bottom: 1px solid var(--border);
    color: var(--slate-700);
}

.rc-param-table tr:nth-child(even) td {
    background: #f8faff;
}

.rc-param-table code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .8rem;
    background: #eef2ff;
    color: #4338ca;
    padding: .1rem .4rem;
    border-radius: .3rem;
}

@media(max-width:1024px) {
    .rc-grid3 {
        grid-template-columns: repeat(2, 1fr)
    }
}

@media(max-width:768px) {

    .rc-grid2,
    .rc-grid3 {
        grid-template-columns: 1fr
    }
}

/* ── Related Tools Strip ── */
.rts-wrap {
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, #f8faff, #faf5ff);
    border-top: 1px solid rgba(148, 163, 184, .12);
    border-bottom: 1px solid rgba(148, 163, 184, .12);
}

.rts-inner {
    max-width: 72rem;
    margin: 0 auto;
}

.rts-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.125rem;
}

.rts-divider {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, #e2e8f0, transparent);
}

.rts-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--slate-400);
    white-space: nowrap;
}

.rts-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .75rem;
}

.rts-card {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    background: #fff;
    border: 1px solid #e8edf5;
    border-radius: .875rem;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .05);
    transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .22s, border-color .22s;
}

.rts-card:hover {
    transform: translateY(-3px);
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(99, 102, 241, .13);
}

.rts-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rts-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Some tool pages wrap the name+hint in a plain, unclassed <span>/<div>
   instead of .rts-text. As a flex child of .rts-card it still defaults
   to min-width:auto without this, so the card (and the whole grid) can
   overflow horizontally on narrow screens even with .rts-card's own
   min-width:0 fix. Target it structurally so every markup variant is
   covered without editing each page's HTML. */
.rts-card > *:not(.rts-icon) {
    min-width: 0;
}

.rts-name {
    font-size: .8125rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rts-hint {
    font-size: .7rem;
    color: var(--slate-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rts-card:hover .rts-name {
    color: #1e40af;
}

@media(max-width:1024px) {
    .rts-grid {
        grid-template-columns: repeat(3, 1fr)
    }
}

@media(max-width:768px) {
    .rts-grid {
        grid-template-columns: repeat(2, 1fr)
    }
}

@media(max-width:540px) {
    .rts-wrap {
        padding: 1.125rem 1rem
    }

    .rts-header {
        margin-bottom: .75rem
    }

    .rts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: .5rem
    }

    .rts-card {
        padding: .625rem .75rem;
        gap: .5rem
    }

    .rts-icon {
        width: 2rem;
        height: 2rem;
        border-radius: .5rem
    }

    .rts-name {
        font-size: .75rem
    }

    .rts-hint {
        font-size: .65rem
    }
}

@media(max-width:380px) {
    .rts-wrap {
        padding: .875rem .75rem
    }

    .rts-grid {
        gap: .4rem
    }

    .rts-card {
        padding: .5rem .625rem;
        gap: .4rem
    }

    .rts-icon {
        width: 1.75rem;
        height: 1.75rem
    }
}

/* ── How-To step cards (.hiw-*) ── */
.hiw-eyebrow{display:inline-block;font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:#3b82f6;background:#eff6ff;padding:.35rem 1.1rem;border-radius:9999px;margin-bottom:1rem}
.hiw-h2{font-size:clamp(1.5rem,3vw,2rem);font-weight:800;letter-spacing:-.025em;color:var(--slate-900);margin:0}
.hiw-sub{margin-top:.75rem;font-size:.9375rem;color:#475569;max-width:34rem;margin-inline:auto}
.hiw-grid,.hiw-grid-3,.hiw-grid-5{display:grid;align-items:start;gap:0}
.hiw-grid{grid-template-columns:1fr 2rem 1fr 2rem 1fr 2rem 1fr}
.hiw-grid-3{grid-template-columns:1fr 2rem 1fr 2rem 1fr}
.hiw-grid-5{grid-template-columns:1fr 2rem 1fr 2rem 1fr 2rem 1fr 2rem 1fr}
.hiw-card{background:#fff;border:1.5px solid #e2e8f0;border-radius:1.5rem;padding:1.75rem 1.5rem;box-shadow:0 4px 20px rgba(15,23,42,.07);position:relative;overflow:hidden;transition:transform .3s,box-shadow .3s}
.hiw-card:hover{transform:translateY(-4px);box-shadow:0 12px 32px rgba(99,102,241,.12)}
.hiw-accent{position:absolute;top:0;left:0;right:0;height:3px;background:linear-gradient(90deg,#3b82f6,#8b5cf6)}
.hiw-arrow{display:flex;align-items:center;justify-content:center;padding-top:2.5rem}

@media(max-width:1024px) {
    .hiw-grid,.hiw-grid-3,.hiw-grid-5 {
        grid-template-columns: 1fr;
        gap: 1rem
    }

    .hiw-arrow {
        display: none!important
    }
}
