/* Scrollbar */
*::-webkit-scrollbar {
    width: 6px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: var(--color-background);
}

*::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--color-subtle-foreground);
}

body {
	background: var(--color-background);
	color: var(--color-foreground);
}

header#main {
    min-height: var(--nav-height);
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    justify-content: center;

    background-color: var(--color-card);
    border-bottom: 1px solid var(--color-border);

    .logo-container {
        display: flex;
        align-items: center;
        gap: .4rem;
        font-weight: bold;

        a {
            display: flex;
            align-items: center;
            font-size: 24px;
        }

        a > svg {
            color: var(--color-primary);
            transition: transform 0.2s ease-in-out;
            display: inline-block;
        }
        a:hover > svg {
            transform: rotate(30deg);
        }
    }

    a:not(.button) {
        color: var(--color-foreground);
        text-decoration: none;
        font-weight: bold;
        transition: all .2s ease;
    }

    nav.desktop {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        max-width: 80rem;
        width: 80rem;
        padding: 0 1rem;

        .links-container,
        .auth-container {
            height: 100%;
            display: flex;
            gap: 2rem;

            &:has(.button + .button) {
                gap: .5rem;
            }

            >*:not(.button) {
                display: grid;
                place-content: center;
                position: relative;

                &::after {
                    content: "";
                    position: absolute;
                    width: 0;
                    height: 2px;
                    bottom: 0;
                    left: 50%;
                    transform: translateX(-50%);
                    background: linear-gradient(90deg, #34d399, #22d3ee);
                    transition: width 0.2s ease;
                }

                &:hover {
                    color: var(--color-primary);
                }

                &:hover::after {
                    width: 100%;
                }

                &.active {
                    color: var(--color-primary);
                }

                &.active::after {
                    width: 100%;
                }
            }

            .button {
                align-self: center;
            }
        }
    }

    nav.mobile {
        flex: 1;
        display: none;
        grid-template-rows: var(--nav-height) 0fr;
        padding: 0 1rem;
        background-color: var(--color-card);
        transition: all .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        z-index: 3;

        .nav-toggle {
            label {
                border: 1px solid white;
                border-radius: 100vw;
                display: inline-block;
            }

            /* https://jonsuh.com/hamburgers/ */
            .hamburger {
                padding: 15px 15px;
                display: inline-block;
                cursor: pointer;
                transition-property: opacity, filter;
                transition-duration: 0.15s;
                transition-timing-function: linear;
                font: inherit;
                color: inherit;
                text-transform: none;
                background-color: transparent;
                border: 0;
                margin: 0;
                overflow: visible;
            }

            .hamburger:hover {
                opacity: 0.7;
            }

            .hamburger-box {
                width: 40px;
                height: 24px;
                display: inline-block;
                position: relative;
            }

            .hamburger-inner {
                display: block;
                top: 50%;
                margin-top: -2px;
            }

            .hamburger-inner,
            .hamburger-inner::before,
            .hamburger-inner::after {
                width: 40px;
                height: 4px;
                background-color: var(--color-secondary);
                border-radius: 4px;
                position: absolute;
                transition-property: transform;
                transition-duration: 0.15s;
                transition-timing-function: ease;
            }

            .hamburger-inner::before,
            .hamburger-inner::after {
                content: "";
                display: block;
            }

            .hamburger-inner::before {
                top: -10px;
            }

            .hamburger-inner::after {
                bottom: -10px;
            }

            .hamburger--squeeze .hamburger-inner {
                transition-duration: 0.075s;
                transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
            }

            .hamburger--squeeze .hamburger-inner::before {
                transition: top 0.075s 0.12s ease, opacity 0.075s ease;
            }

            .hamburger--squeeze .hamburger-inner::after {
                transition: bottom 0.075s 0.12s ease, transform 0.075s cubic-bezier(0.55, 0.055, 0.675, 0.19);
            }

            #nav-content-toggle {
                display: none;
            }
        }

        .mobile-nav-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .mobile-nav-content {
            overflow: hidden;
            opacity: 0;
            visibility: hidden;
            transition: all .3s ease-in;

            .links-container {
                display: flex;
                flex-direction: column;
                gap: 1rem;
                padding: 1rem;
                font-weight: bold;
            }

            .links-container>* {
                padding: 1rem;
                font-size: 1.1rem;
                text-align: center;
                border-radius: var(--radius);
                transition: all .2s ease-in-out;

                &:hover {
                    color: var(--color-secondary);
                    background-color: var(--color-muted);
                }

                &.active {
                    color: var(--color-background);
                    background-color: rgb(8, 128, 146);
                }
            }
        }
    }

    /* mobile nav toggle */
    .mobile:has(#nav-content-toggle:checked) {
        grid-template-rows: var(--nav-height) 1fr;
    }

    .mobile:has(#nav-content-toggle:checked) .mobile-nav-content {
        opacity: 1;
        visibility: visible;
    }

    #nav-content-toggle:checked+label .hamburger-inner {
        transform: rotate(45deg);
        transition-delay: 0.12s;
        transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    }

    #nav-content-toggle:checked+label .hamburger-inner::before {
        top: 0;
        opacity: 0;
        transition: top 0.075s ease, opacity 0.075s 0.12s ease;
    }

    #nav-content-toggle:checked+label .hamburger-inner::after {
        bottom: 0;
        transform: rotate(-90deg);
        transition: bottom 0.075s ease, transform 0.075s 0.12s cubic-bezier(0.215, 0.61, 0.355, 1);
    }
}

@media (max-width: 1024px) {
    header#main {
        backdrop-filter: none;
        border-bottom: 1px solid transparent;
    }

    nav.desktop {
        display: none !important;
    }

    nav.mobile {
        display: grid !important;
        border-bottom: 1px solid var(--color-border);
    }
}

footer {
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
    padding: 1rem;

    .footer-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
        text-align: center;
    }

    .footer-logo {
        font-size: 1.5rem;
        font-weight: 700;
        background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .footer-links {
        display: flex;
        gap: 2rem;
        flex-wrap: wrap;
        justify-content: center;

        a {
            color: var(--color-subtle-foreground);
            font-size: 0.95rem;
        }
    }

}

.link {
    color: var(--color-secondary);
    text-decoration: underline 0.1em transparent;
    text-underline-offset: 0.5em;
    transition: all 0.2s ease-in-out;

    &:hover,
    &:focus-visible {
        color: var(--color-secondary);
        text-decoration-color: var(--color-secondary);
        text-underline-offset: 0.15em;
    }

    &:has(svg) {
        display: inline-flex;
        align-items: center;
        gap: .5rem;
    }
}

.button {
    padding: 0.625rem 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--color-foreground);
    text-decoration: none;
    white-space: nowrap;
    outline: 2px solid transparent;
    cursor: pointer;

    &:hover:not(:disabled) {
        background-color: var(--color-muted);
    }

    /* &:active:not(:disabled) {
        transform: scale3d(0.95, 0.95, 0.95);
    } */

    &:focus-visible {
        outline: 2px solid var(--color-primary);
        outline-offset: 4px;
    }

    &.outlined {
        background: var(--color-card);
        color: var(--color-foreground);
        border-color: var(--color-border);

        &:hover:not(:disabled) {
            color: var(--color-primary);
            border-color: rgba(52, 211, 153, 0.3);
        }
    }

    &.cta {
        color: var(--color-background);
        font-weight: bold;
        background-size: 300% 100%;
        background-image: linear-gradient(to right, var(--color-primary), rgb(52, 211, 200), white, rgb(34, 238, 214), var(--color-secondary));
        transition: all .2s ease-in-out;

        &:hover {
            background-position: 100% 0;
        }
    }

    &.error {
        color: var(--color-destructive);
        border-color: var(--color-destructive-light);

        &:hover:not(:disabled) {
            color: var(--color-destructive);
            background-color: var(--color-destructive-lighter);
            border-color: var(--color-destructive-light);
        }

        &:active:not(:disabled) {
            background-color: var(--color-destructive-lighter);
        }
    }

    &.small {
        padding: 0.375rem 0.75rem;
        font-size: 14px;
        gap: 0.5rem;
    }

    .loading-icon {
        width: 0px;
        aspect-ratio: 1/1;
        transition: all .2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    &:has(.loading-icon) {
        padding-right: .75rem;
    }
    &.loading {
        padding-right: 1.25rem;
        cursor: progress;
        user-select: none;

        /* reveal loading icon on loading class */
        .loading-icon {
            width: 16px; /* TODO: add variable size later */
        }
    }

    /* Loading spinner color overrides for different button types */
    &.outline.loading::after {
        border-top-color: var(--color-foreground);
    }

    &.error.loading::after {
        border-top-color: #ef4444;
    }

    &:disabled,
    &.disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
}

/* htmx request state — any hx-* form gets a spinner on its submit button */
/* reveal loading icon on loading class */
form.htmx-request .button .loading-icon {
    width: 16px; /* TODO: add variable size later */
}

.card {
    background-color: var(--color-card);
    border: 1px solid var(--color-border);
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;

    h2,
    h3 {
        font-size: 1.5rem;
        line-height: 1;
    }
}

.profile-avatar {
    --_width: 120px;
    position: relative;
    width: var(--_width);
    height: var(--_width);
    border: 3px solid var(--color-primary);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.3);
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;

    img,
    label {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    img {
        object-fit: cover;
    }

    label {
        display: grid;
        place-content: center;
        cursor: pointer;
        color: red;
        background-color: rgba(0, 0, 0, 0.3);
        opacity: 0;
        transition: all .16s ease-in-out;

        &:hover {
            opacity: 1;
        }
    }

    &:has(input:checked) {
        img {
            display: none;
        }

        label {
            opacity: 0;
        }
    }
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: auto;

    svg {
        width: 60px;
        height: 60px;
        color: var(--color-background);
    }
}

.profile-picture-section {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.5rem;
	padding-bottom: 1.6rem;
	border-bottom: 1px solid var(--color-border);
}

.b-dropdown {
	position: relative;

	button {
		width: 100%;
		padding: 1rem;
		justify-content: space-between;
		border: 1px solid var(--color-border);

		&:focus {
			outline: none;
			border-color: var(--color-primary);
			box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
		}

		& svg {
			width: 24px;
			height: 24px;
			transition: transform 0.2s ease;
		}

		&.open svg {
			transform: rotate(180deg);
		}
	}

	.b-dropdown-menu {
		position: absolute;
		top: calc(100% + 0.5rem);
		left: 0;
		right: 0;
		background-color: var(--color-card);
		border: 1px solid var(--color-border-strong);
		border-radius: 0.5rem;
		max-height: 250px;
		overflow-y: auto;
		z-index: 5;
		box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
		opacity: 0;
		visibility: hidden;
		transform: translateY(-10px);
		transition: all 0.2s ease-in-out;

		&.open {
			opacity: 1;
			visibility: visible;
			transform: translateY(0);
		}
	}

	.dropdown-search {
		position: sticky;
		top: 0;
		padding: 0.75rem;
		background-color: var(--color-card);
		border-bottom: 1px solid var(--color-border);

		input {
			width: 100%;
			padding: 0.5rem;
			background-color: var(--color-background);
			border: 1px solid var(--color-border);
			border-radius: 0.25rem;
			color: var(--color-foreground);
			font-size: 0.875rem;
		}

		input:focus {
			outline: none;
			border-color: var(--color-primary);
		}
	}

	.dropdown-option {
		padding: 0.75rem 1rem;
		cursor: pointer;
		transition: background-color 0.15s ease;
		font-size: 0.875rem;

		&:hover {
			background-color: rgba(52, 211, 153, 0.1);
		}

		&.selected {
			background-color: rgba(52, 211, 153, 0.15);
			color: var(--color-primary);
		}
	}
}

/* code block */
.code-block {
    margin-top: 1rem;
    padding: var(--space-4);
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;

    + *:not(.code-block) {
        margin-top: 1rem;
    }

    .code-block-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: var(--space-3);
    }

    code {
        display: block;
        color: var(--color-primary);
        font-size: 1rem;

        &.comment {
            color: var(--color-subtle-foreground);
        }
    }
}

/* article container */
.article-container {
    display: grid;
    grid-template-columns: 3fr 2fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header header"
        "article aside";
    column-gap: var(--space-6);

    header {
        grid-area: header;
    }

    article,
    .main-content {
        grid-area: article;

        .tut-block:not(.tut-block:first-child),
        .tut-hr {
            margin-top: 2rem;
        }

        h2 {
            padding-top: 0.6rem;
        }
    }

    aside {
        grid-area: aside;
        align-self: start;
        position: sticky;
        top: calc(var(--nav-height) + 1rem);
    }
}

@media (max-width: 1024px) {
    .article-container {
        display: block;
    }

    aside {
        margin-block: var(--space-6);
    }
}

.b-badge {
    --_clr-bg: var(--color-background);
    --_clr-text: var(--color-muted-foreground);

    width: fit-content;
    height: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius);
    color: var(--_clr-text);
    border: 1px solid var(--_clr-text);
    background: color-mix(in oklch, var(--_clr-bg) 80%, transparent);
    backdrop-filter: blur(6px);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: lowercase;
    letter-spacing: 0.5px;

    &.Easy,
    &.easy {
        background: rgba(52, 211, 153, 0.15);
        color: var(--color-primary);
        border: 1px solid rgba(52, 211, 153, 0.3);
    }

    &.Medium,
    &.medium {
        background: rgba(251, 191, 36, 0.15);
        color: #fbbf24;
        border: 1px solid rgba(251, 191, 36, 0.3);
    }

    &.Hard,
    &.hard {
        background: rgba(239, 68, 68, 0.15);
        color: #ef4444;
        border: 1px solid rgba(239, 68, 68, 0.3);
    }

    &.available {
        --_clr-bg: var(--color-background);
        --_clr-text: var(--color-muted-foreground);
    }

    /* Membership, not status — accent colored but no pulsing dot. */
    &.joined {
        background: rgba(52, 211, 153, 0.15);
        color: var(--color-primary);
        border: 1px solid rgba(52, 211, 153, 0.3);
    }

    &.running {
        --_clr-bg: var(--color-primary);
        --_clr-text: var(--color-primary);
        background: color-mix(in oklch, var(--_clr-bg) 40%, transparent);

        &::before {
            content: '';
            width: 8px;
            height: 8px;
            background-color: var(--color-primary);
            border-radius: 50%;
            animation: pulse 2s ease-in-out infinite;
        }
    }
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.sub-dashboard {
    margin-bottom: 3rem;

    h2 {
        color: #fff;
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }

    h2 + h2,
    .sub-table-scroll + h2 {
        margin-top: 2.5rem;
    }

    .sub-table-scroll {
        overflow-x: auto;
        background: var(--color-card);
        border: 1px solid var(--color-border);
        border-radius: 1rem;
    }

    .sub-table {
        width: 100%;
        border-collapse: collapse;
        min-width: 40rem;

        th,
        td {
            padding: 0.9rem 1.25rem;
            text-align: left;
            vertical-align: top;
        }

        th {
            background: var(--color-muted);
            color: var(--color-subtle-foreground);
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
        }

        tbody tr + tr {
            border-top: 1px solid var(--color-border);
        }

        tr.is-past {
            opacity: 0.65;
        }
    }

    .align-right {
        text-align: right;
    }

    .sub-plan {
        color: #fff;
        font-weight: 700;
    }

    .sub-price {
        color: var(--color-primary);
        font-size: 0.85rem;
    }

    .sub-ref,
    .sub-note {
        color: var(--color-subtle-foreground);
        font-size: 0.7rem;
    }

    .sub-ref {
        font-family: var(--font-mono, monospace);
        margin-top: 0.2rem;
        word-break: break-all;
    }

    .sub-note {
        font-size: 0.75rem;
        margin-top: 0.25rem;
    }

    .sub-date {
        color: var(--color-foreground);
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .sub-empty {
        color: var(--color-subtle-foreground);
    }

    .status-pill {
        display: inline-block;
        padding: 0.2rem 0.7rem;
        border-radius: 999px;
        border: 1px solid var(--color-border);
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        white-space: nowrap;
    }

    .status-active,
    .status-trialing {
        border-color: var(--color-primary);
        background: rgba(52, 211, 153, 0.12);
        color: var(--color-primary);
    }

    .status-past_due,
    .status-unpaid,
    .status-incomplete {
        border-color: #f59e0b;
        background: rgba(245, 158, 11, 0.12);
        color: #fbbf24;
    }

    .status-canceled,
    .status-refunded,
    .status-incomplete_expired {
        border-color: #ef4444;
        background: rgba(239, 68, 68, 0.1);
        color: #f87171;
    }

    .btn-cancel {
        padding: 0.45rem 1rem;
        border-radius: var(--radius);
        border: 1px solid rgba(239, 68, 68, 0.5);
        background: transparent;
        color: #f87171;
        font-size: 0.85rem;
        cursor: pointer;
        transition: background 0.2s ease;

        &:hover {
            background: rgba(239, 68, 68, 0.1);
        }
    }

    .btn-portal {
        padding: 0.45rem 1rem;
        border-radius: var(--radius);
        border: 1px solid rgba(148, 163, 184, 0.5);
        background: transparent;
        color: inherit;
        font-size: 0.85rem;
        cursor: pointer;
        transition: background 0.2s ease;

        &:hover {
            background: rgba(148, 163, 184, 0.12);
        }
    }
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-0.5rem);
    }
}

.toast {
    animation: toast-in 0.3s ease both;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Generic: banner.html's alerts leave through this same class. */
.is-dismissing {
    opacity: 0;
    transform: translateY(-1.25rem);
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: none;
    }

    .toast,
    .is-dismissing {
        transition: opacity 0.01ms;
    }
}

/* Filter Chips */
.filter-chips {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;

    > * {
        --_active-color: #34d399;

        padding: 0.4rem 1.2rem;
        border: 1px solid var(--color-border-strong);
        background: var(--color-card);
        color: var(--color-subtle-foreground);
        border-radius: 2rem;
        font-weight: bold;
        cursor: pointer;
        user-select: none;
        transition: all 0.2s ease-in-out, padding 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);

        &:hover {
            border-color: var(--color-primary);
            color: var(--color-foreground);
            background-color: var(--color-muted);
        }

        input {
            display: none;
        }

        /* text content */
        *:not(input) {
            --_size: 0;

            position: relative;

            /* the dot */
            &::after {
                content: "";
                position: absolute;
                width: var(--_size);
                height: var(--_size);
                border-radius: 50%;
                top: 50%;
                right: -1.2rem;
                transform: translateY(-50%);
                background: var(--_active-color);
                transition: width 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
                /* transform-origin: right center; */
                transform-origin: left;
            }
        }

        &:has(input:checked) {
            background: rgba(52, 211, 153, 0.15);
            border-color: var(--color-primary);
            color: var(--color-primary);

            padding-right: 2rem;

            :not(input)::after {
                --_size: 10px;
            }
        }

        &[for="medium"] {
            --_active-color: #fbbf24;
        }
        &[for="hard"] {
            --_active-color: var(--color-destructive);
        }
    }
}

/* Accordion */
.b-accordion {
    --_label-height: 4rem;
    --_clr-border: transparent;
    margin: 1rem auto;
    width: 100%;
    max-width: 64rem;
    display: grid;
    grid-template-rows: var(--_label-height) 0fr;
    transition: all .2s ease-in-out;
    background-color: var(--color-card);
    border: 1px solid var(--_clr-border);
    border-radius: var(--radius);

    &:first-of-type {
        margin-top: 0;
    }

    &:last-of-type {
        margin-bottom: 0;
    }

    &:has(label:hover) {
        --_clr-border: var(--color-border);
    }

    &:has(input:checked) {
        grid-template-rows: var(--_label-height) 1fr;
        --_clr-border: var(--color-border);

        .content {
            opacity: 1;
        }
    }

    &:not(:has(input:checked)) label svg {
        transform: rotate(0deg);
    }

    >input {
        display: none;
    }

    label {
        padding: 0 1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        user-select: none;

        svg {
            width: 18px;
            height: 18px;
            transform: rotate(90deg);
            transition: all .2s ease-in-out;
            color: var(--color-foreground);
        }
    }

    .content {
        overflow: hidden;
        opacity: 0;
        transition: all .4s ease-in-out;

        >* {
            padding: 0 1rem 1rem;
            color: var(--color-subtle-foreground);

            >*+* {
                margin-top: var(--space-2);
            }
        }
    }
}

.comp-table {
    .comp-info {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .content {
        border-left: 3px solid transparent;

        &.status-upcoming {
            border-left-color: var(--color-secondary);
            background: rgba(34, 211, 238, 0.04);
        }

        &.status-active {
            border-left-color: var(--color-primary);
            background: rgba(52, 211, 153, 0.05);
        }

        &.status-completed {
            border-left-color: var(--color-border);
            opacity: 0.6;
        }
    }

    &:has(.content.show) .content:not(.show) {
        display: none;
    }
}

/* Table */
.table {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    width: 100%;
    overflow-x: auto;

    header,
    .content {
        display: grid;
        grid-template-columns: 70px minmax(10rem, 1fr) 120px 100px;
        place-items: center;
        gap: 1rem;
        padding: 15px 20px;
        min-width: fit-content;
    }

    header {
        background: var(--color-muted);
        font-size: 0.9rem;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--color-subtle-foreground);
    }

    .content {
        border-bottom: 1px solid var(--color-border);

        &:last-of-type {
            border-bottom: none;
        }

        &:hover {
            background: rgba(52, 211, 153, 0.03);
        }

        .comp-name-link {
            position: relative;
            height: 100%;
            color: var(--color-foreground);
            text-decoration: none;
            font-weight: 600;
            font-size: 1rem;
            transition: color 0.2s ease;
            display: flex;
            align-items: center;
            gap: 0.5rem;

            &:hover {
                color: var(--color-primary);
            }

            & svg {
                width: 16px;
                height: 16px;
                opacity: 0;
                transform: translateX(-4px);
                transition: all 0.2s ease;
            }

            &:hover svg {
                opacity: 1;
                transform: translateX(0);
            }

            .crown-icon {
                position: absolute;
                top: 5px;
                left: 0;
                width: 20px;
                height: 20px;
                transform: rotateZ(-40deg);
            }
        }

        .schedule-cell {
            display: grid;
            place-self: center;
            gap: 0.25rem;
        }

        .schedule-dates {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--color-foreground);
        }

        .schedule-dates svg {
            width: 16px;
            height: 16px;
            color: var(--color-secondary);
            flex-shrink: 0;
        }

        .schedule-arrow {
            color: var(--color-subtle-foreground)!important;
        }

        .schedule-duration {
            font-size: 0.9375rem;
            color: var(--color-subtle-foreground);
            padding-left: 1.5rem;
        }
    }

}


/* Tutorial quiz flag card */
@keyframes flag-card-in {
    from {
        opacity: 0;
        transform: translateY(0.5rem);
    }
}

@keyframes flag-glow {
    0% {
        text-shadow: none;
    }

    40% {
        text-shadow: 0 0 14px rgba(34, 211, 238, 0.8);
    }

    100% {
        text-shadow: 0 0 6px rgba(52, 211, 153, 0.35);
    }
}

.tut-flag-wrap {
    display: grid;
    grid-template-rows: 1fr;
    transition: all 0.3s ease-out;

    > .tut-flag-card {
        overflow: hidden;
        min-height: 0;
        transition: margin-top 0.3s ease-out;
    }
}

#quiz-card.htmx-added {
    opacity: 1;
}

#quiz-card.htmx-added .tut-flag-wrap {
    grid-template-rows: 0fr;

    > .tut-flag-card {
        margin-top: 0;
    }
}

.tut-flag-card {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: var(--radius);
    background: rgba(52, 211, 153, 0.08);
    animation: flag-card-in 0.3s ease-out both;
}

.tut-flag-code {
    margin-top: 0.5rem;
    font-family: monospace;
    font-size: 1.125rem;
    letter-spacing: 2px;
    color: var(--color-secondary);
    animation: flag-glow 1.2s ease-out 0.6s 1 both;
}

.toast-check path {
    stroke-dasharray: 12;
    stroke-dashoffset: 12;
    animation: check-draw 0.4s ease-out 0.15s forwards;
}

@keyframes check-draw {
    to {
        stroke-dashoffset: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tut-flag-card,
    .tut-flag-code,
    .toast-check path,
    form.htmx-request button[type="submit"]::after {
        animation: none;
    }

    .tut-flag-wrap,
    .tut-flag-wrap > .tut-flag-card {
        transition: none;
    }

    .toast-check path {
        stroke-dashoffset: 0;
    }

    form.htmx-request button[type="submit"]::after {
        content: none;
    }

    .htmx-added {
        opacity: 1;
    }
}

/* Animated background orbs */
#body-container {
    overflow: clip;
}

:has(> .orbs) {
    isolation: isolate;
}

.orbs {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    contain: layout style;

    .orb {
        position: absolute;
        border-radius: 50%;
        aspect-ratio: 1 / 1;
        opacity: 0.4;
        animation: orb-float 8s ease-in-out infinite;
        will-change: transform;
        contain: strict;
    }

    .orb-1 {
        width: min(800px, 120vw);
        background: radial-gradient(circle closest-side, var(--color-primary), transparent);
        top: -20%;
        right: -10%;
    }

    .orb-2 {
        width: min(650px, 100vw);
        background: radial-gradient(circle closest-side, var(--color-secondary), transparent);
        bottom: -20%;
        left: -10%;
        animation-delay: -4s;
    }

    .orb-3 {
        width: min(500px, 80vw);
        background: radial-gradient(circle closest-side, #8b5cf6, transparent);
        top: 50%;
        left: 50%;
        translate: -50% -50%;
        animation-delay: -2s;
        opacity: 0.2;
    }
}

@keyframes orb-float {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -30px) scale(1.05);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.95);
    }
}

@media (prefers-reduced-motion: reduce) {
    .orbs .orb {
        animation: none;
        will-change: auto;
    }
}

form:has(.form-group) {
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-wrapper {
    --_color-background: hsl(216, 31%, 17%);
    --_color-border: hsl(215, 25%, 27%);

    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--_color-background);
    border: 1px solid var(--_color-border);
    border-radius: 0.5rem;
    overflow: hidden;
    transition: all .2s ease-in-out;

    &:has(input:focus-within) {
        --_color-background: var(--color-background);
        --_color-border: var(--color-primary);
    }

    &:has(input:user-invalid),
    &:has(input[aria-invalid="true"]),
    &:has(select[aria-invalid="true"]) {
        --_color-border: hsla(357, 100%, 45%, 0.6);
    }

    &:has(input:user-invalid:focus),
    &:has(input[aria-invalid="true"]:focus),
    &:has(select[aria-invalid="true"]:focus) {
        --_color-border: hsl(357, 100%, 45%);
    }

    &:has(input:user-invalid),
    &:has(input[aria-invalid="true"]) {
        color: hsl(357, 100%, 45%);
    }

    input {
        width: 100%;
        padding: 0.75rem 1rem;
        transition: inherit;

        &:not(:placeholder-shown) {
            background-color: var(--color-background, hsl(240, 21%, 15%));
        }

        &:disabled {
            opacity: 50%;
            cursor: not-allowed;
            pointer-events: none;
        }
    }

    .input-icon {
        position: absolute;
        left: 1rem;
        pointer-events: none;
        transition: all .2s ease-in-out;
    }
    &:has(.input-icon) input {
        padding-left: 3rem;
    }
    &:has(input:focus),
    &:has(input:not(:placeholder-shown)) {
        input {
            padding-left: 1rem;
        }

        .input-icon {
            left: -1.4rem;
        }
    }
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;

    input[type="checkbox"] {
        flex-shrink: 0;
        width: 1rem;
        height: 1rem;
        border-radius: 0.25rem;
        border: 1px solid var(--border, #334155);
        accent-color: var(--color-primary);
        cursor: pointer;
    }
}
