/* Layout — header, nav, main, footer, scroll-to-top */

/* ── Header ── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--theme);
    border-bottom: 1px solid var(--border);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    max-width: calc(var(--nav-width) + var(--gap) * 2);
    margin-inline: auto;
    padding-inline: var(--gap);
    height: var(--header-height);
}

/* ── Logo ── */
.logo {
    display: flex;
    align-items: center;
    gap: var(--gap);
}

.logo a {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: 0.5px;
}

/* ── Nav menu ── */
#menu {
    display: flex;
    align-items: center;
    gap: var(--gap);
    list-style: none;
    word-break: keep-all;
    overflow-x: auto;
    white-space: nowrap;
}

#menu a {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
    color: var(--primary);
    text-decoration: none;
}

#menu a:hover {
    text-decoration: none;
}

#menu span.active {
    font-weight: 500;
    border-bottom: 2px solid currentColor;
}

/* ── Main content wrapper ── */
.main {
    position: relative;
    min-height: calc(100svh - var(--header-height) - var(--footer-height));
    max-width: calc(var(--main-width) + var(--gap) * 2);
    margin-inline: auto;
    padding: var(--gap);
}

/* ── Footer ── */
.footer {
    max-width: calc(var(--nav-width) + var(--gap) * 2);
    margin-inline: auto;
    padding-inline: var(--gap);
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    font-size: 14px;
    border-top: 1px solid var(--border);
}

.footer a {
    color: var(--secondary);
}

.footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ── Social icons ── */
.social-icons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    color: var(--primary);
    transition: opacity 0.2s;
}

.social-label {
    font-size: 14px;
    font-weight: 500;
}

.social-icons a:hover {
    opacity: 0.7;
    text-decoration: none;
}

.social-icons svg {
    height: 26px;
    width: 26px;
}

/* ── Scroll-to-top ── */
.top-link {
    position: fixed;
    bottom: 60px;
    right: 30px;
    z-index: 99;
    background: var(--tertiary);
    border-radius: 50%;
    height: 42px;
    width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.2s, opacity 0.2s;
}

.top-link.visible {
    visibility: visible;
    opacity: 1;
}

.top-link:hover {
    text-decoration: none;
    opacity: 0.8;
}

.top-link svg {
    height: 16px;
    width: 16px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    :root {
        --gap: 14px;
    }

    .nav {
        height: auto;
        padding-block: 12px;
    }

    #menu {
        padding-block: 4px;
    }
}
