/* ==========================================================================
   PRISM User Handbook — Comprehensive Stylesheet
   PRISM handbook layout
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties — Light Theme (default)
   -------------------------------------------------------------------------- */
:root,
[data-theme="light"] {
    --hb-bg: #fafafa;
    --hb-card: var(--color-white);
    --hb-text: #2c2c2c;
    --hb-accent: #1565C0;
    --hb-heading: var(--color-bg);
    --hb-sidebar-bg: #e8e8e8;
    --hb-header-bg: #1a2332;
    --hb-header-text: #f0f0f0;
    --hb-code-bg: #2d2d2d;
    --hb-border: var(--color-text);
    --hb-link-hover: #1565C0;
    --hb-font-body: 'Roboto', sans-serif;
    --hb-font-heading: 'Roboto', sans-serif;
    --hb-font-code: 'Fira Code', monospace;
    --hb-font-size: 1rem;
    --overlay-4: rgba(255, 255, 255, 0.04);
    --overlay-6: rgba(255, 255, 255, 0.06);
    --overlay-8: rgba(255, 255, 255, 0.08);
    --overlay-10: rgba(255, 255, 255, 0.1);
    --overlay-12: rgba(255, 255, 255, 0.12);
    --overlay-15: rgba(255, 255, 255, 0.15);
    --overlay-20: rgba(255, 255, 255, 0.2);
    --text-dim: rgba(255, 255, 255, 0.3);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --color-text: var(--hb-text);
    --color-text-bright: var(--color-white);
    --color-surface: var(--hb-card);
}

/* --------------------------------------------------------------------------
   1b. CSS Custom Properties — Dark Theme
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
    --hb-bg: #121220;
    --hb-card: #1e1e30;
    --hb-text: var(--color-text);
    --hb-heading: #f0f0f0;
    --hb-sidebar-bg: #161625;
    --hb-header-bg: #0d1117;
    --hb-header-text: var(--color-text);
    --hb-code-bg: #1a1a2e;
    --hb-border: #2a2a40;
    --hb-accent: #5c9eff;
    --hb-link-hover: #5c9eff;
}

/* --------------------------------------------------------------------------
   2. Global Reset + Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: var(--hb-font-size);
}

body {
    font-family: var(--hb-font-body);
    color: var(--hb-text);
    background: var(--hb-bg);
    margin: 0;
    padding: 0;
    line-height: 1.65;
    transition: color 0.2s ease, background-color 0.2s ease;
}

/* --------------------------------------------------------------------------
   3. Progress Bar
   -------------------------------------------------------------------------- */
.hb-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--hb-accent);
    z-index: 1100;
    transition: width 0.15s ease-out;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   4. Header
   -------------------------------------------------------------------------- */
.hb-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--hb-header-bg);
    border-bottom: 1px solid var(--overlay-6);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.hb-header__inner {
    display: flex;
    align-items: center;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    gap: 16px;
}

.hb-header__title {
    display: flex;
    align-items: baseline;
    text-decoration: none;
    gap: 8px;
    flex-shrink: 0;
}

.hb-header__logo {
    font-family: var(--hb-font-heading);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--color-white);
    letter-spacing: 0.08em;
}

.hb-header__subtitle {
    font-family: var(--hb-font-heading);
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--hb-header-text);
    opacity: 0.7;
}

.hb-header__meta {
    margin-left: auto;
    flex-shrink: 0;
}

.hb-reading-time {
    font-size: 0.82rem;
    color: var(--hb-header-text);
    opacity: 0.5;
    font-family: var(--hb-font-code);
}

.hb-header__controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Hamburger — hidden on desktop */
.hb-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    z-index: 1001;
}

.hb-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--hb-header-text);
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.hb-hamburger--active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hb-hamburger--active span:nth-child(2) {
    opacity: 0;
}

.hb-hamburger--active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Search */
.hb-search-wrapper {
    position: relative;
}

.hb-search {
    padding: 6px 12px 6px 32px;
    border: 1px solid var(--overlay-15);
    border-radius: 6px;
    background: var(--overlay-8);
    color: var(--hb-header-text);
    font-family: var(--hb-font-body);
    font-size: 0.88rem;
    width: 200px;
    outline: none;
    transition: border-color 0.2s ease, width 0.2s ease, background-color 0.2s ease;
}

.hb-search:focus {
    border-color: var(--text-dim);
    background: var(--overlay-12);
    width: 260px;
}

.hb-search::placeholder {
    color: var(--hb-header-text);
    opacity: 0.4;
}

.hb-search-icon {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0.5;
    color: var(--hb-header-text);
}

/* Font size buttons */
.hb-font-btn {
    padding: 4px 8px;
    border: 1px solid var(--overlay-15);
    border-radius: 4px;
    background: transparent;
    color: var(--hb-header-text);
    font-family: var(--hb-font-code);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    line-height: 1;
}

.hb-font-btn:hover {
    background: var(--overlay-10);
    border-color: var(--text-dim);
}

/* Theme toggle */
.hb-theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    padding: 4px;
    line-height: 1;
    color: var(--hb-header-text);
    transition: color 0.2s ease;
}

.hb-theme-btn:hover {
    color: var(--hb-accent);
}

[data-theme="light"] .hb-theme-icon--dark,
:root .hb-theme-icon--dark {
    display: none;
}

[data-theme="light"] .hb-theme-icon--light,
:root .hb-theme-icon--light {
    display: inline;
}

[data-theme="dark"] .hb-theme-icon--light {
    display: none;
}

[data-theme="dark"] .hb-theme-icon--dark {
    display: inline;
}

/* --------------------------------------------------------------------------
   5. Layout — CSS Grid
   -------------------------------------------------------------------------- */
.hb-layout {
    display: grid;
    grid-template-columns: 260px 1fr 220px;
    max-width: 1440px;
    margin: 0 auto;
    min-height: calc(100vh - 56px);
    padding-top: 24px;
    gap: 0;
}

/* --------------------------------------------------------------------------
   6. Left Sidebar
   -------------------------------------------------------------------------- */
.hb-sidebar {
    position: sticky;
    top: 56px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    background: var(--hb-sidebar-bg);
    border-right: 1px solid var(--hb-border);
    transition: background-color 0.2s ease, border-color 0.2s ease;
    padding: 0;
}

.hb-sidebar__inner {
    padding: 20px 0;
}

.hb-sidebar__heading {
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--hb-text);
    opacity: 0.5;
    margin-bottom: 12px;
    padding: 0 16px;
    font-family: var(--hb-font-heading);
}

.hb-sidebar__part {
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--hb-text);
    opacity: 0.55;
    border-left: 3px solid var(--hb-accent);
    padding: 6px 16px;
    margin: 18px 0 8px 0;
    font-family: var(--hb-font-heading);
}

.hb-sidebar__link {
    display: flex;
    align-items: center;
    padding: 6px 12px 6px 16px;
    text-decoration: none;
    color: var(--hb-text);
    opacity: 0.7;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
    font-size: 0.88rem;
    gap: 6px;
}

.hb-sidebar__link:hover {
    background: rgba(128, 128, 128, 0.08);
    opacity: 1;
    color: var(--hb-text);
}

.hb-sidebar__link.active {
    border-left-color: var(--hb-accent);
    background: rgba(21, 101, 192, 0.08);
    color: var(--hb-accent);
    opacity: 1;
    font-weight: 500;
}

.hb-sidebar__num {
    font-family: var(--hb-font-code);
    width: 24px;
    flex-shrink: 0;
    color: var(--hb-text);
    opacity: 0.45;
    font-size: 0.82rem;
}

.hb-sidebar__text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hb-sidebar__time {
    font-size: 0.72rem;
    font-family: var(--hb-font-code);
    color: var(--hb-text);
    opacity: 0.35;
    flex-shrink: 0;
}

/* Sidebar scrollbar */
.hb-sidebar::-webkit-scrollbar {
    width: 5px;
}

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

.hb-sidebar::-webkit-scrollbar-thumb {
    background: var(--hb-border);
    border-radius: 3px;
}

.hb-sidebar {
    scrollbar-width: thin;
    scrollbar-color: var(--hb-border) transparent;
}

/* --------------------------------------------------------------------------
   7. Main Content
   -------------------------------------------------------------------------- */
.hb-content {
    min-width: 0;
    padding: 0 24px 48px;
}

.hb-article {
    max-width: 800px;
    margin: 0 auto;
    background: var(--hb-card);
    padding: 48px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

/* --------------------------------------------------------------------------
   8. Typography (inside .hb-article)
   -------------------------------------------------------------------------- */
.hb-article h1 {
    font-family: var(--hb-font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--hb-heading);
    border-bottom: 2px solid var(--hb-border);
    padding-bottom: 16px;
    margin: 0 0 32px 0;
    line-height: 1.25;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.hb-article h2,
.hb-article h3,
.hb-article h4 {
    scroll-margin-top: 72px;
}

.hb-article h2 {
    font-family: var(--hb-font-heading);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--hb-heading);
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--hb-border);
    border-left: 4px solid rgba(21, 101, 192, 0.12);
    padding-left: 16px;
    margin-bottom: 1rem;
    line-height: 1.3;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.hb-article h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.hb-article h3 {
    font-family: var(--hb-font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--hb-heading);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    line-height: 1.35;
    transition: color 0.2s ease;
}

.hb-article h4 {
    font-family: var(--hb-font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--hb-heading);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.hb-article p {
    margin: 0 0 1.25em 0;
    line-height: 1.65;
}

.hb-article a {
    color: var(--hb-text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.hb-article a:hover {
    color: var(--hb-link-hover);
}

.hb-article strong {
    font-weight: 700;
    color: var(--hb-heading);
}

.hb-article ul,
.hb-article ol {
    padding-left: 1.6em;
    margin-bottom: 1.25em;
}

.hb-article li {
    margin-bottom: 0.5em;
}

.hb-article li > ul,
.hb-article li > ol {
    margin-top: 0.4em;
    margin-bottom: 0.4em;
}

.hb-article blockquote {
    border-left: 4px solid var(--hb-accent);
    background: rgba(21, 101, 192, 0.04);
    padding: 16px 20px;
    margin: 1.5em 0;
    font-style: italic;
    border-radius: 0 4px 4px 0;
    color: var(--hb-text);
    opacity: 0.9;
}

.hb-article blockquote p:last-child {
    margin-bottom: 0;
}

.hb-article hr {
    border: none;
    border-top: 1px solid var(--hb-border);
    margin: 2rem 0;
}

.hb-article img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* --------------------------------------------------------------------------
   9. Tables (inside .hb-article)
   -------------------------------------------------------------------------- */
.hb-article table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5em;
    font-size: 0.95rem;
}

.hb-article thead th {
    background: var(--hb-sidebar-bg);
    font-family: var(--hb-font-heading);
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid var(--hb-accent);
    color: var(--hb-heading);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.hb-article td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--hb-border);
    transition: border-color 0.2s ease;
}

.hb-article tr:nth-child(even) {
    background: rgba(128, 128, 128, 0.03);
}

.hb-article tr:hover {
    background: rgba(21, 101, 192, 0.03);
}

.hb-article .hb-table-wrap {
    overflow-x: auto;
    margin-bottom: 1.5em;
    -webkit-overflow-scrolling: touch;
}

.hb-article .hb-table-wrap table {
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   10. Code Blocks (inside .hb-article)
   -------------------------------------------------------------------------- */
.hb-article code {
    background: var(--hb-code-bg);
    color: #f8f8f2;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--hb-font-code);
    font-size: 0.9em;
    overflow-wrap: break-word;
}

.hb-article pre {
    position: relative;
    background: var(--hb-code-bg);
    color: #f8f8f2;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1.5em;
    line-height: 1.5;
    transition: background-color 0.2s ease;
}

.hb-article pre code {
    background: none;
    padding: 0;
    font-size: 0.9rem;
    color: inherit;
    border-radius: 0;
}

.hb-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    background: var(--overlay-10);
    color: var(--text-secondary);
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--hb-font-heading);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.15s ease;
}

.hb-article pre:hover .hb-copy-btn {
    opacity: 1;
}

.hb-copy-btn:hover {
    background: var(--overlay-20);
    color: var(--color-white);
}

@media (hover: none) {
    .hb-copy-btn {
        opacity: 0.7;
    }
}

/* --------------------------------------------------------------------------
   11. Right Sidebar / Scrollspy (.hb-toc)
   -------------------------------------------------------------------------- */
.hb-toc {
    position: sticky;
    top: 56px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: 20px 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--hb-border) transparent;
}

.hb-toc::-webkit-scrollbar {
    width: 5px;
}

.hb-toc::-webkit-scrollbar-track {
    background: transparent;
}

.hb-toc::-webkit-scrollbar-thumb {
    background: var(--hb-border);
    border-radius: 3px;
}

.hb-toc__heading {
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--hb-text);
    opacity: 0.5;
    margin-bottom: 12px;
    font-family: var(--hb-font-heading);
}

.hb-toc__links a {
    display: block;
    padding: 4px 12px;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--hb-text);
    opacity: 0.6;
    border-left: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
    line-height: 1.45;
}

.hb-toc__links a:hover {
    opacity: 1;
    color: var(--hb-text);
}

.hb-toc__links a.active {
    border-left-color: var(--hb-accent);
    color: var(--hb-accent);
    opacity: 1;
}

/* Indent sub-headings in ToC */
.hb-toc__links a[data-level="3"] {
    padding-left: 24px;
    font-size: 0.82rem;
}

.hb-toc__links a[data-level="4"] {
    padding-left: 36px;
    font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   13. Back to Top
   -------------------------------------------------------------------------- */
.hb-back-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--hb-accent);
    color: var(--color-white);
    font-size: 20px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 10px var(--scrim-20);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease, background-color 0.15s ease;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hb-back-top--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.hb-back-top:hover {
    background: #1976D2;
}

[data-theme="dark"] .hb-back-top:hover {
    background: #7ab4ff;
}

/* --------------------------------------------------------------------------
   14. Search Results
   -------------------------------------------------------------------------- */
.hb-search-results {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 640px;
    background: var(--hb-card);
    border: 1px solid var(--hb-border);
    box-shadow: 0 8px 32px var(--scrim-15);
    border-radius: 8px;
    max-height: 420px;
    overflow-y: auto;
    z-index: 1050;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.hb-search-results[hidden] {
    display: none;
}

.hb-search-results .hb-search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--hb-border);
    transition: background-color 0.12s ease;
}

.hb-search-results .hb-search-result-item:last-child {
    border-bottom: none;
}

.hb-search-results .hb-search-result-item:hover {
    background: rgba(21, 101, 192, 0.06);
}

.hb-search-results .hb-search-result-title {
    font-family: var(--hb-font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--hb-heading);
    margin-bottom: 4px;
}

.hb-search-results .hb-search-result-context {
    font-size: 0.85rem;
    color: var(--hb-text);
    opacity: 0.65;
    line-height: 1.45;
}

.hb-search-results .hb-search-no-results {
    padding: 20px 16px;
    text-align: center;
    color: var(--hb-text);
    opacity: 0.5;
    font-size: 0.9rem;
}

/* Section label divider in search results */
.hb-search-section-label {
    padding: 6px 16px 4px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--hb-text);
    opacity: 0.45;
    font-family: var(--hb-font-heading);
    border-top: 1px solid var(--hb-border);
}

.hb-search-section-label:first-child {
    border-top: none;
}

/* Section badge inside result title */
.hb-search-section-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 6px;
    margin-left: 8px;
    border-radius: 3px;
    background: rgba(21, 101, 192, 0.1);
    color: var(--hb-accent);
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: var(--hb-font-heading);
}

/* Keyboard-selected result */
.hb-search-result-item--selected {
    background: rgba(21, 101, 192, 0.1) !important;
    outline: 2px solid var(--hb-accent);
    outline-offset: -2px;
}

/* Make result items proper links */
a.hb-search-result-item {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* --------------------------------------------------------------------------
   15. Search Highlight
   -------------------------------------------------------------------------- */
mark.hb-highlight {
    background: rgba(21, 101, 192, 0.25);
    padding: 1px 2px;
    border-radius: 2px;
    color: inherit;
}

/* --------------------------------------------------------------------------
   16. Mobile Overlay
   -------------------------------------------------------------------------- */
.hb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--scrim-50);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.hb-overlay--visible {
    opacity: 1;
    pointer-events: auto;
}

/* --------------------------------------------------------------------------
   17a. Responsive — Tablet (max-width: 1200px)
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .hb-toc {
        display: none;
    }

    .hb-layout {
        grid-template-columns: 260px 1fr;
    }
}

/* --------------------------------------------------------------------------
   17b. Responsive — Mobile (max-width: 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .hb-layout {
        grid-template-columns: 1fr;
    }

    /* Show hamburger */
    .hb-hamburger {
        display: flex;
    }

    /* Sidebar as fixed drawer */
    .hb-sidebar {
        position: fixed;
        left: -280px;
        top: 56px;
        bottom: 0;
        width: 280px;
        z-index: 950;
        max-height: calc(100vh - 56px);
        border-right: 1px solid var(--hb-border);
        transition: transform 0.3s ease;
    }

    .hb-sidebar--open {
        transform: translateX(280px);
    }

    /* Reduce article padding */
    .hb-article {
        padding: 24px 18px;
        border-radius: 0;
        box-shadow: none;
    }

    .hb-content {
        padding: 0 8px 32px;
    }

    /* Hide subtitle and meta on mobile */
    .hb-header__subtitle {
        display: none;
    }

    .hb-header__meta {
        display: none;
    }

    /* Compact search */
    .hb-search {
        width: 140px;
    }

    .hb-search:focus {
        width: 180px;
    }

    /* Smaller heading sizes */
    .hb-article h1 {
        font-size: 1.7rem;
    }

    .hb-article h2 {
        font-size: 1.35rem;
    }

    .hb-article h3 {
        font-size: 1.12rem;
    }

    /* Header inner compact */
    .hb-header__inner {
        padding: 0 12px;
        gap: 10px;
    }

    /* Font buttons stacked */
    .hb-header__controls {
        gap: 4px;
    }

    /* Back to top closer to edge */
    .hb-back-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* --------------------------------------------------------------------------
   17c. Responsive — Very small (max-width: 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .hb-search-wrapper {
        display: none;
    }

    .hb-font-btn {
        padding: 3px 6px;
        font-size: 0.72rem;
    }

    .hb-article {
        padding: 16px 12px;
    }

    .hb-article h1 {
        font-size: 1.45rem;
    }

    .hb-article pre {
        padding: 14px;
        font-size: 0.82rem;
        border-radius: 4px;
    }
}

/* --------------------------------------------------------------------------
   18. Print Stylesheet
   -------------------------------------------------------------------------- */
@media print {
    .hb-progress-bar,
    .hb-header,
    .hb-sidebar,
    .hb-toc,
    .hb-back-top,
    .hb-search-results,
    .hb-overlay,
    .hb-copy-btn {
        display: none !important;
    }

    body {
        background: var(--color-white);
        color: var(--color-black);
        font-size: 11pt;
        line-height: 1.6;
    }

    .hb-layout {
        display: block;
        max-width: 100%;
        padding: 0;
    }

    .hb-content {
        padding: 0;
    }

    .hb-article {
        max-width: 100%;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        background: none;
    }

    .hb-article h1,
    .hb-article h2,
    .hb-article h3,
    .hb-article h4 {
        color: var(--color-black);
    }

    .hb-article h2 {
        border-left-color: var(--color-black);
    }

    .hb-article a {
        color: var(--color-black);
        text-decoration: none;
        font-weight: 500;
    }

    .hb-article pre {
        background: #f5f5f5;
        color: #222222;
        border: 1px solid #cccccc;
        page-break-inside: avoid;
    }

    .hb-article code {
        background: #eeeeee;
        color: #222222;
    }

    .hb-article table {
        page-break-inside: avoid;
    }

    .hb-article thead th {
        background: var(--color-text);
        color: var(--color-black);
        border-bottom-color: var(--color-black);
    }

    .hb-article blockquote {
        border-left-color: #444444;
        background: #f5f5f5;
    }

    mark.hb-highlight {
        background: #ffff99;
    }
}

/* --------------------------------------------------------------------------
   19. Smooth Transitions (theme switching)
   -------------------------------------------------------------------------- */
.hb-header,
.hb-sidebar,
.hb-article,
.hb-toc,
.hb-back-top,
.hb-search-results {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* --------------------------------------------------------------------------
   20. Selection Highlight
   -------------------------------------------------------------------------- */
::selection {
    background: rgba(21, 101, 192, 0.3);
    color: inherit;
}

::-moz-selection {
    background: rgba(21, 101, 192, 0.3);
    color: inherit;
}

/* --------------------------------------------------------------------------
   Extra: Smooth focus outline for keyboard navigation
   -------------------------------------------------------------------------- */
.hb-sidebar__link:focus-visible,
.hb-toc__links a:focus-visible,
.hb-search:focus-visible,
.hb-font-btn:focus-visible,
.hb-theme-btn:focus-visible,
.hb-hamburger:focus-visible,
.hb-back-top:focus-visible {
    outline: 2px solid var(--hb-accent);
    outline-offset: 2px;
}
