:root {
    --bg-color: #f3f6f1;
    --card-bg: #ffffff;
    --text-color: #293b31;
    --text-muted: #69796e;
    --accent: #527747;
    --accent-dark: #3f6136;
    --accent-light: #eaf0e6;
    --border: #dce4d8;
    --shadow: 0 12px 35px rgba(39, 62, 43, 0.09);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: clamp(10px, 3vw, 32px);
    background: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.7;
}

.container {
    width: 100%;
    max-width: 1360px;
    margin: 0 auto;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid rgba(220, 228, 216, 0.8);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

a {
    color: var(--accent-dark);
}

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

button,
input {
    font: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid #92b77f;
    outline-offset: 3px;
}

header {
    padding: clamp(24px, 4vw, 48px) clamp(18px, 5vw, 60px);
    text-align: center;
    background: linear-gradient(135deg, #e8efe2, #f7f8f3);
    border-bottom: 1px solid var(--border);
}

header h1 {
    margin: 0;
    color: var(--accent-dark);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.035em;
}

header p {
    max-width: 650px;
    margin: 14px auto 0;
    color: var(--text-muted);
    font-size: clamp(0.95rem, 2vw, 1.12rem);
}

nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 16px clamp(12px, 3vw, 28px);
    background: #fff;
    border-bottom: 1px solid var(--border);
}

nav button {
    min-height: 44px;
    padding: 10px 19px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--text-color);
    font-size: 0.96rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease,
        border-color 0.2s ease;
}

nav button:hover {
    background: var(--accent-light);
    color: var(--accent-dark);
}

nav button.active {
    background: var(--accent);
    color: #fff;
}

nav button:active {
    transform: translateY(1px);
}

main {
    padding: clamp(20px, 4vw, 54px);
}

section {
    width: 100%;
}

h2,
h3,
h4 {
    color: var(--accent-dark);
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
    line-height: 1.3;
}

h2 {
    margin: 0 0 24px;
    font-size: clamp(1.7rem, 3.5vw, 2.5rem);
}

h3 {
    margin: 0 0 14px;
    font-size: clamp(1.25rem, 2.5vw, 1.7rem);
}

h4 {
    font-size: 1.15rem;
}

p {
    margin-top: 0;
}

section p {
    color: var(--text-muted);
}

section img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
}

.card,
.poem,
.question,
.story-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
}

.card,
.poem,
.question {
    padding: clamp(18px, 3vw, 28px);
}

.poem,
.question,
.story-card {
    margin-bottom: 22px;
}


.home-content,
.home-grid,
.main-content {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: start;
    gap: clamp(22px, 4vw, 48px);
}

.home-content img,
.home-grid img,
.main-content img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: var(--radius);
}

.poems,
.poems-container,
.questions,
.questions-container,
.stories,
.stories-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
}

.poem,
.question {
    margin: 0;
    box-shadow: 0 5px 18px rgba(39, 62, 43, 0.04);
}

.poem {
    border-left: 3px solid #a9bd9d;
}

.poem p {
    white-space: pre-line;
    line-height: 1.85;
}

.poem h3,
.question h3 {
    margin-bottom: 12px;
}


.tab-content {
    display: none;
    animation: page-appear 0.25s ease;
}

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

.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: center;
    gap: clamp(24px, 4vw, 50px);
}

.grid-2 > * {
    min-width: 0;
}

.image-card {
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--accent-light);
}

.image-card img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.faq-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.faq-item {
    min-width: 0;
    padding: clamp(18px, 3vw, 28px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 5px 18px rgba(39, 62, 43, 0.04);
}

.faq-item h3,
.faq-item h4 {
    margin-top: 0;
}

@keyframes page-appear {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.story-card {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 6px 22px rgba(39, 62, 43, 0.05);
}

.story-img {
    min-height: 260px;
    overflow: hidden;
    background: var(--accent-light);
}

.story-img img {
    width: 100%;
    height: 100%;
    min-height: 260px;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.story-card:hover .story-img img {
    transform: scale(1.025);
}

.story-body {
    align-self: center;
    min-width: 0;
    padding: clamp(20px, 3.5vw, 36px);
}

.story-body h3 {
    margin-top: 0;
}

.story-body p {
    line-height: 1.8;
}

footer {
    padding: 26px 20px;
    border-top: 1px solid var(--border);
    background: #f7f8f3;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.92rem;
}


.login-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 38px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 8px 28px rgba(39, 62, 43, 0.06);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form label {
    color: var(--text-color);
    font-weight: 600;
}

.login-input {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid #cbd7c7;
    border-radius: 10px;
    background: #fbfcfa;
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(82, 119, 71, 0.12);
    outline: none;
}

.login-btn {
    min-height: 48px;
    padding: 12px 20px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.login-btn:hover {
    background: var(--accent-dark);
}

.login-btn:active {
    transform: translateY(1px);
}


@media (max-width: 900px) {
    body {
        padding: 14px;
    }

    .grid-2,
    .home-content,
    .home-grid,
    .main-content {
        grid-template-columns: minmax(0, 1fr);
    }

    .image-card img {
        height: 340px;
    }

    .story-card {
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    }

    .story-img,
    .story-img img {
        min-height: 230px;
    }

    .poems,
    .poems-container,
    .questions,
    .questions-container,
    .stories,
    .stories-container {
        grid-template-columns: minmax(0, 1fr);
    }

    main {
        padding: 30px;
    }
}


@media (max-width: 600px) {
    body {
        padding: 6px;
        font-size: 15px;
    }

    .container {
        border-radius: 13px;
    }

    header {
        padding: 28px 16px;
    }

    header h1 {
        letter-spacing: -0.025em;
    }

    nav {
        gap: 6px;
        padding: 12px 8px;
    }

    nav button {
        min-height: 42px;
        padding: 9px 13px;
        font-size: 0.9rem;
    }

    main {
        padding: 22px 16px;
    }

    h2 {
        margin-bottom: 18px;
    }

    .image-card img {
        height: 260px;
    }

    .faq-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .story-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .story-img,
    .story-img img {
        width: 100%;
        height: 230px;
        min-height: 0;
    }

    .story-body {
        padding: 22px 18px;
    }

    .login-container {
        padding: 20px 16px;
    }

    .poem,
    .question {
        padding: 20px 17px;
    }

    footer {
        padding: 22px 14px;
    }
}


@media (max-width: 360px) {
    header h1 {
        font-size: 1.8rem;
    }

    nav button {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    main {
        padding: 18px 12px;
    }

    .story-body {
        padding: 18px 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Уточнения для реальной разметки сайта */
.container {
    width: 100%;
    max-width: 1360px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
}

header .subtitle {
    max-width: 650px;
    margin: 14px auto 0;
    color: var(--text-muted);
    font-size: clamp(0.95rem, 2vw, 1.12rem);
}

/* --- добавлено: счётчики в вкладках, служебные классы, поведение картинок --- */
.tab-btn .count {
    opacity: 0.55;
    font-size: 0.92em;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tab-btn:focus-visible {
    outline: 2px solid var(--accent-dark);
    outline-offset: 3px;
}

.site-footer {
    margin-top: 28px;
}

.site-footer a {
    color: var(--accent-dark);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}
