/**
 * Homepage — Phase 2
 * Spacing rhythm: 4px base · 8px grid · clamp() for responsive scale
 */

/* ═══════════════════════════════════════
   Spacing system (homepage only)
   ═══════════════════════════════════════ */
.page-home {
    --home-section-y: clamp(3.5rem, 5.5vw, 5rem);
    --home-header-gap: clamp(2rem, 3.5vw, 2.75rem);
    --home-stack-lg: clamp(1.75rem, 3vw, 2.5rem);
    --home-stack-md: clamp(1.25rem, 2vw, 1.75rem);
    --home-stack-sm: 1rem;
    --home-gap: clamp(1rem, 1.5vw, 1.5rem);
    --home-gap-tight: 0.75rem;
    --home-card-pad: clamp(1.25rem, 2.5vw, 2rem);
    --home-container-x: clamp(1.25rem, 4vw, 2rem);
}

.page-home .container {
    padding-left: var(--home-container-x);
    padding-right: var(--home-container-x);
}

/* Section vertical rhythm */
.page-home section {
    padding-top: var(--home-section-y);
    padding-bottom: var(--home-section-y);
}

.page-home section.fullscreen-hero {
    padding-top: var(--header-height);
    padding-bottom: calc(var(--home-stack-lg) + 2rem);
}

.page-home .section-header {
    margin-bottom: var(--home-header-gap);
}

.page-home .section-label {
    margin-bottom: var(--home-stack-sm);
}

.page-home .section-title {
    margin-bottom: var(--home-stack-sm);
}

.page-home .section-title::after {
    margin-top: var(--home-gap-tight);
}

/* ═══ Hero ═══ */
.page-home .fullscreen-hero {
    isolation: isolate;
    min-height: 100vh;
    min-height: 100dvh;
}

.fullscreen-hero .hero-background {
    z-index: 0;
}

.fullscreen-hero .hero-overlay {
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(26, 26, 31, 0.35) 0%, rgba(26, 26, 31, 0.92) 100%),
        linear-gradient(135deg, rgba(26, 26, 31, 0.88) 0%, rgba(26, 26, 31, 0.55) 50%, rgba(26, 26, 31, 0.75) 100%),
        radial-gradient(ellipse at 20% 80%, rgba(184, 149, 107, 0.22) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 15%, rgba(184, 149, 107, 0.08) 0%, transparent 45%);
}

.hero-grain {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0.18;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 180px 180px;
    mix-blend-mode: overlay;
}

.page-home .hero-content {
    position: relative;
    z-index: 3;
    padding: var(--home-stack-lg) 0 var(--home-stack-md);
}

.page-home .hero-label {
    margin-bottom: var(--home-stack-sm);
}

.page-home .hero-title {
    font-size: var(--text-hero-lg);
    font-weight: var(--font-weight-display);
    line-height: var(--banner-title-leading);
    letter-spacing: var(--banner-title-tracking);
    margin-bottom: var(--banner-content-gap);
    color: white;
}

.page-home .hero-description {
    line-height: var(--banner-subtitle-leading);
    margin-bottom: var(--banner-content-gap);
}

.page-home .hero-stats {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: clamp(0.75rem, 2.5vw, 2.5rem);
    margin-top: var(--home-stack-sm);
    margin-bottom: var(--home-stack-md);
    width: 100%;
    max-width: 100%;
}

.page-home .hero-stat {
    flex: 1 1 0;
    min-width: 0;
}

.page-home .stat-number {
    margin-bottom: 0.4rem;
    white-space: nowrap;
}

.page-home .stat-text {
    white-space: nowrap;
    font-size: clamp(0.625rem, 1.15vw, 0.875rem);
    letter-spacing: 0.04em;
    line-height: 1.3;
}

.page-home .hero-actions {
    gap: var(--home-gap);
}

.page-home .hero-scroll {
    z-index: 3;
    bottom: var(--home-stack-md);
    cursor: pointer;
    transition: opacity var(--transition-normal), color var(--transition-normal);
}

.page-home .hero-scroll:hover {
    color: var(--color-accent-soft);
}

.hero-background {
    animation: heroKenBurns 22s ease-in-out infinite alternate;
    transform-origin: center center;
    will-change: transform;
}

@keyframes heroKenBurns {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

.hero-reveal.hero-reveal-line,
.hero-label.hero-reveal,
.hero-description.hero-reveal {
    display: block;
    opacity: 0;
    transform: translateY(24px);
    animation: heroFadeUp 0.85s var(--ease-out) forwards;
    animation-delay: calc(var(--reveal-i, 0) * 100ms + 200ms);
}

.hero-reveal-line {
    display: block;
}

.hero-stat.hero-reveal {
    opacity: 0;
    transform: translateY(24px);
    animation: heroFadeUp 0.85s var(--ease-out) forwards;
    animation-delay: calc(var(--reveal-i, 0) * 100ms + 650ms);
}

.hero-actions.hero-reveal {
    display: flex;
    opacity: 0;
    transform: translateY(24px);
    animation: heroFadeUp 0.85s var(--ease-out) forwards;
    animation-delay: 900ms;
}

@keyframes heroFadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-scroll-chevron {
    width: 24px;
    height: 24px;
    margin-top: var(--home-gap-tight);
    border-right: 2px solid rgba(255, 255, 255, 0.7);
    border-bottom: 2px solid rgba(255, 255, 255, 0.7);
    transform: rotate(45deg);
    animation: chevronBounce 2s ease-in-out infinite;
}

@keyframes chevronBounce {
    0%, 100% { transform: rotate(45deg) translate(0, 0); opacity: 0.6; }
    50% { transform: rotate(45deg) translate(4px, 4px); opacity: 1; }
}

.fullscreen-hero .scroll-line {
    display: none;
}

/* ═══ About showcase ═══ */
.page-home .about-showcase {
    background: var(--color-surface-warm);
}

.about-showcase__title {
    text-align: center;
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    color: var(--color-ink);
    margin-bottom: var(--home-header-gap);
}

.about-showcase__content {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    background: var(--color-surface);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
}

.about-showcase__text {
    flex: 1 1 340px;
    padding: var(--home-card-pad);
    display: flex;
    flex-direction: column;
    gap: var(--home-stack-sm);
}

.about-showcase__company-name {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    color: var(--color-ink);
    margin-bottom: 0.25rem;
}

.about-showcase__text p {
    font-size: var(--text-base);
    margin: 0;
    color: var(--color-muted);
    line-height: var(--leading-relaxed);
}

.about-showcase__features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--home-gap);
    margin: var(--home-stack-sm) 0;
}

.about-feature-card {
    padding: var(--home-gap) var(--home-stack-sm);
    background: var(--color-surface-warm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition:
        border-color var(--transition-normal),
        box-shadow var(--transition-normal),
        transform var(--transition-normal);
}

.about-feature-card:hover {
    border-color: var(--color-border-accent);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.about-feature-card__icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--color-accent-muted);
    color: var(--color-accent-hover);
    font-size: 0.95rem;
    margin-bottom: var(--home-gap-tight);
}

.about-feature-card h4 {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-ink);
    margin-bottom: 0.35rem;
}

.about-feature-card p {
    font-size: var(--text-sm);
    color: var(--color-muted);
    line-height: 1.5;
    margin: 0;
}

.about-showcase__features .about-feature-card:last-child {
    grid-column: 1 / -1;
}

.about-showcase__image {
    flex: 1 1 340px;
    position: relative;
    min-height: 22rem;
    overflow: hidden;
    border-radius: 0 var(--radius-2xl) var(--radius-2xl) 0;
}

.about-showcase__image-content {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-out);
}

.about-showcase__image:hover .about-showcase__image-content {
    transform: scale(1.05);
}

/* ═══ Timeline ═══ */
.page-home .timeline-container {
    padding-top: var(--home-gap-tight);
}

.page-home .timeline-item {
    margin-bottom: var(--home-stack-lg);
}

.page-home .timeline-item:last-child {
    margin-bottom: 0;
}

.page-home .timeline-content {
    margin-left: var(--home-stack-md);
    margin-right: var(--home-stack-md);
    padding: var(--home-card-pad);
}

.page-home .timeline-content h3 {
    margin-bottom: var(--home-gap-tight);
}

.page-home .timeline-content p {
    margin-bottom: var(--home-stack-sm);
}

.page-home .timeline-image {
    margin-top: var(--home-stack-sm);
}

.timeline-section .timeline-line {
    background: linear-gradient(
        180deg,
        transparent,
        var(--color-accent) 12%,
        var(--color-accent-soft) 88%,
        transparent
    );
    width: 3px;
    box-shadow: 0 0 12px var(--color-accent-glow);
}

.timeline-section .timeline-year {
    width: auto;
    min-width: 5.5rem;
    padding: 0.5rem 1.25rem;
    background: var(--color-surface);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-pill);
    box-shadow: 0 0 20px var(--color-accent-glow);
    font-size: var(--text-base);
    z-index: 2;
    position: relative;
}

.timeline-section .timeline-year::before {
    display: none;
}

.timeline-item.reveal.is-revealed,
.timeline-item.reveal.is-visible {
    opacity: 1;
    transform: scale(1);
}

/* ═══ Matrix ═══ */
.page-home .matrix-grid {
    gap: var(--home-stack-md);
}

.page-home .matrix-row {
    gap: var(--home-gap);
}

.page-home .matrix-header {
    padding: var(--home-card-pad);
}

.page-home .matrix-content {
    padding: var(--home-card-pad);
}

.page-home .matrix-content h4 {
    margin-bottom: 0.5rem;
}

.page-home .matrix-content p {
    margin-bottom: var(--home-stack-sm);
}

.page-home .matrix-specs {
    gap: var(--home-gap);
}

.matrix-section .matrix-item {
    position: relative;
    overflow: hidden;
}

.matrix-section .matrix-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent-soft), var(--color-accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-normal);
    z-index: 2;
}

.matrix-section .matrix-item:hover::before {
    transform: scaleX(1);
}

.matrix-section .matrix-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.matrix-section .matrix-image {
    aspect-ratio: 16 / 10;
    height: auto;
    min-height: unset;
    width: 100%;
}

/* ═══ Partnership showcase ═══ */
.page-home .showcase-container {
    margin-top: 0;
}

.page-home .showcase-tabs.showcase-tabs--pill {
    position: relative;
    display: flex;
    gap: var(--home-gap-tight);
    padding: var(--home-gap-tight);
    margin: var(--home-card-pad) var(--home-card-pad) 0;
    background: var(--color-surface-warm);
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
}

.page-home .showcase-tabs--pill .tab-btn {
    flex: 1;
    border: none;
    border-radius: var(--radius-pill);
    padding: 0.75rem 1rem;
    font-size: var(--text-sm);
    z-index: 1;
    background: transparent;
    white-space: nowrap;
}

.page-home .showcase-tabs--pill .tab-btn:hover {
    background: transparent;
}

.page-home .showcase-tabs--pill .tab-btn.active {
    color: var(--color-ink);
    background: transparent;
}

.page-home .showcase-tabs--pill .tab-btn.active::after {
    display: none;
}

.tab-pill-indicator {
    position: absolute;
    top: var(--home-gap-tight);
    left: 0;
    height: calc(100% - (var(--home-gap-tight) * 2));
    width: 0;
    background: var(--color-surface);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition:
        left 0.25s var(--ease-out),
        width 0.25s var(--ease-out);
    z-index: 0;
    pointer-events: none;
}

.page-home .showcase-content.showcase-content--fade {
    display: grid;
    padding: 0;
    min-height: 0;
}

.page-home .showcase-content--fade .tab-content {
    grid-area: 1 / 1;
    display: flex;
    gap: var(--home-stack-md);
    align-items: flex-start;
    padding: var(--home-card-pad);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease-out), visibility 0.2s;
    pointer-events: none;
    z-index: 0;
}

.page-home .showcase-content--fade .tab-content.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 1;
}

.page-home .tab-image {
    flex: 1;
    height: auto;
    min-height: 16rem;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-lg);
}

.page-home .tab-details h3 {
    margin-bottom: var(--home-stack-sm);
}

.page-home .tab-details p {
    margin-bottom: var(--home-stack-md);
}

.page-home .tab-features {
    gap: var(--home-gap);
    margin-bottom: var(--home-stack-md);
}

.page-home .feature {
    padding: var(--home-gap);
}

/* ═══ Pathways ═══ */
.page-home .pathways-container {
    gap: var(--home-gap);
}

.page-home .pathway-header {
    padding: var(--home-card-pad);
}

.page-home .pathway-content {
    padding: var(--home-card-pad);
}

.page-home .pathway-content h3 {
    margin-bottom: var(--home-gap-tight);
}

.page-home .pathway-content p {
    margin-bottom: var(--home-stack-sm);
}

.page-home .pathway-modules {
    gap: var(--home-gap-tight);
    margin-bottom: var(--home-stack-md);
}

.page-home .pathway-certification {
    padding-top: var(--home-stack-sm);
}

/* ═══ Research ═══ */
.page-home .research-container {
    gap: var(--home-stack-lg);
}

.page-home .research-stats {
    gap: var(--home-gap);
}

.page-home .research-stat {
    padding: var(--home-card-pad);
}

.page-home .research-highlights {
    gap: var(--home-gap);
}

.page-home .highlight-content {
    padding: var(--home-card-pad);
}

.page-home .highlight-meta {
    margin-bottom: var(--home-gap-tight);
}

.page-home .highlight-content h3 {
    margin-bottom: var(--home-gap-tight);
}

.page-home .highlight-content p {
    margin-bottom: var(--home-stack-sm);
}

/* ═══ Leadership ═══ */
.page-home .leadership-container {
    gap: var(--home-stack-lg);
}

.page-home .awards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--home-gap);
}

.page-home .award {
    padding: var(--home-card-pad);
}

.page-home .award-year {
    margin-bottom: var(--home-gap-tight);
}

.page-home .award-name {
    margin-bottom: 0.25rem;
}

.page-home .leadership-team {
    padding: var(--home-card-pad);
    margin-bottom: 0;
}

.page-home .leadership-team h3 {
    margin-bottom: var(--home-header-gap);
    padding-bottom: var(--home-stack-sm);
}

.page-home .team-grid {
    gap: var(--home-gap);
}

.page-home .member-info {
    padding: var(--home-card-pad);
}

.page-home .member-name {
    margin-bottom: 0.25rem;
}

.page-home .member-title {
    margin-bottom: var(--home-stack-sm);
}

.page-home .member-divider {
    margin-bottom: var(--home-stack-sm);
}

.page-home .member-bio {
    margin-bottom: var(--home-stack-sm);
}

.page-home .member-qualifications {
    gap: var(--home-gap-tight);
    padding-top: var(--home-stack-sm);
}

.leadership-section .member-photo-container {
    aspect-ratio: 4 / 5;
    height: auto;
    overflow: hidden;
}

.leadership-section .member-photo {
    width: 100%;
    height: 100%;
    min-height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    background-size: cover;
    background-position: center top;
    transition: transform 0.5s var(--ease-out);
}

.leadership-section .team-member:hover .member-photo {
    transform: scale(1.04);
}

.leadership-section .member-qualifications {
    transition: transform var(--transition-normal);
}

.leadership-section .team-member:hover .member-qualifications {
    transform: translateY(-4px);
}

/* ═══ News ═══ */
.page-home .news-container {
    gap: var(--home-stack-lg);
}

.page-home .news-featured {
    gap: 0;
}

.page-home .news-content {
    padding: var(--home-card-pad);
}

.page-home .news-category {
    margin-bottom: var(--home-gap-tight);
}

.page-home .news-date {
    margin-bottom: var(--home-stack-sm);
}

.page-home .news-content h3 {
    margin-bottom: var(--home-stack-sm);
}

.page-home .news-content p {
    margin-bottom: var(--home-stack-md);
}

.page-home .news-grid {
    gap: var(--home-gap);
}

.page-home .news-item-content {
    padding: var(--home-card-pad);
}

.page-home .news-item-category {
    margin-bottom: var(--home-gap-tight);
}

.page-home .news-item h4 {
    margin-bottom: var(--home-gap-tight);
}

/* ═══ Contact CTA ═══ */
.page-home .contact-cta {
    position: relative;
    background: var(--color-ink);
    border-top: none;
    border-image: none;
    margin-top: 0;
}

.page-home .contact-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--color-accent) 20%,
        var(--color-accent-soft) 50%,
        var(--color-accent) 80%,
        transparent
    );
}

.page-home .contact-cta .cta-content h2 {
    font-family: var(--font-display);
    margin-bottom: var(--home-stack-sm);
}

.page-home .contact-cta .cta-content p {
    margin-bottom: var(--home-stack-lg);
}

.page-home .contact-cta .cta-info {
    gap: var(--home-gap);
    margin-bottom: 0;
}

.page-home .contact-cta .info-item {
    gap: var(--home-stack-sm);
}

.cta-info-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: rgba(184, 149, 107, 0.12);
    border: 1px solid rgba(184, 149, 107, 0.3);
    color: var(--color-accent-soft);
}

.cta-info-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.contact-cta .info-icon {
    display: none;
}

/* ═══ Responsive ═══ */
@media (max-width: 1200px) {
    .page-home .awards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .page-home {
        --home-section-y: clamp(2.75rem, 5vw, 3.5rem);
        --home-header-gap: clamp(1.5rem, 3vw, 2rem);
    }

    .about-showcase__content {
        flex-direction: column;
    }

    .about-showcase__image {
        flex: none;
        width: 100%;
        border-radius: 0;
        order: -1;
        min-height: 16rem;
    }

    .about-showcase__features {
        grid-template-columns: 1fr;
    }

    .page-home .showcase-tabs.showcase-tabs--pill {
        flex-direction: column;
        border-radius: var(--radius-lg);
        margin: var(--home-stack-sm);
    }

    .page-home .showcase-tabs--pill .tab-btn {
        border-radius: var(--radius-md);
        white-space: normal;
        text-align: center;
    }

    .tab-pill-indicator {
        display: none;
    }

    .page-home .showcase-content.showcase-content--fade {
        display: block;
    }

    .page-home .showcase-content--fade .tab-content {
        grid-area: unset;
        display: none;
        flex-direction: column;
        padding: var(--home-stack-sm);
        gap: var(--home-stack-sm);
    }

    .page-home .showcase-content--fade .tab-content.active {
        display: flex;
    }

    .page-home .tab-image {
        width: 100%;
        min-height: 12rem;
        aspect-ratio: 16 / 10;
    }

    .timeline-section .timeline-year::before {
        display: block;
        position: absolute;
        left: -2.375rem;
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
    }

    .timeline-section .timeline-year {
        padding-left: 0;
        margin-left: 3.75rem;
    }

    .page-home .timeline-content {
        margin-left: 3.75rem;
        margin-right: 0;
    }

    .page-home .pathways-container {
        flex-direction: column;
    }

    .page-home .news-featured {
        flex-direction: column;
    }

    .page-home .news-image {
        min-height: 14rem;
    }
}

@media (max-width: 768px) {
    .page-home .hero-stats {
        display: flex;
        flex-wrap: nowrap;
        gap: clamp(0.5rem, 2vw, 1rem);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.25rem;
    }

    .page-home .hero-stats::-webkit-scrollbar {
        display: none;
    }

    .page-home .hero-stat {
        flex: 0 0 auto;
        min-width: 4.75rem;
    }

    .page-home .stat-text {
        font-size: 0.625rem;
        letter-spacing: 0.03em;
    }

    .page-home .awards-grid {
        grid-template-columns: 1fr;
    }

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

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

    .page-home .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-home .contact-cta .cta-info {
        grid-template-columns: 1fr;
        gap: var(--home-stack-md);
    }

    .page-home .contact-cta .info-item {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .page-home .news-grid {
        grid-template-columns: 1fr;
    }

    .page-home .research-stats {
        grid-template-columns: 1fr;
    }

    .page-home .matrix-specs {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .page-home .matrix-specs span {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-background {
        animation: none;
    }

    .hero-reveal-line,
    .hero-label.hero-reveal,
    .hero-description.hero-reveal,
    .hero-stat.hero-reveal,
    .hero-actions.hero-reveal,
    .timeline-item.reveal {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .hero-scroll-chevron {
        animation: none;
    }

    .leadership-section .team-member:hover .member-photo {
        transform: none;
    }
}
