/* ============================================
   КЕРЛИНГ КЛУБ ЯРОСЛАВЛЬ — FIXED VERSION
   ============================================ */

/* ========== ПЕРЕМЕННЫЕ ========== */
:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --text-dark: #2c3e50;
    --text-gray: #7f8c8d;
    --bg-light: #f5f9ff;
    --shadow-sm: 0 2px 8px rgba(0,0,0,.05);
    --shadow-md: 0 4px 20px rgba(0,0,0,.08);
    --radius: 8px;
}

/* ========== RESET ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;

    background-color: var(--bg-light);
    background-image:
        linear-gradient(90deg, transparent 19px, #0066cc 20px, transparent 21px),
        linear-gradient(0deg, transparent 19px, #0066cc 20px, transparent 21px);
    background-size: 20px 20px;
    background-attachment: fixed;
}

/* ========== ОБЩИЕ ЭЛЕМЕНТЫ ========== */
a {
    color: var(--primary);
    text-decoration: none;
    transition: .3s;
}

a:hover {
    color: var(--primary-dark);
}

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

/* ========== HEADER ========== */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    padding: .8rem 1rem;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

header.scrolled {
    box-shadow: var(--shadow-md);
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.logo-img {
    height: 50px;
    max-width: 180px;
    transition: .3s;
}

.logo-img:hover { opacity: .9; }

/* ========== NAVIGATION ========== */
.nav-list {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    align-items: center;
}

.nav-list a {
    font-weight: 500;
    padding: .5rem .75rem;
    white-space: nowrap;
    color: var(--text-dark);
    border-bottom: 2px solid transparent; /* фикс высоты */
    transition: .2s;
}

.nav-list a:hover {
    color: var(--primary);
}

.nav-list a.active {
    color: var(--primary);
    font-weight: 600;
    border-bottom: 2px solid var(--primary);
}

/* ========== BURGER ========== */
.burger-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: 0;
    cursor: pointer;
}

.burger-line {
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    border-radius: 2px;
    transition: .3s;
}

.burger-toggle.active .burger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px,5px);
}
.burger-toggle.active .burger-line:nth-child(2) {
    opacity: 0;
}
.burger-toggle.active .burger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px,-5px);
}

/* ========== PAGE WRAPPER ========== */
main.page,
main > .content,
.gallery-page,
.news-single,
body > main:not(.page) {
    background: #fff;
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid #e0e0e0;
    flex: 1 0 auto;
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4 {
    margin-bottom: 1rem;
    line-height: 1.3;
}

h1 {
    font-size: 2rem;
    border-bottom: 3px solid var(--primary);
    padding-bottom: .5rem;
}

h2 { font-size: 1.5rem; margin-top: 1.5rem; }
h3 { font-size: 1.25rem; }

p, ul, ol { margin-bottom: 1rem; }
ul, ol { margin-left: 1.5rem; }

blockquote {
    border-left: 4px solid var(--primary);
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0 4px 4px 0;
    font-style: italic;
}

/* ========== NEWS ========== */
.news-item {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.news-item time {
    display: block;
    color: var(--text-gray);
    font-size: .9rem;
    margin-bottom: .5rem;
}

.news-item h2 { font-size: 1.3rem; }

.news-item .read-more {
    display: inline-block;
    margin-top: 1rem;
    font-weight: 500;
}

/* ========== GALLERY ========== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(300px,1fr));
    gap: 1.5rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/3;
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: .3s;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: .3s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* ========== LIGHTBOX ========== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.95);
    z-index: 2000;
}

.lightbox-content {
    max-width: 90%;
    max-height: 85vh;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    border-radius: var(--radius);
}

/* ========== FOOTER ========== */
footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: auto; /* прижимает вниз */
    border-top: 3px solid var(--primary);
    background: #fff;
}

/* ========== MOBILE ========== */
@media (max-width: 768px) {

    header {
        position: fixed;
        width: 100%;
    }

    body {
        padding-top: 70px;
        background-attachment: scroll;
        background-image:
            linear-gradient(90deg, transparent 14px, #0066cc 15px, transparent 16px),
            linear-gradient(0deg, transparent 14px, #0066cc 15px, transparent 16px);
        background-size: 15px 15px;
    }

    .burger-toggle { display: flex; }

    .nav-list {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 280px;
        flex-direction: column;
        padding: 80px 2rem;
        background: #fff;
        transition: .3s;
        box-shadow: var(--shadow-md);
    }

    .nav-list.active { right: 0; }

    .gallery-grid {
        grid-template-columns: repeat(2,1fr);
        gap: 1rem;
    }

    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.3rem; }
}

@media (max-width: 480px) {
    .gallery-grid { grid-template-columns: 1fr; }
    h1 { font-size: 1.4rem; }
}
