:root {
    --radius: 14px;
}

/* Light theme (default) */
:root,
[data-theme="light"] {
    --bg: #f7f8fa;
    --panel: #ffffff;
    --text: #1b1f27;
    --muted: #5b6472;
    --accent: #2f6fed;
    --border: #e3e6ec;
    --header-bg: rgba(247, 248, 250, 0.92);
}

/* Dark theme */
[data-theme="dark"] {
    --bg: #0f1115;
    --panel: #171a21;
    --text: #e7e9ee;
    --muted: #9aa3b2;
    --accent: #4f8cff;
    --border: #242936;
    --header-bg: rgba(15, 17, 21, 0.92);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--header-bg);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.brand { display: flex; align-items: center; text-decoration: none !important; }

/* ── Logo ── */
.site-logo {
    height: 36px;
    width: auto;
    display: block;
}
.footer-logo {
    height: 28px;
    width: auto;
    display: block;
}
.hero-logo {
    height: 80px;
    width: auto;
    display: block;
    margin: 0 auto 1.25rem;
}

/* Theme logo switching */
.logo-light { display: block; }
.logo-dark  { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark  { display: block; }

/* ── Nav ── */
.nav { display: flex; align-items: center; }
.nav a { color: var(--muted); margin-left: 1.5rem; }
.nav a.active, .nav a:hover { color: var(--text); text-decoration: none; }

.nav-auth { margin-left: 1.5rem; padding-left: 1.5rem; border-left: 1px solid var(--border); }
.nav-auth a { margin-left: 0; }
.nav-auth a + a { margin-left: 1rem; }

.theme-toggle {
    margin-left: 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    line-height: 1;
    font-size: 1rem;
}
.theme-toggle:hover { border-color: var(--accent); }
[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: none; }

.lang-switch { margin-left: 1.5rem; padding-left: 1.5rem; border-left: 1px solid var(--border); }
.lang-switch a { margin-left: 0.6rem; font-size: 0.85rem; font-weight: 600; }
.lang-switch a:first-child { margin-left: 0; }
.lang-switch a.active { color: var(--accent); }

/* ── Hamburger ── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 11;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Hero ── */
.hero {
    padding: 4rem 0 3.5rem;
    text-align: center;
    background: radial-gradient(1200px 400px at 50% -10%, rgba(79,140,255,0.14), transparent);
}
.hero-logo-wrap { margin-bottom: 0; }
.lead { font-size: 1.2rem; color: var(--muted); margin: 0 0 1.5rem; }

.section { padding: 3rem 0; }
.section h2 { margin-top: 0; }

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius);
    border: none;
    font-size: 1rem;
    cursor: pointer;
}
.btn:hover { text-decoration: none; opacity: 0.92; }

/* ── Cards ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    padding: 0;
}
.card > h3, .card > p, .card > .link { padding-left: 1.5rem; padding-right: 1.5rem; }
.card > .link { display: inline-block; padding-bottom: 1.5rem; }
.card-media {
    display: block;
    aspect-ratio: 4 / 3;
    background: var(--bg);
    overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.card-media:hover img { transform: scale(1.04); }
.card h3 { margin-top: 1.25rem; }

/* ── Gallery ── */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}
.gallery-item { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.gallery-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.muted { color: var(--muted); }
.link { font-weight: 600; }

.prose { max-width: 680px; }

/* ── Contacts ── */
.contacts-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 2.5rem; }
.contact-list { list-style: none; padding: 0; }
.contact-list li { padding: 0.35rem 0; }

form { display: block; }
form label { display: block; margin: 1rem 0 0.35rem; color: var(--muted); }
form input, form textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 1rem;
}
form button { margin-top: 1.25rem; }
.form-error, ul li { color: #ff6b6b; }
form ul { padding-left: 1rem; }

/* ── Flash ── */
.flash {
    padding: 0.9rem 1.1rem;
    border-radius: 10px;
    margin: 1.5rem 0;
}
.flash-success { background: rgba(46, 160, 67, 0.15); border: 1px solid rgba(46,160,67,0.5); color: #2a8a3e; }
[data-theme="dark"] .flash-success { color: #7ee787; }

/* ── Presentations ── */
.presentation {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
    margin-top: 2rem;
}
.presentation-cover {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--panel);
}
.presentation-cover img { width: 100%; display: block; transition: transform 0.3s ease; }
.presentation-cover:hover img { transform: scale(1.03); }
.presentation-body h2 { margin-top: 0; }
.presentation-highlights {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.5rem 1.5rem;
}
.presentation-highlights li { padding-left: 1.4rem; position: relative; }
.presentation-highlights li::before {
    content: "⬡";
    position: absolute;
    left: 0;
    color: var(--accent);
}
.presentation-meta { font-size: 0.9rem; margin-bottom: 1rem; }
.presentation-actions { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }

.presentation-viewer {
    margin-top: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--panel);
}
.presentation-viewer object { display: block; width: 100%; height: 80vh; min-height: 480px; }
.presentation-viewer p { padding: 1.5rem; }

/* ── Footer ── */
.site-footer {
    border-top: 1px solid var(--border);
    color: var(--muted);
    padding: 1.25rem 0;
    font-size: 0.9rem;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.footer-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--text); text-decoration: none; }

/* ── Admin ── */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.admin-table th, .admin-table td {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
.admin-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .05em; }
.admin-table tbody tr:hover { background: var(--panel); }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.85rem; border-radius: 8px; }
.btn-danger { background: #dc3545; }
.btn-danger:hover { background: #b02a37; opacity: 1; }

.admin-form .form-group { margin-bottom: 1.1rem; }
.admin-form .form-group label { margin-top: 0; }
.admin-form textarea { font-family: inherit; resize: vertical; }

.form-row-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
.form-section-title {
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
    margin: 1.75rem 0 0.75rem;
}

.admin-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.admin-gallery-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--panel);
}
.admin-gallery-item img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}
.admin-gallery-name {
    font-size: 0.75rem;
    color: var(--muted);
    padding: 0.25rem 0.5rem 0.35rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Lightbox ── */
.gallery-item img { cursor: zoom-in; }

.lightbox {
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    max-width: 92vw;
    max-height: 92vh;
    overflow: visible;
}
.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(6px);
}
.lightbox img {
    display: block;
    max-width: 92vw;
    max-height: 88vh;
    width: auto;
    height: auto;
    border-radius: var(--radius);
    object-fit: contain;
}
.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .nav {
        display: none;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--header-bg);
        backdrop-filter: blur(8px);
        border-bottom: 1px solid var(--border);
        padding: 1rem 1.25rem 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        z-index: 9;
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    }
    .nav.is-open { display: flex; }

    .nav > a {
        margin-left: 0;
        padding: 0.6rem 0;
        width: 100%;
        border-bottom: 1px solid var(--border);
        font-size: 1rem;
    }
    .nav > a:last-of-type { border-bottom: none; }

    .nav-auth {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        padding-top: 0.75rem;
        width: 100%;
        display: flex;
        gap: 1rem;
    }
    .nav-auth a { margin-left: 0; }

    .lang-switch {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        padding-top: 0.75rem;
        width: 100%;
    }

    .theme-toggle { margin-left: 0; margin-top: 0.5rem; }

    .contacts-grid { grid-template-columns: 1fr; gap: 2rem; }

    .hero { padding: 2.5rem 0 2rem; }
    .hero-logo { height: 56px; }

    .site-logo { height: 30px; }

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

    .presentation { grid-template-columns: 1fr; gap: 1.5rem; }
    .presentation-cover { max-width: 320px; }
    .presentation-highlights { grid-template-columns: 1fr; }
    /* mobile browsers do not render inline PDF embeds — the buttons above cover it */
    .presentation-viewer { display: none; }
    .footer-nav { gap: 1rem; }
}
