/* variables */

:root {
    --background-dark: hsl(0, 0%, 0%);
    --background: hsl(210, 5%, 7%);
    --background-light: hsl(210, 5%, 14%);
    --background-bright: hsl(210, 5%, 20%);
    --background-tint: hsl(235, 10%, 10%);

    --text-highlighted: hsl(0, 0%, 100%);
    --text: hsl(0, 0%, 90%);
    --text-muted: hsl(0, 0%, 70%);

    --wplace-blue: hsl(220, 80%, 50%);

    --radius-small: 5px;
    --radius-medium: 10px;
    --radius-big: 15px;
}

/* background and misc */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text);
}

::-webkit-scrollbar-track {
    background: var(--background-bright);
    border-radius: 3px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    overflow-anchor: none;
}

html, body {
    min-height: 100vh;
    height: auto;
    scrollbar-gutter: stable;
}

button {
	background: none;
	color: inherit;
	border: none;
	padding: 0;
	font: inherit;
	cursor: pointer;
	outline: inherit;
}

a {
    text-decoration: none;
    color: unset;
}

h1 {
    color: var(--text-highlighted);
}

strong {
    transition: all 0.1s;
}

strong:hover {
    color: var(--text);
}


body {
    padding: 2rem 0;
    
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;

    background-color: var(--background-dark);
    
    background-image: url("./resources/background.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;


    color: var(--text);
    font-family: "Inter", 'Segoe UI', system-ui, sans-serif;

    font-size-adjust: 0.52;
}

body.animations-disabled * {
  transition: none !important;
}

.button-normal {
    background-color: transparent;
    border: 1px solid var(--background-bright);
    border-radius: var(--radius-medium);
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    color: var(--text);
}

.button-normal:hover {
    background-color: var(--background-bright) !important;
    transform: scale(1.1);
    box-shadow: 0 2px 4px hsla(0, 0%, 0%, 0.2);
    color: var(--text-highlighted);
}

.button-normal:active {
    transform: translateY(1px);
    box-shadow: none;
}

.button-normal:disabled {
    border-color: var(--background-light);
    color: var(--text-muted); 
    pointer-events: none;
}

.button-icon {
    padding: 0.5rem;
    line-height: 0;
}

/* main */

.main {
    width: min(1200px, 90%);
    background: color-mix(in srgb, var(--background) 80%, transparent);
    border: 1px solid var(--background-bright);
    border-radius: var(--radius-big);
    box-shadow: 0px 5px 15px 0px hsla(0, 0%, 0%, 0.5);

    margin: 0 auto;
    backdrop-filter: blur(10px);

    display: flex;
    flex-direction: column;

    position: relative;
    z-index: 1;

    transition: all 0.15s;
}

body:not(.fancy-bg-fx) .main {
    backdrop-filter: none;
    box-shadow: 0 0 0 hsla(0, 0%, 0%, 0);
    background: var(--background-tint);
}

.header {
    border-bottom: 1px solid var(--background-bright);
    padding: 1.5rem;
    height: 90px;
    display: flex;
}

.header-logo {
    height: 100%;
    width: auto;
    max-height: 100%;
    display: block;
    pointer-events: none;
}

@media (max-width: 900px) {
    .header-logo {
        content: url("./resources/header_logo_small.png");
    }
}

.splash-text {
    margin: auto 1rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;  
}


.header-button-container {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-button {
    height: 100%;
}



.footer {
    margin-top: auto;
    border-top: 1px solid var(--background-bright);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;

    color: var(--text-muted);
    z-index: 10;
}



.content {
    padding: 1.5rem;
}

.page {
    position: absolute;

    opacity: 0;
    transform: translateY(4px);
    scale: 0;
    
}

.page.active {
    scale: initial;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    position: initial;

    opacity: 1;
    transform: translateY(0);
}

body:not(.page-fade-in) .page.active {
    transition: none;
}

.project-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.about-link {
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s ease-out;
    margin-bottom: 0.5rem;
}

.about-link:hover {
    transform: translateY(-2px);
}


.about-link img {
    width: 24px;
    aspect-ratio: 1;
}

.about-link p {
    position: relative;
    display: inline-block;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    color: var(--text-highlighted);
    font-weight: 500;
    transition: transform 0.2s ease-out;
    transform: translateY(1px);
}


.about-link p::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 1px;
    border-radius: 99px;
    bottom: -2px;
    left: 0;
    background-color: var(--text-highlighted);
    transform-origin: bottom right;
    transition: transform 0.25s ease-out;
}

.about-link:hover p::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}


/* toggle switch */

.toggle {
    pointer-events: all;
    width: 3rem;
    height: 1.5rem;
    aspect-ratio: 2;
    padding: 0.2rem;

    border-radius: var(--radius-big);
    background-color: var(--background-bright);

    display: flex;
    align-items: center;

    transition: all 0.15s ease-out;
}

.toggle-thumb {
    height: 100%;
    aspect-ratio: 1;

    border-radius: 50%;
    background-color: var(--text);

    transition: all 0.15s ease-out;
}

.toggle[aria-pressed="true"] {
    background-color: var(--wplace-blue);
}

.toggle[aria-pressed="true"] .toggle-thumb {
    transform: translateX(calc(100% + 0.4rem));
    background-color: var(--text-highlighted);
}


/* projects */

.project-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}


.project-card {
    width: 30%;
    aspect-ratio: 1.8;
    flex-basis: 40%;
    flex-grow: 1;

    border: 1px solid var(--background-bright);
    border-radius: var(--radius-big);

    overflow: hidden;

    transition: all 0.2s ease;

    position: relative;
}

.project-card:nth-child(-n+3) { /* fix da layout!! */
    flex-basis: 30%; 
}

.project-card:hover {
    transform: scale(1.02);
}

.project-card:active {
    transform: scale(0.98);
}

.project-card-image {
    pointer-events: none;
    position: absolute;
    height: 100%;
    width: 100%;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    object-fit: cover;

    transition: all 0.2s ease, mask-size 0.2s ease, mask-position 0.2s ease;

    --fade: linear-gradient(
        90deg,
        hsla(0, 0%, 0%, 0.15) 0%,
        hsla(0, 0%, 0%, 0.4) 50%,
        hsla(0, 0%, 0%, 0.8) 70%,
        hsl(0, 0%, 0%) 100%
    );
    
    mask-image: var(--fade);
    mask-size: 200% 100%;
    mask-position: 100% 0;
}

.project-card:hover .project-card-image {
    mask-size: 100% 100%;
}

.project-card-title {
    position: absolute;
    left: 16px;
    top: 12px;
    width: 90%;

    font-size: 1.52rem;
    font-weight: bold;
    text-align: left;

    color: var(--text-highlighted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 

    filter: drop-shadow(0px 2px 4px hsla(0, 0%, 0%, 0.9));
    transition: all 0.15s;
}

.project-card-description {
    opacity: 0;
    position: absolute;
    top: 48px;
    left: 16px;
    width: 40%;

    text-align: left;
    color: var(--text);

    filter: drop-shadow(0px 2px 4px hsla(0, 0%, 0%, 0.8));
    transition: all 0.2s ease;
}

@media (max-width: 1100px) {
    .project-card-description {
        width: 90%;
    }
}

.project-card:hover .project-card-description {
    opacity: 1 !important;
} 

@media (max-width: 900px) {
    .project-card:hover .project-card-description {
    opacity: 0 !important;
} 
}

.project-card-current-project-tag {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background-color: var(--wplace-blue);
    color: var(--text-highlighted);
    border-radius: var(--radius-medium);
    box-shadow: 0 2px 8px hsla(0, 0%, 0%, 0.5);
    padding: 0.2rem 0.4rem;

    transition: all 0.15s;
}


/* project pages */

.project-page-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    column-gap: 1rem;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--background-bright);
}

.project-page-header h1 {
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-spacer {
    border: 1px solid;
    padding: 0rem 1rem;
    visibility: hidden;
}

.project-page-header .header-spacer {
    width: fit-content;
}

.project-page-description {
    width: 90%;
    margin: auto;
    text-align: center;
}


.project-page-info-container {
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
}

.project-page-meta-container {
    width: 100%;
}

.project-page-image-container {
    display: flex;
    align-items: center;
    width: 30%;
}

@media (max-width: 900px) {
    .project-page-image-container {
        display: none;
    }
}

.project-page-image-container img {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid var(--background-bright);
    border-radius: var(--radius-medium);
    pointer-events: none;
}



.project-page-meta {
    width: 100%;
    margin-bottom: 0.5rem;
}

.project-page-meta-row {
    display: grid;
    grid-template-columns: 1fr 4fr;
    gap: 1.5rem;

    padding: 0.75rem;
    border-bottom: 1px solid var(--background-bright);
}

.project-page-meta-row:last-child {
    border-bottom: none;
}

.project-page-meta dt {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.project-page-meta dd {
    margin: 0;
}

.project-page-meta-button-container {
    display: flex;
    flex-direction: row;
    gap: 1rem;
}


.project-page-extras-container {
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    align-items: flex-start;
    
}

.project-page-contributors-container {
    width: 40%;
    outline: 1px solid var(--background-bright);
    border-radius: var(--radius-big);
    display: flex;
    flex-direction: column;
}

@media (max-width: 900px) {
    .project-page-contributors-container {
        display: none;
    }
}

.project-page-contributors-scroll {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-right: 0.25rem;
    align-items: center;
}

.project-page-contributor {
    width: 96%;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--background-bright);
}

.project-page-contributor:last-child {
    border-bottom: none;
}



.project-page-extras-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--background-bright);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.project-page-history-container {
    width: 100%;
    outline: 1px solid var(--background-bright);
    border-radius: var(--radius-big);
}

.project-page-gallery-container {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.project-page-gallery-info-container {
    display: flex;
    flex-direction: row;
    gap: 1rem;
}

.project-page-gallery-info-box {
    padding: 0.8rem 1rem;
    border: 1px solid var(--background-bright);
    border-radius: var(--radius-medium);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.project-page-gallery-info-box-header {
    width: 100%;
    height: 30%;
    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 0.8rem;
    color: var(--text-muted);
}

.project-page-gallery-info-box-content {
    display: flex;
    align-items: center;
    flex: 1;
}



.project-page-gallery {
    position: relative;
    width: 100%;
    outline: 1px solid var(--background-bright);
    border-radius: var(--radius-big);
    overflow: hidden;
}

.project-page-gallery-slides {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.project-page-gallery-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    pointer-events: none;
}

.project-page-gallery-slide.active {
    opacity: 1;
    pointer-events: auto;
    position: relative;
}

.project-page-gallery-slide img {
    display: block;
    width: 100%;
    height: auto;
}

.project-page-gallery-counter {
    position: absolute;
    top: 12px;
    left: 12px;
    background: color-mix(in srgb, var(--background) 80%, transparent);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-medium);
    border: 1px solid color-mix(in srgb, var(--text-muted) 30%, transparent);
    backdrop-filter: blur(4px);

    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-highlighted);
    font-variant-numeric: tabular-nums;

    z-index: 10;

    opacity: 0;
    transition: opacity 0.2s;
}

body.show-gallery-slide-counter .project-page-gallery-counter {
    opacity: 1;
}

.project-page-gallery-counter-counter-separator {
    margin: 0 0.2rem;
    color: var(--text-muted);
}

.project-page-gallery-counter-total-slides {
    color: var(--text-muted);
}


.project-page-extras-footer {
    padding: 1rem;
    border-top: 1px solid var(--background-bright);
    display: flex;
    gap: 1rem;
}

.project-page-extras-footer > button {
    flex: 0 0 auto;
}

.project-page-gallery-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;

    flex-wrap: wrap;
}

.project-page-gallery-dot {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;

    background: var(--text);
    opacity: 0.4;

    cursor: pointer;

    transition: all 0.2s ease;
}

.project-page-gallery-dot.active {
    opacity: 1;
}

.project-page-gallery-dot:hover {
    transform: scale(1.15);
}


.project-page-gallery-auto-scroll-speed-display {
    font-variant-numeric: tabular-nums;
}

.project-page-gallery-auto-scroll-range {
    width: 100%;
    max-width: 300px;
    height: 0.5rem;
    cursor: pointer;
    background: var(--background-bright);
    border-radius: var(--radius-big);
    -webkit-appearance: none;
    appearance: none;
}

.project-page-gallery-auto-scroll-range::-webkit-slider-runnable-track {
    height: 100%;
    background: var(--background-bright);
    border-radius: var(--radius-big);
}

.project-page-gallery-auto-scroll-range::-moz-range-track {
    height: 0.5rem;
    background: var(--background-bright);
    border-radius: var(--radius-big);
}

.project-page-gallery-auto-scroll-range::-moz-range-progress {
    height: 0.5rem;
    background: var(--wplace-blue);
    border-radius: var(--radius-big);
}

.project-page-gallery-auto-scroll-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1rem;
    height: 1rem;
    background: var(--text);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: -0.25rem;
}
.project-page-gallery-auto-scroll-range::-moz-range-thumb {

    width: 1rem;
    height: 1rem;
    background: var(--text);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
    

.project-page-gallery-auto-scroll-range::-webkit-slider-thumb:hover, .project-page-gallery-auto-scroll-range::-webkit-slider-thumb:active {
    transform: scale(1.2);
    background: var(--text-highlighted);
}

.project-page-gallery-auto-scroll-range::-moz-range-thumb:hover, .project-page-gallery-auto-scroll-range::-moz-range-thumb:active {
    transform: scale(1.2);
    background: var(--text-highlighted);
}

/* modal system */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    pointer-events: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;

    transition: all 0.15s ease-out;
}

.modal-overlay.active {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: all;
}

.modal {
    opacity: 0;
    width: min(1000px, 80%);
    background: color-mix(in srgb, var(--background) 80%, transparent);
    border: 1px solid var(--background-bright);
    border-radius: var(--radius-big);
    box-shadow: 0px 5px 15px 0px hsla(0, 0%, 0%, 0.5);

    display: flex;
    flex-direction: column;

    backdrop-filter: blur(10px);

    position: relative;
    z-index: 5;

    transform: scale(0.95);
    transition: all 0.15s ease;

    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    padding: 1rem;
    height: fit-content;
    border-bottom: 1px solid var(--background-bright);
    display: flex;
    flex-direction: row;
    align-items: center;
}

.modal-content {
    padding: 1rem;
    overflow: visible;
    overflow-y: auto;
}

body:not(.fancy-bg-fx) .modal {
    backdrop-filter: none;
    box-shadow: 0 0 0 hsla(0, 0%, 0%, 0);
    background: var(--background-tint);
}

.modal h2 {
    color: var(--text-highlighted);
}
.modal h3 {
    font-weight: 500;
    margin: 0.5rem 0;
}


.modal-overlay.active .modal {
    opacity: 1;
    transform: scale(1);
}

.modal-close-button {
    margin-left: auto;
}

.modal-setting {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
}


.modal-templates-container {
    height: fit-content;
    width: 100%;
    display: flex;
    overflow-x: auto;
    text-align: center;
    justify-content: safe center;
}

.modal-templates-template {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    margin: 0.5rem 1rem;
}

.modal-templates-template h3 {
    margin: 0;
}

.modal-templates-template p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.modal-templates-template img {
    height: 200px;
    border-radius: var(--radius-medium);
    border: 1px solid var(--background-bright);
    padding: 4px;
}

body:has(.modal-overlay.active) {
    overflow: hidden;
}

/* tooltip */

.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted var(--text);
    cursor: help;
}

.tooltip-text {
    background: color-mix(in srgb, var(--background) 80%, transparent);
    border: 1px solid var(--background-bright);
    border-radius: var(--radius-medium);
    box-shadow: 0px 5px 15px 0px hsla(0, 0%, 0%, 0.5);
    backdrop-filter: blur(10px);

    color: var(--text) !important;
    width: 12rem;
    padding: 0.5rem;
    
    position: absolute;
    z-index: 1;

    text-align: center;

    bottom: 100%; 
    left: 50%;
    margin-left: -6rem;

    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
}

body:not(.fancy-bg-fx) .tooltip-text {
    backdrop-filter: none;
    box-shadow: 0 0 0 hsla(0, 0%, 0%, 0);
    background: var(--background-tint);
}

.tooltip:hover .tooltip-text {
    pointer-events: initial;
    opacity: 1;
    transform: translateY(-0.5rem);
}

/* fun */

.fun-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    flex-direction: row;
    justify-content: center;
    gap: 1250px; 
    pointer-events: none; 
    display: flex;
    transition: all 0.3s;
}

body.fun-mode .fun-container {
    opacity: 1;
}

.fun-column-left, .fun-column-right {
    width: 300px; 
    height: 100vh;
    background-repeat: repeat-y;
    background-size: contain;
}

.fun-column-left {
    background-image: url('./resources/fun_mode/fun_left.gif');
}

.fun-column-right {
    background-image: url('./resources/fun_mode/fun_right.gif');
}

@keyframes hue-shift {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

.hue-shift-active {
  animation: hue-shift 4s linear infinite; 
}