/* =============================================================
   Project Showcase — Card & Detail Page
   Builds on top of design-system.css tokens.
   ============================================================= */

/* ---------------------------------------------------------------
   Shared: status badge + tag variants
--------------------------------------------------------------- */

.project-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: "Saira Extra Condensed", sans-serif;
    font-weight: 600;
    color: rgb(255 255 255 / 0.55);
}

.project-status--dark {
    color: var(--muted);
}

.project-status__dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--status-amber);
    box-shadow: 0 0 0 0 rgb(var(--status-amber-rgb) / 0.5);
    animation: status-pulse 2.4s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes status-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgb(var(--status-amber-rgb) / 0.5);
    }
    55% {
        box-shadow: 0 0 0 6px rgb(var(--status-amber-rgb) / 0);
    }
}

/* Tags on dark background */
.project-tag {
    display: inline-block;
    font-size: 0.63rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    font-family: "Saira Extra Condensed", sans-serif;
    padding: 0.22em 0.6em;
    border-radius: 2px;
    background: rgb(255 255 255 / 0.09);
    color: rgb(255 255 255 / 0.65);
    border: 1px solid rgb(255 255 255 / 0.14);
}

/* Tags on light background */
.project-tag--light {
    background: var(--bg-mid);
    color: var(--brand-dark);
    border: 1px solid var(--bg-deep);
}

/* Link buttons — shared base */
.project-card__link svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    flex-shrink: 0;
}

.project-card__link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: "Saira Extra Condensed", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    white-space: nowrap;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
    line-height: 1.4;
    margin: 0;
}

/* Restore mobile tap-target minimums (overridden by tweaks.css global rule) */
@media (max-width: 767px) {
    .project-card__link {
        min-height: 48px;
        min-width: 48px;
    }
}

.project-card__link--github {
    background: rgb(var(--brand-rgb) / 0.08);
    color: var(--brand-dark);
    border: 1px solid rgb(var(--brand-rgb) / 0.28);
}
.project-card__link--github:hover,
.project-card__link--github:focus {
    background: rgb(var(--brand-rgb) / 0.16);
    color: var(--brand-dark);
    text-decoration: none;
}

.project-card__link--release {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}
.project-card__link--release:hover,
.project-card__link--release:focus {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
    text-decoration: none;
}

.project-card__link--details {
    background: transparent;
    color: var(--cyan);
    border: 1px solid rgb(var(--cyan-rgb) / 0.35);
}
.project-card__link--details:hover,
.project-card__link--details:focus {
    background: rgb(var(--cyan-rgb) / 0.1);
    color: var(--cyan);
    text-decoration: none;
}

/* ---------------------------------------------------------------
   Rich project card (projects with image — home page)
--------------------------------------------------------------- */

.project-card {
    display: flex;
    flex-direction: column;
    background: rgb(255 255 255 / 0.45);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-card);
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
    position: relative;
}

/* Accent stripe */
.project-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

.project-card__body {
    flex: 0 0 auto;
    padding: 2.25rem 2rem 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 2; /* sits above the bleeding visual */
}

.project-card__visual {
    position: relative;
    overflow: hidden;
    min-height: 240px;
    flex: 1 1 auto;
    z-index: 1;
}

.project-card__screenshot {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    transition: transform 0.5s ease;
}

/* Gradient mask fades the image in from the left */
.project-card__visual {
    -webkit-mask-image: linear-gradient(to right, transparent 22%, black 37%);
    mask-image: linear-gradient(to right, transparent 22%, black 37%);
}

/* Pseudo-element with backdrop-filter scopes blur to the transition zone only */
.project-card__visual::before {
    content: "";
    position: absolute;
    inset: 0;
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    /* Fade the blur in/out so it peaks at the mask transition, not the whole image */
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 20%,
        black 28%,
        transparent 45%
    );
    mask-image: linear-gradient(
        to right,
        transparent 20%,
        black 28%,
        transparent 45%
    );
    z-index: 2;
    pointer-events: none;
}

.project-card:hover .project-card__screenshot {
    transform: scale(1.035) translateY(-4px);
}

.project-card__meta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}

.project-card__title {
    font-family: "Saira Extra Condensed", sans-serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin: 0;
    line-height: 1;
    letter-spacing: -0.01em;
}

.project-card__subtitle {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--brand);
    letter-spacing: 0.01em;
}

.project-card__tagline {
    font-family: "Open Sans", sans-serif;
    font-size: 0.82rem;
    color: var(--brand);
    font-style: italic;
    margin: 0.3rem 0 1rem;
    letter-spacing: 0.03em;
}

.project-card__desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.3rem;
    max-width: 42ch;
}

.project-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
}

.project-card__links {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* Status badge + tags on the now-light card */
.project-card .project-status {
    color: var(--muted);
}

.project-card .project-tag {
    background: var(--bg-deep);
    color: var(--brand-dark);
    border-color: transparent;
}

/* ---------------------------------------------------------------
   Simple card (projects without image — fallback)
--------------------------------------------------------------- */

.project-simple-card {
    border: 1px solid var(--bg-deep);
    border-radius: var(--radius-md);
    background: var(--bg-mid);
    border-left: 3px solid var(--brand);
    transition: box-shadow 0.2s ease;
}

.project-simple-card:hover {
    box-shadow: 0 4px 20px rgb(var(--brand-rgb) / 0.12);
}

.project-simple-card__inner {
    padding: 1.5rem 1.75rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.project-simple-card__title {
    font-family: "Saira Extra Condensed", sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.35rem;
}

.project-simple-card__title a {
    color: var(--brand-dark);
    text-decoration: none;
    min-height: unset;
    min-width: unset;
    min-inline-size: unset;
    line-height: 1.3;
    margin: 0;
}

.project-simple-card__title a:hover {
    color: var(--brand);
}

.project-simple-card__desc {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.6;
}

.project-simple-card__link {
    flex-shrink: 0;
    font-family: "Saira Extra Condensed", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
    white-space: nowrap;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--brand);
    border-radius: var(--radius-sm);
    transition:
        background 0.15s ease,
        color 0.15s ease;
    line-height: 1.4;
    margin: 0;
}

/* Restore mobile tap-target minimums (overridden by tweaks.css global rule) */
@media (max-width: 767px) {
    .project-simple-card__link {
        min-height: 48px;
        min-width: 48px;
    }
}

.project-simple-card__link:hover {
    background: var(--brand);
    color: #fff;
    text-decoration: none;
}

/* ---------------------------------------------------------------
   Desktop layout — body left, screenshot right
--------------------------------------------------------------- */

@media (min-width: 768px) {
    .project-card {
        flex-direction: row;
    }

    .project-card__body {
        flex: 0 0 38%;
        max-width: 38%;
    }

    /* Visual bleeds left under the body; flex:1 1 auto fills the rest + bleed width */
    .project-card__visual {
        flex: 1 1 auto;
        min-height: 320px;
        margin-left: var(--card-visual-bleed);
    }
}

@media (max-width: 767px) {
    .project-card__body {
        /* Extra bottom padding gives breathing room above the image */
        padding: 1.75rem 1.5rem 2rem 1.75rem;
    }

    .project-card__title {
        font-size: 2rem;
    }

    .project-card__desc {
        max-width: none;
    }

    /* Image is below the body on mobile — fade in from the top, not from the left */
    .project-card__visual {
        -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 30%);
        mask-image: linear-gradient(to bottom, transparent 0%, black 30%);
    }

    .project-card__visual::before {
        -webkit-mask-image: linear-gradient(
            to bottom,
            transparent 0%,
            black 20%,
            transparent 50%
        );
        mask-image: linear-gradient(
            to bottom,
            transparent 0%,
            black 20%,
            transparent 50%
        );
    }
}

/* No lift on touch devices — :hover fires on tap and feels jittery */
@media (hover: none) {
    .project-card:hover {
        transform: none;
        box-shadow: var(--shadow-card);
    }

    .project-card:hover .project-card__screenshot {
        transform: none;
    }
}

/* ---------------------------------------------------------------
   Project detail page (single.html)
--------------------------------------------------------------- */

.project-detail__header {
    padding-bottom: 0.5rem;
}

.project-detail__subtitle {
    font-size: 1.8rem;
    font-weight: 300;
    display: block;
    color: var(--muted);
    line-height: 1;
}

.project-detail__tagline {
    font-family: "Open Sans", sans-serif;
    font-size: 1rem;
    font-style: italic;
    color: var(--brand);
    margin: 0.4rem 0 1rem;
    letter-spacing: 0.02em;
}

.project-detail__header-links {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Reuse dark button classes on light bg — override to use brand colors */
.project-detail .project-card__link--github {
    background: rgb(var(--brand-rgb) / 0.1);
    color: var(--brand);
    border: 1px solid rgb(var(--brand-rgb) / 0.35);
}
.project-detail .project-card__link--github:hover {
    background: rgb(var(--brand-rgb) / 0.18);
    color: var(--brand-dark);
}

.project-detail .project-status {
    color: var(--muted);
}

.project-section-heading {
    font-family: "Saira Extra Condensed", sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--brand-dark);
    letter-spacing: 0.02em;
    margin: 2.25rem 0 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--bg-deep);
}

/* Hero screenshot */
.project-detail__hero {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow:
        0 2px 8px rgb(0 0 0 / 0.06),
        0 12px 40px rgb(var(--shadow-tint-rgb) / 0.14);
    margin: 1.5rem 0 2rem;
    border: 1px solid var(--bg-deep);
}

.project-detail__hero img {
    width: 100%;
    display: block;
}

/* Intro body text */
.project-detail__intro {
    font-size: 0.92rem;
    line-height: 1.75;
    color: var(--text-body);
    max-width: 90ch;
}

.project-detail__intro p {
    margin-bottom: 0.75rem;
}
.project-detail__intro strong {
    color: var(--brand-dark);
}

/* Feature tiles */
.project-detail__features {
    display: grid;
    grid-template-columns: repeat(var(--feature-cols, auto-fit), minmax(195px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.feature-tile {
    background: var(--bg-mid);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.1rem;
    border-left: 3px solid var(--accent);
    transition: box-shadow 0.2s ease;
}

.feature-tile:hover {
    box-shadow: 0 4px 20px rgb(var(--accent-rgb) / 0.12);
}

.feature-tile__icon {
    font-size: 1.2rem;
    color: var(--brand);
    margin-bottom: 0.55rem;
}

.feature-tile__icon svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: var(--brand);
}

.feature-tile__title {
    font-family: "Saira Extra Condensed", sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin-bottom: 0.3rem;
    letter-spacing: 0.02em;
}

.feature-tile__desc {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
}

/* Screenshots gallery */
.screenshots-gallery {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    padding-bottom: 0.85rem;
    margin-bottom: 1.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.screenshots-gallery::-webkit-scrollbar {
    height: 3px;
}
.screenshots-gallery::-webkit-scrollbar-track {
    background: var(--bg-deep);
    border-radius: 2px;
}
.screenshots-gallery::-webkit-scrollbar-thumb {
    background: var(--brand);
    border-radius: 2px;
}

.gallery-item {
    flex: 0 0 auto;
    width: clamp(260px, 38vw, 420px);
    scroll-snap-align: start;
    margin: 0;
}

.gallery-item img {
    width: 100%;
    display: block;
    border-radius: 6px;
    border: 1px solid var(--bg-deep);
    box-shadow: 0 4px 18px rgb(0 0 0 / 0.08);
}

.gallery-item figcaption {
    font-size: 0.7rem;
    color: var(--muted);
    text-align: center;
    margin-top: 0.5rem;
    font-style: italic;
    line-height: 1.4;
}

/* Data sources table */
.data-sources-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin: 0.5rem 0 2rem;
    /* Scroll rather than overflow on narrow viewports */
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-sources-table th {
    font-family: "Saira Extra Condensed", sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 0.7rem;
    color: var(--brand);
    padding: 0.55rem 0.8rem;
    border-bottom: 2px solid var(--bg-deep);
    text-align: left;
}

.data-sources-table td {
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--bg-mid);
    color: var(--text-body);
    vertical-align: top;
    line-height: 1.5;
}

.data-sources-table tbody tr:last-child td {
    border-bottom: none;
}

.data-sources-table code {
    background: var(--bg-mid);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.75rem;
    color: var(--brand-dark);
    font-family:
        "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* Privacy architecture tiers */
.privacy-chain {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bg-deep);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 2rem;
}

.privacy-tier {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--bg-deep);
    position: relative;
    transition: background 0.15s ease;
}

.privacy-tier:last-child {
    border-bottom: none;
}

.privacy-tier:first-child {
    background: linear-gradient(90deg, rgb(var(--accent-rgb) / 0.06), transparent);
}

.privacy-tier:hover {
    background: var(--bg-mid);
}

.privacy-tier__number {
    flex: 0 0 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Saira Extra Condensed", sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.privacy-tier:nth-child(1) .privacy-tier__number {
    background: var(--accent);
    color: #fff;
}
.privacy-tier:nth-child(2) .privacy-tier__number {
    background: var(--brand);
    color: #fff;
}
.privacy-tier:nth-child(3) .privacy-tier__number {
    background: var(--cyan);
    color: var(--brand-dark);
}
.privacy-tier:nth-child(4) .privacy-tier__number {
    background: var(--bg-deep);
    color: var(--muted);
}

.privacy-tier__label {
    font-family: "Saira Extra Condensed", sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--brand-dark);
    letter-spacing: 0.02em;
    margin-bottom: 0.15rem;
}

.privacy-tier:first-child .privacy-tier__label {
    color: var(--accent);
}

.privacy-tier__desc {
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.55;
}

/* CTA block at page bottom */
.project-cta {
    background: linear-gradient(135deg, var(--cta-bg-deep) 0%, var(--brand-dark) 100%);
    border-radius: var(--radius-lg);
    padding: 2rem 2.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 2.5rem;
}

.project-cta__text h4 {
    font-family: "Saira Extra Condensed", sans-serif;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
    letter-spacing: 0.01em;
}

.project-cta__text p {
    color: rgb(255 255 255 / 0.6);
    font-size: 0.82rem;
    margin: 0;
    line-height: 1.5;
}

.project-cta__actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------
   Detail page: mobile overrides
--------------------------------------------------------------- */

@media (max-width: 767px) {
    .project-cta {
        padding: 1.25rem 1rem;
    }
}

/* ---------------------------------------------------------------
   Accessibility: reduced motion
--------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .project-status__dot {
        animation: none;
    }
    .project-card {
        transition: none;
    }
    .project-card:hover {
        transform: none;
    }
    .project-card__screenshot {
        transition: none;
    }
    .project-card:hover .project-card__screenshot {
        transform: none;
    }
    .project-simple-card {
        transition: none;
    }
    .feature-tile {
        transition: none;
    }
}

/* ── Pipeline flow (How it works) ── */
.pipeline-flow {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.pipeline-flow__step {
    background: var(--bg-mid);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    text-align: center;
    flex: 1;
    min-width: 160px;
    max-width: 220px;
}

.pipeline-flow__icon {
    margin-bottom: 0.5rem;
}

.pipeline-flow__icon svg {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--brand);
}

.pipeline-flow__step:nth-child(3n+1) .pipeline-flow__icon svg { color: var(--brand); }
.pipeline-flow__step:nth-child(3n+3) .pipeline-flow__icon svg { color: var(--cyan); }
.pipeline-flow__step:nth-child(3n+5) .pipeline-flow__icon svg { color: var(--accent); }

.pipeline-flow__title {
    font-family: "Saira Extra Condensed", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin-bottom: 0.25rem;
}

.pipeline-flow__desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.pipeline-flow__arrow {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.pipeline-flow__arrow::after {
    content: "\2192"; /* → */
}

@media (max-width: 600px) {
    .pipeline-flow {
        flex-direction: column;
        align-items: center;
    }
    .pipeline-flow__step {
        max-width: 100%;
        width: 100%;
    }
    .pipeline-flow__arrow::after {
        content: "\2193"; /* ↓ */
    }
    /* Reset explicit column count to auto-fit for narrow screens */
    .project-detail__features {
        grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
    }
}
