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

body {
    font-family: "Spline Sans", "Noto Sans", sans-serif;
    background-color: #F8FAFC;
}

.viewport {
    max-width: 1280px;
    margin-inline: auto;
}

.header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background-color: #f8f9fa;
    white-space: nowrap;
    border-bottom: 2px solid #e7edf4;
    padding: .75em 2.5em;
    gap: 1em;
}

.brand,
.nav,
.nav__button,
.search-bar,
.avatar {
    display: inline-flex;
    align-items: center;
    height: 2.5em;
}

.search-bar:hover,
.search-bar:focus-within {
    border: 2px solid #2089F3;
}
.search-bar:hover .search-bar__icon .icon {
    fill: #2089F3;
}

.nav {
    gap: 2em;
    padding-inline: 1em;
    flex: 1 1 auto;
}
.nav__link {
    font-size: small;
    font-weight: bold;
    padding: 0.25em 1em;
    text-align: center;
    color: #0D141C !important;
    text-decoration: none;
}

.nav__link:hover {
    border-bottom: 2px solid #2089F3 !important;
    cursor: pointer;
}

.nav__link:focus {
    outline: 2px solid #2089F3;
    outline-offset: 2px;
    color: #0D141C !important;
}

.nav__button {
    user-select: none;
}

.nav__button:focus {
    outline: 1px solid #2089F3;
    outline-offset: 1px;
}

.brand {
    padding-inline: 1em;
    gap: 1em;
    color: #0d141c;
}
.brand__logo {
    display: inline-flex;
    align-items: center;
}

.icon {
    width: 1.5rem;
    height: 1.5rem;
    color: #0D141C;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icon:hover {
    cursor: pointer;
}
.nav .icon {
    display: none;
}

.search-bar {
    border: none;
    background-color: #E7EDf4;
    color: #49739C;
    padding-inline: 0.5em;
    border-radius: 2em;
    min-width: fit-content;
}

.search-bar__icon .icon {
    fill: #49739C;
}
.search-bar__input {
    width: 100%;
    overflow: hidden;
    color: #0D141C;
    border: none;
    flex: 1 1 auto;
    background-color: #E7EDF4;
    padding: 4px;
}
.search-bar__input:focus {
    outline: none;
    border: none;
}
.search-bar__input::placeholder {
    color: #49739C;
    border: none;
    outline: none;
    display: flex;
}

.avatar {
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    aspect-ratio: 1;
    width: 2.5rem;
    min-width: 2.5rem;
    border-radius: 2.5rem;
    overflow: hidden;
    justify-content: center;
}

.avatar__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}


.main {
    padding: 2em 5em;
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.user-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-inline: auto;
    gap: 1em;
}
.user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
}
.user-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.user__image {
    display: inline-flex;
    width: 7rem;
    height: 7rem;
    border-radius: 50%;
    overflow: hidden;
    background-color: #E7EDF4;
    object-fit: contain;
}
.user__image:hover {
    cursor: pointer;
}

.user__name {
    color: #0D141C;
    font-size: 22px;
    font-weight: bold;
    font-weight: 600;
    text-align: center;
}
.user__id,
.user__joining-date {
    color: #49739C;
    font-size: 16px;
    font-weight: 400;
    text-align: center;
}

/* Style modals for both states; open and close */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal__content {
    display: flex;
    flex-direction: column;
    background-color: white;
    padding: 2em;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal__title {
    font-size: 1.5rem;
    color: #0D141C;
    margin-bottom: 1em;
}

.modal__form {
    display: flex;
    flex-direction: column;
    font-size: 1rem;
    color: #49739C;
    margin-bottom: 1.5em;
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.modal__icon-button {
    order: -1;
    align-self: flex-end;
    background: none;
    border: none;
    color: #49739C;
    font-size: 1rem;
    cursor: pointer;
}

.modal__icon-button:hover {
    color: #2089F3;
}

.modal__icon-button:focus {
    outline: 2px solid #2089F3;
    outline-offset: 2px;
}

.modal__form-field {
    align-items: center;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5em;
}

.modal__form-field__label {
    color: #111418;
}

.modal__form-field__input {
    padding: 0.5em;
    border: 1px solid #CEDBE8;
    border-radius: 4px;
    font-size: 1rem;
    background-color: #EAEDF0;
    color: #111418;
}

.modal__form-field__input:focus {
    border-color: #2089F3;
    outline: none;
}
.modal__form-field__input::placeholder {
    color: #5E7287;
}

.modal__button {
    background-color: #D6E2EF;
    color: #111418;
    font-weight: bold;
    font-size: 1rem;
    padding: 0.75em 1.5em;
    border: none;
    border-radius: 2em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    align-self: flex-end;
    min-width: 100px;
}

.modal__button:hover,
.modal__button:focus {
    background-color: #176dc1;
    color: #fff;
}
.modal__button:focus {
    outline: 2px solid #2089F3;
    outline-offset: 2px;
}

.follow-user-button {
    min-width: 84px;
    max-width: 480px;
    width: 100%;
    cursor: pointer;
    display: inline-flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    white-space: nowrap;
    text-wrap: nowrap;
    background-color: #E7EDf4;
    color: #0D141C;
    font-weight: bold;
    font-size: small;
    padding: 0.75em 1em;
    border: none;
    border-radius: 2em;
}

.follow-user-button:hover,
.follow-user-button:focus {
    outline: 2px solid #2089F3;
    outline-offset: 2px;
    background-color: #2089F3;
    color: white;
}

.follow-user-button.following {
    background-color: red;
    color: white;
}
.follow-user-button.following:hover,
.follow-user-button.following:focus {
    outline: 2px solid red;
}

.tabs {
    border-bottom: 1px solid #CEDBE8;
    display: flex;
    gap: 2em;
    padding-inline: 1em;
}
.tab {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-block: 13px;
    border-bottom: 3px solid transparent;
    font-size: small;
    font-weight: bolder;
    color: #49739C;
    text-decoration: none;
}
.tab:focus {
    outline: 2px solid #2089F3;
    outline-offset: 2px;
    color: #0D141C;
}
.tab--active {
    color: #0D141C;
    border-bottom: 3px solid #2089F3;
}
.tab-content {
    padding-inline: 1em;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1em;
}

.tab:hover {
    color: #0D141C;
    cursor: pointer;
}

.post {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1em;
    padding: 1em;
    border-radius: 1em;
    border: 1px solid #E7EDF4;
}

.post:hover {
    background-color: #E7EDF4;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.post:focus {
    outline: 2px solid #2089F3;
    outline-offset: 2px;
    background-color: #E7EDF4;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.post__text-section {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 0.5em;
    max-height: 170px;
}
.post__statistics,
.post__author {
    display: inline-flex;
    color: #49739C;
    font-size: small;
    font-weight: normal;
}
.post__content {
    display: inline-flex;
    color: #0D141C;
    font-weight: bold;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;       /* Number of lines to show */
    line-clamp: 3;               /* Standard property for compatibility */
    overflow: hidden;
}
.post__image-section {
    overflow: hidden;
    border-radius: 0.75em;
    height: 100%;
}
.post__image {
    aspect-ratio: 16 / 9;
    width: 100%;
    object-fit: cover;
    border-radius: 0.75em;
    background-color: #E7EDF4;
}
.post__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


@media screen and (max-width: 1100px) {
    .search-bar {
        align-self: stretch;
        align-items: center;
    }
    .search-bar__input {
        display: none;
    }
}

@media screen and (max-width: 940px) {
    .nav .nav__link:last-of-type {
        display: none;
    }
    .header {
        padding: 0.75em 1.5em;
    }
    .main {
        padding: 2em 2.5em;
    }
}

@media screen and (max-width: 870px) {
    .nav {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        flex-grow: 0;
        order: -1;
        padding: 0;
    }
    .nav.nav--active {
        position: absolute;
        top: 0;
        left: 0;
        background-color: #f8f9fa;
        width: 100%;
        height: 100%;
        padding-inline: 24px;
        padding-block: 12px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        z-index: 1;
    }
    .nav__link {
        display: none;
    }
    .nav--active .nav__link,
    .nav--active .nav__link:last-of-type {
        display: inline-block;
        padding: 0.5em 1em;
        width: 100%;
        text-align: center;
    }
    .nav--active .nav__link:hover {
        background-color: #E7EDF4;    
        cursor: pointer;
        outline: none !important;
        border-bottom: none !important;
    }
    .nav--active .nav__link:focus {
        outline: 1px solid #2089F3 !important;
        outline-offset: 1px;
    }
    .nav__button {
        display: inline-flex;
        align-self: flex-end;
    }
    .nav--active .nav__button {
        order: -1;
        align-self: flex-start;
    }
    .nav__button .icon {
        display: inline-flex;
    }
    .search-bar {
        margin-left: auto;
    }
    .post {
        grid-template-columns: 1fr;
        border: 1px solid #e7edf4;
        border-radius: 1em;
        cursor: pointer;
    }
    .post__text-section {
        order: 1;
        padding-inline: 1em;
        padding-bottom: 1em;
    }
    .post__image-section {
        order: -1;
        height: 200px;
    }
    .post__image {
        height: 100%;
        aspect-ratio: 16 / 9;
    }
}

@media screen and (max-width: 600px) {
    .header {
        padding: 0.75em 1.5em;
    }
    .main {
        padding: 2em 1.5em;
    }
    .search-bar {
        width: fit-content;
        justify-content: center;
        align-items: center;
    }
    .search-bar__input {
        display: none;
    }
}
@media screen and (max-width: 420px) {
    .main {
        padding: 2em 1em;
    }
    .brand__name {
        display: none;
    }
    .modal__content {
        width: 90%;
        max-width: 400px;
    }
}

.layer-1 {
    border: 2px dashed black;
}

.layer-2 {
    border: 2px dashed blue;
}

.layer-3 {
    border: 2px dashed green;
}
