:root {
    color-scheme: light;
    --primary: #2976ae;
    --primary-hover: #155b93;
    --on-primary: #ffffff;
    --primary-container: #d9ebf7;
    --on-primary-container: #092f49;
    --secondary: #155b93;
    --secondary-container: #dbe7f0;
    --on-secondary-container: #102b3e;
    --tertiary: #59636f;
    --tertiary-container: #e1e5eb;
    --surface: #fffbfe;
    --surface-low: #f7f2fa;
    --surface-container: #f3edf7;
    --surface-high: #ece6f0;
    --on-surface: #1d1b20;
    --on-surface-muted: #49454f;
    --outline: #79747e;
    --outline-soft: #cac4d0;
    --error: #b3261e;
    --error-container: #f9dedc;
    --success: #326b4a;
    --success-container: #d4eedc;
    --rating: #b56d00;
    --badge-bg: #fff1cf;
    --badge-fg: #694700;
    --shadow: 0 2px 10px rgba(29, 27, 32, 0.08);
    --shadow-raised: 0 14px 36px rgba(57, 46, 84, 0.13);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --content: 1240px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--surface);
    color: var(--on-surface);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

a {
    color: var(--primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    text-decoration-thickness: 2px;
}

img {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

h1,
h2,
h3,
h4 {
    color: var(--on-surface);
    line-height: 1.15;
}

h1 {
    font-size: clamp(2.35rem, 5vw, 4.8rem);
    letter-spacing: -0.045em;
}

h2 {
    font-size: clamp(1.75rem, 3vw, 2.55rem);
    letter-spacing: -0.025em;
}

h3 {
    font-size: 1.2rem;
}

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1000;
    transform: translateY(-150%);
    border-radius: var(--radius-sm);
    background: var(--on-surface);
    color: var(--surface);
    padding: 10px 14px;
}

.skip-link:focus {
    transform: translateY(0);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid color-mix(in srgb, var(--outline-soft) 70%, transparent);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(18px);
}

.navbar {
    display: flex;
    align-items: center;
    gap: 32px;
    width: min(calc(100% - 40px), var(--content));
    min-height: 72px;
    margin: 0 auto;
}

.nav-brand {
    flex: 0 0 auto;
}

.nav-brand a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo,
.brand-logo img {
    display: block;
    width: 116px;
    height: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.nav-links > a,
.nav-links form button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--on-surface-muted);
    cursor: pointer;
    font-weight: 650;
    padding: 8px 14px;
    text-decoration: none;
}

.nav-links > a:hover,
.nav-links form button:hover {
    background: var(--surface-container);
    color: var(--primary);
}

.nav-spacer {
    flex: 1;
}

.nav-links form {
    display: inline-flex;
    margin: 0;
}

.nav-links .nav-cta,
.nav-links form .nav-cta {
    background: var(--primary);
    color: var(--on-primary);
    padding-inline: 20px;
}

.nav-links .nav-cta:hover,
.nav-links form .nav-cta:hover {
    background: var(--primary-hover);
    color: var(--on-primary);
}

.nav-links .theme-toggle {
    display: inline-flex;
    width: 42px;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--on-surface-muted);
    cursor: pointer;
    padding: 8px;
    transition: background 160ms ease, color 160ms ease;
}

.nav-links .theme-toggle:hover {
    background: var(--surface-container);
    color: var(--primary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.theme-toggle [data-icon="dark"],
.theme-toggle [data-icon="system"] {
    display: none;
}

:root[data-theme="dark"] .theme-toggle [data-icon="light"] {
    display: none;
}

:root[data-theme="dark"] .theme-toggle [data-icon="dark"] {
    display: block;
}

:root[data-theme="system"] .theme-toggle [data-icon="system"] {
    display: block;
}

:root[data-theme="system"] .theme-toggle [data-icon="light"],
:root[data-theme="system"] .theme-toggle [data-icon="dark"] {
    display: none;
}

main {
    min-height: calc(100vh - 160px);
}

.page-container {
    width: min(calc(100% - 40px), var(--content));
    margin: 0 auto;
    padding: 56px 0 80px;
}

.page-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
    gap: 48px;
    align-items: end;
    margin-bottom: 40px;
}

.page-header h1 {
    max-width: 760px;
    margin-bottom: 0;
    font-size: clamp(2.15rem, 4vw, 3.7rem);
}

.page-header p {
    margin-bottom: 4px;
    color: var(--on-surface-muted);
    font-size: 1.06rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--primary);
    font-size: 0.77rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.eyebrow::before {
    width: 22px;
    height: 3px;
    border-radius: 99px;
    background: var(--tertiary);
    content: "";
}

.muted {
    color: var(--on-surface-muted);
}

.btn {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    padding: 10px 22px;
    text-align: center;
    text-decoration: none;
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 22%, transparent);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    border-color: var(--outline-soft);
    background: transparent;
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary-container);
}

/* Irreversible actions (deleting the account). The container colour reads on
   the error colour in both themes. */
.btn-danger {
    background: var(--error);
    color: var(--error-container);
}

.btn-danger:hover {
    background: color-mix(in srgb, var(--error) 88%, black);
}

.danger-zone {
    border-top: 1px solid var(--outline-soft);
    margin-top: 32px;
    padding-top: 24px;
}

.plain-list {
    margin: 0 0 16px;
    padding-left: 20px;
    text-align: left;
}

.full-width {
    width: 100%;
}

.hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
    gap: clamp(48px, 8vw, 112px);
    align-items: center;
    min-height: 620px;
    padding: 72px 0 88px;
}

.hero::before {
    position: absolute;
    top: 9%;
    right: -8%;
    z-index: -1;
    width: 42%;
    height: 82%;
    border-radius: 48% 52% 42% 58% / 55% 43% 57% 45%;
    background: var(--primary-container);
    content: "";
    transform: rotate(-8deg);
}

.hero-copy h1 {
    max-width: 800px;
    margin-bottom: 24px;
}

.hero-copy h1 span {
    color: var(--primary);
}

.hero-copy > p {
    max-width: 640px;
    margin-bottom: 32px;
    color: var(--on-surface-muted);
    font-size: clamp(1.08rem, 2vw, 1.3rem);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.project-board {
    position: relative;
    max-width: 440px;
    margin-left: auto;
    border: 1px solid var(--outline-soft);
    border-radius: 30px;
    background: var(--surface);
    box-shadow: var(--shadow-raised);
    padding: 28px;
    transform: rotate(2deg);
}

.project-board::before {
    position: absolute;
    top: -18px;
    right: 42px;
    width: 82px;
    height: 36px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--tertiary-container) 82%, transparent);
    content: "";
    transform: rotate(-6deg);
}

.board-label {
    color: var(--on-surface-muted);
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.project-board h2 {
    margin: 8px 0 26px;
    font-size: 1.65rem;
}

.board-swatch {
    height: 150px;
    margin-bottom: 20px;
    border-radius: 18px;
    background:
        linear-gradient(145deg, transparent 46%, rgba(255,255,255,0.24) 47% 52%, transparent 53%),
        linear-gradient(120deg, var(--primary), var(--tertiary));
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.board-stat {
    border-radius: 12px;
    background: var(--surface-container);
    padding: 12px;
}

.board-stat strong,
.board-stat span {
    display: block;
}

.board-stat span {
    color: var(--on-surface-muted);
    font-size: 0.72rem;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.section-heading h2,
.section-heading p {
    margin-bottom: 0;
}

.section-heading p {
    max-width: 520px;
    color: var(--on-surface-muted);
}

.features,
.store-grid,
.article-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.features {
    padding-bottom: 72px;
}

.feature-card,
.auth-card,
.store-item,
.article-card,
.content-card,
.profile-header {
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.feature-card {
    position: relative;
    min-height: 220px;
    overflow: hidden;
    padding: 28px;
}

.feature-number {
    display: block;
    margin-bottom: 44px;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 800;
}

.feature-card::after {
    position: absolute;
    right: -38px;
    bottom: -48px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: var(--secondary-container);
    content: "";
}

.feature-card:nth-child(2)::after {
    background: var(--tertiary-container);
}

.feature-card p {
    margin-bottom: 0;
    color: var(--on-surface-muted);
}

.article-grid,
.store-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.article-card,
.store-item {
    display: flex;
    overflow: hidden;
    flex-direction: column;
    transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.article-card:hover,
.store-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-raised);
    transform: translateY(-3px);
}

.article-image,
.item-image {
    position: relative;
    overflow: hidden;
    height: 190px;
    background:
        radial-gradient(circle at 28% 30%, var(--tertiary-container) 0 15%, transparent 16%),
        linear-gradient(135deg, var(--secondary-container), var(--surface-high));
}

.article-image::after,
.item-image::after {
    position: absolute;
    right: -20px;
    bottom: -45px;
    width: 150px;
    height: 110px;
    border: 24px solid color-mix(in srgb, var(--primary) 40%, transparent);
    border-radius: 50%;
    content: "";
}

.article-image img,
.item-image img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-body,
.item-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 24px;
}

.catalog-swatch {
    display: grid;
    place-items: center;
    height: 100%;
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary);
}

.checkout-lines {
    padding: 0;
    list-style: none;
}

.checkout-lines li {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 0;
    border-bottom: 1px solid var(--outline);
}

.checkout-lines span {
    margin-left: auto;
}

.checkout-total {
    margin: 24px 0;
    font-size: 1.4rem;
}

.article-body h3,
.item-info h3 {
    margin-bottom: 10px;
}

.article-body p {
    flex: 1;
    margin-bottom: 24px;
    color: var(--on-surface-muted);
}

.course-badge,
.badge-best,
.quantity-badge {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 750;
}

.course-badge {
    margin-bottom: 14px;
    background: var(--secondary-container);
    color: var(--on-secondary-container);
    padding: 5px 10px;
}

.badge-best {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 2;
    background: var(--badge-bg);
    color: var(--badge-fg);
    padding: 6px 10px;
}

.card-link {
    font-weight: 750;
}

.item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 18px;
}

.rating {
    color: var(--rating);
    font-size: 0.92rem;
    font-weight: 700;
}

.price {
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 800;
}

.item-action {
    padding: 0 24px 24px;
}

.item-action .btn {
    width: 100%;
}

.cart-ok,
.cart-error {
    display: block;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 11px 12px;
}

.cart-ok {
    background: var(--success-container);
    color: var(--success);
}

.cart-error,
.error {
    background: var(--error-container);
    color: var(--error);
}

.state-panel,
.error {
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
}

.state-panel {
    border: 1px dashed var(--outline-soft);
    background: var(--surface-low);
    color: var(--on-surface-muted);
}

.state-panel .btn {
    margin-top: 8px;
}

.content-narrow {
    max-width: 840px;
    margin: 0 auto;
}

.back-link {
    display: inline-flex;
    margin-bottom: 32px;
    font-weight: 700;
    text-decoration: none;
}

.article-header {
    margin-bottom: 36px;
}

.article-header h1 {
    margin-bottom: 18px;
    font-size: clamp(2.25rem, 5vw, 4rem);
}

.article-header .lead {
    color: var(--on-surface-muted);
    font-size: 1.16rem;
}

.article-hero-image {
    width: 100%;
    max-height: 480px;
    margin-bottom: 28px;
    border-radius: var(--radius-lg);
    object-fit: cover;
}

.content-card {
    padding: clamp(24px, 5vw, 48px);
}

.article-body {
    font-size: 1.04rem;
    line-height: 1.8;
}

.article-body > :first-child {
    margin-top: 0;
}

.article-body > :last-child {
    margin-bottom: 0;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body blockquote,
.article-body table {
    margin: 0 0 1.1em;
}

.article-body h2 {
    margin: 1.6em 0 0.5em;
    font-size: 1.45rem;
    line-height: 1.3;
}

.article-body h3 {
    margin: 1.3em 0 0.4em;
    font-size: 1.15rem;
    line-height: 1.35;
}

.article-body ul,
.article-body ol {
    padding-left: 1.4em;
}

.article-body li + li {
    margin-top: 0.35em;
}

.article-body blockquote {
    padding-left: 1em;
    border-left: 3px solid var(--outline-soft);
}

.article-body code {
    font-size: 0.92em;
}

.article-body table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
}

.article-body th,
.article-body td {
    padding: 6px 12px;
    border: 1px solid var(--outline-soft);
    text-align: left;
}

.centered {
    display: flex;
    width: min(calc(100% - 40px), 1040px);
    min-height: calc(100vh - 150px);
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    padding: 56px 0;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(300px, 0.85fr) minmax(360px, 0.65fr);
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-raised);
}

.auth-aside {
    position: relative;
    display: flex;
    min-height: 560px;
    flex-direction: column;
    justify-content: end;
    overflow: hidden;
    background: var(--primary-container);
    color: var(--on-primary-container);
    padding: clamp(32px, 6vw, 64px);
}

.auth-aside::before,
.auth-aside::after {
    position: absolute;
    border-radius: 50%;
    content: "";
}

.auth-aside::before {
    top: -90px;
    right: -60px;
    width: 300px;
    height: 300px;
    border: 55px solid color-mix(in srgb, var(--primary) 32%, transparent);
}

.auth-aside::after {
    top: 130px;
    left: 18%;
    width: 110px;
    height: 220px;
    border-radius: 80% 25% 70% 30%;
    background: var(--tertiary-container);
    transform: rotate(38deg);
}

.auth-aside h1,
.auth-aside p {
    position: relative;
    z-index: 1;
}

.auth-aside h1 {
    margin-bottom: 16px;
    font-size: clamp(2.2rem, 4vw, 3.5rem);
}

.auth-aside p {
    max-width: 440px;
    margin-bottom: 0;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    border: 0;
    box-shadow: none;
    padding: clamp(32px, 6vw, 64px);
}

.auth-card h2 {
    margin-bottom: 8px;
}

.auth-intro {
    margin-bottom: 28px;
    color: var(--on-surface-muted);
}

.auth-form {
    margin-top: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    color: var(--on-surface-muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.form-group input {
    width: 100%;
    min-height: 50px;
    border: 1px solid var(--outline);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--on-surface);
    padding: 11px 13px;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
    outline: none;
}

.auth-footer {
    margin-top: 24px;
    color: var(--on-surface-muted);
    font-size: 0.9rem;
    text-align: center;
}

.auth-result {
    align-self: center;
    margin: auto;
    border: 1px solid var(--outline-soft);
    background: var(--surface);
    box-shadow: var(--shadow-raised);
    text-align: center;
}

.profile-header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 24px;
    align-items: center;
    margin-bottom: 48px;
    padding: 32px;
}

.avatar {
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    border-radius: 22px;
    background: var(--primary-container);
    color: var(--on-primary-container);
    font-size: 1.5rem;
    font-weight: 800;
}

.profile-info h1 {
    margin-bottom: 6px;
    font-size: 2rem;
    letter-spacing: -0.02em;
}

.profile-info p {
    margin-bottom: 0;
    color: var(--on-surface-muted);
}

.profile-panel {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 20px;
}

.profile-panel > div {
    border-radius: var(--radius-md);
    background: var(--surface-container);
    padding: 28px;
}

.profile-panel p:last-child {
    margin-bottom: 0;
}

.inventory-card .quantity-badge {
    margin-top: 14px;
    background: var(--primary-container);
    color: var(--on-primary-container);
    padding: 7px 11px;
}

.site-footer {
    border-top: 1px solid var(--outline-soft);
    background: var(--surface-low);
}

.footer-inner {
    display: flex;
    width: min(calc(100% - 40px), var(--content));
    min-height: 90px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 0 auto;
    color: var(--on-surface-muted);
    font-size: 0.88rem;
}

.footer-inner p {
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.htmx-request.btn {
    cursor: wait;
    opacity: 0.65;
}

@media (max-width: 850px) {
    .navbar {
        flex-wrap: wrap;
        gap: 4px 20px;
        padding: 12px 0;
    }

    .nav-links {
        order: 2;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .nav-spacer {
        display: none;
    }

    .hero,
    .page-header,
    .auth-layout,
    .profile-panel {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
        padding-top: 64px;
    }

    .hero::before {
        right: -15%;
        bottom: 0;
        top: auto;
        width: 70%;
        height: 44%;
    }

    .project-board {
        width: min(100%, 480px);
        margin: 12px auto 0;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .feature-card {
        min-height: 180px;
    }

    .feature-number {
        margin-bottom: 26px;
    }

    .auth-aside {
        min-height: 310px;
    }

    .auth-card {
        max-width: none;
    }
}

@media (max-width: 560px) {
    .navbar,
    .page-container,
    .centered,
    .footer-inner {
        width: min(calc(100% - 28px), var(--content));
    }

    .page-container {
        padding: 40px 0 64px;
    }

    .nav-links > a,
    .nav-links form button {
        padding-inline: 11px;
        white-space: nowrap;
    }

    .hero {
        gap: 50px;
        padding: 42px 0 64px;
    }

    .project-board {
        padding: 20px;
    }

    .board-grid {
        grid-template-columns: 1fr;
    }

    .section-heading,
    .footer-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .profile-header {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    .footer-inner {
        justify-content: center;
        padding: 24px 0;
    }
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --primary: #8cc8f0;
        --primary-hover: #addbfa;
        --on-primary: #00344f;
        --primary-container: #155b93;
        --on-primary-container: #d1eaff;
        --secondary: #a8cbea;
        --secondary-container: #1d4666;
        --on-secondary-container: #dbeeff;
        --tertiary: #c3c8d2;
        --tertiary-container: #40464e;
        --surface: #141218;
        --surface-low: #1d1b20;
        --surface-container: #211f26;
        --surface-high: #2b2930;
        --on-surface: #e6e1e5;
        --on-surface-muted: #cac4d0;
        --outline: #938f99;
        --outline-soft: #49454f;
        --error: #ffb4ab;
        --error-container: #5f1b16;
        --success: #a7d8b6;
        --success-container: #20442f;
        --rating: #ffc66b;
        --badge-bg: #604800;
        --badge-fg: #ffe08a;
        --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        --shadow-raised: 0 16px 42px rgba(0, 0, 0, 0.45);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --primary: #8cc8f0;
    --primary-hover: #addbfa;
    --on-primary: #00344f;
    --primary-container: #155b93;
    --on-primary-container: #d1eaff;
    --secondary: #a8cbea;
    --secondary-container: #1d4666;
    --on-secondary-container: #dbeeff;
    --tertiary: #c3c8d2;
    --tertiary-container: #40464e;
    --surface: #141218;
    --surface-low: #1d1b20;
    --surface-container: #211f26;
    --surface-high: #2b2930;
    --on-surface: #e6e1e5;
    --on-surface-muted: #cac4d0;
    --outline: #938f99;
    --outline-soft: #49454f;
    --error: #ffb4ab;
    --error-container: #5f1b16;
    --success: #a7d8b6;
    --success-container: #20442f;
    --rating: #ffc66b;
    --badge-bg: #604800;
    --badge-fg: #ffe08a;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-raised: 0 16px 42px rgba(0, 0, 0, 0.45);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}

/* Projects page: cards that mirror the app's project screen. */
.unit-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 20px;
    color: var(--on-surface-muted);
    font-size: 0.9rem;
}

.unit-toggle a {
    border: 1px solid var(--outline-soft);
    border-radius: 999px;
    padding: 4px 12px;
    color: var(--on-surface);
    text-decoration: none;
}

.unit-toggle a[aria-current="true"] {
    border-color: var(--primary);
    background: var(--primary-container);
    color: var(--on-primary-container);
    font-weight: 700;
}

.project-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    align-items: start;
}

.project-card {
    overflow: hidden;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.project-hero {
    height: 180px;
    background: var(--surface-container);
}

.project-hero img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-body {
    padding: 20px 24px 24px;
}

.project-body h2 {
    margin: 0 0 4px;
    font-size: 1.35rem;
}

.project-subtitle,
.muted {
    margin: 0;
    color: var(--on-surface-muted);
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 16px 0 4px;
}

.stat {
    border-radius: var(--radius-md);
    background: var(--secondary-container);
    padding: 10px 12px;
    color: var(--on-secondary-container);
}

.stat strong,
.stat span {
    display: block;
}

.stat strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat span {
    font-size: 0.74rem;
}

.project-section {
    margin-top: 18px;
    border-top: 1px solid var(--outline-soft);
    padding-top: 14px;
}

.project-section h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.project-section h4 {
    margin: 14px 0 6px;
    color: var(--primary);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.surface-list,
.supply-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.surface-list li,
.supply-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--surface-high);
}

.surface-name,
.supply-name {
    font-weight: 650;
}

.surface-meta,
.supply-detail {
    color: var(--on-surface-muted);
    font-size: 0.9rem;
}

.supply-state {
    width: 1.2em;
    color: var(--success);
    text-align: center;
}

.supply-list li.is-done .supply-name {
    color: var(--on-surface-muted);
    text-decoration: line-through;
}

.supply-detail {
    margin-left: auto;
}

.swatch {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 1px solid var(--outline);
    border-radius: 50%;
}

.supply-progress {
    width: 100%;
    height: 8px;
    margin: 10px 0 2px;
    accent-color: var(--primary);
}

@media (max-width: 480px) {
    .project-list {
        grid-template-columns: 1fr;
    }
}

/* Suggestions and shop recommendations on the projects page. */
.suggestion-list,
.recommend-items {
    margin: 0;
    padding: 0;
    list-style: none;
}

.suggestion-list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0;
    border-bottom: 1px solid var(--surface-high);
}

.suggestion-reason {
    color: var(--on-surface-muted);
    font-size: 0.88rem;
}

.recommend {
    flex-basis: 100%;
    margin: 2px 0 4px 1.9em;
}

.recommend summary {
    cursor: pointer;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 650;
}

.recommend-tier h5 {
    margin: 12px 0 4px;
    font-size: 0.85rem;
}

.recommend-items li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--surface-high);
}

.recommend-name {
    font-weight: 650;
}

.recommend-price {
    color: var(--primary);
    font-weight: 750;
}

.recommend-notes {
    flex-basis: 100%;
    color: var(--on-surface-muted);
    font-size: 0.82rem;
}

.recommend-items .item-action {
    margin-left: auto;
}
