/*
 * guides-v2.css
 * Quirgs legacy guide stylesheet — v2 dark terminal aesthetic
 * Applied to all /guides/*.html pages. Original styles.css preserved but unused.
 */

:root {
    --bg: #09090b;
    --surface: #18181b;
    --surface-2: #1c1c1f;
    --border: #27272a;
    --border-2: #2e2e33;

    --text: #a1a1aa;
    --text-bright: #f4f4f5;
    --text-muted: #52525b;

    --green: #4ade80;
    --blue: #60a5fa;
    --red: #f87171;
    --yellow: #facc15;
    --purple: #a78bfa;

    --code-bg: #0d0d10;
    --code-text: #a1a1aa;

    --radius: 6px;
    --radius-lg: 10px;
    --max-w: 860px;

    --font-mono: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Reset ──────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Base ───────────────────────────────────────── */
html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    padding: 0 16px 64px;
}

/* ── Links ──────────────────────────────────────── */
a {
    color: var(--blue);
    text-decoration: none;
    border-bottom: 1px dashed var(--blue);
    transition: color 0.2s, border-color 0.2s;
}

a:hover {
    color: var(--green);
    border-color: var(--green);
}

/* ── Header / logo area ─────────────────────────── */
.guide-header {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 28px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.guide-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.logo {
    width: 96px;
    height: auto;
    margin-bottom: 12px;
    display: block;
}

.guide-header h1 {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    color: var(--text-bright);
    font-weight: 600;
    line-height: 1.3;
    margin-top: 0;
    margin-bottom: 4px;
}

.back-to-dir {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    border-bottom: 1px dashed var(--text-muted);
    white-space: nowrap;
    align-self: flex-start;
    margin-top: 4px;
}

.back-to-dir:hover {
    color: var(--blue);
    border-color: var(--blue);
}

/* ── Legacy badge ───────────────────────────────── */
.legacy-pill {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    color: var(--yellow);
    background: rgba(250, 204, 21, 0.06);
    border: 1px solid rgba(250, 204, 21, 0.2);
    padding: 3px 10px;
    border-radius: 4px;
    margin-top: 10px;
}

/* ── Nav ────────────────────────────────────────── */
nav#main-nav {
    position: sticky;
    top: 0;
    z-index: 200;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0;
    max-width: 100%;
    width: 100%;
    margin-bottom: 28px;
}

nav#main-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 16px;
}

nav#main-nav li {
    margin: 0;
}

nav#main-nav a {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text);
    border-bottom: none;
    padding: 12px 14px;
    transition: color 0.2s, background 0.2s;
}

nav#main-nav a:hover {
    color: var(--text-bright);
    background: rgba(255, 255, 255, 0.04);
    border-bottom: none;
}

/* ── In-page search bar ─────────────────────────── */
.content-search-container {
    position: sticky;
    top: 45px;
    z-index: 190;
    max-width: var(--max-w);
    margin: 0 auto 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.search-wrapper {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    gap: 6px;
}

#content-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 4px 6px;
}

#content-search-input::placeholder {
    color: var(--text-muted);
}

.content-search-info {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.content-search-nav {
    display: flex;
    gap: 4px;
}

.content-search-nav button,
#content-search-button {
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.82rem;
    font-family: var(--font-mono);
    transition: color 0.2s, border-color 0.2s;
}

.content-search-nav button:hover,
#content-search-button:hover {
    color: var(--text-bright);
    border-color: var(--blue);
    background: transparent;
}

.content-search-nav button:disabled {
    opacity: 0.3;
    cursor: default;
}

/* search highlight */
.highlight-search {
    background-color: rgba(250, 204, 21, 0.25);
    border-radius: 2px;
}

/* ── Content wrapper ────────────────────────────── */
.content-area {
    max-width: var(--max-w);
    margin: 0 auto;
}

/* ── Section ────────────────────────────────────── */
section {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-lg);
    padding: 28px 26px;
    margin-bottom: 16px;
    scroll-margin-top: 100px;
}

section h2 {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text-bright);
    font-weight: 600;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

section h3 {
    font-size: 0.9rem;
    color: var(--text-bright);
    margin: 20px 0 10px;
}

section h4 {
    font-size: 0.85rem;
    color: var(--blue);
    margin: 16px 0 8px;
    font-family: var(--font-mono);
}

section p {
    margin-bottom: 12px;
}

section p:last-child {
    margin-bottom: 0;
}

section ul,
section ol {
    padding-left: 22px;
    margin-bottom: 12px;
}

section li {
    margin-bottom: 6px;
}

/* ── Tables ─────────────────────────────────────── */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    font-size: 0.85rem;
    display: block;
    overflow-x: auto;
}

th,
td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--surface);
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    font-weight: 600;
}

tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

/* ── Code ───────────────────────────────────────── */
code {
    font-family: var(--font-mono);
    font-size: 0.83em;
    color: var(--green);
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    overflow-x: auto;
    margin: 14px 0;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--code-text);
    font-size: 0.85rem;
}

/* ── Expandable / Read More ─────────────────────── */
.expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.expandable-content.expanded {
    max-height: 4000px;
}

.read-more-btn {
    background: none;
    border: 1px solid var(--border-2);
    color: var(--blue);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 6px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    margin-top: 14px;
    transition: border-color 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.read-more-btn:hover {
    border-color: var(--blue);
    color: var(--text-bright);
    background: transparent;
}

.read-less-text {
    display: none;
}

.read-more-btn.expanded .read-more-text {
    display: none;
}

.read-more-btn.expanded .read-less-text {
    display: inline;
}

.read-more-btn::after {
    content: '▼';
    font-size: 9px;
}

.read-more-btn.expanded::after {
    content: '▲';
}

/* ── Flowchart ──────────────────────────────────── */
.flowchart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin: 16px 0;
    font-family: var(--font-mono);
    font-size: 0.83rem;
}

.flowchart-step {
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    padding: 10px 18px;
    width: 100%;
    max-width: 500px;
    text-align: center;
    color: var(--text-bright);
}

.flowchart-arrow {
    width: 2px;
    height: 18px;
    background: var(--border-2);
    position: relative;
}

.flowchart-arrow::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: -4px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--border-2);
}

/* ── Note / Example callouts ────────────────────── */
.note,
.example {
    background: rgba(96, 165, 250, 0.06);
    border-left: 3px solid var(--blue);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 0.85rem;
}

/* ── Hamburger / mobile nav ─────────────────────── */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    cursor: pointer;
    position: absolute;
    top: 28px;
    right: 20px;
    z-index: 1000;
}

.hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: var(--text-muted);
    border-radius: 2px;
    transition: background 0.2s;
}

.hamburger.active span {
    background-color: var(--text-bright);
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
}

.overlay.active {
    display: block;
}

/* ── Back to top ────────────────────────────────── */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    color: var(--blue);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 8px 14px;
    border-radius: var(--radius);
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, border-color 0.2s;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    border-color: var(--blue);
    color: var(--text-bright);
}

/* ── Footer ─────────────────────────────────────── */
footer {
    max-width: var(--max-w);
    margin: 48px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

footer a {
    color: var(--text-muted);
    border-bottom: 1px dashed var(--text-muted);
    transition: color 0.2s;
}

footer a:hover {
    color: var(--blue);
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    nav#main-nav {
        position: fixed;
        top: 0;
        right: -260px;
        width: 240px;
        height: 100vh;
        background: var(--surface);
        border-left: 1px solid var(--border);
        border-bottom: none;
        z-index: 999;
        transition: right 0.3s ease;
        padding-top: 60px;
        margin-bottom: 0;
    }

    nav#main-nav ul {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    nav#main-nav a {
        padding: 14px 24px;
        border-bottom: 1px solid var(--border);
    }

    nav#main-nav.active {
        right: 0;
    }

    body.menu-open {
        overflow: hidden;
    }

    section {
        padding: 20px 16px;
    }

    .content-search-container {
        top: 45px;
    }
}

@media (max-width: 480px) {
    .guide-header h1 {
        font-size: 1rem;
    }
}