/*
 * PrintOnNow image tools (meme generator, compress, resize, crop, convert, rotate,
 * watermark, photo editor, upscale, remove background, blur face, HTML to image).
 * Loaded only on the tool pages. Every rule is scoped under .pit-, so the site's own
 * styles are not touched and the theme's rules stay out of the tools.
 */

.pit-page {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto 40px;
    color: #111827;
    font-size: 1rem;
    line-height: 1.6;
}

.pit-page *,
.pit-page *::before,
.pit-page *::after {
    box-sizing: border-box;
}

.pit-hero {
    margin: 8px 0 18px;
    text-align: center;
}

.pit-hero h1 {
    margin: 0 0 8px;
    font-size: clamp(1.8rem, 4.6vw, 2.8rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.pit-hero p {
    max-width: 760px;
    margin: 0 auto;
    color: #4b5563;
    font-size: 1.05rem;
}

.pit-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.pit-badges li {
    padding: 4px 12px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ------------------------------------------------------------------ the tool */

.pit-app {
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.pit-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 220px;
    padding: 28px 16px;
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.pit-drop.is-over {
    border-color: #111827;
    background: #f1f5f9;
}

.pit-drop strong {
    font-size: 1.15rem;
}

.pit-drop small {
    color: #6b7280;
}

.pit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid #111827;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.pit-btn:hover {
    background: #374151;
    color: #fff;
}

.pit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pit-btn--light {
    border-color: #d1d5db;
    background: #fff;
    color: #111827;
}

.pit-btn--light:hover {
    background: #f3f4f6;
    color: #111827;
}

.pit-btn--small {
    min-height: 36px;
    padding: 6px 14px;
    font-size: 0.9rem;
}

.pit-layout {
    display: grid;
    gap: 18px;
}

@media (min-width: 900px) {
    .pit-layout {
        grid-template-columns: minmax(0, 1fr) 320px;
        align-items: start;
    }
}

.pit-panel {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-radius: 16px;
    background: #f8fafc;
}

.pit-panel h2,
.pit-panel h3 {
    margin: 0;
    font-size: 1.05rem;
}

.pit-field {
    display: grid;
    gap: 6px;
}

.pit-field > span,
.pit-field > label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.pit-page input[type="text"],
.pit-page input[type="number"],
.pit-page select,
.pit-page textarea {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: #111827;
    font: inherit;
}

.pit-page textarea {
    min-height: 160px;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.9rem;
}

.pit-page input[type="range"] {
    width: 100%;
    accent-color: #111827;
}

.pit-page input[type="color"] {
    width: 44px;
    height: 40px;
    padding: 2px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
}

.pit-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.pit-row > .pit-field {
    flex: 1 1 120px;
}

.pit-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}

.pit-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pit-chip {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #111827;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.pit-chip.is-on {
    border-color: #111827;
    background: #111827;
    color: #fff;
}

.pit-grid9 {
    display: grid;
    grid-template-columns: repeat(3, 34px);
    gap: 4px;
}

.pit-grid9 button {
    width: 34px;
    height: 34px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.pit-grid9 button.is-on {
    background: #111827;
}

/* files and results */

.pit-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.pit-file {
    position: relative;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
}

.pit-file__thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    background: repeating-conic-gradient(#f3f4f6 0% 25%, #fff 0% 50%) 50% / 16px 16px;
}

.pit-file__thumb img,
.pit-file__thumb canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.pit-file__info {
    padding: 8px 10px;
    font-size: 0.8rem;
    line-height: 1.35;
    word-break: break-word;
}

.pit-file__info b {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pit-file__tools {
    display: flex;
    gap: 4px;
    padding: 0 8px 8px;
}

.pit-file__remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.75);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.pit-saving {
    color: #047857;
    font-weight: 700;
}

.pit-bigger {
    color: #b45309;
    font-weight: 700;
}

.pit-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

.pit-status {
    min-height: 1.4em;
    margin: 10px 0 0;
    color: #4b5563;
    font-size: 0.95rem;
}

.pit-status.is-error {
    color: #b42318;
}

.pit-progress {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

.pit-progress > i {
    display: block;
    width: 0;
    height: 100%;
    background: #111827;
    transition: width 0.2s ease;
}

.pit-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    overflow: hidden;
    border-radius: 14px;
    background: repeating-conic-gradient(#f3f4f6 0% 25%, #fff 0% 50%) 50% / 20px 20px;
}

.pit-stage canvas,
.pit-stage img {
    max-width: 100%;
    height: auto;
}

.pit-stage .canvas-container {
    max-width: 100%;
}

.pit-compare {
    display: grid;
    gap: 12px;
}

@media (min-width: 700px) {
    .pit-compare {
        grid-template-columns: 1fr 1fr;
    }
}

.pit-compare figure {
    margin: 0;
}

.pit-compare figcaption {
    margin-top: 6px;
    color: #4b5563;
    font-size: 0.85rem;
    text-align: center;
}

.pit-overlay-box {
    position: absolute;
    border: 2px solid #22c55e;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.12);
    cursor: pointer;
}

.pit-overlay-box::after {
    content: "x";
    position: absolute;
    top: -12px;
    right: -12px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    font-size: 13px;
    line-height: 22px;
    text-align: center;
}

.pit-templates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px;
}

.pit-template {
    display: grid;
    gap: 4px;
    padding: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    color: #111827;
    font: inherit;
    font-size: 0.75rem;
    text-align: center;
    cursor: pointer;
}

.pit-template.is-on {
    border-color: #111827;
    box-shadow: 0 0 0 1px #111827;
}

.pit-template canvas {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.pit-texts {
    display: grid;
    gap: 10px;
}

.pit-text-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: 6px;
    align-items: center;
}

.pit-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fef3c7;
}

.pit-cta p {
    margin: 0;
    font-weight: 600;
}

.pit-hidden {
    display: none !important;
}

/* ------------------------------------------------------------------ the copy */

.pit-copy {
    max-width: 860px;
    margin: 36px auto 0;
}

.pit-copy h2 {
    margin: 32px 0 12px;
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    line-height: 1.2;
}

.pit-copy ol,
.pit-copy ul {
    padding-left: 22px;
}

.pit-copy li {
    margin: 6px 0;
}

.pit-faq details {
    margin: 0 0 10px;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
}

.pit-faq summary {
    font-weight: 700;
    cursor: pointer;
}

.pit-faq details p {
    margin: 10px 0 0;
}

.pit-related {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pit-related a {
    display: block;
    height: 100%;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    color: #111827;
    text-decoration: none;
}

.pit-related a:hover {
    border-color: #111827;
}

.pit-related b {
    display: block;
}

.pit-related span {
    color: #6b7280;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    /* On phones the theme's article padding plus ours left the editor too narrow. */
    .pit-article .inside-article {
        padding-right: 0;
        padding-left: 0;
    }

    .pit-page {
        width: calc(100% - 8px);
    }

    .pit-app {
        padding: 10px;
        border-radius: 16px;
    }

    /* Meme layouts: one row that swipes sideways instead of a tall grid. */
    .pit-templates {
        grid-auto-columns: 84px;
        grid-auto-flow: column;
        grid-template-columns: none;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .pit-templates::-webkit-scrollbar {
        display: none;
    }

    .pit-text-row {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .pit-text-row .pit-text-size {
        display: none;
    }
}

.pit-crumbs {
    margin: 0 0 6px;
    color: #6b7280;
    font-size: 0.85rem;
    text-align: center;
}

.pit-crumbs a {
    color: #374151;
}

.pit-privacy {
    margin: 12px 0 0;
    color: #4b5563;
    font-size: 0.9rem;
    text-align: center;
}
