/* tracegoodwin.art — vivid creepy-creature artist showcase */

:root {
    --void: #0a0c09;
    --void-2: #10140e;
    --void-3: #182016;
    --fog: #e6ecda;
    --dim: #93a086;
    --slime: #8fdb2b;
    --slime-bright: #b4ff3c;
    --violet: #9a4bff;
    --line: rgba(230, 236, 218, 0.13);
    --font-creep: "Creepster", "Chalkduster", fantasy;
    --font-caps: "Bebas Neue", "Arial Narrow", Impact, sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
    background: var(--void);
    color: var(--fog);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Film-grain overlay */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 90;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
a { color: var(--fog); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--slime-bright); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--font-creep); font-weight: 400; line-height: 1.04; letter-spacing: 0.03em; }

.wrap { max-width: 74rem; margin: 0 auto; padding: 0 1.4rem; }

.kicker {
    font-family: var(--font-caps);
    font-size: 1rem;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--slime-bright);
    display: block;
    margin-bottom: 0.4rem;
}

/* ---------- Scroll progress line ---------- */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 70;
    background: linear-gradient(90deg, var(--violet), var(--slime-bright));
    box-shadow: 0 0 12px rgba(180, 255, 60, 0.65);
    transform: scaleX(0);
    transform-origin: left;
    pointer-events: none;
}

/* ---------- Header ---------- */

.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 0.7rem 1.4rem;
    background: linear-gradient(to bottom, rgba(10, 12, 9, 0.94), rgba(10, 12, 9, 0.82));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.brand {
    font-family: var(--font-creep);
    font-size: 1.55rem;
    text-decoration: none;
    white-space: nowrap;
    color: var(--fog);
}
.brand em { font-style: normal; color: var(--slime-bright); }
.cat-nav {
    display: flex;
    gap: 0.45rem;
    margin-left: auto;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav a {
    font-family: var(--font-caps);
    font-size: 0.98rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--dim);
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.cat-nav a:hover { color: #fff; border-color: var(--slime-bright); }
.cat-nav a.active { background: var(--violet); border-color: var(--violet); color: #fff; }

/* ---------- Hero ---------- */

.hero {
    position: relative;
    min-height: min(100svh, 56rem);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    background:
        radial-gradient(ellipse 90% 60% at 50% 112%, rgba(154, 75, 255, 0.2), transparent 60%),
        radial-gradient(ellipse 75% 55% at 50% -12%, rgba(143, 219, 43, 0.13), transparent 65%),
        var(--void);
}
.hero-eyes {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(125vw, 78rem);
    opacity: 0.2;
    pointer-events: none;
}
.hero-eyes .eye { transform-origin: center; transform-box: fill-box; }
.hero-inner { position: relative; padding: 7rem 1.4rem 5rem; }
.hero h1 {
    font-size: clamp(3.6rem, 13vw, 8.5rem);
    text-shadow: 0 0 55px rgba(143, 219, 43, 0.5);
}
.hero .sub {
    font-family: var(--font-caps);
    font-size: clamp(1.05rem, 2.6vw, 1.5rem);
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: var(--dim);
    margin-top: 0.8rem;
}
.hero .place {
    color: var(--dim);
    font-size: 0.98rem;
    margin-top: 1.2rem;
}
.hero .place a { color: var(--fog); text-decoration-color: rgba(180, 255, 60, 0.55); }
.scroll-cue {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--dim);
    font-family: var(--font-caps);
    font-size: 0.9rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    text-decoration: none;
}
.scroll-cue::after {
    content: "";
    display: block;
    width: 1px;
    height: 2.6rem;
    margin: 0.6rem auto 0;
    background: linear-gradient(to bottom, var(--slime-bright), transparent);
}

/* ---------- About ---------- */

.about { padding: 6rem 0 4rem; }
.about-grid {
    display: grid;
    grid-template-columns: 0.9fr 1.4fr;
    gap: 3.5rem;
    align-items: center;
    max-width: 60rem;
    margin: 0 auto;
}
.about-photo {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center 30%;
    filter: saturate(1.15) contrast(1.04);
    border: 1px solid var(--line);
    clip-path: polygon(0 3%, 6% 0, 100% 2%, 98% 95%, 92% 100%, 2% 98%);
}
.about h2 { font-size: clamp(2.1rem, 5vw, 3rem); margin-bottom: 1.1rem; }
.about p { color: var(--fog); margin-bottom: 1rem; }
.about .aside { color: var(--dim); font-size: 0.98rem; }
@media (max-width: 52rem) {
    .about-grid { grid-template-columns: 1fr; gap: 2rem; }
    .about-photo { max-width: 20rem; }
}

/* ---------- Work sections ---------- */

.work { padding: 2rem 0 3rem; }
.work-section { padding: 3.5rem 0 1rem; }
.work-head { display: flex; align-items: baseline; gap: 1.1rem; margin-bottom: 1.8rem; position: relative; z-index: 2; }
.work-head h2 {
    font-size: clamp(2.3rem, 6vw, 3.6rem);
    text-shadow: 0 0 32px rgba(154, 75, 255, 0.55);
}
.work-head .count {
    font-family: var(--font-caps);
    color: var(--dim);
    font-size: 1.1rem;
    letter-spacing: 0.18em;
}

/* No-JS fallback is CSS masonry; JS rebuilds into .cols flex columns */
.work-grid { columns: 4 15rem; column-gap: 0.9rem; }
.work-grid.cols {
    columns: unset;
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
}
.work-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}
.work-grid.cols a { margin-bottom: 0; }
.work-grid a {
    display: block;
    margin-bottom: 0.9rem;
    break-inside: avoid;
    overflow: hidden;
    background: var(--void-2);
}
/* Hand-cut edges: four rotating torn-paper silhouettes plus a slight tilt */
.work-grid a:nth-child(4n+1) {
    --tilt: 0.5deg;
    clip-path: polygon(0 1.5%, 28% 0, 71% 2%, 100% 0.6%, 98.8% 34%, 100% 68%, 99% 98.5%, 66% 100%, 30% 98.8%, 0.9% 99.4%, 0 63%, 1.2% 31%);
}
.work-grid a:nth-child(4n+2) {
    --tilt: -0.7deg;
    clip-path: polygon(1.2% 0.8%, 35% 1.8%, 68% 0, 99% 1.4%, 100% 30%, 98.6% 66%, 100% 99%, 71% 98.6%, 33% 100%, 0 98.2%, 1.4% 66%, 0.4% 33%);
}
.work-grid a:nth-child(4n+3) {
    --tilt: 0.8deg;
    clip-path: polygon(0.6% 0, 30% 1.2%, 72% 0.4%, 98.8% 0, 100% 35%, 99.2% 70%, 98.6% 100%, 64% 99%, 31% 99.6%, 1.6% 98.6%, 0 66%, 0.8% 29%);
}
.work-grid a:nth-child(4n) {
    --tilt: -0.4deg;
    clip-path: polygon(0 0.7%, 33% 0.2%, 66% 1.6%, 99.3% 0, 98.9% 31%, 100% 64%, 99.4% 99.2%, 69% 100%, 34% 98.4%, 0.5% 99.8%, 1.1% 68%, 0 34%);
}
.work-grid img {
    width: 100%;
    height: auto;
    filter: saturate(1.05);
    transform: rotate(var(--tilt, 0deg));
    transition: transform 0.4s ease, filter 0.4s ease, opacity 0.4s ease;
}
.work-grid a:hover img { transform: rotate(var(--tilt, 0deg)) scale(1.045); filter: saturate(1.25); }
@media (max-width: 46rem) {
    .work-grid { columns: 2; column-gap: 0.6rem; }
    .work-grid a { margin-bottom: 0.6rem; }
}

.work-empty {
    text-align: center;
    color: var(--dim);
    padding: 4rem 1.4rem;
    font-style: italic;
}

/* ---------- Lightbox ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(6, 8, 5, 0.95);
    padding: 2.5rem;
}
.lightbox.open { display: flex; }
.lightbox img {
    max-width: min(92vw, 62rem);
    max-height: 86vh;
    border: 1px solid var(--line);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}
.lightbox button {
    position: absolute;
    background: rgba(230, 236, 218, 0.07);
    color: var(--fog);
    border: 1px solid var(--line);
    border-radius: 50%;
    width: 2.9rem;
    height: 2.9rem;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}
.lightbox button:hover { background: var(--violet); color: #fff; }
.lb-close { top: 1.1rem; right: 1.1rem; }
.lb-prev { left: 1.1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1.1rem; top: 50%; transform: translateY(-50%); }
.lb-caption {
    position: absolute;
    bottom: 1.1rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--dim);
    font-family: var(--font-caps);
    letter-spacing: 0.14em;
    font-size: 0.95rem;
}

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--line);
    padding: 2.4rem 0;
    color: var(--dim);
    font-size: 0.95rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 2rem; }
.site-footer a { color: var(--dim); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.footer-social { margin-left: auto; display: flex; gap: 1rem; }
.footer-social svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }

/* ---------- Motion (JS + motion-ok only; content never hidden otherwise) ---------- */

@media (prefers-reduced-motion: no-preference) {
    html.js .reveal {
        opacity: 0;
        transform: translateY(28px);
        transition: opacity 0.8s ease, transform 0.8s ease;
        transition-delay: var(--d, 0s);
    }
    html.js .reveal.in { opacity: 1; transform: none; }

    /* Gallery tiles crawl out of the dark, oversaturated for a beat */
    html.js .work-item.reveal {
        transform: translateY(46px) scale(0.96);
        filter: brightness(0.22) saturate(0.3) hue-rotate(40deg);
        transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), filter 1.2s ease;
        transition-delay: var(--d, 0s);
    }
    html.js .work-item.reveal.in { transform: none; filter: none; }

    .lightbox.open img { animation: lb-pop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1); }
    @keyframes lb-pop {
        from { transform: scale(0.9); opacity: 0; }
        to   { transform: scale(1); opacity: 1; }
    }

    .hero-eyes { animation: eyes-in 2.4s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
    .hero-eyes .eye { animation: blink 7s infinite; animation-delay: var(--blink, 0s); }
    .hero-inner > * { animation: rise 1s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
    .hero-inner > :nth-child(2) { animation-delay: 0.15s; }
    .hero-inner > :nth-child(3) { animation-delay: 0.3s; }
    .hero-inner > :nth-child(4) { animation-delay: 0.45s; }

    @keyframes eyes-in {
        from { opacity: 0; }
        to   { opacity: 0.2; }
    }
    @keyframes blink {
        0%, 91%, 100% { transform: scaleY(1); }
        93%, 95% { transform: scaleY(0.06); }
        97% { transform: scaleY(1); }
    }
    @keyframes rise {
        from { opacity: 0; transform: translateY(26px); }
        to   { opacity: 1; transform: none; }
    }
}
