/* =====================================================
   HONESTLY, E — Quilt Panel (Ezra Witness Companion)
   Ezra's right-column shell — replaces timeline when Ezra
   is the active companion. Mirrors the Cookbook (Ember)
   pattern: an always-present aside showing the wake of
   Ezra's witness stewardship — patches the subscriber has
   captured. Click a square → lightbox showing the full
   content (per Desta's spec: simple lightbox out, no
   over-engineering).

   Grid layout v1; constellation visual (clusters floating
   as visual islands, SVG threads) deferred to v2 once the
   surface is in subscribers' hands and the clustering pattern
   proves out.

   Per companion-surface-awareness principle: piece 1 of 4
   (UI). Tools / constitution / memoryContext land in
   subsequent Vapi-side work.
   ===================================================== */

.quilt-panel {
    display: none;
    width: var(--timeline-width, 280px);
    flex-shrink: 0;
    background: var(--bg-card);
    border-left: 1px solid var(--border-light);
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    position: sticky;
    top: var(--header-height);
    overflow: hidden;
}

.ezra-active .quilt-panel {
    display: flex;
}

.ezra-active .timeline-sidebar {
    display: none;
}

.ezra-active .timeline-fab {
    display: none !important;
}

/* -----------------------------------------------------
   Header
   ----------------------------------------------------- */
.quilt-panel-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quilt-panel-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--text-primary);
    margin: 0;
}

.quilt-panel-add-btn {
    background: none;
    border: 1px solid var(--ezra-color, #9C8F73);
    color: var(--ezra-color, #9C8F73);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quilt-panel-add-btn:hover {
    background: var(--ezra-color, #9C8F73);
    color: white;
}

/* -----------------------------------------------------
   Scroll area + grid
   ----------------------------------------------------- */
.quilt-panel-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem;
}

.quilt-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.quilt-panel-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.quilt-panel-empty-icon {
    font-size: 1.6rem;
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

.quilt-panel-empty-title {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.quilt-panel-empty-text {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.quilt-panel-empty-cta {
    margin-top: 0.85rem;
    background: var(--ezra-color, #9C8F73);
    color: white;
    border: none;
    padding: 0.45rem 0.95rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quilt-panel-empty-cta:hover {
    background: #847862;
}

/* -----------------------------------------------------
   Square cards — small tiles in the grid
   ----------------------------------------------------- */
.quilt-panel-square {
    aspect-ratio: 1;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    position: relative;
}

.quilt-panel-square:hover {
    border-color: var(--ezra-color, #9C8F73);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.quilt-panel-square-image {
    width: 100%;
    height: 60%;
    object-fit: cover;
}

.quilt-panel-square-no-image {
    flex: 1;
    background: linear-gradient(135deg, rgba(156, 143, 115, 0.08), rgba(156, 143, 115, 0.02));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.4rem;
    text-align: center;
    line-height: 1.3;
}

.quilt-panel-square-meta {
    padding: 0.35rem 0.5rem;
    flex-shrink: 0;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
}

.quilt-panel-square-title {
    font-family: var(--font-serif);
    font-size: 0.78rem;
    color: var(--text-primary);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quilt-panel-square-sense {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--font-sans);
}

/* Tiny sense icon at top-right of each square */
.quilt-panel-square-sense-badge {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* -----------------------------------------------------
   Footer compose CTA
   ----------------------------------------------------- */
.quilt-panel-footer {
    padding: 0.85rem;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.quilt-panel-compose-btn {
    width: 100%;
    background: var(--bg-card);
    color: var(--ezra-color, #9C8F73);
    border: 1px solid var(--ezra-color, #9C8F73);
    padding: 0.55rem 0.95rem;
    font-family: var(--font-serif);
    font-size: 0.88rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quilt-panel-compose-btn:hover {
    background: var(--ezra-color, #9C8F73);
    color: white;
}

.quilt-panel-compose-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* -----------------------------------------------------
   Quilt Square Detail Lightbox — what subscribers see
   when they click a square in the panel.
   ----------------------------------------------------- */
.quilt-square-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.quilt-square-lightbox.active {
    display: flex;
}

.quilt-square-lightbox-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.quilt-square-lightbox-close {
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 2;
}

.quilt-square-lightbox-close:hover {
    color: var(--text-primary);
}

.quilt-square-lightbox-image {
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.quilt-square-lightbox-body {
    padding: 1.5rem 1.75rem 1.75rem;
}

.quilt-square-lightbox-sense {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ezra-color, #9C8F73);
    font-family: var(--font-sans);
    margin-bottom: 0.4rem;
}

.quilt-square-lightbox-title {
    font-family: var(--font-serif);
    font-size: 1.45rem;
    color: var(--text-primary);
    margin: 0 0 0.85rem;
    line-height: 1.25;
}

.quilt-square-lightbox-content {
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.quilt-square-lightbox-meta {
    margin-top: 1.25rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
}

/* -----------------------------------------------------
   Responsive — collapse panel on mobile (Ezra falls back
   to timeline-style modal / FAB pattern)
   ----------------------------------------------------- */
@media (max-width: 1024px) {
    .ezra-active .quilt-panel {
        display: none;
    }
    .ezra-active .timeline-sidebar {
        display: flex;
    }
}
