/* =====================================================================
   PDFEzy — Components (components.css)
   Page-level building blocks for the homepage, tool landing pages, guides
   and content pages. Loaded AFTER main.css and tools.css so it governs the
   redesigned tool grid, modals and form controls. "Minimal-AI Clarity".
   ===================================================================== */

@layer components {

/* ----------------------------- Hero -------------------------------- */
.hero {
    position: relative;
    padding-block: clamp(3rem, 7vw, 6rem);
    text-align: center;
    overflow: hidden;
    isolation: isolate;
}
.hero::before {
    content: "";
    position: absolute;
    inset: -20% -10% auto -10%;
    height: 130%;
    z-index: -1;
    background:
        radial-gradient(60% 50% at 50% 0%, var(--accent-subtle), transparent 70%),
        radial-gradient(40% 40% at 85% 15%, color-mix(in oklch, var(--accent) 14%, transparent), transparent 70%);
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.4rem;
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.hero h1 { margin-inline: auto; max-width: 16ch; }
.hero h1 .accent { color: var(--accent); }
.hero p.lead {
    font-size: clamp(1.05rem, 0.98rem + 0.5vw, 1.3rem);
    color: var(--text-muted);
    max-width: 60ch;
    margin: 1.25rem auto 2rem;
}
.hero-buttons { display: flex; gap: 0.85rem; justify-content: center; flex-wrap: wrap; }
.hero-trust {
    display: flex;
    gap: clamp(1rem, 4vw, 3rem);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2.5rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}
.hero-trust span { display: inline-flex; align-items: center; gap: 0.45rem; }
.hero-trust strong { color: var(--text); }

/* --------------------------- Sections ------------------------------ */
.section { padding-block: var(--space-section); }
.section-title { text-align: center; max-width: 70ch; margin: 0 auto clamp(2rem, 4vw, 3rem); }
.section-title .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
    margin-bottom: 0.6rem;
}
.section-title p { color: var(--text-muted); font-size: 1.05rem; margin-top: 0.75rem; }

/* ------------------------ Tools section ---------------------------- */
.tools-section { padding-block: var(--space-section); background: var(--bg); }

.tool-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2.25rem;
}
.category {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.05rem;
    min-height: 40px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.92rem;
    transition: all 0.2s ease;
}
.category:hover { border-color: var(--accent); color: var(--text); }
.category.active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.1rem;
    position: relative;
}
.tool-grid.drag-over { outline: 2px dashed var(--accent); outline-offset: 8px; border-radius: var(--radius-lg); }

.tool-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
a.tool-card { text-decoration: none; }
.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: color-mix(in oklch, var(--accent) 40%, var(--border));
    color: var(--text);
}
.tool-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: grid; place-items: center;
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 1.3rem;
    margin-bottom: 0.4rem;
}
.tool-card h3 { font-size: 1.1rem; margin: 0; }
.tool-card p { font-size: 0.9rem; color: var(--text-muted); margin: 0; line-height: 1.5; }
.tool-card .tool-cta {
    margin-top: auto;
    padding-top: 0.6rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.tool-card:hover .tool-cta { gap: 0.6rem; }

/* --------------------- Features / value grid ----------------------- */
.features { padding-block: var(--space-section); }
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: grid; place-items: center;
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 1.4rem;
    margin-bottom: 1.1rem;
}
.feature-content h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.feature-content p { color: var(--text-muted); font-size: 0.95rem; }

/* ------------------------- "How it works" -------------------------- */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    counter-reset: step;
}
.step-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem 1.5rem;
    box-shadow: var(--shadow-sm);
}
.step-card::before {
    counter-increment: step;
    content: counter(step);
    display: grid; place-items: center;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-contrast);
    font-family: var(--font-display);
    font-weight: 700;
    margin-bottom: 0.9rem;
}
.step-card h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.step-card p { color: var(--text-muted); font-size: 0.95rem; }

/* ----------------------------- FAQ --------------------------------- */
.faq-section { padding-block: var(--space-section); }
.faq-container { max-width: 820px; margin-inline: auto; display: grid; gap: 0.75rem; }
.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s ease;
}
.faq-item.active { border-color: color-mix(in oklch, var(--accent) 45%, var(--border)); }
.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.35rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
}
.faq-question h3 { font-size: 1.02rem; margin: 0; font-family: var(--font-body); font-weight: 600; }
.faq-toggle { font-size: 1.5rem; color: var(--accent); line-height: 1; flex-shrink: 0; transition: transform 0.2s ease; }
.faq-item.active .faq-toggle { transform: rotate(45deg); }
.faq-answer { overflow: hidden; max-height: 0; transition: max-height 0.35s ease; }
.faq-item.active .faq-answer { max-height: 600px; }
.faq-answer p { color: var(--text-muted); padding: 0 1.35rem 1.25rem; margin: 0; line-height: 1.65; }

/* --------------------------- Dropzone ------------------------------ */
.tool-widget { margin-block: 1.5rem; }
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    padding: clamp(2rem, 5vw, 3.25rem);
    background: var(--surface);
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    transition: border-color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--surface-2); }
.dropzone.drag-over { border-color: var(--accent); background: var(--accent-subtle); }
.dropzone-icon { color: var(--accent); }
.dropzone-title { font-weight: 600; color: var(--text); margin: 0; }
.dropzone-or { color: var(--text-muted); font-weight: 400; }
.dropzone-hint { font-size: 0.85rem; color: var(--text-muted); margin: 0.25rem 0 0; }

/* --------------- Modals & form controls (tool dialogs) ------------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: oklch(0% 0 0 / 0.55);
    display: grid; place-items: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(-12px) scale(0.98);
    transition: transform 0.25s ease;
}
.modal-overlay.active .modal { transform: none; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.4rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h3 { font-size: 1.2rem; margin: 0; color: var(--text); }
.modal-header h3 i { color: var(--accent); }
.modal-close {
    background: var(--surface-2);
    border: none;
    width: 34px; height: 34px;
    border-radius: 50%;
    font-size: 1.3rem; line-height: 1;
    color: var(--text-muted);
    display: grid; place-items: center;
    cursor: pointer;
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-body { padding: 1.4rem; display: grid; gap: 1.1rem; background: var(--surface); height: auto; min-height: 0; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 1.1rem 1.4rem; border-top: 1px solid var(--border); }

.form-group { display: grid; gap: 0.45rem; }
.form-group > label { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.form-control,
.modal input[type="text"],
.modal input[type="number"],
.modal textarea,
.modal select {
    width: 100%;
    padding: 0.65rem 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
}
.form-control:focus, .modal textarea:focus, .modal select:focus,
.modal input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.modal input[type="range"] { width: 100%; accent-color: var(--accent); }
.modal input[type="color"] { width: 48px; height: 36px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); }
.help-text { font-size: 0.8rem; color: var(--text-muted); }

.position-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.position-btn {
    padding: 0.55rem 0.4rem;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.78rem;
    transition: all 0.15s ease;
}
.position-btn:hover { border-color: var(--accent); color: var(--text); }
.position-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.custom-position { display: flex; gap: 0.6rem; }
.alignment-options, .rotation-options, .direction-options, .pages-options {
    display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem;
}
.alignment-options label, .rotation-options label, .direction-options label, .pages-options label {
    display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.92rem; color: var(--text);
}
.position-options select { width: 100%; }

/* Signature modal */
.signature-modal #signature-canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    touch-action: none;
    cursor: crosshair;
}
.signature-controls { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.85rem; flex-wrap: wrap; }

/* --------------------------- Breadcrumb ---------------------------- */
.breadcrumb { padding-block: 1rem 0; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.88rem; color: var(--text-muted); }
.breadcrumb li { display: inline-flex; align-items: center; gap: 0.4rem; }
.breadcrumb li + li::before { content: "/"; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb [aria-current="page"] { color: var(--text); }

/* ----------------------- Article / prose --------------------------- */
.prose { max-width: 72ch; }
.prose > * + * { margin-top: 1.1rem; }
.prose h2 { margin-top: 2.5rem; }
.prose h3 { margin-top: 1.75rem; }
.prose p, .prose li { color: var(--text); line-height: 1.75; }
.prose ul, .prose ol { padding-left: 1.4rem; display: grid; gap: 0.5rem; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { color: var(--text); }
.prose blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 0 0.5rem 1.15rem;
    color: var(--text-muted);
    font-style: italic;
}
.prose code { background: var(--surface-2); padding: 0.1rem 0.4rem; border-radius: 6px; font-size: 0.9em; }

/* ----------------------- Tool page layout -------------------------- */
.tool-hero { padding-block: clamp(2rem, 5vw, 3.5rem) 1rem; }
.tool-hero h1 { max-width: 18ch; }
.tool-hero .lead { color: var(--text-muted); font-size: 1.1rem; max-width: 60ch; margin-top: 1rem; }
.tool-layout { display: grid; gap: clamp(2rem, 5vw, 3.5rem); }
.related-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.related-tool {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text); font-weight: 600;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.related-tool:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }
.related-tool .tool-icon { width: 38px; height: 38px; font-size: 1rem; margin: 0; }

/* ----------------------------- CTA band ---------------------------- */
.cta-band {
    text-align: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: var(--accent-contrast);
    border-radius: var(--radius-lg);
    padding: clamp(2.5rem, 6vw, 4rem) 1.5rem;
    box-shadow: var(--shadow-lg);
}
.cta-band h2 { color: var(--accent-contrast); }
.cta-band p { color: color-mix(in oklch, var(--accent-contrast) 88%, transparent); max-width: 50ch; margin: 1rem auto 1.75rem; }
.cta-band .btn-primary { background: var(--accent-contrast); color: var(--accent-strong); }
.cta-band .btn-primary:hover { background: color-mix(in oklch, var(--accent-contrast) 90%, black); }

/* ---------------------------- Guides ------------------------------- */
.guides-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.25rem; }
.guide-card {
    display: flex; flex-direction: column; gap: 0.5rem;
    padding: 1.5rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.guide-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); color: var(--text); }
.guide-card .tag { font-size: 0.78rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }
.guide-card h3 { font-size: 1.12rem; }
.guide-card p { color: var(--text-muted); font-size: 0.93rem; }

/* --------------------------- Ad slots ------------------------------ */
.ad-slot {
    margin-block: 2rem;
    min-height: 100px;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.ad-slot[data-ad="leaderboard"] { min-height: 90px; }
.ad-slot[data-ad="rectangle"] { min-height: 250px; max-width: 336px; margin-inline: auto; }

/* ------------------------- Trust / meta ---------------------------- */
.byline { color: var(--text-muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-top: 0.5rem; }
.byline .sep { opacity: 0.5; }
.badge-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.25rem; }
.badge {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.85rem; color: var(--text-muted); font-weight: 600;
}
.badge svg { width: 16px; height: 16px; color: var(--accent); }

/* --------------------- Scroll-driven reveal ------------------------ */
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        .reveal {
            animation: reveal-in linear both;
            animation-timeline: view();
            animation-range: entry 0% entry 40%;
        }
        @keyframes reveal-in {
            from { opacity: 0; transform: translateY(28px); }
            to { opacity: 1; transform: none; }
        }
    }
}

} /* @layer components */

/* --------------------------- Responsive ---------------------------- */
@media (max-width: 600px) {
    .position-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-buttons .btn { flex: 1 1 auto; }
}
