
/* Ensure header is visible on tablets layout */
.codex-category-page--tablets .codex-category-header {
    position: relative !important;
    z-index: 10 !important;
}

/* Reset codex-category-content styles for tablets layout */
.codex-category-page--tablets .codex-category-content {
    padding: 0 !important;
    background: transparent !important;
    margin-top: 0 !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Tablets Page Wrapper - High specificity to override other styles */
.codex-category-page .tablets-page-wrapper,
.tablets-page-wrapper {
    /* Define CSS variables for tablets layout */
    --ledger-navbar-height: 60px;
    --footer-height: 60px;
    --ledger-text-primary: #e9dcc9;
    --ledger-bg-primary: #1a1611;
    --ledger-accent-gold: #d4af37;
    --ledger-accent-brown: #b8a25c;
    
    min-height: calc(100vh - 180px) !important;
    margin-bottom: 0 !important;
    padding: 2rem 0 5rem 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100vw !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 0 !important;
    position: relative !important;
    z-index: 1 !important;
    background: #1a1611 !important;
}

.tablets-page-wrapper::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #1a1611;
    z-index: -2;
}

.tablets-page-wrapper::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0), rgba(0, 0, 0, 1));
    z-index: -1;
}

/* Card Grid */
.codex-category-content .tablets-card-grid,
.tablets-card-grid {
    overflow-y: auto !important;
    width: 100% !important;
    max-width: 1400px !important;
    margin: 0 auto 1rem !important;
    flex-grow: 1 !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.5rem !important;
    margin-top: 0 !important;
    position: relative !important;
    z-index: 1 !important;
    overflow: visible !important;
}

.tablets-card-grid-item {
    min-height: 250px;
    width: 100%;
    animation: fadeIn 0.8s ease-out;
    animation-fill-mode: both;
}

.tablets-card-grid-item:nth-child(3n+1) { animation-delay: 0.1s; }
.tablets-card-grid-item:nth-child(3n+2) { animation-delay: 0.3s; }
.tablets-card-grid-item:nth-child(3n+3) { animation-delay: 0.5s; }

.tablets-card,
.tablets-card-secondary {
    position: relative;
    z-index: 1;
    background: rgba(26, 22, 17, 0.938);
    background-image: url('https://codex.xdripia.com/wp-content/uploads/2025/09/stone_squared.webp');
    background-size: cover;
    background-blend-mode: normal;
    border: 2px solid var(--ledger-accent-brown);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    border-radius: 0.375rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 350px;
    min-height: 350px;
    margin: 0 auto;
    cursor: pointer;
}

.tablets-card::before,
.tablets-card-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://codex.xdripia.com/wp-content/uploads/2025/09/stone_squared.webp');
    background-size: cover;
    opacity: 0.05;
    pointer-events: none;
    z-index: 1;
}

.tablets-card-secondary::before {
    opacity: 0.03;
}

.tablets-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(184, 162, 101, 0.2);
    border-color: var(--ledger-accent-gold);
    transition: all 1.3s ease;
}

.tablets-card-secondary:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 15px rgba(94, 72, 53, 0.2);
    border-color: var(--ledger-accent-brown);
}

.tablets-section-badge {
    position: absolute;
    top: 30px;
    left: 290px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(26, 22, 17, 0.9);
    border: 1px solid var(--ledger-accent-gold);
    color: var(--ledger-accent-gold);
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 0.8rem;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.tablets-card-inner {
    padding: 1.25rem 1.5rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: visible;
    z-index: 5;
    height: 100%;
    flex-grow: 1;
    width: 100%;
    isolation: isolate;
}

.tablets-card-header {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    margin-bottom: 0.5rem !important;
    width: 100% !important;
    position: relative !important;
    z-index: 10 !important;
}

.tablets-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #000;
    border: 1px solid var(--ledger-accent-gold);
    border-radius: 50%;
    padding: 0.2rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.tablets-card-icon-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tablets-card-title {
    font-size: 1.1rem !important;
    font-weight: 500 !important;
    font-family: 'Cinzel', serif !important;
    color: var(--ledger-accent-gold) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7), 0 0 20px rgba(201, 169, 97, 0.8) !important;
    margin: 0 !important;
    margin-bottom: 0.5rem !important;
    line-height: 1.2 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 1 !important;
    min-width: 0 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    position: relative !important;
    z-index: 10 !important;
}

.tablets-card-latin {
    font-size: 0.91rem;
    font-weight: 500;
    color: var(--ledger-bg-primary);
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    background: linear-gradient(90deg, var(--ledger-accent-brown), var(--ledger-accent-gold));
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    max-width: fit-content;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.tablets-card-text {
    font-size: 0.9rem;
    color: var(--ledger-text-primary);
    line-height: 1.5;
    font-family: 'EB Garamond', serif;
    flex-grow: 1;
    margin-bottom: 0;
}

/* Modal Styles */
.tablet-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 999999;
    padding: 1.5rem;
    animation: modalFadeIn 0.5s ease-out;
}

.tablet-modal-container {
    position: relative;
    width: 100%;
    max-width: 60rem;
    max-height: 90vh;
    animation: modalSlideIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: transparent;
    overflow: hidden;
}

.tablet-background {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #1a1611;
    border: 2px solid var(--ledger-accent-gold);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
    overflow: hidden;
    display: flex;
}

.tablet-overlay {
    position: absolute;
    inset: 0;
    background-image: url('https://codex.xdripia.com/wp-content/uploads/2025/09/tablets_destiny_texture.webp');
    background-blend-mode: overlay;
    opacity: 0.1;
    pointer-events: none;
}

.tablet-content {
    width: 100%;
    height: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    color: var(--ledger-text-primary);
    position: relative;
    z-index: 1;
}

.tablet-content::-webkit-scrollbar { width: 8px; }
.tablet-content::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
.tablet-content::-webkit-scrollbar-thumb { background: var(--ledger-accent-brown); border-radius: 10px; }
.tablet-content::-webkit-scrollbar-thumb:hover { background: var(--ledger-accent-gold); }

.tablet-modal-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.tablet-modal-image-column {
    flex: 0 0 40%;
    background-color: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border-right: 2px solid var(--ledger-accent-gold);
}

.tablet-modal-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.5));
}

.tablet-modal-text-column {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
}

.tablet-id {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--ledger-accent-brown);
    margin-bottom: 0.5rem;
}

.tablet-title {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: var(--ledger-accent-gold);
    margin-bottom: 1rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 12px rgba(212, 175, 55, 0.7);
}

.tablet-latin {
    font-family: 'EB Garamond', serif;
    font-size: 1.2rem;
    font-style: italic;
    color: var(--ledger-text-primary);
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.tablet-paragraph {
    font-family: 'EB Garamond', serif;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: var(--ledger-text-primary);
}

.tablet-close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--ledger-accent-gold);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.tablet-close-button:hover {
    background: rgba(212, 175, 55, 0.15);
    transform: scale(1.1);
}

.tablet-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--ledger-accent-gold);
    color: var(--ledger-accent-gold);
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    z-index: 10;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.2s ease;
}

.tablet-nav-button:hover {
    background: rgba(212, 175, 55, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.tablet-nav-previous { left: -5rem; }
.tablet-nav-next { right: -5rem; }

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

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

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

@media (max-width: 1200px) {
    .tablets-card-grid { gap: 2rem; }
}

@media (max-width: 992px) {
    .tablets-card-grid { grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
}

@media (max-width: 768px) {
    .tablet-modal-layout { flex-direction: column; }
    .tablet-modal-image-column {
        flex: 0 0 250px;
        border-right: none;
        border-bottom: 2px solid var(--ledger-accent-gold);
    }
    .tablet-modal-text-column { padding: 2rem; }
    .tablet-nav-previous { left: 0.5rem; }
    .tablet-nav-next { right: 0.5rem; }
}

@media (max-width: 640px) {
    .tablets-card-grid { grid-template-columns: 1fr; gap: 1rem; }
}

