/**
 * Project Templates Styles
 *
 * Styles for single CNaught project pages.
 *
 * @package CarbonGuru_Stripe_Climate
 */

/* Variables (inherit from supplier templates) */
:root {
    --cg-primary: #635bff;
    --cg-primary-dark: #4f46e5;
    --cg-success: #10b981;
    --cg-warning: #f59e0b;
    --cg-text: #1f2937;
    --cg-text-muted: #6b7280;
    --cg-border: #e5e7eb;
    --cg-bg-light: #f9fafb;
    --cg-radius: 12px;
    --cg-radius-lg: 20px;
}

/* =====================================================
   PROJECT HERO BLOCK
   ===================================================== */

.cg-project-hero-block {
    margin: 0;
}

.cg-project-hero-block__inner {
    position: relative;
    min-height: 350px;
}

.cg-project-hero-block__image {
    position: relative;
    overflow: hidden;
    border-radius: 0;
}

.cg-project-hero-block__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cg-project-hero-block__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.6));
}

.cg-project-hero-block__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 32px 24px;
    color: #fff;
    z-index: 1;
}

.cg-project-hero-block__title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 16px;
    line-height: 1.1;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.cg-project-hero-block__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.cg-project-hero-block__type,
.cg-project-hero-block__impact {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
}

.cg-project-hero-block__type {
    background: var(--cg-primary);
}

.cg-project-hero-block__impact {
    background: var(--cg-success);
}

.cg-project-hero-block__location {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cg-text);
}

.cg-project-hero-block__location svg {
    color: var(--cg-primary);
}

/* =====================================================
   PROJECT DETAILS BLOCK
   ===================================================== */

.cg-project-details-block {
    max-width: 1000px;
    margin: 0 auto;
}

/* Project Section */
.cg-project-section {
    padding: 40px 0;
    border-bottom: 1px solid var(--cg-border);
}

.cg-project-section:last-child {
    border-bottom: none;
}

.cg-project-section__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cg-text);
    margin: 0 0 8px;
}

.cg-project-section__subtitle {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--cg-text);
    margin: 24px 0 12px;
}

.cg-project-section__subtitle-text {
    font-size: 0.9375rem;
    color: var(--cg-text-muted);
    margin: 0 0 20px;
}

.cg-project-section__content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--cg-text);
}

.cg-project-section__content p {
    margin-bottom: 16px;
}

.cg-project-section__content p:last-child {
    margin-bottom: 0;
}

/* Project Section Meta */
.cg-project-section__meta {
    margin-top: 24px;
}

/* Project Tags */
.cg-project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cg-project-tag {
    display: inline-block;
    padding: 6px 12px;
    background: var(--cg-bg-light);
    border: 1px solid var(--cg-border);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--cg-text);
}

.cg-project-tag--label {
    background: rgba(99, 91, 255, 0.1);
    border-color: var(--cg-primary);
    color: var(--cg-primary);
}

.cg-project-tag--linked {
    text-decoration: none;
    transition: all 0.15s ease;
}

.cg-project-tag--linked:hover {
    background: var(--cg-primary);
    border-color: var(--cg-primary);
    color: #fff;
}

/* Linked info values */
.cg-project-info-link {
    color: var(--cg-primary);
    text-decoration: none;
    font-weight: 500;
}

.cg-project-info-link:hover {
    text-decoration: underline;
}

/* Project Info Grid */
.cg-project-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.cg-project-info-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.cg-project-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: var(--cg-bg-light);
    border-radius: var(--cg-radius);
}

.cg-project-info-item__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cg-text-muted);
}

.cg-project-info-item__value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--cg-text);
}

.cg-project-info-item__value a {
    color: var(--cg-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cg-project-info-item__value a:hover {
    text-decoration: underline;
}

.cg-project-info-item__value svg {
    opacity: 0.7;
}

/* Due Diligence Figure */
.cg-project-section__figure {
    margin-top: 24px;
    padding: 20px;
    background: var(--cg-bg-light);
    border-radius: var(--cg-radius);
}

.cg-project-section__image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.cg-project-section__caption {
    margin: 12px 0 0;
    font-size: 0.875rem;
    font-style: italic;
    color: var(--cg-text-muted);
}

/* UN SDG Goals */
.cg-project-sdgs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.cg-project-sdg {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px;
    background: var(--cg-bg-light);
    border-radius: var(--cg-radius);
    min-width: 100px;
    text-align: center;
}

.cg-project-sdg__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--cg-primary);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 50%;
}

.cg-project-sdg__name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--cg-text-muted);
    line-height: 1.3;
}

/* Project Location */
.cg-project-location {
    padding: 20px;
    background: var(--cg-bg-light);
    border-radius: var(--cg-radius);
    margin-top: 20px;
}

.cg-project-location__name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--cg-text);
    margin: 0 0 8px;
}

.cg-project-location__name svg {
    color: var(--cg-primary);
}

.cg-project-location__coords {
    font-size: 0.875rem;
    color: var(--cg-text-muted);
    margin: 0 0 16px;
}

.cg-project-location__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--cg-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
}

.cg-project-location__link:hover {
    text-decoration: underline;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 768px) {
    .cg-project-hero-block__title {
        font-size: 1.75rem;
    }

    .cg-project-hero-block__content {
        padding: 24px 16px;
    }

    .cg-project-hero-block__meta {
        gap: 10px;
    }

    .cg-project-section {
        padding: 32px 0;
    }

    .cg-project-section__title {
        font-size: 1.25rem;
    }

    .cg-project-info-grid {
        grid-template-columns: 1fr;
    }

    .cg-project-sdgs {
        justify-content: center;
    }
}

/* =====================================================
   CNAUGHT PORTFOLIO GALLERY BLOCK
   ===================================================== */

.cg-cnaught-gallery {
    max-width: 100%;
    width: 100%;
}

.cg-cnaught-gallery__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cg-text);
    margin: 0 0 12px;
    padding: 0;
}

.cg-cnaught-gallery__main {
    position: relative;
    border-radius: var(--cg-radius);
    overflow: hidden;
    margin-bottom: 12px;
    background: var(--cg-bg-light);
}

.cg-cnaught-gallery__main a {
    display: block;
    text-decoration: none;
}

.cg-cnaught-gallery__image {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.cg-cnaught-gallery__main a:hover .cg-cnaught-gallery__image {
    transform: scale(1.02);
}

.cg-cnaught-gallery__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    padding: 20px;
}

.cg-cnaught-gallery__description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #4b5563;
    margin: 16px 0 20px 0;
    padding: 0;
}

.cg-cnaught-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.cg-cnaught-gallery__thumb-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.cg-cnaught-gallery__thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    background: #fff;
    border: 1px solid var(--cg-border);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.cg-cnaught-gallery__thumb:hover {
    border-color: var(--cg-success);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
    transform: translateY(-2px);
}

.cg-cnaught-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cg-cnaught-gallery__thumb-placeholder {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cg-text-muted);
    text-transform: uppercase;
}

.cg-cnaught-gallery__thumb-name {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--cg-text);
    text-align: center;
    text-decoration: none;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cg-cnaught-gallery__thumb-name:hover {
    color: var(--cg-primary);
}

.cg-cnaught-gallery__count {
    font-size: 0.8125rem;
    color: var(--cg-text-muted);
    margin: 0;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .cg-cnaught-gallery__thumbs {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .cg-cnaught-gallery__thumb-name {
        font-size: 0.6875rem;
    }
}

@media (max-width: 480px) {
    .cg-cnaught-gallery__thumbs {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .cg-cnaught-gallery__thumb-wrapper {
        gap: 6px;
    }

    .cg-cnaught-gallery__thumb-name {
        font-size: 0.625rem;
    }
}

/* =====================================================
   PORTFOLIO COMPOSITION BLOCK
   ===================================================== */

.cg-portfolio-composition {
    max-width: 100%;
    padding: 24px;
    background: var(--cg-bg-light);
    border-radius: var(--cg-radius);
    margin: 24px 0;
}

.cg-portfolio-composition__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--cg-text);
    margin: 0 0 16px;
}

.cg-portfolio-composition__description {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--cg-text);
    margin-bottom: 20px;
}

.cg-portfolio-composition__description p {
    margin: 0 0 12px;
}

.cg-portfolio-composition__description p:last-child {
    margin-bottom: 0;
}

.cg-portfolio-composition__chart {
    margin-bottom: 20px;
}

.cg-portfolio-composition__bar {
    display: flex;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    background: #e5e7eb;
}

.cg-portfolio-composition__segment {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2px;
    transition: opacity 0.2s ease;
}

.cg-portfolio-composition__segment:hover {
    opacity: 0.85;
}

.cg-portfolio-composition__segment-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.cg-portfolio-composition__legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cg-portfolio-composition__legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cg-portfolio-composition__legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.cg-portfolio-composition__legend-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.cg-portfolio-composition__legend-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cg-text);
}

.cg-portfolio-composition__legend-type {
    font-size: 0.75rem;
    color: var(--cg-text-muted);
}

.cg-portfolio-composition__legend-percentage {
    font-size: 1rem;
    font-weight: 600;
    color: var(--cg-text);
    min-width: 45px;
    text-align: right;
}

/* Responsive */
@media (max-width: 480px) {
    .cg-portfolio-composition {
        padding: 16px;
    }

    .cg-portfolio-composition__bar {
        height: 24px;
    }

    .cg-portfolio-composition__segment-label {
        font-size: 0.625rem;
    }

    .cg-portfolio-composition__legend-name {
        font-size: 0.8125rem;
    }

    .cg-portfolio-composition__legend-percentage {
        font-size: 0.875rem;
    }
}
