:root {
    --bg-color: #f5f7fa;
    --hr-color: #ced7e1;
    --card-bg-color: #ffffff;
    --text-color: #1a202c;
    --text-light-color: #2a3549;
    --link-hover-bg: #f2f4f7;
    --link-border: #cbd5e0;
    --tag-bg-color: #e2e8f0;
    --tag-text-color: #4a5568;
    --tag-active-bg: #3465cf;
    --tag-active-text: #ffffff;
    --input-bg-color: #ffffff;
    --input-border-color: #cbd5e0;
    --input-focus-color: #3465cf;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a202c;
        --hr-color: #444f62;
        --card-bg-color: #2d3748;
        --text-color: #e2e8f0;
        --text-light-color: #a0aec0;
        --link-hover-bg: #333f54;
        --link-border: #4a5568;
        --tag-bg-color: #4a5568;
        --tag-text-color: #e2e8f0;
        --tag-active-bg: #6366f1;
        --tag-active-text: #e2e8f0;
        --input-bg-color: #2d3748;
        --input-border-color: #4a5568;
        --input-focus-color: #6366f1;
    }
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px 0;
    transition: background-color 0.3s ease;
}

.container {
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.info-section {
    padding: 30px;
    background-color: var(--card-bg-color);
    border-radius: 12px;
    border: 1px solid var(--link-border);
    margin-bottom: 20px;
    transition: background-color 0.3s ease;
}

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 20%;
    object-fit: cover;
    border: 1px solid var(--link-border);
    display: block;
    margin: 0 auto 15px auto;
    transition: border-color 0.3s ease;
}

a {
    color: var(--text-light-color);
}

h1 {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
    text-align: center;
}

h2 {
    color: var(--text-light-color);
    font-size: 16px;
    font-weight: 400;
    margin: 10px 0 0 0;
    transition: color 0.3s ease;
    text-align: center;
}

h3 {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 200;
    margin: 0;
    transition: color 0.3s ease;
    text-align: center;
}

.links-wrapper {
    display: grid;
    gap: 15px;
}

.link-group {
    display: grid;
    gap: 0;
    border: 1px solid var(--link-border);
    border-radius: 8px;
    overflow: hidden;
}

.link-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    background-color: var(--card-bg-color);
    border: none;
    text-decoration: none;
    color: var(--text-color);
    font-size: 16px;
    font-weight: 600;
    transition: all 0.1s ease-in-out;
    border-bottom: 1px solid var(--link-border);
}

.link-group > .link-button:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.link-button:hover {
    background-color: var(--link-hover-bg);
}

.link-group > .link-button:last-child {
    border-bottom: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.icon {
    margin-right: 12px;
    width: 22px;
    height: 22px;
    border: none;
}

@media (prefers-color-scheme: dark) {
    .icon {
        filter: invert(100%) brightness(120%) saturate(150%);
    }
}

.footer {
    margin-top: 20px;
    font-size: 14px;
    color: #718096;
    transition: color 0.3s ease;
}

@media (max-width: 500px) {
    body {
        padding: 0;
    }
    
    .container {
        padding: 0;
    }
    
    .info-section {
        padding: 20px;
        border-left: none;
        border-right: none;
    }
    
    .avatar {
        width: 80px;
        height: 80px;
        margin-left: auto;
        margin-right: auto;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .link-button {
        padding: 4px;
    }
    
    .icon {
        width: 20px;
        height: 20px;
    }
    
    .links-wrapper {
        gap: 10px;
    }
    
    /* ВИПРАВЛЕНО: Відновлення рамок і заокруглення */
    .link-group {
        border-radius: 8px;
        border-left: 1px solid var(--link-border);
        border-right: 1px solid var(--link-border);
    }
    
    /* ВИПРАВЛЕНО: Відновлення заокруглення для першої/останньої кнопки (якщо воно не працювало) */
    .link-group > .link-button:first-child {
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
    }
    
    .link-group > .link-button:last-child {
        border-bottom-left-radius: 8px;
        border-bottom-right-radius: 8px;
    }
}

@media print {
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
        min-height: auto;
        padding: 0;
        display: block;
    }
    
    .container {
        max-width: none;
        text-align: left;
        padding: 20px;
    }
    
    .info-section {
        padding: 0;
        margin-bottom: 20px;
        background: none;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 20px;
        border: none;
    }
    
    .avatar {
        display: block;
        width: 80px;
        height: 80px;
        border: 1px solid #ddd;
        border-radius: 50%;
        flex-shrink: 0;
        margin: 0;
    }
    
    h1 {
        font-size: 24px;
        font-weight: 600;
        color: #000000 !important;
        margin: 0;
        text-align: left;
    }
    
    h2 {
        font-size: 16px;
        font-weight: 400;
        color: #000000 !important;
        margin-top: 5px;
        text-align: left;
    }
    
    h3 {
        font-size: 12px;
        font-weight: 200;
        color: #000000 !important;
        margin-top: 0;
        text-align: left;
    }
    
    .footer {
        display: none;
    }
    
    .links-wrapper {
        display: block;
        gap: 0;
    }
    
    .link-group {
        display: block;
        border: none;
        margin-bottom: 5px !important;
    }
    
    .link-button {
        display: block;
        padding: 0;
        background-color: transparent !important;
        border: none !important;
        color: #0000ff !important;
        font-size: 18px;
        font-weight: 400;
        margin-bottom: 5px;
        text-align: left;
        text-decoration: underline;
    }
    
    .link-button .icon {
        display: none;
    }
    
    .link-button::after {
        content: " (" attr(href) ") ";
        font-size: 14px;
        color: #555555;
        text-decoration: none;
    }
}

/* Стилі для файлу "Блоґ" (Blog) */
header {
    display: none;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* 🛠️ ЗМЕНШЕНО: З 10px 20px на 6px 20px. Це єдина зміна для десктопа. */
    padding: 6px 20px;
    background-color: var(--card-bg-color);
    border-radius: 8px;
    border: 1px solid var(--link-border);
    
    /* ЗМІНА: Додаємо нижній відступ */
    margin-bottom: 20px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-avatar {
    width: 32px;
    height: 32px;
    margin-right: 4px;
    border-radius: 6px;
    object-fit: cover;
}

.nav-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
}

.nav-center {
    display: flex;
    gap: 15px;
}

.nav-link {
    color: var(--text-light-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    /* Залишаємо 5px 0, оскільки це не сильно впливає на загальну висоту nav-bar */
    padding: 5px 0; 
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--text-color);
}

.nav-link.active {
    color: var(--text-color);
    border-bottom: 2px solid var(--tag-active-bg);
    padding-bottom: 3px;
}

main {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

hr {
    border: none;
    border-top: 1px solid var(--hr-color);
}

.content-view {
    display: none;
    background-color: var(--card-bg-color);
    padding: 20px 30px;
    /* ЗМІНА: Повертаємо заокруглення 8px з усіх боків */
    border-radius: 8px;
    border: 1px solid var(--link-border);
    border-top: 1px solid var(--link-border); /* Залишаємо повну рамку */
    transition: background-color 0.3s ease;
}

.content-view.active {
    display: block;
}

.back-button {
    text-decoration: none;
    color: var(--text-light-color);
    font-size: 16px;
    font-weight: 600;
    transition: color 0.1s ease-in-out;
    margin-bottom: 15px;
    display: inline-block;
}

.back-button:hover {
    color: var(--text-color);
}

#search-container {
margin-bottom: 15px;
}

.search-icon-wrapper {
    position: relative;
}

#search-input {
width: 100%;
padding: 10px 16px 10px 40px;
font-family: 'Inter', sans-serif;
font-size: 15px;
border: 1px solid var(--input-border-color);
border-radius: 6px;
background-color: var(--input-bg-color);
color: var(--text-color);
transition: border-color 0.2s ease;
box-sizing: border-box;
}

#search-input::placeholder {
color: var(--text-light-color);
}

#search-input:focus {
outline: none;
border-color: var(--input-focus-color);
}

.search-icon-wrapper::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    background-image: url('/icons/search.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: invert(0);
    transition: filter 0.3s ease;
    width: 16px;
    height: 16px;
}

@media (prefers-color-scheme: dark) {
    .search-icon-wrapper::before {
        filter: invert(1);
    }
}

#tags-container {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 15px;
}

.tag-button {
    padding: 6px 14px;
    border-radius: 16px;
    border: 1px solid var(--link-border);
    background-color: var(--tag-bg-color);
    color: var(--tag-text-color);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.tag-button:hover {
    background-color: var(--link-hover-bg);
}

.tag-button.active {
    background-color: var(--tag-active-bg);
    color: var(--tag-active-text);
    border-color: var(--tag-active-bg);
}

nav#articles-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0px;
    border: 1px solid var(--link-border);
    border-radius: 8px; /* ЗМІНА: Повертаємо заокруглення для всього списку */
    overflow: hidden;
}

nav#articles-list li a {
    display: flex;
    flex-direction: column;
    padding: 15px 18px;
    background-color: var(--card-bg-color);
    border: none;
    text-decoration: none;
    color: var(--text-color);
    font-size: 16px;
    font-weight: 600;
    transition: all 0.1s ease-in-out;
}

nav#articles-list li:first-child a {
    border-top-left-radius: 8px; /* ЗМІНА: Повертаємо заокруглення для першого елемента */
    border-top-right-radius: 8px; /* ЗМІНА: Повертаємо заокруглення для першого елемента */
}

nav#articles-list li:not(:last-child) a {
    border-bottom: 1px solid var(--link-border);
}

nav#articles-list li:last-child a {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

nav#articles-list li a:hover {
    background-color: var(--link-hover-bg);
}

.no-articles {
    text-align: center;
    color: var(--text-light-color);
    padding-top: 20px;
}

.article-date-sidebar {
    font-size: 0.85em;
    color: var(--text-light-color);
    font-weight: 400;
    margin-bottom: 6px;
}

.article-tags-sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.article-tags-sidebar span {
    background-color: var(--tag-bg-color);
    color: var(--tag-text-color);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
}

.article-title {
    margin-top: 0;
    margin-bottom: 4px;
    text-align: left;
}

.article-date-main {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-light-color);
    margin: 0 0 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--link-border);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.tag {
    background-color: var(--tag-bg-color);
    color: var(--tag-text-color);
    font-size: 13px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 14px;
}

img, video {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    height: auto;
    display: block;
    margin: 15px 0;
    border-radius: 6px;
    border: 1px solid var(--link-border);
}

@media (max-width: 768px) {
    
    body {
        padding: 10px 10px;
    }
    
    main {
        padding: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .top-nav {
        /* 🛠️ ЗМЕНШЕНО: З 8px 15px на 5px 15px для мобілки */
        padding: 5px 15px;
        /* ЗМІНА: Повертаємо нижній відступ */
        margin-bottom: 15px;
        /* ЗМІНА: Встановлюємо заокруглення для ВСІХ кутів */
        border-radius: 8px;
        /* Повертаємо повний бордер */
        border: 1px solid var(--link-border);
        margin-top: 10px; 
    }
    
    .info-section {
        margin-top: 20px;
    }
    
    /* ВИПРАВЛЕННЯ: Відновлення рамок та заокруглень для блоків контенту */
    .content-view {
        padding: 20px 15px;
        /* ЗМІНА: Повертаємо заокруглення для ВСІХ кутів */
        border-radius: 8px; 
        border: 1px solid var(--link-border);
        border-top: 1px solid var(--link-border); /* Залишаємо повну рамку */
    }
    
    /* ЗМІНА: Стилізація списку статей nav#articles-list для окремого блоку */
    nav#articles-list ul {
        border-radius: 8px; /* Повертаємо заокруглення для всього списку */
        border: 1px solid var(--link-border);
        border-top: 1px solid var(--link-border); /* Залишаємо повну рамку */
    }
    
    /* Для випадку, коли article-list йде одразу після nav-bar */
    nav#articles-list {
        margin-bottom: 20px;
    }
    
    /* ВИПРАВЛЕННЯ: Тепер заокруглення для першого/останнього елемента ПОВЕРНУТІ */
    nav#articles-list li:first-child a {
        border-top-left-radius: 8px; 
        border-top-right-radius: 8px; 
    }
    nav#articles-list li:last-child a {
        border-bottom-left-radius: 8px;
        border-bottom-right-radius: 8px;
    }
    
    .back-button {
        margin-left: 0px;
    }
    
    .content-view iframe {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin: 15px 0;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}