/* ================================================
   rinji.net - Skeuomorphic Leather Journal
   Palette: Burgundy-Cream | Typography: Commissioner-Versatile
   ================================================ */

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

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

body {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.75;
    color: #3D1F1F;
    background-color: #4A1C2B;
    overflow-x: hidden;
}

/* --- Leather Texture Generator (CSS-based) --- */
.leather-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.leather-dark {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(123, 45, 62, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(123, 45, 62, 0.2) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(42, 15, 22, 0.4) 0%, transparent 60%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(42, 15, 22, 0.08) 2px,
            rgba(42, 15, 22, 0.08) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 3px,
            rgba(74, 28, 43, 0.05) 3px,
            rgba(74, 28, 43, 0.05) 6px
        ),
        linear-gradient(135deg, #4A1C2B 0%, #3D1F1F 40%, #4A1C2B 70%, #2A0F16 100%);
}

.leather-cream {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(201, 168, 76, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(139, 94, 94, 0.04) 0%, transparent 40%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(61, 31, 31, 0.02) 3px,
            rgba(61, 31, 31, 0.02) 5px
        ),
        linear-gradient(170deg, #FAF6ED 0%, #F5ECD7 50%, #FAF6ED 100%);
}

/* --- Desk Surface (cream writing area with burgundy border) --- */
.desk-surface {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 60px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(201, 168, 76, 0.05) 0%, transparent 50%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(61, 31, 31, 0.015) 3px,
            rgba(61, 31, 31, 0.015) 5px
        ),
        linear-gradient(175deg, #FAF6ED 0%, #F5ECD7 100%);
    box-shadow:
        0 0 0 60px #4A1C2B,
        inset 0 2px 8px rgba(42, 15, 22, 0.1),
        4px 6px 24px rgba(42, 15, 22, 0.2);
}

@media (max-width: 768px) {
    .desk-surface {
        padding: 40px 24px;
        box-shadow:
            0 0 0 16px #4A1C2B,
            inset 0 2px 8px rgba(42, 15, 22, 0.1),
            4px 6px 24px rgba(42, 15, 22, 0.2);
    }
}

/* --- Bookmark Scroll-Progress Ribbon --- */
.bookmark-ribbon {
    position: fixed;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 20px;
    z-index: 100;
    pointer-events: none;
}

.bookmark-ribbon::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #7B2D3E, #4A1C2B);
    opacity: 0.6;
    border-radius: 2px;
}

.bookmark-marker {
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 32px;
    background: linear-gradient(135deg, #C9A84C, #A8873A);
    clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
    box-shadow: 2px 2px 6px rgba(42, 15, 22, 0.3);
    transition: top 0.1s ease-out;
}

@media (max-width: 768px) {
    .bookmark-ribbon {
        display: none;
    }
}

/* --- Navigation Tabs --- */
.nav-tabs {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 200;
}

.nav-tab-trigger {
    background: linear-gradient(145deg, #4A1C2B, #3D1F1F);
    color: #F5ECD7;
    padding: 10px 20px;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: 2px 4px 12px rgba(42, 15, 22, 0.3);
    border: 1px solid rgba(123, 45, 62, 0.4);
    border-bottom: none;
    transition: background 0.3s ease;
    user-select: none;
}

.nav-tab-trigger:hover {
    background: linear-gradient(145deg, #7B2D3E, #4A1C2B);
}

.nav-tab-list {
    list-style: none;
    background: linear-gradient(170deg, #4A1C2B, #2A0F16);
    border: 1px solid rgba(123, 45, 62, 0.4);
    border-radius: 0 0 4px 4px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    box-shadow: 4px 6px 16px rgba(42, 15, 22, 0.4);
}

.nav-tabs.open .nav-tab-list {
    max-height: 300px;
    opacity: 1;
}

.nav-tab-list li a {
    display: block;
    padding: 10px 20px;
    color: #F5ECD7;
    text-decoration: none;
    font-family: 'Lora', serif;
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease;
    border-bottom: 1px solid rgba(123, 45, 62, 0.2);
}

.nav-tab-list li:last-child a {
    border-bottom: none;
}

.nav-tab-list li a:hover {
    background: rgba(123, 45, 62, 0.3);
    color: #C9A84C;
}

/* --- Section Labels & Headings --- */
.section-label {
    display: block;
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8B5E5E;
    margin-bottom: 12px;
}

.section-heading {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 5.5vw, 4.2rem);
    letter-spacing: 0.02em;
    color: #3D1F1F;
    margin-bottom: 28px;
    transition: font-weight 0.4s ease;
    line-height: 1.15;
}

.section-heading:hover {
    font-weight: 500;
}

/* --- SPREAD 1: HERO --- */
.spread-hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.journal-page {
    position: relative;
    width: 70vw;
    max-width: 900px;
    height: 60vh;
    max-height: 600px;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(201, 168, 76, 0.04) 0%, transparent 60%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(61, 31, 31, 0.01) 2px,
            rgba(61, 31, 31, 0.01) 4px
        ),
        linear-gradient(175deg, #FAF6ED 0%, #F5ECD7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    box-shadow:
        8px 4px 20px rgba(42, 15, 22, 0.25),
        inset 0 0 30px rgba(61, 31, 31, 0.05),
        -2px 0 8px rgba(42, 15, 22, 0.1);
    border: 1px solid rgba(139, 94, 94, 0.15);
}

.page-curl {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(90deg, transparent, rgba(42, 15, 22, 0.06));
    pointer-events: none;
}

.page-curl::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #F5ECD7 45%, rgba(139, 94, 94, 0.15) 50%, rgba(42, 15, 22, 0.1));
}

.journal-content {
    text-align: center;
    padding: 40px;
}

.site-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 5.5rem);
    letter-spacing: 0.02em;
    color: #3D1F1F;
    opacity: 0;
    animation: fadeInTitle 1.5s ease-out 0.3s forwards;
}

@keyframes fadeInTitle {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tagline {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    color: #6B2D2D;
    opacity: 0.8;
    margin-top: 16px;
    opacity: 0;
    animation: fadeInTitle 1.5s ease-out 0.8s forwards;
}

.gold-wave-ornament {
    margin-top: 28px;
    opacity: 0;
    animation: fadeInTitle 1.5s ease-out 1.2s forwards;
}

.gold-wave-ornament svg {
    width: 140px;
    height: 24px;
    animation: waveFloat 3s ease-in-out infinite;
}

@keyframes waveFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.fleuron {
    position: absolute;
    color: #C9A84C;
    font-size: 1.4rem;
    opacity: 0.5;
}

.fleuron-top-left {
    top: 20px;
    left: 24px;
}

.fleuron-bottom-right {
    bottom: 20px;
    right: 24px;
}

@media (max-width: 768px) {
    .journal-page {
        width: 90vw;
        height: 65vh;
    }
    .journal-content {
        padding: 24px;
    }
}

/* --- WAVE DIVIDERS --- */
.wave-divider {
    position: relative;
    height: 60px;
    background: #4A1C2B;
    overflow: hidden;
}

.wave-divider svg {
    width: 100%;
    height: 100%;
    animation: waveDrift 8s ease-in-out infinite;
}

.wave-divider-2 svg {
    animation-delay: -2s;
    animation-duration: 10s;
}

.wave-divider-3 svg {
    animation-delay: -4s;
    animation-duration: 9s;
}

.wave-divider-4 svg {
    animation-delay: -1s;
    animation-duration: 11s;
}

@keyframes waveDrift {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-30px); }
}

/* --- SPREAD 2: INTRODUCTION --- */
.spread-intro {
    position: relative;
    background: #4A1C2B;
    padding: 80px 60px;
}

.spread-intro .desk-surface {
    display: grid;
    grid-template-columns: 8fr 3fr;
    gap: 40px;
    align-items: start;
}

.intro-text-block {
    transform: rotate(-0.5deg);
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(61, 31, 31, 0.012) 2px,
            rgba(61, 31, 31, 0.012) 4px
        ),
        linear-gradient(170deg, #FAF6ED, #F5ECD7);
    padding: 48px 40px;
    box-shadow: 4px 6px 16px rgba(42, 15, 22, 0.15);
    border: 2px dashed #8B5E5E;
    border-image: repeating-linear-gradient(
        0deg,
        #8B5E5E 0px,
        #8B5E5E 8px,
        transparent 8px,
        transparent 12px
    ) 2;
}

.intro-text-block p {
    margin-bottom: 18px;
    color: #3D1F1F;
}

.intro-text-block p:last-child {
    margin-bottom: 0;
}

.intro-text-block strong {
    font-weight: 600;
    color: #4A1C2B;
}

.intro-text-block em {
    font-style: italic;
    color: #6B2D2D;
}

.intro-decorative-card {
    transform: rotate(1deg);
    background: linear-gradient(160deg, #F5ECD7, #FAF6ED);
    padding: 40px 30px;
    box-shadow: 4px 6px 16px rgba(42, 15, 22, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    border: 1px solid rgba(139, 94, 94, 0.12);
}

.pressed-flower {
    width: 100%;
    max-width: 120px;
    height: auto;
}

@media (max-width: 768px) {
    .spread-intro {
        padding: 40px 16px;
    }
    .spread-intro .desk-surface {
        grid-template-columns: 1fr;
    }
    .intro-text-block {
        transform: none;
        padding: 30px 24px;
    }
    .intro-decorative-card {
        transform: none;
        min-height: 180px;
    }
}

/* --- SPREAD 3: CARD GALLERY --- */
.spread-gallery {
    position: relative;
    background: #4A1C2B;
    padding: 80px 60px;
}

.section-label-gallery {
    text-align: center;
    color: #8B5E5E;
}

.section-heading-gallery {
    text-align: center;
    margin-bottom: 60px;
}

.card-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    max-width: 1000px;
    margin: 0 auto;
}

/* Card flip mechanics */
.flip-card {
    perspective: 1200px;
    height: 320px;
    cursor: pointer;
}

.flip-card-1 { transform: rotate(-0.8deg); z-index: 2; }
.flip-card-2 { transform: rotate(0.5deg) translateY(-12px); z-index: 3; }
.flip-card-3 { transform: rotate(-0.3deg); z-index: 1; }
.flip-card-4 { transform: rotate(1deg); z-index: 2; grid-column: 1 / 2; }
.flip-card-5 { transform: rotate(-0.6deg) translateY(8px); z-index: 1; grid-column: 2 / 4; }

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.flip-card:hover .flip-card-inner,
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 4px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Front: leather textured */
.flip-card-front {
    background:
        radial-gradient(ellipse at 40% 30%, rgba(123, 45, 62, 0.15) 0%, transparent 50%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(42, 15, 22, 0.06) 2px,
            rgba(42, 15, 22, 0.06) 4px
        ),
        linear-gradient(155deg, #4A1C2B, #3D1F1F 60%, #4A1C2B);
    box-shadow:
        4px 6px 16px rgba(42, 15, 22, 0.25),
        inset 0 1px 0 rgba(123, 45, 62, 0.3);
    border: 2px dashed rgba(139, 94, 94, 0.25);
    transition: box-shadow 0.6s ease;
}

.flip-card:hover .flip-card-front {
    box-shadow:
        2px 3px 8px rgba(42, 15, 22, 0.15),
        inset 0 1px 0 rgba(123, 45, 62, 0.3);
}

.card-stitching {
    position: absolute;
    inset: 8px;
    border: 2px dashed rgba(139, 94, 94, 0.3);
    border-radius: 2px;
    pointer-events: none;
}

.card-embossed-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    letter-spacing: 0.04em;
    color: #F5ECD7;
    text-shadow:
        1px 1px 2px rgba(42, 15, 22, 0.4),
        0 0 1px rgba(245, 236, 215, 0.2);
    text-align: center;
}

.card-gold-motif {
    margin-top: 16px;
    color: #C9A84C;
    font-size: 1.4rem;
    opacity: 0.7;
}

/* Back: cream paper */
.flip-card-back {
    transform: rotateY(180deg);
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(61, 31, 31, 0.012) 2px,
            rgba(61, 31, 31, 0.012) 4px
        ),
        linear-gradient(170deg, #FAF6ED, #F5ECD7);
    box-shadow:
        4px 6px 16px rgba(42, 15, 22, 0.2),
        inset 0 0 20px rgba(61, 31, 31, 0.03);
    text-align: center;
}

.flip-card-back p {
    font-family: 'Lora', serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #3D1F1F;
}

.flip-card-back em {
    color: #6B2D2D;
    font-style: italic;
}

@media (max-width: 900px) {
    .card-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
    .flip-card-4 { grid-column: auto; }
    .flip-card-5 { grid-column: auto; }
}

@media (max-width: 600px) {
    .spread-gallery {
        padding: 40px 16px;
    }
    .card-gallery {
        grid-template-columns: 1fr;
    }
    .flip-card {
        height: 280px;
    }
    .flip-card-1, .flip-card-2, .flip-card-3, .flip-card-4, .flip-card-5 {
        transform: none;
    }
}

/* --- SPREAD 4: FEATURE --- */
.spread-feature {
    position: relative;
    background: #4A1C2B;
    padding: 0 60px 80px;
    overflow: hidden;
}

.feature-wave-top {
    height: 80px;
    margin-bottom: 0;
}

.feature-wave-top svg {
    width: 100%;
    height: 100%;
    animation: waveDrift 12s ease-in-out infinite;
}

.feature-layout {
    display: grid;
    grid-template-columns: 4fr 7fr;
    gap: 60px;
    align-items: start;
}

.feature-quote {
    transform: rotate(-1deg);
    padding: 20px 0;
}

.feature-quote blockquote p {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    color: #6B2D2D;
    opacity: 0.8;
    line-height: 1.5;
}

.feature-quote cite {
    display: block;
    margin-top: 16px;
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    color: #8B5E5E;
    font-style: normal;
}

.feature-content p {
    margin-bottom: 18px;
    color: #3D1F1F;
}

.feature-content p:last-child {
    margin-bottom: 0;
}

.bg-flower {
    position: absolute;
    pointer-events: none;
    z-index: 0;
}

.bg-flower-1 {
    top: 25%;
    right: 8%;
    width: 80px;
    opacity: 0.6;
}

.bg-flower-2 {
    bottom: 15%;
    left: 5%;
    width: 60px;
    opacity: 0.5;
}

@media (max-width: 768px) {
    .spread-feature {
        padding: 0 16px 40px;
    }
    .feature-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .feature-quote {
        transform: none;
    }
}

/* --- SPREAD 5: CLOSING --- */
.spread-closing {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.closing-leather {
    z-index: 0;
}

.closing-surface {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 60px 40px;
}

.closing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.wax-seal {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #7B2D3E, #4A1C2B 70%, #2A0F16);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 12px rgba(42, 15, 22, 0.4),
        inset 0 2px 4px rgba(245, 236, 215, 0.1),
        inset 0 -2px 4px rgba(42, 15, 22, 0.3);
    position: relative;
}

.wax-seal::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 1.5px solid rgba(201, 168, 76, 0.3);
}

.wax-seal-inner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.wax-seal-letter {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 2rem;
    color: #F5ECD7;
    text-shadow: 1px 1px 2px rgba(42, 15, 22, 0.5);
    opacity: 0.85;
}

.closing-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: #F5ECD7;
    opacity: 0.85;
}

.closing-gold-line svg {
    width: 120px;
    opacity: 0.6;
}

.closing-domain {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8B5E5E;
}

/* --- REVEAL ANIMATIONS --- */
[data-reveal] {
    opacity: 0;
    transform: scale(0.95) translateY(16px);
    transition:
        opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition-delay: var(--delay, 0s);
}

[data-reveal].revealed {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Card stagger */
.flip-card[data-reveal] {
    transition-delay: calc(var(--i, 0) * 0.15s);
}

/* Wave divider reveal */
.wave-divider[data-reveal] {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.wave-divider[data-reveal].revealed {
    opacity: 1;
    transform: none;
}

/* --- Spread backgrounds --- */
.spread {
    position: relative;
}

.spread-intro,
.spread-gallery,
.spread-feature {
    background: #4A1C2B;
}

/* --- Selection styling --- */
::selection {
    background: rgba(123, 45, 62, 0.3);
    color: #3D1F1F;
}

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

::-webkit-scrollbar-track {
    background: #2A0F16;
}

::-webkit-scrollbar-thumb {
    background: #7B2D3E;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8B5E5E;
}
