/* Leave the @layer declarations to prevent conflicts with editor defined styles */
@layer theme, base, components, utilities;
@layer components {
    :root {
        --page-bg: #ffffff;
        --page-bg-dark: #030712;
        --theme-text-color: var(--text-color, #111827);
        --theme-text-color-dark: var(--text-color-dark, #f3f4f6);
        --theme-heading-color: var(--heading-color, #111827);
        --theme-heading-color-dark: var(--heading-color-dark, #ffffff);
        --theme-subtitle-color: var(--subtitle-color, #6b7280);
        --theme-subtitle-color-dark: var(--subtitle-color-dark, #9ca3af);
        --theme-divider-color: #e5e7eb;
        --theme-divider-color-dark: #374151;
        --theme-nav-color: #374151;
        --theme-nav-color-dark: #e5e7eb;
        --theme-link-color: var(--link-color, var(--color-primary-main));
        --theme-link-hover-color: var(--link-hover-color, var(--color-primary-dark));
        --theme-link-underline-color: var(--link-underline-color, var(--color-primary-main));
        --theme-link-hover-underline-color: var(--link-hover-underline-color, var(--color-primary-dark));
        --theme-site-title-size: var(--site-title-size, 24px);
        --theme-site-title-font-weight: var(--site-title-font-weight, 700);
        --theme-transition-timing-funtion: cubic-bezier(0.4, 0, 0.2, 1);
    }

    body, .outer-container {
        background-color: var(--site-bg-color, var(--page-bg));
    }

    body.dark, .dark .outer-container {
        background-color: var(--page-bg-dark);
    }

    .dark .nav-link {
        color: var(--color-text-dark-bg-heading);
    }

    .inner-container {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .footer-inner {
        display: flex;
        flex-direction: column;
    }

    .main-content {
        margin-bottom: 160px;
    }

    .gradient-container {
        position: relative;
    }

    .gradient-inner {
        position: absolute;
        inset: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        opacity: 40%;

        &:where(.dark, .dark *) {
            opacity: 20%;
        }
    }

    .main-gradient-1 {
        margin-right: -208px;
        height: 224px;
        filter: blur(106px);
        background-image: linear-gradient(to bottom right, var(--color-primary-main) 0%, #c084fc 100%);

        &:where(.dark, .dark *) {
            background-image: linear-gradient(to bottom right, #1d4ed8 0%, #c084fc 100%);
        }
    }

    .main-gradient-2 {
        height: 128px;
        filter: blur(106px);
        background-image: linear-gradient(to right, #22d3ee 0%, #67e8f9 100%);

        &:where(.dark, .dark *) {
            background-image: linear-gradient(to right, #22d3ee 0%, #4f46e5 100%);
        }
    }

    .page-content {
        position: relative;
    }

    .main-header {
        position: relative;
        z-index: 20;
    }

    .main-header nav {
        z-index: 10;
        width: 100%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);

        &:where(.dark, .dark *) {
            border-color: rgba(255, 255, 255, 0.05);
        }

        @media (width >= 1024px) {
            border-color: transparent;
        }
    }

    .nav-container {
        max-width: 1280px;
        margin-inline: auto;
        padding-inline: 24px;

        @media (width >= 768px) {
            padding-inline: 48px;
        }

        @media (width >= 1280px) {
            padding-inline: 24px;
        }
    }

    .layout-logo-above .nav-container {
        padding-top: 32px;
    }

    .mobile-nav .nav-container {
        @media (width >= 1280px) {
            padding-inline: 48px;
        }
    }

    .logo-above-nav-outer {
        position: relative;
        width: 100%;
        z-index: 20;
    }

    .nav-outer {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 24px;
        padding-block: 12px;

        @media (width >= 768px) {
            gap: 0;
            padding-block: 16px;
        }
    }

    .nav-inner {
        width: max-content;
        position: relative;
        z-index: 20;
        display: flex;
        justify-content: space-between;
    }

    .mobile-nav .nav-inner {
        width: 100%;
        justify-content: space-between;
    }

    .mobile-nav-backdrop {
        display: none;
        z-index: 10;
        position: fixed;
        height: 100vh;
        width: 100vw;
        inset: 0;
        scale: 1 0;
        transform-origin: bottom;
        background-color: rgba(255, 255, 255, 0.7);
        -webkit-backdrop-filter: blur(40px);
        backdrop-filter: blur(40px);
        transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, visibility, content-visibility, overlay, pointer-events;
        transition-timing-function: var(--theme-transition-timing-funtion);
        transition-duration: 500ms;

        &:where(.dark, .dark *) {
            background-color: rgba(17, 24, 39, 0.7);
        }

        &:where(.mobile-nav-open *) {
            display: block;
            scale: 1 100%;
            transform-origin: top;
        }
    }

    .main-header .logo {
        display: flex;
        align-items: center;
    }

    .main-header .logo img {
        width: auto;
    }

    .layout-logo-above .logo {
        justify-content: center;
    }

    .logo-large {
        height: 64px;

        @media (width >= 768px) {
            height: 96px;
        }
    }

    .logo-medium {
        height: 48px;
    }

    .logo-small {
        height: 32px;
    }

    .logo-x-small {
        height: 16px;
    }

    .light-bg-logo {
        &:where(.dark, .dark *) {
            display: none;
        }
    }

    .dark-bg-logo {
        display: none;

        &:where(.dark, .dark *) {
            display: block;
        }
    }

    .text-logo {
        font-size: var(--option-site-title-size, var(--theme-site-title-size));
        line-height: 1em;
        font-weight: var(--theme-site-title-font-weight);

        &:where(.dark, .dark *) {
            color: #ffffff;
        }
    }

    .mobile-menu-button-container {
        position: relative;
        display: flex;
        align-items: center;
        max-height: 40px;
    }

    .layout-logo-above .mobile-menu-button-container {
        position: absolute;
        top: 0;
        height: 100%;
        max-height: none;
    }

    .mobile-menu-button {
        position: relative;
        cursor: pointer;
        padding: 24px;
        margin-right: -24px;
    }

    .layout-logo-above .mobile-menu-button {
        padding: 16px;
        margin-right: 0;
    }

    .mobile-cart-alert {
        position: absolute;
        display: flex;
        align-items: center;
        justify-content: center;
        top: 4px;
        right: 0;
        height: 20px;
        width: 20px;
        margin: 4px;
        background-color: var(--color-primary-main);
        border-radius: calc(infinity * 1px);
        font-size: 10px;
        font-weight: 700;
    }

    .mobile-cart-alert span {
        color: #ffffff;
    }

    .mobile-menu-button-piece {
        display: none;
        margin: auto;
        height: 2px;
        width: 20px;
        background-color: var(--theme-divider-color-dark);
        border-radius: 4px;
        transition-property: translate, rotate;
        transition-timing-function: var(--theme-transition-timing-funtion);
        transition-duration: 300ms;

        &:where(.dark, .dark *) {
            background-color: #d1d5db;
        }

        &:where(.mobile-nav *) {
            display: block;
        }
    }

    .mobile-nav-open .mobile-piece-top {
        rotate: 45deg;
        translate: 0 6px;
    }

    .mobile-piece-bottom {
        margin-top: 8px;
    }

    .mobile-nav-open .mobile-piece-bottom {
        rotate: calc(45deg * -1);
        translate: 0 -4px;
    }

    .layout-logo-above-desktop-buttons {
        position: absolute;
        top: 0;
        right: 0;
        display: flex;
        gap: 8px;

        &:where(.mobile-nav *) {
            display: none;
        }
    }

    .nav-list-container {
        visibility: visible;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 24px;
        position: relative;
        background-color: transparent;
        border-style: none;
        padding: 32px;
        opacity: 100;
        translate: 0 0;
        scale: 100% 100%;
        box-shadow: 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 0 #0000;

        &:where(.dark, .dark *) {
            background-color: transparent;
        }

        &:where(.mobile-nav *) {
            position: absolute;
            display: block;
            top: 100%;
            left: 0;
            z-index: 20;
            width: 100%;
            transform-origin: top right;
            translate: 0 4px;
            scale: 90% 90%;
            flex-direction: column;
            border-radius: 24px;
            border: 1px solid #f3f4f6;
            background-color: #ffffff;
            opacity: 0;
            transition-property: all;
            transition-timing-function: var(--theme-transition-timing-funtion);
            transition-duration: 300ms;
            box-shadow: 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 25px 50px -12px color-mix(in srgb, oklch(44.6% 0.03 256.802) 10%, transparent);

            &:where(.dark, .dark *) {
                background-color: #1f2937;
                border-color: #374151;
                box-shadow: 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 0 #0000;
            }
        }

        &:where(.mobile-nav-open *) {
            opacity: 100;
        }
    }

    .layout-logo-above .nav-list-container {
        width: 100%;
        justify-content: center;
        padding: 0;

        &:where(.mobile-nav *) {
            padding-block: 16px;
            padding-inline: 32px;
        }
    }

    .mobile-nav .mobile-nav-open .nav-list-container {
        visibility: hidden;
    }

    .nav-list-container-inner {
        width: auto;
        padding-right: 16px;

        &:where(.mobile-nav *) {
            width: 100%;
            padding-right: 0;
        }
    }

    .nav-list-container ul {
        display: flex;
        gap: 0;
        flex-direction: row;

        &:where(.mobile-nav *) {
            flex-direction: column;
            gap: 24px;
        }
    }

    .layout-logo-above .nav-list-container ul {
        justify-content: center;
        row-gap: 16px;
        flex-wrap: wrap;

        &:where(.mobile-nav *) {
            row-gap: 24px;
        }
    }

    .mobile-nav .nav-link, .subnav .nav-link {
        color: var(--theme-nav-color) !important;
    }

    .dark .mobile-nav .nav-link, .dark .subnav .nav-link {
        color: var(--theme-nav-color-dark) !important;
    }

    .nav-link {
        display: block;
        padding-inline: 16px;
        font-family: var(--font-nav_link);
        color: var(--nav-link-color, var(--theme-nav-color));
        font-size: var(--nav-link-font-size, 14px);
        letter-spacing: var(--nav-link-letter-spacing, 0.4px);
        font-weight: var(--nav-link-font-weight, 400);
        text-transform: var(--nav-link-text-transform, none);
        text-underline-offset: 4px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        transition-property: all;
        transition-timing-function: var(--theme-transition-timing-funtion);
        transition-duration: 150ms;

        &:hover {
            color: var(--nav-link-active-color, var(--color-primary-main));
            text-decoration-line: underline;
        }

        &.active {
            color: var(--nav-link-active-color, var(--color-primary-main));
            text-decoration-line: underline;
        }

        &:where(.dark, .dark *) {
            color: var(--theme-nav-color-dark);
        }

        &:where(.mobile-nav *) {
            padding-inline: 0;
        }
    }

    .dark .nav-link:hover {
        color: #ffffff;
    }

    .subnav {
        display: flex;
        flex-direction: column;
        gap: 16px;
        position: absolute;
        z-index: 20;
        padding-block: 8px;
        border-radius: 4px;
        border: 1px solid #f3f4f6;
        background-color: #ffffff;
        box-shadow: 0 0 #0000, 0 0 #0000, 0 0 #0000,0 0 #0000, 0 25px 50px -12px color-mix(in oklab, color-mix(in oklab, oklch(44.6% 0.03 256.802) 10%, transparent) 100%, transparent);

        &:where(.dark, .dark *) {
            border-color: #374151;
            background-color: #1f2937;
            box-shadow: none;
        }

        &:where(.mobile-nav *) {
            position: relative;
            padding-block: 0;
            border-radius: 0;
            border: none;
            background-color: transparent;
            box-shadow: none;
            margin-left: 40px;
            margin-top: 20px;
        }
    }

    .subnav .nav-link {
        overflow: auto;
    }

    .main-nav-item {
        position: relative;
        max-width: 320px;
    }

    .nav-button {
        &:where(.mobile-nav *) {
            margin-top: 24px;
        }
    }

    .layout-logo-above .mobile-nav .nav-button {
        margin-top: 0;
    }

    .nav-button a {
        position: relative;
        display: flex;
        height: 36px;
        width: 100%;
        align-items: center;
        justify-content: center;
        padding-inline: 16px;
        border-radius: calc(infinity * 1px);
        background-color: var(--color-primary-main);
        transition-property: all;
        transition-timing-function: var(--theme-transition-timing-funtion);
        transition-duration: 300ms;
        font-size: 14px;
        font-weight: 700;
        color: var(--theme-heading-color-dark);

        &:hover {
            scale: 105% 105%;
        }

        @media (width >= 640px) {
            width: max-content;
        }
    }

    .nav-button.highlight-button a {
        background-color: #ffffff;
        color: var(--text-color);
        border: 1px solid #9ca3af;
    }

    .mobile-nav-button {
        display: none;

        &:where(.mobile-nav *) {
            display: list-item;
        }
    }

    .mobile-nav .avatar-container {
        margin-top: 24px;
    }

    .layout-logo-above .mobile-nav .avatar-container {
        margin-top: 0;
    }

    .nav-avatar {
        display: flex;
    }

    .nav-avatar img {
        width: 48px;
        height: 48px;
        border-radius: calc(infinity * 1px);
    }

    .nav-avatar span {
        display: inline-block;
        padding: 4px;
        border-radius: calc(infinity * 1px);
        border: 1px solid var(--color-primary-main);
    }

    .nav-avatar span svg {
        width: 24px;
    }

    .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border-width: 0;
    }

    .post-list-container, .post-section {
        position: relative;
        width: 100%;
        max-width: 1024px;
        padding-inline: 32px;
        padding-block: 20px;
        margin-inline: auto;

        @media (width >= 640px) {
            max-width: 640px;
        }
        @media (width >= 768px) {
            max-width: 768px;
        }
        @media (width >= 1024px) {
            max-width: 1024px;
            padding-block: 32px;
        }
        @media (width >= 1280px) {
            padding-inline: 20px;
        }
    }

    .post-top-section {
        padding-top: 0;
        max-width: 768px;
    }

    .post-list-container h1, .post h1 {
        text-align: center;
        font-size: 30px;
        line-height: 1.2em;
        font-weight: 700;
        letter-spacing: -0.4px;

        @media (width >= 1024px) {
            font-size: 36px;
            line-height: 1.375em;
        }

        &:where(.dark, .dark *) {
            color: var(--theme-heading-color-dark);
        }
    }

    .post h1 {
        margin-top: 8px;
        margin-bottom: 12px;
    }

    .posts-grid {
        margin-top: 40px;
        display: grid;
        gap: 40px;

        @media (width >= 768px) {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        @media (width >= 1280px) {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }
    }

    .posts-grid .post {
        cursor: pointer;
    }

    .posts-grid .post-image-container {
        overflow: hidden;
        border-radius: 6px;
        transition-property: all;
        transition-timing-function: var(--theme-transition-timing-funtion);
        transition-duration: 150ms;

        &:hover {
            scale: 105% 105%;
        }
    }

    .posts-grid .post-image-container a {
        position: relative;
        display: block;
        aspect-ratio: 1 / 1;
    }

    .posts-grid .post-image-container img {
        position: absolute;
        height: 100%;
        width: 100%;
        object-fit: cover;
    }

    .post-tags {
        display: flex;
        gap: 12px;
        margin-top: 20px;
    }

    .post-tags a {
        display: inline-block;
        font-size: 12px;
        font-weight: 400;
        letter-spacing: 0.8px;
        line-height: 1.33em;
        text-transform: uppercase;
        color: var(--color-primary-main);
    }

    .posts-grid h2 {
        margin-top: 8px;
        font-size: 30px;
        font-weight: 700;
        line-height: 1.375em;
        letter-spacing: -0.4px;
        color: var(--theme-heading-color);
    }

    .posts-grid h2 a {
        background-image: linear-gradient(to right, var(--color-secondary-dark) 0%, var(--color-secondary-light) 100%);
        background-position: left bottom;
        background-repeat: no-repeat;
        background-size: 0 10px;
        transition-property: background-size;
        transition-timing-function: var(--theme-transition-timing-funtion);
        transition-duration: 500ms;

        &:hover {
            background-size: 100% 10px;
        }

        &:is(:where(.posts-grid .post):hover *) {
            @media (hover: hover) {
                background-size: 100% 10px;
            }
        }
    }

    .posts-grid .post-subtitle {
        margin-top: 8px;
        font-size: 14px;
        color: #6b7280;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;

        &:where(.dark, .dark *) {
            color: #9ca3af;
        }
    }

    .posts-grid .post-footer {
        margin-top: 12px;
        display: flex;
        gap: 12px;
        align-items: center;
        color: #6b7280;

        &:where(.dark, .dark *) {
            color: #9ca3af;
        }
    }

    .posts-grid .post-author {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .posts-grid .post-author img {
        width: 20px;
        height: 20px;
        border-radius: calc(infinity * 1px);
        object-fit: cover;
    }

    .posts-grid .post-author span {
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .posts-grid .footer-separator {
        font-size: 12px;
        line-height: 1.33em;
        color: #d1d5db;

        &:where(.dark, .dark *) {
            color: #4b5563;
        }
    }

    .posts-grid time {
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .posts-pagination {
        margin-top: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .posts-pagination nav {
        isolation: isolate;
        display: inline-flex;
        border-radius: 6px;
        box-shadow: 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgb(0 0 0 / 0.05);
    }

    .posts-pagination a {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        background: #ffffff;
        border: 1px solid #d1d5db;
        font-size: 14px;
        color: #6b7280;

        &:hover {
            background: #f9fafb;
        }

        &:where(.dark, .dark *) {
            border-color: #6b7280;
            background: #1f2937;
            color: #d1d5db;
        }
    }

    .posts-pagination a.disabled {
        pointer-events: none;
        opacity: 40%;
    }

    .posts-pagination .pagination-button-left {
        padding: 8px 16px 8px 12px;
        border-top-left-radius: 6px;
        border-bottom-left-radius: 6px;
    }

    .posts-pagination .pagination-button-right {
        padding: 8px 12px 8px 16px;
        border-top-right-radius: 6px;
        border-bottom-right-radius: 6px;
    }

    .posts-pagination svg {
        width: 12px;
        height: 12px;
    }

    .post .post-heading {
        margin-top: 12px;
        display: flex;
        justify-content: center;
        color: #6b7280;
    }

    .post .post-creation-container {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .post-heading .avatar {
        width: 40px;
        height: 40px;
        border-radius: calc(infinity * 1px);
        object-fit: cover;
    }

    .post .post-author {
        color: #1f2937;

        &:where(.dark, .dark *) {
            color: #9ca3af;
        }
    }

    .post .post-time {
        display: flex;
        align-items: center;
        font-size: 14px;

        color: var(--theme-subtitle-color);

        &:where(.dark, .dark *) {
            color: var(--theme-subtitle-color-dark);
        }
    }

    .post .cover-image {
        position: relative;
        z-index: 0;
        margin-inline: auto;
        aspect-ratio: 16 / 9;
        max-width: 1024px;
        overflow: hidden;

        @media (width >= 1024px) {
            border-radius: 8px;
        }
    }

    .post .cover-image img {
        position: absolute;
        height: 100%;
        width: 100%;
        object-fit: cover;
    }

    .post article {
        margin-inline: auto;
        max-width: 768px;
    }

    .post .post-content {
        margin-block: 12px;
        margin-inline: auto;
    }

    .post .post-social {
        display: flex;
        gap: 12px;
        justify-content: center;
        margin-top: 20px;

        @media (width >= 640px) {
            margin-top: 4px;
        }
    }

    .post .post-social a {
        color: var(--color-secondary-main);
        transition-property: scale;
        transition-timing-function: var(--theme-transition-timing-funtion);
        transition-duration: 150ms;

        &:hover {
            scale: 105% 105%;
        }
    }

    .post .post-social a svg {
        width: 24px;
    }

    .post .back-link-container {
        margin-block: 28px;
        display: flex;
        justify-content: center;
    }

    .post .back-link-container a {
        padding: 8px 20px;
        font-size: 14px;
        color: var(--theme-link-color);

        &:hover {
            color: var(--theme-link-hover-color);
        }
    }

    .post .post-footer {
        margin-top: 12px;
        border-radius: 16px;
        background: #f9fafb;
        padding: 32px;
        color: var(--theme-subtitle-color);

        &:where(.dark, .dark *) {
            background: #111827;
            color: var(--theme-subtitle-color-dark);
        }
    }

    .post .footer-author {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;

        @media (width >= 640px) {
            flex-wrap: nowrap;

        }
    }

    .post .footer-avatar {
        margin-top: 4px;
        margin-right: 24px;
    }

    .post .footer-avatar img {
        width: 96px;
        height: 96px;
        border-radius: calc(infinity * 1px);
        object-fit: cover;
    }

    .post .author-info {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .post .author-info h3 {
        font-size: 18px;
        line-height: 1.55em;
        color: #1f2937;

        &:where(.dark, .dark *) {
            color: #d1d5db;
        }
    }

    .post .author-info a {
        font-size: 14px;
        padding-block: 8px;
        color: var(--theme-link-color);

        &:hover {
            color: var(--theme-link-hover-color);
        }
    }

    .total-comments {
        margin-bottom: 12px;
    }

    .post-comments {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
}
