@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Syne:wght@400;700;800&display=swap');

/* ==========================================================================
   СВІТЛА ЖУРНАЛЬНА ПАЛІТРА (LIGHT GLOSSY MAGAZINE STYLE)
   ========================================================================== */
:root {
    --color-bg-paper: #FAFAFA;
    --color-bg-white: #FFFFFF;
    --color-bg-mint: #F0Fdf4;
    --color-bg-sky: #F0F9FF;
    
    --color-text-main: #1E293B;
    --color-text-muted: #64748B;
    
    --color-accent-teal: #0EA5E9;
    --color-accent-coral: #F97316;
    --color-accent-gold: #EAB308;
    --color-accent-green: #10B981;
    
    --font-display: 'Syne', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --grid-gap: 3rem;
    --section-padding: 8vw 5%;
}

html {
    scroll-behavior: smooth;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--color-bg-paper);
    color: var(--color-text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    line-height: 1.6;
    font-weight: 400;
}

h1, h2, h3 {
    font-family: var(--font-display);
    text-transform: uppercase;
    line-height: 1.05;
    color: var(--color-text-main);
}

a { color: inherit; text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--color-accent-teal); }

p { margin-bottom: 1.5rem; font-size: clamp(1rem, 1.1vw, 1.15rem); color: var(--color-text-muted); }

img { max-width: 100%; height: auto; display: block; }

.container {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.magazine-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--grid-gap);
    align-items: center;
}

/* --- ГЕРОЙ ЕКРАН (Hero Section) --- */
.hero {
    background-color: var(--color-bg-white);
    text-align: center;
    padding-top: 20vh;
    padding-bottom: 15vh;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- СТВОРЕННЯ ГОЛОВНОГО ХЕДЕРА --- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 5%;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: auto;
    background: transparent;
}

.main-header.scrolled {
    padding: 1rem 5%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 30px rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-logo {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    cursor: pointer;
}

.header-logo img {
    height: 80px;
    transition: height 0.4s ease;
}

.main-header.scrolled .header-logo img {
    height: 48px;
}

.hero-accordion {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    z-index: 1;
}

.accordion-item {
    flex: 1;
    background-size: cover;
    background-position: center;
    transition: flex 0.8s cubic-bezier(0.25, 1, 0.5, 1), filter 0.8s ease;
    filter: brightness(0.4) grayscale(50%);
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
}

.accordion-item:last-child {
    border-right: none;
}

.accordion-item.active {
    flex: 4;
    filter: brightness(1) grayscale(0%);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.6) 100%);
    pointer-events: none;
}

.hero-content {
    position: absolute;
    bottom: 6vh;
    left: 5%;
    max-width: 900px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    pointer-events: none;
    
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    border: none;
    box-shadow: none;
}

.header-logo span {
    font-family: 'Taurus', var(--font-display);
    font-size: 1.6rem;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    margin-bottom: 8px;
    transition: font-size 0.4s ease, margin-bottom 0.4s ease;
}

.main-header.scrolled .header-logo span {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.header-contacts {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.header-contacts a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.header-contacts a:hover {
    color: var(--color-accent-green);
}

.header-contacts svg {
    opacity: 0.8;
}

@media (max-width: 900px) {
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        padding: 1.5rem 5%;
    }
    .header-contacts {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .main-header.scrolled {
        padding: 1rem 5%;
        gap: 1rem;
    }
}

.hero-headline {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
    max-width: 100%;
    margin-left: 0;
    text-transform: none;
    line-height: 1.1;
    color: var(--color-accent-green);
    background: none;
    -webkit-text-fill-color: initial;
    filter: none;
    text-shadow: 0 4px 15px rgba(0,0,0,0.7), 0 2px 5px rgba(0,0,0,0.9);
}

.hero-subheadline {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.2vw, 1.2rem);
    color: rgba(255, 255, 255, 0.95);
    max-width: 100%;
    margin-left: 0;
    line-height: 1.6;
    margin-bottom: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-left: 4px solid var(--color-accent-green);
    padding: 0;
    padding-left: 1.5rem;
    border-radius: 0;
    box-shadow: none;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

/* --- ЗАГАЛЬНІ СТИЛІ ЕЛЕМЕНТІВ СПИСКУ --- */
.item-row {
    display: flex;
    align-items: stretch; /* Stretches the thumbnail to match text height */
    gap: 1.5rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, background 0.3s ease;
}

.item-row:hover {
    transform: translateX(10px);
}

.item-thumb-wrapper {
    width: 120px;
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
}

.item-thumb-wrapper a {
    display: block;
    width: 100%;
}

.item-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--color-bg-white);
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.02);
}

.item-info { 
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.item-info p:first-child { margin-bottom: 0.3rem; font-family: var(--font-display); font-size: 1.2rem; color: var(--color-text-main); }
.item-info p.item-desc { font-size: 0.95rem; margin-bottom: 0; line-height: 1.5; }

/* --- MODERN UNIVERSAL CATEGORY SECTION --- */
.section-category {
    padding: var(--section-padding);
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.category-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    max-width: 1500px;
}

/* Right alignment reverse order */
.section-category.align-right .category-text { order: 2; }
.section-category.align-right .category-images { order: 1; }

.category-text h2 {
    font-size: clamp(2.5rem, 4vw, 4.5rem);
    margin-bottom: 2rem;
}

.category-images {
    position: relative;
    width: 100%;
}

.category-img-main {
    width: 85%;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    background: #fff;
    border: 4px solid transparent;
}

.category-img-secondary {
    position: absolute;
    bottom: -15%;
    right: 0;
    width: 65%;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    border: 4px solid transparent;
    background: #fff;
}

.section-category.align-right .category-img-main {
    margin-left: 15%;
}
.section-category.align-right .category-img-secondary {
    right: auto;
    left: 0;
}

/* --- THEMES --- */

/* 1. Wind (Soft Mint/Gray) */
.theme-wind { background: linear-gradient(135deg, #F8FAFC 0%, var(--color-bg-paper) 100%); }
.theme-wind h2 { color: var(--color-accent-teal); }
.theme-wind .category-img-secondary { border-color: #F8FAFC; }

/* 2. Water (Deep Royal Blue) */
.theme-water { background-color: #0F172A; color: #FFFFFF; }
.theme-water h2 { color: #38BDF8; }
.theme-water p, .theme-water .item-desc { color: #94A3B8; }
.theme-water .item-info p:first-child { color: #FFFFFF; }
.theme-water .item-row { border-bottom-color: rgba(255,255,255,0.1); }
.theme-water .item-thumb { background: #1E293B; border-color: rgba(255,255,255,0.1); }
.theme-water .category-img-secondary { border-color: #0F172A; }

/* 3. Solar (Sunny Coral/Yellow) */
.theme-solar { background-color: #FFF7ED; }
.theme-solar h2 { color: var(--color-accent-coral); }
.theme-solar .category-img-secondary { border-color: #FFF7ED; }

/* 4. Electro (Vibrant Teal/Green background) */
.theme-electro { background-color: #E0F2FE; }
.theme-electro h2 { color: var(--color-text-main); }
.theme-electro .item-row { border-bottom-color: rgba(0,0,0,0.08); }
.theme-electro .category-img-secondary { border-color: #E0F2FE; }

/* 5. Hybrid (Dark Slate) */
.theme-hybrid { background-color: #1E293B; color: #F8FAFC; }
.theme-hybrid h2 { color: var(--color-accent-gold); }
.theme-hybrid p, .theme-hybrid .item-desc { color: #CBD5E1; }
.theme-hybrid .item-info p:first-child { color: #F8FAFC; }
.theme-hybrid .item-row { border-bottom-color: rgba(255,255,255,0.1); }
.theme-hybrid .item-thumb { background: #334155; border-color: rgba(255,255,255,0.1); }
.theme-hybrid .category-img-secondary { border-color: #1E293B; }

/* 6. Generic (White Paper) */
.theme-generic { background-color: #FFFFFF; }
.theme-generic h2 { color: var(--color-accent-green); }
.theme-generic .category-img-secondary { border-color: #FFFFFF; }

/* --- Auth (maintenance lock) --- */
.maintenance-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-paper);
}

.maintenance-card {
    text-align: center;
    max-width: 400px;
    padding: 3rem;
}

.maintenance-card h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.maintenance-card p {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.password-form input {
    padding: 0.8rem 1rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 1rem;
}

.password-form button {
    padding: 0.8rem 2rem;
    background: var(--color-accent-teal);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}

.error-msg {
    color: var(--color-accent-coral);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* --- Article/Item Page --- */
.item-page-nav {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 1.5rem 5%;
    background: var(--color-bg-white);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.item-page-nav img { height: 36px; }
.item-page-nav span {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--color-text-main);
}

.article-header {
    padding: 3rem 5%;
    max-width: 900px;
    margin: 0 auto;
}

.back-link {
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--color-accent-teal);
    display: inline-block;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: var(--font-display);
    font-weight: 600;
}
.back-link::before { content: '← '; }

.article-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.article-divider {
    width: 60px;
    height: 3px;
    background: var(--color-accent-teal);
    margin: 1.5rem 0;
    border-radius: 2px;
}

.markdown-body {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 5% 4rem;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-text-muted);
}

.markdown-body p { margin-bottom: 1.2rem; }
.markdown-body h2 { font-size: 1.5rem; margin: 2.5rem 0 1rem; color: var(--color-text-main); }
.markdown-body h3 { font-size: 1.2rem; margin: 2rem 0 0.8rem; color: var(--color-text-main); }
.markdown-body img { width: 100%; margin: 2rem 0; border-radius: 12px; }
.markdown-body ul, .markdown-body ol { margin-bottom: 1.2rem; padding-left: 1.5rem; }
.markdown-body li { margin-bottom: 0.3rem; }
.markdown-body strong { color: var(--color-text-main); }

/* --- Спеціальна секція Модулі (Minimalist Grid) --- */
.theme-modules {
    background-color: var(--color-bg-white);
    padding-top: 5rem;
    padding-bottom: 5rem;
}

.container-modules h2 {
    text-align: center;
    margin-bottom: 4rem;
    font-size: 2.5rem;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2.5rem;
    align-items: start;
}

.module-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s ease;
    text-decoration: none;
}

.module-card:hover {
    transform: translateY(-8px);
}

.module-img-wrapper {
    width: 100%;
    aspect-ratio: 1; /* Square thumbnails */
    background: #fff;
    border-radius: 12px;
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.02);
    padding: 1rem; /* PDF might have white bg, add padding for breathing room */
}

.module-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Keep full diagram visible inside the square */
}

.module-title {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-text-main);
    transition: color 0.3s ease;
}

.module-card:hover .module-title {
    color: var(--color-accent-teal);
}

/* --- Footer --- */
.catalog-footer {
    padding: 3rem 5%;
    text-align: center;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-main);
    background: var(--color-bg-white);
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* --- SCROLL REVEAL ANIMATIONS --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}
.reveal.delay-1 { transition-delay: 0.1s; }
.reveal.delay-2 { transition-delay: 0.2s; }
.reveal.delay-3 { transition-delay: 0.3s; }

/* --- Адаптивність --- */
@media (max-width: 1024px) {
    .hero-accordion {
        flex-direction: column;
    }
    .accordion-item {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }
    .accordion-item.active {
        flex: 3;
    }

    .section-category {
        min-height: auto;
        padding-top: 5rem;
        padding-bottom: 5rem;
    }

    .category-container { 
        grid-template-columns: 1fr; 
        gap: 3rem; 
    }
    
    .section-category.align-right .category-text { order: 1; }
    
    /* Hide big images on mobile for maximum minimalism and information focus */
    .category-images { 
        display: none !important; 
    }
}