/* PGH Garment editor. Mobile first: large touch targets, stacked controls, print-area stage that scales to the screen. */
.pge {
    --pge-ink: #1d1d1b;
    --pge-accent: #1f6b57;
    --pge-danger: #9a2a1f;
    --pge-line: #d9d9d4;
    --pge-muted: #6b6b66;
    color: var(--pge-ink);
    font-size: 16px;
    max-width: 520px;
    margin: 16px 0;
}

.pge-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.pge-tabs button {
    flex: 1;
    min-height: 44px;
    border: 1px solid var(--pge-line);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-weight: 600;
}

.pge-tabs button[aria-selected="true"] {
    border-color: var(--pge-accent);
    color: var(--pge-accent);
}

.pge-tabs button.is-passive {
    color: var(--pge-muted);
    border-style: dashed;
}

.pge-back-note {
    margin: 0 0 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f5f4ef;
    color: var(--pge-muted);
    font-size: 14px;
}

.pge-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f5f4ef;
    border-radius: 12px;
    overflow: hidden;
}

.pge-mockup {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

/* Print-area frame, proportioned 4500 x 5100 px (0.882). The stage is square, so height = width x 5100/4500.
 * Placed from the Printify front print-area reference (chest, below the collar, centred on the body).
 * The position is an approximation until the Printify print dimensions are verified. The frame is only
 * drawn while a layer is selected, so the customer sees the design on the fabric, not a box. */
.pge-area {
    position: absolute;
    left: 34.6%;
    top: 25.8%;
    width: 31.3%;
    height: 35.4%;
    border: 1px dashed transparent;
    overflow: hidden;
    touch-action: none;
}

.pge-area.is-editing {
    border-color: rgba(31, 107, 87, 0.45);
}

/* Back face placement is temporary: while editing, the frame is dotted and warm-coloured. The normal preview hides it. */
.pge-area.is-temporary.is-editing {
    border-style: dotted;
    border-color: rgba(154, 42, 31, 0.5);
}

.pge-layer {
    position: absolute;
    box-sizing: border-box;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.pge-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.pge-text span {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-family: "Caveat", cursive;
    font-size: 100%;
    color: var(--pge-ink);
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
}

/* Text colour picker. Swatches are at least 44px so they work with a thumb. */
.pge-colour {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.pge-colour__label {
    flex: 0 0 100%;
    font-size: 14px;
    color: var(--pge-muted);
}

.pge-swatch {
    width: 44px;
    height: 44px;
    border: 1px solid var(--pge-line);
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
}

.pge-swatch[aria-pressed="true"] {
    outline: 3px solid var(--pge-accent);
    outline-offset: 2px;
}

.pge-swatch:disabled,
.pge-colour input[type="color"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pge-colour input[type="color"] {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--pge-line);
    border-radius: 8px;
    background: #fff;
}

.pge-layer.is-selected {
    outline: 2px solid var(--pge-accent);
    outline-offset: 2px;
}

.pge-handle {
    position: absolute;
    width: 28px;
    height: 28px;
    background: #fff;
    border: 2px solid var(--pge-accent);
    border-radius: 50%;
    box-sizing: border-box;
}

.pge-handle-scale {
    right: -14px;
    bottom: -14px;
    cursor: nwse-resize;
}

.pge-handle-rotate {
    left: 50%;
    top: -42px;
    transform: translateX(-50%);
    cursor: alias;
}

.pge-hint {
    margin: 8px 0 12px;
    color: var(--pge-muted);
    font-size: 14px;
}

.pge-toolbar,
.pge-selection,
.pge-text-add {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pge-text-add {
    flex: 1 1 100%;
}

.pge-text-add input[type="text"] {
    flex: 1 1 160px;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--pge-line);
    border-radius: 8px;
    font: inherit;
    min-width: 0;
}

.pge-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 8px 14px;
    border: 1px solid var(--pge-line);
    border-radius: 8px;
    background: #fff;
    color: var(--pge-ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.pge-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pge-button--primary {
    border-color: var(--pge-accent);
    background: var(--pge-accent);
    color: #fff;
}

.pge-button--danger {
    color: var(--pge-danger);
}

.pge-selection {
    margin-top: 8px;
}

.pge-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin: 16px 0 8px;
    padding: 12px;
    border-radius: 10px;
    background: #f5f4ef;
}

.pge-price {
    font-size: 22px;
}

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

.pge-approval {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    min-height: 44px;
    font-size: 15px;
}

.pge-approval input {
    width: 22px;
    height: 22px;
    margin-top: 2px;
}

@media (min-width: 720px) {
    .pge-handle {
        width: 22px;
        height: 22px;
    }
    .pge-button {
        min-height: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pge * {
        transition: none !important;
    }
}

/* Product page entry: the design starts here, the editor opens on its own page. */
.pge-entry {
    margin: 16px 0;
    padding: 16px;
    border-radius: 12px;
    background: #f5f4ef;
}

.pge-entry .pge-edit-link[hidden] {
    display: none;
}

.pge-entry .pge-edit-link {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    margin: 0 0 12px;
    border: 1px solid #1f6b57;
    border-radius: 8px;
    background: #ffffff;
    color: #1f6b57;
    font-weight: 700;
    text-decoration: none;
}

.pge-entry__lead,
.pge-entry__price {
    margin: 0 0 12px;
    font-size: 15px;
}

/* The entry sits outside .pge, so its colours are set here, not through the editor's variables. */
.pge-entry .pge-entry__button {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid #1f6b57;
    border-radius: 8px;
    background: #1f6b57;
    color: #ffffff;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
}

.pge-entry .pge-entry__button:hover,
.pge-entry .pge-entry__button:focus {
    background: #185a48;
    color: #ffffff;
}

/* Editor page: full screen, mobile first. The theme's header, menu and sticky cart bar are hidden. */
.pgh-editor-page .site-header,
.pgh-editor-page .primary-mobile-nav,
.pgh-editor-page .mobile-menu,
.pgh-editor-page .martfury-preloader,
.pgh-editor-page #scroll-top,
.pgh-editor-page .site-footer,
.pgh-editor-page footer,
.pgh-editor-page .woocommerce-breadcrumb,
.pgh-editor-page .page-header,
.pgh-editor-page .sticky-add-to-cart,
.pgh-editor-page .martfury-sticky-add-to-cart,
.pgh-editor-page .mf-sticky-add-to-cart,
.pgh-editor-page .mobile-sticky-add-to-cart,
.pgh-editor-page .entry-title,
.pgh-editor-page .page-title,
.pgh-editor-page .woocommerce-product-gallery,
.pgh-editor-page .product-bottom-bar {
    display: none !important;
}

.pgh-editor-page {
    overflow-x: hidden;
}

.pge--page {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px 32px;
}

.pge-page-head {
    padding: 8px 0 12px;
}

.pge-back {
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
    color: var(--pge-accent);
    font-weight: 600;
    text-decoration: none;
}

.pge-title {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
}

.pge-choices,
.pge-text-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 8px 0;
}

.pge-choice {
    display: flex;
    flex: 1 1 140px;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    color: var(--pge-muted);
}

.pge-choice--wide {
    flex-basis: 100%;
}

.pge-choice select {
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--pge-line);
    border-radius: 8px;
    background: #fff;
    color: var(--pge-ink);
    font: inherit;
}

.pge-review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.pge-review-actions .pge-button {
    flex: 1 1 160px;
}

.pge-confirm {
    text-decoration: none;
}

.pge-confirm-note {
    margin: 8px 0 0;
    color: var(--pge-danger);
    font-size: 14px;
}

/* Review step: show the design without tools, frame or handles. */
.pge.is-review .pge-choices,
.pge.is-review .pge-tabs,
.pge.is-review .pge-back-note,
.pge.is-review .pge-hint,
.pge.is-review .pge-toolbar,
.pge.is-review .pge-text-tools,
.pge.is-review .pge-selection,
.pge.is-review .pge-colour,
.pge.is-review .pge-reset {
    display: none;
}

.pge.is-review .pge-area {
    border-color: transparent;
}

.pge.is-review .pge-layer.is-selected {
    outline: none;
}
