/* ==========================================
   GENERATIVE ART TOOL
   ========================================== */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;

    font-family: Arial, Helvetica, sans-serif;
    color: #eee;

    background: #0b0b10;
}


/* ==========================================
   BACKGROUND
   ========================================== */

body {
    position: relative;
}

body::before {
    content: "";

    position: fixed;
    inset: 0;

    background-image: url("./background.svg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    opacity: 0.8;

    z-index: 0;
    pointer-events: none;
}

.flow-art-header {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    min-height: 58px;
    padding: 0 clamp(1rem, 4vw, 2.5rem);
    border-bottom: 1px solid rgba(173, 156, 214, 0.16);
    background: rgba(12, 12, 18, 0.94);
    color: #eee;
    font-size: 0.9rem;
}

.flow-art-brand {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 0.55rem;
    color: #eee;
    font-weight: 700;
    text-decoration: none;
}

.flow-art-brand img {
    display: block;
    border-radius: 5px;
}

.flow-art-header-title {
    color: #c4b5fd;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.flow-art-home-link {
    justify-self: end;
    padding: 0.45rem 0.75rem;
    border: 1px solid #393542;
    border-radius: 6px;
    color: #d8d5df;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.flow-art-brand:hover,
.flow-art-brand:focus-visible {
    color: #c4b5fd;
}

.flow-art-home-link:hover,
.flow-art-home-link:focus-visible {
    border-color: #8b5cf6;
    background: #211b2d;
    color: #eee;
}

.flow-art-brand:focus-visible,
.flow-art-home-link:focus-visible {
    outline: 2px solid #a78bfa;
    outline-offset: 3px;
}


/* ==========================================
   MAIN CONTAINER
   ========================================== */

.tool-container {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;

    width: 100%;
    max-width: 1200px;

    margin: 0 auto;
    padding: 1rem 2rem 2rem;
}

.canvas-container {
    order: 0;
}

.controls {
    order: 2;
}

.page-actions {
    order: 1;
}

.page-guide {
    order: 4;
}

#internal-links {
    order: 5;
}


/* ==========================================
   CANVAS
   ========================================== */

.canvas-container {
    width: 100%;

    display: flex;
    justify-content: center;
    align-items: center;

    margin: 0;
    padding: 0;

    background: transparent;
    border: none;

    overflow: visible;
}

.canvas-container canvas {
    display: block;

    width: 100%;
    max-width: 800px;

    height: auto;

    margin: 0;
    padding: 0;

    border: none;
    border-radius: 8px;

    /* BIG SOFT SHADOW */
    box-shadow:
        0 0 25px rgba(0, 0, 0, 0.7),
        0 0 60px rgba(0, 0, 0, 0.55),
        0 20px 80px rgba(0, 0, 0, 0.65);
}

.page-intro {
    max-width: 800px;
    margin: 1.25rem auto 0;
    color: #c9c9d2;
    line-height: 1.6;
}

.page-intro h1 {
    margin: 0 0 0.5rem;
    color: #eee;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.page-intro p {
    margin: 0;
}

.page-guide {
    max-width: 800px;
    margin: 2.5rem auto 4rem;
    color: #c9c9d2;
    line-height: 1.75;
}

.page-guide section {
    margin-top: 2rem;
}

.page-guide h2 {
    margin: 0 0 0.75rem;
    color: #eee;
    font-size: 1.45rem;
    line-height: 1.3;
}

.page-guide h3 {
    margin: 1.25rem 0 0.35rem;
    color: #e2e2eb;
    font-size: 1.05rem;
}

.page-guide p {
    margin: 0 0 0.9rem;
}

.page-guide ol {
    padding-left: 1.4rem;
}

.page-guide li {
    margin-bottom: 0.55rem;
}

.page-guide strong {
    color: #f3f3f6;
}

/* ==========================================
   CONTROLS
   ========================================== */

.controls {
    display: grid;

    grid-template-columns: repeat(4, minmax(0, 1fr));

    gap: 1rem;

    margin-top: 0.25rem;
    margin-bottom: 1.5rem;

    padding: 1.25rem;

    background: rgba(20, 20, 27, 0.94);

    border: 1px solid #30303a;
    border-radius: 12px;

    box-shadow:
        0 10px 35px rgba(0, 0, 0, 0.45);
}

@media (max-width: 1000px) {
    .controls {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 750px) {
    .controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* ==========================================
   INPUT GROUP
   ========================================== */

.input-group {
    display: flex;
    flex-direction: column;

    gap: 0.5rem;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 600;

    color: #eee;
}

.input-label-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.input-help {
    position: relative;
    display: inline-flex;
}

.input-help-button {
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    padding: 0;
    border: 1px solid #898997;
    border-radius: 50%;
    background: transparent;
    color: #c9c9d2;
    font: 600 12px/1 Arial, Helvetica, sans-serif;
    cursor: pointer;
}

.input-help-button:hover,
.input-help-button:focus-visible,
.input-help.is-open .input-help-button {
    border-color: #b9a0ff;
    color: #d7caff;
    outline: none;
}

.input-help-tooltip {
    position: fixed;
    z-index: 30;
    width: min(280px, calc(100vw - 2rem));
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
    padding: 0.75rem 0.85rem;
    border: 1px solid #484354;
    border-radius: 8px;
    background: #191821;
    color: #eee;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.5;
}

.input-help-tooltip[hidden] {
    display: none;
}


/* ==========================================
   NUMBER INPUT
   ========================================== */

.input-group input[type="number"] {
    width: 100%;

    padding: 0.65rem 0.75rem;

    border: 1px solid #3a3a46;
    border-radius: 6px;

    font: inherit;

    color: #eee;
    background: #15151c;

    appearance: textfield;
    -moz-appearance: textfield;
}

/* Hide Chromium and Safari's native number steppers. */
.input-group input[type="number"]::-webkit-inner-spin-button,
.input-group input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.input-group input[type="number"]:focus {
    outline: none;

    border-color: #666;
    background: #1a1a23;
}

.input-group input[type="number"]:invalid {
    border-color: #ef5b68;
    box-shadow: 0 0 0 2px rgba(239, 91, 104, 0.2);
}


/* ==========================================
   COLOR INPUT
   ========================================== */

.input-group input[type="color"] {
    width: 100%;
    height: 42px;

    padding: 3px;

    border: 1px solid #3a3a46;
    border-radius: 6px;

    background: #15151c;

    cursor: pointer;
}

.input-with-lock {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
}

.input-group .input-with-lock > input {
    width: 0;
    min-width: 0;
    flex: 1;
}

.number-stepper {
    display: grid;
    flex: 0 0 28px;
    grid-template-rows: repeat(2, 1fr);
    gap: 2px;
}

.number-stepper button {
    display: grid;
    min-height: 18px;
    place-items: center;
    padding: 0;
    border: 1px solid #3a3a46;
    border-radius: 4px;
    background: #22222c;
    color: #aaaab6;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.number-stepper button:hover {
    border-color: #8b5cf6;
    background: #30283f;
    color: #e0d5ff;
}

.number-stepper button:active {
    background: #493b62;
}

.number-stepper button:focus-visible {
    outline: 2px solid #a78bfa;
    outline-offset: 1px;
}

.number-stepper svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.lock-toggle {
    display: grid;
    width: 42px;
    min-width: 42px;
    place-items: center;
    padding: 0;
    border: 1px solid #3a3a46;
    border-radius: 6px;
    background: #22222c;
    color: #aaaab6;
    cursor: pointer;
}

.lock-toggle:hover,
.lock-toggle.is-locked {
    border-color: #8b5cf6;
    color: #c4b5fd;
}

.lock-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}


/* ==========================================
   RANGE INPUT
   ========================================== */

.input-group input[type="range"] {
    width: 100%;

    margin: 0.35rem 0;

    accent-color: #8b5cf6;
}


/* ==========================================
   VALUE DISPLAY
   ========================================== */

.input-group span {
    font-size: 0.8rem;
    color: #999;
}


/* ==========================================
   SHARE BUTTON
   ========================================== */

.page-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem auto 0.25rem;
}

.action-button {
    min-width: 220px;
    padding: 0.7rem 1rem;

    border: 1px solid #3a3a46;
    border-radius: 6px;

    background: #22222c;
    color: #fff;

    font: inherit;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.action-button:hover:not(:disabled) {
    background: #30303c;
    border-color: #555;
}

.action-button:disabled {
    opacity: 0.55;
    cursor: wait;
}


/* ==========================================
   MOBILE
   ========================================== */

@media (max-width: 600px) {

    .tool-container {
        width: 100%;
        max-width: none;

        margin: 0;
        padding: 0;
    }

    .controls {
        order: 2;
    }


    /* ---------- Canvas ---------- */

    .canvas-container {
        width: 100%;

        margin: 0;
        padding: 0;
    }

    .canvas-container canvas {
        display: block;

        width: 100% !important;
        max-width: 100% !important;

        height: auto !important;

        margin: 0;

        border-radius: 0;

        box-shadow:
            0 0 20px rgba(0, 0, 0, 0.7),
            0 10px 40px rgba(0, 0, 0, 0.6);
    }


    /* ---------- Controls ---------- */

    .controls {
        display: grid;

        grid-template-columns: 1fr;

        margin: 0.25rem 0.5rem 1rem;

        padding: 1rem;

        gap: 1rem;

        border-radius: 10px;
    }

    .page-intro {
        margin: 1rem 1rem 0;
    }

    .page-guide {
        margin: 2rem 1rem 3rem;
    }

    .page-actions {
        margin-right: 0.5rem;
        margin-left: 0.5rem;
    }

    .action-button {
        width: 100%;
    }
}
