/* ==========================================================================
   Ерөнхий тохиргоо
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    touch-action: pan-y;
    overflow-x: hidden;
}

body {
    font-family: Arial, sans-serif;
    background-color: #ffffff;
    color: #000000;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0 40px;
    touch-action: pan-y;
    overflow-x: hidden;
    max-width: 100vw;
}

/* ==========================================================================
   Бүх зургийг татаж авах / хадгалахаас хамгаалах (утас, компьютер аль алинд нь)
   ========================================================================== */
img {
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Утас дээр удаан дараад "Зураг татах" цэс гарахаас сэргийлнэ.
       Товч, слайдер зэрэг дээр дарах боломж алдагдахгүй,
       учир нь тухайн товч/цонх нь өөр элемент дээр байрладаг. */
    pointer-events: none;
}

/* ==========================================================================
   Дээд талын цэсүүд
   ========================================================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;       
    font-weight: bold;     
    line-height: 1.5;
    padding: 30px 40px 20px 40px;
    background: transparent;
    z-index: 100;
}

.header-left {
    display: flex;
}

.top-right {
    display: flex;
    gap: 30px;
}

.nav-item {
    cursor: pointer;
}

.nav-item:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Хөл хэсэг (4 булан)
   ========================================================================== */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    font-size: 18px;       
    font-weight: bold;     
    line-height: 1.5;
    padding: 20px 40px 30px 40px;
    background: transparent;
    z-index: 100;
}

.bottom-left {
    display: flex;
    flex-direction: column;
}

#reference-btn:hover {
    text-decoration: underline;
}

.bottom-right {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.footer-email {
    color: #000000;
    text-decoration: none;
}

.footer-email:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Голын зураг
   ========================================================================== */
.gallery {
    background-color: #ffffff;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

.image-container img {
    max-height: 550px;
    max-width: 100%;
    object-fit: contain;
    display: block;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* ==========================================================================
   Шууд доошоо дэлгэгдэх хэсгүүдийн CSS тохиргоо
   ========================================================================== */
.reference-section {
    max-height: 0; 
    overflow: hidden;
    background-color: #ffffff;
}

.reference-section.active {
    padding: 40px 0;
}

.content-wrapper {
    max-width: 1500px; 
    margin: 0 auto; 
    width: 100%;
    padding: 0 20px; 
}

.reference-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    position: relative;
}

.content-wrapper h2 {
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.close-x {
    font-size: 34px;       
    color: #000000;        
    cursor: pointer;
    font-weight: 300;      
    line-height: 1;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.close-x:hover {
    opacity: 0.5;          
    transform: scale(1.05); 
}

/* ==========================================================================
   PROJECTS ЦЭСНИЙ МИНИМАЛИСТ ДИЗАЙН
   ========================================================================== */
.projects-container {
    margin-top: 10px;
}

.project-item {
    width: 100%;
}

/* Нэг төсөл нээгдэхэд бусад нь нуугдана */
.projects-container.has-open .project-item:not(.open) {
    display: none;
}

.back-to-projects {
    display: none;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.5px;
    cursor: pointer;
    margin-bottom: 20px;
}

.back-to-projects:hover {
    text-decoration: underline;
}

.back-to-projects.visible {
    display: inline-block;
}

.project-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 0.5px;
    gap: 12px;
}

.project-name {
    word-break: break-word;
    overflow-wrap: break-word;
}

.project-title-bar:hover .project-name {
    text-decoration: underline;
}

.toggle-icon {
    font-size: 20px;
    font-weight: 300;
}

.project-details {
    display: none;
    padding: 10px 0 40px 0;
}

.project-item.open .project-details {
    display: block;
}

.project-meta {
    font-size: 14px;
    line-height: 2;
    margin-bottom: 25px;
}

.project-meta strong {
    display: inline-block;
    width: 90px;
    text-transform: lowercase;
}

.project-description {
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 10px;
    text-align: justify;
    word-break: break-word;
    overflow-wrap: break-word;
}

.project-description p {
    display: block;
}

.project-description.clamped:not(.expanded) p {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.description-toggle {
    display: inline-block;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 25px;
}

.description-toggle:hover {
    text-decoration: underline;
}

.project-images img {
    width: auto;
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
    display: block;
    margin: 20px auto 0 auto;
}

/* ==========================================================================
   Бусад хэсгүүд
   ========================================================================== */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.news-item {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 20px;
}

.news-item:last-child {
    border-bottom: none;
}

.news-date {
    font-size: 13px;
    font-weight: bold;
    color: #888888;
    display: block;
    margin-bottom: 8px;
}

.news-item p {
    font-size: 14px;
    line-height: 1.8;
    color: #000000;
    text-align: justify;
    margin-bottom: 10px;
}

.news-link {
    font-size: 13px;
    color: #000000;
    text-decoration: none;
    font-weight: bold;
}

.news-link:hover {
    text-decoration: underline;
}

.bio-text h3 {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #000000;
}

.bio-text p {
    font-size: 14px;
    line-height: 1.9;
    color: #000000;
    text-align: justify;
}

.quotes-list > p {
    font-size: 14px;
    line-height: 1.8;       
    margin-bottom: 24px;    
    color: #000000;
    text-align: justify;         
    text-justify: inter-word;     
    word-break: break-word;       
}

.source-list {
    margin-top: 40px;       
    border-top: 1px solid #eeeeee; 
    padding-top: 30px;
}

.source-list p {
    font-size: 13px;        
    line-height: 1.3;       
    margin-bottom: 6px;     
    color: #333333;         
    text-align: left;       
    word-break: break-word;
}

/* ==========================================================================
   Минималист Зургийн Слайдер (Carousel)
   ========================================================================== */
.slider-container {
    position: relative;
    width: 100%;
    max-height: 280px;
    margin-top: 20px;
    overflow: hidden;
}

.slider-slides {
    position: relative;
    width: 100%;
    height: 280px; 
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
}

.slider-slides img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.0s ease-in-out; 
    z-index: 1;
}

.slider-slides img.active {
    opacity: 1;
    z-index: 2;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #000000;
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    box-shadow: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    user-select: none;
}

.slider-btn:hover {
    opacity: 0.5;
    transform: translateY(-50%) scale(1.07);
}

.prev-btn { left: 14px; }
.next-btn { right: 14px; }

/* ==========================================================================
   Мэдээний зургийн тохиргоо (News Image) - ЗӨВ БАЙРШИЛ
   ========================================================================== */
.news-image {
    width: 100%;
    max-width: 500px; 
    margin: 15px 0 20px 0; 
    overflow: hidden;
    background-color: #ffffff;
}

.news-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* ==========================================================================
   Project зургийг томруулж харах цонх (Lightbox)
   ========================================================================== */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    cursor: zoom-out;
    /* Гар утаснаас pinch хийж зумлах боломжгүй болгосон */
    touch-action: none;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-overlay img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    /* Томруулсан зураг дээр pinch-zoom хийхэд саад болохгүй байхаар тохируулсан */
    pointer-events: none;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 28px;
    font-size: 42px;
    font-weight: 300;
    color: #000000;
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
}

.lightbox-close:hover {
    opacity: 0.7;
}

/* Lightbox доторх Дараагийн/Өмнөх зураг руу шилжих товчнууд */
.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #000000;
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    z-index: 1001;
    padding: 0;
    box-shadow: none;
    transition: opacity 0.2s ease, transform 0.15s ease;
    user-select: none;
    pointer-events: auto;
}

.lightbox-btn:hover {
    opacity: 0.6;
    transform: translateY(-50%) scale(1.07);
}

.lightbox-prev-btn { left: 16px; }
.lightbox-next-btn { right: 16px; }

@media (max-width: 768px) {
    .lightbox-btn {
        width: 42px;
        height: 42px;
        font-size: 26px;
    }
}

/* Project зургийг дарж болохыг харуулах курсор */
.project-images {
    cursor: zoom-in;
}

/* ==========================================================================
   Гар утасны тохиргоо (Responsive)
   ========================================================================== */
@media (max-width: 768px) {
    body {
        padding: 0 20px;
    }
    header, footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
        padding-left: 20px;
        padding-right: 20px;
    }
    .bottom-right {
        text-align: center;
    }
   .bio-text p:nth-child(2) {
    margin-top: 24px;
}
}

/* ==========================================================================
   Project нэр дээр курсор аваачихад нэрний яг доор гарч ирэх зураг (Hover preview)
   ========================================================================== */
.project-item {
    position: relative;
}

.hover-preview {
    position: absolute;
    left: 0;
    top: calc(100% - 8px);   /* нэрний доор шууд */
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.hover-preview.visible {
    opacity: 1;
}

.hover-preview img {
    display: block;
    max-width: min(420px, 100%);
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Утас, таблет (hover байхгүй төхөөрөмж) дээр ажиллахгүй */
@media (hover: none), (max-width: 768px) {
    .hover-preview { display: none; }
}
