/* --- PART 1: CORE UPDATES --- */

:root {
  --bg-deep: #050505;
  --text-main: #f0f0f0;
  --text-muted: rgba(240, 240, 240, 0.6);
  --gold: #c8a44a;
  --gold-dim: #8a7030;
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --container-width: 90%;
  --max-width: 1200px;
  --header-height: 70px;
  
  /* Status Colors */
  --status-preclinical: #a0a0a0; /* Grey/Silver */
  --status-experimental: #c8a44a; /* Gold */
}

/* IMPORT ARABIC FONT */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;700&display=swap');

*, *::before, *::after { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; 
  outline: none;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: 'Cormorant Garamond', serif; font-weight: 400; letter-spacing: -0.02em; }

/* FIX: STATIC BACKGROUND */
.bg-layer {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100vh;
  z-index: -1;
  overflow: hidden;
  transform: none !important; 
}

.bg-image {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.4;
}

.noise-overlay {
  position: absolute; inset: 0;
  background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIj48ZmlsdGVyIGlkPSJnoiPjxmZVR1cmJ1bGVuY2UgdHlwZT0iZnJhY3RhbE5vaXNlIiBiYXNlRnJlcXVlbmN5PSIwLjY1IiBudW1PY3RhdmVzPSIzIiBzdGl0Y2hUaWxlcz0ic3RpdGNoIi8+PC9maWx0ZXI+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsdGVyPSJ1cmwoI2cpIiBvcGFjaXR5PSIwLjAzIi8+PC9zdmc+');
  opacity: 0.5; mix-blend-mode: overlay; pointer-events: none;
}

.vignette-overlay {
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, transparent 0%, var(--bg-deep) 120%);
}

/* Header & Hero */
.main-header {
  position: fixed; top: 0; width: 100%; height: var(--header-height); z-index: 100;
  display: flex; align-items: center;
  background: linear-gradient(to bottom, rgba(5,5,5,0.9), transparent);
  backdrop-filter: blur(5px);
}
.container { width: var(--container-width); max-width: var(--max-width); margin: 0 auto; }
.main-header .container { display: flex; justify-content: space-between; align-items: center; }
.logo-img { height: 32px; width: auto; opacity: 0.9; }

.hero-section {
  height: 95vh;
  display: flex; align-items: center;
  padding-top: var(--header-height);
}
.hero-title { font-size: clamp(3rem, 12vw, 5.5rem); line-height: 1; margin-bottom: 24px; }
.italic-accent { font-style: italic; font-weight: 300; color: var(--gold); }
.hero-subtitle { font-size: 1.1rem; color: var(--text-muted); font-weight: 300; max-width: 500px; margin-bottom: 40px; }
.kicker { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em; color: var(--gold); margin-bottom: 16px; }

.scroll-indicator { display: flex; align-items: center; gap: 15px; opacity: 0.7; margin-top: 40px; }
.scroll-indicator .text { font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em; }
.scroll-indicator .line { height: 1px; width: 40px; background: var(--text-muted); }

/* Intro Section */
.intro-section { padding: 40px 0; border-bottom: 1px solid var(--glass-border); margin-bottom: 60px; }
.intro-text { font-size: 1.1rem; color: #ccc; max-width: 800px; font-weight: 300; }

/* Slider */
.research-section { padding-bottom: 80px; }
.section-title { font-size: 2.5rem; color: var(--text-main); margin-bottom: 5px; }
.section-subtitle { display: block; font-family: 'Inter', sans-serif; font-size: 0.85rem; color: var(--gold); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 40px; }

.slider-container { width: 100%; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; padding-bottom: 20px; scrollbar-width: none; }
.slider-container::-webkit-scrollbar { display: none; }
.slider-track { display: flex; gap: 20px; padding: 0 5%; width: max-content; }
.spacer-end { width: 5vw; }

.research-card { scroll-snap-align: center; width: 85vw; max-width: 320px; flex-shrink: 0; cursor: pointer; transition: transform 0.3s; }
.research-card:active { transform: scale(0.98); }

.card-glass {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 30px; border-radius: 4px; min-height: 280px;
  display: flex; flex-direction: column; justify-content: space-between;
}

.chem-meta { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.chem-id { font-size: 0.75rem; color: var(--gold-dim); border: 1px solid var(--gold-dim); padding: 2px 8px; border-radius: 50px; }
.evidence-tag { 
    font-size: 0.65rem; 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    padding: 2px 0; 
    font-weight: 600;
}
.evidence-tag.preclinical { color: var(--status-preclinical); }
.evidence-tag.experimental { color: var(--status-experimental); }

.card-title { font-size: 1.8rem; line-height: 1.1; margin-bottom: 5px; }
.card-small-sub { font-size: 0.8rem; text-transform: uppercase; color: #888; margin-bottom: 10px; letter-spacing: 0.05em; }
.card-desc { font-size: 0.95rem; color: var(--text-muted); font-weight: 300; margin-bottom: 20px; }
.btn-text { background: none; border: none; color: var(--text-main); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; padding: 0; cursor: pointer; }

/* Info Grid & Quality */
.info-section { padding: 80px 0; }
.info-grid { display: grid; grid-template-columns: 1fr; gap: 40px; margin-top: 40px; }
.info-item h4 { font-size: 1.5rem; margin-bottom: 10px; color: #fff; }
.info-item p { color: var(--text-muted); font-size: 0.95rem; font-weight: 300; }
.gold-num { display: block; color: var(--gold); font-family: 'Cormorant Garamond'; font-size: 2rem; margin-bottom: 10px; opacity: 0.6; }

.quality-section {
  position: relative;
  padding: 100px 0;
  overflow: hidden;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.01);
}
.bg-watermark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  max-width: 600px;
  opacity: 0.04;
  pointer-events: none;
}
.relative-z { position: relative; z-index: 2; text-align: center; }
.quality-text { font-size: 1.2rem; color: #ccc; margin: 30px auto; max-width: 600px; font-weight: 300; }
.cert-badges { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; }
.badge { border: 1px solid var(--gold); color: var(--gold); padding: 8px 16px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; border-radius: 2px; }

/* FAQ Section */
.faq-section { padding: 80px 0; }
.faq-list { margin-top: 40px; max-width: 800px; }
.faq-item { border-bottom: 1px solid var(--glass-border); padding: 20px 0; cursor: pointer; }
.faq-question { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; color: #fff; }
.faq-question .plus { color: var(--gold); font-size: 1.5rem; font-weight: 300; transition: transform 0.3s; }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.faq-answer p { padding-top: 15px; color: var(--text-muted); font-size: 0.95rem; font-weight: 300; }
.faq-item.active .plus { transform: rotate(45deg); }
.faq-item.active .faq-answer { max-height: 200px; }

/* Footer */
footer { padding: 80px 0 40px; border-top: 1px solid rgba(255,255,255,0.05); }
.footer-content { display: flex; flex-direction: column; gap: 40px; }
.logo-footer-lg { width: 180px; opacity: 0.8; margin-bottom: 15px; }
.footer-links { display: flex; flex-direction: column; gap: 15px; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.copyright { color: #555; font-size: 0.8rem; }

/* Modal - ENHANCED */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); z-index: 1000; display: flex; align-items: flex-end; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.modal-backdrop.active { opacity: 1; pointer-events: auto; }
.modal-content { width: 100%; max-width: 600px; background: #111; border-top: 1px solid var(--gold); padding: 40px 30px; border-radius: 20px 20px 0 0; margin: 0 auto; transform: translateY(100%); transition: transform 0.4s; max-height: 85vh; overflow-y: auto; }
.modal-backdrop.active .modal-content { transform: translateY(0); }
.close-modal { position: absolute; top: 20px; right: 20px; background: none; border: none; color: #fff; font-size: 2rem; }

.modal-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.modal-badge { font-size: 0.7rem; padding: 4px 8px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.05em; border: 1px solid rgba(255,255,255,0.2); }

.modal-body h2 { font-size: 2rem; color: var(--gold); margin-bottom: 5px; }
.modal-label { font-family: 'Inter', sans-serif; font-size: 0.75rem; text-transform: uppercase; color: #666; margin-top: 25px; margin-bottom: 10px; letter-spacing: 0.1em; border-bottom: 1px solid #333; padding-bottom: 5px; }
.modal-body p, .modal-body li { color: #ccc; font-size: 0.95rem; font-weight: 300; margin-bottom: 10px; }
.modal-list { padding-left: 20px; margin-bottom: 15px; }

/* NEW: Unknown Box & Citation */
.unknown-box {
    margin-top: 25px;
    padding: 15px 20px;
    background: rgba(180, 50, 50, 0.05);
    border-left: 2px solid #844;
}
.unknown-box h4 { font-size: 0.85rem; color: #b88; text-transform: uppercase; margin-bottom: 10px; letter-spacing: 0.05em; }
.unknown-box ul { padding-left: 15px; margin: 0; }
.unknown-box li { color: #aaa; font-size: 0.85rem; margin-bottom: 5px; }

.citation-box { margin-top: 30px; border-top: 1px solid var(--glass-border); padding-top: 15px; }
.citation-text { font-size: 0.75rem; color: #666; font-style: italic; margin-bottom: 5px; }
.doi-link { color: var(--gold-dim); text-decoration: none; font-size: 0.7rem; text-transform: uppercase; }

.disclaimer-box { margin-top: 20px; padding: 15px; background: rgba(200, 164, 74, 0.05); border: 1px solid var(--gold-dim); font-size: 0.8rem; color: var(--gold); }

/* Desktop */
@media (min-width: 768px) {
  .info-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-content { flex-direction: row; justify-content: space-between; align-items: flex-end; }
  .footer-links { flex-direction: row; gap: 30px; }
  .modal-backdrop { align-items: center; }
  .modal-content { border-radius: 4px; border: 1px solid var(--glass-border); }
}

/* UI Elements */
.nav-link { text-decoration: none; color: var(--text-main); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15em; padding: 10px 15px; transition: color 0.3s ease; }
.nav-link:hover { color: var(--gold); }

.lang-switcher { display: flex; gap: 8px; margin-left: 20px; border-left: 1px solid rgba(255,255,255,0.2); padding-left: 20px; }
.lang-btn { background: none; border: none; color: var(--text-muted); font-size: 0.75rem; cursor: pointer; text-transform: uppercase; padding: 0; }
.lang-btn.active { color: var(--gold); font-weight: bold; }

.hero-cta { display: flex; gap: 20px; margin-bottom: 40px; }
.btn { display: inline-block; padding: 14px 32px; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.8rem; text-decoration: none; transition: all 0.3s ease; cursor: pointer; text-align: center; }
.btn-primary { border: 1px solid var(--gold); background: rgba(200, 164, 74, 0.1); color: var(--gold); }
.btn-primary:hover { background: var(--gold); color: #000; }
.btn-ghost { border: 1px solid var(--glass-border); color: var(--text-muted); }
.btn-ghost:hover { border-color: var(--text-main); color: var(--text-main); }

.evidence-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 40px; }
.tag-num { display: block; color: var(--gold); font-family: 'Cormorant Garamond'; font-size: 1.5rem; margin-bottom: 10px; border-bottom: 1px solid rgba(200, 164, 74, 0.3); padding-bottom: 5px; width: fit-content; }

.partner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 30px; }

.ref-links-container { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.ref-link { font-size: 0.75rem; color: var(--text-muted); border: 1px solid var(--glass-border); padding: 5px 10px; text-decoration: none; border-radius: 4px; transition: 0.2s; }
.ref-link:hover { border-color: var(--gold); color: var(--gold); }

/* --- MOBILE MENU STYLES --- */
.burger-btn { display: none; }
.mobile-menu-overlay { display: none; }

@media (max-width: 768px) {
    .desktop-nav { display: none !important; }

    .burger-btn {
        display: block;
        position: relative;
        z-index: 2000; 
        width: 30px; height: 20px;
        background: none; border: none; cursor: pointer; padding: 0;
    }

    .burger-btn span { position: absolute; left: 0; width: 100%; height: 2px; background-color: var(--gold); transition: all 0.3s ease; }
    .burger-btn span:first-child { top: 0; }
    .burger-btn span:last-child { bottom: 0; }

    .burger-btn.active span:first-child { transform: rotate(45deg); top: 9px; background-color: #fff; }
    .burger-btn.active span:last-child { transform: rotate(-45deg); bottom: 9px; background-color: #fff; }

    .mobile-menu-overlay {
        display: flex; flex-direction: column; justify-content: center; align-items: center;
        position: fixed; top: 0; left: 0; width: 100%; 
        
        /* FIX FOR IOS: Use dvh (dynamic height) instead of vh */
        height: 100vh; /* Fallback for old browsers */
        height: 100dvh; /* Modern mobile browsers */
        
        background: rgba(5, 5, 5, 0.98);
        backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
        z-index: 99;
        opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
    }
    .mobile-menu-overlay.active { opacity: 1; pointer-events: all; }

    .mobile-links { display: flex; flex-direction: column; gap: 30px; text-align: center; }
    .mobile-link { font-family: 'Cormorant Garamond', serif; font-size: 2rem; color: var(--text-main); text-decoration: none; transition: color 0.3s; }
    .mobile-link:hover { color: var(--gold); }

    .mobile-footer { 
        position: absolute; 
        width: 100%; 
        text-align: center;
        
        /* FIX FOR IOS: Safe Area Insets + Dynamic Bottom */
        bottom: 0;
        padding-bottom: calc(30px + env(safe-area-inset-bottom)); 
    }
    
    .mobile-lang { justify-content: center; margin-left: 0; border: none; padding: 0; }
}

/* --- RTL SUPPORT (ARABIC) --- */
/* This section automatically applies when <html dir="rtl"> is present */

[dir="rtl"] body {
    font-family: 'Tajawal', sans-serif;
    text-align: right;
}

[dir="rtl"] h1, 
[dir="rtl"] h2, 
[dir="rtl"] h3, 
[dir="rtl"] h4,
[dir="rtl"] .tag-num,
[dir="rtl"] .hero-title,
[dir="rtl"] .mobile-link,
[dir="rtl"] .gold-num {
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
}

[dir="rtl"] .lang-switcher {
    border-left: none;
    border-right: 1px solid rgba(255,255,255,0.2);
    margin-left: 0;
    margin-right: 20px;
    padding-left: 0;
    padding-right: 20px;
}

[dir="rtl"] .card-glass {
    text-align: right;
}

[dir="rtl"] .btn-text {
    direction: ltr; /* Arrows keep orientation */
}

/* Flip modal layout */
[dir="rtl"] .modal-list {
    padding-left: 0;
    padding-right: 20px;
}
[dir="rtl"] .close-modal {
    right: auto;
    left: 20px;
}
[dir="rtl"] .unknown-box {
    border-left: none;
    border-right: 2px solid #844;
}

/* Flip FAQ icons */
[dir="rtl"] .faq-question {
    flex-direction: row-reverse;
}

/* --- MODAL GALLERY (PRODUCT PHOTOS) --- */
.modal-gallery-container {
    width: 100%;
    margin: 25px 0;
    position: relative;
}

.modal-gallery-track {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch; /* Smooth scroll iOS */
    padding-bottom: 10px;
    
    /* Эффект "на весь экран" внутри модалки */
    margin-left: -30px;
    margin-right: -30px;
    padding-left: 30px;
    padding-right: 30px;
    
    /* Скрытие скроллбара */
    scrollbar-width: none; 
}

.modal-gallery-track::-webkit-scrollbar {
    display: none;
}

.modal-product-img {
    height: 180px; /* Фиксированная высота для аккуратности */
    width: auto;   /* Ширина подстроится */
    border-radius: 4px;
    scroll-snap-align: center;
    flex-shrink: 0;
    
    /* Стилизация под общий дизайн */
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.02);
    transition: border-color 0.3s;
}

.modal-product-img:hover {
    border-color: var(--gold-dim);
}

/* Опционально: подпись под галереей */
.gallery-caption {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: -5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
}

/* --- SLIDER NAVIGATION ARROWS (Desktop Only) --- */

/* 1. Главная обертка */
.slider-wrapper {
    position: relative; /* Чтобы стрелки позиционировались внутри этого блока */
    width: 100%;
}

/* 2. Сами стрелки */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 100; /* Высокий индекс, чтобы быть поверх карточек */
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; /* Скрыты, пока мышь не наведена */
}

/* 3. ВАЖНОЕ ИСПРАВЛЕНИЕ: Показываем стрелки при наведении на ОБЕРТКУ (wrapper), а не контейнер */
.slider-wrapper:hover .nav-arrow {
    opacity: 1;
}

.nav-arrow:hover {
    background: var(--gold);
    color: #000;
    box-shadow: 0 0 15px rgba(200, 164, 74, 0.3);
}

.prev-arrow { left: 10px; } /* Сдвинул чуть левее, чтобы не перекрывать контент */
.next-arrow { right: 10px; } /* Сдвинул чуть правее */

/* На мобильных скрываем */
@media (max-width: 768px) {
    .nav-arrow {
        display: none;
    }
}

/* --- LIGHTBOX (ZOOM IMAGE) --- */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: fadeIn 0.2s ease;
}

.lightbox-img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    transform: scale(0.9);
    animation: zoomIn 0.3s forwards ease;
}

@keyframes zoomIn {
    to { transform: scale(1); }
}

/* Курсор для картинок в галерее */
.modal-product-img {
    cursor: zoom-in;
    transition: transform 0.2s;
}
.modal-product-img:hover {
    transform: scale(1.02);
}

/* --- MODAL GALLERY NAVIGATION (Desktop) --- */
.modal-gallery-wrapper {
    position: relative; /* Чтобы стрелки позиционировались внутри */
    width: 100%;
}

.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.gallery-nav-btn:hover {
    background: var(--gold);
    color: #000;
}

.gallery-prev { left: -10px; }
.gallery-next { right: -10px; }

/* Скрываем стрелки на мобильных (там есть свайп) */
@media (max-width: 768px) {
    .gallery-nav-btn {
        display: none;
    }
}