/* TODO: Don't use CDN and serve as static files */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap');

:root {
    --bg: #eaeaea;
    --fg: #333;

    --bg-dark: hsl(220, 5%, 93%);
    --bg-darker: hsl(220, 5%, 90%);
    --bg-darker-2: #d5d5d5;
    --bg-darker-2-1: #c8c8c8;
    --bg-darker-3: #c0c0c0;

    --accent-1: #278542;
    --accent-1-fg: #154d24;

    --card-date: #666;
    --card-content: #222;

    --font-sf: 'Inter', sans-serif;
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 700;

    --shadow-1: 0 0 16px 0 #00000018;

    --text-input-bg: #fff;

    --bg-darker-2-1: #c8c8c8;
    --accent-2-lighter: #5cc969;
    --accent-2: #4eaa59;
    --accent-2-darker: #2e974c;
    --accent-2-darkest: #002d0d;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
}

html {
    height: 100%;
    width: 100%;
}

body {
    background: var(--bg);
    color: var(--fg);

    font-family: var(--font-sf);
    font-size: 17px;
    font-weight: var(--font-weight-normal);

    width: 100%;
    min-height: 100%;

    position: relative;
}

.main {
    max-width: 70ch;
    margin: 0 auto;
    padding-bottom: 8rem;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 3rem;
}

nav {
    padding: 1rem 0;

    display: flex;
    flex-wrap: wrap;
    gap: 1rem;

    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-medium);

    color: var(--accent-1-fg);
}

/* Tutti i link dentro la navbar sono speciali e non sembrano link */
nav .nav-element {
    display: flex;
    width: 100%;
    height: 100%;

    align-items: center;
    justify-content: center;

    text-decoration: none;
    color: inherit;

    gap: 0.5rem;
}

nav a:hover {
    color: var(--accent-1-fg);
    text-decoration: none;
}

nav .nav-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0;

    background: var(--bg-dark);
    border-radius: 4px;
    border: 1px solid var(--bg-darker-2);
    box-shadow: var(--shadow-1);

    transition: transform 150ms ease-in-out;
}

nav .nav-logo:hover {
    transform: scale(1.05);
}

nav .nav-logo img {
    width: 150px;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
}

nav .nav-main {
    display: flex;
    /* grid-template-columns: repeat(5, 1fr) 1fr auto 1fr; */

    background: var(--bg-dark);
    border-radius: 4px;
    border: 1px solid var(--bg-darker-2);
    box-shadow: var(--shadow-1);

    z-index: 0;
}

nav .nav-item.filler {
    width: 6rem;
}

nav .nav-main .nav-element {
    padding: 1rem 1.25rem;
    cursor: pointer;
}

nav .nav-main .nav-button {
    margin: 0 0.5rem;
    /* padding: 0.5rem; */

    aspect-ratio: 1;
    width: 2rem;
    height: 2rem;

    /* background: var(--bg-darker-2); */

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--bg-darker-2);
    border-radius: 1rem;

    cursor: pointer;
}

nav .nav-main .nav-item {
    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--bg-dark);

    user-select: none;

    z-index: 2;
}

nav .nav-main .nav-element:hover, nav .nav-main .nav-button:hover {
    background: var(--bg-darker);
}

nav .nav-main .nav-item.dropdown {
    position: relative;

    z-index: 1;
}

nav .nav-main .nav-item.dropdown .nav-items .nav-item:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

nav .nav-main .nav-item.dropdown .name {
    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--bg-dark);

    z-index: 3;
}

nav .nav-main .nav-item.dropdown .name:hover {
    background: var(--bg-darker);
}

nav .nav-main .nav-item.dropdown .nav-items {
    position: absolute;
    top: 100%;
    width: 100%;

    display: none;

    background: var(--bg-dark);
    border-radius: 4px;
    border: 1px solid var(--bg-darker-2);
    box-shadow: var(--shadow-1);
}
/*
nav .nav-main .nav-item.dropdown .nav-items::before {
    position: absolute;
    content: '';
    top: -2px;
    height: 2px;
    left: 0;
    right: 0;
    width: 100%;

    background: var(--bg-darker);
} */

nav .nav-main .nav-item.dropdown .name:hover + .nav-items, nav .nav-main .nav-item.dropdown .name + .nav-items:hover {
    display: flex;
    flex-direction: column;
}

/* .nav-main borders */
.nav-main > .nav-item:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}
.nav-main > .nav-item:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

footer {
    position: absolute;
    bottom: 0;
    left: 50%;
    height: 3rem;

    width: 80ch;

    transform: translate(-50%, 0);

    background: var(--bg-dark);
    border-radius: 4px;
    border: 1px solid var(--bg-darker-2);
    border-bottom: none;
    box-shadow: var(--shadow-1);

    display: flex;
    align-items: center;
    justify-content: center;

    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

/* Components */

section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-list {
    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 1rem;

    margin-top: 1rem;
}

.card {
    background: var(--bg-dark);
    border-radius: 4px;
    border: 1px solid var(--bg-darker-2);
    box-shadow: var(--shadow-1);

    max-width: 60ch;

    padding: 1rem;

    display: flex;
    flex-direction: column;
}

.card .title {
    font-size: 22px;
    font-weight: var(--font-weight-bold);
}

.card .date {
    font-size: 15px;
    color: var(--card-date);

    margin-bottom: 0.75rem;
}

.card .description {
    font-weight: var(--font-weight-light);
    color: var(--card-content);
}

/* Typography */

h1, h2, h3, h4 {
    margin: 0;
    margin-top: 1rem;
    margin-bottom: 0.5rem;

    font-weight: var(--font-weight-light);
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.35rem;
}

h4 {
    font-size: 1.2rem;
    font-weight: var(--font-weight-bold);
}

p, ul, ol, li {
    margin: 0.5rem 0;
    width: 70ch;
    max-width: 100%;
}

p.center {
    text-align: center;
}

/* Controls */

a {
    color: var(--accent-1-fg);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
}

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

/* Buttons */

button, .button {
    font-family: var(--font-sf);
    font-weight: var(--font-weight-medium);
    font-size: 17px;
    
    /* gray variant #b3b3b3 */
    border: 1px solid var(--bg-darker-3);
    /* gray variant #bfbfbf */
    background: var(--bg-darker-2);
    /* gray variant #333333 */
    color: var(--fg);

    height: 2rem;

    border-radius: 4px;

    padding: 0 1rem;

    transition: all 100ms ease-in-out;
    
    box-shadow: 0 4px 8px 0 #00000022;

    cursor: pointer;
}

button:hover, .button:hover {
    background: var(--bg-darker-2-1);
    box-shadow: 0 4px 8px 0 #00000033;
}

button.primary {
    border: 1px solid var(--accent-2-darker);
    background: var(--accent-2);
    color: var(--accent-2-darkest);
}

button.primary:hover {
    background: var(--accent-2-lighter);
}

button.icon {
    padding: 0;
    width: 2rem;
}

/* Text Fields */

input[type=text], input[type=password] {
    border: none;
    background: none;

    height: 2rem;
    padding: 0 0.5rem;

    font-size: 17px;

    background: var(--text-input-bg);
    color: var(--fg);

    border-radius: 4px;
    border: 1px solid var(--bg-darker-2);
    box-shadow: 0 0 8px 0 #00000020;

    font-family: var(--font-sf);
    font-size: 17px;
    font-weight: var(--font-weight-normal);
}

input[type=password] {
    font-family: caption;
}

/* Compound Controls */

.compound {
    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 4px;
    box-shadow: 0 0 8px 0 #00000022;
}

.compound > button, .compound > .button, .compound > input {
    box-shadow: none;
}

.compound > :not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.compound > :not(:last-child) {
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Forms */

form .field {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

form .field-set {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-auto-rows: auto;

    gap: 0.5rem 1rem;
    padding: 1rem;
}

form .field-set label {
    grid-column: 1 / 2;
    align-self: center;
    justify-self: end;
}

form .field-set input {
    grid-column: 2 / 3;
}

/* Pages */

.page-home {
    /* TODO: Sarebbe meglio se si riuscisse a capire come farlo senza */
    overflow-x: hidden;
}

.page-home .nav-logo {
    display: none;
}

.page-home .super {
    position: absolute;
    left: 50vw;
    top: 50vh;

    width: 90vw;

    transform: translate(-50%, -50%);

    display: flex;
    flex-direction: row;
    flex-wrap: wrap;

    align-items: center;
    justify-content: center;

    gap: 2vmin;
}

.page-home canvas {
    position: absolute;
    width: 100vw;
    height: 100vh;
    top: 0;
    right: 0;

    pointer-events: none;
    z-index: -1;

    transition: opacity 1000ms ease-in-out;
    opacity: 1;
}

.page-home canvas.hide {
    opacity: 0;
}

.page-home .super .block.text {
    max-width: 40ch;
    font-size: 1.25rem;
}

.page-home .super .block.text h1 {
    font-weight: var(--font-weight-medium);
}

.page-home .super .block.text p {
    font-weight: var(--font-weight-light);
}

.page-home .super .block.image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-home .super .block.image img {
    max-width: 80ch;
    max-height: 50vh;
    filter: drop-shadow(0 0 64px rgba(0, 0, 0, 0.2)) drop-shadow(0 0 8px rgba(0, 0, 0, 0.35));
}

.page-home .main {
    padding-top: calc(100vh - 6rem);
}

.page-utenti .search {
    margin: 2rem 0;
}

.page-utenti .search input[type=text] {
    width: 50ch;
    height: 2.5rem;
}

.page-utenti .search button {
    width: 2.5rem;
    height: 2.5rem;
}