/* Commission request forms: same "commission sheet" look as prices.html
   (chunky ink outlines, hard offset shadows, neon accents on a starfield).
   The form markup is generated by admin/commission_helpers.php:build_form_html()
   and shared by every commission, so all styling lives here. */
@import url('https://fonts.googleapis.com/css2?family=Gochi+Hand&family=Jost:wght@400;500;600&family=Luckiest+Guy&display=swap');

:root {
    --ink: #0b0618;
    --panel: #1b1035;
    --panel-2: #26164d;
    --field: #110a24;
    --text: #ece7ff;
    --muted: #bdb3e0;
    --alien: #7dff5a;
    --pink: #ff5fc8;
    --orange: #ff9a3d;
    --violet: #a98bff;
    --cyan: #3fe3ff;
    --sun: #ffe04a;
    --danger: #ff6b8b;
    --display: 'Luckiest Guy', 'Jost', system-ui, sans-serif;
    --hand: 'Gochi Hand', 'Jost', cursive;
    --body: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 0;
    font-family: var(--body);
    color: var(--text);
    /* Fallback sky; form-shared.js paints the animated starfield on top */
    background:
        radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 72% 9%, #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 38% 64%, #d9ccff 50%, transparent 51%),
        radial-gradient(1px 1px at 88% 42%, #c2ffd2 50%, transparent 51%),
        radial-gradient(1px 1px at 22% 86%, #fff 50%, transparent 51%),
        radial-gradient(circle at 12% 18%, rgba(120, 40, 170, 0.38), transparent 55%),
        radial-gradient(circle at 90% 80%, rgba(40, 170, 90, 0.22), transparent 50%),
        #001220;
    background-attachment: fixed;
}

#space-bg {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

.container {
    width: min(100%, 820px);
    margin: 0 auto;
    padding: 28px 24px 60px;
}

/* ---------- Header ---------- */
.form-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding: 4px 14px;
    font-family: var(--hand);
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    transition: background 0.2s ease, transform 0.2s ease;
}
.form-back:hover,
.form-back:focus-visible { background: rgba(255, 255, 255, 0.14); transform: translateX(-3px); outline: none; }

.container h1 {
    margin: 0 0 30px;
    padding: 0;
    text-align: center;
    font-family: var(--display);
    font-size: clamp(2.3rem, 7vw, 4rem);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: 0.02em;
    color: #fff;
    text-shadow:
        3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink),
        2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink),
        5px 6px 0 var(--pink), 8px 9px 0 var(--ink);
    animation: titleFloat 4.5s ease-in-out infinite;
}
.container h1::before {
    content: '\2726  Commission Request  \2726';
    display: table;
    margin: 0 auto 16px;
    padding: 3px 16px;
    font-family: var(--hand);
    font-size: 1.15rem;
    letter-spacing: 0;
    color: var(--ink);
    text-shadow: none;
    background: var(--alien);
    border: 3px solid var(--ink);
    border-radius: 999px;
    box-shadow: 0 4px 0 var(--ink);
    transform: rotate(-3deg);
}

/* ---------- The order form card ---------- */
form {
    position: relative;
    width: 100%;
    padding: 34px 30px 28px;
    background:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.06) 1px, transparent 1.6px) 0 0 / 14px 14px,
        linear-gradient(160deg, var(--panel-2), var(--panel) 62%, #140b28);
    border: 3px solid var(--ink);
    border-radius: 24px;
    box-shadow: 9px 10px 0 var(--alien), 9px 10px 0 3px var(--ink);
    counter-reset: field;
    animation: cardIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
/* "Order form" tab */
form::before {
    content: 'Order form \270E';
    position: absolute;
    top: -18px;
    left: 22px;
    padding: 0 12px;
    font-family: var(--hand);
    font-size: 1.1rem;
    line-height: 1.5;
    color: var(--ink);
    background: var(--alien);
    border: 3px solid var(--ink);
    border-radius: 10px;
    transform: rotate(-3deg);
}

/* Price sticker (added by form-shared.js from the hidden commission_cost field) */
.form-price {
    position: absolute;
    top: -26px;
    right: -18px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    font-family: var(--display);
    font-size: 1.65rem;
    line-height: 1;
    color: var(--ink);
    background: var(--pink);
    border: 3px solid var(--ink);
    border-radius: 50%;
    outline: 2px dashed rgba(11, 6, 24, 0.4);
    outline-offset: -11px;
    box-shadow: 0 5px 0 var(--ink);
    transform: rotate(12deg);
    animation: stickerBob 3.4s ease-in-out infinite;
}
.form-price small {
    margin-top: 2px;
    font-family: var(--hand);
    font-size: 0.85rem;
}

/* ---------- Fields ---------- */
form > label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    font-family: var(--display);
    font-size: 1.15rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #fff;
    text-shadow: 2px 2px 0 var(--ink);
}
form > label::before {
    counter-increment: field;
    content: counter(field, decimal-leading-zero);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 34px;
    height: 34px;
    font-family: var(--hand);
    font-size: 1rem;
    color: var(--ink);
    text-shadow: none;
    background: var(--accent, var(--alien));
    border: 3px solid var(--ink);
    border-radius: 50%;
    transform: rotate(-6deg);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
form > label:nth-of-type(4n+1) { --accent: var(--alien); }
form > label:nth-of-type(4n+2) { --accent: var(--pink); }
form > label:nth-of-type(4n+3) { --accent: var(--cyan); }
form > label:nth-of-type(4n+4) { --accent: var(--sun); }

input, textarea, button {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    font-family: inherit;
}

form > input:not([type="hidden"]),
form > textarea {
    display: block;
    margin: 0 0 26px;
    padding: 13px 16px;
    font-size: 1.02rem;
    color: var(--text);
    background: var(--field);
    border: 3px solid var(--ink);
    border-radius: 14px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06), 0 4px 0 var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
form > textarea {
    min-height: 140px;
    line-height: 1.5;
    resize: vertical;
}
form > input::placeholder,
form > textarea::placeholder { color: #8a80b0; opacity: 1; }
form > input:not([type="hidden"]):hover,
form > textarea:hover { border-color: #2a1c4d; }
form > input:not([type="hidden"]):focus,
form > textarea:focus {
    outline: none;
    border-color: var(--alien);
    box-shadow: inset 0 0 0 2px rgba(125, 255, 90, 0.15), 0 6px 0 var(--ink), 0 0 26px rgba(125, 255, 90, 0.25);
    transform: translateY(-2px);
}
/* Wiggle the number bubble of the field being filled in */
form > label:has(+ input:focus)::before,
form > label:has(+ textarea:focus)::before { transform: rotate(8deg) scale(1.15); }

/* ---------- Reference upload ---------- */
.upload-review {
    margin: 4px 0 24px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 3px dashed rgba(169, 139, 255, 0.45);
    border-radius: 18px;
}
.custom-file-input { position: relative; margin-bottom: 10px; }
.custom-file-input input[type="file"] { display: none; }
.custom-file-input label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px 10px;
    font-family: var(--display);
    font-size: 1.15rem;
    letter-spacing: 0.05em;
    color: var(--ink);
    text-align: center;
    background: var(--cyan);
    border: 3px solid var(--ink);
    border-radius: 14px;
    box-shadow: 0 5px 0 var(--ink);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.custom-file-input label:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.custom-file-input label:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.custom-file-input label svg path { stroke: var(--ink); }

.upload-hint {
    margin: 10px 0 12px;
    font-family: var(--hand);
    font-size: 1.1rem;
    color: var(--muted);
    text-align: center;
}
.error-message {
    margin: 0 0 10px;
    font-weight: 600;
    color: var(--danger);
}
.error-message:empty { display: none; }
.error { color: var(--danger); font-size: 14px; margin-bottom: 15px; }

.upload-preview-layout {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 14px;
}
.main-preview-panel,
.preview-sidebar {
    padding: 10px;
    background: var(--field);
    border: 3px solid var(--ink);
    border-radius: 14px;
}
.main-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 8px;
    overflow: hidden;
    font-family: var(--hand);
    font-size: 1.1rem;
    color: var(--muted);
    text-align: center;
    background: repeating-linear-gradient(-45deg, #1a1033 0 14px, #150d2b 14px 28px);
    border-radius: 10px;
    cursor: default;
}
.main-preview img { width: 100%; height: 220px; object-fit: contain; border-radius: 8px; }
.preview-meta {
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--muted);
    text-align: center;
    word-break: break-word;
}
.preview-header {
    margin-bottom: 8px;
    font-family: var(--display);
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    color: var(--violet);
}
.preview-container {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: flex-start;
    gap: 12px;
    min-height: 76px;
    max-height: 244px;
    margin-top: 0;
    padding: 10px 10px 4px 4px;
    overflow-y: auto;
}
.preview-image {
    position: relative;
    width: 68px;
    height: 68px;
    overflow: visible;
    cursor: pointer;
    background: transparent;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.preview-image:hover { transform: rotate(-3deg) scale(1.06); }
.preview-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1e1e1e;
    border: 2px solid var(--ink);
    border-radius: 10px;
}
.preview-image.active img { border-color: var(--alien); box-shadow: 0 0 0 2px var(--alien); }
.preview-image button {
    position: absolute;
    top: -9px;
    right: -9px;
    z-index: 3;
    width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    color: var(--ink);
    background: var(--danger);
    border: 2px solid var(--ink);
    border-radius: 50%;
    cursor: pointer;
}

/* ---------- ToS + submit ---------- */
.tos {
    margin: 6px 0 20px;
    font-size: 0.95rem;
    color: var(--muted);
    text-align: center;
}
.tos a {
    font-weight: 600;
    color: var(--pink);
    text-decoration: none;
    border-bottom: 2px dashed currentColor;
}
.tos a:hover,
.tos a:focus-visible { color: #ff8ad8; outline: none; }

button[type="submit"] {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0;
    padding: 16px 18px 13px;
    overflow: hidden;
    font-family: var(--display);
    font-size: 1.45rem;
    letter-spacing: 0.06em;
    color: var(--ink);
    background: var(--alien);
    border: 3px solid var(--ink);
    border-radius: 18px;
    box-shadow: 0 6px 0 var(--ink);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.2s ease;
}
button[type="submit"]::before { content: '\1F6F8'; position: relative; z-index: 2; font-size: 1.1em; }
button[type="submit"]:hover,
button[type="submit"]:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 0 var(--ink); outline: none; }
button[type="submit"]:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--ink); }
button[type="submit"]:hover::before { animation: ufoZip 0.6s ease-in-out; }

.submit-label {
    position: relative;
    z-index: 2;
    display: inline-block;
    min-width: 86px;
    text-align: center;
}
/* Upload progress: fills the button with ink stripes */
.submit-loader {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    width: 0;
    opacity: 0;
    background: repeating-linear-gradient(-45deg, rgba(11, 6, 24, 0.22) 0 12px, rgba(11, 6, 24, 0.1) 12px 24px);
    background-size: 34px 34px;
    transition: width 0.2s linear, opacity 0.2s ease;
}
button[type="submit"].is-loading { cursor: wait; transform: none; }
button[type="submit"].is-loading .submit-loader { opacity: 1; animation: stripes 0.8s linear infinite; }

/* ---------- Lightbox ---------- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: rgba(0, 8, 18, 0.88);
}
.lightbox-overlay.open { display: flex; }
.lightbox-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(96vw, 980px);
    max-height: 94vh;
    padding: 16px;
    background: var(--panel);
    border: 3px solid var(--ink);
    border-radius: 20px;
    box-shadow: 8px 9px 0 var(--violet), 8px 9px 0 3px var(--ink);
}
.lightbox-image {
    width: 100%;
    max-height: 72vh;
    object-fit: contain;
    background: var(--field);
    border: 3px solid var(--ink);
    border-radius: 12px;
}
.lightbox-caption {
    width: 100%;
    font-size: 0.9rem;
    color: var(--muted);
    text-align: center;
    word-break: break-word;
}
.lightbox-controls { display: flex; justify-content: center; gap: 12px; width: 100%; }
.lightbox-btn {
    width: auto;
    min-width: 110px;
    margin: 0;
    padding: 10px 18px 8px;
    font-family: var(--display);
    font-size: 1.05rem;
    letter-spacing: 0.05em;
    color: var(--ink);
    background: var(--violet);
    border: 3px solid var(--ink);
    border-radius: 12px;
    box-shadow: 0 4px 0 var(--ink);
    cursor: pointer;
}
.lightbox-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.lightbox-btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.lightbox-close {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--ink);
    background: var(--danger);
    border: 3px solid var(--ink);
    border-radius: 50%;
    box-shadow: 0 4px 0 var(--ink);
    cursor: pointer;
}

/* ---------- Phones ---------- */
@media (max-width: 900px) {
    .container { padding: 18px 14px 50px; }
    form { padding: 30px 18px 22px; box-shadow: 6px 7px 0 var(--alien), 6px 7px 0 3px var(--ink); }
    .form-price { width: 80px; height: 80px; font-size: 1.35rem; top: -30px; right: -8px; }
    .upload-review { padding: 14px; }
    .upload-preview-layout { grid-template-columns: 1fr; }
    .main-preview { min-height: 180px; }
    .main-preview img { height: 180px; }
    .lightbox-close { top: -12px; right: -6px; }
}

/* ---------- Motion ---------- */
@keyframes titleFloat {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50%      { transform: translateY(-5px) rotate(1deg); }
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to   { opacity: 1; transform: none; }
}
@keyframes stickerBob {
    0%, 100% { transform: rotate(12deg) translateY(0); }
    50%      { transform: rotate(8deg) translateY(-5px); }
}
@keyframes ufoZip {
    0%   { transform: translateX(0); }
    40%  { transform: translateX(8px) rotate(10deg); }
    70%  { transform: translateX(-4px) rotate(-6deg); }
    100% { transform: translateX(0); }
}
@keyframes stripes { to { background-position: 34px 0; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
