/* ============================================
   Project Detail Pages
   Extends portfolio.css variables & patterns
   ============================================ */

/* --- CSS Custom Properties (same as portfolio) --- */
:root {
    --bg-primary: #FAF9F6;
    --bg-secondary: #F5F0EB;
    --bg-card: #FFFDF9;
    --text-primary: #1A1A1A;
    --text-secondary: #444444;
    --text-muted: #777777;
    --accent: #FF4500;
    --accent-hover: #E03D00;
    --accent-light: rgba(255, 69, 0, 0.08);
    --border: #E0D6CC;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-hero: clamp(2rem, 5vw, 3rem);
    --font-size-h2: clamp(1.5rem, 3vw, 2rem);
    --font-size-h3: clamp(1.1rem, 2vw, 1.35rem);
    --font-size-body: 1rem;
    --font-size-small: 0.875rem;
    --spacing-section: 80px;
    --nav-height: 64px;
    --transition-speed: 0.3s;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-body);
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-speed) ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   TOP NAVIGATION
   ============================================ */
.project-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

.project-nav .nav-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--accent);
    transition: opacity var(--transition-speed) ease;
}

.back-link:hover {
    opacity: 0.7;
}

.back-link svg {
    flex-shrink: 0;
}

.nav-projects {
    display: flex;
    list-style: none;
    gap: 4px;
}

.nav-projects a {
    display: block;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: color var(--transition-speed) ease,
                background var(--transition-speed) ease;
}

.nav-projects a:hover,
.nav-projects a:focus-visible {
    color: var(--accent);
    background: var(--accent-light);
}

.nav-projects a.active {
    color: var(--accent);
    background: var(--accent-light);
    font-weight: 600;
}

/* ============================================
   PROJECT HERO
   ============================================ */
.project-hero {
    padding: calc(var(--nav-height) + 60px) 24px 48px;
    text-align: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Background image layer */
.project-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--hero-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.4;
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: scale(1.05);
    z-index: 0;
}

/* Gradient overlay for readability */
.project-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(248, 249, 250, 0.6) 0%,
        rgba(248, 249, 250, 0.85) 40%,
        rgba(248, 249, 250, 0.95) 100%
    );
    z-index: 1;
}

/* Ken Burns zoom on load */
.project-hero.hero-revealed::before {
    transform: scale(1);
    opacity: 1;
}

.project-hero .container {
    max-width: 760px;
    position: relative;
    z-index: 2;
}

.project-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.meta-tag {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent);
    padding: 4px 12px;
    background: var(--accent-light);
    border-radius: 50px;
}

.project-hero h1 {
    font-size: var(--font-size-hero);
    font-weight: 800;
    line-height: 1.15;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.project-hero .subtitle {
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 640px;
    margin: 0 auto;
}

.project-roles {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.role-chip {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 5px 14px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 50px;
}

/* ============================================
   HERO ENTRANCE ANIMATION (first visit)
   ============================================ */
@keyframes heroFadeUp {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heroFadeDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heroScale {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes chipSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes accentLine {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 48px;
        opacity: 1;
    }
}

/* When entrance animation is active, hide elements initially */
.hero-entrance .project-meta,
.hero-entrance h1,
.hero-entrance .subtitle,
.hero-entrance .project-roles,
.hero-entrance .hero-divider {
    opacity: 0;
}

/* Staggered entrance sequence */
.hero-entrance.hero-animate .project-meta {
    animation: heroFadeDown 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.hero-entrance.hero-animate h1 {
    animation: heroFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
}

.hero-entrance.hero-animate .subtitle {
    animation: heroFadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.6s forwards;
}

.hero-entrance.hero-animate .project-roles {
    animation: heroScale 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.85s forwards;
}

/* Individual chip stagger within roles */
.hero-entrance.hero-animate .role-chip {
    opacity: 0;
    animation: chipSlideIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-entrance.hero-animate .role-chip:nth-child(1) { animation-delay: 0.9s; }
.hero-entrance.hero-animate .role-chip:nth-child(2) { animation-delay: 1.0s; }
.hero-entrance.hero-animate .role-chip:nth-child(3) { animation-delay: 1.1s; }
.hero-entrance.hero-animate .role-chip:nth-child(4) { animation-delay: 1.2s; }
.hero-entrance.hero-animate .role-chip:nth-child(5) { animation-delay: 1.3s; }

/* Decorative divider line that draws in */
.hero-divider {
    width: 48px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    margin: 28px auto 0;
    opacity: 1;
}

.hero-entrance .hero-divider {
    opacity: 0;
    width: 0;
}

.hero-entrance.hero-animate .hero-divider {
    animation: accentLine 0.6s cubic-bezier(0.22, 1, 0.36, 1) 1.3s forwards;
}

/* ============================================
   CONTENT SECTIONS
   ============================================ */
.project-section {
    padding: var(--spacing-section) 0;
}

.project-section:nth-child(even) {
    background: var(--bg-secondary);
}

.section-heading {
    font-size: var(--font-size-h2);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    position: relative;
    padding-bottom: 12px;
}

.section-heading::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 48px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

.section-intro {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-top: 20px;
    margin-bottom: 32px;
}

/* Content blocks */
.content-block {
    margin-bottom: 36px;
}

.content-block:last-child {
    margin-bottom: 0;
}

.content-block h3 {
    font-size: var(--font-size-h3);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.content-block p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.content-block ul {
    list-style: none;
    padding: 0;
    margin-bottom: 16px;
}

.content-block ul li {
    position: relative;
    padding-left: 24px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 10px;
}

.content-block ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 11px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
}

/* Highlight/callout text */
.callout {
    padding: 20px 24px;
    background: var(--accent-light);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 24px 0;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.stat-card {
    text-align: center;
    padding: 24px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: var(--font-size-small);
    color: var(--text-muted);
}

/* Image containers */
.project-image {
    margin: 28px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

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

.project-image.small {
    max-width: 560px;
}

.project-image.medium {
    max-width: 720px;
}

.image-caption {
    font-size: var(--font-size-small);
    color: var(--text-muted);
    text-align: center;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    font-style: italic;
}

/* Image grid for side-by-side images */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin: 28px 0;
}

.image-grid .project-image {
    margin: 0;
}

/* Comparison table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: var(--font-size-small);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.comparison-table th,
.comparison-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.comparison-table th {
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table tr:nth-child(even) td {
    background: var(--bg-secondary);
}

.comparison-table td:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

/* Result/impact cards */
.impact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin: 28px 0;
}

.impact-card {
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-speed) ease,
                box-shadow var(--transition-speed) ease;
}

.impact-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.impact-card .impact-icon {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.impact-card h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.impact-card p {
    font-size: var(--font-size-small);
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Reflection cards */
.reflection-list {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.reflection-item {
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.reflection-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 700;
    font-size: var(--font-size-small);
    border-radius: 50%;
}

.reflection-item p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

.reflection-item strong {
    color: var(--text-primary);
}

/* ============================================
   CONTACT / CONNECT SECTION
   ============================================ */
.contact-section {
    background: var(--bg-primary);
    text-align: center;
    padding: var(--spacing-section) 0;
}

.contact-section .section-heading {
    text-align: center;
}

.contact-section .section-heading::after {
    left: 50%;
    transform: translateX(-50%);
}

.contact-description {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 20px auto 40px;
    line-height: 1.7;
}

.contact-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: var(--font-size-small);
    color: var(--text-primary);
    transition: all var(--transition-speed) ease;
}

.contact-link svg {
    flex-shrink: 0;
    color: var(--accent);
    transition: color var(--transition-speed) ease;
}

.contact-link:hover,
.contact-link:focus-visible {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   BOTTOM PROJECT NAVIGATION
   ============================================ */
.project-footer-nav {
    padding: 48px 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.footer-nav-label {
    text-align: center;
    font-size: var(--font-size-small);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.footer-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

.footer-nav-card {
    display: block;
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) ease;
    text-align: center;
}

.footer-nav-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.footer-nav-card .nav-card-company {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.footer-nav-card .nav-card-title {
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Back to portfolio link */
.back-to-portfolio {
    display: block;
    text-align: center;
    margin-top: 24px;
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--accent);
}

.back-to-portfolio:hover {
    opacity: 0.7;
}

/* ============================================
   FOOTER
   ============================================ */
.project-footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.project-footer p {
    color: var(--text-muted);
    font-size: var(--font-size-small);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    :root {
        --spacing-section: 56px;
        --nav-height: 56px;
    }

    .nav-projects {
        display: none;
    }

    .project-hero {
        padding: calc(var(--nav-height) + 40px) 16px 36px;
        min-height: 340px;
    }

    .project-hero h1 {
        font-size: clamp(1.6rem, 6vw, 2.2rem);
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .footer-nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .comparison-table {
        font-size: 0.75rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 8px 10px;
    }

    .reflection-item {
        padding: 16px;
    }

    .contact-links {
        flex-direction: column;
        align-items: center;
    }

    .contact-link {
        width: 100%;
        max-width: 320px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .footer-nav-grid {
        grid-template-columns: 1fr;
    }

    .project-meta {
        gap: 8px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .project-nav,
    .project-footer-nav {
        display: none !important;
    }

    body {
        color: #000;
        background: #fff;
    }

    .project-section {
        padding: 30px 0;
    }
}
