.projects-page {
    position: relative;
    padding: 40px 16px;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    max-width: 1100px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Breadcrumb row — mirrors the gallery/blog .section-header-line.
   min-height matches the blog's row (whose height is set by its controls) so the
   vertically-centered breadcrumb sits at the same offset below the topbar. */
.section-header-line {
    margin-bottom: 0.75rem;
    min-height: 31px;
}

/* Header */
h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.header-desc {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 40px;
}

/* List Style */
ul.project-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

ul.project-list li {
    margin-bottom: 0;
    padding: 8px;
    border-radius: 8px;
    background-color: var(--surface-overlay);
    border: 1px solid var(--border-default);
    box-sizing: border-box;
    transition: border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Accent border on hover — same as the topbar search trigger. */
ul.project-list li:hover {
    border-color: var(--accent-primary);
}

ul.project-list li:target {
    animation: highlight-project 2.5s ease-out;
    scroll-margin-top: 100px;
}

@keyframes highlight-project {
    0% { background-color: var(--accent-glow); }
    100% { background-color: transparent; }
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9em;
    background-color: var(--surface-overlay);
    padding: 3px 6px;
    border-radius: 4px;
    color: var(--accent-primary);
}

.project-line {
    font-size: 16px;
    margin-bottom: 8px;
    text-align: center;
}

/* Keep a long title inside a single rounded box (inline-block) instead of one
   box per wrapped line, and let it break cleanly. */
.project-line code {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
    color: var(--text-primary);
    transition: color 0.15s ease;
}

/* Title turns accent on hover. */
.project-line a:hover code {
    color: var(--accent-primary);
}

/* Screenshot: fill the card in a consistent square so images read larger and
   uniform regardless of their native aspect ratio. */
.project-screenshot img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* Details Custom Block */
details.custom-block {
    margin: 16px 0;
    padding: 16px;
    border-radius: 8px;
    background-color: var(--surface-overlay);
    border: 1px solid var(--border-default);
}

details.custom-block summary {
    font-weight: 600;
    cursor: pointer;
    outline: none;
    user-select: none;
    color: var(--text-primary);
}

details.custom-block[open] summary {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-default);
}

.details-content {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
}

.details-content b {
    color: var(--text-primary);
}

.project-links {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 8px;
    align-items: baseline;
}

.project-links a {
    color: var(--text-interactive);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.project-links a:hover {
    text-decoration: underline;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.tag-pill {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: 12px;
    background-color: var(--surface-overlay);
    color: var(--accent-primary);
    border: 1px solid var(--border-default);
    transition: all 0.2s;
}

.tag-pill:hover {
    background-color: var(--accent-primary);
    color: var(--text-on-accent);
}

/* Subheadings matching reference.
   Exclude the breadcrumb <h2 class="app-breadcrumb"> — otherwise this padding
   inflates its box and, with the row's align-items-center, lifts the breadcrumb
   text a few px too high compared with the detail page. */
h2:not(.app-breadcrumb) {
    font-size: 24px;
    font-weight: 600;
    margin: 48px 0 24px;
    padding-bottom: 12px;
    border-bottom: none;
}

/* ==========================================================================
   Responsive Layout — cards per row (list gap is 16px)
   Mobile  = 2  →  (100% - 1*12) / 2   (mobile overrides gap to 12px)
   Tablet  = 3  →  (100% - 2*16) / 3
   Desktop = 4  →  (100% - 3*16) / 4
   ========================================================================== */

/* Mobile Layout (max-width: 470px) — 2 cards per row */
@media (max-width: 470px) {
    /* Tighter page + card spacing so the image gets more of the narrow width. */
    .projects-page {
        padding: 40px 12px;
    }

    ul.project-list {
        gap: 12px;
    }

    ul.project-list li {
        flex: 0 0 calc((100% - 12px) / 2);
        max-width: calc((100% - 12px) / 2);
        padding: 8px;
    }

    /* Smaller title so longer names fit; long ones wrap in one tidy box. */
    .project-line {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .project-line code {
        font-size: 0.75rem;
        padding: 2px 6px;
    }

    .project-links,
    .project-links a {
        font-size: 12px;
    }
}

/* Tablet Layout (min-width: 471px) and (max-width: 1023px) */
@media (min-width: 471px) and (max-width: 1023px) {
    ul.project-list li {
        flex: 0 0 calc((100% - 32px) / 3);
        max-width: calc((100% - 32px) / 3);
    }
}

/* Desktop Layout (min-width: 1024px) */
@media (min-width: 1024px) {
    /* Align with the logo like the gallery/blog pages: the global .container
       reserves 10rem on the right for the logo; cancel it and nudge the column
       right by 4rem so the breadcrumb sits under the logo. */
    .container:has(.projects-page) {
        padding-right: 0 !important;
    }

    .projects-page {
        left: 4rem;
    }

    ul.project-list li {
        flex: 0 0 calc((100% - 48px) / 4);
        max-width: calc((100% - 48px) / 4);
    }
}
