/* =====================================================
   kurairi.com — Victorian Scholar's Crystal Cabinet
   ===================================================== */

/* ---- Custom Properties ---- */
:root {
    --espresso: #2C1A0E;
    --dark-umber: #1E1009;
    --ivory: #F5ECD7;
    --antique-gold: #B8923A;
    --pale-honey: #E8C88A;
    --burnt-sienna: #C44B2B;
    --rose-plum: #8B4A6B;
    --body-text: #3A2510;
    --warm-grey: #E8E0C8;
    --nav-gold: #C9A86C;
    --ffd580: #FFD580;
    --ff7a5c: #FF7A5C;
    --prismatic-blue: #4A8BB8;
    --honey-amber: #E8B84B;

    /* Cursor bloom position */
    --cx: 50%;
    --cy: 50%;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--espresso);
    color: var(--body-text);
    font-family: 'EB Garamond', Georgia, serif;
    font-size: clamp(15px, 1.1vw, 18px);
    line-height: 1.8;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Paper grain texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    opacity: 0.06;
}

/* ---- Typography ---- */
h1, h2, h3, h4 {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-feature-settings: "liga" 1, "kern" 1, "onum" 1;
}

/* ---- Navigation ---- */
#site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(30, 16, 9, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    border-bottom: 1px solid rgba(184, 146, 58, 0.4);
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
}

.nav-logo {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-variant: small-caps;
    font-size: 18px;
    letter-spacing: 0.22em;
    color: var(--pale-honey);
    text-decoration: none;
    text-transform: lowercase;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 40px;
}

.nav-links a {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-variant: small-caps;
    font-size: 12px;
    letter-spacing: 0.22em;
    color: var(--nav-gold);
    text-decoration: none;
    text-transform: lowercase;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--pale-honey);
}

/* ---- Panels ---- */
.panel {
    min-height: 80vh;
    position: relative;
    padding: 100px 0 80px;
}

.panel-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
}

.panel-dark {
    background-color: var(--espresso);
}

.panel-light {
    background-color: var(--ivory);
}

/* ---- Panel 1: Folio ---- */
.panel-folio {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Cursor bloom effect */
.cursor-bloom {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: conic-gradient(
        from 0deg at var(--cx) var(--cy),
        transparent 0deg,
        rgba(255, 213, 128, 0.08) 30deg,
        rgba(255, 122, 92, 0.1) 80deg,
        rgba(196, 75, 43, 0.08) 130deg,
        rgba(139, 74, 107, 0.08) 190deg,
        rgba(74, 139, 184, 0.06) 240deg,
        rgba(255, 213, 128, 0.06) 300deg,
        transparent 360deg
    );
    mix-blend-mode: screen;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.cursor-bloom.active {
    opacity: 1;
}

.folio-content {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.crystal-centerpiece {
    width: 220px;
    height: 240px;
    margin-bottom: 16px;
}

.crystal-amethyst {
    width: 100%;
    height: 100%;
    animation: crystal-sway 8s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 8px rgba(184, 146, 58, 0.25));
}

@keyframes crystal-sway {
    from { transform: rotate(-2deg); }
    to { transform: rotate(2deg); }
}

.folio-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(48px, 7vw, 80px);
    letter-spacing: 0.12em;
    color: #F5ECD7;
    text-transform: uppercase;
    line-height: 1;
}

.folio-subtitle {
    font-family: 'EB Garamond', serif;
    font-size: 18px;
    font-style: italic;
    color: var(--pale-honey);
    letter-spacing: 0.04em;
}

.folio-rule {
    width: 400px;
    max-width: 90vw;
    margin-top: 8px;
}

.folio-rule svg {
    width: 100%;
    height: 20px;
}

/* ---- Ornamental Dividers ---- */
.ornamental-divider {
    padding: 20px 40px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Divider stroke-dasharray animation */
.divider-line-left,
.divider-line-right {
    stroke-dasharray: 340;
    stroke-dashoffset: 340;
    transition: stroke-dashoffset 1.2s ease;
}

.ornamental-divider.drawn .divider-line-left,
.ornamental-divider.drawn .divider-line-right {
    stroke-dashoffset: 0;
}

/* ---- Section Titles ---- */
.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(32px, 4vw, 48px);
    color: var(--pale-honey);
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.section-title-light {
    color: var(--pale-honey);
}

/* On light backgrounds the section title should be darker amber */
.panel-light .section-title {
    color: var(--antique-gold);
}

.section-intro {
    font-family: 'EB Garamond', serif;
    font-size: clamp(15px, 1.1vw, 17px);
    color: var(--body-text);
    max-width: 600px;
    margin-bottom: 60px;
    font-style: italic;
    opacity: 0.85;
}

.section-intro-light {
    color: var(--warm-grey);
    opacity: 0.7;
}

/* ---- Masonry Grid ---- */
.masonry-grid {
    columns: 3;
    column-gap: 24px;
    column-fill: balance;
}

@media (max-width: 960px) {
    .masonry-grid {
        columns: 2;
    }
}

@media (max-width: 600px) {
    .masonry-grid {
        columns: 1;
    }
}

/* ---- Cards ---- */
.card {
    break-inside: avoid;
    margin-bottom: 24px;
    background: var(--ivory);
    border: 1px solid var(--antique-gold);
    border-radius: 2px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(44, 26, 14, 0.08), 0 2px 8px rgba(44, 26, 14, 0.06);
}

.card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.card:hover {
    border-color: var(--pale-honey);
}

/* Crystalline facet overlay on hover */
.card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, rgba(255, 213, 128, 0.15), rgba(196, 75, 43, 0.12));
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    opacity: 0;
    transition: opacity 0.4s ease, clip-path 0.4s ease;
    pointer-events: none;
}

.card:hover::after {
    opacity: 1;
    clip-path: polygon(50% 5%, 95% 20%, 100% 70%, 55% 100%, 5% 80%, 0% 30%);
}

.card-tall {
    /* taller cards naturally from content */
}

.card-wide {
    break-inside: avoid;
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 20px;
    color: var(--espresso);
    margin-bottom: 10px;
    line-height: 1.3;
}

.card-text {
    font-family: 'EB Garamond', serif;
    font-size: 15px;
    color: var(--body-text);
    line-height: 1.75;
    margin-bottom: 10px;
}

.card-text:last-of-type {
    margin-bottom: 0;
}

.card-tag {
    display: inline-block;
    font-family: 'EB Garamond', serif;
    font-size: 11px;
    font-style: italic;
    color: var(--rose-plum);
    border: 1px solid rgba(139, 74, 107, 0.3);
    padding: 2px 8px;
    border-radius: 1px;
    margin-top: 12px;
    letter-spacing: 0.04em;
}

.card-crystal-accent {
    float: right;
    width: 60px;
    height: 80px;
    margin: 0 0 8px 12px;
    opacity: 0.7;
}

.card-crystal-accent.small {
    width: 50px;
    height: 50px;
}

.card-crystal-accent svg {
    width: 100%;
    height: 100%;
}

.card-ornament {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    opacity: 0.6;
}

.card-ornament svg {
    width: 40px;
    height: 40px;
}

.card-ornament-small {
    display: flex;
    justify-content: center;
    margin: 16px 0 8px;
    opacity: 0.5;
}

.card-ornament-small svg {
    width: 30px;
    height: 30px;
}

.card-image {
    margin: -24px -24px 16px -24px;
    overflow: hidden;
}

.card-image-full {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 0;
}

.card-image-full svg {
    max-width: 100%;
}

.small-crystal svg {
    max-width: 160px;
}

.sepia-image svg {
    filter: sepia(0.3) saturate(0.7);
}

.card-pull-quote {
    padding: 16px 0;
    text-align: center;
}

.card-pull-quote blockquote {
    font-family: 'EB Garamond', serif;
    font-size: 18px;
    font-style: italic;
    color: var(--body-text);
    line-height: 1.7;
    padding: 0 16px;
    border-left: 2px solid var(--antique-gold);
    text-align: left;
}

/* ---- Panel 3: Crystallography ---- */
.panel-crystallography {
    padding: 100px 0 80px;
}

.crystal-diagram-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 40px;
}

.crystal-system-diagram {
    width: 100%;
    max-width: 760px;
    display: block;
    margin: 0 auto;
}

.diagram-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
    font-weight: 600;
    fill: var(--pale-honey);
    letter-spacing: 0.05em;
}

.diagram-sublabel {
    font-family: 'EB Garamond', serif;
    font-size: 10px;
    font-style: italic;
    fill: var(--warm-grey);
    opacity: 0.65;
}

.diagram-annotation {
    font-family: 'EB Garamond', serif;
    font-size: 13px;
    font-style: italic;
    fill: var(--antique-gold);
    opacity: 0.7;
}

/* ---- Panel 4: Archive (Annotated) ---- */
.panel-inner-annotated {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

.main-content-col {
    flex: 1;
    min-width: 0;
}

.annotation-sidebar {
    width: 180px;
    flex-shrink: 0;
    padding-top: 80px;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.annotation-sidebar.visible {
    opacity: 0.4;
}

.annotation-note {
    font-family: 'EB Garamond', serif;
    font-size: 11px;
    font-style: italic;
    color: var(--body-text);
    line-height: 1.6;
    margin-bottom: 24px;
    padding-left: 12px;
    border-left: 1px solid rgba(184, 146, 58, 0.3);
}

@media (max-width: 1280px) {
    .annotation-sidebar {
        display: none;
    }
    .panel-inner-annotated {
        max-width: 1200px;
    }
}

/* ---- Panel 5: Correspondences ---- */
.panel-correspondences {
    background: var(--ivory);
}

.panel-inner-editorial {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 40px;
}

.editorial-content {
    display: flex;
    gap: 60px;
    align-items: flex-start;
    margin-top: 40px;
}

.editorial-illustration {
    flex-shrink: 0;
    width: 240px;
}

.editorial-crystal-svg {
    width: 100%;
    filter: drop-shadow(0 4px 12px rgba(184, 146, 58, 0.2));
    opacity: 0.85;
}

.editorial-text {
    flex: 1;
    max-width: 700px;
}

.editorial-body {
    font-family: 'EB Garamond', serif;
    font-size: clamp(15px, 1.1vw, 18px);
    color: var(--body-text);
    line-height: 1.85;
    margin-bottom: 24px;
}

.pull-quote {
    margin: 36px 0;
    padding: 0 32px;
    position: relative;
}

.pull-quote::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--antique-gold), transparent);
}

.pull-quote-text {
    font-family: 'Cinzel Decorative', 'Palatino Linotype', serif;
    font-size: clamp(14px, 1.3vw, 18px);
    color: var(--espresso);
    line-height: 1.6;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-style: normal;
    font-weight: 400;
}

@media (max-width: 800px) {
    .editorial-content {
        flex-direction: column;
    }
    .editorial-illustration {
        width: 160px;
        margin: 0 auto;
    }
}

/* ---- Panel 6: Specimens ---- */
.panel-specimens {
    background: var(--ivory);
}

.card-specimen .card-image-full {
    margin: -24px -24px 16px -24px;
    padding: 20px;
    background: rgba(44, 26, 14, 0.04);
    border-bottom: 1px solid rgba(184, 146, 58, 0.2);
}

.specimen-full-svg {
    max-height: 220px;
    filter: drop-shadow(0 2px 6px rgba(184, 146, 58, 0.2));
}

/* ---- Panel 7: Colophon ---- */
.panel-colophon {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-umber);
}

.colophon-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.colophon-ornament {
    width: 80px;
    height: 80px;
    opacity: 0.6;
    margin-bottom: 8px;
}

.colophon-ornament svg {
    width: 100%;
    height: 100%;
}

.colophon-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: clamp(20px, 2.5vw, 32px);
    letter-spacing: 0.18em;
    color: var(--pale-honey);
    text-transform: lowercase;
}

.colophon-rule {
    width: 300px;
    opacity: 0.5;
}

.colophon-rule svg {
    width: 100%;
    height: 8px;
}

.colophon-line {
    font-family: 'EB Garamond', serif;
    font-size: 15px;
    font-style: italic;
    color: var(--antique-gold);
    opacity: 0.7;
    max-width: 400px;
    text-align: center;
}

.colophon-year {
    font-family: 'Cinzel Decorative', serif;
    font-size: 12px;
    letter-spacing: 0.3em;
    color: var(--antique-gold);
    opacity: 0.4;
    margin-top: 8px;
}

/* ---- Specimen illustration ---- */
.specimen-illustration {
    width: 100%;
    max-width: 280px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* ---- Parallax on crystallography diagram ---- */
.crystal-diagram-wrapper {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .panel-inner {
        padding: 0 20px;
    }

    .panel-inner-annotated {
        padding: 0 20px;
    }

    .panel-inner-editorial {
        padding: 0 20px;
    }

    .folio-title {
        font-size: clamp(36px, 10vw, 56px);
    }

    .ornamental-divider {
        padding: 16px 20px;
    }
}

/* Prismatic accent tones used in bloom and facet effects */
.card-tag.prismatic {
    border-color: #4A8BB8;
    color: #4A8BB8;
}

.card-tag.amber {
    border-color: #E8B84B;
    color: #E8B84B;
}

/* Prismatic color palette reference — used in JS conic-gradient bloom */
/* Colors: #4A8BB8 (cool prismatic blue), #E8B84B (warm amber facet) */

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--antique-gold);
    border-radius: 3px;
}

/* ---- Selection ---- */
::selection {
    background: rgba(184, 146, 58, 0.3);
    color: var(--espresso);
}
