/* ============================================================
   Crassula Lab — Энциклопедия толстянок
   Палитра: кремовый #F9F8F6, хвоя #2C4C3B, терракота #C86D51,
   графит #22252A. Mobile-first.
   ============================================================ */

:root {
    --cream: #F9F8F6;
    --cream-deep: #F1EFE9;
    --pine: #2C4C3B;
    --pine-dark: #22392D;
    --pine-soft: #4A6B57;
    --terracotta: #C86D51;
    --terracotta-soft: #E7B3A2;
    --ink: #22252A;
    --muted: #6A6F76;
    --line: rgba(44, 76, 59, 0.14);
    --card: #FFFFFF;
    --shadow-sm: 0 6px 18px rgba(34, 37, 42, 0.06);
    --shadow-md: 0 18px 40px rgba(34, 37, 42, 0.12);
    --radius: 18px;
    --radius-sm: 12px;
    --container: 1160px;
    --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--cream);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

a { color: var(--pine); text-decoration: none; }
a:hover { color: var(--terracotta); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.12; color: var(--pine); margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.7rem, 4.4vw, 2.5rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }

.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;
}

.skip-link {
    position: absolute; left: -999px; top: 0; z-index: 100;
    background: var(--pine); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.eyebrow {
    display: inline-block;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--terracotta);
    margin-bottom: 12px;
}

/* ================= Buttons ================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--sans); font-size: .95rem; font-weight: 600;
    padding: 13px 24px; border-radius: 999px; border: 1.5px solid transparent;
    cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
    line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--pine); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--pine-dark); color: #fff; box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--pine); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--pine); color: var(--pine); background: rgba(44,76,59,.05); }
.btn-light { background: rgba(255,255,255,.9); color: var(--pine); }
.btn-light:hover { background: #fff; color: var(--pine); }

/* ================= Header ================= */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(249, 248, 246, 0.88);
    backdrop-filter: saturate(150%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }

.logo { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.logo:hover { color: var(--ink); }
.logo-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 13px;
    background: var(--cream-deep); border: 1px solid var(--line);
}
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text strong { font-family: var(--serif); font-size: 1.35rem; color: var(--pine); font-weight: 700; }
.logo-text em { font-style: normal; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.main-nav { display: flex; align-items: center; gap: 28px; }
.main-nav a { font-size: .95rem; font-weight: 500; color: var(--ink); position: relative; }
.main-nav a::after {
    content: ""; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0;
    background: var(--terracotta); transition: width .22s ease;
}
.main-nav a:hover { color: var(--pine); }
.main-nav a:hover::after { width: 100%; }

.nav-toggle {
    display: none; flex-direction: column; gap: 5px; width: 44px; height: 44px;
    align-items: center; justify-content: center; background: transparent;
    border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.nav-toggle span { width: 20px; height: 2px; background: var(--pine); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ================= Hero ================= */
.hero { padding: 44px 0 26px; }
.hero-inner { display: grid; gap: 30px; align-items: center; }
.hero-copy .lead { font-size: 1.08rem; color: #3d4249; max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 26px; }

.hero-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 26px; padding: 0; margin: 0; border-top: 1px solid var(--line); padding-top: 20px; }
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-family: var(--serif); font-size: 1.9rem; color: var(--pine); line-height: 1; }
.hero-stats span { font-size: .82rem; color: var(--muted); }

.hero-media { margin: 0; position: relative; }
.hero-media img {
    width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
    border-radius: var(--radius); box-shadow: var(--shadow-md);
}
.hero-media figcaption {
    margin-top: 12px; font-size: .82rem; color: var(--muted); text-align: center;
}

/* ================= Sections ================= */
.section { padding: 64px 0; }
.section-alt { background: var(--cream-deep); }
.section-head { max-width: 720px; margin-bottom: 34px; }
.section-head--row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; justify-content: space-between; max-width: none; }
.section-head--row > div { max-width: 640px; }
.section-sub { color: var(--muted); margin: 0; }

/* ================= Filters ================= */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.filter {
    font-family: var(--sans); font-size: .88rem; font-weight: 600;
    padding: 9px 18px; border-radius: 999px; cursor: pointer;
    background: #fff; color: var(--pine); border: 1px solid var(--line);
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.filter:hover { border-color: var(--pine); }
.filter.is-active { background: var(--pine); color: #fff; border-color: var(--pine); }

/* ================= Species cards ================= */
.card-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }

.species-card {
    background: var(--card); border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--line); box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column;
    transition: transform .2s ease, box-shadow .2s ease;
}
.species-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.species-card.is-hidden { display: none; }

.species-media { position: relative; }
.species-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.badge {
    position: absolute; top: 12px; left: 12px;
    font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    padding: 6px 12px; border-radius: 999px; color: #fff;
}
.badge--easy { background: var(--pine-soft); }
.badge--medium { background: var(--terracotta); }
.badge--hard { background: #8A4B37; }

.species-body { padding: 20px 20px 22px; display: flex; flex-direction: column; flex: 1; }
.species-latin { font-size: .82rem; font-style: italic; color: var(--terracotta); margin: 0 0 4px; }
.species-body h3 { margin: 0 0 8px; font-size: 1.28rem; }
.species-desc { font-size: .94rem; color: var(--muted); margin: 0 0 16px; }
.species-meta { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.species-meta li {
    font-size: .78rem; color: var(--pine); background: rgba(44,76,59,.08);
    padding: 5px 11px; border-radius: 999px;
}
.species-body .btn { margin-top: auto; align-self: flex-start; }

/* ================= Articles ================= */
.article-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
.article-card {
    background: var(--card); border-radius: var(--radius); padding: 26px 24px;
    border: 1px solid var(--line); box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; transition: transform .2s ease, box-shadow .2s ease;
}
.article-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.article-card .article-tag { font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--terracotta); }
.article-card h3 { margin: 10px 0 12px; }
.article-card p { color: var(--muted); font-size: .95rem; }
.article-card .read-link {
    margin-top: auto; font-weight: 600; color: var(--pine); background: none; border: none;
    padding: 0; cursor: pointer; font-family: var(--sans); font-size: .95rem;
    display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
}
.article-card .read-link:hover { color: var(--terracotta); }
.article-card .read-link::after { content: "→"; transition: transform .2s ease; }
.article-card .read-link:hover::after { transform: translateX(4px); }

/* ================= Blog ================= */
.blog-list { display: grid; gap: 18px; grid-template-columns: 1fr; }
.blog-post {
    background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--terracotta);
    border-radius: var(--radius-sm); padding: 22px 22px; box-shadow: var(--shadow-sm);
}
.blog-post h3 { margin: 0 0 6px; font-size: 1.2rem; }
.blog-post time { font-size: .8rem; color: var(--muted); display: block; margin-bottom: 10px; }
.blog-post p { margin: 0; color: #3d4249; }
.blog-post .blog-del {
    margin-top: 12px; background: none; border: none; color: var(--muted);
    font-size: .82rem; cursor: pointer; padding: 0; font-family: var(--sans);
}
.blog-post .blog-del:hover { color: var(--terracotta); }

.blog-empty {
    text-align: center; padding: 46px 24px; border: 1.5px dashed var(--line);
    border-radius: var(--radius); background: rgba(255,255,255,.5);
}
.blog-empty__icon { display: inline-flex; margin-bottom: 8px; }
.blog-empty h3 { margin: 0 0 8px; }
.blog-empty p { color: var(--muted); max-width: 46ch; margin: 0 auto; }

/* ================= Footer ================= */
.site-footer { background: var(--pine); color: #E9EEE9; padding: 54px 0 26px; margin-top: 30px; }
.site-footer h3 { color: #fff; }
.site-footer a { color: #F4D9CE; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; gap: 34px; }
.footer-about p { color: #CBD8CE; font-size: .95rem; max-width: 52ch; }
.footer-meta { font-size: .92rem; }
.logo-mark--light { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); margin-bottom: 12px; }

.footer-subscribe p { color: #CBD8CE; font-size: .95rem; max-width: 46ch; }
.subscribe-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; }
.subscribe-row input {
    flex: 1 1 220px; min-width: 0; padding: 13px 18px; border-radius: 999px;
    border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08);
    color: #fff; font-family: var(--sans); font-size: .95rem;
}
.subscribe-row input::placeholder { color: #A9BCAF; }
.subscribe-row input:focus { outline: 2px solid var(--terracotta-soft); outline-offset: 1px; }
.subscribe-row .btn-primary { background: var(--terracotta); }
.subscribe-row .btn-primary:hover { background: #B65C40; }
.form-hint { min-height: 22px; font-size: .88rem; color: var(--terracotta-soft); margin: 0; }
.form-hint.is-ok { color: #B6E2C2; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; font-size: .92rem; }

.footer-bottom {
    display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
    margin-top: 36px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.15);
    font-size: .84rem; color: #A9BCAF;
}

/* ================= Modal ================= */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(24, 32, 27, .55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .25s ease; }
.modal.is-open .modal-overlay { opacity: 1; }
.modal-dialog {
    position: relative; background: var(--cream); width: 100%; max-width: 720px;
    max-height: 90vh; overflow-y: auto; border-radius: 22px 22px 0 0;
    box-shadow: var(--shadow-md); transform: translateY(24px); opacity: 0;
    transition: transform .28s ease, opacity .28s ease;
}
.modal.is-open .modal-dialog { transform: translateY(0); opacity: 1; }
.modal-close {
    position: absolute; top: 14px; right: 14px; z-index: 2;
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
    background: rgba(255,255,255,.9); color: var(--pine); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: #fff; color: var(--terracotta); }
.modal-body { padding: 30px 24px 34px; }

.modal-hero { border-radius: 16px; overflow: hidden; margin: 0 0 20px; }
.modal-hero img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.modal-body .modal-latin { font-style: italic; color: var(--terracotta); font-size: .9rem; margin: 0 0 4px; }
.modal-body h2 { margin: 0 0 10px; font-size: 1.9rem; }
.modal-body .modal-intro { color: #3d4249; }

.care-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 22px 0 0; }
.care-item {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 16px 18px;
}
.care-item dt { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--pine); margin-bottom: 4px; font-size: .95rem; }
.care-item dd { margin: 0; font-size: .92rem; color: #3d4249; }
.care-icon { font-size: 1.05rem; }

.modal-body .article-body p { color: #3d4249; }
.modal-body .article-body h3 { margin-top: 1.4em; font-size: 1.25rem; }
.modal-body .article-body ul { color: #3d4249; padding-left: 1.2em; }
.modal-body .article-body li { margin-bottom: .4em; }
.modal-body .article-body blockquote {
    margin: 1.2em 0; padding: 12px 18px; border-left: 3px solid var(--terracotta);
    background: var(--cream-deep); border-radius: 0 12px 12px 0; font-style: italic; color: var(--pine);
}

/* Form inside modal (blog composer) */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .9rem; font-weight: 600; color: var(--pine); margin-bottom: 6px; }
.field input, .field textarea {
    width: 100%; padding: 13px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: #fff; font-family: var(--sans);
    font-size: .95rem; color: var(--ink); resize: vertical;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--pine-soft); outline-offset: 1px; border-color: var(--pine-soft); }
.modal-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

/* ================= Responsive ================= */
@media (min-width: 640px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); }
    .article-grid { grid-template-columns: repeat(2, 1fr); }
    .blog-list { grid-template-columns: repeat(2, 1fr); }
    .care-grid { grid-template-columns: repeat(2, 1fr); }
    .modal { align-items: center; padding: 24px; }
    .modal-dialog { border-radius: 22px; }
    .modal-body { padding: 34px 32px 38px; }
}

@media (min-width: 900px) {
    .hero { padding: 70px 0 40px; }
    .hero-inner { grid-template-columns: 1.05fr .95fr; gap: 56px; }
    .hero-media img { aspect-ratio: 4 / 4.6; }
    .section { padding: 84px 0; }
    .card-grid { grid-template-columns: repeat(3, 1fr); }
    .article-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: 1.1fr 1fr; gap: 60px; }
    .care-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 899px) {
    .main-nav {
        position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 0;
        background: var(--cream); border-bottom: 1px solid var(--line);
        padding: 8px 20px 16px; box-shadow: var(--shadow-sm);
        transform: translateY(-8px); opacity: 0; pointer-events: none;
        transition: opacity .2s ease, transform .2s ease;
    }
    .main-nav.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
    .main-nav a { padding: 14px 0; border-bottom: 1px solid var(--line); }
    .main-nav a:last-child { border-bottom: none; }
    .main-nav a::after { display: none; }
    .nav-toggle { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; animation: none !important; }
}
