/* ============================================================
   Titto – Keyring Customizer  (scoped: kc-*)
   ============================================================ */

:root {
    --kc-accent:      #1a1a1a;
    --kc-gold:        #D4AF37;
    --kc-radius-sm:   6px;
    --kc-radius-md:   10px;
    --kc-radius-lg:   16px;
    --kc-gap:         14px;
    --kc-swatch-size: 28px;
}

/* ── Page layout ─────────────────────────────────────────── */
.kc-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 28px;
    align-items: start;
    padding: 24px 0 48px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .kc-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Control panel ───────────────────────────────────────── */
.kc-panel {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: var(--kc-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: var(--kc-gap);
}

.kc-panel__heading {
    font-size: 20px;
    font-weight: 600;
    color: var(--kc-accent);
    margin: 0 0 4px;
}

.kc-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kc-label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.kc-label small {
    font-weight: 400;
    color: #999;
}

/* ── Color swatches ──────────────────────────────────────── */
.kc-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kc-swatch {
    height: var(--kc-swatch-size);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
    border: none;
}

.kc-swatch:hover {
    transform: scale(1.1);
}

.kc-swatch--active {
    border-color: var(--kc-accent);
    transform: scale(1.2);
}


/* ── Badge / plate buttons ───────────────────────────────── */
.kc-plate-row {
    display: flex;
    gap: 8px;
}

.kc-plate {
    flex: 1;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--kc-radius-sm);
    border: 1.5px solid #d0d0d0;
    background: #f7f7f7;
    color: #333;
    cursor: pointer;
    transition: all 0.15s;
}

.kc-plate:hover {
    border-color: #999;
}

.kc-plate--active {
    background: var(--kc-accent);
    border-color: var(--kc-accent);
    color: #fff;
}

.kc-plate--active.kc-plate--gold {
    background: var(--kc-gold);
    border-color: var(--kc-gold);
    color: #3a2800;
}

/* ── Text input ──────────────────────────────────────────── */
.kc-input {
    width: 100%;
    padding: 9px 12px;
    font-size: 15px;
    letter-spacing: 3px;
    text-transform: uppercase;
    border: 1.5px solid #d0d0d0;
    border-radius: var(--kc-radius-sm);
    background: #fafafa;
    color: var(--kc-accent);
    transition: border-color 0.15s;
}

.kc-input:focus {
    outline: none;
    border-color: var(--kc-accent);
}

/* ── Font style buttons ──────────────────────────────────── */
.kc-font-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.kc-font-btn {
    padding: 5px 12px;
    font-size: 13px;
    border-radius: var(--kc-radius-sm);
    border: 1.5px solid #d0d0d0;
    background: #f7f7f7;
    color: #333;
    cursor: pointer;
    transition: all 0.15s;
}

.kc-font-btn:hover {
    border-color: #999;
}

.kc-font-btn--active {
    background: var(--kc-accent);
    border-color: var(--kc-accent);
    color: #fff;
}

/* ── Price row ───────────────────────────────────────────── */
.kc-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 14px;
    color: #555;
    padding-top: 4px;
}

.kc-price strong {
    font-size: 22px;
    font-weight: 700;
    color: var(--kc-accent);
}

/* ── Add to bag button ───────────────────────────────────── */
.kc-add-btn {
    width: 100%;
    padding: 13px 0;
    background: var(--kc-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--kc-radius-md);
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: background 0.15s, transform 0.1s;
}

.kc-add-btn:hover {
    background: #333;
}

.kc-add-btn:active {
    transform: scale(0.98);
}

/* ── Preview column ──────────────────────────────────────── */
.kc-preview {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Preview stage wrapper ───────────────────────────────── */
.kc-3d-wrap {
    width: 100%;
    background: #f8f8f8;
    border-radius: var(--kc-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 12px;
}

/* ── Product stage (base photo + overlays) ───────────────── */
#kc-stage {
    position: relative;
    width: min(100%, 400px);
    aspect-ratio: 1 / 1;
    user-select: none;
}

#kc-stage > img.kc-stage__base {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

/* Insert geometry (measured from keychain-blank.jpg, 1080x1080):
   circle bounds x 275-521, y 618-865 */
.kc-insert {
    position: absolute;
    left: 25.46%;
    top: 57.22%;
    width: 22.87%;
    height: 22.87%;
    border-radius: 50%;
    overflow: hidden;
    background: radial-gradient(circle at 40% 30%, #f38ab5 0%, #ee6f9f 55%, #e2578c 100%);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .12);
    touch-action: none;
}

.kc-insert--has-photo {
    cursor: grab;
}

.kc-insert--dragging {
    cursor: grabbing;
}

.kc-insert img.kc-insert__photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: 50% 50%;
    display: none;
    pointer-events: none;
}

.kc-insert--has-photo img.kc-insert__photo {
    display: block;
}

.kc-insert__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    text-align: center;
    line-height: 1.3;
    opacity: .9;
    pointer-events: none;
}

.kc-insert--has-photo .kc-insert__placeholder {
    display: none;
}

/* Tag plate: centre (736.8, 582.2), 388x133px, rotated 38.23deg */
.kc-tag {
    position: absolute;
    left: 68.22%;
    top: 53.91%;
    width: 35.93%;
    height: 12.31%;
    transform: translate(-50%, -50%) rotate(38.23deg);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.kc-tag__name {
    white-space: nowrap;
    line-height: 1;
}

/* ── Hint texts ──────────────────────────────────────────── */
.kc-3d-hint {
    margin: 6px 0 0;
    font-size: 11px;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 5px;
}

.kc-3d-icon {
    font-size: 15px;
}

.kc-hint {
    font-size: 12px;
    color: #bbb;
    text-align: center;
    line-height: 1.5;
}
