/* ==========================================================================
   Wilber-Combs Matrix Explorer — Styles
   ========================================================================== */

/* ---- Root container ---- */

.wcm-explorer {
    background: #faf8f4;
    border-radius: 12px;
    padding: 32px;
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #2c2c2c;
    line-height: 1.55;
    max-width: 960px;
    margin: 32px auto;
}

/* ---- Override primer heading styles ---- */

.wcm-explorer.wcm-explorer h2,
.wcm-explorer.wcm-explorer h3,
.wcm-explorer.wcm-explorer h4 {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    margin: 0;
    line-height: 1.3;
}

/* ==========================================================================
   Header
   ========================================================================== */

.wcm-header {
    margin-bottom: 24px;
}

.wcm-header__title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 6px;
}

.wcm-header__subtitle {
    font-size: 14px;
    color: #666;
    max-width: 700px;
    margin: 0 0 24px;
    line-height: 1.55;
}

/* ==========================================================================
   Grid — Scrollable Wrapper
   ========================================================================== */

.wcm-grid-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: #d0cdc8 transparent;
}

.wcm-grid-wrap::-webkit-scrollbar {
    height: 4px;
}

.wcm-grid-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.wcm-grid-wrap::-webkit-scrollbar-thumb {
    background: #d0cdc8;
    border-radius: 2px;
}

/* ==========================================================================
   Grid — CSS Grid Layout
   ========================================================================== */

.wcm-grid {
    display: grid;
    grid-template-columns: 90px repeat(5, 1fr);
    grid-template-rows: auto repeat(7, auto);
    gap: 3px;
    min-width: 650px;
}

/* ---- Corner cell (empty, top-left) ---- */

.wcm-grid__corner {
    /* Empty — just occupies grid space */
}

/* ==========================================================================
   Column Headers
   ========================================================================== */

.wcm-grid__col-header {
    background: #2c2c2c;
    color: #fff;
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
    border-radius: 6px 6px 0 0;
    position: relative;
}

.wcm-grid__col-subtitle {
    display: block;
    font-size: 10px;
    font-weight: 400;
    opacity: 0.7;
    text-transform: none;
    letter-spacing: normal;
    margin-top: 2px;
}

/* ---- Info icon button ---- */

.wcm-grid__col-note {
    position: absolute;
    top: 4px;
    right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    font-size: 10px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 150ms, color 150ms;
}

.wcm-grid__col-note:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* ==========================================================================
   Row Headers
   ========================================================================== */

.wcm-grid__row-header {
    background: var(--wcm-stage-color);
    color: #fff;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 6px 0 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: horizontal-tb;
    text-align: center;
}

/* ==========================================================================
   Grid Cells
   ========================================================================== */

.wcm-cell {
    background: #fff;
    border: 1px solid #e8e5e0;
    padding: 10px 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    color: #444;
    text-align: center;
    transition: all 150ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcm-cell:hover {
    background: #fcfaf6;
    border-color: #d0cdc8;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.wcm-cell--active {
    border-color: var(--wcm-stage-color);
    box-shadow: 0 0 0 2px var(--wcm-stage-color);
    background: color-mix(in srgb, var(--wcm-stage-color) 8%, #fff);
}

.wcm-cell__label {
    font-weight: 500;
    line-height: 1.35;
}

/* ==========================================================================
   Perspective Toggle
   ========================================================================== */

.wcm-perspective {
    display: flex;
    justify-content: center;
    gap: 0;
    border: 1px solid #d0cdc8;
    border-radius: 8px;
    overflow: hidden;
    margin: 16px auto 20px;
    width: fit-content;
}

.wcm-perspective-btn {
    padding: 10px 18px;
    background: #fff;
    border: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 150ms;
}

.wcm-perspective-btn + .wcm-perspective-btn {
    border-left: 1px solid #d0cdc8;
}

.wcm-perspective-btn:hover {
    background: #f5f3ef;
}

.wcm-perspective-btn--active {
    background: #2c2c2c;
    color: #fff;
}

.wcm-perspective-btn--active:hover {
    background: #444;
}

/* ==========================================================================
   Detail Panel
   ========================================================================== */

.wcm-detail {
    margin-top: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ---- Detail Header ---- */

.wcm-detail__header {
    background: var(--wcm-stage-color);
    color: #fff;
    padding: 20px 24px;
}

.wcm-detail__stage-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
    margin-bottom: 6px;
}

.wcm-detail__title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.wcm-detail__subtitle {
    font-size: 13px;
    opacity: 0.85;
    font-style: italic;
    margin: 0;
}

/* ---- Detail Body ---- */

.wcm-detail__body {
    padding: 24px;
    background: #fff;
}

/* ---- Experience Section ---- */

.wcm-detail__section {
    margin-bottom: 24px;
}

.wcm-detail__section-title {
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--wcm-stage-color);
    margin-bottom: 10px;
    line-height: 1.3;
}

.wcm-detail__text {
    font-size: 14px;
    line-height: 1.65;
    color: #333;
    margin: 0 0 24px;
}

.wcm-detail__section .wcm-detail__text:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Insight / Shadow Cards
   ========================================================================== */

.wcm-detail__cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.wcm-detail__card {
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e8e5e0;
}

.wcm-detail__card--insight {
    background: #f8faf8;
    border-left: 3px solid #3a7d44;
}

.wcm-detail__card--shadow {
    background: #faf8f6;
    border-left: 3px solid #c9a96e;
}

.wcm-detail__card-title {
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    line-height: 1.3;
}

.wcm-detail__card--insight .wcm-detail__card-title {
    color: #3a7d44;
}

.wcm-detail__card--shadow .wcm-detail__card-title {
    color: #c9a96e;
}

.wcm-detail__card .wcm-detail__text {
    font-size: 13px;
    line-height: 1.55;
    color: #444;
    margin: 0;
}

/* ==========================================================================
   Traditions / Exemplars Footer
   ========================================================================== */

.wcm-detail__footer {
    border-top: 1px solid #e8e5e0;
    padding-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.wcm-detail__footer .wcm-detail__section-title {
    color: #888;
}

.wcm-detail__traditions,
.wcm-detail__exemplars {
    /* Structural containers — no extra styling needed */
}

.wcm-detail__footer .wcm-detail__text {
    font-size: 13px;
    line-height: 1.55;
    color: #555;
    margin: 0;
}

/* Single-column fallback when only traditions present */
.wcm-detail__footer .wcm-detail__traditions:only-child {
    grid-column: 1 / -1;
}

/* ==========================================================================
   Prompt (shown when no cell is selected)
   ========================================================================== */

.wcm-prompt {
    text-align: center;
    padding: 48px 24px;
    color: #888;
    font-style: italic;
    font-size: 14px;
}

/* ==========================================================================
   Tooltip (column info popover)
   ========================================================================== */

.wcm-tooltip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    margin-top: 8px;
    background: #2c2c2c;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    width: 280px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 100;
    pointer-events: none;
    text-transform: none;
    font-weight: 400;
    letter-spacing: normal;
    text-align: left;
}

/* ---- Tooltip arrow (pointing up) ---- */

.wcm-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #2c2c2c;
}

/* ==========================================================================
   Orientation Note (Witnessing & Nondual columns)
   ========================================================================== */

.wcm-orientation-note {
    background: #f5f3ef;
    border-left: 2px solid var(--wcm-stage-color, #c9a96e);
    border-radius: 0 6px 6px 0;
    padding: 14px 18px 14px 16px;
    margin: 16px auto 20px;
    max-width: 700px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.wcm-orientation-note__icon {
    flex-shrink: 0;
    font-size: 14px;
    color: var(--wcm-stage-color, #c9a96e);
    line-height: 1.55;
}

.wcm-orientation-note p {
    font-size: 13px;
    font-style: italic;
    color: #555;
    line-height: 1.55;
    margin: 0;
}

/* ==========================================================================
   3rd-Person Dual Experience Section
   ========================================================================== */

.wcm-experience-dual {
    margin-bottom: 24px;
}

.wcm-experience-dual__label {
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    font-variant: small-caps;
    color: #c9a96e;
    margin-bottom: 8px;
}

.wcm-experience-dual__label--study {
    color: #888;
}

.wcm-experience-dual__divider {
    border: none;
    border-top: 1px solid #e8e5e0;
    margin: 16px 0;
}

.wcm-experience-dual .wcm-detail__text {
    font-size: 14px;
    line-height: 1.65;
    color: #333;
}

.wcm-experience-dual__label--study + .wcm-detail__text {
    color: #555;
}

/* ==========================================================================
   Witnessing Panel — Three Streams
   ========================================================================== */

.wcm-streams {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.wcm-stream {
    background: #faf8f4;
    border: 1px solid #e8e5e0;
    border-radius: 6px;
    padding: 14px;
}

.wcm-stream__title {
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--wcm-stage-color, #666);
    margin: 0 0 8px;
    line-height: 1.3;
}

.wcm-stream__text {
    font-size: 13px;
    line-height: 1.55;
    color: #444;
    margin: 0;
}

/* ==========================================================================
   Witnessing Panel — Unchanging Ground
   ========================================================================== */

.wcm-unchanging-ground {
    border-top: 1px solid #e8e5e0;
    padding-top: 16px;
    margin-bottom: 24px;
}

.wcm-unchanging-ground__title {
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #888;
    margin: 0 0 8px;
    line-height: 1.3;
}

.wcm-unchanging-ground__text {
    font-size: 13px;
    font-style: italic;
    line-height: 1.55;
    color: #666;
    margin: 0;
}

/* ==========================================================================
   Nondual Panel — Horizon of Form
   ========================================================================== */

.wcm-horizon {
    background: color-mix(in srgb, var(--wcm-stage-color, #c9a96e) 6%, #fff);
    border: 1px solid color-mix(in srgb, var(--wcm-stage-color, #c9a96e) 20%, transparent);
    border-left: 3px solid var(--wcm-stage-color, #c9a96e);
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 24px;
}

.wcm-horizon__label {
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wcm-stage-color, #c9a96e);
    margin-bottom: 8px;
    font-weight: 600;
}

.wcm-horizon__text {
    font-size: 14px;
    line-height: 1.65;
    color: #333;
    margin: 0 0 12px;
}

.wcm-horizon__note {
    font-size: 12px;
    font-style: italic;
    color: #888;
    line-height: 1.5;
    margin: 0;
}

/* ==========================================================================
   Nondual Panel — Three Accents
   ========================================================================== */

.wcm-accents {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.wcm-accent {
    background: #faf8f4;
    border: 1px solid #e8e5e0;
    border-radius: 6px;
    padding: 14px;
}

.wcm-accent__title {
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--wcm-stage-color, #666);
    margin: 0 0 8px;
    line-height: 1.3;
}

.wcm-accent__text {
    font-size: 13px;
    line-height: 1.55;
    color: #444;
    margin: 0;
}

/* ==========================================================================
   Fade Transition
   ========================================================================== */

.wcm-detail,
.wcm-prompt,
.wcm-perspective,
.wcm-orientation-note {
    opacity: 1;
    transition: opacity 200ms ease;
}

.wcm-fading {
    opacity: 0;
}

/* ==========================================================================
   Full-Bleed Inside Primer Sections (desktop)
   ========================================================================== */

.primer-section__content .wcm-explorer {
    margin-left: -40px;
    margin-right: -40px;
    max-width: none;
    border-radius: 0;
}

/* ==========================================================================
   Responsive — Tablet (max-width: 768px)
   ========================================================================== */

@media (max-width: 768px) {
    .wcm-explorer {
        padding: 20px 16px;
        border-radius: 8px;
        margin: 20px auto;
    }

    .wcm-perspective-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .wcm-detail__header {
        padding: 16px 20px;
    }

    .wcm-detail__body {
        padding: 16px 20px;
    }

    .wcm-detail__cards {
        grid-template-columns: 1fr;
    }

    .wcm-detail__footer {
        grid-template-columns: 1fr;
    }

    .wcm-streams,
    .wcm-accents {
        grid-template-columns: 1fr;
    }

    .wcm-orientation-note {
        margin: 12px auto 16px;
    }
}

/* ---- Full-bleed inside primer sections on mobile ---- */

@media (max-width: 768px) {
    .primer-section__content .wcm-explorer {
        margin-left: -16px;
        margin-right: -16px;
        max-width: none;
        width: calc(100% + 32px);
        border-radius: 0;
    }
}

/* ==========================================================================
   Responsive — Small screens (max-width: 600px)
   ========================================================================== */

@media (max-width: 600px) {
    .wcm-explorer {
        padding: 16px 12px;
    }

    .wcm-grid__row-header {
        font-size: 10px;
        padding: 6px 8px;
    }

    .wcm-cell {
        font-size: 10px;
        padding: 8px 6px;
    }

    .wcm-detail__title {
        font-size: 18px;
    }

    .wcm-perspective {
        flex-wrap: wrap;
        border-radius: 8px;
    }

    .wcm-perspective-btn {
        padding: 8px 12px;
        font-size: 11px;
        flex: 1 1 auto;
        text-align: center;
    }

    .wcm-perspective-btn + .wcm-perspective-btn {
        border-left: 1px solid #d0cdc8;
    }

    .wcm-stream,
    .wcm-accent {
        padding: 12px;
    }

    .wcm-horizon {
        padding: 12px 14px;
    }
}
