/* ============================================================
   PROJECTS SUBPAGE STYLESHEET
   Crimson Noir Hero + Paper Catalog Showcase
   Inherits design tokens from ../home_style.css
   ============================================================ */

/* Page layout */
body.is-subpage {
    background: var(--black);
    color: var(--black);
    min-height: 100vh;
    padding-top: 64px;
    overflow-x: hidden;
}

@media (min-width: 961px) {
    body.is-subpage {
        padding-top: 84px;
    }
}

@media (max-width: 640px) {
    body.is-subpage {
        padding-top: 54px;
    }
}

/* Subpage header — clean dark glass */
.is-subpage .o-header {
    mix-blend-mode: normal;
    background: rgba(8, 8, 8, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    color: var(--white);
}

/* Active Nav State */
.o-header_nav a.is-active {
    color: var(--white);
    opacity: 1;
    position: relative;
}

.o-header_nav a.is-active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
}

/* Subpage main container */
.is-subpage main {
    position: relative;
    z-index: 2;
    background: var(--white);
    min-height: calc(100vh - 84px);
}

/* Subpage scroll reveal */
.is-subpage [data-scroll-reveal] {
    visibility: visible;
}

/* ============================================================
   TOP BAR WITH BREADCRUMBS (Dark glass strip)
   ============================================================ */
.sp-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.4rem 3rem;
    background: #0d0d0d;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 10;
    color: var(--white);
}

@media (max-width: 640px) {
    .sp-topbar {
        padding: 1.2rem 1.8rem;
    }
}

.sp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.sp-breadcrumb a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.25s;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.sp-breadcrumb a:hover {
    color: var(--white);
}

.sp-breadcrumb_sep {
    opacity: 0.3;
}

.sp-breadcrumb_current {
    color: var(--white);
}

.sp-topbar_badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
    padding: 0.45rem 1.3rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 3rem;
    background: rgba(255, 255, 255, 0.04);
}

.sp-topbar_badge_dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: #28CA41;
    box-shadow: 0 0 8px rgba(40, 202, 65, 0.7);
}

/* ============================================================
   CRIMSON NOIR HERO (Projects Page - Clear Stage + Lower Text)
   ============================================================ */
.sp-hero--projects {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: calc(var(--header-height, 80px) + 1.8rem) 3.5rem 3rem;
    position: relative;
    z-index: 1;
    background: #040404;
    overflow: clip;
    box-sizing: border-box;
}

.sp-hero_bg_wrap {
    /* Pinned backdrop: stays fixed while hero copy + catalog scroll over it.
       Faded out via ScrollTrigger once the hero scrolls away (see projects.html). */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100vh; height: 100svh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Transparent wrapper so <picture> WebP swaps never disturb layout */
.sp-hero_bg_wrap picture {
    display: contents;
}

.sp-hero_bg_img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 26%;
    opacity: 0.94;
    filter: contrast(1.15) brightness(0.92) saturate(1.15);
    will-change: transform;
    transform: scale(1.06);
}

.sp-hero_bg_overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, 
        rgba(0, 0, 0, 0.72) 0%, 
        rgba(0, 0, 0, 0.1) 18%, 
        transparent 35%, 
        rgba(0, 0, 0, 0.4) 72%, 
        #000000 100%
    );
    pointer-events: none;
}

.sp-hero_bg_vignette {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: radial-gradient(ellipse at 50% 45%, transparent 48%, rgba(0, 0, 0, 0.45) 85%, rgba(0, 0, 0, 0.85) 100%);
    pointer-events: none;
}

.sp-hero_bg_crimson {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: radial-gradient(ellipse at 50% 24%, rgba(220, 38, 38, 0.22) 0%, rgba(185, 28, 28, 0.05) 45%, transparent 70%);
    mix-blend-mode: screen;
    pointer-events: none;
}

/* Inner Layout Frame */
.sp-phero_inner {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    z-index: 5;
}

/* Open Center Stage: Keeps 'PROJECTS' artwork completely visible */
.sp-phero_stage_spacer {
    min-height: 24vh;
    flex: 1;
    pointer-events: none;
}

/* Text Content Under the Middle Line of the Hero */
.sp-phero_lower {
    /* =========================================================================
       >>> MANUAL POSITION CONTROLLER <<<
       Change '--hero-lower-offset-y' below to move this div manually:
       - Increase (e.g. 55px, 70px) to move it FURTHER DOWNWARD
       - Decrease (e.g. 20px, 0px) to move it UPWARD
       - Negative (e.g. -20px, -40px) pulls it even higher up
       ========================================================================= */
    --hero-lower-offset-y: 180px;

    max-width: 820px;
    margin: auto auto 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.8rem;
    position: relative;
    z-index: 5;
    padding-bottom: 1rem;
    transform: translateY(var(--hero-lower-offset-y));
    will-change: transform, opacity;
}

.sp-phero_lower_eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #ef4444;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.sp-phero_lower_dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

.sp-phero_lower_text {
    font-size: clamp(1.6rem, 1.9vw, 2.1rem);
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.86);
    max-width: 780px;
    margin: 0;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.9);
    font-weight: 400;
}

/* Inline Stats / Specs Ribbon Under the Middle Line */
.sp-phero_lower_stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.2rem;
    flex-wrap: wrap;
    background: rgba(12, 6, 6, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 0.9rem 2.4rem;
    border-radius: 999px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.sp-phero_lstat_item {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.sp-phero_lstat_val {
    font-family: var(--font-display);
    font-size: 2.2rem;
    line-height: 1;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.sp-phero_lstat_lbl {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.sp-phero_lstat_divider {
    display: inline-block;
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.12);
}

/* Responsive */
@media (max-width: 1024px) {
    .sp-hero--projects {
        padding: calc(var(--header-height, 80px) + 1.5rem) 2rem 2.5rem;
    }
}

@media (max-width: 860px) {
    .sp-hero--projects {
        min-height: auto;
    }
    .sp-phero_stage_spacer {
        min-height: 16vh;
    }
    .sp-phero_lower_stats {
        gap: 1.4rem;
        padding: 0.8rem 1.6rem;
    }
    .sp-phero_lstat_divider {
        display: none;
    }
}

@media (max-width: 640px) {
    .sp-phero_lower {
        --hero-lower-offset-y: 15px;
    }
    .sp-phero_lower_stats {
        border-radius: 1.6rem;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
        text-align: center;
        padding: 1.4rem;
    }
    .sp-phero_lstat_item {
        flex-direction: column;
        align-items: center;
        gap: 0.2rem;
    }
}

/* ============================================================
   WHITE / PAPER SECTION (Editorial Contrast like Home About)
   ============================================================ */
.sp-content--paper {
    background-color: #fcfcfc;
    background-image: url('../assets/textures/paper.png');
    background-repeat: repeat;
    background-size: 1000px auto;
    color: #000000;
    position: relative;
    z-index: 2;
    /* Slide over the pinned hero backdrop */
    margin-top: -2.4rem;
    border-radius: 2.4rem 2.4rem 0 0;
    box-shadow: 0 -30px 80px rgba(0, 0, 0, 0.5);
    padding: 9rem 3rem 10rem;
}

.sp-content--paper::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: rgba(0, 0, 0, 0.08);
}

@media (max-width: 640px) {
    .sp-content--paper {
        padding: 6rem 1.8rem 7rem;
        margin-top: -1.4rem;
        border-radius: 1.6rem 1.6rem 0 0;
    }
}

.sp-section_inner {
    max-width: 1300px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* ============================================================
   PROJECTS SHOWCASE SECTION (White Paper Theme)
   ============================================================ */
.sp-filters {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    margin-bottom: 4.5rem;
}

.sp-filter_btn {
    font-family: var(--font-body);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.85rem 2rem;
    border-radius: 4rem;
    border: 1px solid rgba(0, 0, 0, 0.14);
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.7);
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.sp-filter_btn:hover {
    color: #000000;
    border-color: #000000;
    background: rgba(0, 0, 0, 0.04);
}

.sp-filter_btn.is-active {
    color: #ffffff;
    background: #000000;
    border-color: #000000;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
}

.sp-filter_count {
    font-size: 1.05rem;
    opacity: 0.7;
}

.sp-filter_btn.is-active .sp-filter_count {
    color: #ffffff;
    font-weight: 700;
    opacity: 0.85;
}

/* Projects Grid */
.sp-projects_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 3.5rem;
}

@media (max-width: 640px) {
    .sp-projects_grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
}

/* Projects Loader Container */
.sp-loader_wrap {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    padding: 5rem 1rem;
    width: 100%;
}

/* From Uiverse.io by cosnametv */ 
.loader {
  --color: #a5a5b0;
  --size: 70px;
  width: var(--size);
  height: var(--size);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.loader span {
  width: 100%;
  height: 100%;
  background-color: var(--color);
  animation: keyframes-blink 0.6s alternate infinite linear;
}

.loader span:nth-child(1) {
  animation-delay: 0ms;
}

.loader span:nth-child(2) {
  animation-delay: 200ms;
}

.loader span:nth-child(3) {
  animation-delay: 300ms;
}

.loader span:nth-child(4) {
  animation-delay: 400ms;
}

.loader span:nth-child(5) {
  animation-delay: 500ms;
}

.loader span:nth-child(6) {
  animation-delay: 600ms;
}

@keyframes keyframes-blink {
  0% {
    opacity: 0.3;
    transform: scale(0.5) rotate(5deg);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Project Card on Paper Background */
.sp-project_card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 1.8rem;
    overflow: hidden;
    color: #000000;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.06);
    transition: transform 0.4s var(--ease-out), border-color 0.4s, box-shadow 0.4s, opacity 0.3s;
    position: relative;
}

.sp-project_card:hover {
    transform: translateY(-8px);
    border-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.12);
}

.sp-project_card.is-hidden {
    display: none !important;
}

.sp-project_thumb {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #111111;
    margin: 0;
    display: block;
}

.sp-project_thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-smooth);
    display: block;
}

.sp-project_card:hover .sp-project_thumb img {
    transform: scale(1.06);
}

.sp-project_badge {
    position: absolute;
    top: 1.6rem;
    left: 1.6rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.45rem 1.2rem;
    border-radius: 3rem;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--white);
    z-index: 2;
}

.sp-project_body {
    padding: 3rem 2.8rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.sp-project_title {
    font-family: var(--font-display);
    font-size: 2.8rem;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sp-project_title a {
    color: #000000;
    text-decoration: none;
    transition: color 0.3s;
}

.sp-project_title a:hover {
    color: #000000;
    opacity: 0.72;
}

.sp-project_arrow {
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.3s, color 0.3s;
    color: #000000;
}

.sp-project_card:hover .sp-project_arrow {
    background: #000000;
    color: #ffffff;
    transform: translate(3px, -3px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.sp-project_arrow svg {
    width: 1.2rem;
    height: 1.2rem;
}

.sp-project_desc {
    font-size: 1.45rem;
    line-height: 1.65;
    color: #555555;
    margin-bottom: 2.4rem;
    flex-grow: 1;
}

.sp-project_tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 2.4rem;
}

.sp-project_tag {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.4rem 1rem;
    border-radius: 3rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.03);
    color: #333333;
    transition: all 0.25s;
}

.sp-project_tag:hover {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
}

.sp-project_actions {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding-top: 2rem;
}

.sp-project_action_btn {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: #000000;
    text-decoration: none;
    transition: all 0.3s var(--ease-out);
}

.sp-project_action_btn:hover {
    color: #000000;
    opacity: 0.72;
    transform: translateX(4px);
}

.sp-project_action_secondary {
    margin-left: auto;
    font-size: 1.15rem;
    color: var(--gray-700);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s;
}

.sp-project_action_secondary:hover {
    color: #000000;
}

/* ============================================================
   OPEN SOURCE / GITHUB LABS BANNER (Dark with workBg texture)
   ============================================================ */
.sp-github_banner--dark {
    margin-top: 9rem;
    padding: 5rem 4rem;
    border-radius: 2rem;
    background-color: #080808;
    background-image: url('../assets/textures/workBg.png');
    background-size: cover;
    background-position: center;
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2.5rem;
    position: relative;
    overflow: hidden;
}

.sp-github_banner--dark::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    pointer-events: none;
    z-index: 1;
}

.sp-github_banner_content {
    position: relative;
    z-index: 2;
}

.sp-github_banner_btn {
    position: relative;
    z-index: 2;
}

/* ============================================================
   CTA CALLOUT SECTION (Paper / Editorial Contrast)
   ============================================================ */
.sp-cta--paper {
    margin-top: 9rem;
    padding: 7rem 4rem;
    border-radius: 2.2rem;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2rem;
    color: #000000;
}

.sp-cta_title {
    font-family: var(--font-display);
    font-size: clamp(3.6rem, 6vw, 7rem);
    text-transform: uppercase;
    letter-spacing: -0.01em;
    color: #000000;
}

.sp-cta_desc {
    font-size: 1.6rem;
    max-width: 620px;
    color: #555555;
    line-height: 1.65;
}

.sp-cta_actions {
    display: flex;
    gap: 1.6rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
}

.sp-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 1.3rem 3rem;
    border-radius: 4px;
    background: #000000;
    color: #ffffff;
    text-decoration: none;
    transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
}

.sp-btn-primary:hover {
    transform: translateY(-2px);
    background: #222222;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.sp-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 1.3rem 3rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.18);
    color: #000000;
    text-decoration: none;
    transition: transform 0.3s, background 0.3s, border-color 0.3s;
}

.sp-btn-secondary:hover {
    transform: translateY(-2px);
    background: rgba(0, 0, 0, 0.08);
    border-color: #000000;
}

/* ============================================================
   FOOTER ALIGNMENT FOR SUBPAGES (Sticky fixed reveal)
   ============================================================ */
.is-subpage .o-footer_placeholder {
    width: 100%;
    height: var(--footer-height, 500px);
    pointer-events: none;
}

/* Subpage Footer Marquee */
.is-subpage .m-marquee {
    display: flex;
    overflow: hidden;
    width: 100%;
    white-space: nowrap;
    padding-bottom: 3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    user-select: none;
    pointer-events: auto;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 3.5rem, #000 calc(100% - 3.5rem), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 3.5rem, #000 calc(100% - 3.5rem), transparent 100%);
}

.is-subpage .m-marquee_viewport {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    animation: footerMarquee 26s linear infinite;
    will-change: transform;
}

.is-subpage .m-marquee:hover .m-marquee_viewport {
    animation-play-state: paused;
}

.is-subpage .m-marquee_item {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0.8rem;
    padding-right: 3.5rem;
}

@keyframes footerMarquee {
    0%   { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

@media (max-width: 640px) {
    .is-subpage .m-marquee {
        padding-bottom: 2rem;
    }
    .is-subpage .m-marquee .tx-2xl {
        font-size: 3rem;
    }
    .is-subpage .m-marquee_item {
        gap: 0.6rem;
        padding-right: 2.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .is-subpage .m-marquee_viewport {
        animation: none !important;
    }
    .is-subpage .m-marquee {
        overflow-x: auto;
    }
}
