/*
 * Shuntailor Glossary — desktop slide-in panel
 *
 * Layout:
 *   - Panel: fixed to the left edge, width 380px, slides in from translateX(-100%).
 *   - Overlay: full-screen transparent capture behind the panel.
 *   - Main content: adds margin-left: 380px when body.tg-panel-open.
 *
 * Mobile:
 *   - Below the breakpoint, the panel is not used at all (JS skips open).
 *   - CSS defensively hides panel below 1024px as well.
 */

/* Inline link marker — thick underline + subtle highlight to signal it's clickable */
.tg-inline-link {
    background-image: linear-gradient(transparent 62%, rgba(111, 139, 168, 0.22) 62%, rgba(111, 139, 168, 0.22) 100%);
    border-bottom: 2px solid rgba(111, 139, 168, 0.85);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    padding: 0 3px;
    border-radius: 2px;
    cursor: pointer;
}
.tg-inline-link:hover {
    border-bottom-color: #3a5773;
    background-color: rgba(234, 238, 243, 0.9);
    background-image: none;
    color: inherit;
}

/* Overlay kept for legacy compat but never interactive or visible. */
.tg-panel-overlay {
    display: none !important;
}

/* Panel — LEFT SIDEBAR WIDGET (flex item of .site-content).
   When closed: display:none so layout collapses back to 2-col.
   When open: becomes a flex-basis:380px sibling before main content.
   GeneratePress .site-content{display:flex} handles the rest — right sidebar
   stays fixed width, main content flex:1 shrinks proportionally. */
.tg-panel {
    order: -1;              /* put before main content */
    flex: 0 0 380px;
    max-width: 380px;
    align-self: flex-start;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    margin: 0 20px 0 0;
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(26, 26, 26, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    display: none;           /* hidden until open */
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Yu Gothic Medium", sans-serif;
    color: #1a1a1a;
    overflow: hidden;
    z-index: 1;
}
body.tg-panel-open .tg-panel {
    display: flex;
}

/* Narrow viewports — shrink panel basis so content doesn't get squeezed.
   GP right sidebar is ~300px; reserve enough for content at 1200px viewport. */
@media (max-width: 1400px) {
    .tg-panel { flex: 0 0 340px; max-width: 340px; }
}
@media (max-width: 1200px) {
    .tg-panel { flex: 0 0 300px; max-width: 300px; }
}

/* Widget-style branding bar at top (localized via JS) */
.tg-panel-brand {
    flex: 0 0 auto;
    padding: 10px 18px;
    background: #1a1a1a;
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: none;
    border-radius: 11px 11px 0 0;
}

.tg-panel-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid #eee;
    background: #F4F1EA;
}
.tg-panel-kicker {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #B8A68A;
}
.tg-panel-close {
    background: transparent;
    border: none;
    font-size: 26px;
    line-height: 1;
    width: 30px;
    height: 30px;
    cursor: pointer;
    color: #666;
    padding: 0;
    border-radius: 6px;
    transition: background 0.12s ease, color 0.12s ease;
}
.tg-panel-close:hover,
.tg-panel-close:focus {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
    outline: none;
}

.tg-panel-titleblock {
    flex: 0 0 auto;
    padding: 20px 24px 14px;
    border-bottom: 1px solid #f0f0f0;
}
.tg-panel-titleblock h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: #1a1a1a;
}
.tg-panel-subtitle {
    margin: 0;
    font-size: 13.5px;
    color: #555;
    line-height: 1.6;
}

.tg-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 22px 24px 24px;
    font-size: 14px;
    line-height: 1.75;
}
.tg-panel-body h1 { display: none; } /* title rendered in titleblock */
.tg-panel-body h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 28px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
    letter-spacing: -0.01em;
}
.tg-panel-body h3 {
    font-size: 14.5px;
    font-weight: 600;
    margin: 18px 0 8px;
    color: #333;
}
.tg-panel-body p {
    margin: 0 0 12px;
}
.tg-panel-body ul,
.tg-panel-body ol {
    margin: 0 0 14px;
    padding-left: 20px;
}
.tg-panel-body li {
    margin-bottom: 5px;
}
.tg-panel-body code {
    background: #f4f4f4;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12.5px;
    font-family: "SF Mono", Menlo, monospace;
}
.tg-panel-body blockquote {
    border-left: 3px solid #B8A68A;
    padding: 3px 14px;
    color: #555;
    margin: 14px 0;
    background: #FAF8F3;
    font-size: 13.5px;
}
.tg-panel-body a {
    color: #3a5773;
    text-decoration: underline;
}
.tg-panel-body .tg-wrap,
.tg-panel-body .tg-hero,
.tg-panel-body .tg-breadcrumb,
.tg-panel-body .tg-nl-cta,
.tg-panel-body .tg-meta {
    /* Strip the full-page chrome inside the panel — panel has its own header/footer */
    display: none !important;
}
.tg-panel-body .tg-body {
    padding: 0;
}

.tg-panel-loading,
.tg-panel-error {
    padding: 24px;
    font-size: 14px;
    color: #666;
    text-align: center;
}
.tg-panel-error a { color: #3a5773; }

.tg-panel-footer {
    flex: 0 0 auto;
    padding: 14px 24px;
    border-top: 1px solid #eee;
    background: #FAFAFA;
}
.tg-panel-fullpage {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: #3a5773;
    text-decoration: none;
    padding: 6px 0;
}
.tg-panel-fullpage:hover {
    text-decoration: underline;
}

/* Panel is now a flex sibling of main content — GeneratePress
   .site-content{display:flex} handles shrinking automatically.
   No manual margin-left needed on .tg-main-content. */

/* Below breakpoint — hide panel entirely (defensive; JS also disables) */
@media (max-width: 1023px) {
    .tg-panel,
    body.tg-panel-open .tg-panel {
        display: none !important;
    }
}
