/*
Theme Name: Tribr
Theme URI: https://tribr.example.com
Description: A portfolio and narrative visual platform for illustrators with app-like experience
Version: 1.0.0
Author: Tribr Team
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tribr
*/

/* Base reset and modern CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #d2d7df;
    background-color: #1f0330;
    overflow: hidden;
}

body,
html {
    margin: 0;
    padding: 0;
}

/* WordPress admin compatibility */
.wp-admin .tribr-app-shell {
    display: none;
}

/* App Shell Layout */
.tribr-app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    background: #FFFFFF;
}



/* Fixed Header - sin barra, solo botón hamburguesa flotante */
.tribr-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3000;
    /* above content but below menu-drawer (5000) and fullscreen (10000) */
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

.tribr-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    box-sizing: border-box;
    pointer-events: auto;
}

tribr-idblock {
    display: block;
    cursor: pointer;
}

.tribr-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
}

.tribr-logo img {
    z-index: 100000;
    display: block;
    height: 32px;
    width: auto;
}

.tribr-site-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--tribr-text-color, #31043a);
    line-height: 1;
    white-space: nowrap;
    text-transform: uppercase;
}

.tribr-blogname {
    margin-left: 0.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: #200333;
    display: block;
    cursor: pointer;
    text-decoration: none;
}

.tribr-menu-btn {
    z-index: 100000;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.tribr-menu-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.tribr-menu-btn svg {
    display: block;
    width: 24px;
    height: 24px;
    stroke: #1F2937;
    /* ensure stroke is visible for inline SVG */
    color: #1F2937;
}

.tribr-header-view-title,
.tribr-current-view-title {
    display: none;
}

/* Navigation Drawer */
.tribr-menu-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: #FFFFFF;
    z-index: 5000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.tribr-menu-drawer.open {
    transform: translateX(0);
}

.tribr-menu-header {
    /*padding: 1rem;*/
    padding: 0px;
    margin: 0px;

    display: flex;
    justify-content: flex-end;
    border-bottom: 1px solid black;
}

.tribr-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: #6B7280;
    cursor: pointer;
    padding: 0.5rem;
}

.tribr-menu-nav {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
}

.tribr-menu-item {
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: #374151;
    font-size: 1.125rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.tribr-menu-item:hover {
    background: #081a2c;
    color: var(--tribr-primary-color, #3B82F6);
}

.tribr-menu-item.active {
    background: rgba(59, 130, 246, 0.05);
    color: var(--tribr-primary-color, #3B82F6);
    border-left: 4px solid var(--tribr-primary-color, #3B82F6);
}

.tribr-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    z-index: 4000;
    backdrop-filter: blur(2px);
}

.tribr-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Content Area */
.tribr-main {
    flex: 1;
    overflow-y: auto;
    /*padding: 0px;*/
}

/* Full viewport mosaic (Home) */
.tribr-app-shell.tribr-mosaic-fullviewport {
    /* Use computed --vh to match visible viewport (accounts for mobile chrome) */
    height: calc(var(--vh, 1vh) * 100);
}

.tribr-app-shell.tribr-mosaic-fullviewport .tribr-main {
    flex: 1;
    min-height: 0;
    height: 100%;
    padding: 0;
    /* remove top padding so mosaic covers full viewport */
    overflow: auto;
}

.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-grid {
    min-height: 100%;
    height: 100%;
    width: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
}

.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-grid.is-muuri {
    min-height: 100%;
}

/* Viewport-fit card sizes (4 col x 3 row virtual grid) */
.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-grid.is-muuri .tribr-content-card {
    --mosaic-gap: 0.5rem;
    --mosaic-cell-w: calc((100% - var(--mosaic-gap) * (var(--mosaic-cols, 4) - 1)) / var(--mosaic-cols, 4));
    --mosaic-cell-h: calc((100% - var(--mosaic-gap) * (var(--mosaic-rows, 3) - 1)) / var(--mosaic-rows, 3));
}

.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-grid.is-muuri .tribr-card--w1-h1 {
    width: var(--mosaic-cell-w);
    height: var(--mosaic-cell-h);
}

.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-grid.is-muuri .tribr-card--w2-h1 {
    width: calc(var(--mosaic-cell-w) * 2 + var(--mosaic-gap));
    height: var(--mosaic-cell-h);
}

.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-grid.is-muuri .tribr-card--w1-h2 {
    width: var(--mosaic-cell-w);
    height: calc(var(--mosaic-cell-h) * 2 + var(--mosaic-gap));
}

.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-grid.is-muuri .tribr-card--w2-h2 {
    width: calc(var(--mosaic-cell-w) * 2 + var(--mosaic-gap));
    height: calc(var(--mosaic-cell-h) * 2 + var(--mosaic-gap));
}

.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-card .tribr-card-image {
    width: 99%;
    height: 99%;
    object-fit: cover;
}

.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-card .tribr-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    color: white;
}

.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-card .tribr-card-title {
    font-size: 0.75rem;
    color: white;
    margin: 0;
}

.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-card .tribr-card-excerpt,
.tribr-app-shell.tribr-mosaic-fullviewport .tribr-content-card .tribr-card-meta {
    display: none;
}

/* Hero Carousel */
.tribr-hero {
    position: relative;
    width: 100%;
    height: 55vh;
    max-height: none;
    overflow: hidden;
}

.tribr-hero-carousel {
    position: relative;
    width: 100%;
    height: 100%;

}

.tribr-hero-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.tribr-hero-item.active {
    opacity: 1;
}

.tribr-hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tribr-hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
}

.tribr-hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.tribr-hero-meta {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Related Strip */
.tribr-related-strip {
    padding: 1rem 1.5rem;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
}

.tribr-related-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6B7280;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tribr-related-items {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tribr-related-items::-webkit-scrollbar {
    display: none;
}

.tribr-related-item {
    flex-shrink: 0;
    width: 120px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tribr-related-item:hover {
    transform: scale(1.05);
}

.tribr-related-thumbnail {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.tribr-related-title-small {
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Content Grid */
.tribr-content-grid {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tribr-content-card {
    position: relative;
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

/* Muuri enabled */
.tribr-content-grid.is-muuri {
    display: block;
    position: relative;
}

.tribr-content-grid.is-muuri .tribr-content-card {
    position: absolute;
    width: 280px;
    touch-action: none;
}

@media (min-width: 640px) {
    .tribr-content-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }

    .tribr-content-grid.is-muuri .tribr-content-card {
        width: 320px;
    }
}

@media (min-width: 1024px) {
    .tribr-content-grid {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    }

    .tribr-content-grid.is-muuri .tribr-content-card {
        width: 360px;
    }
}

.tribr-content-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.tribr-card-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* --- New Layout Variations --- */

/* Masonry */
.tribr-layout-masonry.is-muuri .tribr-content-card {
    width: var(--mosaic-cell-w, 280px);
}

.tribr-card--masonry.h-sm {
    height: 200px;
}

.tribr-card--masonry.h-md {
    height: 300px;
}

.tribr-card--masonry.h-lg {
    height: 400px;
}

.tribr-card--masonry.h-xl {
    height: 500px;
}

/* Carousel */
.tribr-layout-carousel {
    display: flex !important;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    gap: var(--mosaic-gap, 1rem);
    padding: 2rem;
    height: 100%;
    align-items: center;
}

.tribr-layout-carousel::-webkit-scrollbar {
    height: 6px;
}

.tribr-layout-carousel::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.tribr-card--carousel {
    flex: 0 0 300px;
    height: 450px;
    scroll-snap-align: center;
}

/* Single Slide */
.tribr-layout-single {
    display: flex !important;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
}

.tribr-card--single {
    width: 100%;
    height: 100%;
    flex: 0 0 100%;
    scroll-snap-align: start;
    border-radius: 0;
    box-shadow: none;
}

.tribr-card--single .tribr-card-image {
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Outer Style */
.tribr-layout-outer .tribr-content-card {
    background: transparent;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.tribr-layout-outer .tribr-card-content {
    background: #fff;
    margin-top: 10px;
    border-radius: 0 0 12px 12px;
}

/* Card Inner helper */
.tribr-card-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Fullscreen overlay */
.tribr-no-scroll {
    overflow: hidden;
}

.tribr-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 5000;
}

.tribr-fullscreen-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.tribr-fullscreen-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tribr-fullscreen-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #120122;
}

.tribr-fullscreen-image {
    touch-action: none;
    transition: transform 0.12s ease;
    transform-origin: center;
    will-change: transform;
}

.tribr-fullscreen-meta {
    position: absolute;
    left: 1.25rem;
    bottom: 1.25rem;
    right: 4rem;
    color: rgba(255, 255, 255, 0.95);
    pointer-events: none;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.tribr-fullscreen-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.tribr-fullscreen-author {
    margin-top: 0.25rem;
    font-size: 0.95rem;
    opacity: 0.9;
}

.tribr-fullscreen-prev,
.tribr-fullscreen-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 72px;
    height: 72px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.95);
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    z-index: 5000;
}

.tribr-fullscreen-prev {
    left: 1rem;
}

.tribr-fullscreen-next {
    right: 1rem;
}

.tribr-fullscreen-prev:hover,
.tribr-fullscreen-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.tribr-fullscreen-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.95);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.tribr-fullscreen-close:hover {
    background: rgba(28, 5, 53, 0.274);
}

/* Fullscreen Sidebar (Summary) */
.tribr-fullscreen-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: rgba(20, 2, 37, 0.438);
    backdrop-filter: blur(15px);
    color: white;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 2rem;
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: auto;
}

.tribr-fullscreen-sidebar.open {
    transform: translateX(0);
}

.tribr-fullscreen-info {
    position: absolute;
    bottom: 1.25rem;
    right: 5rem;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.95);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.tribr-fullscreen-info:hover {
    background: rgba(255, 255, 255, 0.25);
}

.tribr-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.tribr-sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tribr-sidebar-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tribr-sidebar-close:hover {
    opacity: 1;
}

.tribr-sidebar-content {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.5;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .tribr-fullscreen-sidebar {
        width: 100%;
        height: auto;
        bottom: 0;
        top: auto;
        transform: translateY(100%);
    }

    @keyframes tribr-sidebar-slide-in {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }
}

.tribr-card-content {
    padding: 1rem;
}

.tribr-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 0.5rem;
}

.tribr-card-excerpt {
    font-size: 0.875rem;
    color: #6B7280;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tribr-card-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.tribr-tag {
    padding: 0.25rem 0.5rem;
    background: #F3F4F6;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #6B7280;
}

/* Loading State */
.tribr-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.tribr-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #E5E7EB;
    border-top: 3px solid #3B82F6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .tribr-app-shell {
        max-width: 100%;
        box-shadow: none;
    }

    .tribr-hero {
        height: 50vh;
    }

    .tribr-content-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
}

/* Utility Classes */
.tribr-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tribr-text-center {
    text-align: center;
}

.tribr-mb-4 {
    margin-bottom: 1rem;
}