/* ===== Variables ===== */

:root {
    --bg: #101010;
    --text: #cdc9c0;
    --muted: #8c887e;
    --brass: #cfae6b;
    --gold: #b58f45;
    --sub-header: #967f51;
    --line: #2c2723;
    --hover-color: #6f4f9a;      /* main.js gives links a random one */
    --selection-color: #6f4f9a;  /* main.js picks a random one */

    /* Accent colours */
    --green: #4fb394;
    --violet: #a37fd6;
    --blue: #6b93e0;
    --rose: #d6667a;
    --amber: #d9a441;
    --teal: #4fa3b0;

    /* Commission status dots on the Contact page */
    --status-open: var(--green);
    --status-limited: var(--amber);
    --status-closed: var(--rose);

    /* Lists the scripts read (separated by commas) */
    --hover-colors: var(--green), var(--violet), var(--blue), var(--rose), var(--amber), var(--teal);  /* links, main.js */
    --shooting-colors: #2e7d68, #365f9c, #a8802f, #6f4f9a, #9c3f4b, #3f6f7a;  /* emerald, sapphire, gold, amethyst, garnet, teal (stars.js) */

    --logo-gold: #d99831;  /* the gold of header_star.svg (stars.js glows it) */
}


/* ===== Fonts ===== */

@font-face {
    font-family: "essay1743";
    font-display: swap;
    src: url("/assets/fonts/Essays1743.ttf") format('truetype');
}

@font-face {
    font-family: 'IM Fell English';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/assets/fonts/IMFellEnglish-Regular.woff2") format('woff2');
}

@font-face {
    font-family: 'IM Fell English';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("/assets/fonts/IMFellEnglish-Italic.woff2") format('woff2');
}


/* ===== Base ===== */

html {
    background: var(--bg);
    scrollbar-gutter: stable;
}

body {
    position: relative;  /* the sky covers the whole page, not just the screen */
    margin: 0;
    color: var(--text);
    font-family: 'IM Fell English', Georgia, serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
}

::selection {
    background: color-mix(in srgb, var(--selection-color) 38%, transparent);
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    max-height: 500px;
    height: auto;
    object-fit: contain;
}

/* Not every input: text boxes keep the browser's dark text on their white background */
span,
p,
label,
input[type="file"] {
    color: var(--text);
}

h1 {
    width: fit-content;    /* only as wide as the text, so the whole gradient falls on the letters */
    margin-left: auto;     /* ...and centered */
    margin-right: auto;
    color: transparent;
    letter-spacing: 0.01em;
    text-align: center;
    font-style: italic;
    font-weight: normal;
    font-size: 40px;
    line-height: 1.25;
    animation: ink 1.6s cubic-bezier(.3, .7, .3, 1) both;
    background: linear-gradient(100deg, #8e763f 0%, #c9a95e 28%, #9a8147 52%, #c2a258 76%, #8a7240 100%);
    background-clip: text;
    filter: url(#worn);
}

@keyframes ink {
    0% {
        opacity:0;letter-spacing:.11em;
    }
    100% {
        opacity:1;letter-spacing:.01em;
    }
}

/* Page title: the h1 (and its h4 subtitle) with a faint glow behind and a thin gold line under them */
.page-title {
    position: relative;    /* the glow is placed relative to this */
    text-align: center;
    padding: 20px 0 16px;
    margin-bottom: 12px;
}

.page-title > * {
    position: relative;    /* above the glow */
}

.page-title h1,
.page-title h4 {
    margin-top: 0;
    margin-bottom: 0;
}

.page-title::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(380px, 100%);
    height: 120px;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at center, rgba(207, 174, 107, 0.055), transparent 70%);
    pointer-events: none;
}

.page-title:not(.sketch-cards-title)::after {
    content: "";
    display: block;
    width: min(340px, 70%);
    height: 1px;
    margin: 14px auto 0;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

h2 {
    color: var(--brass);
}

h3 {
    font-family: "essay1743";
    letter-spacing: 0.01em;
    text-align: left;
    font-size: 1.35rem;
    color: var(--sub-header);
    font-weight: normal;
    margin: 0 0 6px;
}

h4 {
    color: var(--muted);
    margin: 0 0 22px;
    font-style: italic;
    text-align: center;
    font-size: 18px;
    font-weight: normal;
}

h5 {
    color: var(--sub-header);
    margin: 0 0 2px;
    font-style: italic;
    text-align: center;
    font-size: 15px;
    font-weight: normal;
}


/* ===== Stars & sky (stars.js) ===== */

.st {
    width: 1em;
    height: 1em;
    fill: var(--gold);
    vertical-align: -0.1em;
}

.sky {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.8s;
}

.sky.ready {
    opacity: 1;
}

.twinkle {
    position: absolute;
    opacity: 0.8;
    animation: twinkle 5s ease-in-out infinite;
}

@keyframes twinkle {
    50% { opacity: 0.12; }
}

.shooting-star {
    position: absolute;
    opacity: 0;
    filter: drop-shadow(0 0 2px var(--glow)) drop-shadow(0 0 5px var(--glow));
}

.shooting-star g {
    opacity: 0.85;
}

.shooting-star .shooting-core {
    fill: #f1e4c4;
}


/* ===== Header & nav ===== */

header {
    position: relative;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
}

nav {
    display: flex;
    justify-content: right;
    align-items: center;
    gap: 24px;
    padding: 16px 0;
    flex-wrap: wrap;
    margin-top: 25px;
}

nav a {
    display: inline-block;
    padding: 8px 0;
    color: var(--text);
    border-radius: 6px;
    min-width: 85px;
    line-height: 18px;
    text-align: center;
    font-style: normal;
    font-weight: 400;
    font-size: 20px;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--hover-color);
}

nav a[aria-current="page"]:not(:hover) {
    color: var(--text);
}

nav .title {
    position: relative;
    margin-right: auto;
    margin-left: 35px;
    max-height: none;
    padding: 0;
    text-align: left;
}

nav .title:hover {
    color: var(--text);
}

nav .title p {
    font-size: 36px;
    line-height: 26px;
    margin: 0;
    display: flex;
    font-style: normal;
    font-family: "essay1743";
    color: var(--text);
}

nav .title img,
nav .title .logo-star {
    position: absolute;
    z-index: 1;
    top: -35px;
    left: -55px;
}

.nav-links > a,
nav .main-button {
    position: relative;
}

nav .nav-star {
    position: absolute;
    bottom: 100%;
    left: 50%;
    width: 12px;
    height: 12px;
    transform: translateX(-50%);
    fill: var(--hover-color);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

nav a:hover .nav-star,
nav a[aria-current="page"] .nav-star {
    opacity: 1;
}

nav a[aria-current="page"] .nav-star {
    filter: drop-shadow(0 0 2px var(--hover-color));
}

nav .drop-star {
    position: absolute;
    left: 8%;
    width: 15px;
    height: 15px;
    transform: translateX(-50%) scale(0) rotate(-90deg);
    fill: var(--hover-color);
    opacity: 0;
    transition: opacity 0.3s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

nav a:hover .drop-star {
    opacity: 1;
    transform: translateX(-50%) scale(1) rotate(0deg);
}

.dropdown {
    position: relative;
    padding: 8px 0;
    z-index: 5;
}

.dropdown .main-button::after {
    content: "";
    display: inline-block;
    margin-left: 8px;
    width: 5px;
    height: 5px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: translateY(-3px) rotate(45deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    min-width: 100%;
    padding-top: 4px;
    background: #181615;
    border: 1px solid var(--line);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
    opacity: 0.8;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    white-space: nowrap;
    border-radius: 0;
    text-align: left;
    padding: 8px 20px 8px 30px;
    margin: 8px 0;
    font-size: 18px;
}


/* ===== Footer ===== */

footer {
    width: 100%;
    max-width: 1300px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    padding: 24px 0;
    margin: auto;
    color: var(--muted);
}

footer a {
    margin: auto 0;
    color: var(--muted);
    text-align: center;
    text-decoration: underline;
}

footer a:hover {
    color: var(--hover-color);
}

footer p {
    color: inherit;
}

footer .st {
    margin: auto 0;
}

footer .footer-div {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--gold);
}

footer .footer-div .st {
    font-size: 22px;
}

footer .footer-div::before,
footer .footer-div::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
    width: 100%;
}


/* ===== Lightbox & dialogs ===== */

#lightbox,
#drawbox {
    padding: 0;
    border: none;
    background: none;
    max-width: 95vw;
    max-height: 95vh;
    overflow: visible;
}

#lightbox[open],
#drawbox[open] {
    animation: fade-in 0.6s ease;
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#lightbox::backdrop,
#drawbox::backdrop {
    background: rgba(0, 0, 0, 0.85);
}

#lightbox img {
    display: block;
    max-width: 85vw;
    max-height: 85vh;
    object-fit: contain;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    transition: opacity 0.2s;
}

#lightbox img.loading {
    opacity: 0;
    transition: none;
}

.lightbox-prev,
.lightbox-next {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 15vw;
    display: flex;
    align-items: center;
    padding: 0 32px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 64px;
    cursor: pointer;
    opacity: 0.1;
    transition: opacity 0.2s;
    transform: scaleY(2);
}

.lightbox-prev {
    left: 0;
    justify-content: flex-start;
}

.lightbox-next {
    right: 0;
    justify-content: flex-end;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 0.6;
}

.lightbox-prev:hover {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.08), transparent);
}

.lightbox-next:hover {
    background: linear-gradient(to left, rgba(255, 255, 255, 0.08), transparent);
}

/* width: 0 + min-width: 100% = exactly as wide as the image, never wider */
.lightbox-caption,
.lightbox-fields {
    width: 0;
    min-width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    position: relative;
    z-index: 1;
}

.lightbox-caption {
    color: #fff;
    text-align: center;
}

.lightbox-caption p:empty {
    visibility: hidden;
}

.lightbox-fields {
    margin: 10px 0;
}

.lightbox-fields input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: none;
    background: linear-gradient(rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15));
    color: var(--text);
}


/* ===== Homepage ===== */

.homepage-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    font-style: italic;
    font-size: 1.2rem;
    margin: 20px 0 15px;
}

.homepage-header h1 {
    margin-left: 0;        /* auto margins (h1 above) would push the stars to the edges */
    margin-right: 0;
    font: 1.2rem / 1.75 'IM Fell English', Georgia, serif;
    font-style: italic;
    letter-spacing: normal;
    color: var(--text);
    filter: none;
}

.image-grid {
    --columns: 4;  /* also read by main.js */
    display: grid;
    grid-template-columns: repeat(var(--columns), 1fr);
    gap: 16px;
    max-width: 1300px;
    margin: 0 auto;
}

.image-grid .spot {
    margin: 0;
    aspect-ratio: 3 / 4;
}

.image-grid .spot img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
}

.image-grid .spot a,
.uploaded-images a {
    height: 100%;
    color: inherit;
    text-decoration: inherit;
    cursor: zoom-in;
}

.image-grid .spot a {
    display: block;
}

.home-grid.masonry {
    display: flex;
    align-items: flex-start;
}

.home-grid .column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.home-grid.masonry figure.spot,
.home-grid.masonry .spot a,
.home-grid.masonry .spot img {
    aspect-ratio: auto;
    height: auto;
}

/* An empty spot with no image below it would only leave a gap at the bottom of its column */
.home-grid.masonry .column > div.spot:not(:has(~ figure)) {
    display: none;
}


/* ===== Portfolio pages: shared ===== */

.sketch-set-image-grid,
.character-gallery,
.tarot-gallery {
    --columns: 4;
    --gap: 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--gap);
    max-width: 1020px;
    margin: 0 auto;
}

.sketch-set-image-grid > div,
.character-gallery > div,
.tarot-gallery > div {
    width: calc((100% - (var(--columns) - 1) * var(--gap)) / var(--columns));
}

/* Logged in: images can be dragged into a new order (admin.js) */
.arrangeable .arrange-item {
    cursor: grab;
}

.arrange-item.dragging {
    opacity: 0.4;
}

.arrange-item.swap-target {
    outline: 2px solid var(--gold);
    outline-offset: 4px;
}

.sets-rule,
.set-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--gold);
    max-width: 260px;
}

.sets-rule::before,
.sets-rule::after,
.set-rule::before,
.set-rule::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold));
}

.sets-rule::after,
.set-rule::after {
    transform: scaleX(-1);
}

.sets-rule {
    margin: 4px auto 20px;
    font-size: 10px;
}

.set-rule {
    margin: 14px auto 0;
}


/* ===== Sketch cards ===== */

.sets {
    margin-bottom: 30px;
}

.official-sets,
.personal-sets {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 34px 22px;
}

.sketch-set-card {
    width: 410px;
    max-width: 100%;
    min-height: 305px;
}

.stack {
    position: relative;
    height: 250px;
    margin-bottom: 30px;
}

.stack img:not(.c0) {
    filter: grayscale();
}

.stack-box {
    display: block;
    color: var(--hover-color);
}

.stack-box:hover img:not(.c0) {
    filter: none;
}

.stckc {
    position: absolute;
    transform-origin: 50% 100%;
    inset: 0;
    margin: auto;
    width: 170px;
    transition: transform 0.6s cubic-bezier(0.3, 0.8, 0.3, 1), filter 1s;
}

.stckc.c0 {
    z-index: 4;
}

.stckc.c1 {
    z-index: 1;
    transform: rotate(-2deg);
}

.stckc.c2 {
    z-index: 2;
    transform: rotate(2.5deg);
}

.stckc.c3 {
    z-index: 3;
    transform: rotate(-1deg);
}

.stack-box:hover .c1 {
    transform: translateX(-60px) rotate(-13deg);
}

.stack-box:hover .c2 {
    transform: translateX(-20px) rotate(-4.5deg);
}

.stack-box:hover .c0 {
    transform: translateX(20px) translateY(-8px) rotate(4.5deg);
}

.stack-box:hover .c3 {
    transform: translateX(60px) rotate(13deg);
}

.stack-t {
    text-align: center;
}

.stack-t p {
    margin: auto;
}

.stack-t p.sketch-set-card-year,
.stack-t p.sketch-set-card-info {
    color: var(--muted);
    font-size: 13px;
    transition: opacity 0.3s;
    font-family: "essay1743";
}

.stack-t p.sketch-set-card-year {
    opacity: 1;
    margin-top: -6px;
}

.stack-t p.sketch-set-card-info {
    opacity: 0;
    margin-top: -10px;
}

.stack-box:hover .sketch-set-card-info {
    opacity: 1;
}

.sketch-set-card-name {
    font-size: 17px;
    transition: color 0.3s;
    position: relative;
    width: fit-content;
    margin: 0 auto;
    color: #a7a59f;
}

.stack-box:hover .sketch-set-card-name {
    color: inherit;
}

.sketch-set-card-name .stack-star {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 6px;
}

.stack-box .stack-star {
    opacity: 0;
    fill: var(--hover-color);
    transition: opacity 0.3s;
}

.stack-box:hover .stack-star {
    opacity: 1;
}


/* ===== Sketch set page ===== */

.sbar {
    position: sticky;
    top: 0;
    display: flex;
    max-width: 80%;
    align-items: center;
    gap: 18px;
    padding: 25px 0 10px;
    margin: 0 auto 30px;
    backdrop-filter: blur(2px);
    border-bottom: 1px solid var(--line);
    z-index: 1;
}

.sketch-back {
    border: 1px solid var(--gold);
    color: var(--brass);
    padding: 4px 16px;
    border-radius: 2px;
    cursor: pointer;
    background: color-mix(in srgb, var(--bg) 60%, transparent);
    transition: background 0.25s;
}

.sketch-back:hover {
    background: color-mix(in srgb, var(--gold) 14%, transparent);
}

.curn {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 18px;
    margin: 0;
    color: var(--muted);
}

.curn small {
    color: var(--muted);
    font-style: italic;
    margin-left: 8px;
}

.pn {
    display: flex;
    gap: 6px;
}

.pn a {
    width: 34px;
    height: 30px;
    border: 1px solid var(--line);
    box-sizing: border-box;
    background: color-mix(in srgb, var(--bg) 60%, transparent);
    color: var(--brass);
    border-radius: 2px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pn a:hover {
    border-color: var(--gold);
}

/* The set's own line with a star (.set-rule) takes the place of the page title's plain line */
.sketch-set-titles::after {
    content: none;
}

.sketch-set-titles h1 {
    font-size: 32px;
}

.sketch-set-titles h4 {
    font-style: normal;
}

.sketch-div {
    position: relative;
    z-index: 0;
    transition: transform 0.35s;
}

.sketch-div:hover {
    transform: translateY(-4px) rotate(-0.5deg);
    z-index: 2;
}

.sketch-star {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.35s;
}

.sketch-div:hover .sketch-star {
    opacity: 1;
}

.arranging .sketch-div:hover {
    transform: none;
}

.bottom-navigation {
    position: relative;
    display: flex;
    max-width: 80%;
    align-items: center;
    gap: 18px;
    margin: 30px auto 0;
    padding-top: 20px;
    backdrop-filter: blur(2px);
    border-top: 1px solid var(--line);
}

.bn {
    display: flex;
    min-width: 100%;
}

.bn a {
    max-width: 46%;
    color: var(--sub-header);
    line-height: 1.35;
    text-decoration: none;
    transition: color 0.25s;
    font-size: 18px;
}

.bn small {
    display: block;
    font-style: italic;
    font-size: 0.85rem;
    transition: color 0.25s;
    color: var(--muted);
}

.bn a:hover,
.bn a:hover small {
    color: var(--hover-color);
}

.bn .bnnext {
    margin-left: auto;
    text-align: right;
}


/* ===== Story illustrations ===== */

.story-gallery {
    --row-height: 300px;
    display: flex;
    flex-wrap: wrap;
    gap: 30px 18px;
}

.story-gallery::after {
    content: "";
    flex-grow: 999;
}

/* main.js marks the last row: it keeps its normal size and is centered */
.story-gallery.center-last-row {
    justify-content: center;
}

.story-gallery.center-last-row::after {
    display: none;
}

.story-gallery .story-img-div.last-row {
    flex-grow: 0;
}

.story-img-div {
    margin: 0;
    display: flex;
    flex-direction: column;
    flex: var(--ratio) 1 calc(var(--ratio) * var(--row-height));
}

.story-img-div a {
    display: block;
    height: 100%;
}

.story-img-div img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    transition: transform 0.55s cubic-bezier(0.3, 0.8, 0.3, 1);
}

.story-frame {
    position: relative;
    aspect-ratio: var(--ratio);
}

.story-a,
.story-b {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 0;
    border: 1px solid #34302a;
    background: #1c1916;
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.3, 0.8, 0.3, 1), opacity 0.4s;
}

.story-frame:hover .story-a {
    transform: rotate(-2.4deg) translate(-7px, 5px);
    opacity: 1;
}

.story-frame:hover .story-b {
    transform: rotate(2deg) translate(8px, 6px);
    opacity: 1;
}

.story-frame:hover img {
    transform: translateY(-2px);
}

.story-caption {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 8px 2px 0;
    line-height: 1.4;
    height: 1.4em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s;
}


/* ===== Book covers ===== */

.bookcover-gallery {
    --g: 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 34px var(--g);
}

.bookcover-gallery img {
    max-height: 369px;
}

.bookcover-gallery .bookcover-img-div {
    perspective: 900px;
    transition: filter 0.4s;
}

.bookcover-gallery .bookcover-img-div:hover {
    filter: drop-shadow(12px 16px 14px rgba(0, 0, 0, 0.55));
}

.bookcover-gallery .bookcover-img-div a {
    display: block;
    position: relative;
    transform-origin: left center;
    transition: transform 0.5s cubic-bezier(0.3, 0.8, 0.3, 1);
}

.bookcover-gallery .bookcover-img-div:hover a {
    transform: rotateY(-13deg) translateY(-6px);
}

.bookcover-gallery .bookcover-img-div a img {
    display: block;
}

.bookcover-gallery .bookcover-img-div a::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.7), rgba(255, 255, 255, 0.07) 3%, transparent 10%);
}


/* ===== Character art ===== */

.character-gallery.masonry {
    align-items: flex-start;
}

.character-gallery .column {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.character-gallery .character-img-div {
    position: relative;
    overflow: hidden;
    transform: perspective(800px) translateY(var(--lift, 0px)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.15s ease-out;
}

.character-gallery .character-img-div:hover {
    --lift: -4px;
}

.character-gallery .character-img-div img {
    display: block;
    width: 100%;
    height: auto;
}

.character-gallery .character-glare {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(240, 220, 170, 0.085), transparent 65%);
    opacity: 0;
    transition: opacity 0.3s;
}

.character-gallery .character-img-div:hover .character-glare {
    opacity: 1;
}


/* ===== Tarot ===== */

/* Empty column, subtitle, button: equal outer columns keep the subtitle centered */
.tarot-intro {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    max-width: 1020px;
    margin: 0 auto;
}

.tarot-intro h4 {
    grid-column: 2;
    margin: 0;
}

.tarot-intro .draw {
    grid-column: 3;
    justify-self: end;
}

.tarot-img-div {
    position: relative;
}

.tarot-img-div a,
.tarot-img-div img {
    display: block;
    width: 100%;
}

.tarot-img-div img {
    transition: transform 0.3s;
}

.tarot-img-div:hover img {
    transform: translateY(-6px);
}

.tarot-twinkle {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.tarot-twinkle-st {
    position: absolute;
    opacity: 0;
    filter: drop-shadow(0 0 2px var(--gold));
}

.tarot-img-div:hover .tarot-twinkle-st {
    animation: twinkle-tarot 1.3s ease-in-out infinite;
    animation-delay: var(--d);
}

@keyframes twinkle-tarot {
    0%, 100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    50% {
        opacity: 0.95;
        transform: translate(-50%, -50%) rotate(18deg) scale(1);
    }
}

.draw {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 6px 20px;
    border: 1px solid var(--gold);
    border-radius: 40px;
    background: none;
    color: var(--brass);
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.7;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 0 14px color-mix(in srgb, var(--brass) 20%, transparent), inset 0 0 10px color-mix(in srgb, var(--brass) 7%, transparent);
    animation: breathe 4.6s ease-in-out infinite;
    transition: background 0.3s;
}

.draw:hover {
    background: color-mix(in srgb, var(--gold) 10%, transparent);
}

@keyframes breathe {
    50% {
        box-shadow: 0 0 24px color-mix(in srgb, var(--brass) 34%, transparent), inset 0 0 12px color-mix(in srgb, var(--brass) 12%, transparent);
    }
}

/* Trim the box to the letters themselves, so the text sits visually centered */
.draw-label {
    text-box: trim-both cap alphabetic;
    color: var(--brass);
}

.draw-cards {
    position: relative;
    z-index: 4;
    width: 15px;
    height: 21px;
    flex: none;
    margin-right: 2px;
}

.draw-cards i {
    position: absolute;
    inset: 0;
    border: 1px solid var(--gold);
    border-radius: 2px;
    background: var(--star) center / 52% no-repeat, #17130f;
    transition: transform 0.8s cubic-bezier(0.3, 0.8, 0.3, 1);
}

.draw-cards i:nth-child(1) {
    z-index: 1;
    transform: translate(-1.5px, 1px) rotate(-3deg);
}

.draw-cards i:nth-child(2) {
    z-index: 2;
    transform: translate(1px, 0.5px) rotate(2deg);
}

.draw-cards i:nth-child(3) {
    z-index: 3;
}

.draw:hover .draw-cards i:nth-child(2) {
    transform: translate(3px, -17px) rotate(-8deg) scale(1.12);
}

.draw-div {
    display: flex;
    gap: 22px;
    align-items: flex-end;
    justify-content: center;
}

#ovh {
    margin-top: 25px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.draw-flip {
    width: min(250px, 27vw);
    aspect-ratio: 4 / 7;
    perspective: 1000px;
    cursor: pointer;
    z-index: 2;
    transform: rotate(var(--rot, 0deg)) translateY(var(--ty, 0px)) scale(var(--sc, 1));
    transition: transform 0.45s cubic-bezier(0.3, 0.8, 0.3, 1), opacity 0.6s;
}

#drawbox.picking .draw-flip:not(.on):not(.dim):hover {
    --ty: -14px;
}

.draw-flip.dim {
    opacity: 0.3;
    z-index: 1;
}

.draw-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 1.1s cubic-bezier(0.3, 0.8, 0.3, 1);
}

.draw-flip.on .draw-inner {
    transform: rotateY(180deg);
}

.draw-inner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.draw-inner .draw-front {
    transform: rotateY(180deg);
}
.draw-inner .draw-back {
    border: 1px solid var(--gold);
    border-radius: 8px;
    box-sizing: border-box;
}

.draw-flip.on .draw-front {
    border: 1px solid var(--gold);
    border-radius: 8px;
    box-sizing: border-box;
}


/* ===== About ===== */

.about {
    display: grid;
    grid-template-columns: minmax(0, 520px) auto;  /* auto: the text column is as wide as its paragraphs (62ch) */
    justify-content: center;
    gap: 56px;
}

/* No portrait uploaded: just the text, centered */
.about:not(:has(.about-image)) {
    grid-template-columns: auto;
}

.about .about-image {
    max-width: 600px;
    width: 100%;
}

.about .about-image img {
    max-height: 600px;
    width: 100%;
}

.about-text {
    text-align: justify;
    padding-top: 30px;
}

.about p {
    max-width: 62ch;
    margin: 0 0 16px;
    font: 18px / 1.75 'IM Fell English', Georgia, serif;
    color: var(--text);
    text-indent: 2em;
}


/* ===== Contact ===== */

.contact-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
    font-size: 18px;
    color: var(--text);
}

.contact-body ul {
    list-style: none;
    padding-left: 0;
    margin-top: 0;
}

.contact-body li {
    display: flex;
    align-items: flex-start;
}

.contact-body p {
    max-width: 62ch;
    margin: 0 0 16px;
}

.contact-body .contact-links {
    color: var(--muted);
    text-align: center;
    text-decoration: underline;
}

.contact-body .contact-links a:hover {
    color: var(--hover-color);
}

.contact-body .st {
    flex-shrink: 0;
    width: 11px;
    height: 11px;
    margin-top: 0.2em;
    padding-right: 14px;
}

.contact-body .spacer {
    max-width: 62ch;
    margin: 16px 0;
}

/* Must come after .contact-body .st (same specificity) */
.contact-body .spacer-star {
    display: block;
    margin: 0 auto;
    padding-right: 0;
    width: 20px;
    height: 20px;
}

.contact-body .commissions-open,
.contact-body .commissions-limited,
.contact-body .commissions-closed {
    color: var(--muted);
    font-size: 18px;
    max-width: 62ch;
    text-align: center;
}

.contact-body .commissions-open    { --status-color: var(--status-open); }
.contact-body .commissions-limited { --status-color: var(--status-limited); }
.contact-body .commissions-closed  { --status-color: var(--status-closed); }

.contact-body .commissions-open::before,
.contact-body .commissions-limited::before,
.contact-body .commissions-closed::before {
    display: inline-block;
    margin-right: 10px;
    content: "";
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--status-color);
    box-shadow: 0 0 8px var(--status-color);
    animation: pu 5s ease-in-out infinite;
}

.contact-body section:nth-child(1) {
    text-align: center;
}

@keyframes pu {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}


/* ===== Admin: edit page ===== */

.grid-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.grid-controls input {
    width: 60px;
    background: inherit;
    color: var(--text);
}

.grid-controls a,
.grid-controls button {
    display: inline-block;
    padding: 8px 16px;
    background: #333;
    color: #fff;
    border-radius: 6px;
    min-width: 85px;
    text-align: center;
    border: none;
    font: inherit;
    line-height: inherit;
    box-sizing: border-box;
    cursor: pointer;
    vertical-align: middle;
}

.grid-controls a:hover,
.grid-controls button:hover {
    background-image: linear-gradient(rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15));
}

.edit-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.edit-layout .image-grid {
    flex: 1;
}

#edit-grid .spot {
    position: relative;
    border: 2px dashed #888;
    border-radius: 6px;
    cursor: pointer;
}

#edit-grid .spot.filled {
    border-style: solid;
}

#edit-grid .spot.selected {
    border-color: #fff;
    box-shadow: 0 0 0 3px #fff;
}

.spot-clear {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.spot:not(.filled) .spot-clear {
    display: none;
}

.image-panel {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 280px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

body:has(.image-panel) {
    padding-right: 312px;
}

.image-panel select {
    width: 100%;
    margin-bottom: 8px;
}

.panel-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.panel-image {
    width: 100%;
    cursor: grab;
}

.panel-image.selected {
    outline: 3px solid #fff;
}

.panel-image[hidden] {
    display: none;
}


/* ===== Admin: upload page ===== */

form select[name="category"],
form select[name="sketch_set"] {
    min-width: 220px;
}

#sketchset-dialog form {
    display: grid;
    gap: 10px;
}

#sketchset-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

/* The dialog is white: dark text instead of the page's light grey */
#sketchset-dialog label {
    color: inherit;
}

.sketch-set-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.sketch-set-row form {
    display: flex;
    gap: 6px;
}

.sketch-set-row input {
    color: var(--bg);
}

.sketch-set-row input[name="set_year"] {
    width: 80px;
}


/* ===== Admin: right-click menu ===== */

.context-menu {
    position: absolute;
    z-index: 100;
    min-width: 150px;
    padding: 4px;
    background: #fff;
    color: #000;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* The menu is white: e.g. "(current: …)" takes its label's grey instead of the page's light grey */
.context-menu span {
    color: inherit;
}

.context-menu button {
    display: block;
    width: 100%;
    padding: 6px 12px;
    text-align: left;
    background: none;
    border: none;
    border-radius: 4px;
    font: inherit;
    cursor: pointer;
}

.context-menu button:hover {
    background: #eee;
}

.context-menu button[hidden] {
    display: none;
}

.context-menu hr {
    margin: 4px 0;
    border: none;
    border-top: 1px solid #ddd;
}

.context-menu .move-menu > span,
.context-menu .set-menu > span {
    display: block;
    padding: 4px 12px;
    font-size: 0.85em;
    color: #777;
}

.context-menu .set-menu select {
    display: block;
    width: calc(100% - 24px);
    margin: 0 12px 6px;
}


/* ===== Page transitions ===== */

@keyframes sketchpage-fade-in {
    from { opacity: 0; }
}

::view-transition-old(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-new(root) {
    animation: sketchpage-fade-in 0.1s ease;
    mix-blend-mode: normal;
}

::view-transition-image-pair(root) {
    isolation: auto;
}

::view-transition-group(.sketch-card-transition) {
    animation-duration: 0.6s;
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
}

::view-transition-old(.sketch-card-transition),
::view-transition-new(.sketch-card-transition) {
    height: 100%;
    object-fit: cover;
}


/* ===== Reduced motion ===== */

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
