You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
website/public/style.css

714 lines
12 KiB
CSS

/* 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');
5 years ago
:root {
--bg: #eaeaea;
--fg: #333;
--bg-lighter: #f0f0f0;
--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; */
5 years ago
background: var(--bg-dark);
border-radius: 4px;
border: 1px solid var(--bg-darker-2);
box-shadow: var(--shadow-1);
z-index: 1;
}
5 years ago
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;
5 years ago
}
nav .nav-main .nav-item {
display: flex;
align-items: center;
justify-content: center;
background: var(--bg-dark);
5 years ago
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);
}
.tags {
display: flex;
flex-direction: row;
gap: 0 0.5rem;
margin-top: 0.5rem;
}
.tags .tag {
height: 1.5rem;
border-radius: calc(1.5rem / 2);
padding: 0 calc(1.5rem / 2);
background: var(--bg-darker-2);
color: var(--card-date);
font-size: 15px;
display: flex;
align-items: center;
justify-content: center;
}
/* 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%;
}
ul, ol {
padding: 0 0 0 1.5rem;
}
pre {
margin: 0.5rem 0;
background: var(--bg-lighter);
border: 1px solid #cbcbcb;
border-radius: 2px;
box-shadow: 0 2px 4px 0 #00000033;
font-size: 90%;
display: flex;
overflow-x: auto;
}
pre > code {
display: block;
margin: 0.25rem;
}
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);
}
.search {
margin: 2rem 0;
}
.search input[type=text] {
width: 50ch;
height: 2.5rem;
}
.search button {
width: 2.5rem;
height: 2.5rem;
}
/* Rendered Markdown */
.news-content {
display: block;
}
.news-content h1 {
text-align: center;
}
.news-content img {
display: block;
margin: 1rem auto;
background: var(--bg-dark);
border-radius: 4px;
border: 1px solid var(--bg-darker-2);
box-shadow: 0 2px 8px 0 #00000033;
}
.news-content .date {
font-size: 15px;
color: var(--card-date);
display: flex;
justify-content: center;
}
.news-content .tags, .news-content .date {
justify-content: center;
}
.news-content table {
margin: 1rem auto;
}
/* Math */
.katex-display {
margin: 1rem 0;
font-size: 105%;
}
/* Tables */
table {
border-collapse: collapse;
}
table td, table th {
padding: 0.5rem;
}
table td:not(:first-child), table th:not(:first-child) {
border-left: 1px solid var(--bg-darker-3);
}
table td {
border-top: 1px solid var(--bg-darker-3);
}
table tbody tr:hover {
background: var(--bg-darker);
}