/*
 * Maxwell Digital Studio — Projects / Portfolio section
 * Matches the studio dark / purple / Montserrat design system.
 * Version: 1.0.0
 */

/* ---------------------------------------------------------------------------
 * Section shell
 * ------------------------------------------------------------------------- */
.projects-section {
    position: relative;
    z-index: 4;
    background: var(--bg-primary);
    padding: 100px 40px;
    text-align: center;
    overflow: hidden;
}

.projects-section::before {
    content: '';
    position: absolute;
    top: -150px;
    right: -150px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 95, 255, 0.07) 0%, transparent 60%);
    pointer-events: none;
}

.projects-section::after {
    content: '';
    position: absolute;
    bottom: -200px;
    left: -150px;
    width: 560px;
    height: 560px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.06) 0%, transparent 60%);
    pointer-events: none;
}

.projects-title {
    font-size: 44px;
    font-weight: 100;
    color: var(--text-primary);
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.projects-subtitle {
    font-size: 14px;
    font-weight: 400;
    color: var(--purple-primary);
    letter-spacing: 3px;
    margin-bottom: 48px;
}

/* ---------------------------------------------------------------------------
 * Carousel — one project slide visible at a time
 * ------------------------------------------------------------------------- */
.projects-carousel {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
}

/* Stack every slide in the same grid cell; only the active one shows. */
.project-slide {
    display: grid;
    grid-template-columns: minmax(280px, 38%) 1fr;
    gap: 48px;
    align-items: center;
    text-align: left;

    grid-column: 1;
    grid-row: 1;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition: opacity 600ms ease, transform 600ms ease, visibility 600ms ease;
    pointer-events: none;
}

/* When there is more than one project, overlap the slides so the carousel
   keeps a fixed height as they cross-fade. A single project lays out normally. */
.projects-carousel.is-multi {
    display: grid;
}
.projects-carousel.is-multi .project-slide {
    grid-column: 1;
    grid-row: 1;
}

.project-slide.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

/* Left: meta — clean text on the dark background, no boxed card. */
.project-meta-inner {
    padding: 8px 0;
}

.project-name {
    font-size: clamp(34px, 4vw, 48px);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.05;
    letter-spacing: -0.5px;
    margin-bottom: 32px;
}

.project-facts {
    margin: 0 0 28px;
}

.project-fact {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border-subtle);
}
.project-fact:last-child {
    border-bottom: 1px solid var(--border-subtle);
}

.project-fact dt {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--purple-primary);
    align-self: center;
}

.project-fact dd {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.5;
    word-break: break-word;
}

.project-fact dd a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border-subtle);
    transition: color 200ms ease, border-color 200ms ease;
}
.project-fact dd a:hover {
    color: var(--purple-primary);
    border-color: var(--purple-primary);
}

.project-explore {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #fff;
    background: var(--purple-primary);
    border: none;
    border-radius: 999px;
    padding: 14px 28px;
    text-decoration: none;
    cursor: pointer;
    transition: background 200ms ease;
}
.project-explore:hover {
    background: var(--purple-secondary);
}

/* Right: screenshot slideshow ------------------------------------------- */
.project-shots {
    min-width: 0;
}
.project-shots-link {
    display: block;
    text-decoration: none;
}
.project-shots-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-secondary);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

/* Hover treatment mirrors the services tiles: purple border, glow, slight lift
   plus the animated star-border sweep. */
.project-shots-link:hover .project-shots-frame {
    border-color: var(--purple-primary);
    box-shadow: 0 0 24px rgba(139, 95, 255, 0.2);
    transform: translateY(-2px);
}

.project-shots-frame::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, transparent 0%, transparent 35%, rgba(139, 95, 255, 0.5) 45%, #8b5fff 50%, rgba(139, 95, 255, 0.5) 55%, transparent 65%, transparent 100%);
    background-size: 400% 400%;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
    pointer-events: none;
}
.project-shots-link:hover .project-shots-frame::before {
    opacity: 1;
    animation: star-border 4s ease-in-out infinite;
}

.project-shot {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    opacity: 0;
    transition: opacity 900ms ease;
}
.project-shot.is-active {
    opacity: 1;
}

/* Carousel navigation (multi only) -------------------------------------- */
/* Arrow buttons reuse the .arrow-badge styling from main.css (the same badges
   used by the Process / "Idea to Launch" section), so only layout lives here. */
.projects-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 48px;
}

.projects-dots {
    display: flex;
    gap: 10px;
}
.projects-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: rgba(139, 95, 255, 0.25);
    cursor: pointer;
    transition: background 200ms ease, transform 200ms ease;
}
.projects-dot:hover {
    background: rgba(139, 95, 255, 0.5);
}
.projects-dot.is-active {
    background: var(--purple-primary);
    transform: scale(1.25);
}

/* ===========================================================================
 * Standalone project detail page  (/projects/<slug>/)
 * ======================================================================== */
.project-page {
    position: relative;
    z-index: 2;
    background: var(--bg-primary);
    padding: 140px 40px 120px;
    max-width: 1240px;
    margin: 0 auto;
}

/* Shared buttons: solid purple primary + white "ghost" secondary. */
.project-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border-radius: 999px;
    padding: 13px 28px;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
}
.project-btn--solid {
    background: var(--purple-primary);
    color: #fff;
}
.project-btn--solid:hover {
    background: var(--purple-secondary);
}
.project-btn--ghost {
    background: #fff;
    color: #09090b;
    border-color: #fff;
}
.project-btn--ghost:hover {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
}

.project-page-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

/* Header ----------------------------------------------------------------- */
.project-page-head {
    margin-bottom: 80px;
}
.project-page-head .project-page-actions {
    margin-bottom: 40px;
}
.project-page-kicker {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 3px;
    color: var(--purple-primary);
    margin-bottom: 16px;
}
.project-page-title {
    font-size: clamp(38px, 6vw, 68px);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.02;
    letter-spacing: -0.5px;
    margin-bottom: 18px;
}
.project-page-tagline {
    font-size: clamp(17px, 2vw, 22px);
    font-weight: 300;
    color: var(--text-secondary);
    max-width: 760px;
    line-height: 1.5;
    margin-bottom: 32px;
}

/* Meta strip */
.project-page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin: 0 0 32px;
    padding: 24px 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}
.project-page-meta dt {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--purple-primary);
    margin-bottom: 6px;
}
.project-page-meta dd {
    margin: 0;
    font-size: 15px;
    color: var(--text-primary);
}

/* Tag pills — rounded chips echoing the service-tile buttons. */
.project-tags {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.project-tag {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 11px 22px;
    line-height: 1.2;
    transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
}
.project-tag:hover {
    color: var(--purple-primary);
    border-color: var(--purple-primary);
    background: var(--purple-glow);
}

/* Zig-zag 70/30 rows ----------------------------------------------------- */
.project-zigzag {
    display: flex;
    flex-direction: column;
    gap: 96px;
}

.zigzag-row {
    display: grid;
    grid-template-columns: 70% 30%; /* text 70 / image 30 */
    gap: 56px;
    align-items: center;
}
.zigzag-row.is-reverse {
    grid-template-columns: 30% 70%; /* image 30 / text 70 */
}
/* Keep the text reading first in the DOM (a11y) but render the image on the
   left for reversed rows. */
.zigzag-row.is-reverse .zigzag-text {
    order: 2;
}
.zigzag-row.is-reverse .zigzag-image {
    order: 1;
}

/* Text aligns to the side the image sits on: image-right → text hugs the
   right edge (toward the image); image-left → text hugs the left edge. */
.zigzag-text {
    text-align: right;
}
.zigzag-row.is-reverse .zigzag-text {
    text-align: left;
}

.zigzag-text h2 {
    font-size: clamp(22px, 2.6vw, 30px);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 18px;
}
.zigzag-text p {
    font-size: 16px;
    font-weight: 300;
    color: var(--text-secondary);
    line-height: 1.75;
}

.zigzag-image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
}

/* Footer ----------------------------------------------------------------- */
.project-page-foot {
    margin-top: 100px;
    padding-top: 48px;
    border-top: 1px solid var(--border-subtle);
}

/* ---------------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------------- */
@media (max-width: 980px) {
    .project-slide {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .project-shots {
        order: -1; /* screenshot on top, meta below on narrow screens */
    }
    .project-name {
        text-align: center;
    }
    .project-meta-inner {
        text-align: center;
    }
    .project-facts {
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
    }

    .zigzag-row,
    .zigzag-row.is-reverse {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .zigzag-row.is-reverse .zigzag-text,
    .zigzag-row.is-reverse .zigzag-image {
        order: initial; /* always text-then-image when stacked */
    }
    /* Stacked: text reads naturally left-aligned regardless of row parity. */
    .zigzag-text,
    .zigzag-row.is-reverse .zigzag-text {
        text-align: left;
    }
    .zigzag-image {
        max-width: 560px;
        margin: 0 auto;
        width: 100%;
    }
}

@media (max-width: 600px) {
    .projects-section {
        padding: 70px 20px;
    }
    .project-fact {
        grid-template-columns: 80px 1fr;
    }
    .project-page {
        padding: 110px 20px 80px;
    }
    .project-page-meta {
        gap: 24px;
    }
    .project-zigzag {
        gap: 64px;
    }
    .project-page-actions {
        width: 100%;
    }
    .project-btn {
        flex: 1 1 auto;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .project-slide,
    .project-shot {
        transition: none;
    }
}
