/* Projects hub + detail pages */

body {
    background: var(--bg-primary);
}

/* Per-category tint, matching the homepage teaser's project_media_* classes
   (public/css/homepage/projects_section.css) so thumbnails/placeholders stay
   visually consistent between the teaser, hub, and detail pages. */
.project_media_robotics {
    --project-media-bg: #2d6f92;
}

.project_media_ai {
    --project-media-bg: #405f38;
}

.project_media_web {
    --project-media-bg: #73503b;
}

.project_media_mobile {
    --project-media-bg: #5a4a86;
}

/* HUB HERO - same tilted, drifting circuit-board technique as the Education
   page's hero (public/css/education/style.css). */
#projects_page_hero {
    position: relative;
    height: 300px;
    overflow: hidden;
    border-bottom: 2px solid #3d4151;
}

#projects_page_hero_bg {
    position: absolute;
    top: -300px;
    left: -600px;
    width: 300%;
    height: 250%;
    background-image: var(--projects-hero-background-image);
    background-size: 500px;
    z-index: -1;
    transform: perspective(2500px) rotateX(35deg) rotateY(0deg);
    transform-origin: center;
    animation: scrollDiagonal 20s linear infinite;
}

#projects_page_hero_overlay {
    position: absolute;
    inset: 0;
    background: rgba(28, 30, 37, 0.55);
}

#projects_page_hero_content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 0 24px;
}

.projects_page_eyebrow {
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent-primary);
    font-weight: 700;
}

#projects_page_hero_content h1 {
    margin: 0;
    font-size: 2.6em;
    font-weight: 700;
    color: var(--text-primary);
}

#projects_page_hero_content p {
    margin: 0;
    max-width: 660px;
    font-size: 1.05em;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* BODY / CARD GRID */
#projects_page_body {
    display: grid;
    row-gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 48px 40px 80px;
}

.projects_page_grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.projects_page_card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    box-shadow: 0 5px 10px var(--shadow-primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.projects_page_card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: 0 12px 24px var(--shadow-secondary);
}

.projects_page_card_thumb {
    aspect-ratio: 16 / 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--project-media-bg, #3a4b62);
}

.projects_page_card_thumb_image {
    background-size: cover;
    background-position: center;
}

.projects_page_card_thumb svg {
    width: 44px;
    height: 44px;
    opacity: 0.9;
}

.projects_page_card_body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
}

.projects_page_card_category {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-primary);
    font-weight: 700;
}

.projects_page_card_body h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.3;
    color: var(--text-primary);
}

.projects_page_card_body p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.projects_page_card_tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
}

.projects_page_tag {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* SMALLER PROJECTS - de-emphasized reveal section */
#projects_page_minor_section {
    padding-top: 8px;
    border-top: 1px solid var(--border-primary);
}

#projects_page_minor_toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

#projects_page_minor_toggle:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.projects_page_minor_toggle_chevron {
    transition: transform 0.2s ease;
}

#projects_page_minor_toggle[aria-expanded="true"] .projects_page_minor_toggle_chevron {
    transform: rotate(180deg);
}

.projects_page_minor_grid {
    margin-top: 20px;
}

.projects_page_minor_grid[hidden] {
    display: none;
}

.projects_page_card_minor {
    opacity: 0.78;
    filter: saturate(0.8);
}

.projects_page_card_minor:hover {
    opacity: 1;
    filter: none;
}

.projects_page_card_minor .projects_page_card_thumb {
    aspect-ratio: 16 / 9;
}

.projects_page_card_minor .projects_page_card_thumb svg {
    width: 34px;
    height: 34px;
}

/* DETAIL PAGE HERO */
#projects_detail_page_hero {
    position: relative;
    padding: 40px 40px 46px;
    background: linear-gradient(160deg, var(--project-media-bg, #3a4b62) 0%, var(--bg-primary) 130%);
    border-bottom: 2px solid #3d4151;
}

#projects_detail_page_hero_content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.projects_detail_page_back {
    align-self: flex-start;
    font-size: 13.5px;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 8px;
    transition: color 0.2s ease;
}

.projects_detail_page_back:hover {
    color: var(--text-primary);
}

#projects_detail_page_hero_content h1 {
    margin: 0;
    font-size: 2.2em;
    font-weight: 700;
    color: var(--text-primary);
}

#projects_detail_page_hero_content p {
    margin: 0;
    max-width: 720px;
    font-size: 1.05em;
    line-height: 1.6;
    color: var(--text-secondary);
}

#projects_detail_page_hero_content p a,
.projects_detail_page_content section p a,
.projects_detail_page_technical_body a {
    color: #8be28f;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

#projects_detail_page_hero_content p a:hover,
.projects_detail_page_content section p a:hover,
.projects_detail_page_technical_body a:hover {
    color: #b7f5ba;
}

/* DETAIL PAGE BODY */
#projects_detail_page_body {
    display: grid;
    row-gap: 28px;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 40px 20px;
}

.projects_detail_page_gallery_hero_wrap {
    position: relative;
}

.projects_detail_page_gallery_hero {
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    background-size: cover;
    background-position: center;
    background-color: var(--project-media-bg, #3a4b62);
    box-shadow: 0 8px 20px var(--shadow-primary);
    cursor: zoom-in;
}

.projects_detail_page_gallery_hero_video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    background: #000;
    box-shadow: 0 8px 20px var(--shadow-primary);
    object-fit: contain;
}

.projects_detail_page_gallery_hero_video[hidden] {
    display: none;
}

.projects_detail_page_gallery_arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(20, 22, 28, 0.55);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.projects_detail_page_gallery_arrow:hover {
    background: rgba(20, 22, 28, 0.8);
}

.projects_detail_page_gallery_arrow_prev {
    left: 14px;
}

.projects_detail_page_gallery_arrow_next {
    right: 14px;
}

.projects_detail_page_gallery_placeholder {
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--project-media-bg, #3a4b62);
    box-shadow: 0 8px 20px var(--shadow-primary);
}

.projects_detail_page_gallery_placeholder svg {
    width: 80px;
    height: 80px;
    opacity: 0.85;
}

.projects_detail_page_gallery_thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.projects_detail_page_thumb {
    position: relative;
    flex: none;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    line-height: 0;
    transition: border-color 0.2s ease;
}

.projects_detail_page_thumb img {
    display: block;
    width: 84px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
}

/* Fallback for a video thumb with no poster frame - a neutral tile with a
   play glyph, same size as an image thumb so it doesn't jump the strip's
   layout. */
.projects_detail_page_thumb_play {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 54px;
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-tertiary);
}

/* When a video thumb does have a poster frame, the glyph above instead sits
   as a small centered badge over that frame - same cue a video thumbnail
   normally carries, without claiming the poster image is a plain screenshot. */
.projects_detail_page_thumb_play_overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(10, 11, 14, 0.6);
    color: #fff;
}

.projects_detail_page_thumb:hover {
    border-color: var(--border-primary);
}

.projects_detail_page_thumb_active,
.projects_detail_page_thumb[aria-current="true"] {
    border-color: var(--accent-primary);
}

.projects_detail_page_gallery_caption {
    margin: 10px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-tertiary);
}

.projects_detail_page_gallery_caption[hidden] {
    display: none;
}

.projects_detail_page_gallery_caption a {
    color: inherit;
    text-decoration: underline;
}

.projects_detail_page_content {
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.projects_detail_page_content h2 {
    margin: 0 0 12px;
    font-size: 1.25em;
    color: var(--text-primary);
}

.projects_detail_page_content section p {
    margin: 0;
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.projects_detail_page_list {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.projects_detail_page_list li {
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text-secondary);
}

/* ARCHITECTURE & IMPLEMENTATION - rendered Markdown from technicalContent,
   plus the diagram and in-context images it can place inline via {{diagram}}
   and {{image:<id>}}.
   Plain block flow, not flex: a floated technicalImages figure (below) needs
   normal siblings to wrap around it, which flex items cannot do. */
.projects_detail_page_technical_body {
    display: block;
}

.projects_detail_page_technical_body::after {
    content: "";
    display: table;
    clear: both;
}

.projects_detail_page_technical_body > *:not(:last-child) {
    margin-bottom: 16px;
}

.projects_detail_page_technical_body p {
    margin: 0;
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.projects_detail_page_technical_body h3,
.projects_detail_page_technical_body h4 {
    margin: 4px 0 0;
    color: var(--text-primary);
}

.projects_detail_page_technical_body ul,
.projects_detail_page_technical_body ol {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.projects_detail_page_technical_body li {
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.projects_detail_page_technical_body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
}

.projects_detail_page_diagram {
    clear: both;
    overflow-x: auto;
    padding: 18px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
}

.projects_detail_page_diagram svg {
    display: block;
    margin: 0 auto;
}

/* A technicalImages figure is a small supporting screenshot, not a hero shot
   - it floats beside whatever paragraph follows it (room permitting) rather
   than taking the full content width. */
.projects_detail_page_technical_figure {
    float: right;
    width: 45%;
    max-width: 260px;
    margin: 4px 0 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.projects_detail_page_technical_figure img {
    display: block;
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 8px 20px var(--shadow-primary);
}

.projects_detail_page_technical_figure figcaption {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-tertiary);
}

.projects_detail_page_technical_figure figcaption a {
    color: inherit;
    text-decoration: underline;
}

/* Unlike a technicalImages figure, a video is a hero-style demo clip, not a
   small supporting screenshot - it takes the full content width like the
   diagram above rather than floating beside the text. */
.projects_detail_page_technical_video {
    clear: both;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.projects_detail_page_technical_video video {
    display: block;
    width: 100%;
    border-radius: 12px;
    background: var(--bg-card);
}

.projects_detail_page_technical_video figcaption {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-tertiary);
}

.projects_detail_page_technical_video figcaption a {
    color: inherit;
    text-decoration: underline;
}

.projects_detail_page_tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.projects_detail_page_tags_gallery {
    margin-top: -8px;
}

.projects_detail_page_tag {
    font-size: 13px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    white-space: nowrap;
}

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

.projects_detail_page_links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-primary);
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.projects_detail_page_links a:hover {
    background: var(--bg-card-hover);
}

.projects_detail_page_links a svg:last-child {
    opacity: 0.7;
}

/* LIGHTBOX - full-screen focus view for gallery images */
/* Set on <body> by public/scripts/projects/script.js while the lightbox is
   open, so the page underneath cannot scroll away behind the overlay. */
.projects_detail_page_lightbox_open {
    overflow: hidden;
}

.projects_detail_page_lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 11, 14, 0.9);
}

.projects_detail_page_lightbox[hidden] {
    display: none;
}

.projects_detail_page_lightbox_image {
    max-width: min(92vw, 1400px);
    max-height: 88vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.projects_detail_page_lightbox_video {
    max-width: min(92vw, 1400px);
    max-height: 88vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.projects_detail_page_lightbox_video[hidden] {
    display: none;
}

.projects_detail_page_lightbox_close {
    position: absolute;
    top: 18px;
    right: 22px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.projects_detail_page_lightbox_close:hover {
    background: rgba(255, 255, 255, 0.18);
}

.projects_detail_page_lightbox_arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.projects_detail_page_lightbox_arrow:hover {
    background: rgba(255, 255, 255, 0.18);
}

.projects_detail_page_lightbox_arrow_prev {
    left: 18px;
}

.projects_detail_page_lightbox_arrow_next {
    right: 18px;
}

/* DETAIL PAGE FOOTER NAV - visually cut off from the project content above
   it with a full-width divider, so it reads as page-level navigation rather
   than part of the project write-up. */
.projects_detail_page_footer_nav {
    max-width: 900px;
    margin: 44px auto 60px;
    padding: 32px 40px 0;
    border-top: 1px solid var(--border-primary);
}

.projects_detail_page_all_link {
    display: inline-flex;
    align-items: center;
    padding: 12px 18px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.projects_detail_page_all_link:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

@media (max-width: 900px) {
    #projects_page_body {
        padding: 32px 20px 60px;
    }

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

    #projects_page_hero_content h1 {
        font-size: 1.9em;
    }

    #projects_detail_page_hero {
        padding: 32px 20px 36px;
    }

    #projects_detail_page_body {
        padding: 32px 20px 10px;
    }

    .projects_detail_page_gallery_arrow {
        width: 34px;
        height: 34px;
    }

    .projects_detail_page_lightbox_arrow {
        width: 40px;
        height: 40px;
    }

    /* Not enough width left beside a 260px float to read comfortably - stack
       the figure full-width instead of wrapping text around it. */
    .projects_detail_page_technical_figure {
        float: none;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
}
