/* mindsquare Codex — How-To Page Styles */

* { box-sizing: border-box; }

body.msq-howto-body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--msq-text);
    background: var(--msq-bg);
    line-height: 1.6;
}

/* TOPBAR */
.msq-howto-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid var(--msq-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.msq-howto-topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}
.msq-howto-logo {
    text-decoration: none !important;
    font-size: 22px;
    color: var(--msq-text) !important;
    font-weight: 300;
}
.msq-howto-logo strong {
    color: var(--msq-primary);
    font-weight: 700;
    margin-left: 0.15em;
}
.msq-howto-nav {
    display: flex;
    gap: 24px;
    align-items: center;
}
.msq-howto-nav a {
    color: var(--msq-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: color 0.15s;
}
.msq-howto-nav a:hover {
    color: var(--msq-primary);
}
.msq-howto-nav a.active {
    color: var(--msq-primary);
    border-bottom: 2px solid var(--msq-primary);
    padding-bottom: 4px;
}
.msq-howto-nav a.msq-btn-primary,
.msq-howto-nav a.msq-btn-primary:hover {
    color: #fff !important;
    border-bottom: none;
    padding-bottom: initial;
}
.msq-btn-sm {
    padding: 8px 18px !important;
    font-size: 14px !important;
}

/* LAYOUT: Sidebar + Main */
.msq-howto-sidebar {
    position: fixed;
    top: 73px;
    left: 0;
    width: 260px;
    height: calc(100vh - 73px);
    overflow-y: auto;
    background: var(--msq-bg-soft);
    border-right: 1px solid var(--msq-border);
    padding: 32px 0;
}
.msq-howto-sidebar-inner {
    padding: 0 20px;
}
.msq-howto-sidebar h3 {
    margin: 0 0 16px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--msq-text-light);
    font-weight: 700;
}
.msq-howto-sidebar ol {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: tocitem;
}
.msq-howto-sidebar ol li {
    counter-increment: tocitem;
    margin-bottom: 4px;
}
.msq-howto-sidebar ol li a {
    display: block;
    padding: 8px 12px;
    color: var(--msq-text);
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.15s;
    position: relative;
}
.msq-howto-sidebar ol li a:before {
    content: counter(tocitem) ".";
    color: var(--msq-text-light);
    margin-right: 8px;
    font-variant-numeric: tabular-nums;
}
.msq-howto-sidebar ol li a:hover {
    background: #fff;
    color: var(--msq-primary);
}
.msq-howto-sidebar ol li a.active {
    background: #fff;
    color: var(--msq-primary);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--msq-primary);
}

.msq-howto-main {
    margin-left: 260px;
    max-width: 920px;
    padding: 48px 56px 96px;
}

/* HERO */
.msq-howto-hero {
    border-bottom: 4px solid var(--msq-primary);
    padding-bottom: 32px;
    margin-bottom: 56px;
}
.msq-howto-hero h1 {
    font-size: 56px;
    font-weight: 300;
    margin: 0 0 16px;
    color: var(--msq-text);
    letter-spacing: -1px;
}
.msq-howto-lead {
    font-size: 22px;
    color: var(--msq-text-light);
    line-height: 1.5;
    margin: 0;
    max-width: 720px;
}

/* SECTIONS */
section {
    scroll-margin-top: 90px;
    margin-bottom: 64px;
}
section h2 {
    font-size: 32px;
    color: var(--msq-text);
    margin: 0 0 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--msq-secondary);
    font-weight: 600;
}
section h3 {
    font-size: 20px;
    color: var(--msq-text);
    margin: 32px 0 14px;
    font-weight: 600;
}
section h4 {
    font-size: 17px;
    color: var(--msq-text);
    margin: 0 0 12px;
    font-weight: 700;
}
section p, section li {
    color: var(--msq-text);
    line-height: 1.7;
    font-size: 16px;
}
section a {
    color: var(--msq-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}
section a:hover {
    border-bottom-color: var(--msq-primary);
}

/* STEPS LIST */
.msq-howto-steps {
    list-style: none;
    padding: 0;
    counter-reset: stepitem;
    margin: 24px 0;
}
.msq-howto-steps > li {
    counter-increment: stepitem;
    position: relative;
    padding: 12px 0 12px 56px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--msq-border);
}
.msq-howto-steps > li:last-child {
    border-bottom: none;
}
.msq-howto-steps > li:before {
    content: counter(stepitem);
    position: absolute;
    left: 0;
    top: 12px;
    width: 36px;
    height: 36px;
    background: var(--msq-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

/* BULLETS */
.msq-howto-bullets {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}
.msq-howto-bullets li {
    padding: 8px 0 8px 28px;
    position: relative;
}
.msq-howto-bullets li:before {
    content: "▸";
    color: var(--msq-primary);
    position: absolute;
    left: 8px;
    font-weight: bold;
}

/* CODE BLOCKS */
section pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px 20px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.5;
    margin: 12px 0;
    font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
    border-left: 3px solid var(--msq-primary);
}
section pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    border-radius: 0;
}
section code {
    background: var(--msq-bg-soft);
    color: var(--msq-primary);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
    border: 1px solid var(--msq-border);
}

/* CALLOUTS */
.msq-howto-callout {
    padding: 16px 20px;
    border-radius: 6px;
    margin: 20px 0;
    border-left: 4px solid;
}
.msq-howto-callout strong {
    display: inline-block;
    margin-right: 6px;
}
.msq-howto-callout-info {
    background: #e7f3ff;
    border-left-color: #0693e3;
    color: #0c4a6e;
}
.msq-howto-callout-info a { color: #0693e3; }
.msq-howto-callout-success {
    background: #e6f7e9;
    border-left-color: #4caf50;
    color: #1b5e20;
}
.msq-howto-callout-warn {
    background: #fff8e1;
    border-left-color: var(--msq-secondary);
    color: #5a4500;
}

/* TABLE */
.msq-howto-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}
.msq-howto-table th,
.msq-howto-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--msq-border);
    vertical-align: top;
}
.msq-howto-table th {
    background: var(--msq-bg-soft);
    color: var(--msq-text);
    font-weight: 700;
    border-bottom: 2px solid var(--msq-secondary);
}
.msq-howto-table td:first-child {
    font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    color: var(--msq-primary);
    white-space: nowrap;
}

/* GOOD/BAD examples */
.msq-howto-example {
    margin: 8px 0 8px 20px;
    font-size: 15px;
}
.msq-howto-example > div {
    padding: 4px 0;
}
.msq-howto-example-good { color: #1b5e20; }
.msq-howto-example-bad { color: #b00020; }

/* GRID 2 columns */
.msq-howto-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 24px 0;
}
.msq-howto-card {
    background: var(--msq-bg-soft);
    border: 1px solid var(--msq-border);
    border-radius: 8px;
    padding: 20px 24px;
    transition: border-color 0.15s, transform 0.15s;
}
.msq-howto-card:hover {
    border-color: var(--msq-primary);
    transform: translateY(-2px);
}
.msq-howto-card ul {
    margin: 0;
    padding-left: 20px;
}
.msq-howto-card ul li {
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.5;
}

/* FAQ DETAILS */
.msq-howto-faq {
    margin: 12px 0;
    border: 1px solid var(--msq-border);
    border-radius: 6px;
    background: var(--msq-bg-soft);
    overflow: hidden;
    transition: border-color 0.15s;
}
.msq-howto-faq[open] {
    border-color: var(--msq-primary);
}
.msq-howto-faq summary {
    padding: 14px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.15s;
    position: relative;
    padding-right: 40px;
}
.msq-howto-faq summary::-webkit-details-marker { display: none; }
.msq-howto-faq summary:hover {
    background: #f1f1f4;
}
.msq-howto-faq summary:after {
    content: "+";
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--msq-primary);
    font-size: 22px;
    font-weight: 600;
    transition: transform 0.2s;
}
.msq-howto-faq[open] summary:after {
    content: "−";
}
.msq-howto-faq > div {
    padding: 12px 20px 18px;
    background: #fff;
    border-top: 1px solid var(--msq-border);
}

/* FOOTER */
.msq-howto-footer {
    margin-left: 260px;
    border-top: 1px solid var(--msq-border);
    background: var(--msq-bg-soft);
    padding: 28px 56px;
}
.msq-howto-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--msq-text-light);
    font-size: 14px;
}
.msq-howto-footer a {
    color: var(--msq-text-light);
    text-decoration: none;
    border-bottom: 1px dotted var(--msq-text-light);
}
.msq-howto-footer a:hover {
    color: var(--msq-primary);
    border-bottom-color: var(--msq-primary);
}
.msq-howto-footer-note {
    color: var(--msq-text-light);
    font-size: 14px;
    font-style: italic;
    margin-top: 12px;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .msq-howto-sidebar {
        display: none;
    }
    .msq-howto-main {
        margin-left: 0;
        max-width: 100%;
        padding: 32px 24px 64px;
    }
    .msq-howto-footer {
        margin-left: 0;
        padding: 24px;
    }
}

@media (max-width: 640px) {
    .msq-howto-topbar-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .msq-howto-nav {
        flex-wrap: wrap;
        gap: 16px;
    }
    .msq-howto-hero h1 { font-size: 40px; }
    .msq-howto-lead { font-size: 18px; }
    section h2 { font-size: 26px; }
    .msq-howto-grid-2 { grid-template-columns: 1fr; }
}
