:root {
    --black: #000;
    --white: #fff;
    --cyber-violet: #eae4ff;
    --cyber-glow: rgba(180, 150, 255, 0.25);
    --light-hover: rgba(238, 238, 238, 0.5);
}

html,
body {
    height: 100%;
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--white);
    color: var(--black);
    display: flex;
    flex-direction: column;
    font-weight: 400;
    font-size: 16px;
}

.page-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--black);
    background-image: url("./images/sfondo.jpeg");
    background-repeat: no-repeat;
    background-size: 100%;
    border-bottom: 1px solid #999;
    box-shadow: 0 2px 6px var(--cyber-glow);
}

nav {
    max-width: 65em;
    margin: 0 auto;
    padding: 0.6em 1em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header.center-logo nav {
    justify-content: center;
}

#nav-navigation.hidden_button {
    display: none;
}

#header-logo {
    height: clamp(4.8em, 7vw, 6em);
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    order: -1;
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
    background: transparent;
}

.header-logo-img {
    height: 85%;
    width: auto;
    z-index: 2;
    position: relative;
    display: block;
    margin-top: -0.15em;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

#header-logo::before {
    content: "";
    position: absolute;
    left: 57%;
    top: 55%;
    transform: translate(-60%, -60%);
    width: 60%;
    height: 60%;
    border-radius: 70% / 70%;
    background: rgba(2, 2, 2, 0.141);
    transition: background 0.3s ease, box-shadow 0.3s ease, width 0.3s ease, height 0.3s ease;
    z-index: 1;
}

#header-logo:hover::before {
    background: rgba(255, 255, 255, 0.23);
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.15);
}

#header-logo.active::before {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0.125rem 0.75rem rgba(150, 100, 255, 0.3);
}

#nav-navigation {
    list-style: none;
    display: flex;
    gap: 0.6rem;
    margin: 0;
    padding: 0;
}

#nav-navigation a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.6em 1em;
    border-radius: 0.5rem;
    transition: all 0.25s ease;
    position: relative;
    min-width: 4em;
    text-align: center;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(0.5rem);
    -webkit-backdrop-filter: blur(0.5rem);
}

#nav-navigation a:hover {
    background: rgba(255, 255, 255, 0.25);
    color: var(--white);
    transform: translateY(-0.0625rem);
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.15);
}

#nav-navigation a.active {
    background: rgba(255, 255, 255, 0.816);
    color: var(--black);
    box-shadow: 0 0.125rem 0.75rem rgba(150, 100, 255, 0.3);
    font-weight: 600;
}

#nav-navigation a.show-arrow::after {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0.5em;
    font-size: 1.2em;
    color: var(--black);
    mix-blend-mode: destination-out;
}

#nav-navigation a[data-section="Archivio"].show-arrow {
    color: var(--black);
}

#nav-navigation a[data-section="Archivio"].show-arrow::after {
    display: none;
}

main {
    max-width: 55 rem;
    margin: 2rem auto;
    padding: 0 1rem;
    flex-grow: 1;
    min-width: 55%;
}

.repo-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--black);
    margin-bottom: 0.8em;
    border-bottom: 0.125rem solid var(--black);
    padding-bottom: 0.3em;
}

#search-container {
    padding: 0;
    border: none;
    background: transparent;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

#document-search {
    width: 100%;
    max-width: 40rem;
    padding: 0.7em 1.2em;
    border: 0.125rem solid #ddd;
    border-radius: 1.5rem;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 400;
    transition: all 0.25s ease;
    background: var(--white);
}

#document-search:focus {
    outline: none;
    border-color: #b896ff;
    box-shadow: 0 0 0 0.1875rem rgba(180, 150, 255, 0.15);
}

#document-search::placeholder {
    color: #999;
    font-weight: 400;
}

.dynamic-content-container ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.dynamic-content-container li {
    margin-bottom: 0.3em;
}

.folder-toggle {
    font-size: 1rem;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    padding: 0.4em 0.6em;
    display: block;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
}

.folder-toggle:hover {
    background-color: var(--light-hover);
}

.folder-toggle::before {
    content: '▶';
    color: #b896ff;
    display: inline-block;
    font-size: 0.7em;
    margin-right: 0.6em;
    margin-left: 0.2em;
    transition: transform 0.15s ease;
}

.folder-toggle:not(.collapsed)::before {
    transform: rotate(90deg);
}

.folder-content {
    padding-left: 1.6em;
    transition: max-height 0.2s ease-out;
}

.folder-content.collapsed {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.15s ease-in;
}

.pdf_row {
    display: block;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
}

.pdf_row:hover {
    background-color: var(--light-hover);
}

.dynamic-content-container p {
    padding: 0.4em 0.6em;
    margin: 0 0 0.2em 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    flex: 1;
}

.file-name {
    color: #333;
    font-weight: 400;
    text-decoration: none;
    transition: color 0.2s ease;
}

.file-name:hover {
    color: #b896ff;
    text-decoration: underline;
}

.file-path {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
    font-weight: 400;
}

.dynamic-content-container p a[href$=".pdf"]:not(.download-button)::before {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background-image: url("./images/pdf.svg");
    background-size: contain;
    background-repeat: no-repeat;
    margin-right: 0.5em;
    vertical-align: middle;
}

.download-button {
    width: 1.125rem;
    height: 1.125rem;
    background-image: url("./images/download.svg");
    background-size: contain;
    background-repeat: no-repeat;
    display: inline-block;
    margin-left: 1em;
    opacity: 0.5;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.download-button:hover {
    opacity: 1;
    transform: scale(1.15);
}

footer {
    padding: 1.2rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 400;
    color: #666;
    margin-top: auto;
    border-top: 0.0625rem solid #e0e0e0;
    background: var(--white);
}

@media (min-width: 46.875rem) {
    header {
        padding-top: 0;
        padding-bottom: 0;
    }

    nav {
        padding-top: 0;
        padding-bottom: 0;
        align-items: center;
    }

    #header-logo {
        margin-top: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
}

@media (max-width: 46.875rem) {
    nav {
        flex-direction: column;
        align-items: center;
        gap: 0.6rem;
        padding: 0.8rem 0.5rem;
    }

    #header-logo {
        order: -1;
        margin-bottom: 0.8rem;
    }

    #nav-navigation {
        order: 1;
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    #nav-navigation a {
        font-size: 0.9rem;
        padding: 0.5em 0.8em;
        min-width: 3.5em;
    }
}

/* @media () */