/* =========================================
   Project Page Nav Override
   ========================================= */
.project-page .main-container {
    min-height: auto;
    padding: 0;
}

/* Nav, clock, sky gradient and entrance blur come from index.css (body.home-page) */

/* Clouds over the first screen only, behind the content */
.page-sky {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    height: 100vh;
}

/* =========================================
   Project Page Content Wrapper
   ========================================= */
.project-content {
    position: relative;
    z-index: 1;
    max-width: 1060px;
    margin: 0 auto;
    padding: 8rem 2rem 7rem; /* starts just under the pinned nav */
}

/* Nothing on these pages may widen the page (no sideways scrolling on phones) */
html:has(body.sky-page) {
    overflow-x: clip;
    font-size: 14px; /* same base size as the homepage, so nav, clock and text match */
}

/* Project/hobby pages: the sky's fade starts lower, so long hero text stays on blue */
body.home-page.sky-page:not(.dark) {
    background-image: linear-gradient(180deg,
        #387FD9 0,
        #387FD9 15vh,
        #3B85E0 32vh,
        #468EE3 48vh,
        #4C98E5 62vh,
        #5CA5E9 75vh,
        #6DB0EC 88vh,
        #7FBCEF 100vh,
        #91C7F4 110vh,
        #AAD3F5 118vh,
        #C0DEF8 126vh,
        #D2E8FB 134vh,
        #E6F3FD 142vh,
        #F8FDFF 150vh,
        #FAFDFF 156vh);
}

/* Hero text sits on the blue sky: white, like the homepage */
body.sky-page:not(.dark) :is(.project-number, .project-title) {
    color: #fff;
}

body.sky-page:not(.dark) :is(.project-desc, .project-type) {
    color: rgba(255, 255, 255, 0.9);
}

body.sky-page:not(.dark) .project-type {
    border-color: rgba(255, 255, 255, 0.5);
}

body.sky-page:not(.dark) .project-live-btn {
    color: #fff;
    border-color: #fff;
}

body.sky-page:not(.dark) .project-live-btn:hover {
    background: #fff;
    color: #111;
}

/* Section headings in normal case, like "My Work" on the homepage */
body.sky-page .section-title {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    text-transform: none;
    color: var(--text-primary);
}

/* Entrance: the page content blurs in after the nav */
body.sky-page .project-content {
    animation: blur-in 1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s backwards;
}

@media (prefers-reduced-motion: reduce) {
    body.sky-page .project-content { animation: none; }
}

/* =========================================
   Project Hero
   ========================================= */
.project-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.project-number {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.project-type {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.project-title {
    font-family: var(--font-display);
    font-size: clamp(4rem, 12vw, 8rem);
    font-weight: 900;
    letter-spacing: -0.035em;
    line-height: 1;
    color: var(--text-primary);
    margin-bottom: 1.75rem;
    transition: color 0.3s ease;
}

.project-desc {
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--text-secondary);
    max-width: 580px;
    margin-bottom: 2.5rem;
    transition: color 0.3s ease;
}

.project-live-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    border: 1.5px solid var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.project-live-btn:hover {
    background: var(--text-primary);
    color: var(--bg);
    gap: 0.75rem;
}

.project-live-btn .material-icons-round {
    font-size: 16px;
}

/* =========================================
   Section Common
   ========================================= */
.project-section {
    margin-top: 5rem;
    padding-top: 4rem;
    border-top: 1px solid var(--border);
}

.section-title {
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    transition: color 0.3s ease;
}

/* =========================================
   Stack Section
   ========================================= */
.stack-categories {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stack-category {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.stack-cat-label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 148px;
    padding-top: 0.3rem;
    flex-shrink: 0;
    transition: color 0.3s ease;
}

.stack-cat-label::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--dot-color, var(--text-secondary));
    flex-shrink: 0;
}

.stack-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.stack-pill {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

/* =========================================
   Highlights Grid
   ========================================= */
.highlights-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.highlight-card {
    background-image: linear-gradient(144.46deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    backdrop-filter: blur(21px);
    -webkit-backdrop-filter: blur(21px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    transition: background 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.highlight-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: radial-gradient(
        circle 90px at var(--glow-x, -200px) var(--glow-y, -200px),
        rgba(255, 255, 255, 0.24),
        transparent 90%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.highlight-card:hover::before {
    opacity: 1;
}

.highlight-card > * {
    position: relative;
    z-index: 1;
}

body.dark .highlight-card {
    background-image: linear-gradient(144.46deg, rgba(30, 41, 59, 0.6) 0%, rgba(30, 41, 59, 0.2) 100%);
}

.highlight-icon {
    font-size: 22px !important;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.highlight-card h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.highlight-card p {
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 900px) {
    .project-content {
        padding-top: 11rem; /* the nav drops below the clock here */
    }
}

@media (max-width: 640px) {
    .project-content {
        padding-top: 10rem;
    }

    .stack-category {
        flex-direction: column;
        gap: 0.6rem;
    }

    .stack-cat-label {
        min-width: auto;
        padding-top: 0;
    }

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

/* =========================================
   Client-facing story (top) and developer details (bottom)
   ========================================= */
.story-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.story-card {
    padding: 1.75rem;
    border-radius: 22px;
    background: var(--card-bg);
    border: 1px solid var(--border);
}

@supports (corner-shape: squircle) {
    .story-card {
        border-radius: 40px;
        corner-shape: squircle;
    }
}

.story-card h3 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}

.story-card h3 .material-icons-round {
    font-size: 22px;
    color: #387FD9;
}

.story-card p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Developer details: collapsed behind a button at the very bottom */
.dev-details {
    margin-top: 5rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border);
}

.dev-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.2rem 0.9rem 1.4rem;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    list-style: none;
    transition: background 0.2s ease;
}

.dev-toggle::-webkit-details-marker {
    display: none;
}

.dev-toggle:hover {
    background: #333;
}

body.dark .dev-toggle {
    background: #fff;
    color: #111;
}

.dev-toggle .dev-chevron {
    transition: rotate 0.3s ease;
}

.dev-details[open] .dev-chevron {
    rotate: 180deg;
}

.dev-hint {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* The technical sections inside open with the site's blur-in */
.dev-details[open] .dev-body {
    animation: blur-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.dev-body > .project-section:first-child {
    margin-top: 2.5rem;
}

@media (max-width: 640px) {
    .story-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Case study layout (project pages)
   Hero with devices → the problem → how it works (alternating rows)
   → what it changes → developer details
   ========================================= */
.cs-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 3.5rem;
    align-items: center;
}

.cs-hero .project-desc {
    font-size: 1.3rem;
    line-height: 1.6;
}

/* Device frames around real screenshots */
.device-stage {
    position: relative;
    padding: 0 6% 9% 0;
}

.device-browser {
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 40px 80px -30px rgba(10, 40, 90, 0.55), 0 8px 20px -8px rgba(10, 40, 90, 0.25);
}

.device-bar {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    background: #F2F2F5;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.device-bar i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #D7D7DC;
}

.device-bar i:nth-child(1) { background: #FF5F57; }
.device-bar i:nth-child(2) { background: #FEBC2E; }
.device-bar i:nth-child(3) { background: #28C840; }

.device-browser img {
    display: block;
    width: 100%;
    height: auto;
}

/* iPhone (16 Pro proportions): titanium frame, black bezel, side buttons,
   Dynamic Island and a status bar. Sized with container units so it scales. */
.device-phone {
    container-type: inline-size;
    filter: drop-shadow(0 40px 45px rgba(10, 40, 90, 0.35));
}

.iphone-body {
    position: relative;
    padding: 4.4cqw;
    border-radius: 16cqw;
    background: linear-gradient(145deg, #c9c6c1 0%, #77746f 18%, #b4b1ac 45%, #5e5c59 70%, #a9a6a1 100%);
}

.iphone-body::before { /* black bezel inside the titanium band */
    content: '';
    position: absolute;
    inset: 1.25cqw;
    border-radius: 14.8cqw;
    background: #050505;
}

.iphone-btn {
    position: absolute;
    width: 1cqw;
    border-radius: 1cqw;
    background: linear-gradient(90deg, #6b6864, #a9a6a1);
}

.iphone-btn.action { left: -0.8cqw; top: 20%; height: 7cqw; }
.iphone-btn.vol-up { left: -0.8cqw; top: 28%; height: 12cqw; }
.iphone-btn.vol-down { left: -0.8cqw; top: 36.5%; height: 12cqw; }
.iphone-btn.power { right: -0.8cqw; top: 30%; height: 18cqw; background: linear-gradient(270deg, #6b6864, #a9a6a1); }
.iphone-btn.camera { right: -0.8cqw; top: 55%; height: 13cqw; background: linear-gradient(270deg, #6b6864, #a9a6a1); }

.iphone-screen {
    position: relative;
    aspect-ratio: 390 / 844;
    border-radius: 12.2cqw;
    overflow: hidden;
    background: var(--sb, #fff);
}

.iphone-status {
    position: absolute;
    inset: 0 0 auto;
    height: 12.8cqw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1cqw 6.5cqw 0 8.5cqw;
    color: var(--sbc, #000);
    font: 600 3.7cqw/1 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', sans-serif;
    letter-spacing: -0.01em;
    z-index: 2;
}

.iphone-status svg {
    height: 3.1cqw;
    width: auto;
    fill: currentColor;
}

.iphone-status .icons {
    display: flex;
    align-items: center;
    gap: 1.3cqw;
}

.iphone-island {
    position: absolute;
    top: 2.7cqw;
    left: 50%;
    translate: -50% 0;
    width: 29cqw;
    height: 8.5cqw;
    border-radius: 99px;
    background: #000;
    z-index: 3;
}

.device-phone .iphone-screen img {
    position: absolute;
    top: 12.8cqw;
    left: 0;
    width: 100%;
    height: calc(100% - 12.8cqw);
    object-fit: cover;
    object-position: top;
    border-radius: 0;
}

.device-stage .device-phone {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 30%;
}

/* The problem: one big plain statement */
.cs-problem {
    margin-top: 7rem;
    max-width: 58rem;
}

.cs-kicker {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Text Reveal: tall section with the statement pinned while words light up */
.text-reveal-wrap {
    height: 165vh;
    max-width: none;
}

.text-reveal-sticky {
    position: sticky;
    top: 22vh;
}

.text-reveal-sticky .text-reveal {
    max-width: 58rem;
}

.tr-word {
    opacity: 0.15;
    transition: opacity 0.15s linear;
}

@media (max-width: 640px) {
    .text-reveal-wrap {
        height: 150vh;
    }

    .text-reveal-sticky {
        top: 20vh;
    }
}

.cs-problem p {
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 3.4vw, 2.9rem);
    font-weight: 600;
    line-height: 1.22;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.cs-problem p em {
    font-style: normal;
    color: #387FD9;
}

/* How it works: alternating screenshot / text rows */
.cs-rows {
    display: flex;
    flex-direction: column;
    gap: 6.5rem;
    margin-top: 2rem;
}

.cs-row {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 4rem;
    align-items: center;
}

.cs-row.flip > .cs-media {
    order: 2;
}

.cs-media.phone-only {
    display: flex;
    justify-content: center;
}

.cs-media.phone-only .device-phone {
    width: min(235px, 58%);
}

.cs-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: rgba(56, 127, 217, 0.12);
    color: #387FD9;
    font-weight: 700;
    margin-bottom: 1.1rem;
}

.cs-text h3 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.6vw, 2.2rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    margin-bottom: 0.9rem;
}

.cs-text p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* What it changes: three result tiles */
.cs-impact-wrap {
    margin-top: 8rem;
}

.cs-impact-wrap > h2 {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 3.2vw, 2.7rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 2.25rem;
}

.cs-impact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.cs-tile {
    padding: 2rem 1.75rem;
    border-radius: 26px;
    background: #111;
    color: #fff;
}

@supports (corner-shape: squircle) {
    .cs-tile {
        border-radius: 48px;
        corner-shape: squircle;
    }
}

.cs-tile .material-icons-round {
    font-size: 30px;
    color: #6DB0EC;
    margin-bottom: 1.4rem;
}

.cs-tile h3 {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 0.7rem;
}

.cs-tile p {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.72);
}

body.dark .cs-tile {
    background: var(--card-bg);
    border: 1px solid var(--border);
}

@media (max-width: 900px) {
    .cs-hero,
    .cs-row {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .cs-row.flip > .cs-media {
        order: 0;
    }

    .cs-impact {
        grid-template-columns: 1fr;
    }

    .cs-rows {
        gap: 4.5rem;
    }
}

@media (max-width: 640px) {
    .cs-problem {
        margin-top: 4.5rem;
    }

}

/* At a glance: summary slides, first one full width */
.cs-slides {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.cs-slide {
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    background: none;
    cursor: pointer;
}

.cs-slide.wide {
    grid-column: 1 / -1;
}

.cs-slide img {
    display: block;
    width: 100%;
    height: auto;
}

@media (max-width: 640px) {
    .cs-slides {
        grid-template-columns: 1fr;
    }
}

/* "Top highlights" heading above the numbered points (same style as "The Problem") */
.cs-rows-title {
    margin-bottom: -3.5rem; /* sits close to the first point despite the row gap */
}

/* Type label right under the project title (e.g. "Food ordering platform") */
.project-subtitle {
    margin: -0.75rem 0 1.5rem;
}

/* Two phones side by side (e.g. stamp card + QR code), the second slightly lower */
.cs-media.phone-pair {
    display: flex;
    justify-content: center;
    gap: 6%;
}

.cs-media.phone-pair .device-phone {
    width: min(250px, 44%);
}

.cs-media.phone-pair .device-phone:nth-child(2) {
    margin-top: 12%;
}
