/* Self-hosted — the privacy policy promises no third-party requests beyond
   Google Analytics, so this must never come from a fonts CDN. Single variable
   file, weights 300-700, used for everything: headings, body, and controls. */
@font-face {
    font-family: "Google Sans Flex";
    src: url("/fonts/google-sans-flex-v22.woff2") format("woff2");
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --brand-from: #f95835;
    --brand-to: #c41138;
    --brand: #d92546;
    --ink: #14161a;
    --ink-2: #3f4249;
    --muted: #6e7076;
    --line: #e4e4e7;
    --line-2: #f0f0f1;
    --bg: #ffffff;
    --surface: #fafafa;
    --radius: 16px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
    --shadow-md: 0 4px 6px -2px rgba(16, 24, 40, .03), 0 12px 16px -4px rgba(16, 24, 40, .08);
    --shadow-lg: 0 8px 8px -4px rgba(16, 24, 40, .03), 0 20px 24px -4px rgba(16, 24, 40, .1);
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: "Google Sans Flex", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

[x-cloak] { display: none !important; }

a { color: var(--brand); }

img { max-width: 100%; }

.wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
}

.wrap-narrow { max-width: 760px; }

.center { text-align: center; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Header */

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

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 66px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
    text-decoration: none;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.logo svg { display: block; }

.logo span {
    background: linear-gradient(to bottom right, var(--brand-from), var(--brand-to));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav a {
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    font-size: 15px;
    white-space: nowrap;
}

.nav a:hover,
.nav a.active { color: var(--ink); }

/* Hero */

.hero {
    padding: 60px 0 8px;
    text-align: center;
}

h1 {
    font-size: 46px;
    line-height: 1.08;
    letter-spacing: -.02em;
    margin: 0 0 16px;
    font-weight: 700;
}

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

.lead {
    font-size: 19px;
    color: var(--ink-2);
    margin: 0 auto 22px;
    max-width: 640px;
}

.trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 22px;
    margin: 0 0 34px;
    padding: 0;
    list-style: none;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink-2);
}

.trust li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.trust svg { color: #16a34a; flex: 0 0 auto; }

/* The header is sticky, so anything an anchor jumps to needs to clear it or
   its heading lands underneath. */
[id] { scroll-margin-top: 88px; }

/* Tool shell */

.tool { padding-bottom: 20px; }

.tool-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    padding: 22px;
}

/* Drop zone — gradient frame with a white inset rule, label sits above the
   hover overlay so the whole surface stays clickable. */

.drop-zone {
    background-image: linear-gradient(to bottom right, var(--brand-from), var(--brand-to));
    border-radius: 20px;
    padding: 3px;
    position: relative;
    z-index: 0;
    cursor: pointer;
}

.drop-zone::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background-color: transparent;
    pointer-events: none;
    transition: background-color .15s ease;
}

.drop-zone:hover::after { background-color: rgba(0, 0, 0, .07); }
.drop-zone.dragover::after { background-color: rgba(0, 0, 0, .17); }

.drop-files {
    position: relative;
    z-index: 1;
    border-radius: 18px;
    padding: 68px 20px;
    text-align: center;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: #fff;
    box-shadow: 0 0 0 2px #fff inset;
    transition: box-shadow .15s ease;
}

.drop-zone.dragover .drop-files { box-shadow: 0 0 0 3px #fff inset; }

.drop-files .icon {
    display: block;
    margin: 0 auto 14px;
    opacity: .95;
}

.drop-files small {
    display: block;
    font-size: 15px;
    font-weight: 400;
    opacity: .92;
    margin-top: 10px;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 11px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: filter .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.btn:hover { filter: brightness(1.06); }

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    filter: none;
}

.btn-primary {
    background-image: linear-gradient(to bottom right, var(--brand-from), var(--brand-to));
    color: #fff;
    box-shadow: 0 1px 2px rgba(196, 17, 56, .3), 0 6px 16px -4px rgba(196, 17, 56, .35);
}

.btn-ghost {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink-2);
    box-shadow: var(--shadow-sm);
}

.btn-ghost:hover { background: var(--surface); }

.btn-lg { padding: 15px 30px; font-size: 17px; border-radius: 12px; }

.btn svg { flex: 0 0 auto; }

/* File grid */

.grid-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 2px 4px 16px;
}

.grid-head h2 {
    font-size: 17px;
    margin: 0;
    letter-spacing: -.01em;
}

.grid-hint {
    font-size: 13.5px;
    color: var(--muted);
    margin: 3px 0 0;
}

.head-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.grid-note {
    font-size: 13.5px;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 9px;
    padding: 9px 13px;
    margin: 0 0 14px;
}

/* Files ⇄ Pages switch */

.view-toggle {
    display: inline-flex;
    background: #f0f0f1;
    border-radius: 9px;
    padding: 3px;
    gap: 2px;
}

.view-toggle button {
    border: 0;
    background: none;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    padding: 6px 14px;
    border-radius: 7px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.view-toggle button:hover:not(:disabled) { color: var(--ink); }

.view-toggle button.active {
    background: #fff;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.view-toggle button:disabled { opacity: .45; cursor: not-allowed; }

/* Page grid */

.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 14px;
}

.page-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: box-shadow .16s ease, transform .16s ease;
}

.page-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.page-card:active { cursor: grabbing; }

/* Square tile: an image that fits unrotated still fits at 90°/270°, so
   rotation needs no scaling maths. */
.page-thumb {
    position: relative;
    aspect-ratio: 1;
    background: #fff;
    border-bottom: 1px solid var(--line-2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.page-thumb img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    transition: transform .2s ease;
}

.page-thumb.rot-90 img { transform: rotate(90deg); }
.page-thumb.rot-180 img { transform: rotate(180deg); }
.page-thumb.rot-270 img { transform: rotate(270deg); }

.page-tools {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 2;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity .15s ease;
}

.page-card:hover .page-tools,
.page-tools:focus-within { opacity: 1; }

.page-rotate,
.page-remove {
    width: 25px;
    height: 25px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #374151;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .2);
    transition: background-color .15s ease, color .15s ease;
}

.page-remove { font-size: 18px; }

.page-rotate:hover { background: var(--ink); color: #fff; }
.page-remove:hover { background: var(--brand-to); color: #fff; }

.page-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 7px;
    background: #f5f5f6;
    min-width: 0;
}

.page-num {
    flex: 0 0 auto;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 10px;
    background: linear-gradient(to bottom right, var(--brand-from), var(--brand-to));
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-src {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Touch devices have no hover, so the controls must always be visible. */
@media (hover: none) {
    .page-tools { opacity: 1; }
}

@media (max-width: 600px) {
    .page-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
    .page-tools { opacity: 1; }
    .head-right { width: 100%; justify-content: space-between; }
}

.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 18px;
}

.pdf-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: box-shadow .16s ease, transform .16s ease;
}

.pdf-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.pdf-card:active { cursor: grabbing; }

.pdf-card.is-error {
    border-color: #fca5a5;
    background: #fff5f5;
}

.sortable-ghost { opacity: .3; }

.sortable-drag {
    cursor: grabbing;
    box-shadow: var(--shadow-lg);
    transform: none;
}

/* Sortable's fallback clone follows the pointer; without this it keeps the
   card's own hover lift and sits a couple of pixels off the cursor. */
.sortable-fallback { opacity: .95 !important; }

.pdf-thumb {
    position: relative;
    aspect-ratio: 1 / 1.29;
    background: #fff;
    border-bottom: 1px solid var(--line-2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* `contain`, not `cover`: a landscape scan should be recognisable rather than
   cropped down to its middle. Portrait pages sit within ~0.3% of the tile
   ratio, so they fill it anyway. */
.pdf-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.thumb-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #c3c8d1;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
}

.pdf-card.is-error .thumb-fallback { color: #f0a3a3; }

.thumb-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.pdf-foot {
    padding: 9px 11px 10px;
    background: #f5f5f6;
    min-width: 0;
}

.pdf-text { min-width: 0; }

.pdf-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-meta {
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.pdf-card.is-error .pdf-meta { color: #b91c1c; }

/* Bottom-left of the preview, not top-left: the top of page one is where
   letterheads live and the badge sat right on top of them. The foot of a
   page is nearly always margin. */
.card-order {
    position: absolute;
    left: 7px;
    bottom: 7px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: linear-gradient(to bottom right, var(--brand-from), var(--brand-to));
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0, 0, 0, .2);
    pointer-events: none;
}

.pdf-card.is-error .card-order { background: #dc2626; }

/* z-index is load-bearing: .pdf-thumb is positioned and comes later in the
   DOM, so without this it paints over the button and swallows the click. */
.card-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #374151;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .2);
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.card-remove:hover,
.card-remove:focus-visible {
    background: var(--brand-to);
    color: #fff;
    box-shadow: 0 0 0 1px rgba(196, 17, 56, .5), 0 2px 8px rgba(196, 17, 56, .4);
}

/* Action bar */

.actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line-2);
}

.actions .spacer { flex: 1; }

.summary {
    font-size: 14px;
    color: var(--muted);
}

.hint {
    font-size: 13.5px;
    color: var(--muted);
    margin: 14px 4px 0;
}

.progress {
    flex: 1 1 180px;
    height: 8px;
    border-radius: 99px;
    background: var(--line);
    overflow: hidden;
}

.progress span {
    display: block;
    height: 100%;
    border-radius: 99px;
    background-image: linear-gradient(to right, var(--brand-from), var(--brand-to));
    transition: width .2s ease;
}

.alert {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 11px;
    margin-top: 18px;
    font-size: 15px;
}

/* Result */

.done { text-align: center; padding: 26px 10px 12px; }

.done .check {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #ecfdf5;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.done h2 {
    margin: 0 0 6px;
    font-size: 25px;
    letter-spacing: -.02em;
}

.done p { color: var(--muted); margin: 0 0 22px; }

.done .btn-ghost { margin-top: 14px; }

/* Content sections */

section { padding: 68px 0; }

section.alt { background: var(--surface); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }

h2 {
    font-size: 32px;
    line-height: 1.15;
    letter-spacing: -.015em;
    margin: 0 0 12px;
    font-weight: 700;
}

.section-lead {
    font-size: 17px;
    color: var(--muted);
    margin: 0 auto 44px;
    max-width: 620px;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    counter-reset: step;
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
}

.steps li {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 24px;
}

section.alt .steps li { background: var(--bg); }

.steps li::before {
    counter-increment: step;
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(to bottom right, var(--brand-from), var(--brand-to));
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 14px;
}

.steps h3 { margin: 0 0 6px; font-size: 17.5px; letter-spacing: -.01em; }
.steps p { margin: 0; color: var(--muted); font-size: 15px; }

/* Feature rows — illustration on one side, copy on the other, alternating. */

.features {
    display: flex;
    flex-direction: column;
    gap: 64px;
    text-align: left;
    margin-top: 8px;
}

.feature-row {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 24px 72px;
    align-items: center;
}

/* Even rows flip: copy left, art right — and the column widths swap with
   them so the art column stays the narrower one. */
.feature-row:nth-child(even) {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
}

.feature-row:nth-child(even) .feature-art { order: 2; }

.feature-art svg {
    display: block;
    width: 100%;
    max-width: 400px;
    height: auto;
    margin: 0 auto;
}

.feature-copy h3 {
    font-size: 24px;
    letter-spacing: -.015em;
    margin: 0 0 10px;
}

.feature-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 16.5px;
    line-height: 1.65;
    max-width: 46ch;
}

@media (max-width: 760px) {
    .features { gap: 44px; }
    .feature-row,
    .feature-row:nth-child(even) { grid-template-columns: 1fr; gap: 16px; }
    .feature-row:nth-child(even) .feature-art { order: 0; }
    .feature-art svg { max-width: 300px; }
    .feature-copy h3 { font-size: 20px; }
    .feature-copy p { max-width: none; }
}

/* FAQ */

.faq { text-align: left; }

.faq details {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 13px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.faq summary {
    cursor: pointer;
    padding: 18px 52px 18px 22px;
    font-weight: 600;
    font-size: 16.5px;
    list-style: none;
    position: relative;
}

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

.faq summary::after {
    content: "";
    position: absolute;
    right: 24px;
    top: 26px;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform .18s ease;
}

.faq details[open] summary::after { transform: rotate(-135deg); top: 30px; }

.faq details p {
    margin: 0;
    padding: 0 22px 20px;
    color: var(--ink-2);
    font-size: 15.5px;
}

.faq details p + p { padding-top: 12px; margin-top: -8px; }

/* Prose */

.prose { text-align: left; }
.prose .lead { margin-left: 0; max-width: none; }   /* h1 is left-aligned here */
.prose h2 { font-size: 26px; margin: 36px 0 10px; }
.prose h2:first-child { margin-top: 0; }
.prose p { color: var(--ink-2); font-size: 16px; }
.prose ul { color: var(--ink-2); font-size: 16px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }

/* Legal pages */

.legal-meta {
    font-size: 14.5px;
    color: var(--muted);
    margin: -4px 0 30px;
}

.prose h3 { font-size: 18px; margin: 26px 0 6px; }

.callout {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand-to);
    border-radius: 12px;
    padding: 18px 22px;
    margin: 0 0 30px;
    box-shadow: var(--shadow-sm);
}

.callout p { margin: 0; }
.callout p + p { margin-top: 10px; }

.error-code {
    font-size: 84px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.04em;
    margin: 24px 0 12px;
    background: linear-gradient(to bottom right, var(--brand-from), var(--brand-to));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

@media (max-width: 600px) {
    .error-code { font-size: 62px; }
}

.cta-band { text-align: center; }
.cta-band h2 { margin-bottom: 10px; }
.cta-band p { color: var(--muted); font-size: 17px; margin: 0 0 26px; }

/* Footer */

.site-footer {
    border-top: 1px solid var(--line);
    padding: 34px 0;
    color: var(--muted);
    font-size: 14.5px;
    background: #fff;
}

.site-footer .wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px 26px;
    flex-wrap: wrap;
}

.site-footer nav { display: flex; gap: 22px; flex-wrap: wrap; }

.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* Responsive */

@media (max-width: 860px) {
    h1 { font-size: 36px; }
    h2 { font-size: 27px; }
    section { padding: 52px 0; }
    .hero { padding-top: 40px; }
}

@media (max-width: 600px) {
    h1 { font-size: 30px; }
    .lead { font-size: 17px; }
    .nav { gap: 16px; }
    .nav a { font-size: 14px; }
    .tool-panel { padding: 14px; border-radius: 18px; }
    .drop-files { padding: 46px 16px; font-size: 20px; }
    .drop-files small { font-size: 13.5px; }
    .pdf-grid { grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 14px; }
    .actions .btn { flex: 1 1 auto; }
    .actions .spacer { display: none; }
    .summary { width: 100%; }
}

/* The in-page anchors are the first thing to go when the bar gets tight —
   the sections are still reachable by scrolling. */
@media (max-width: 700px) {
    .nav .hide-sm { display: none; }
}

@media (max-width: 400px) {
    .logo { font-size: 17px; gap: 7px; }
    .logo svg { width: 22px; height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation-duration: .01ms !important; }
    .pdf-card:hover { transform: none; }
}
