/*
 * learn-hubs.css
 * Styles for OfficeSeries Learn hub content pages — left nav, article, and
 * "In This Page" panel.  Uses design tokens from learn.css.
 */

/* ─── Layout helpers ─── */

/* ═══════════════════════════════════════════
   Search box (top of left nav)
   ═══════════════════════════════════════════ */

.hub-search-box {
    position: relative;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--os-border);
}

.hub-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-family: var(--os-font);
    color: var(--os-text);
    background-color: var(--os-surface);
    border: 1px solid var(--os-border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.hub-search-input:focus {
    border-color: var(--os-primary);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.12);
}

.hub-search-input::placeholder {
    color: var(--os-text-muted);
}

.hub-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--os-surface);
    border: 1px solid var(--os-border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    max-height: 24rem;
    overflow-y: auto;
    scrollbar-width: thin;
}

.hub-search-result-item {
    display: block;
    padding: 0.625rem 0.75rem;
    text-decoration: none;
    color: var(--os-text);
    border-bottom: 1px solid #f0f0f2;
    transition: background-color 0.1s;
}

.hub-search-result-item:last-child {
    border-bottom: none;
}

.hub-search-result-item:hover {
    background-color: #f0f4fa;
    text-decoration: none;
    color: var(--os-text);
}

.hub-search-result-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--os-primary);
    margin-bottom: 0.125rem;
}

.hub-search-result-snippet {
    font-size: 0.75rem;
    color: var(--os-text-muted);
    line-height: 1.4;
}

.hub-search-no-results {
    padding: 0.75rem;
    font-size: 0.8125rem;
    color: var(--os-text-muted);
    text-align: center;
}

/* ═══════════════════════════════════════════
   Left navigation ("Topics")
   ═══════════════════════════════════════════ */

.hub-menu {
    padding: 0.5rem 0.75rem 1.5rem 0;
    position: sticky;
    top: 4rem;
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    scrollbar-width: thin;
    font-size: 0.875rem;
}

.hub-menu a {
    color: var(--os-text-muted);
    text-decoration: none;
}

.hub-menu a:hover {
    color: var(--os-primary);
    text-decoration: none;
}

.hub-menu-header {
    display: none;
}

/* Collapse toggle (mobile) */
.hub-menu-button,
.hub-inpage-button {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--os-font);
    background: var(--os-surface);
    border: 1px solid var(--os-border);
    color: var(--os-text);
    border-radius: var(--os-radius);
    margin-bottom: 0.5rem;
    transition: border-color 0.15s, color 0.15s;
}

.hub-menu-button:hover,
.hub-inpage-button:hover {
    border-color: var(--os-primary);
    color: var(--os-primary);
}

.hub-menu-button:focus,
.hub-inpage-button:focus {
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
    outline: none;
}

/* Folder / section links */
.hub-menu-link.nav-link.folder {
    font-weight: 600;
    color: var(--os-text);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.5rem 0;
    margin-top: 0.625rem;
    display: flex;
    align-items: center;
}

.hub-menu-item:first-child .hub-menu-link.nav-link.folder {
    margin-top: 0;
}

.hub-menu-link.nav-link.folder .toggle-icon {
    margin-right: 4px;
    position: relative;
    top: 0;
    font-size: 1.125rem;
}

/* File / page links */
.hub-menu-link.nav-link.file {
    font-weight: 400;
    color: var(--os-text-muted);
    font-size: 0.8125rem;
    padding: 0.375rem 0 0.375rem 0.75rem;
    border-left: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.hub-menu-link.nav-link.file:hover {
    color: var(--os-primary);
    border-left-color: var(--os-primary);
}

/* Nav items & nesting */
.hub-menu-item {
    padding: 0;
    margin-bottom: 1px;
    font-size: 0.8125rem;
    overflow: hidden;
}

.hub-menu-item ul {
    padding-left: 0.875rem;
    list-style-type: none;
    overflow: hidden;
}

.hub-menu-item ul ul {
    padding-left: 0.875rem;
}

/* Active page */
.hub-menu-item.active {
    background: transparent;
    border-left: none;
    padding: 0;
}

.hub-menu-link {
    padding: 0.3125rem 0.375rem;
    margin: 0;
    font-size: 0.8125rem;
    border-radius: 4px;
}

.hub-menu-link.active {
    font-weight: 600;
    color: var(--os-primary);
    background-color: rgba(0, 102, 204, 0.06);
    border-radius: 4px;
}

/* ═══════════════════════════════════════════
   "In This Page" panel (right sidebar)
   ═══════════════════════════════════════════ */

.hub-inpage {
    padding: 1.5rem 0 1.5rem 2rem;
    border-left: 1px solid var(--os-border);
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    position: sticky;
    top: 4rem;
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    font-size: 0.8125rem;
}

.hub-inpage-header {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--os-text-muted);
    padding-bottom: 0.625rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--os-border);
    text-align: left;
}

/* "In This Page" menu links */
.hub-inpage-menu-ul-h1,
.hub-inpage-menu-ul-h2,
.hub-inpage-menu-ul-h3,
.hub-inpage-menu-ul-h4,
.hub-inpage-menu-ul-h5,
.hub-inpage-menu-ul-h6 {
    list-style-type: none;
    padding-left: 0;
    margin-left: 0;
    line-height: normal;
}

.hub-inpage-menu-li-h1 > a,
.hub-inpage-menu-li-h2 > a,
.hub-inpage-menu-li-h3 > a,
.hub-inpage-menu-li-h4 > a,
.hub-inpage-menu-li-h5 > a,
.hub-inpage-menu-li-h6 > a {
    font-weight: 400;
    color: var(--os-text-muted);
    text-decoration: none;
    display: block;
    padding: 0.3125rem 0.5rem;
    font-size: 0.8125rem;
    border-left: 2px solid transparent;
    background-color: transparent;
    transition: color 0.15s, border-color 0.15s, background-color 0.5s ease-out, font-weight 0.15s;
}

.hub-inpage-menu-li-h1 > a:hover,
.hub-inpage-menu-li-h2 > a:hover,
.hub-inpage-menu-li-h3 > a:hover,
.hub-inpage-menu-li-h4 > a:hover,
.hub-inpage-menu-li-h5 > a:hover,
.hub-inpage-menu-li-h6 > a:hover {
    color: var(--os-primary);
    border-left-color: var(--os-primary);
    background: transparent;
}

.hub-inpage-menu-li-h3 > a,
.hub-inpage-menu-li-h4 > a,
.hub-inpage-menu-li-h5 > a,
.hub-inpage-menu-li-h6 > a {
    padding-left: 1.25rem;
}

/* Active section highlight (applied by JS for 2s on click) */
.hub-inpage-menu-link-active {
    color: var(--os-primary) !important;
    border-left-color: var(--os-primary) !important;
    font-weight: 600 !important;
    background-color: #dbe9f9 !important;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════
   Article content area
   ═══════════════════════════════════════════ */

.hub-article {
    background-color: transparent;
    padding: 0 2.5rem;
    border: none;
    border-radius: 0;
    font-family: var(--os-font);
    box-shadow: none;
}

/* Headings */
.hub-article h1,
.hub-article h2,
.hub-article h3,
.hub-article h4,
.hub-article h5,
.hub-article h6 {
    color: var(--os-text);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

.hub-article h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1em;
    padding-top: 0;
    letter-spacing: -0.01em;
}

.hub-article h2 {
    font-size: 1.5rem;
    margin-top: 3rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid var(--os-border);
}

.hub-article h3 {
    font-size: 1.25rem;
    margin-top: 2.25rem;
}

.hub-article h4 {
    font-size: 1.125rem;
    margin-top: 2rem;
}

.hub-article h5 {
    font-size: 1rem;
    margin-top: 1.5rem;
}

.hub-article h6 {
    font-size: 0.9375rem;
    margin-top: 1.5rem;
    color: var(--os-text-muted);
}

/* Paragraphs */
.hub-article p {
    margin-top: 0;
    margin-bottom: 1.25rem;
    line-height: 1.75;
}

/* Images */
.hub-article img {
    max-width: 100%;
    height: auto;
    border-radius: var(--os-radius);
    border: 1px solid var(--os-border);
    margin: 1rem 0;
}

/* Callouts / highlights (rendered as <p><mark>) */
.hub-article p mark {
    display: block;
    padding: 1rem 1.25rem;
    color: var(--os-text);
    background-color: #f0f6ff;
    border-left: 4px solid var(--os-primary);
    border-radius: 0 var(--os-radius) var(--os-radius) 0;
    margin: 1.5rem 0;
}

.hub-article p mark a {
    font-weight: 600;
}

.hub-article p mark a:hover {
    text-decoration: underline;
}

/* Blockquotes */
.hub-article blockquote {
    padding: 1.25rem 1.5rem;
    line-height: 1.75;
    font-size: 1rem;
    border-left: 4px solid var(--os-primary);
    color: var(--os-text);
    background-color: #f8f9fb;
    margin: 2rem 0;
    border-radius: 0 var(--os-radius) var(--os-radius) 0;
}

/* Inline emphasis */
.hub-article em {
    font-style: italic;
    color: var(--os-text);
}

.hub-article strong,
.hub-article b {
    font-weight: 600;
    color: var(--os-text);
}

/* Lists */
.hub-article ul,
.hub-article ol {
    margin: 0.75rem 0 1.5rem 0;
    padding-left: 1.75rem;
}

.hub-article li {
    margin-bottom: 0.75rem;
    line-height: 1.75;
}

.hub-article li strong {
    font-weight: 600;
    color: var(--os-text);
}

/* Links */
.hub-article a {
    color: var(--os-primary);
    text-decoration: none;
    font-weight: 500;
}

.hub-article a:hover {
    color: var(--os-primary-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Code */
.hub-article code {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85em;
    background-color: rgba(0, 0, 0, 0.04);
    border-radius: 4px;
    padding: 0.15em 0.4em;
}

.hub-article pre {
    background-color: #f8f8fa;
    border: 1px solid var(--os-border);
    border-radius: var(--os-radius);
    padding: 1.25em;
    overflow-x: auto;
}

.hub-article pre code {
    background: none;
    padding: 0;
}

/* Tables */
.hub-article table {
    width: 100%;
    margin: 2rem 0;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.hub-article table th {
    font-weight: 600;
    background-color: #f8f9fb;
    border-bottom: 2px solid var(--os-border);
    padding: 0.875rem 1.125rem;
    text-align: left;
    color: var(--os-text);
}

.hub-article table td {
    border-bottom: 1px solid #e8e8ed;
    padding: 0.875rem 1.125rem;
    vertical-align: top;
    color: var(--os-text);
}

.hub-article table tbody tr:hover {
    background-color: #f8f9fb;
}

.hub-article table strong {
    font-weight: 600;
}

/* Horizontal rule */
.hub-article hr {
    border: none;
    border-top: 1px solid var(--os-border);
    margin: 2rem 0;
}

/* Header highlight (applied by JS for 2s when navigating via In This Page) */
.hub-article-header-highlight {
    background-color: #dbe9f9 !important;
    border-left: 4px solid var(--os-primary) !important;
    border-radius: 0;
    padding: 0.375rem 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Headings need transition on base state so removal of highlight fades out */
.hub-article h1,
.hub-article h2,
.hub-article h3,
.hub-article h4,
.hub-article h5,
.hub-article h6 {
    transition: background-color 0.5s ease-out, border-color 0.5s ease-out, box-shadow 0.5s ease-out;
}

/* ═══════════════════════════════════════════
   Mobile layout
   ═══════════════════════════════════════════ */

@media (max-width: 767.98px) {
    .hub-menu {
        width: 100%;
        padding: 1rem;
        border: 1px solid var(--os-border);
        border-radius: var(--os-radius);
        position: absolute;
        top: 3rem;
        background-color: var(--os-surface);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        z-index: 1000;
    }

    .hub-article {
        padding: 0 1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}
