/* ============================================
   desca.works — Victorian Ornamental Design System
   ============================================ */

/* CSS Custom Properties */
:root {
    --midnight: #1A1028;
    --amethyst: #7B2D8E;
    --gold: #C4956A;
    --garnet: #8B2252;
    --emerald: #1B6B4A;
    --parchment: #F0E6D3;
    --manuscript: #B8A892;
    --brass: #A8874B;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--midnight);
    color: var(--parchment);
    font-family: 'Lora', Georgia, serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Grain Overlay (Canvas)
   ============================================ */
#grain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.08;
    mix-blend-mode: overlay;
}

/* ============================================
   Typography
   ============================================ */

/* Display / Headings — Playfair Display */
.site-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(3.5rem, 9vw, 7rem);
    letter-spacing: 0.06em;
    line-height: 1.12;
    color: var(--parchment);
    text-align: center;
    position: relative;
    z-index: 2;
}

.plate-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(2.8rem, 7vw, 5.5rem);
    letter-spacing: 0.06em;
    line-height: 1.12;
    color: var(--parchment);
    margin-bottom: 0.3em;
}

.colophon-title {
    font-size: clamp(2.4rem, 6vw, 4.5rem);
}

/* Subtitle / Labels — Josefin Sans */
.site-subtitle {
    font-family: 'Josefin Sans', 'Helvetica Neue', sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--manuscript);
    text-align: center;
    margin-top: 1em;
    position: relative;
    z-index: 2;
}

.plate-number {
    font-family: 'Josefin Sans', 'Helvetica Neue', sans-serif;
    font-weight: 600;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 0.5em;
}

.sidebar-label {
    font-family: 'Josefin Sans', 'Helvetica Neue', sans-serif;
    font-weight: 600;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 0.5em;
}

.colophon-label {
    font-family: 'Josefin Sans', 'Helvetica Neue', sans-serif;
    font-weight: 600;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 0.3em;
}

.colophon-value {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    color: var(--parchment);
}

/* Body text — Lora */
.body-text {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    color: var(--parchment);
    margin-bottom: 1.2em;
}

.body-text + .body-text {
    text-indent: 1.5em;
}

.workshop-text {
    line-height: 1.6;
}

.workshop-text + .workshop-text {
    text-indent: 1.5em;
}

/* Marginalia */
.marginalia {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(0.7rem, 0.8vw, 0.78rem);
    color: var(--manuscript);
    opacity: 0.6;
    position: absolute;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.05em;
}

.right-margin {
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
}

.left-margin {
    left: 2vw;
    top: 50%;
    transform: translateY(-50%);
}

/* ============================================
   Ornamental Rules
   ============================================ */
.ornamental-rule {
    border: none;
    height: 1px;
    background: var(--gold);
    opacity: 0.6;
    margin: 1.5em 0;
    position: relative;
}

.ornamental-rule::after {
    content: '\u25C6';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.5rem;
    color: var(--gold);
    background: var(--midnight);
    padding: 0 0.8em;
    opacity: 0.8;
}

.ornamental-rule.short {
    width: 60%;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   Plates — Full viewport sections
   ============================================ */
.plate {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ============================================
   PLATE I: THE FRONTISPIECE
   ============================================ */
.plate-i {
    background-color: var(--midnight);
    flex-direction: column;
}

.frontispiece-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80vw;
    max-width: 900px;
    padding: 4rem 2rem;
}

.cartouche-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    max-width: 800px;
    height: auto;
    z-index: 1;
}

/* Blob backgrounds */
.blob {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.blob.visible {
    opacity: 1;
}

.blob-frontispiece {
    width: 500px;
    height: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.blob-exhibition {
    width: 450px;
    height: 450px;
    top: 20%;
    left: 10%;
}

.blob-workshop-1 {
    width: 400px;
    height: 400px;
    top: 10%;
    left: 5%;
}

.blob-workshop-2 {
    width: 400px;
    height: 400px;
    bottom: 10%;
    right: 10%;
}

/* Blob pulse animation for frontispiece */
@keyframes blobPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.08); }
}

.blob-frontispiece.visible svg {
    animation: blobPulse 3.33s ease-in-out infinite;
}

/* ============================================
   Divider Bands
   ============================================ */
.divider-band {
    position: relative;
    width: 100%;
    height: 120px;
    background-color: var(--midnight);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2;
}

.divider-svg {
    width: 100%;
    height: 100%;
    max-width: 1200px;
}

/* ============================================
   Compass Rose
   ============================================ */
.compass-rose {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9998;
    width: 48px;
    height: 48px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.compass-rose:hover {
    opacity: 1;
}

/* ============================================
   Z-Pattern Grid Layout
   ============================================ */
.plate-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0 2%;
    width: 100%;
    max-width: 1200px;
    padding: 2rem 4vw;
    position: relative;
    z-index: 2;
}

/* Z-left: primary content in columns 2-6, secondary in columns 8-10 */
.z-left .primary-block {
    grid-column: 2 / 7;
    grid-row: 1;
}

.z-left .secondary-block {
    grid-column: 8 / 11;
    grid-row: 1;
    align-self: center;
}

.z-left .workshop-block {
    grid-column: 2 / 9;
    grid-row: 1;
}

/* Z-right: content in columns 5-10 */
.z-right .collection-block {
    grid-column: 4 / 11;
    grid-row: 1;
}

/* ============================================
   Content Blocks & Frames
   ============================================ */
.content-block {
    position: relative;
    padding: 2rem;
}

.content-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.small-frame {
    width: 100%;
    height: 100%;
}

.content-inner {
    position: relative;
    z-index: 1;
    padding: 2rem 2.5rem;
}

/* Sidebar list */
.sidebar-content {
    padding: 1.5rem 1.8rem;
}

.sidebar-list {
    list-style: none;
    padding: 0;
}

.sidebar-list li {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--parchment);
    padding: 0.6em 0;
    border-bottom: 1px solid rgba(168, 135, 75, 0.2);
    position: relative;
    padding-left: 1.2em;
}

.sidebar-list li::before {
    content: '\u2022';
    color: var(--gold);
    position: absolute;
    left: 0;
    top: 0.6em;
    font-size: 0.6em;
}

.sidebar-list li:last-child {
    border-bottom: none;
}

/* ============================================
   Connector Filaments
   ============================================ */
.connector-filament {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    width: 30vw;
    height: 80vh;
}

.connector-1-2 {
    top: -10vh;
    right: 15vw;
}

.connector-2-3 {
    top: -10vh;
    left: 15vw;
}

.connector-3-4 {
    top: -10vh;
    right: 15vw;
}

/* ============================================
   Collection Items
   ============================================ */
.collection-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.collection-item {
    position: relative;
}

.item-border {
    position: relative;
    border: 1px solid rgba(196, 149, 106, 0.3);
    padding: 1.5rem 1.2rem;
    transition: border-color 0.4s ease;
}

.item-border:hover {
    border-color: rgba(196, 149, 106, 0.6);
}

.item-corner-ornament {
    position: absolute;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.item-corner-ornament.top-left {
    top: -2px;
    left: -2px;
}

.item-corner-ornament.top-right {
    top: -2px;
    right: -2px;
}

.item-corner-ornament.bottom-left {
    bottom: -2px;
    left: -2px;
}

.item-corner-ornament.bottom-right {
    bottom: -2px;
    right: -2px;
}

.item-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    letter-spacing: 0.04em;
    color: var(--parchment);
    margin-bottom: 0.5em;
}

.item-description {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    line-height: 1.65;
    color: var(--manuscript);
}

/* ============================================
   PLATE IV: THE WORKSHOP — Drop Cap
   ============================================ */
.drop-cap-container {
    position: relative;
    float: left;
    width: 3.5rem;
    height: 3.5rem;
    margin-right: 0.5rem;
    margin-top: 0.2rem;
}

.drop-cap-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.drop-cap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: 2.8rem;
    line-height: 1;
    color: var(--gold);
    position: relative;
    z-index: 1;
}

.workshop-content::after {
    content: '';
    display: table;
    clear: both;
}

/* ============================================
   PLATE V: THE COLOPHON
   ============================================ */
.plate-v {
    flex-direction: column;
}

.colophon-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80vw;
    max-width: 700px;
    padding: 3rem 2rem;
}

.colophon-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: auto;
    z-index: 0;
}

.colophon-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 3rem 3.5rem;
}

.colophon-text {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    color: var(--parchment);
    margin-bottom: 2em;
}

.colophon-details {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2em;
    flex-wrap: wrap;
}

.colophon-section {
    text-align: center;
}

.colophon-attribution {
    font-family: 'Josefin Sans', 'Helvetica Neue', sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--manuscript);
    opacity: 0.7;
}

/* Final flourish */
.final-flourish {
    width: 400px;
    max-width: 60vw;
    height: auto;
    margin-top: 3rem;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.final-flourish.visible {
    opacity: 1;
}

/* ============================================
   SVG Path Drawing Animation
   ============================================ */
.draw-path {
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
    transition: stroke-dashoffset 2.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.draw-path.drawn {
    stroke-dashoffset: 0;
}

/* Filaments have different timing */
.filament {
    transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0) 0.5s;
}

.filament.drawn {
    opacity: 0.8;
}

/* ============================================
   Content Reveal Animations
   ============================================ */
.content-inner {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
}

.content-inner.revealed {
    opacity: 1;
    transform: translateY(0);
}

.site-title,
.site-subtitle {
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.site-title.revealed,
.site-subtitle.revealed {
    opacity: 1;
}

.colophon-inner {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
}

.colophon-inner.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 900px) {
    .plate-grid {
        display: flex;
        flex-direction: column;
        padding: 2rem 6vw;
        gap: 2rem;
    }

    .z-left .primary-block,
    .z-left .secondary-block,
    .z-left .workshop-block,
    .z-right .collection-block {
        grid-column: auto;
        width: 100%;
    }

    .collection-items {
        grid-template-columns: 1fr;
    }

    .connector-filament {
        display: none;
    }

    .marginalia {
        display: none;
    }

    .colophon-details {
        flex-direction: column;
        gap: 1.5rem;
    }

    .cartouche-frame {
        width: 90vw;
    }

    .frontispiece-content {
        width: 95vw;
    }

    .colophon-content {
        width: 95vw;
    }

    .colophon-inner {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 600px) {
    .plate {
        min-height: auto;
        padding: 3rem 0;
    }

    .plate-i {
        min-height: 100vh;
    }

    .plate-v {
        min-height: 80vh;
    }

    .divider-band {
        height: 80px;
    }

    .content-inner {
        padding: 1.5rem 1rem;
    }

    .sidebar-content {
        padding: 1rem;
    }

    .compass-rose {
        bottom: 1rem;
        right: 1rem;
        width: 36px;
        height: 36px;
    }
}

/* ============================================
   Selection Styling
   ============================================ */
::selection {
    background-color: var(--amethyst);
    color: var(--parchment);
}

::-moz-selection {
    background-color: var(--amethyst);
    color: var(--parchment);
}

/* ============================================
   Scrollbar Styling
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--midnight);
}

::-webkit-scrollbar-thumb {
    background: var(--brass);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}
