/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #16213E 0%, #0F3D3E 50%, #2C2824 100%);
    color: #F0E8DA;
    line-height: 1.6;
    overflow-x: hidden;
    --color-primary: #D4A960;
    --color-secondary: #C9A8A0;
    --color-dark-1: #16213E;
    --color-dark-2: #0F3D3E;
    --color-dark-3: #1A1A2E;
    --color-dark-4: #2C2824;
    --color-dark-5: #3A3630;
    --color-dark-6: #4A3068;
    --color-gray: #6B6E8D;
    --color-accent: #2A6B5E;
    --color-light: #F0E8DA;
}

/* Entry Threshold Section */
.entry-threshold {
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #1A1A2E 0%, #0F3D3E 100%);
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(212, 169, 96, 0.1);
}

.entry-threshold::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    background:
        radial-gradient(circle at 20% 50%, rgba(212, 169, 96, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(201, 168, 160, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 0%, rgba(74, 48, 104, 0.03) 0%, transparent 60%);
    animation: breathe 8s ease-in-out infinite;
    z-index: 0;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.entry-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
    padding: 2rem;
    animation: fadeInDown 1.2s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.entry-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 8vw, 7rem);
    font-weight: 700;
    color: #D4A960;
    letter-spacing: 0.15em;
    line-height: 1.0;
    margin-bottom: 1rem;
    text-shadow: 0 4px 20px rgba(212, 169, 96, 0.2);
}

.entry-subtitle {
    font-family: 'Lora', serif;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: #C9A8A0;
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-bottom: 2rem;
}

.entry-divider {
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #D4A960, transparent);
    margin: 2rem auto;
    animation: expandWidth 1.2s ease-out 0.3s both;
}

@keyframes expandWidth {
    from { width: 0; }
    to { width: 80px; }
}

.entry-description {
    font-family: 'Lora', serif;
    font-size: clamp(0.95rem, 1.5vw, 1.2rem);
    color: #F0E8DA;
    font-weight: 400;
    line-height: 1.8;
    opacity: 0.9;
}

/* Masonry Container */
.masonry-container {
    padding: 60px 40px;
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    grid-auto-rows: auto;
    background: linear-gradient(180deg, rgba(106, 110, 141, 0.1) 0%, rgba(26, 26, 46, 0.2) 50%, rgba(44, 40, 36, 0.1) 100%);
}

@media (min-width: 768px) {
    .masonry-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 50px;
    }
}

@media (min-width: 1200px) {
    .masonry-container {
        grid-template-columns: 1.2fr 1fr 0.8fr;
        gap: 60px;
    }
}

/* Masonry Shard (Card) */
.masonry-shard {
    background: linear-gradient(135deg, rgba(58, 54, 48, 0.6) 0%, rgba(42, 107, 94, 0.3) 100%);
    border: 1px solid rgba(212, 169, 96, 0.2);
    border-radius: 12px;
    padding: 40px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    animation: slideInUp 0.8s ease-out backwards;
    box-shadow: inset 0 0 30px rgba(212, 169, 96, 0.05);
}

.shard-1 { animation-delay: 0.1s; }
.shard-2 { animation-delay: 0.2s; }
.shard-3 { animation-delay: 0.15s; }
.shard-4 { animation-delay: 0.25s; }
.shard-5 { animation-delay: 0.2s; }
.shard-6 { animation-delay: 0.3s; }
.shard-7 { animation-delay: 0.25s; }
.shard-8 { animation-delay: 0.35s; }
.shard-9 { animation-delay: 0.3s; }

.shard-2,
.shard-4,
.shard-6,
.shard-8 {
    border-left: 3px solid rgba(42, 107, 94, 0.3);
}

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

/* Wabi-sabi clip-path irregularity */
.masonry-shard:nth-child(1) { clip-path: polygon(0 2%, 100% 0, 100% 95%, 0 100%); }
.masonry-shard:nth-child(2) { clip-path: polygon(2% 0, 100% 1%, 98% 100%, 0 99%); }
.masonry-shard:nth-child(3) { clip-path: polygon(0 0, 99% 3%, 100% 98%, 1% 100%); }
.masonry-shard:nth-child(4) { clip-path: polygon(1% 0, 100% 2%, 99% 100%, 0 97%); }
.masonry-shard:nth-child(5) { clip-path: polygon(0 1%, 98% 0, 100% 99%, 2% 100%); }
.masonry-shard:nth-child(6) { clip-path: polygon(2% 1%, 100% 0, 98% 99%, 0 100%); }
.masonry-shard:nth-child(7) { clip-path: polygon(0 3%, 99% 0, 100% 97%, 1% 100%); }
.masonry-shard:nth-child(8) { clip-path: polygon(1% 2%, 100% 1%, 99% 100%, 0 99%); }
.masonry-shard:nth-child(9) { clip-path: polygon(0 0, 100% 2%, 100% 100%, 1% 98%); }

.masonry-shard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, rgba(212, 169, 96, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.masonry-shard:hover {
    border-color: rgba(212, 169, 96, 0.5);
    background: linear-gradient(135deg, rgba(106, 110, 141, 0.5) 0%, rgba(42, 107, 94, 0.4) 100%);
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(212, 169, 96, 0.2), inset 0 0 40px rgba(212, 169, 96, 0.1);
    border-color: #2A6B5E;
}

.shard-content {
    position: relative;
    z-index: 1;
}

/* Shard Icon */
.shard-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.9;
    transition: all 0.5s ease-out;
    filter: drop-shadow(0 4px 8px rgba(212, 169, 96, 0.2));
    color: #D4A960;
}

.masonry-shard:hover .shard-icon {
    width: 100px;
    height: 100px;
    opacity: 1;
    filter: drop-shadow(0 8px 16px rgba(212, 169, 96, 0.4));
}

/* Shard Title */
.shard-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-weight: 700;
    color: #D4A960;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    line-height: 1.2;
}

/* Shard Text */
.shard-text {
    font-family: 'Lora', serif;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: #E8D9CC;
    font-weight: 400;
    line-height: 1.7;
    opacity: 0.85;
}

/* Kintsugi Seams (Animated Connectors) */
.masonry-shard::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    width: 2px;
    height: 40px;
    background: linear-gradient(180deg, #D4A960 0%, rgba(212, 169, 96, 0) 100%);
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.masonry-shard:hover::after {
    opacity: 1;
    animation: seamFlow 2s ease-in-out infinite;
}

@keyframes seamFlow {
    0%, 100% { height: 40px; opacity: 0.3; }
    50% { height: 60px; opacity: 0.7; }
}

/* Closing Vessel Section */
.closing-vessel {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(42, 107, 94, 0.3) 0%, #0F3D3E 50%, #4A3068 100%);
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
    border-top: 1px solid rgba(212, 169, 96, 0.1);
}

.closing-vessel::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 30% 20%, rgba(212, 169, 96, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 70% 80%, rgba(201, 168, 160, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 10% 90%, rgba(74, 48, 104, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 90% 10%, rgba(42, 107, 94, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.closing-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    text-align: center;
    animation: fadeIn 1.2s ease-out;
}

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

.closing-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    font-weight: 700;
    color: #D4A960;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.closing-text {
    font-family: 'Lora', serif;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: #F0E8DA;
    font-weight: 400;
    line-height: 1.8;
    opacity: 0.9;
    margin-bottom: 2.5rem;
}

.closing-kintsugi-line {
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #D4A960 20%, #D4A960 80%, transparent);
    margin: 0 auto;
    animation: pulseWidth 3s ease-in-out infinite;
}

@keyframes pulseWidth {
    0%, 100% { width: 120px; }
    50% { width: 150px; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .masonry-container {
        grid-template-columns: 1fr;
        padding: 30px 20px;
        gap: 30px;
    }

    .entry-threshold {
        padding: 2rem 1rem;
    }

    .closing-vessel {
        padding: 40px 20px;
    }

    .masonry-shard {
        padding: 30px;
        min-height: 250px;
    }
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #0a0a1a 0%, #0F3D3E 50%, #1a1510 100%);
    }
}

/* Smooth scrolling performance */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
