/* Font-faces */

/* Regular */

@font-face {
    font-family: "Red Hat Display";
    src: url(fonts/RedHatDisplay-Regular.ttf);
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: "Red Hat Display";
    src: url(fonts/RedHatDisplay-Italic.ttf);
    font-weight: normal;
    font-style: italic;
}

/* Semi Bold */

@font-face {
    font-family: "Red Hat Display";
    src: url(fonts/RedHatDisplay-SemiBold.ttf);
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: "Red Hat Display";
    src: url(fonts/RedHatDisplay-SemiBoldItalic.ttf);
    font-weight: 600;
    font-style: italic;
}

/* Bold */

@font-face {
    font-family: "Red Hat Display";
    src: url(fonts/RedHatDisplay-Bold.ttf);
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: "Red Hat Display";
    src: url(fonts/RedHatDisplay-BoldItalic.ttf);
    font-weight: 700;
    font-style: italic;
}

/* Variable declarations, reset, and font family stack selection */

* {
    font-family: 'Red Hat Display', system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --font-color: #DDDCDB;
    --background-color: #DDDCDB;
    --primary-color: #96825F;
    --secondary-color: #B8B0A0;
    --accent-color: #181818;
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0.2px;
    overflow-clip-margin: initial;
}

/* General properties for main elements */

body {
    height: 100vh;
    background-color: var(--background-color);
}

svg {
    width: 25px;
    height: 25px;
}

button {
    appearance: none;
    background-color: inherit;
    cursor: pointer;
    margin: 0;
    padding: 0;
    border: 0;
}

label {
    position: absolute;
    left: -9999px;
    overflow: hidden;
}

a {
    text-decoration: none;
    color: var(--secondary-color);
}

.main-container {
    min-height: 100%;
    display: grid;
    grid-template-columns: 270px auto;
    box-sizing: border-box;
    gap: 1.5rem;
}

/* Sidebar section */

.sidebar {
    position: relative;
}

.sidebar-fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 270px;
    height: 100%;
    display: grid;
    grid-template-rows: 1fr 2fr;
    box-sizing: border-box;
    border-radius: 0 2rem 2rem 0;
    padding: 1rem 0;
}

.logo {
    position: relative;
    display: grid;
    align-items: center;
    justify-items: center;
    background-position: center;
    background-size: cover;
    background-color: var(--accent-color);
    padding: 1rem 0;
    border-radius: 0 1.2rem 0 0;
}

/* Add transparent, dark background while allowing for the gradient effect of h1 to be visible */

.logo::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--accent-color);
    opacity: 0.6;
    border-radius: 0 1.2rem 0 0;
}

/* -------------------------- */

/* Add gradient text effect */

h1 {
    z-index: 1;
    background-image: linear-gradient(to right, #96825f, #9e8d6f, #a7997f, #afa48f, #b8b0a0);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

/* -------------------------- */

nav {
    background-color: var(--accent-color);
    padding: 1rem 0;
    border-radius: 0 0 1.2rem 0;
}

nav a {
    position: relative;
    display: grid;
    grid-template-columns: min-content auto max-content;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem 1rem 1rem;
}

nav a:focus-visible {
    appearance: none;
    outline: none;
    border: none;
}

/* Hover button animation */

nav a::before {
    content: "";
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-image: linear-gradient(to right, #96825f, #9e8d6f, #a7997f, #afa48f, #b8b0a0);
    transform: translateX(-150%);
    transition: 0.3s;
}

nav a:hover::before,
nav a:focus-visible::before {
    transform: translateX(0);
}

/* -------------------------- */

nav a svg {
    z-index: 2;
    fill: var(--secondary-color);
    transition: 0.3s;
}

nav a:hover svg,
nav a:focus-visible svg {
    fill: var(--accent-color);
}

nav a span {
    z-index: 2;
    display: grid;
    place-content: center;
    font-weight: 600;
    transition: 0.3s;
}

nav a svg+span {
    justify-self: start;
    color: var(--secondary-color);
}

nav a:hover svg+span,
nav a:focus-visible svg+span {
    color: var(--accent-color);
}

nav a span+span {
    width: 20px;
    height: 20px;
    font-size: 14px;
    text-align: center;
    color: #b8b0a0d2;
}

nav a:nth-child(3) span+span,
nav a:nth-child(6) span+span {
    background-color: var(--primary-color);
    color: var(--accent-color);
    border-radius: 100%;
}

nav a:hover span+span,
nav a:focus-visible span+span {
    color: var(--accent-color);
}

nav a:hover:nth-child(3) span+span,
nav a:focus-visible:nth-child(3) span+span,
nav a:hover:nth-child(6) span+span {
    box-shadow: 0px 0px 2px 1px var(--accent-color);
}

/* Webpage content */

.content {
    display: none;
    background-color: var(--secondary-color);
}

main {
    display: grid;
    grid-template-rows: min-content auto auto;
}

/* Top-section, including the search-bar and profile details (notification button, profile photo, and profile name) */

.top-content {
    z-index: 10;
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: auto auto;
    background-color: var(--secondary-color);
    gap: 2rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
}


/* Search-bar */

.search-bar {
    min-width: 350px;
    max-width: 500px;
    height: 55px;
    display: grid;
    grid-template-columns: min-content auto min-content;
    align-self: start;
    align-items: center;
    box-sizing: border-box;
    background-color: var(--accent-color);
    border-radius: 0.5rem;
}

/* Shows the focus-outline on the search-bar container, not on the input itself */

.search-bar:focus-within {
    outline: 3px solid var(--background-color);
    border-radius: 0.5rem;
}

/* -------------------------- */

.search-bar>svg {
    height: 100%;
    fill: var(--secondary-color);
    padding-left: 1rem;
    cursor: text;
}

.search-bar:focus-within svg {
    fill: var(--background-color);
}

.search-bar input {
    width: 100%;
    height: 100%;
    appearance: none;
    background-color: inherit;
    color: var(--secondary-color);
    padding-left: 1rem;
    border: 0;
}

.search-bar:focus-within input {
    color: var(--background-color);
}

/* Disable the default cancel button on webkit */

.search-bar input::-webkit-search-cancel-button {
    appearance: none;
}

/* -------------------------- */

.search-bar input:focus-visible {
    appearance: inherit;
    outline: none;
    border: inherit;
    color: var(--background-color);
}

/* Custom search-bar cancel button */

.search-bar button {
    visibility: hidden;
    display: grid;
    place-content: center;
    fill: var(--secondary-color);
    margin: 0 1rem;
}

.search-bar button:focus-visible {
    appearance: none;
    border: none;
    outline: 2px solid var(--background-color);
    border-radius: 0.3rem;
}

/* -------------------------- */

/* Disable input autofill background color */


input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    transition-delay: 9999s;
    -webkit-transition-delay: 9999s;
}

/* -------------------------- */

/* Profile details section */

.profile-details {
    display: grid;
    grid-template-columns: min-content auto auto;
    align-items: center;
    justify-content: end;
    gap: 1.5rem;
}

.profile-details button:first-of-type {
    display: grid;
    place-content: center;
}

.profile-details button:first-of-type:focus-visible {
    appearance: none;
    outline: 3px solid var(--background-color);
    border-radius: 0.3rem;
    border: 0;
}

.profile-details button:first-of-type svg {
    fill: #181818;
}

.profile-details button:last-of-type {
    position: relative;
    display: grid;
    place-content: center;
}

.profile-details button:last-of-type:focus-visible {
    appearance: none;
    border: 0;
    outline: none;
}

.profile-details button:last-of-type img {
    object-fit: cover;
    border-radius: 100%;
    box-shadow: 0px 0px 0px 3px var(--accent-color);
}

.profile-details button:last-of-type:focus-visible img {
    box-shadow: 0px 0px 0px 5px var(--background-color);
}

.profile-name {
    font-weight: 600;
    color: var(--accent-color);
    margin-right: 11px;
}

.profile-name:focus-visible {
    appearance: none;
    outline: 3px solid var(--background-color);
    border-radius: 0.3rem;
    border: none;
}

/* Main section containing the collections, new art, trending art styles, and communities sections */

.main-content {
    justify-self: center;
    display: grid;
    grid-template-columns: auto 250px;
    grid-template-rows: 355px 400px auto;
    column-gap: 2.5rem;
    row-gap: 2rem;
    padding: 0 1.5rem;
    margin-bottom: 2rem;
}

.main-content h2 {
    font-size: 1.1rem;
    color: var(--accent-color);
    margin: 0 0 0 0.5rem;
}

.collection-section,
.new_art-section,
.trending-section,
.communities-section {
    display: grid;
    grid-template-rows: min-content auto;
    gap: 1rem;
}

.collection-container figure,
.new_art-container,
.trending-container,
.communities-section {
    background-color: var(--accent-color);
    border-radius: 0.7rem;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.3);
}

/* Collections section */

.collection-section {
    grid-row: 1 / 3;
}

.collection-container {
    min-width: 400px;
    max-width: 1450px;
    overflow-y: scroll;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    grid-template-rows: repeat(auto-fill, minmax(370px, 1fr));
    grid-auto-columns: 325px;
    grid-auto-rows: 355px;
    gap: 1.5rem;
    padding: 3px 15px 3px 3px;
    border-radius: 0.7rem;
    scrollbar-color: rgb(24, 24, 24, 0.9) rgba(255, 255, 255, 0.2);
}

/* Custom scrollbar for webkit browsers */

.collection-container::-webkit-scrollbar {
    width: 10px;
}

.collection-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
}

.collection-container::-webkit-scrollbar-thumb {
    background: rgb(24, 24, 24, 0.9);
    border-radius: 20px;
}

.collection-container::-webkit-scrollbar-thumb:hover {
    background: rgb(24, 24, 24, 0.7);
}

/* -------------------------- */

.collection-container figure {
    position: relative;
    overflow: hidden;
    margin: 0;
    cursor: pointer;
}

.collection-container figure:focus-visible {
    appearance: none;
    border: 0;
    outline: 3px solid var(--background-color)
}

.collection-container img {
    width: 100%;
    height: 100%;
    overflow: hidden;
    object-fit: cover;
    border-radius: 0.7rem 0.7rem 0 0;
}

/* Modify the image position for certain containers to bring painting details into view */

.collection-container figure:nth-child(4) img {
    object-position: 0 -35px;
}

.collection-container figure:nth-child(5) img {
    object-position: top;
}

/* -------------------------- */

/* Painting details, containing name, author, year of publication, and the "Download" and "Share" buttons */

.collection-container figcaption {
    width: 100%;
    position: absolute;
    bottom: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    font-size: 0.9rem;
    font-weight: 600;
    background-color: var(--accent-color);
    color: var(--secondary-color);
    gap: 20px;
    padding: 15px 10px 15px 10px;
    border-radius: 0 0 0.7rem 0.7rem;
    transform: translateY(36px);
    transition: 0.3s;
}

/* Hover animation */

.collection-container figure:hover figcaption,
.collection-container figure:focus-visible figcaption,
.collection-container figure:focus-within figcaption {
    transform: translateY(0);
}

/* -------------------------- */

.fig-buttons {
    position: absolute;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
}

.fig-buttons button {
    display: grid;
    place-content: center;
}

.fig-buttons button:focus-visible {
    appearance: none;
    outline: 2px solid var(--background-color);
    border-radius: 0.3rem;
    border: none;
}

.fig-buttons button svg {
    fill: var(--secondary-color);
}

.fig-buttons button:hover svg,
.fig-buttons button:focus-visible svg {
    fill: var(--primary-color);
}

/* New art section */

.new_art-container {
    overflow: auto;
    display: grid;
    flex-direction: column;
    place-content: center;
    padding: 3px 15px 0 15px;
}

/* Custom scroll-buttons */

.new_art-container button {
    color: var(--secondary-color);
}

.new_art-container button:hover {
    color: var(--primary-color);
}

/* -------------------------- */

/* Scrollable container for new-art pieces */

.new_art-scrollable {
    overflow-y: scroll;
    display: grid;
    grid-template-rows: repeat(9, 75px);
    gap: 15px;
    border-radius: 0.3rem;
    margin-bottom: 3px;
    scrollbar-width: none;
    scroll-snap-type: y mandatory;
    -ms-overflow-style: none;
}

/* Disable default scrollbar (was replaced by custom scroll buttons described above) */

.new_art-scrollable::-webkit-scrollbar {
    display: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* -------------------------- */

.new_art-scrollable a:focus-visible {
    appearance: none;
    border: none;
    outline: none;
}

.new_art-scrollable figure {
    display: grid;
    grid-template-columns: min-content auto;
    margin: 0;
    scroll-snap-align: center;
}

.new_art-scrollable img {
    object-fit: cover;
    border-radius: 0.3rem 0 0 0.3rem;
}

/* New-art description, containing the painting name and metrics (Likes and Views count) */

.new_art-scrollable figcaption {
    position: relative;
    display: grid;
    grid-template-rows: auto auto;
    font-size: 0.85rem;
    font-style: italic;
    font-weight: 600;
    background-color: var(--secondary-color);
    color: var(--accent-color);
    border-radius: 0 0.3rem 0.3rem 0;
    padding: 10px;
}

.new_art-scrollable figcaption svg {
    width: 20px;
    height: 20px;
}

.new_art-scrollable figcaption .painting-metrics {
    position: absolute;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    font-style: normal;
    text-align: center;
    gap: 8px;
    padding: 0 5px 3px 5px;
}

.new_art-scrollable figcaption .painting-metrics .hearts-metrics,
.new_art-scrollable figcaption .painting-metrics .watch-metrics {
    display: flex;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.new_art-scrollable a:hover figcaption,
.new_art-scrollable a:focus-visible figcaption {
    background-color: var(--primary-color);
    color: var(--font-color);
    fill: var(--background-color)
}

/* Trending section */

.trending-container {
    display: grid;
    grid-template-rows: repeat(5, 1fr);
    border: 3px solid var(--accent-color);
    gap: 3px;
}

.trending-item {
    position: relative;
    display: grid;
    place-content: center;
    background-size: cover;
    background-position: center;
    padding: 0.5rem;
}

.trending-item:nth-child(1) {
    background-image: url(art-styles/impressionism.webp);
    border-radius: 0.5rem 0.5rem 0 0;
}

.trending-item:nth-child(2) {
    background-image: url(art-styles/fauvism.webp);
}

.trending-item:nth-child(3) {
    background-image: url(art-styles/baroque.webp);
}

.trending-item:nth-child(4) {
    background-image: url(art-styles/expressionism.webp);
}

.trending-item:nth-child(5) {
    background-image: url(art-styles/surrealism.webp);
    border-radius: 0 0 0.5rem 0.5rem;
}

.trending-item:focus-visible {
    appearance: none;
    border: none;
    outline: none;
}

/* Add transparent background color background image without interfering with background image's opacity */

.trending-item::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: inherit;
    opacity: 0.4;
}

.trending-item:hover::before,
.trending-item:focus-visible::before {
    opacity: 0.1;
}

/* -------------------------- */

.trending-item span {
    z-index: 1;
    font-size: 0.9rem;
    font-weight: 600;
    background-color: var(--accent-color);
    color: var(--secondary-color);
    padding: 0.5rem;
    border-radius: 0.2rem;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.3);
}

.trending-item:hover span,
.trending-item:focus-visible span {
    color: var(--background-color);
}

.trending-item:focus-visible span {
    outline: 3px solid var(--background-color);
}

/* Communities section */

.communities-section {
    grid-column: 1 / 3;
}

.communities-section h2 {
    color: var(--secondary-color);
    padding: 1rem 1rem 0 1rem;
}

.communities-container {
    grid-column: 1 / 3;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(600px, 1fr));
    grid-template-rows: 1fr 1fr;
    gap: 1rem;
    padding: 0 1rem 1rem 1rem;
    border-radius: 0.7rem;
}

.community {
    height: 100px;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    font-weight: 600;
    background-color: var(--secondary-color);
    color: var(--accent-color);
    border-radius: 0.3rem;
}

/* Separate community name and community metrics with a diagonal line */

.community::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 10px;
    height: 100%;
    background-color: var(--accent-color);
    transform: skewX(-40deg);
}

/* -------------------------- */

.community .community-name,
.community .community-metrics {
    display: grid;
    place-content: center;
    border-radius: 0.3rem;
}

.community-name {
    background: linear-gradient(to right, #96825f, #9e8d6f, #a7997f, #afa48f, #b8b0a0);
}

.community-metrics {
    grid-template-columns: auto auto;
    font-size: 0.9rem;
    background: linear-gradient(to left, #96825f, #9e8d6f, #a7997f, #afa48f, #b8b0a0);
    gap: 2rem;
}

.community-posts,
.community-members {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.community:hover .community-name {
    background-image: linear-gradient(to left, #b8b0a0, #c2bbae, #ccc5bd, #d5d1cc, #dddcdb);
}

.community:hover .community-metrics {
    background-image: linear-gradient(to right, #b8b0a0, #c2bbae, #ccc5bd, #d5d1cc, #dddcdb);
}

/* Footer */

footer {
    align-self: end;
    max-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-weight: 600;
    background-color: var(--accent-color);
    color: var(--secondary-color);
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.contact-info {
    display: flex;
    gap: 1rem;
}

.contact-info a svg {
    width: 30px;
    height: 30px;
    fill: var(--secondary-color);
}

.contact-info a svg:hover {
    fill: var(--background-color);
}

/* Webpage loading animation */

.loading-animation {
    display: none;
    justify-content: center;
    align-items: center;
    background-color: var(--accent-color);
    border-radius: 1rem;
    padding: 1rem;
    margin: auto;
}

.dual-ring {
    content: " ";
    width: 64px;
    height: 64px;
    display: block;
    border-radius: 50%;
    border: 6px solid var(--primary-color);
    border-color: var(--primary-color) transparent var(--secondary-color) transparent;
    margin: 8px;
    animation: dual-ring 1.2s linear infinite;
}

@keyframes dual-ring {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.show {
    display: grid;
}

.show-hero {
    background-color: unset;
    background-image: url(hero.webp);
}

/* Media queries */

@media (max-width: 1050px) {

    .main-container {
        grid-template-columns: 50px auto;
    }

    .sidebar-fixed {
        width: 50px;
        grid-template-rows: auto;
        justify-content: center;
    }

    .logo {
        display: none;
    }

    nav {
        display: grid;
        align-content: center;
        border-radius: 0 1.2rem 1.2rem 0;
    }

    nav a {
        grid-template-columns: auto;
        padding: 1rem;
    }

    nav a::before {
        transition: none;
    }

    nav a svg {
        transition: none
    }

    nav a svg+span,
    nav a span+span {
        display: none;
    }
}