/* Ecosystem — Metro tiles + slide-over detail (actions → image → copy) */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: clip;
}

html.ecosystem-page-doc,
html.ecosystem-page-doc body {
    background-color: #050505;
}

body.ecosystem-page-body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #050505;
    color: #f5f5f5;
    padding: 0;
    min-height: 100vh;
    overflow-x: clip;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.ecosystem-page-body::before {
    content: '';
    position: fixed;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    width: min(140vw, 1600px);
    height: 320px;
    background: radial-gradient(
        ellipse 78% 92% at 50% 0%,
        rgba(99, 102, 241, 0.26) 0%,
        rgba(99, 102, 241, 0.1) 38%,
        transparent 72%
    );
    pointer-events: none;
    z-index: 0;
}

body.ecosystem-page-body header.eco-hero {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: clamp(24px, 4vw, 36px) 0 clamp(16px, 2.5vw, 24px) !important;
    margin: 0 0 clamp(20px, 3vw, 28px) !important;
    box-shadow: none !important;
}

body.ecosystem-page-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 0.92em;
    color: rgba(199, 210, 254, 0.95);
}

body.ecosystem-page-body .eco-page {
    position: relative;
    z-index: 1;
    max-width: min(1120px, 100%);
    margin: 0 auto;
    padding: 0 clamp(16px, 3vw, 32px) clamp(40px, 5vw, 56px);
}

body.ecosystem-page-body #headerContainer {
    width: 100%;
}

.eco-hero {
    position: relative;
    z-index: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.eco-hero-title {
    margin: 0 0 8px;
    font-size: clamp(28px, 5vw, 40px);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
    line-height: 1.1;
}

.eco-hero-lead {
    margin: 0;
    max-width: 40rem;
    font-size: clamp(15px, 2.2vw, 17px);
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.52);
}

/* —— Stage: grid + sliding detail —— */
.eco-stage {
    position: relative;
    min-height: min(72vh, 720px);
    overflow: hidden;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.eco-stage--detail-open {
    min-height: 0;
    height: auto;
    overflow: visible;
}

.eco-view {
    transition:
        transform 0.42s cubic-bezier(0.32, 0.72, 0, 1),
        opacity 0.35s ease;
    will-change: transform, opacity;
}

.eco-view--grid {
    position: relative;
    z-index: 1;
    padding: clamp(16px, 2.5vw, 24px);
    transform: translateX(0);
    opacity: 1;
}

.eco-stage--detail-open .eco-view--grid {
    position: absolute;
    inset: 0;
    z-index: 1;
    transform: translateX(-18%);
    opacity: 0.35;
    pointer-events: none;
}

.eco-group-label {
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
}

.eco-group-label:not(:first-child) {
    margin-top: 22px;
}

/* Metro tile grid */
.eco-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 4px;
}

@media (min-width: 720px) {
    .eco-tile-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

body.ecosystem-page-body button.eco-tile {
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    width: 100%;
    margin: 0;
}

.eco-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 148px;
    padding: 0;
    border: none;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    color: #fff;
    background: var(--eco-accent, #4f46e5);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        filter 0.18s ease;
}

.eco-tile--wide {
    grid-column: span 2;
}

@media (max-width: 719px) {
    .eco-tile--wide {
        grid-column: span 1;
    }
}

.eco-tile:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    filter: brightness(1.06);
    z-index: 1;
}

.eco-tile:focus {
    outline: none;
}

.eco-tile:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.eco-tile-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-color: var(--eco-accent, #4f46e5);
    transform: scale(1.02);
    transition: transform 0.35s ease;
}

.eco-tile:hover .eco-tile-bg {
    transform: scale(1.08);
}

.eco-tile-bg--empty {
    background: linear-gradient(145deg, var(--eco-accent, #52525b) 0%, #27272a 100%);
}

.eco-tile-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.88) 0%,
        rgba(0, 0, 0, 0.45) 45%,
        rgba(0, 0, 0, 0.15) 100%
    );
    pointer-events: none;
}

.eco-tile-content {
    position: relative;
    z-index: 1;
    padding: 14px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.eco-tile-name {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

.eco-tile-desc {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.82);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.eco-tile-badge {
    align-self: flex-start;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.eco-tile--muted {
    opacity: 0.92;
}

/* Detail slide-over — height fits header + image + copy when open */
.eco-view--detail {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    max-height: 100%;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    background: rgba(12, 12, 16, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -12px 0 48px rgba(0, 0, 0, 0.5);
}

.eco-stage--detail-open .eco-view--detail {
    position: relative;
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    max-height: min(92vh, 960px);
    overflow: hidden;
}

.eco-detail-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.eco-detail-header-start {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1 1 auto;
}

.eco-detail-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 1 auto;
    margin-left: auto;
}

.eco-detail-actions:empty {
    display: none;
}

.eco-detail-actions .eco-btn {
    padding: 9px 16px;
    font-size: 13px;
    white-space: nowrap;
}

@media (max-width: 560px) {
    .eco-detail-header {
        flex-direction: column;
        align-items: stretch;
    }

    .eco-detail-actions {
        margin-left: 0;
        justify-content: flex-start;
        padding-top: 4px;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }
}

body.ecosystem-page-body button.eco-detail-back {
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
}

.eco-detail-back {
    flex-shrink: 0;
    padding: 9px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.92);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.eco-detail-back:hover {
    background: rgba(129, 140, 248, 0.15);
    border-color: rgba(129, 140, 248, 0.45);
    transform: translateY(-1px);
}

.eco-detail-title {
    margin: 0;
    font-size: clamp(18px, 3vw, 24px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eco-detail-body {
    flex: 0 1 auto;
    overflow-y: visible;
    padding: clamp(18px, 3vw, 28px);
    -webkit-overflow-scrolling: touch;
}

.eco-stage--detail-open .eco-detail-body {
    overflow-y: auto;
    min-height: 0;
}

/* Panel layout inside detail (cloned from store) */
.eco-detail-body .eco-panel-figure {
    margin: 0 0 20px;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.25);
    line-height: 0;
}

.eco-detail-body .eco-panel-img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.eco-detail-body .eco-panel-body {
    flex: 0 0 auto;
}

.eco-detail-body .eco-panel-body p {
    margin: 0 0 14px;
    font-size: 15px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.72);
}

.eco-detail-body .eco-panel-body p:last-child {
    margin-bottom: 0;
}

.eco-detail-body .eco-caption {
    color: rgba(255, 255, 255, 0.45) !important;
    font-size: 14px !important;
}

.eco-detail-body .eco-panel-body ul {
    margin: 0 0 14px;
    padding-left: 1.35em;
    color: rgba(255, 255, 255, 0.68);
    font-size: 15px;
}

.eco-detail-body .eco-panel-body ul li {
    margin-bottom: 8px;
    line-height: 1.55;
}

.eco-detail-body .eco-panel-body a:not(.eco-btn) {
    color: #a5b4fc;
    text-decoration: none;
}

.eco-detail-body .eco-panel-body a:not(.eco-btn):hover {
    color: #c7d2fe;
    text-decoration: underline;
}

.eco-detail-body .eco-panel-lead {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px 18px;
    margin-bottom: 14px;
}

.eco-detail-body .eco-panel-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.eco-detail-body .eco-panel-lead p {
    margin: 0;
    flex: 1 1 200px;
}

.eco-coming-soon {
    color: rgba(255, 255, 255, 0.42);
    font-style: italic;
    font-size: 15px;
}

/* Modern action buttons */
body.ecosystem-page-body .eco-btn {
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
}

.eco-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.eco-btn--primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    border-color: rgba(129, 140, 248, 0.35);
    box-shadow: 0 2px 14px rgba(99, 102, 241, 0.38);
}

.eco-btn--primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45);
}

.eco-btn--secondary {
    background: rgba(255, 255, 255, 0.06);
    color: #e0e7ff;
    border-color: rgba(129, 140, 248, 0.45);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.eco-btn--secondary:hover {
    background: rgba(129, 140, 248, 0.18);
    border-color: rgba(167, 139, 250, 0.55);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.eco-page-footer {
    position: relative;
    z-index: 1;
    margin-top: clamp(32px, 4vw, 48px);
    padding: 20px 0 8px;
    text-align: center;
    color: rgba(255, 255, 255, 0.38);
    font-size: 13px;
    line-height: 1.65;
}

.eco-page-footer a {
    color: #a5b4fc;
    text-decoration: none;
}

.eco-page-footer a:hover {
    text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
    .eco-view,
    .eco-tile,
    .eco-tile-bg,
    .eco-btn,
    .eco-detail-back {
        transition: none;
    }

    .eco-stage--detail-open .eco-view--grid {
        transform: none;
        opacity: 0.2;
    }

    .eco-stage--detail-open .eco-view--detail {
        transform: none;
    }

    .eco-btn--primary:hover,
    .eco-btn--secondary:hover,
    .eco-detail-back:hover {
        transform: none;
    }
}
