:root {
    --bg: #f5efe4;
    --bg-soft: #fbf8f1;
    --paper: rgba(255, 251, 244, 0.82);
    --ink: #2d241b;
    --muted: #6c5e50;
    --line: rgba(76, 58, 43, 0.15);
    --gold: #b8893e;
    --gold-deep: #8b6320;
    --terracotta: #b75a3c;
    --green: #46604c;
    --success: #dff2e4;
    --error: #f8dede;
    --shadow: 0 24px 80px rgba(53, 40, 27, 0.12);
    --radius: 28px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(184, 137, 62, 0.24), transparent 28%),
        linear-gradient(180deg, #efe4cf 0%, var(--bg) 38%, #f8f2e8 100%);
    color: var(--ink);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.narrow {
    width: min(760px, calc(100% - 32px));
}

.article-wide {
    width: min(1120px, calc(100% - 32px));
}

.hero {
    position: relative;
    overflow: hidden;
    padding-bottom: 72px;
    background:
        linear-gradient(135deg, rgba(65, 49, 33, 0.92), rgba(101, 77, 45, 0.76)),
        url('../img/hero-bg.jpg') center/cover;
    color: #fff9ef;
}

.hero__veil {
    position: absolute;
    inset: auto -10% -120px auto;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(184, 137, 62, 0.38), rgba(184, 137, 62, 0));
    filter: blur(12px);
}

.hero__inner {
    position: relative;
    z-index: 1;
}

.hero__topbar,
.admin-header__inner,
.admin-toolbar,
.section-heading,
.site-footer__inner,
.contacts-grid,
.grid--about,
.form-grid__inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.hero__topbar {
    padding: 20px 0 12px;
}

.brand {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.7rem, 3vw, 2.5rem);
    letter-spacing: 0.02em;
}

.brand--small {
    font-size: 1.8rem;
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    width: 85%;
    justify-content: center;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.main-nav a,
.admin-nav a {
    opacity: 0.84;
}

.main-nav a.is-active,
.admin-nav a.is-active,
.main-nav a:hover,
.admin-nav a:hover {
    opacity: 1;
}

.hero__content {
    max-width: 720px;
    padding: 0;
}

.hero-logo {
    width: min(340px, 56vw);
    margin: 0 0 14px;
}

.hero-logo svg {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 6px 14px rgba(32, 18, 4, 0.36));
}

.hero-logo img {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 6px 14px rgba(32, 18, 4, 0.36));
}

.eyebrow {
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.24em;
    font-size: 0.78rem;
    color: rgba(255, 249, 239, 0.82);
}

.eyebrow--dark {
    color: var(--terracotta);
}

h1,
h2,
h3 {
    margin: 0 0 16px;
    font-family: 'Cormorant Garamond', serif;
    line-height: 0.98;
}

h1 {
    font-size: clamp(3.3rem, 8vw, 6.2rem);
}

h2 {
    font-size: clamp(2rem, 5vw, 3.2rem);
}

h3 {
    font-size: 1.7rem;
    color: var(--ink);
}

.card h3 {
    color: var(--gold-deep);
    border-bottom: 2px solid rgba(184, 137, 62, 0.2);
    padding-bottom: 12px;
}

p,
li,
input,
textarea,
button,
table {
    font-size: 1rem;
    line-height: 1.7;
}

.hero__lead,
.admin-subtitle {
    color: rgba(255, 249, 239, 0.82);
    max-width: 640px;
}

.hero__actions,
.form-actions,
.admin-table__actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.button,
button,
input,
textarea {
    font: inherit;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button:hover {
    transform: translateY(-2px);
}

.button--light {
    background: #fff8eb;
    color: var(--ink);
    box-shadow: var(--shadow);
}

.button--ghost,
.button--ghost-dark {
    background: transparent;
    border-color: rgba(255, 248, 235, 0.45);
    color: #fff8eb;
}

.button--ghost-dark {
    border-color: var(--line);
    color: var(--ink);
}

.button--primary {
    background: linear-gradient(135deg, var(--gold) 0%, #d2a763 100%);
    color: #fffdf8;
    box-shadow: 0 16px 40px rgba(184, 137, 62, 0.35);
}

.text-link,
.button-link {
    color: var(--gold-deep);
    font-weight: 700;
    transition: opacity 0.2s ease;
}

.text-link:hover,
.button-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.button-link {
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.section {
    padding: 88px 0;
}

.section--floating {
    margin-top: -48px;
    position: relative;
    z-index: 2;
}

.section--warm {
    background: linear-gradient(180deg, rgba(183, 90, 60, 0.08), rgba(183, 90, 60, 0));
}

.grid,
.news-grid,
.contacts-grid {
    display: grid;
    gap: 24px;
}

.grid--about {
    grid-template-columns: 1.1fr 0.9fr;
}

.news-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.news-grid--community {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contacts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 32px 96px rgba(53, 40, 27, 0.16);
}

.card--accent {
    background: linear-gradient(135deg, rgba(255, 250, 241, 0.95), rgba(255, 241, 212, 0.88));
    border-top: 4px solid var(--gold);
}

.card--soft {
    background: rgba(255, 251, 244, 0.92);
    border-top: 4px solid var(--gold);
}

.card--notice {
    grid-column: 1 / -1;
}

.schedule-list,
.feature-list {
    margin: 0;
    padding-left: 18px;
    list-style: none;
}

.schedule-list li,
.feature-list li {
    margin-bottom: 12px;
    position: relative;
    padding-left: 12px;
}

.schedule-list li::before,
.feature-list li::before {
    content: '✦';
    position: absolute;
    left: -12px;
    color: var(--gold);
    font-size: 0.8rem;
}

.schedule-list strong {
    display: block;
    color: var(--gold-deep);
}

.schedule-entry + .schedule-entry {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--border, #e0ddd5);
}

.schedule-entry h2 {
    margin-bottom: 10px;
}

.schedule-entry__content {
    line-height: 1.7;
}

.schedule-entry__content p {
    margin-bottom: 0.7em;
}

/* ── schedule gallery ────────────────────────────────────────── */
.sch-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.sch-gallery__item {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden;
    display: block;
}

.sch-gallery__item img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    cursor: zoom-in;
    display: block;
    transition: opacity .15s;
}

.sch-gallery__item img:hover {
    opacity: .85;
}

/* remove old unused gallery rule */
.schedule-entry__gallery {
    display: none;
}

/* ── news carousel (mobile only) ──────────────────────────────── */
.news-carousel-wrap {
    position: relative;
}

.news-carousel__btn {
    display: none; /* shown only on mobile via media query */
}

@media (max-width: 640px) {
    .news-carousel-wrap {
        overflow: hidden;
    }

    .news-carousel-wrap .news-grid {
        display: flex;
        flex-wrap: nowrap;
        gap: 16px;
        transition: transform 0.35s ease;
        /* override grid reset */
        grid-template-columns: unset;
    }

    .news-carousel-wrap .news-grid .card {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .news-carousel__btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
        background: rgba(45, 36, 27, 0.55);
        border: none;
        color: #fff;
        font-size: 32px;
        line-height: 1;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        cursor: pointer;
        transition: background .15s;
    }

    .news-carousel__btn:hover { background: rgba(45, 36, 27, 0.85); }
    .news-carousel__btn:disabled { opacity: .25; pointer-events: none; }
    .news-carousel__btn--prev { left: 4px; }
    .news-carousel__btn--next { right: 4px; }
}

.news-card__meta {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.9rem;
}

.news-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.news-card__likes {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(183, 90, 60, 0.08);
    color: var(--terracotta);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.news-card__like-icon {
    font-size: 1rem;
    line-height: 1;
}

.news-card__like-count {
    line-height: 1;
}

.news-card__image,
.article-card__image {
    width: 100%;
    border-radius: 18px;
    margin-bottom: 14px;
    display: block;
}

.news-card__image {
    object-fit: contain;
    background: rgba(255, 251, 244, 0.72);
}

.article-card__image {
    object-fit: contain;
    background: rgba(255, 251, 244, 0.72);
}

.news-image-preview {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
    display: grid;
    gap: 12px;
}

.news-image-preview img {
    width: 100%;
    max-width: 520px;
    border-radius: 14px;
    object-fit: cover;
}

.section-heading--stack {
    justify-content: flex-start;
    margin-bottom: 22px;
}

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

.timeline-grid--single {
    grid-template-columns: 1fr;
}

.timeline-card {
    border-top: 4px solid rgba(184, 137, 62, 0.45);
}

.timeline-card__year {
    margin: 0 0 8px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    color: var(--gold-deep);
}

/* History full text */
.history-text {
    line-height: 1.85;
}

.history-text p {
    margin: 0 0 1.1em;
}

.history-text p:last-child {
    margin-bottom: 0;
}

.history-text .eyebrow {
    margin-bottom: 24px;
}

.history-text__author {
    margin-top: 2em !important;
    font-style: italic;
    color: var(--muted);
    font-size: .93rem;
}

/* ── Hero calendar widget ────────────────────────────────────── */
.hero__content--split {
    max-width: none;
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 48px;
    flex-wrap: nowrap;
}

.hero__left {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.hero__right {
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
}

.hero-cal {
    background: rgba(255, 255, 255, 0.93);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 18px 22px;
    min-width: 340px;
    max-width: 420px;
    /* override hero's inherited light color */
    color: #2d241b;
    --muted: #6c5e50;
    --text: #2d241b;
    --accent: #b75a3c;
    --border: #e0ddd5;
}

.hero-cal__eyebrow {
    margin-bottom: 10px;
}

.hero-cal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--border, #e0ddd5);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.hero-cal__nav {
    color: var(--accent);
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: background .15s;
}
.hero-cal__nav:hover { background: rgba(0,0,0,.08); }

.hero-cal__date-block { text-align: center; line-height: 1.4; }
.hero-cal__date { display: block; font-size: .9rem; font-weight: 600; }
.hero-cal__old-style { font-size: .8rem; font-weight: 400; color: var(--muted); }
.hero-cal__weekday { display: block; font-size: .82rem; color: var(--muted); }

.hero-cal__season {
    font-size: .83rem;
    font-style: italic;
    color: var(--muted);
    margin: 0 0 6px;
}

.hero-cal__fast {
    font-size: .82rem;
    color: var(--muted);
    margin: 0 0 8px;
}

.hero-cal__saints {
    font-size: .83rem;
    line-height: 1.55;
    margin: 0 0 6px;
}

.hero-cal__link {
    text-align: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border, #e0ddd5);
    font-size: .82rem;
}

@media (max-width: 900px) {
    .hero__content--split {
        flex-direction: column;
        align-items: center;
        flex-wrap: wrap;
    }
    .hero__right {
        width: 100%;
        justify-content: center;
    }
    .hero-cal {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
    }
}
/* ── end hero calendar ───────────────────────────────────────── */

/* ── Orthodox Calendar card ─────────────────────────────────── */
.calendar-card {
    max-width: 560px;
}

.calendar-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border, #e0ddd5);
    padding-bottom: 14px;
    margin-bottom: 14px;
}

.calendar-card__nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
    flex-shrink: 0;
    transition: background .15s;
}
.calendar-card__nav-btn:hover {
    background: rgba(0,0,0,.07);
}

.calendar-card__date-block {
    text-align: center;
    line-height: 1.4;
}

.calendar-card__date {
    display: block;
    font-size: 1rem;
    font-weight: 600;
}

.calendar-card__old-style {
    font-size: .85rem;
    font-weight: 400;
    color: var(--muted);
}

.calendar-card__weekday {
    display: block;
    font-size: .9rem;
    color: var(--muted);
}

.calendar-card__season {
    font-style: italic;
    color: var(--muted);
    font-size: .92rem;
    margin: 0 0 8px;
}

.calendar-card__fast {
    font-size: .9rem;
    color: var(--muted);
    margin: 0 0 12px;
}

.calendar-card__saints {
    font-size: .93rem;
    line-height: 1.6;
    margin: 0 0 10px;
}

.calendar-card__readings {
    font-size: .88rem;
    color: var(--muted);
    margin: 10px 0 12px;
    border-top: 1px solid var(--border, #e0ddd5);
    padding-top: 10px;
}

.calendar-card__link {
    margin: 0;
    text-align: center;
    font-size: .88rem;
}

/* ── Calendar instructions modal ───────────────────────────── */
.cal-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cal-modal[hidden] { display: none; }

.cal-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
}

.cal-modal__box {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(92vw, 860px);
    height: min(88vh, 680px);
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,.35);
}

.cal-modal__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border, #e0ddd5);
    background: var(--surface, #faf9f6);
    flex-shrink: 0;
}

.cal-modal__title {
    flex: 1;
    font-size: .95rem;
    font-weight: 600;
}

.cal-modal__extlink {
    font-size: 1.1rem;
    color: var(--accent);
    text-decoration: none;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background .15s;
}
.cal-modal__extlink:hover { background: rgba(0,0,0,.07); }

.cal-modal__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--muted);
    padding: 2px 6px;
    border-radius: 4px;
    transition: background .15s, color .15s;
}
.cal-modal__close:hover { background: rgba(0,0,0,.07); color: var(--text); }

.cal-modal__frame {
    flex: 1;
    width: 100%;
    border: none;
    display: block;
}
/* ── end calendar modal ─────────────────────────────────────── */

.article-card__excerpt {
    font-size: 1.1rem;
    color: var(--muted);
}

.article-card__content {
    margin-top: 24px;
}

.article-card__actions {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.like-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
}

.like-button__heart {
    font-size: 1.1rem;
    line-height: 1;
    color: var(--muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.like-button__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(183, 90, 60, 0.12);
    color: var(--terracotta);
    font-weight: 700;
    line-height: 1;
}

.like-button.is-liked {
    border-color: rgba(183, 90, 60, 0.4);
    background: rgba(183, 90, 60, 0.08);
}

.like-button.is-liked .like-button__heart {
    color: #c23c3c;
    transform: scale(1.08);
}

/* Share strip */
.share-strip {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.share-strip__label {
    font-size: 0.875rem;
    color: var(--muted);
    white-space: nowrap;
    margin-right: 2px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 13px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.18s ease, transform 0.15s ease;
    font-family: inherit;
}

.share-btn:hover {
    opacity: 0.82;
    transform: translateY(-1px);
}

.share-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    fill: currentColor;
}

.share-btn--tg  { background: #2CA5E0; }
.share-btn--vk  { background: #0077FF; }
.share-btn--ok  { background: #F7931D; }
.share-btn--wa  { background: #25D366; }
.share-btn--copy { background: #6c757d; }
.share-btn--copy.is-copied { background: #4caf50; }

.related-news {
    padding-top: 24px;
}

.related-news__heading {
    margin-bottom: 18px;
}

.related-news-carousel {
    position: relative;
    padding: 0 46px;
}

.related-news-track {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    padding-bottom: 8px;
}

.related-news-track .related-news-card {
    flex: 0 0 calc((100% - 36px) / 3);
    min-width: 280px;
    scroll-snap-align: start;
}

.related-news-carousel .news-carousel__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(45, 36, 27, 0.55);
    border: none;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    transition: background .15s;
}

.related-news-carousel .news-carousel__btn:hover { background: rgba(45, 36, 27, 0.85); }
.related-news-carousel .news-carousel__btn:disabled { opacity: .25; pointer-events: none; }
.related-news-carousel .news-carousel__btn--prev { left: 0; }
.related-news-carousel .news-carousel__btn--next { right: 0; }

/* Public gallery (article page, 2+ images) */
.article-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.article-gallery__item {
    display: block;
    border-radius: 14px;
    overflow: hidden;
    line-height: 0;
}

.article-gallery__item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.article-gallery__item:hover img {
    transform: scale(1.03);
}

/* Admin gallery preview */
.news-admin-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.news-admin-gallery__item {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
    display: grid;
    gap: 8px;
    background: rgba(255, 255, 255, 0.78);
}

.news-admin-gallery__item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.form-label-text {
    display: block;
    margin-bottom: 4px;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Date picker (admin) */
.date-picker {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.date-picker__num {
    width: 58px;
    text-align: center;
    padding: 10px 4px;
}

.date-picker__year { width: 78px; }
.date-picker__time { width: 52px; }

.date-picker__sep {
    color: var(--muted);
    font-size: 1.15em;
    font-weight: 600;
    padding: 0 1px;
    line-height: 1;
}

.date-picker select {
    flex: 0 1 auto;
    padding: 10px 12px;
    border-radius: 18px;
    border: 1px solid rgba(76, 58, 43, 0.18);
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    font-family: inherit;
    font-size: inherit;
}

/* ── Lightbox ────────────────────────────────────────────── */
.lb {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}
.lb.lb--open { display: flex; }

.lb__stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 60px 80px;
    box-sizing: border-box;
}
@media (max-width: 640px) {
    .lb__stage { padding: 56px 14px 48px; }
}

.lb__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    user-select: none;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
}

.lb__close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    color: #fff;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    opacity: .8;
    transition: opacity .15s;
    padding: 4px 8px;
}
.lb__close:hover { opacity: 1; }

.lb__btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, .13);
    border: none;
    color: #fff;
    font-size: 44px;
    line-height: 1;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    opacity: .8;
    transition: opacity .15s, background .15s;
}
.lb__btn:hover { opacity: 1; background: rgba(255,255,255,.24); }
.lb__prev { left: 12px; }
.lb__next { right: 12px; }
@media (max-width: 640px) {
    .lb__btn { font-size: 32px; padding: 6px 12px; }
    .lb__prev { left: 4px; }
    .lb__next { right: 4px; }
}

.lb--single .lb__btn { display: none; }

.lb__counter {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .65);
    font-size: 13px;
    white-space: nowrap;
}
.lb--single .lb__counter { display: none; }

/* Make single article image and gallery items feel clickable */
.lb-trigger { cursor: zoom-in; }
.article-card__image-wrap { display: block; line-height: 0; }

.site-footer {
    padding: 32px 0 48px;
    border-top: 1px solid var(--line);
}

/* ── 2FA pages ─────────────────────────────────────────────────────────────── */
.twofa-hint {
    color: var(--muted);
    font-size: .92rem;
    margin-bottom: 18px;
}

.twofa-back {
    margin-top: 18px;
    font-size: .88rem;
    color: var(--muted);
}

.twofa-code-input {
    font-size: 1.5rem;
    letter-spacing: 0.25em;
    text-align: center;
}

.twofa-card {
    max-width: 600px;
    display: grid;
    gap: 20px;
}

.twofa-card--active {
    border-left: 4px solid var(--green);
}

.twofa-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .04em;
    width: fit-content;
}

.twofa-badge--on  { background: var(--success); color: var(--green); }
.twofa-badge--off { background: var(--error);   color: var(--terracotta); }

.twofa-steps {
    margin: 0;
    padding-left: 22px;
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: .93rem;
}

.twofa-steps strong { color: var(--ink); }

.twofa-qr-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
}

.twofa-qr-canvas {
    border-radius: 12px;
    overflow: hidden;
    line-height: 0;
    background: #fff;
    padding: 8px;
    width: fit-content;
    min-width: 224px;
    min-height: 224px;
}

.twofa-secret-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.twofa-secret-label {
    font-size: .82rem;
    color: var(--muted);
    font-weight: 500;
}

.twofa-otp-link {
    font-size: .85rem;
    margin-top: 2px;
}

.twofa-secret {
    display: inline-block;
    background: rgba(255, 255, 255, .82);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: .95rem;
    letter-spacing: .08em;
    word-break: break-all;
}

.twofa-confirm-form {
    max-width: 320px;
}

.twofa-btn--warn {
    border-color: var(--terracotta);
    color: var(--terracotta);
}

.flash {
    margin-bottom: 18px;
    padding: 16px 18px;
    border-radius: 18px;
}

.flash--success {
    background: var(--success);
}

.flash--error {
    background: var(--error);
}

.admin-shell {
    background: linear-gradient(180deg, #f2eadc, #fbf8f1);
}

.admin-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(14px);
    background: rgba(250, 245, 236, 0.92);
    border-bottom: 1px solid var(--line);
}

.admin-main {
    padding: 40px 0 80px;
}

.admin-section {
    display: grid;
    gap: 24px;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.88rem;
}

.status-pill--published {
    background: rgba(70, 96, 76, 0.15);
    color: var(--green);
}

.status-pill--draft {
    background: rgba(183, 90, 60, 0.14);
    color: var(--terracotta);
}

.auth-section {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 90px);
    padding: 32px 16px 72px;
}

.auth-card {
    width: min(480px, 100%);
}

.form-stack,
.form-grid {
    display: grid;
    gap: 18px;
}

.form-grid__inline {
    align-items: end;
}

label,
.checkbox-row {
    display: grid;
    gap: 8px;
}

input,
textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(76, 58, 43, 0.18);
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
}

textarea {
    resize: vertical;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-row input {
    width: auto;
}

.field-error {
    color: #a93e28;
}

@media (max-width: 960px) {
    .grid--about,
    .news-grid,
    .contacts-grid,
    .timeline-grid,
    .hero__topbar,
    .admin-header__inner,
    .section-heading,
    .site-footer__inner,
    .admin-toolbar,
    .form-grid__inline {
        grid-template-columns: 1fr;
        display: grid;
    }

    .hero__topbar {
        justify-items: center;
        text-align: center;
    }

    .main-nav {
        width: 100%;
        justify-content: center;
    }

    .news-grid {
        grid-template-columns: 1fr 1fr;
    }

    .related-news-track .related-news-card {
        flex: 0 0 calc((100% - 18px) / 2);
    }

    .news-grid--community {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .hero {
        padding-bottom: 52px;
    }

    .hero-logo {
        margin: 0 auto 14px;
    }

    .hero__lead {
        max-width: none;
        width: 100%;
        text-align: justify;
        text-justify: inter-word;
    }

    .section {
        padding: 64px 0;
    }

    .news-grid,
    .contacts-grid,
    .timeline-grid {
        grid-template-columns: 1fr;
    }

    .news-grid--community {
        grid-template-columns: 1fr;
    }

    .hero__actions,
    .form-actions,
    .admin-table__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .button {
        width: 100%;
    }

    .article-card__actions .button {
        width: auto;
    }

    .related-news-carousel {
        padding: 0 24px;
    }

    .related-news-track .related-news-card {
        flex: 0 0 100%;
        min-width: 0;
    }

    .related-news-carousel .news-carousel__btn {
        width: 34px;
        height: 34px;
        font-size: 28px;
    }
}