/* ==========================================================================
   ppuzzl.dev - Victorian-Ornate Developer Exhibition
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
    --neon-magenta: #FF006E;
    --neon-lime: #ADFF02;
    --ivory-parchment: #FFF8F0;
    --deep-plum: #2D1B2E;
    --gilded-copper: #B87333;
    --bokeh-violet: #9B72CF;
    --specimen-tint: #F0E8FF;

    --font-headline: 'Playfair Display', Georgia, serif;
    --font-body: 'Lora', 'Times New Roman', serif;
    --font-code: 'JetBrains Mono', 'Courier New', monospace;

    --cursor-x: 50%;
    --cursor-y: 50%;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--ivory-parchment);
    color: var(--deep-plum);
    font-family: var(--font-body);
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
}

/* --- Gaslight Cursor-Follow Overlay --- */
#gaslight-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(
        circle 150px at var(--cursor-x) var(--cursor-y),
        rgba(255, 0, 110, 0.08),
        transparent
    );
    transition: background 0.05s ease;
}

/* --- Bokeh Background Particles --- */
#bokeh-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bokeh-particle {
    position: absolute;
    border-radius: 50%;
    filter: blur(6px);
    opacity: 0;
    animation: bokehDrift linear infinite;
}

@keyframes bokehDrift {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    50% {
        transform: translateY(-30vh) translateX(20px) scale(1.2);
        opacity: 0.35;
    }
    90% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-60vh) translateX(-15px) scale(0.8);
        opacity: 0;
    }
}

/* --- Exhibition Hall Entrance --- */
.entrance-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 40px 20px;
}

.entrance-frame-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ornate-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Ornate border SVG styles */
.frame-outer,
.frame-inner {
    fill: none;
    stroke: var(--deep-plum);
    stroke-width: 1.5;
}

.frame-outer {
    stroke-dasharray: 2700;
    stroke-dashoffset: 2700;
    animation: drawBorder 2.5s ease-in-out forwards;
}

.frame-inner {
    stroke-dasharray: 2600;
    stroke-dashoffset: 2600;
    animation: drawBorder 2.5s ease-in-out 0.2s forwards;
    stroke-width: 0.8;
    stroke: var(--bokeh-violet);
}

@keyframes drawBorder {
    to {
        stroke-dashoffset: 0;
    }
}

.rosette-fill {
    fill: none;
    stroke: var(--gilded-copper);
    stroke-width: 1.5;
    opacity: 0;
    animation: fadeIn 0.5s ease 2.2s forwards;
}

.rosette-center {
    fill: var(--gilded-copper);
    opacity: 0;
    animation: fadeIn 0.5s ease 2.4s forwards;
}

.acanthus {
    fill: var(--gilded-copper);
    opacity: 0;
    animation: fadeIn 0.6s ease 2.3s forwards;
}

.cartouche-arch {
    fill: none;
    stroke: var(--deep-plum);
    stroke-width: 1.2;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawBorder 1.5s ease 1.5s forwards;
}

.cartouche-scroll {
    fill: none;
    stroke: var(--gilded-copper);
    stroke-width: 1;
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: drawBorder 1.5s ease 1.8s forwards;
}

.beaded-edge line {
    stroke: var(--deep-plum);
    stroke-width: 0.8;
    stroke-dasharray: 3 5;
    stroke-dashoffset: 500;
    animation: drawBorder 2s ease 1s forwards;
}

.side-flourish path {
    fill: none;
    stroke: var(--gilded-copper);
    stroke-width: 1;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: drawBorder 2s ease 1.2s forwards;
}

.corner-flourish {
    opacity: 0;
    animation: fadeIn 0.6s ease 2s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Entrance content */
.entrance-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.wordmark {
    font-family: var(--font-headline);
    font-size: clamp(36px, 7vw, 80px);
    font-weight: 700;
    color: var(--deep-plum);
    letter-spacing: 0.05em;
    opacity: 0;
    animation: wordmarkReveal 1s ease 2.8s forwards;
}

@keyframes wordmarkReveal {
    0% {
        opacity: 0;
        font-weight: 100;
        letter-spacing: 0.15em;
    }
    50% {
        opacity: 1;
        font-weight: 400;
    }
    100% {
        opacity: 1;
        font-weight: 700;
        letter-spacing: 0.05em;
    }
}

.subtitle {
    font-family: var(--font-headline);
    font-size: clamp(16px, 2.5vw, 24px);
    font-style: italic;
    font-weight: 400;
    color: var(--bokeh-violet);
    margin-top: 12px;
    min-height: 1.5em;
    letter-spacing: 0.08em;
}

.subtitle .cursor-blink {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--neon-magenta);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.8s step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Main Catalog Column --- */
.catalog-column {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* --- Catalog Entry --- */
.catalog-entry {
    margin-bottom: 120px;
    position: relative;
    opacity: 0;
    transform: translateY(15px);
}

.catalog-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

.catalog-entry[data-bg="light"] .entry-frame {
    background-color: var(--ivory-parchment);
}

.catalog-entry[data-bg="tinted"] .entry-frame {
    background-color: var(--specimen-tint);
}

.entry-frame {
    position: relative;
    padding: 60px 40px 40px;
    border-radius: 6px;
}

/* Entry border SVG */
.entry-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.entry-frame-outer {
    fill: none;
    stroke: var(--deep-plum);
    stroke-width: 1.5;
    stroke-dasharray: 2600;
    stroke-dashoffset: 2600;
    transition: stroke-dashoffset 1s ease;
}

.entry-frame-inner {
    fill: none;
    stroke: var(--bokeh-violet);
    stroke-width: 0.6;
    stroke-dasharray: 2500;
    stroke-dashoffset: 2500;
    transition: stroke-dashoffset 1.2s ease 0.2s;
}

.catalog-entry.visible .entry-frame-outer,
.catalog-entry.visible .entry-frame-inner {
    stroke-dashoffset: 0;
}

.entry-rosette {
    fill: var(--gilded-copper);
    opacity: 0;
    transition: opacity 0.5s ease 0.8s;
}

.catalog-entry.visible .entry-rosette {
    opacity: 1;
}

.cartouche-bg {
    fill: var(--ivory-parchment);
    stroke: var(--deep-plum);
    stroke-width: 0.8;
}

.entry-cartouche .cartouche-arch {
    fill: none;
    stroke: var(--deep-plum);
    stroke-width: 1;
}

/* Entry header */
.entry-header {
    text-align: center;
    margin-bottom: 30px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease 0.6s, transform 0.6s ease 0.6s;
}

.catalog-entry.visible .entry-header {
    opacity: 1;
    transform: translateY(0);
}

.entry-number {
    display: block;
    font-family: var(--font-headline);
    font-size: 14px;
    font-style: italic;
    color: var(--bokeh-violet);
    letter-spacing: 0.2em;
    margin-bottom: 8px;
}

.entry-title {
    font-family: var(--font-headline);
    font-size: clamp(28px, 4.5vw, 56px);
    font-weight: 700;
    color: var(--deep-plum);
    line-height: 1.2;
}

/* Entry body */
.entry-body {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease 0.8s, transform 0.6s ease 0.8s;
}

.catalog-entry.visible .entry-body {
    opacity: 1;
    transform: translateY(0);
}

.entry-body p {
    margin-bottom: 24px;
    text-align: justify;
    hyphens: auto;
}

/* Drop cap */
.drop-cap {
    float: left;
    font-family: var(--font-headline);
    font-style: italic;
    font-size: 4em;
    line-height: 0.8;
    padding-right: 10px;
    padding-top: 6px;
    color: var(--neon-magenta);
    text-shadow: 1px 1px 2px var(--gilded-copper);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.4s ease 1.2s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 1.2s;
}

.catalog-entry.visible .drop-cap {
    opacity: 1;
    transform: scale(1);
}

/* Code blocks */
.entry-code {
    background-color: var(--deep-plum);
    border-radius: 4px;
    padding: 24px;
    margin-top: 20px;
    overflow-x: auto;
    border: 1px solid var(--gilded-copper);
    position: relative;
}

.entry-code::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gilded-copper), transparent);
}

.entry-code code {
    font-family: var(--font-code);
    font-size: 14px;
    letter-spacing: 0.01em;
    color: var(--ivory-parchment);
    line-height: 1.7;
    white-space: pre;
    display: block;
}

.code-keyword {
    color: var(--neon-magenta);
}

.code-string {
    color: var(--neon-lime);
}

.code-method {
    color: var(--bokeh-violet);
}

.code-prop {
    color: var(--gilded-copper);
}

.code-comment {
    color: #7a6a7e;
    font-style: italic;
}

/* Entry footer */
.entry-footer {
    margin-top: 30px;
    text-align: center;
}

.footer-rule {
    width: 80%;
    max-width: 400px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.footer-rule line {
    stroke: var(--deep-plum);
    stroke-width: 0.8;
    stroke-dasharray: 3 5;
}

.footer-rosette {
    fill: var(--gilded-copper);
    stroke: var(--deep-plum);
    stroke-width: 0.5;
}

/* --- Specimen Gallery --- */
.specimen-gallery {
    max-width: 800px;
    margin: 0 auto 80px;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.gallery-title {
    font-family: var(--font-headline);
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 700;
    font-style: italic;
    color: var(--deep-plum);
    text-align: center;
    margin-bottom: 40px;
}

.gallery-scroll {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 20px 0 30px;
    -webkit-overflow-scrolling: touch;
}

.gallery-scroll::-webkit-scrollbar {
    height: 6px;
}

.gallery-scroll::-webkit-scrollbar-track {
    background: var(--specimen-tint);
    border-radius: 3px;
}

.gallery-scroll::-webkit-scrollbar-thumb {
    background: var(--gilded-copper);
    border-radius: 3px;
}

.specimen-card {
    flex: 0 0 260px;
    scroll-snap-align: start;
}

.specimen-frame {
    border: 1.5px solid var(--deep-plum);
    border-radius: 4px;
    padding: 16px;
    background-color: var(--ivory-parchment);
    position: relative;
    height: 100%;
}

.specimen-frame::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    border: 0.5px solid var(--bokeh-violet);
    border-radius: 3px;
    pointer-events: none;
}

.specimen-frame::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 8px;
    background-color: var(--ivory-parchment);
    border: 1px solid var(--deep-plum);
    border-radius: 2px;
}

.specimen-label {
    font-family: var(--font-headline);
    font-size: 14px;
    font-weight: 700;
    color: var(--neon-magenta);
    text-align: center;
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}

.specimen-code {
    background-color: var(--deep-plum);
    border-radius: 3px;
    padding: 12px;
    overflow-x: auto;
}

.specimen-code code {
    font-family: var(--font-code);
    font-size: 12px;
    color: var(--ivory-parchment);
    line-height: 1.6;
    white-space: pre;
}

/* --- Closing Flourish --- */
.closing-flourish {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 20px 80px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.closing-rule {
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 0 auto 40px;
    display: block;
}

.closing-line {
    stroke: var(--deep-plum);
    stroke-width: 1;
    stroke-dasharray: 3 6;
}

.closing-rosette-outer {
    fill: none;
    stroke: var(--deep-plum);
    stroke-width: 1.2;
}

.closing-rosette-inner {
    fill: none;
    stroke: var(--gilded-copper);
    stroke-width: 1;
}

.closing-rosette-center {
    fill: var(--gilded-copper);
}

.closing-petal {
    fill: var(--gilded-copper);
    opacity: 0.7;
}

.closing-content {
    margin-top: 20px;
}

.closing-domain {
    font-family: var(--font-headline);
    font-size: clamp(20px, 3vw, 30px);
    font-weight: 700;
    color: var(--deep-plum);
    letter-spacing: 0.1em;
}

.closing-tagline {
    font-family: var(--font-headline);
    font-size: clamp(14px, 1.5vw, 18px);
    font-style: italic;
    color: var(--bokeh-violet);
    margin-top: 8px;
    letter-spacing: 0.08em;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .entry-frame {
        padding: 40px 20px 30px;
    }

    .catalog-entry {
        margin-bottom: 80px;
    }

    .entrance-frame-wrapper {
        aspect-ratio: 3 / 4;
    }

    .drop-cap {
        font-size: 3em;
    }

    .entry-code {
        padding: 16px;
    }

    .entry-code code {
        font-size: 12px;
    }

    .specimen-card {
        flex: 0 0 220px;
    }
}
