/* Spadey's Gallery — header-only page; <main> slot is left to grow with the
   user's gallery content below. Tokens & scaling rules mirror the homepage so
   the two pages feel like one site. */

:root {
    --ink: #3e2723;
    --ink-soft: #5d4037;
    --yellow: #fad054;
    --yellow-deep: #e5b840;
    --sky-top: #2b7da4;
    --sky-mid: #4a9ec4;
    --sky-bottom: #8ec5e8;
    --picker-bg: #5baefc;
    --floral-tile: url("../assets/Flowerbackgroundhalfopacity.png");
    --header-border: 3px solid var(--ink-soft);
    --font-display: "Finger Paint", "Comic Sans MS", cursive;

    /* Same 1080p-preserving upscale as the homepage: pinned to 1 below
       1920×1080, scales linearly above so all paddings/sizes grow together. */
    --upscale: max(1, min(calc(100vw / 1920px), calc(100vh / 1080px)));

    --floral-bg-size: clamp(240px, 44vw, calc(1020px * var(--upscale)));
    --content-max-width: calc(1440px * var(--upscale));
    /* Divider lines as % of the portrait (3:4) frame height.
       These mark where headshot / half-body / full-body sections end. */
    --picker-line-headshot: 29%;
    --picker-line-halfbody: 56%;
    --picker-line-fullbody: 96%;
}

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

html {
    /* Page is scrollable here (gallery content lives below the header). */
    height: auto;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: var(--font-display);
    color: var(--ink);
    background: var(--yellow);
    /* Repeating floral over the rest of the page so when the user adds
       content below, it sits on the same warm pattern as the header strips. */
    background-image: var(--floral-tile);
    background-repeat: repeat;
    background-size: var(--floral-bg-size) auto;
    min-height: 100vh;
}

/* ——— Top bar (home / title / nav buttons) ——— */

.gallery-header {
    position: relative;
    width: 100%;
}

.gallery-topbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--yellow);
    background-image: var(--floral-tile);
    background-repeat: repeat;
    background-size: var(--floral-bg-size) auto;
    border-bottom: var(--header-border);
    padding: clamp(0.55rem, 1.4vw, calc(1.05rem * var(--upscale)))
        clamp(0.85rem, 2.2vw, calc(1.65rem * var(--upscale)));
}

/* Home is anchored absolutely to the left edge so the title can sit dead
   center regardless of the icon's width. Icon size tracks the title font. */
.home-link {
    position: absolute;
    left: clamp(0.85rem, 2.2vw, calc(1.65rem * var(--upscale)));
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    text-decoration: none;
    border-radius: 6px;
    padding: 0.25em;
    font-size: clamp(1.85rem, 5.5vw, calc(2.85rem * var(--upscale)));
    line-height: 1;
    transition: transform 0.12s ease;
}

.home-link:hover {
    /* Combined translate keeps the vertical-center anchor while nudging up */
    transform: translateY(calc(-50% - 1px));
}

.home-link:focus-visible {
    outline: 3px solid var(--sky-top);
    outline-offset: 2px;
}

.home-icon {
    width: 1.1em;
    height: 1.1em;
    display: block;
}

.gallery-title {
    margin: 0;
    text-align: center;
    font-size: clamp(1.85rem, 5.5vw, calc(2.85rem * var(--upscale)));
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: var(--ink);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
    /* Avoid pushing the right-side nav offscreen on tight widths */
    min-width: 0;
}

/* ——— Scene strip (compressed sky + hills banner) ——— */

.gallery-scene {
    position: relative;
    width: 100%;
    /* Banner tall enough to show real sky + cloud + hill silhouette. Scales
       with viewport and lifts on bigger monitors via --upscale. */
    height: clamp(150px, 18vw, calc(300px * var(--upscale)));
    overflow: hidden;
    border-bottom: var(--header-border);
    isolation: isolate;
}

.gallery-scene .sky {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(
        180deg,
        var(--sky-top) 0%,
        var(--sky-mid) 55%,
        var(--sky-bottom) 100%
    );
}

.gallery-scene .sky::after {
    /* Same halftone tone as the homepage so the two scenes feel related */
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.5;
    background-image: radial-gradient(
        circle at 1px 1px,
        rgba(12, 72, 98, 0.58) 0.65px,
        transparent 1.1px
    );
    background-size: 5px 5px;
    mix-blend-mode: multiply;
}

.gallery-scene .clouds {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    z-index: 2;
    pointer-events: none;
    /* Slightly softened so they don't dominate the short band */
    opacity: 0.85;
}

.gallery-scene .hills {
    /* Wrapper just provides a positioning context flush against the scene's
       bottom edge — children handle their own anchoring. */
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

.gallery-scene .hill {
    /* Each new banner-hill PNG (1200×958) carries its silhouette in the top
       ~35% of the canvas with transparent space below. To make every
       silhouette "sit on" the bottom of the banner we offset the image down
       by the height of that empty bottom 65%. With width:100% the image is
       80vw tall (PNG aspect 1200/958 ≈ 1.252), so 65% of that is 52vw. */
    position: absolute;
    left: 0;
    right: 0;
    bottom: clamp(calc(-1120px * var(--upscale)), -52vw, -52px);
    width: 100%;
    height: auto;
    display: block;
    backface-visibility: hidden;
}

.gallery-scene .hill-back {
    z-index: 1;
    filter: brightness(1.04) saturate(1.03);
}

.gallery-scene .hill-mid {
    z-index: 2;
    filter: brightness(1.02);
}

.gallery-scene .hill-front {
    z-index: 3;
}

/* ——— Floating nav inside the scene ——— */

.gallery-nav {
    /* Centered horizontally and vertically inside the banner, sitting in the
       sky/cloud area above the hill peaks. */
    position: absolute;
    z-index: 5;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.gallery-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    /* Wider gap between the two pills */
    gap: clamp(1.4rem, 3.2vw, calc(4.5rem * var(--upscale)));
}

.gallery-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--ink);
    font-weight: 700;
    font-size: clamp(
        1.3rem,
        0.85rem + 1.3vw + 0.45vh,
        calc(2.4rem * var(--upscale))
    );
    line-height: 1;
    /* Generous horizontal padding so the pills read as long buttons */
    padding: clamp(0.7rem, 0.45rem + 0.85vw, calc(1.2rem * var(--upscale)))
        clamp(2.2rem, 1.2rem + 3.2vw, calc(4.5rem * var(--upscale)));
    background-color: var(--yellow);
    background-image: var(--floral-tile);
    background-repeat: repeat;
    background-size: clamp(220px, 42vw, calc(760px * var(--upscale))) auto;
    border: 2px solid #c17a2d;
    border-radius: 5px;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
    transition:
        transform 0.12s ease,
        box-shadow 0.12s ease;
}

.gallery-nav a:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.22);
}

.gallery-nav a:active {
    transform: translateY(0);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.gallery-nav a:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 2px;
}

/* ——— Tagline strip ——— */

.gallery-tagline {
    margin: 0;
    text-align: center;
    color: var(--ink);
    font-weight: 700;
    font-size: clamp(1.05rem, 0.78rem + 0.95vw + 0.35vh, calc(1.85rem * var(--upscale)));
    line-height: 1.25;
    background-color: var(--yellow);
    background-image: var(--floral-tile);
    background-repeat: repeat;
    background-size: var(--floral-bg-size) auto;
    border-bottom: var(--header-border);
    padding: clamp(0.7rem, 1.4vw, calc(1.4rem * var(--upscale)))
        clamp(1rem, 3vw, calc(2.5rem * var(--upscale)));
}

/* ——— Main content slot (left for the user) ——— */

.gallery-main {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: clamp(2.5rem, 5vw, calc(4rem * var(--upscale)))
        clamp(2rem, 4.5vw, calc(4rem * var(--upscale)));
}

/* ——— Price-sheet trigger ——— */

.sheet-trigger-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: clamp(1rem, 2vw, calc(1.75rem * var(--upscale)));
}

.sheet-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    font-family: var(--font-display);
    font-size: clamp(1rem, 0.8rem + 0.8vw, calc(1.4rem * var(--upscale)));
    font-weight: 700;
    color: var(--ink);
    background: var(--yellow);
    border: 3px solid var(--ink-soft);
    border-radius: 8px;
    padding: 0.45em 1.2em;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease;
}

.sheet-trigger:hover {
    background: var(--yellow-deep);
    transform: translateY(-2px);
}

.sheet-trigger:active { transform: translateY(0); }

.sheet-trigger:focus-visible {
    outline: 3px solid var(--sky-top);
    outline-offset: 3px;
}

.sheet-trigger svg {
    width: 1.15em;
    height: 1.15em;
    flex-shrink: 0;
}

/* ——— Price-sheet modal ——— */

.sheet-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.75rem, 3vw, 2rem);
}

.sheet-modal[hidden] { display: none; }

.sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(30, 12, 8, 0.84);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sheet-container {
    position: relative;
    z-index: 1;
    /* Keep image within viewport, respect its 3089:2184 landscape ratio */
    width: min(95vw, calc(92vh * 3089 / 2184));
    max-width: 1400px;
}

.sheet-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.sheet-close {
    position: absolute;
    top: -0.8rem;
    right: -0.8rem;
    width: 2.4rem;
    height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--yellow);
    border: 3px solid var(--ink-soft);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    z-index: 2;
    transition: background 0.12s ease, transform 0.12s ease;
}

.sheet-close:hover {
    background: var(--yellow-deep);
    transform: scale(1.1);
}

.sheet-close:focus-visible {
    outline: 3px solid var(--sky-top);
    outline-offset: 3px;
}

.sheet-close svg {
    width: 1rem;
    height: 1rem;
    color: var(--ink);
}

/* Two equal columns; both anchor to the top */
.pricing-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(2rem, 4vw, calc(4rem * var(--upscale)));
    align-items: start;
}

/* ——— LEFT: character picker ——— */

.pricing-picker {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-width: 0;
    overflow: visible;
}

.picker-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    row-gap: clamp(0.6rem, 1.3vw, calc(1rem * var(--upscale)));
    width: 100%;
}

/* Three-column mini-grid: [labels] [frame] [prices] */
.picker-shell {
    display: grid;
    grid-template-columns:
        clamp(2.4rem, 5.5vw, calc(4rem * var(--upscale)))
        minmax(0, 1fr)
        clamp(3.5rem, 7vw, calc(5.25rem * var(--upscale)));
    gap: clamp(0.35rem, 0.8vw, calc(0.65rem * var(--upscale)));
    align-items: stretch;
    width: 100%;
}

/* Portrait frame: 3:4 matches the 1536×2048 character images */
.picker-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 8px;
    outline: 3px solid var(--ink-soft);
    background: var(--sky-bottom);
}

.picker-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /*object-position: center top;*/
    z-index: 0;
    display: block;
}

.picker-character {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    z-index: 1;
    display: block;
}

.picker-dividers {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.picker-dividers span {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: #cc2a2a;
    box-shadow:
        0 1px 0 rgba(200, 20, 20, 0.4),
        0 -1px 0 rgba(0, 0, 0, 0.2);
}

.picker-dividers span:nth-child(1) { top: var(--picker-line-headshot); }
.picker-dividers span:nth-child(2) { top: var(--picker-line-halfbody); }
.picker-dividers span:nth-child(3) { top: var(--picker-line-fullbody); }

/* Labels column: vertical text, one per zone */
.picker-labels {
    display: flex;
    flex-direction: column;
}

/* Prices column: price sits just above each divider line */
.picker-prices {
    display: flex;
    flex-direction: column;
}

/* Zones match line positions: 27% / 57% / 92% / 8% remainder */
.picker-label {
    flex: 27 1 0%;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    font-size: clamp(1.15rem, 0.85rem + 1.2vw, calc(1.8rem * var(--upscale)));
    font-weight: 700;
    font-style: italic;
    color: #fff;
    -webkit-text-stroke: 1.5px var(--ink);
    paint-order: stroke fill;
    text-shadow:
        2px 2px 0 var(--ink),
        -1px -1px 0 var(--ink),
        1px -1px 0 var(--ink),
        -1px 1px 0 var(--ink);
    line-height: 1;
    white-space: nowrap;
    text-align: center;
}

.picker-label:nth-child(2) { flex: 30 1 0%; }
.picker-label:nth-child(3) { flex: 35 1 0%; }

.picker-labels::after {
    content: "";
    flex: 8 1 0%;
}

.picker-price {
    flex: 27 1 0%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.22em;
    font-size: clamp(1.35rem, 1rem + 1.4vw, calc(2.5rem * var(--upscale)));
    font-weight: 700;
    font-style: italic;
    color: #fff;
    line-height: 1;
    -webkit-text-stroke: 1.5px var(--ink);
    paint-order: stroke fill;
    text-shadow:
        2px 2px 0 var(--ink),
        -1px -1px 0 var(--ink),
        1px -1px 0 var(--ink),
        -1px 1px 0 var(--ink);
}

.picker-price:nth-child(2) { flex: 30 1 0%; }
.picker-price:nth-child(3) { flex: 35 1 0%; }

.picker-prices::after {
    content: "";
    flex: 8 1 0%;
}

/* Style bar with arrows inside: [←] [Shaded] [→] */
.picker-style {
    display: inline-flex;
    align-self: center;
    min-height: clamp(3rem, 6vw, calc(4.5rem * var(--upscale)));
    align-items: center;
    justify-content: center;
    gap: clamp(0.25rem, 0.5vw, calc(0.4rem * var(--upscale)));
    background: var(--picker-bg);
    border: 3px solid var(--ink-soft);
    border-radius: 8px;
    padding: 0.25rem clamp(0.3rem, 0.75vw, calc(0.6rem * var(--upscale)));
}

.picker-style span {
    font-size: clamp(1.6rem, 1rem + 1.7vw, calc(2.6rem * var(--upscale)));
    font-weight: 700;
    font-style: italic;
    color: var(--yellow);
    -webkit-text-stroke: 1.5px var(--ink);
    paint-order: stroke fill;
    text-shadow:
        2px 2px 0 var(--ink),
        -1px -1px 0 var(--ink);
    line-height: 1;
}

.picker-arrow {
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    line-height: 0;
    transition: transform 0.12s ease;
}

.picker-arrow img {
    width: clamp(4rem, 9.5vw, calc(6.5rem * var(--upscale)));
    height: auto;
    display: block;
}

.picker-arrow:hover { transform: translateY(-1px); }
.picker-arrow:active { transform: translateY(1px); }

.picker-arrow:focus-visible {
    outline: 3px solid var(--sky-top);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ——— RIGHT: commission-details paper ——— */

.pricing-details {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-width: 0;
}

.details-paper {
    position: relative;
    width: 88%;
    transform: rotate(4deg);
    transform-origin: center top;
    filter: drop-shadow(0 10px 24px rgba(62, 39, 35, 0.28));
}

.details-paper::before {
    content: "";
    display: block;
    aspect-ratio: 600 / 939;
    background: url("../assets/pricing/Paper%20blank.webp") center / 100% 100%
        no-repeat;
}

.details-content {
    position: absolute;
    inset: 8% 7% 6% 13%;
    display: flex;
    flex-direction: column;
    gap: clamp(0.4rem, 0.9vw, calc(0.75rem * var(--upscale)));
    font-family: var(--font-display);
    color: var(--ink);
}

.details-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(0.4rem, 1vw, calc(0.8rem * var(--upscale)));
}

.details-heading {
    margin: 0 0 0.25em;
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 0.9rem + 1vw, calc(1.6rem * var(--upscale)));
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.details-heading--accent {
    color: #a63d2f;
    text-decoration: none;
}

.details-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-display);
    font-size: clamp(0.95rem, 0.72rem + 0.8vw, calc(1.2rem * var(--upscale)));
    line-height: 1.4;
    color: var(--ink);
}

.details-list li {
    position: relative;
    padding-left: 1.1em;
    margin-bottom: 0.15em;
}

.details-list li::before {
    content: "★";
    position: absolute;
    left: 0;
    top: 0;
    font-size: 0.75em;
    line-height: 1.55;
    color: var(--yellow-deep);
}

.details-block p {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(0.95rem, 0.72rem + 0.8vw, calc(1.2rem * var(--upscale)));
    line-height: 1.4;
    color: var(--ink);
}

/* ——— Narrow screens ——— */

@media (max-width: 900px) {
    .pricing-board {
        grid-template-columns: 1fr;
        gap: clamp(2.5rem, 6vw, calc(3.5rem * var(--upscale)));
    }

    .pricing-details {
        order: 2;
    }

    .details-paper {
        transform: rotate(2deg);
        width: clamp(300px, 78vw, 600px);
    }

    .picker-shell {
        grid-template-columns:
            clamp(2.2rem, 5vw, 3.5rem)
            minmax(0, 1fr)
            clamp(3rem, 6.5vw, 4.5rem);
    }
}

@media (max-width: 640px) {
    .gallery-title {
        /* Pull the title in so the home icon never crowds it */
        font-size: clamp(1.55rem, 6.5vw, 2.4rem);
        padding-inline: 2.5rem;
    }

    .gallery-nav ul {
        gap: 1.2rem;
    }

    .gallery-nav a {
        font-size: 1.15rem;
        padding: 0.65rem 1.9rem;
    }
}

@media (max-width: 380px) {
    .gallery-nav ul {
        gap: 0.85rem;
    }

    .gallery-nav a {
        font-size: 1rem;
        padding: 0.55rem 1.5rem;
    }
}

/* Phones only — keep commission text inside the paper */
@media (max-width: 480px) {
    .details-paper {
        width: min(94vw, 380px);
    }

    .details-content {
        inset: 8% 10% 7% 14%;
        gap: 0.25rem;
    }

    .details-columns {
        gap: 0.3rem;
    }

    .details-heading {
        font-size: clamp(0.92rem, 3.9vw, 1.05rem);
        margin-bottom: 0.12em;
    }

    .details-list,
    .details-block p {
        font-size: clamp(0.72rem, 3.1vw, 0.84rem);
        line-height: 1.28;
    }

    .details-list li {
        margin-bottom: 0.05em;
        padding-left: 1em;
    }

    .details-list li::before {
        line-height: 1.45;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-link,
    .gallery-nav a,
    .picker-arrow {
        transition: none;
    }
    .home-link:hover,
    .gallery-nav a:hover,
    .picker-arrow:hover {
        transform: none;
    }
}
