/* ==========================
   SUPER DOOBIE COLORING DESK
========================== */

.coloring-page {
    min-height: 260px;
    margin: 0;
    padding: 18px;

    background:
        radial-gradient(circle, rgba(0, 0, 0, 0.055) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, 0.17), rgba(0, 0, 0, 0.04)),
        #fff0b8;
    background-size: 7px 7px, 100% 100%, 100% 100%;

    border-right: 4px solid #111;
    border-bottom: 4px solid #111;
    border-left: 4px solid #111;
}

.coloring-desk[hidden],
.coloring-studio[hidden] {
    display: none;
}

.coloring-title-panel {
    position: relative;
    overflow: hidden;

    margin-bottom: 14px;
    padding: 15px 18px 17px;

    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.2) 2px, transparent 2px),
        linear-gradient(135deg, #225f94, #2f89c7);
    background-size: 12px 12px, 100% 100%;

    border: 5px solid #111;
    text-align: center;
}

.coloring-title-panel::before,
.coloring-title-panel::after {
    content: "";
    position: absolute;
    width: 110px;
    height: 110px;
    background: #e33a27;
    border: 4px solid #111;
    transform: rotate(45deg);
}

.coloring-title-panel::before {
    top: -79px;
    left: -53px;
}

.coloring-title-panel::after {
    right: -53px;
    bottom: -79px;
}

.coloring-kicker {
    position: relative;
    z-index: 1;
    display: inline-block;
    margin: 0 0 8px;
    padding: 5px 12px;

    background: #f6d13d;
    border: 3px solid #111;

    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: clamp(0.76rem, 1.7vw, 0.98rem);
    font-style: italic;
    letter-spacing: 0.04em;
    line-height: 1;
    text-transform: uppercase;
    transform: rotate(-1deg);
}

.coloring-title-panel h1 {
    position: relative;
    z-index: 1;
    margin: 0;
    color: #77bd3f;

    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: clamp(3rem, 8vw, 5.4rem);
    font-style: italic;
    letter-spacing: 0.01em;
    line-height: 0.87;
    text-transform: uppercase;

    -webkit-text-stroke: 3px #111;
    text-shadow: 5px 5px 0 #111;
}

.coloring-title-panel > p:last-child {
    position: relative;
    z-index: 1;
    max-width: 620px;
    margin: 13px auto 0;
    color: #fff0b8;
    font-size: clamp(0.9rem, 1.8vw, 1.08rem);
    font-weight: 900;
    line-height: 1.3;
}

/* ==========================
   FEATURED COLORING PAGE
========================== */

.coloring-desk {
    padding: 14px;
    background: #f4e3a8;
    border: 4px solid #111;
}

.coloring-feature-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 13px;
    align-items: start;
}

.coloring-stage {
    position: relative;
    min-width: 0;
    padding-inline: 42px;
}

.coloring-feature {
    margin: 0;
}

.coloring-paper {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 480px;
    padding: 12px;

    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.07), transparent 5%, transparent 95%, rgba(0, 0, 0, 0.07)),
        #fff;
    border: 5px solid #111;
    box-shadow: 7px 7px 0 #2f89c7;
}

.coloring-loading {
    position: absolute;
    inset: 50% auto auto 50%;
    z-index: 1;
    margin: 0;
    padding: 8px 12px;
    background: #f6d13d;
    border: 3px solid #111;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    text-transform: uppercase;
    transform: translate(-50%, -50%);
}

.coloring-loading[hidden] {
    display: none;
}

.coloring-feature-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 680px;
    object-fit: contain;
}

.coloring-feature figcaption {
    margin-top: 10px;
    padding: 10px 12px 11px;
    background: #fff0b8;
    border: 3px solid #111;
    text-align: center;
}

.coloring-counter {
    display: inline-block;
    margin-bottom: 4px;
    color: #a52219;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.coloring-feature figcaption h2 {
    margin: 0;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: clamp(1.55rem, 4vw, 2.35rem);
    line-height: 1;
    text-transform: uppercase;
}

.coloring-feature figcaption p {
    margin: 6px 0 0;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
}

.coloring-page-arrow {
    position: absolute;
    top: 42%;
    z-index: 3;

    display: grid;
    place-items: center;
    width: 40px;
    height: 62px;
    padding: 0 0 5px;

    background: #f6d13d;
    border: 4px solid #111;
    color: #111;
    cursor: pointer;

    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: 2.4rem;
    line-height: 1;
    transition: background 140ms ease, transform 140ms ease;
}

.coloring-page-arrow-previous {
    left: 0;
}

.coloring-page-arrow-next {
    right: 0;
}

.coloring-page-arrow:hover,
.coloring-page-arrow:focus-visible {
    background: #e33a27;
    color: #fff;
    outline: none;
    transform: scale(1.07);
}

/* ==========================
   ACTION PANEL
========================== */

.coloring-action-panel {
    display: grid;
    gap: 9px;
    padding: 10px;
    background: #2f89c7;
    border: 4px solid #111;
}

.coloring-action-burst {
    margin: 0 0 3px;
    padding: 10px 6px;
    background:
        radial-gradient(circle, rgba(0, 0, 0, 0.12) 1px, transparent 1px),
        #f6d13d;
    background-size: 7px 7px;
    border: 3px solid #111;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: 1.32rem;
    font-style: italic;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    transform: rotate(-1deg);
}

.coloring-action {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 9px 10px;

    background: #f6d13d;
    border: 3px solid #111;
    color: #111;
    cursor: pointer;

    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: 1rem;
    letter-spacing: 0.025em;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;

    transition: filter 140ms ease, transform 140ms ease;
}

.coloring-action-primary {
    background: #e33a27;
    color: #fff;
}

.coloring-action small {
    display: block;
    margin-top: 4px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.15;
    text-transform: none;
}

.coloring-action:hover:not(:disabled),
.coloring-action:focus-visible:not(:disabled) {
    filter: brightness(1.08) saturate(1.08);
    outline: none;
    transform: translateY(-2px);
}

.coloring-action:disabled {
    cursor: wait;
    filter: grayscale(0.75);
    opacity: 0.62;
}

.coloring-back-link {
    display: block;
    padding: 8px;
    background: #fff0b8;
    border: 3px solid #111;
    color: #111;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: 0.86rem;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
}

.coloring-back-link:hover,
.coloring-back-link:focus-visible {
    background: #77bd3f;
    outline: none;
}

.coloring-gallery-status {
    min-height: 1.25em;
    margin: 10px 0 0;
    font-weight: 900;
    text-align: center;
}

/* ==========================
   THUMBNAIL PAGE RACK
========================== */

.coloring-rack-panel {
    margin-top: 8px;
    padding: 10px;
    background: #fff0b8;
    border: 4px solid #111;
}

.coloring-rack-heading {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: end;
    margin-bottom: 8px;
}

.coloring-rack-heading p {
    margin: 0 0 2px;
    color: #a52219;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.coloring-rack-heading h2 {
    margin: 0;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    line-height: 1;
    text-transform: uppercase;
}

.coloring-rack-controls {
    display: flex;
    gap: 6px;
}

.coloring-rack-controls button {
    width: 38px;
    height: 34px;
    padding: 0;
    background: #f6d13d;
    border: 3px solid #111;
    cursor: pointer;
    font-weight: 900;
}

.coloring-rack-controls button:hover,
.coloring-rack-controls button:focus-visible {
    background: #e33a27;
    color: #fff;
    outline: none;
}

.coloring-thumbnail-rack {
    display: flex;
    gap: 9px;
    overflow-x: auto;
    padding: 5px 5px 12px;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    scrollbar-color: #e33a27 #f4e3a8;
}

.coloring-thumbnail {
    flex: 0 0 116px;
    scroll-snap-align: start;
    padding: 5px;
    background: #fff;
    border: 3px solid #111;
    color: #111;
    cursor: pointer;
    text-align: left;
    transition: background 140ms ease, transform 140ms ease;
}

.coloring-thumbnail img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border: 2px solid #111;
    background: #fff;
}

.coloring-thumbnail span {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: 0.72rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.coloring-thumbnail:hover,
.coloring-thumbnail:focus-visible {
    background: #f6d13d;
    outline: none;
    transform: translateY(-3px);
}

.coloring-thumbnail.is-selected {
    background: #77bd3f;
    box-shadow: 0 0 0 3px #e33a27;
}

/* ==========================
   ONLINE COLOR LAB
========================== */

.coloring-studio {
    padding: 13px;
    background: #f4e3a8;
    border: 4px solid #111;
}

.coloring-studio-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
    padding: 12px;
    background: #2f89c7;
    border: 4px solid #111;
}

.coloring-studio-heading p {
    margin: 0 0 3px;
    color: #f6d13d;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.coloring-studio-heading h2 {
    margin: 0;
    color: #fff;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: clamp(1.65rem, 4vw, 2.6rem);
    line-height: 1;
    text-transform: uppercase;
    -webkit-text-stroke: 1px #111;
    text-shadow: 3px 3px 0 #111;
}

.coloring-studio-close {
    padding: 9px 12px;
    background: #f6d13d;
    border: 3px solid #111;
    cursor: pointer;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    text-transform: uppercase;
}

.coloring-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(112px, 1fr));
    gap: 8px;
    align-items: stretch;
}

.coloring-tool-group {
    min-width: 0;
    margin: 0;
    padding: 9px;
    background: #fff0b8;
    border: 3px solid #111;
}

.coloring-tool-group legend {
    padding: 0 5px;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.coloring-color-list {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
}

.coloring-color-button {
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    background: var(--swatch-color);
    border: 2px solid #111;
    border-radius: 50%;
    cursor: pointer;
}

.coloring-color-button.is-active,
.coloring-color-button:focus-visible {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px #111;
    outline: none;
}

.coloring-custom-color {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
}

.coloring-custom-color input {
    width: 46px;
    height: 28px;
    padding: 1px;
    background: #fff;
    border: 2px solid #111;
    cursor: pointer;
}

.coloring-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.coloring-size-button,
.coloring-tool-button {
    min-width: 34px;
    min-height: 34px;
    padding: 5px 7px;
    background: #fff;
    border: 2px solid #111;
    cursor: pointer;
    font-family: Impact, "Arial Black", Arial, sans-serif;
    font-size: 0.76rem;
    text-transform: uppercase;
}

.coloring-size-button.is-active,
.coloring-tool-button.is-active {
    background: #77bd3f;
}

.coloring-size-button:hover,
.coloring-size-button:focus-visible,
.coloring-tool-button:hover:not(:disabled),
.coloring-tool-button:focus-visible:not(:disabled) {
    background: #f6d13d;
    outline: none;
}

.coloring-tool-button:disabled {
    cursor: default;
    opacity: 0.4;
}

.coloring-studio-note {
    margin: 10px 0;
    padding: 7px 9px;
    background: #f6d13d;
    border: 2px solid #111;
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
}

.coloring-canvas-frame {
    padding: 12px;
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.17) 2px, transparent 2px),
        #225f94;
    background-size: 12px 12px;
    border: 5px solid #111;
}

.coloring-canvas-stack {
    position: relative;
    width: min(100%, 620px);
    margin: auto;
    background: #fff;
    box-shadow: 7px 7px 0 #111;
}

.coloring-canvas-stack img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

.coloring-canvas-stack canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    mix-blend-mode: multiply;
    touch-action: none;
}

.coloring-studio-actions {
    display: flex;
    justify-content: center;
    gap: 9px;
    margin-top: 12px;
}

.coloring-studio-actions .coloring-action {
    width: auto;
    min-width: 170px;
}

/* ==========================
   PRINT SHEET
========================== */

.coloring-print-area {
    display: none;
}

@media (max-width: 980px) {
    .coloring-feature-layout {
        grid-template-columns: 1fr;
    }

    .coloring-action-panel {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .coloring-action-burst,
    .coloring-back-link {
        grid-column: 1 / -1;
    }

    .coloring-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .coloring-page {
        min-height: auto;
        padding: 12px 10px 16px;
        border-right: 0;
        border-left: 0;
    }

    .coloring-title-panel {
        border-width: 4px;
    }

    .coloring-title-panel h1 {
        max-width: 100%;
        font-size: clamp(2rem, 9vw, 3rem);
        line-height: 0.95;
        white-space: nowrap;
        -webkit-text-stroke-width: 2px;
        text-shadow: 4px 4px 0 #111;
    }

    .coloring-title-panel > p:last-child {
        text-wrap: balance;
    }

    .coloring-desk,
    .coloring-studio {
        padding: 9px;
    }

    .coloring-paper {
        min-height: 360px;
        box-shadow: 5px 5px 0 #2f89c7;
    }

    .coloring-action-panel {
        grid-template-columns: 1fr;
    }

    .coloring-action-burst,
    .coloring-back-link {
        grid-column: auto;
    }

    .coloring-toolbar {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 520px) {
    .coloring-stage {
        padding-inline: 32px;
    }

    .coloring-page-arrow {
        width: 32px;
        height: 54px;
        border-width: 3px;
        font-size: 2rem;
    }

    .coloring-paper {
        min-height: 290px;
        padding: 7px;
        border-width: 4px;
    }

    .coloring-rack-heading,
    .coloring-studio-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .coloring-rack-controls {
        align-self: flex-end;
    }

    .coloring-toolbar {
        grid-template-columns: 1fr;
    }

    .coloring-color-list {
        grid-template-columns: repeat(8, 1fr);
    }

    .coloring-studio-actions {
        flex-direction: column;
    }

    .coloring-studio-actions .coloring-action {
        width: 100%;
    }
}

@media (hover: none) {
    .coloring-thumbnail:hover,
    .coloring-page-arrow:hover,
    .coloring-action:hover:not(:disabled) {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .coloring-page-arrow,
    .coloring-action,
    .coloring-thumbnail {
        transition: none;
    }

    .coloring-page-arrow:hover,
    .coloring-page-arrow:focus-visible,
    .coloring-action:hover:not(:disabled),
    .coloring-action:focus-visible:not(:disabled),
    .coloring-thumbnail:hover,
    .coloring-thumbnail:focus-visible {
        transform: none;
    }

    .coloring-thumbnail-rack {
        scroll-behavior: auto;
    }
}

@media print {
    @page {
        margin: 0.35in;
    }

    body {
        background: #fff !important;
    }

    body * {
        visibility: hidden !important;
    }

    .coloring-print-area,
    .coloring-print-area * {
        visibility: visible !important;
    }

    .coloring-print-area {
        position: fixed;
        inset: 0;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        background: #fff;
        color: #111;
        text-align: center;
    }

    .coloring-print-area h1 {
        margin: 0 0 0.12in;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 14pt;
    }

    .coloring-print-area img {
        display: block;
        max-width: 100%;
        max-height: calc(100vh - 0.65in);
        object-fit: contain;
    }

    .coloring-print-area p {
        margin: 0.08in 0 0;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 8pt;
    }
}
