/* style.css - v3.3.0 Cleaned & Polished */

/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --wood-dark: #1a120b;
    --parchment: #faf3d6; 
    --ink: #2b1d0e;
    --gold: #d4af37;
    
    /* Spine Colors */
    --spine-forge: #3e2723;
    --spine-market: #1b3a28;
    --spine-guild: #1c2331;
    --spine-chronicles: #2a2a2a;
    --spine-cargo: linear-gradient(135deg, #d97706, #b45309);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* =========================================
   2. CORE LAYOUT
   ========================================= */
body {
    background-color: var(--wood-dark);
    color: var(--ink);
    font-family: 'Cormorant Garamond', serif;
    margin: 0; padding: 0;
    height: 100dvh;
    display: flex; 
    flex-direction: column;
    overflow: hidden; 
    overscroll-behavior: none; 
}

/* Static Background Layer */
body::before {
    content: "";
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; 
    background-image: 
        linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.1)),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 1px, transparent 1px, transparent 40px);
    will-change: transform; 
    pointer-events: none;
}

/* Scrollbar Hiding */
#library-view::-webkit-scrollbar, 
.page-content::-webkit-scrollbar, 
body::-webkit-scrollbar,
.desk-layout::-webkit-scrollbar { display: none; }
#library-view, .page-content, body, .desk-layout { scrollbar-width: none; }

/* Reading Mode Override */
body.reading-mode {
    background-color: var(--parchment);
    background-image: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.1'/%3E%3C/svg%3E"),
        radial-gradient(circle at 92% 8%, transparent 55%, rgba(139, 69, 19, 0.15) 58%, rgba(139, 69, 19, 0.25) 60%, transparent 63%);
    background-blend-mode: multiply;
}

/* =========================================
   3. TYPOGRAPHY & UI ELEMENTS
   ========================================= */
.page-title { font-family: 'Cinzel', serif; color: var(--ink); border-bottom: 3px solid var(--ink); padding-bottom: 15px; margin-top: 0; font-size: 1.8rem; }
.log-date { font-family: 'Cinzel', serif; color: #800000; font-weight: bold; font-size: 0.85rem; letter-spacing: 1px; text-transform:uppercase; margin-bottom:5px; }
.log-title { font-family: 'Cinzel', serif; font-weight: bold; font-size: 1.3rem; margin: 0 0 10px 0; border-bottom:1px solid #eee; padding-bottom:5px; color:#111; }
.log-body { font-size: 1.1rem; line-height: 1.5; color: #444; }

.ink-input { width: 100%; background: transparent; border: none; border-bottom: 2px solid var(--ink); padding: 10px 0; font-family: 'Cormorant Garamond', serif; font-size: 1.3rem; color: var(--ink); margin-bottom: 20px; }
.ink-input:focus { outline: none; border-color: var(--gold); }

.seal-btn { display: block; width: 100%; padding: 15px; background: #800000; color: var(--parchment); border: none; font-family: 'Cinzel', serif; font-size: 1.1rem; cursor: pointer; border-radius: 2px; transition: background 0.2s; }
.seal-btn:hover { background: #5a0000; }

.read-more-link {
    display: inline-block; margin-top: 15px; padding-top: 10px; border-top: 1px dashed #ccc; width: 100%; text-align: right;
    font-family: 'Cinzel', serif; font-weight: 800; font-size: 0.85rem; color: #8b0000; text-transform: uppercase; letter-spacing: 1px; text-decoration: none; cursor: pointer; transition: all 0.2s ease;
}
.read-more-link:hover { color: #d4af37; transform: translateX(-5px); }

/* Chips & Meta */
.card-section { text-align: left; margin-top: 12px; }
.card-section-title { font-family: 'Cinzel', serif; font-size: 0.75rem; text-transform: uppercase; color: #8b0000; border-bottom: 1px solid #ddd; margin-bottom: 5px; }
.card-bullets { margin: 0; padding-left: 15px; font-size: 0.85rem; color: #444; }
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.chip { background: #eee; border: 1px solid #ccc; border-radius: 4px; padding: 2px 6px; font-family: 'Share Tech Mono', monospace; font-size: 0.7rem; }

/* =========================================
   4. LAYOUT STRUCTURES
   ========================================= */
#library-view { 
    flex: 1; overflow-y: auto; padding: 70px 20px 40px 20px; 
    display: flex; flex-direction: column; align-items: center; 
    width: 100%; max-width: 1000px; margin: 0 auto;
    will-change: transform; 
}
.desk-layout { display: flex; flex-direction: column; width: 100%; gap: 40px; }

/* Desk Items */
.desk-note { background: #fff; width: 100%; max-width: 400px; padding: 25px; box-shadow: 0 5px 15px rgba(0,0,0,0.4); transform: rotate(-1deg); position: relative; color: #333; margin-bottom: 20px; }
.desk-note::after { content: ''; position: absolute; top: -12px; left: 50%; width: 14px; height: 14px; background: #c00; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.note-hand { font-family: 'Homemade Apple', cursive; font-size: 1.1rem; line-height: 1.5; }
.note-header { font-family: 'Cinzel', serif; font-weight: bold; font-size: 1.3rem; border-bottom: 2px solid #333; margin-bottom: 15px; }

.paper-scrap { background: #e8dcc5; padding: 15px; width: 100%; max-width: 400px; box-shadow: 0 2px 5px rgba(0,0,0,0.3); margin-top: 10px; border-left: 4px solid var(--gold); }
.scrap-title { font-family: 'Cinzel', serif; font-weight: bold; font-size: 0.9rem; color: var(--ink); margin-bottom: 5px; }
.scrap-text { font-size: 0.9rem; color: #4a3b2a; }

/* Bookshelf */
.shelf { display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 450px; }
.book-spine { padding: 30px 20px; border-radius: 4px 12px 12px 4px; color: var(--gold); text-align: center; box-shadow: inset 10px 0 20px rgba(0,0,0,0.5), 0 5px 15px rgba(0,0,0,0.5); cursor: pointer; transition: transform 0.2s; border-left: 5px solid rgba(255,255,255,0.1); position: relative; }
.book-spine:active { transform: scale(0.98); }
.spine-forge { background-color: var(--spine-forge); border: 1px solid #4a3b2a; } 
.spine-market { background: var(--spine-market); } 
.spine-guild { background: var(--spine-guild); } 
.spine-chronicles { background: var(--spine-chronicles); }
.spine-cargo { background: var(--spine-cargo); border-left: 15px solid #92400e; color: #fff; }
.spine-title { font-family: 'Cinzel', serif; font-size: 1.4rem; text-transform: uppercase; letter-spacing: 1px; text-shadow: 0 2px 4px rgba(0,0,0,0.8); }
.spine-subtitle { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; color: rgba(255,255,255,0.9); font-style: italic; }

#book-view { display: none; flex: 1; position: relative; background: var(--parchment); margin: 0; box-shadow: none; border-radius: 0; overflow: hidden; }
#book-view.open { display: flex; flex-direction: column; }
.page-content { flex: 1; overflow-y: auto; padding: 70px 20px 90px 20px; max-width: 100%; width: 100%; }

/* =========================================
   5. OVERLAYS & STATUS
   ========================================= */
.status-bar { position: fixed; top: 0; left: 0; width: 100%; padding: 10px 20px; z-index: 1000; display: flex; justify-content: flex-end; gap: 15px; align-items: center; background: linear-gradient(to bottom, rgba(43, 29, 14, 0.9), transparent); pointer-events: none; height: 60px; }
.status-bar > * { pointer-events: auto; }
.status-logo { height: 32px; width: auto; margin-right: 10px; cursor: pointer; }
.os-clock { color: var(--gold); font-family: 'Cinzel', serif; font-size: 0.9rem; text-shadow: 0 1px 2px rgba(0,0,0,0.5); font-weight: bold; }
.icon-btn { background: rgba(43, 29, 14, 0.3); border: 1px solid var(--gold); color: var(--gold); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1rem; transition: 0.2s; text-decoration: none; }
.icon-btn.active { background: var(--gold); color: #2b1d0e; box-shadow: 0 0 10px var(--gold); }

.app-layer { padding: 0; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--parchment); z-index: 5000; display: none; flex-direction: column; overflow-y: auto; }
.app-layer.active { display: flex; }
iframe { width: 100%; height: 100%; border: none; flex: 1; }
.app-vignette { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5001; background: radial-gradient(circle at center, transparent 85%, var(--wood-dark) 100%); box-shadow: inset 0 0 40px 20px var(--wood-dark); }

.journal-reader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(2px); z-index: 5000; display: none; overflow-y: auto; }
.journal-reader.active { display: block; }
.journal-content { background: #fff; width: 90%; max-width: 600px; margin: 80px auto 40px auto; padding: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); position: relative; transform: rotate(-1deg); border-radius: 2px; color: #333; line-height: 1.6; font-size: 1.1rem; }
.journal-content::after { content: ''; position: absolute; top: -12px; left: 50%; width: 14px; height: 14px; background: #c00; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.3); transform: translateX(-50%); }
.journal-close-btn { position: fixed; top: 20px; right: 20px; background: var(--ink); color: var(--parchment); border: none; padding: 10px 20px; font-family: 'Cinzel', serif; cursor: pointer; z-index: 5001; }
.journal-featured-img { width: 100%; height: 150px; object-fit: cover; background-color: #222; border: 2px solid var(--ink); border-radius: 4px; margin-bottom: 15px; display: block; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 6000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal-overlay.active { display: flex; }
.info-card { background: #fff; width: 90%; max-width: 350px; padding: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); border: 1px solid #aaa; position: relative; transform: rotate(-1deg); text-align: center; }
.info-card::after { content: ''; position: absolute; top: -12px; left: 50%; width: 14px; height: 14px; background: #c00; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }
.info-btn { display: block; width: 100%; padding: 10px; margin-top: 10px; font-family: 'Cinzel', serif; font-weight: bold; cursor: pointer; border: 2px solid var(--ink); background: transparent; color: var(--ink); }
.btn-home { background: var(--ink); color: #fff; border-color: var(--ink); }
.palantir-btn { position: fixed; left: 20px; bottom: 20px; width: 50px; height: 50px; background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8), rgba(80, 20, 180, 0.8), rgba(0,0,0,0.9)); border-radius: 50%; box-shadow: 0 0 15px rgba(80, 20, 180, 0.6); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 2000; border: 2px solid #4a3b2a; }

/* =========================================
   6. CARD SYSTEMS & GRID CONTENT
   ========================================= */

/* Generic Item Card */
.item-card {
    background: #fff; 
    width: 100%; 
    padding: 15px; /* REDUCED PADDING (Was 20px) - Tighter Frame */
    box-shadow: 0 3px 10px rgba(0,0,0,0.15); 
    margin-bottom: 35px; 
    position: relative; 
    color: #333; 
    border: 1px solid rgba(0,0,0,0.1);
    transform: translate3d(0,0,0) rotate(-0.5deg); /* GPU Fix */
    backface-visibility: hidden; 
    will-change: transform; 
    transition: transform 0.3s ease; 
    overflow: visible !important; /* ALLOW PINS */
}
.item-card:nth-of-type(even) { transform: translate3d(0,0,0) rotate(0.5deg); }
.item-card:hover { transform: translate3d(0, -5px, 0) rotate(0deg) scale(1.01); z-index: 5; box-shadow: 0 8px 25px rgba(0,0,0,0.25); }

/* Forge Items */
.forge-item { 
    padding: 0; background: #fdfbf7; border: 1px solid #3e2723; 
    box-shadow: 3px 3px 6px rgba(0,0,0,0.15); margin-bottom: 20px; 
    border-radius: 8px; width: 100%; overflow: visible !important; 
}

/* RED PIN SYSTEM */
.forge-item::after, .item-card::after, .flip-container::after { 
    content: ''; position: absolute; top: -12px; left: 50%; 
    width: 14px; height: 14px; background: #c00; 
    border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.3); 
    transform: translateX(-50%); z-index: 25; pointer-events: none;
}

/* --- IMAGE SYSTEM (INSET & FULLY VISIBLE) --- */
/* This is the final agreed upon style */
.forge-header-img, 
.forge-img-container img, 
.item-card img {
    /* 1. SIZE & SPACING */
    width: calc(100% - 30px) !important; /* Leave 15px gap on sides */
    height: auto !important;             /* Grow naturally (No Crop) */
    margin: 15px auto 0 auto !important; /* Top gap + Center */

    /* 2. VISUALS */
    object-fit: contain !important; 
    border-radius: 4px !important; 
    border: 1px solid rgba(43, 29, 14, 0.1) !important; 
    background: transparent !important; 
    padding: 0 !important;
    display: block; 
}

/* Keep the Emoji/Icon placeholders as fixed banners */
.forge-img-container {
    width: 100% !important;
    height: 160px !important;
    background: var(--wood-dark) !important;
    border-radius: 8px 8px 0 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important; /* Icons stay full width */
}

.forge-img-emoji { font-size: 4rem; line-height: 1; text-align: center; display: block; }

/* Text & Buttons */
.card-inner { padding: 15px; flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.forge-title { font-family: 'Cinzel', serif; font-size: 1.2rem; margin: 0 0 5px 0; letter-spacing: 1px; color: var(--ink); flex-shrink: 0; }
.forge-desc { font-size: 0.95rem; color: #555; display: block; overflow: visible; white-space: normal; margin-bottom: 15px; flex-shrink: 0; }
.forge-btn { width: 100%; padding: 10px; background: transparent; border: 1px solid var(--ink); font-family: 'Cinzel', serif; font-weight: bold; cursor: pointer; transition: all 0.2s; margin-top: auto; flex-shrink: 0; z-index: 10; }
.forge-btn:active { background: var(--ink); color: var(--parchment); }

/* Badges & Filters */
.meta-row { display: flex; gap: 10px; margin-bottom: 15px; flex-shrink: 0; }
.badge { font-family: 'Share Tech Mono', monospace; font-size: 0.8rem; padding: 2px 6px; border: 1px solid #333; border-radius: 4px; text-transform: uppercase; }
.badge-ver { background: #eee; color: #333; }
.badge-live { background: #e8f5e9; color: #2e7d32; border-color: #2e7d32; }
.badge-beta { background: #fffde7; color: #fbc02d; border-color: #fbc02d; }
.badge-alpha { background: #f3e5f5; color: #7b1fa2; border-color: #7b1fa2; }
.forge-search { width: 100%; padding: 12px; background: rgba(255,255,255,0.4); border: 2px solid var(--ink); font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; color: var(--ink); border-radius: 4px; margin-bottom: 15px; }
.forge-filters { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; }
.filter-pill { flex: 0 0 auto; padding: 6px 16px; border: 1px solid var(--ink); border-radius: 20px; background: transparent; font-family: 'Cinzel', serif; font-size: 0.8rem; color: var(--ink); cursor: pointer; }
.filter-pill.active { background: var(--ink); color: var(--parchment); }

/* =========================================
   7. 3D FLIP ENGINE
   ========================================= */
.flip-container { perspective: 1000px; position: relative; width: 100%; }
.flipper { transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1); transform-style: preserve-3d; position: relative; width: 100%; height: auto; min-height: 380px; }
.flip-container.flipped .flipper { transform: rotateY(180deg); }

.front { position: relative; width: 100%; height: auto; min-height: 380px; background: #fdfbf7; border-radius: 8px; border: 1px solid #3e2723; overflow: visible; display: flex; flex-direction: column; z-index: 2; transform: rotateY(0deg); backface-visibility: hidden; }
.back { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--parchment); border-radius: 8px; border: 2px solid var(--gold); padding: 20px; text-align: center; justify-content: center; display: flex; flex-direction: column; transform: rotateY(180deg); backface-visibility: hidden; }

/* Corner Buttons */
.flip-btn, .project-btn { position: absolute; top: 10px; width: 32px; height: 32px; background: rgba(0,0,0,0.6); border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; transition: all 0.2s; font-size: 1.1rem; }
.flip-btn { right: 10px; } 
.project-btn { left: 10px; }
.flip-btn:hover, .project-btn:hover { background: var(--gold); color: var(--wood-dark); }

/* =========================================
   8. PAGE SPECIFIC (ROOKERY & CHRONICLES)
   ========================================= */
/* Rookery Grid */
.streak-grid-container { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 20px 0; max-width: 100%; }
.streak-cell {
    aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.4); border: 1px dashed var(--ink); border-radius: 2px;
    font-family: 'Share Tech Mono', monospace; font-size: 1rem; color: #666; cursor: pointer; transition: all 0.2s;
}
.streak-cell:hover { border-style: solid; background: #fff; transform: scale(1.1); z-index: 2; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.streak-cell.active { background: var(--ink); color: var(--parchment); border-color: var(--gold); border-style: solid; transform: rotate(-3deg); box-shadow: 2px 2px 4px rgba(0,0,0,0.3); }

/* Chronicle Media */
.log-body img, .entry-content img, .entry-featured-img {
    max-width: 90% !important; height: auto !important;
    display: block !important; margin: 20px auto !important;
    border: 1px solid #ccc; padding: 6px; background: #fff; box-shadow: 1px 2px 8px rgba(0,0,0,0.15); transform: rotate(-1deg);
}
.entry-content iframe, .log-body iframe { width: 100% !important; max-width: 100% !important; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.entry-image-container { width: 100%; text-align: center; margin: 20px 0; }

/* =========================================
   9. NAVIGATION & ATMOSPHERE
   ========================================= */
/* BOOKMARK RESTORATION FIX: Z-Index 20000+ to beat the overlays */
.bookmark-container {
    position: fixed; right: 0; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; align-items: flex-end; 
    z-index: 2147483647; /* MAX Z-INDEX: Forces it to front */
    touch-action: none; width: 70px;
    pointer-events: auto !important; /* Forces clickability */
}
.bookmark {
    width: 50px; height: 45px; margin-bottom: 4px; border-radius: 6px 0 0 6px; 
    display: flex; align-items: center; justify-content: center; cursor: pointer; 
    box-shadow: -2px 1px 4px rgba(0,0,0,0.4); transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; right: 0;
}
.bookmark:active, .bookmark.active { width: 65px; transform: translateX(-5px); background: var(--gold) !important; }

/* Colors */
.bm-home { background: #5d4037; } .bm-forge { background: #8b0000; } .bm-market { background: #1b5e20; }
.bm-chronicles { background: #1a237e; } .bm-guild { background: #4a148c; } .bm-ravens { background: #212121; }
.bm-cargo { background-color: #d97706; color: #fff; border-left: 4px solid #b45309; }
.bm-cargo.active { background-color: #b45309; box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }

.bookmark-icon { width: 32px; height: 32px; pointer-events: none; }
.bookmark-icon img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.5)); }

#ember-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9000; pointer-events: none; opacity: 1.0; } /* MAX GLOW */
.update-overlay { position: fixed; inset: 0; background: #1a120b; z-index: 20000; display: flex; align-items: center; justify-content: center; color: var(--gold); text-align: center; }
.update-card { border: 2px solid var(--gold); padding: 40px; background: rgba(0,0,0,0.8); box-shadow: 0 0 30px rgba(212, 175, 55, 0.3); transform: rotate(-1deg); }
.progress-container { width: 200px; height: 6px; background: #333; margin: 20px auto; border-radius: 3px; overflow: hidden; }
.update-progress-fill { height: 100%; background: var(--gold); width: 100%; box-shadow: 0 0 15px var(--gold); animation: pulse 2s infinite ease-in-out; }
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; } 100% { opacity: 0.6; } }

/* =========================================
   10. MEDIA QUERIES (DESKTOP)
   ========================================= */

@media (min-width: 768px) {
    
    /* 1. FORCE FRONT PAGE DUAL-COLUMN */
    .desk-layout {
        flex-direction: row; /* Puts Left (Notes) and Right (Books) side-by-side */
        justify-content: center;
        gap: 60px;
        align-items: flex-start;
    }
    
    /* Ensure the columns share width */
    .desk-left, .desk-right {
        flex: 1;
        width: 50%;
        max-width: 500px;
    }

    /* 2. FORCE GRID FOR LISTS (When Visible) */
    div[id$="List"]:not([style*="none"]) {
        display: grid !important; 
        width: 100%;
        max-width: 1200px; 
        margin: 0 auto;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important; 
        gap: 30px;
        flex-direction: row !important;
        align-items: start !important;
    }

    /* 3. FORCE CARDS TO FIT THE GRID */
    .forge-item, .flip-container, .item-card, .project-card,
    .log-body, .entry-content, div[class*="log"], div[class*="entry"] {
        width: 100% !important; max-width: none !important;
    }

    /* 4. Desktop Hover */
    .item-card:hover, .project-card:hover, .forge-item:hover {
        transform: translateY(-8px); 
        box-shadow: 0 12px 20px rgba(0,0,0,0.4), 0 0 15px rgba(255, 215, 0, 0.3);
        border-color: #d4af37; z-index: 10;
    }
}

/* =========================================
   11. MASONRY LAYOUT (The "Float Up" Fix)
   ========================================= */
@media (min-width: 900px) {
    /* INCREASED SPECIFICITY: Targets ID to override the Grid system */
    div[id$="List"].masonry-mode,
    .gallery-grid.masonry-mode {
        display: block !important; /* Disables Grid */
        column-count: 3;           /* 3 Columns */
        column-gap: 30px;
    }

    /* Prevent cards from being chopped in half */
    div[id$="List"].masonry-mode .item-card,
    .gallery-grid.masonry-mode .item-card {
        display: inline-block;     /* Essential for column flow */
        width: 100%;
        margin-bottom: 30px;       /* Space below each card */
        break-inside: avoid;       
        page-break-inside: avoid;
        transform: translateZ(0);  /* Graphic Glitch Fix */
    }
}

/* Mobile Landscape Dashboard */
@media (orientation: landscape) and (max-height: 500px) {
    .desk-layout { flex-direction: row; align-items: flex-start; padding-top: 70px; gap: 20px; width: 100%; height: 100%; overflow-y: auto; padding-bottom: 80px; }
    .desk-left, .desk-right { flex: 1; width: 50%; max-width: none; margin: 0; }
    .desk-note, .shelf { width: 100%; max-width: none !important; transform: none; }
    .flipper { min-height: 0 !important; }
    .front { position: relative !important; height: auto !important; flex: 1; }
    .back { position: absolute !important; top: 0; left: 0; width: 100%; height: 100%; }
    .forge-header-img, .forge-img-container { height: 85px; min-height: 85px; }
    .card-inner { padding: 10px; }
    .palantir-btn { display: flex !important; transform: scale(0.8); left: 10px; bottom: 10px; }
    .bookmark-icon { width: 26px; height: 26px; }
}

/* =========================================
   12. BUTTON POLISH
   ========================================= */
/* Specific styling for Card Action Buttons (View Gear, Seal, etc) */
.forge-btn, 
.seal-btn {
    padding: 15px !important;  
    letter-spacing: 1px;       
    margin-top: 15px;          
    font-weight: 700;
}

.forge-btn:hover, 
.seal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
