/* =======================================================
   Guide page — Repository tabs, sidebar nav, documentation
   ======================================================= */

.main-content {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.guide-section {
    width: min(1300px, 92%);
    padding: clamp(2rem, 5vw, 3.5rem) 0 3rem;
    margin: 0 auto;
}

/* ------ REPOSITORY TABS ------ */
.repo-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: fadeInUp 0.6s var(--ease-out) both;
}

.repo-tab-btn {
    padding: 8px 22px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--fg-color-second);
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    letter-spacing: -0.01em;
}

.repo-tab-btn:hover {
    color: var(--fg-color-first);
    background: rgba(139, 92, 246, 0.08);
}

.repo-tab-btn.active {
    color: var(--fg-color-first);
    background: var(--gradient-subtle);
    border-color: var(--border-medium);
}

/* ------ TAB PANELS ------ */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ------ GUIDE LAYOUT ------ */
.guide-container {
    grid-template-columns: 260px 1fr;
    gap: clamp(1.5rem, 3vw, 3rem);
    align-items: start;
}

/* ------ SIDEBAR NAVIGATION ------ */
.guide-navigation {
    position: sticky;
    top: 1rem;
    align-self: start;
    padding: 1.5rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    animation: fadeInRight 0.7s var(--ease-out) both;
}

.guide-navigation::-webkit-scrollbar {
    width: 4px;
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.guide-navigation nav {
    margin-top: 0;
}

.guide-navigation a {
    display: block;
    padding: 7px 10px;
    color: var(--fg-color-second);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.25s var(--ease-out);
    word-wrap: break-word;
    position: relative;
    border-left: 2px solid transparent;
}

.guide-navigation a:hover {
    color: var(--fg-color-first);
    background: rgba(139, 92, 246, 0.08);
    border-left-color: var(--accent-color);
    padding-left: 14px;
}

.guide-navigation a.active {
    color: var(--fg-color-first);
    background: var(--gradient-subtle);
    border-left-color: var(--accent-color);
    padding-left: 14px;
}

.first-level-ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.first-level-ul > li {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--fg-color-first);
    padding: 4px 0;
}

.first-level-ul > li > a {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--fg-color-first);
}

.second-level-ul {
    list-style: none;
    margin-top: 6px;
    margin-left: 6px;
    padding-left: 10px;
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.second-level-ul li {
    font-size: 0.85rem;
    font-weight: 400;
}

.second-level-ul li a {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.85rem;
    padding: 5px 8px;
    color: var(--fg-color-muted);
}

/* ------ CONTENT AREA ------ */
.guide {
    flex-direction: row;
    justify-content: end;
    min-width: 0;
}

.guide-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--fg-color-second);
    width: 100%;
    min-width: 0;
    animation: fadeInUp 0.8s var(--ease-out) 0.15s both;
}

.guide-text h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    color: var(--fg-color-first);
    letter-spacing: -0.02em;
    margin: 2.5rem 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    scroll-margin-top: 90px;
}

.guide-text h1:first-child {
    margin-top: 0;
}

.guide-text h1::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 60px;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 2px;
    box-shadow: 0 0 12px var(--accent-glow);
}

.guide-text h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    color: var(--fg-color-first);
    letter-spacing: -0.01em;
    margin: 2rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    scroll-margin-top: 90px;
}

.guide-text h3::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 1.1em;
    background: var(--gradient-primary);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--accent-glow);
    flex-shrink: 0;
}

.guide-text div {
    margin-bottom: 1.25rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: border-color 0.3s var(--ease-out);
}

.guide-text div:hover {
    border-color: var(--border-medium);
}

.guide-text p {
    margin-bottom: 0.6rem;
    color: var(--fg-color-second);
}

.guide-text p:last-child {
    margin-bottom: 0;
}

/* Inline links inside guide text */
.inline-link {
    color: var(--accent-glow);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.88em;
    transition: color 0.2s;
}

.inline-link:hover {
    color: var(--fg-color-first);
}

/* ------ CODE BLOCKS ------ */
pre {
    background: rgba(10, 10, 20, 0.7);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.65;
    color: var(--fg-color-second);
    margin: 0.75rem 0 0;
    white-space: pre;
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--accent-glow);
    background: rgba(139, 92, 246, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
}

pre code {
    background: none;
    color: var(--fg-color-second);
    padding: 0;
    font-size: inherit;
    border-radius: 0;
}

/* ------ TABLES ------ */
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin-top: 0.5rem;
    background: rgba(15, 15, 30, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    font-size: 0.88rem;
}

table, th, td {
    border: none;
}

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

thead tr:first-child th {
    background: var(--gradient-subtle);
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--fg-color-first);
    letter-spacing: 0.02em;
    font-size: 0.9rem;
    padding: 11px 14px;
}

tbody tr {
    transition: background 0.25s var(--ease-out);
}

tbody tr:hover {
    background: rgba(139, 92, 246, 0.05);
}

tbody tr:last-child td {
    border-bottom: none;
}

td {
    color: var(--fg-color-second);
    vertical-align: top;
}

td:first-child {
    font-weight: 600;
    color: var(--fg-color-first);
    font-family: var(--font-display);
    white-space: nowrap;
}

/* ------ MARKDOWN-RENDERED CONTENT ------ */

/* h2 sits between h1 (section title) and h3 (subsection) */
.guide-text h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    color: var(--fg-color-first);
    letter-spacing: -0.02em;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    scroll-margin-top: 90px;
}

.guide-text h2::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 40px;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.guide-text h4,
.guide-text h5,
.guide-text h6 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--fg-color-first);
    margin: 1.5rem 0 0.75rem;
    scroll-margin-top: 90px;
}

.md-content ul,
.md-content ol {
    padding-left: 1.5rem;
    margin: 0.25rem 0 1rem;
    color: var(--fg-color-second);
}

.md-content li {
    margin-bottom: 0.35rem;
    line-height: 1.7;
}

.md-content li > ul,
.md-content li > ol {
    margin: 0.25rem 0 0.25rem;
}

.md-content a {
    color: var(--accent-glow);
    text-decoration: none;
    transition: color 0.2s;
}

.md-content a:hover {
    color: var(--fg-color-first);
    text-decoration: underline;
}

.md-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 0.5rem 0;
}

.md-content blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1.25rem;
    border-left: 3px solid var(--accent-color);
    background: var(--bg-glass);
    border-radius: 0 8px 8px 0;
    color: var(--fg-color-muted);
    font-style: italic;
}

.md-content blockquote p {
    color: inherit;
    margin-bottom: 0;
}

.md-content hr {
    display: none;
}

.md-loading {
    color: var(--fg-color-muted);
    font-style: italic;
    animation: mdPulse 1.4s ease-in-out infinite;
}

@keyframes mdPulse {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 1; }
}

/* ------ COMING SOON PANEL ------ */
.coming-soon-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(3rem, 8vw, 6rem) 2rem;
    gap: 1.25rem;
    animation: fadeInUp 0.7s var(--ease-out) both;
}

.coming-soon-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--gradient-subtle);
    border: 1px solid var(--border-medium);
    margin-bottom: 0.5rem;
}

.coming-soon-icon svg {
    width: 36px;
    height: 36px;
    stroke: var(--accent-glow);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.coming-soon-panel h2 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--fg-color-first);
    letter-spacing: -0.02em;
}

.coming-soon-panel p {
    color: var(--fg-color-second);
    font-size: 1rem;
    max-width: 420px;
}

.cs-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-medium);
    color: var(--fg-color-first);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s var(--ease-out);
    backdrop-filter: blur(10px);
    margin-top: 0.5rem;
}

.cs-link:hover {
    border-color: var(--accent-glow);
    background: rgba(139, 92, 246, 0.1);
    transform: translateY(-2px);
}

/* ------ RESPONSIVE ------ */
@media screen and (max-width: 1000px) {
    .guide-container {
        grid-template-columns: 1fr;
    }

    .guide-navigation {
        display: none;
    }
}

@media screen and (max-width: 700px) {
    .repo-tabs {
        gap: 0.35rem;
        padding: 0.4rem;
    }

    .repo-tab-btn {
        padding: 7px 14px;
        font-size: 0.85rem;
    }

    .guide-text h1 {
        font-size: 1.6rem;
    }

    .guide-text h3 {
        font-size: 1.1rem;
    }

    .guide-text div {
        padding: 1rem;
    }

    pre {
        font-size: 0.75rem;
    }

    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: 8px 10px;
    }
}
