/* ==========================================================================
   Typedeck Help — help.css
   ========================================================================== */

.help-body {
    overflow: hidden;
}

.help-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: calc(100vh - var(--nav-height));
    margin-top: 0;
}

/* ---------- Sidebar ---------- */

.help-sidebar {
    background: var(--bg-section);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 20px 0;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.help-sidebar:hover {
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.help-sidebar::-webkit-scrollbar {
    width: 6px;
}

.help-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.help-sidebar::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
}

.help-sidebar:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

.help-search-box {
    padding: 0 16px 20px;
}

.help-search-box input {
    width: 100%;
    padding: 9px 12px 9px 32px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 14px 14px;
}

.help-search-box input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.help-nav {
    display: flex;
    flex-direction: column;
}

.help-link {
    display: block;
    padding: 5px 12px;
    margin: 0 8px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.1s ease, color 0.1s ease;
}

.help-link:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.help-link.active {
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 500;
}

.help-section {
    margin-top: 4px;
}

.help-section-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    width: calc(100% - 16px);
    margin: 0 8px;
    padding: 10px 12px 6px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.help-section-toggle::before {
    content: '\203A';
    display: inline-block;
    width: 12px;
    font-size: 14px;
    line-height: 1;
    color: var(--text-tertiary);
    transition: transform 0.15s ease;
}

.help-section-toggle.open::before {
    transform: rotate(90deg);
}

.help-section-items {
    display: flex;
    flex-direction: column;
}

.help-section-items[hidden] {
    display: none;
}

.help-section-items .help-link {
    padding-left: 28px;
    font-size: 13px;
}

/* ---------- Content ---------- */

.help-content {
    overflow-y: auto;
    padding: 48px 64px 96px;
    background: var(--bg-page);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.help-content::-webkit-scrollbar {
    width: 6px;
}

.help-content::-webkit-scrollbar-track {
    background: transparent;
}

.help-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 3px;
}

.help-article {
    display: none;
    max-width: 720px;
    margin: 0 auto;
}

.help-article.active {
    display: block;
}

.help-article-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.help-article-icon {
    border-radius: 8px;
}

.help-article h1 {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 36px;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.help-article-header h1 {
    margin-bottom: 0;
}

.help-lead {
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.help-article h2 {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 22px;
    margin-top: 48px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.help-article p {
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.help-article ul {
    margin: 0 0 16px 20px;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.help-article li {
    margin-bottom: 6px;
}

.help-article code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-section);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-primary);
}

.help-article pre {
    margin: 20px 0;
    padding: 20px 24px;
    background: #1E293B;
    border-radius: 10px;
    border: 1px solid #334155;
    overflow-x: auto;
}

.help-article pre code {
    background: none;
    padding: 0;
    color: #E2E8F0;
    font-size: 13px;
    line-height: 1.7;
}

.help-article kbd {
    display: inline-block;
    padding: 2px 7px;
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--text-primary);
    background: var(--bg-section);
    border: 1px solid var(--border);
    border-radius: 5px;
    box-shadow: 0 1px 0 var(--border), 0 1px 2px rgba(0, 0, 0, 0.04);
    line-height: 1.4;
}

.help-article strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ---------- Card Grid (Welcome page) ---------- */

.help-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.help-card {
    display: block;
    padding: 20px 24px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.help-card:hover {
    border-color: var(--brand);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.08);
    transform: translateY(-1px);
    color: var(--text-primary);
}

.help-card h3 {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 6px;
}

.help-card p {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-tertiary);
    margin: 0;
}

/* ---------- See Also ---------- */

.help-seealso {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.help-seealso h3 {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.help-seealso a {
    display: inline-block;
    font-size: 14px;
    margin-right: 16px;
    margin-bottom: 0;
    padding: 4px 0;
}

/* ---------- Shortcuts Table ---------- */

.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}

.shortcuts-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    border-bottom: 2px solid var(--border);
}

.shortcuts-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.shortcuts-table td:last-child {
    text-align: right;
}

/* ---------- Feedback ---------- */

.help-feedback {
    max-width: 720px;
    margin: 48px auto 0;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.help-feedback p {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .help-body {
        overflow: auto;
    }

    .help-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .help-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: none;
        overflow-y: visible;
        padding: 16px 0;
    }

    .help-content {
        overflow-y: visible;
        padding: 32px 20px 64px;
    }

    .help-article {
        max-width: 100%;
    }

    .help-card-grid {
        grid-template-columns: 1fr;
    }

    .help-article h1 {
        font-size: 28px;
    }
}
