/* ============================================================
   ChETL Tier-3 LEFT-context shell (CHETL-0042)
   ============================================================
   One shared shell for every Topic Workspace. Presentation mode comes from
   the container width, written by assets/js/tier3_shell.js as data attributes
   on .chetl-t3 (data-t3-mode: docked | overlay; data-t3-open). No
   media queries: the shell adapts to its own width, not the device.
   Must load AFTER components.css.
   ============================================================ */

.chetl-t3 { width: 100%; min-width: 0; }

.chetl-t3-bar {
    display: flex;
    align-items: center;
    margin: 0 0 8px;
}

.chetl-t3-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-3);
    background: var(--surface-elevated);
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}
.chetl-t3-trigger:hover { background: var(--accent-soft); }
.chetl-t3-trigger[aria-expanded="true"] { border-color: var(--accent-primary); }
.chetl-t3-trigger .q-icon { font-size: 18px; color: var(--accent-primary); }
.chetl-t3-trigger:focus-visible,
.chetl-t3-close:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.chetl-t3-chevron { transition: transform 0.15s ease; }
.chetl-t3[data-t3-mode="docked"][data-t3-open="false"] .chetl-t3-chevron { transform: rotate(180deg); }
.chetl-t3[data-t3-mode="overlay"] .chetl-t3-chevron { display: none; }

.chetl-t3-left {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    min-width: 0;
}
.chetl-t3-left-head,
.chetl-t3-backdrop { display: none; }
.chetl-t3-right:focus { outline: none; }

.chetl-t3[data-t3-mode="docked"][data-t3-open="false"] .chetl-t3-left { display: none; }
.chetl-t3[data-t3-mode="docked"] .chetl-t3-status { display: none !important; }

/* ---- Overlay mode: modal left side-sheet ---- */
.chetl-t3[data-t3-mode="overlay"] .chetl-t3-trigger { min-height: 44px; padding: 6px 14px; }

.chetl-t3[data-t3-mode="overlay"] .chetl-t3-left {
    position: fixed;
    top: var(--chetl-appheader-h, 0px);   /* the shared app header stays uncovered */
    bottom: 0;
    left: 0;
    z-index: 3000;
    width: min(26rem, 100%);
    height: calc(100dvh - var(--chetl-appheader-h, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface-base);
    border-right: 1px solid var(--border-strong);
    box-shadow: var(--elev-pop);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
}
.chetl-t3[data-t3-mode="overlay"][data-t3-open="true"] .chetl-t3-left {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease, visibility 0s;
}

.chetl-t3[data-t3-mode="overlay"] .chetl-t3-left-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 4px 8px 4px var(--space-lg);
    background: var(--surface-base);
    border-bottom: 1px solid var(--border-muted);
}
.chetl-t3-title { font-size: var(--font-body); font-weight: 700; color: var(--text-primary); }
.chetl-t3-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border: none;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
}
.chetl-t3-close:hover { background: var(--accent-soft); }

.chetl-t3[data-t3-mode="overlay"] .chetl-t3-status {
    margin: var(--space-md) var(--space-lg) 0;
    padding: var(--space-sm) var(--space-md);
    border-left: 4px solid var(--error);
    background: color-mix(in srgb, var(--error) 8%, var(--surface-elevated));
    color: var(--error);
}

.chetl-t3[data-t3-mode="overlay"] .chetl-t3-left-body {
    width: 100%;
    padding: var(--space-md) var(--space-lg) var(--space-xl);
}
/* The sheet width differs from the docked w-80 column, so the
   Configuration card and Info container follow it. */
.chetl-t3[data-t3-mode="overlay"] .chetl-t3-left-body > *,
.chetl-t3[data-t3-mode="overlay"] .chetl-t3-left .w-80 { width: 100%; max-width: 100%; }
/* The shared 900 px viewport rule stacks label over field; the sheet keeps the
   docked 45/55 grid because its own width, not the viewport, is what matters. */
.chetl-t3[data-t3-mode="overlay"] .chetl-t3-left .config-row { grid-template-columns: 45% 55%; }

.chetl-t3[data-t3-mode="overlay"] .chetl-t3-backdrop {
    display: block;
    position: fixed;
    inset: var(--chetl-appheader-h, 0px) 0 0 0;
    z-index: 2999;
    background: rgba(30, 42, 56, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}
.chetl-t3[data-t3-mode="overlay"][data-t3-open="true"] .chetl-t3-backdrop {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease, visibility 0s;
}

@media (prefers-reduced-motion: reduce) {
    .chetl-t3-left,
    .chetl-t3-backdrop,
    .chetl-t3-chevron { transition: none !important; }
}
