/* ================================================= */
/* BASE                                              */
/* ================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1f2a37;
    background: #fff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

/* ================================================= */
/* HEADER                                            */
/* ================================================= */

.site-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.site-logo {
    height: 56px;
}

.main-nav-container {
    background: #fff;
    border-bottom: 1px solid #f3f4f6;
}

.main-header-link {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    padding: 8px 0;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
}

.main-header-link:hover {
    color: #0d6efd;
}

.main-header-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #0d6efd;
    transition: width 0.3s ease;
}

.main-header-link:hover::after {
    width: 100%;
}

.main-nav .site-nav-link {
    font-weight: 500;
    color: #1f2a37;
    text-decoration: none;
    padding: 6px 0;
    font-size: 15px;
    transition: color 0.2s ease;
}

.main-nav .site-nav-link:hover {
    color: #0d6efd;
}

.nav-link-top {
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    padding: 4px 0;
}

.nav-link-top:hover {
    color: #0d6efd;
}

.nav-link-top::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #0d6efd;
    transition: width 0.2s ease;
}

.nav-link-top:hover::after {
    width: 100%;
}

/* ================================================= */
/* LANGUAGE & SOCIAL                                 */
/* ================================================= */

.lang-link {
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    color: #6b7280;
    transition: all 0.2s ease;
}

.lang-link:hover {
    color: #0d6efd;
    background: #f3f4f6;
}

.header-divider {
    width: 1px;
    height: 16px;
    background-color: #e5e7eb;
}

.social-btn {
    color: #6b7280;
    font-size: 18px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-btn:hover {
    transform: translateY(-2px);
}

.social-btn.social-x:hover         { color: #000000; }
.social-btn.social-youtube:hover    { color: #FF0000; }
.social-btn.social-instagram:hover  { color: #E1306C; }

.social-svg {
    width: 20px;
    height: 20px;
    display: block;
    border-radius: 5px;
    filter: grayscale(1);
    transition: filter 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-btn.social-nso:hover .social-svg {
    filter: grayscale(0);
}

/* ================================================= */
/* PAGE HEADER (Recent | Publications ▼ | Search)    */
/* ================================================= */

.page-header {
    padding: 28px 0 18px 0;
    border-bottom: 1px solid #eef2f7;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.titles-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    position: relative;
}

/* LEFT */
.title-left {
    font-size: 18px;
    font-weight: 300;
    color: #374151;
    white-space: nowrap;
}

.back-link {
    color: #0d6efd;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #0958d9;
}

/* CENTER */
.title-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
}

.title-center .dropdown {
    position: static;
}

.title-dropdown-link {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: .2px;
    color: #111827;
    text-decoration: none;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    outline: none;
    transition: color 0.2s ease;
}

.title-dropdown-link:hover {
    color: #0d6efd;
}

.title-dropdown-link:focus,
.title-dropdown-link:focus-visible {
    outline: none;
    box-shadow: none;
}

/* RIGHT — Search */
.search-box {
    flex: 0 0 auto;
}

.search-form {
    display: flex;
    align-items: center;
    height: 36px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-form:focus-within {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.08);
}

.search-input {
    border: none;
    outline: none;
    padding: 8px 16px;
    font-size: 14px;
    background: transparent;
    color: #1f2a37;
    width: 180px;
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-btn {
    border: none;
    background: transparent;
    color: #6b7280;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 15px;
    transition: color 0.2s ease;
}

.search-btn:hover {
    color: #0d6efd;
}

/* ================================================= */
/* MEGA MENU — Multi-column layout                   */
/* ================================================= */

.mega-menu {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(10px) !important;
    top: 100% !important;
    min-width: 0;
    max-width: 95vw;
    width: max-content;
    border: 1px solid #e5e7eb;
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-top: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block !important;
    background: #fff;
    z-index: 1000;
}

.dropdown:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) !important;
}

.mega-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 10px;
}

.mega-col {
    padding: 0 10px;
}

.mega-col-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
}

.mega-link {
    display: block;
    padding: 6px 0;
    font-size: 14px;
    color: #4b5563;
    text-decoration: none;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.mega-link:hover {
    color: #0d6efd;
    transform: translateX(4px);
}

/* ================================================= */
/* RESPONSIVE                                        */
/* ================================================= */

@media (max-width: 992px) {
    .mega-columns {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .mega-menu {
        min-width: 100%;
        max-width: 100%;
        border-radius: 8px;
        position: static !important;
        transform: none !important;
        box-shadow: none;
        border: none;
        display: none !important; /* Hide mega menu on mobile by default */
    }

    .titles-bar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .title-left {
        font-size: 16px;
    }

    .site-logo {
        height: 42px;
    }
}

/* ================================================= */
/* YEAR RANGE SLIDER                                 */
/* ================================================= */

.year-filter-bar {
    background: #fff;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    border-bottom: 1px solid transparent;
    transition: max-height 0.3s ease, padding 0.3s ease, border-color 0.2s ease;
}

.year-filter-bar.open {
    max-height: 90px;
    padding: 14px 0;
    border-bottom-color: #eef2f7;
}

.year-range-wrapper {
    display: flex;
    align-items: center;
    gap: 18px;
}

.year-range-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    min-width: 90px;
}

.year-slider-track {
    position: relative;
    flex: 1;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin: 10px 0;
    z-index: 2; /* thumbs above the tick overlay */
}

.year-slider-fill {
    position: absolute;
    top: 0;
    height: 100%;
    background: #0d6efd;
    border-radius: 2px;
    pointer-events: none;
}

.year-slider-track input[type="range"] {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 20px;
    margin: 0;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    pointer-events: none;
}

.year-slider-track input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #0d6efd;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.year-slider-track input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 6px rgba(13, 110, 253, 0.12);
    transform: scale(1.15);
}

.year-slider-track input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #0d6efd;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.year-slider-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Ticks container overlaps slider track upward to widen the hit area.
   No horizontal padding — JS positions ticks in px using the thumb-offset formula. */
.year-ticks {
    position: relative;
    height: 36px;
    margin-top: -14px;  /* pulls the container up into the slider zone */
    z-index: 0;         /* slider track thumbs sit above via z-index:2 */
}

.year-tick {
    position: absolute;
    transform: translateX(-50%);
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    padding: 0 6px;    /* wide horizontal target */
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    transition: color 0.15s ease;
}

.year-tick::before {
    content: '';
    display: block;
    width: 1px;
    height: 4px;
    background: currentColor;
    margin-bottom: 2px;
    transition: width 0.15s ease, height 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}

.year-tick-label {
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1;
}

.year-tick:hover {
    color: #0d6efd;
}

/* In-range ticks: light blue mark */
.year-tick.year-tick--in-range {
    color: #93c5fd;
}

.year-tick.year-tick--in-range::before {
    height: 5px;
}

/* Endpoint ticks (yearFrom / yearTo): prominent blue mark */
.year-tick.year-tick--endpoint {
    color: #0d6efd;
}

.year-tick.year-tick--endpoint::before {
    width: 2px;
    height: 8px;
    background: #0d6efd;
}

.year-tick.year-tick--endpoint .year-tick-label {
    font-weight: 600;
    color: #0d6efd;
}

/* Bridge line connecting the two endpoint tick marks */
.year-range-bridge {
    position: absolute;
    height: 2px;
    background: #0d6efd;
    bottom: 14px;       /* vertically centred on the 4 px tick mark above the label */
    border-radius: 1px;
    pointer-events: none;
    display: none;
}

.year-reset-btn {
    color: #9ca3af;
    font-size: 16px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.year-reset-btn:hover {
    color: #ef4444;
}


/* ================================================= */
/* YEAR PICKER POPUP (Option A variant)              */
/* ================================================= */

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.year-picker {
    position: relative;
    display: inline-block;
}

.year-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.year-picker-trigger:hover {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.08);
}

.year-picker-chevron {
    font-size: 11px;
    color: #9ca3af;
    transition: transform 0.2s ease;
}

.year-picker-popup {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 500;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
    padding: 12px;
    min-width: 300px;
    user-select: none;
}

.year-picker-popup.open {
    display: block;
}

.year-picker-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.year-picker-popup-label {
    font-size: 13px;
    font-weight: 600;
    color: #1f2a37;
}

.year-picker-clear {
    font-size: 12px;
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.15s ease;
}

.year-picker-clear:hover {
    color: #ef4444;
}

.year-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 4px;
}

.year-picker-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 4px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: background 0.1s ease, color 0.1s ease;
}

.year-picker-chip:hover {
    background: #f0f5ff;
    color: #0d6efd;
}

.year-picker-chip--selected {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: transparent;
}

.year-picker-chip--endpoint {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}

.year-picker-hint {
    margin: 8px 0 0;
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
}

.slider-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    font-size: 15px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.slider-toggle-btn:hover {
    border-color: #0d6efd;
    color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.08);
}

.slider-toggle-btn.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

/* ================================================= */
/* BOOK GRID                                         */
/* ================================================= */

.catalogue .row {
    margin-top: 20px;
}

.book-card {
    text-decoration: none;
    color: inherit;
    display: block;
    perspective: 1200px; /* Enable 3D space */
}

.book-cover-wrap {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: visible; /* Changed from hidden to show 3d edges */
    border-radius: 2px 6px 6px 2px;
    background: #e8ecf0;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.4s ease-out, box-shadow 0.4s ease-out;
    transform-style: preserve-3d;
    transform-origin: left center;
}

/* Inner spine shadow to simulate curve */
.book-cover-wrap::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 25px;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(0, 0, 0, 0.1) 5%,
        rgba(0, 0, 0, 0.25) 10%,
        rgba(255, 255, 255, 0.2) 15%,
        rgba(0, 0, 0, 0.05) 40%,
        rgba(255, 255, 255, 0) 100%
    );
    z-index: 10;
    pointer-events: none;
    border-radius: 2px 0 0 2px;
}

/* Page thickness on the right */
.book-cover-wrap::after {
    content: '';
    position: absolute;
    top: 1.5%;
    bottom: 1.5%;
    right: -10px;
    width: 10px;
    background: linear-gradient(to right, #e2e8f0 0%, #f1f5f9 100%);
    transform: rotateY(90deg);
    transform-origin: left;
    border-radius: 0 4px 4px 0;
    opacity: 0;
    transition: opacity 0.4s ease-out;
}

/* Hover rotations */
.book-card:hover .book-cover-wrap {
    transform: translateY(-5px) rotateY(-12deg);
    box-shadow: 
        inset 4px 0 10px rgba(0, 0, 0, 0.04),
        15px 15px 25px rgba(0, 0, 0, 0.12),
        -4px 4px 10px rgba(0, 0, 0, 0.05); /* 3D pop shadow */
}

/* Show pages on hover */
.book-card:hover .book-cover-wrap::after {
    opacity: 1;
}

.book-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px 6px 6px 2px;
    position: relative;
    z-index: 2;
}

.book-meta {
    padding-top: 10px;
}

.book-title {
    font-weight: 600;
    font-size: 14px;
    color: #1f2a37;
    line-height: 1.4;
}

.book-sub {
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
}

/* ================================================= */
/* FOOTER                                            */
/* ================================================= */

.site-footer {
    background: linear-gradient(165deg, #111827 0%, #1a2332 50%, #0f172a 100%);
    color: #cbd5e1;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

/* subtle radial glow */
.site-footer::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -80px;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(13,110,253,.08) 0%, transparent 70%);
    pointer-events: none;
}

/* accent line at top */
.footer-accent {
    height: 3px;
    background: linear-gradient(90deg, #0d6efd 0%, #6366f1 40%, #8b5cf6 70%, #0d6efd 100%);
    background-size: 200% 100%;
    animation: accentShimmer 6s ease infinite;
}

@keyframes accentShimmer {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* main content area */
.footer-main {
    padding: 48px 0 32px;
}

/* brand column */
.footer-brand {
    max-width: 340px;
}

.footer-logo-link {
    display: inline-block;
    transition: opacity .2s ease;
}

.footer-logo-link:hover {
    opacity: .85;
}

.footer-logo {
    height: 44px;
    filter: brightness(0) invert(1);
    /* makes any dark logo white */
}

.footer-desc {
    margin-top: 14px;
    line-height: 1.7;
    color: #94a3b8;
    font-size: 13.5px;
}

/* headings */
.footer-heading {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #e2e8f0;
    margin-bottom: 18px;
    position: relative;
    padding-bottom: 10px;
}

.footer-heading::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 28px;
    height: 2px;
    background: #0d6efd;
    border-radius: 2px;
}

[dir="rtl"] .footer-heading::after {
    left: auto;
    right: 0;
}

/* navigation list */
.footer-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-nav li + li {
    margin-top: 10px;
}

.footer-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color .2s ease, padding-left .2s ease;
}

.footer-link::before {
    content: '›';
    font-size: 16px;
    line-height: 1;
    color: #475569;
    transition: color .2s ease, transform .2s ease;
}

[dir="rtl"] .footer-link::before {
    content: '‹';
}

.footer-link:hover {
    color: #60a5fa;
    padding-left: 4px;
}

[dir="rtl"] .footer-link:hover {
    padding-left: 0;
    padding-right: 4px;
}

.footer-link:hover::before {
    color: #60a5fa;
    transform: translateX(2px);
}

/* social buttons */
.footer-social {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.footer-social-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,.06);
    color: #94a3b8;
    font-size: 17px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.08);
    transition: all .25s ease;
    backdrop-filter: blur(4px);
}

.footer-social-btn:hover {
    background: rgba(13,110,253,.15);
    border-color: rgba(13,110,253,.3);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(13,110,253,.15);
}

.footer-social-btn.social-x:hover         { color: #000000; }
.footer-social-btn.social-youtube:hover    { color: #FF0000; }
.footer-social-btn.social-instagram:hover  { color: #E1306C; }

.footer-social-img {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
    filter: grayscale(1) brightness(1.05);
    transition: filter .25s ease;
}

.footer-social-btn:hover .footer-social-img {
    filter: grayscale(0) brightness(1);
}

/* address */
.footer-address {
    color: #64748b;
    font-size: 12.5px;
    line-height: 1.65;
    margin: 0;
}

/* bottom bar */
.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 0;
    border-top: 1px solid rgba(255,255,255,.06);
    font-size: 13px;
    color: #64748b;
}

.footer-bottom-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    background: rgba(13,110,253,.1);
    color: #60a5fa;
    border: 1px solid rgba(13,110,253,.15);
}

/* responsive footer */
@media (max-width: 768px) {
    .footer-main {
        padding: 36px 0 24px;
    }

    .footer-brand {
        max-width: 100%;
        text-align: center;
    }

    .footer-heading::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-bottom {
        justify-content: center;
        text-align: center;
    }
}

/* ================================================= */
/* RESPONSIVE                                        */
/* ================================================= */

@media (max-width: 768px) {
    .titles-bar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .title-center {
        position: static;
        transform: none;
        width: 100%;
        order: 3;
    }

    .title-left {
        font-size: 16px;
        order: 1;
    }

    .search-box {
        flex: 1;
        order: 2;
        text-align: right;
    }
    
    .search-form {
        display: inline-flex;
    }

    .search-input {
        width: 140px;
    }

    .site-logo {
        height: 42px;
    }
}