/* ================================================================
   ZayneScript Documentation — Shared Stylesheet
   ================================================================ */

:root {
    --bg: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --border: #30363d;
    --text: #c9d1d9;
    --text-muted: #8b949e;
    --link: #58a6ff;
    --link-hover: #79c0ff;
    --accent: #1f6feb;
    --accent-hover: #388bfd;
    --code-bg: #161b22;
    --success: #3fb950;
    --warning: #d29922;
    --sidebar-width: 260px;
    --header-height: 56px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 1.25rem);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    font-size: 15px;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* ----------------------------------------------------------------
   Site Header
   ---------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    gap: 2rem;
}

.site-header .logo {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.site-header .logo span {
    color: var(--link);
}

.site-header nav {
    display: flex;
    gap: 1.5rem;
    margin-left: auto;
}

.site-header nav a {
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: color 0.15s;
    white-space: nowrap;
}

.site-header nav a:hover,
.site-header nav a.active {
    color: var(--text);
    text-decoration: none;
}

/* ----------------------------------------------------------------
   Landing Hero
   ---------------------------------------------------------------- */
.hero {
    text-align: center;
    padding: 5rem 1.5rem 3.5rem;
}

.hero-badge {
    display: inline-block;
    background: rgba(31, 111, 235, .15);
    border: 1px solid rgba(88, 166, 255, .3);
    border-radius: 20px;
    padding: 0.25rem 0.9rem;
    font-size: 0.8rem;
    color: var(--link);
    margin-bottom: 1.5rem;
    letter-spacing: 0.04em;
}

.hero h1 {
    font-size: clamp(2.2rem, 6vw, 3.25rem);
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #58a6ff 0%, #bc8cff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 640px;
    margin: 0 auto 2.25rem;
}

.btn-group {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 0.65rem 1.4rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    text-decoration: none;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text);
    text-decoration: none;
}

/* ----------------------------------------------------------------
   Feature grid
   ---------------------------------------------------------------- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1rem 0 3rem;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    transition: border-color 0.15s;
}

.feature-card:hover {
    border-color: var(--accent);
}

.feature-icon {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.feature-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.feature-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* ----------------------------------------------------------------
   Page-level content (landing, simple pages)
   ---------------------------------------------------------------- */
.page-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

.page-content h1 {
    font-size: 1.9rem;
    margin-bottom: 0.75rem;
}

.page-content h2 {
    font-size: 1.35rem;
    margin: 2.5rem 0 0.75rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.page-content h3 {
    font-size: 1.05rem;
    margin: 1.75rem 0 0.5rem;
}

.page-content p {
    margin-bottom: 1rem;
}

.page-content ul,
.page-content ol {
    margin: 0.5rem 0 1rem 1.4rem;
}

.page-content li {
    margin-bottom: 0.25rem;
}

/* ----------------------------------------------------------------
   Docs two-column layout (sidebar + main)
   ---------------------------------------------------------------- */
.docs-wrapper {
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
.docs-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 1.5rem 0 2rem;
    /* align-self: flex-start is REQUIRED so that sticky works inside a flex
       container — without it the sidebar stretches to the container height
       and position:sticky has nothing to scroll through */
    align-self: flex-start;
}

.sidebar-group {
    margin-bottom: 0.25rem;
}

.sidebar-group-title {
    padding: 0.5rem 1.25rem 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.docs-sidebar ul {
    list-style: none;
}

.docs-sidebar ul li a {
    display: block;
    padding: 0.28rem 1.25rem 0.28rem 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    line-height: 1.4;
}

.docs-sidebar ul li a:hover,
.docs-sidebar ul li a.active {
    color: var(--text);
    border-left-color: var(--accent);
    text-decoration: none;
}

/* Main content area */
.docs-main {
    flex: 1;
    min-width: 0;
    padding: 2.5rem 3rem 4rem;
    max-width: calc(100% - var(--sidebar-width));
}

.docs-main h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.docs-main .page-intro {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.docs-main h2 {
    font-size: 1.4rem;
    margin: 3rem 0 0.75rem;
    border-top: 1px solid var(--border);
    padding-top: 1.75rem;
    scroll-margin-top: calc(var(--header-height) + 1rem);
}

.docs-main h3 {
    font-size: 1.05rem;
    margin: 1.75rem 0 0.5rem;
    scroll-margin-top: calc(var(--header-height) + 1rem);
}

.docs-main h4 {
    font-size: 0.9rem;
    margin: 1.25rem 0 0.4rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.docs-main p {
    margin-bottom: 1rem;
}

.docs-main ul,
.docs-main ol {
    margin: 0.5rem 0 1rem 1.4rem;
}

.docs-main li {
    margin-bottom: 0.3rem;
}

/* ----------------------------------------------------------------
   Code blocks
   ---------------------------------------------------------------- */
pre {
    background: var(--code-bg) !important;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.75rem 0 1.25rem;
    font-size: 0.86rem;
    line-height: 1.65;
    max-width: 100%;
    /* prevent a pre from blowing out its flex/grid parent */
    min-width: 0;
    word-break: normal;
    white-space: pre;
}

code {
    font-family: 'Fira Code', 'Cascadia Mono', 'Consolas', 'Courier New', monospace;
    font-size: 0.875em;
}

:not(pre)>code {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15em 0.4em;
    color: #e6edf3;
}

/* Code block label */
.code-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

/* ----------------------------------------------------------------
   Tables
   ---------------------------------------------------------------- */
.docs-main table,
.page-content table {
    /* enable horizontal scroll on narrow viewports */
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0 1.5rem;
    font-size: 0.875rem;
}

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

th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

td code {
    font-size: 0.82rem;
}

/* ----------------------------------------------------------------
   Callout boxes
   ---------------------------------------------------------------- */
.note,
.tip,
.warning {
    border-radius: 0 6px 6px 0;
    padding: 0.75rem 1rem;
    margin: 1rem 0 1.25rem;
    font-size: 0.9rem;
}

.note {
    background: rgba(31, 111, 235, 0.10);
    border-left: 3px solid var(--accent);
}

.tip {
    background: rgba(63, 185, 80, 0.10);
    border-left: 3px solid var(--success);
}

.warning {
    background: rgba(210, 153, 34, 0.10);
    border-left: 3px solid var(--warning);
}

.note strong,
.tip strong,
.warning strong {
    display: inline-block;
    margin-bottom: 0.2rem;
}

/* ----------------------------------------------------------------
   Method reference block
   ---------------------------------------------------------------- */
.method {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.method-sig {
    font-family: 'Fira Code', 'Cascadia Mono', monospace;
    font-size: 0.9rem;
    color: var(--link);
    margin-bottom: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: pre;
    display: block;
}

.method-desc {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0;
}

/* ----------------------------------------------------------------
   Quick-start section
   ---------------------------------------------------------------- */
.quick-start {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2rem 2.25rem;
    margin: 2.5rem 0;
}

.quick-start h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    border: none;
    padding-top: 0;
}

.steps {
    counter-reset: step;
}

.steps .step {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

/* The text/code content beside the step number bubble */
.steps .step > div {
    flex: 1;
    min-width: 0;   /* allows pre/table children to scroll instead of overflowing */
    overflow: hidden;
}

.steps .step::before {
    counter-increment: step;
    content: counter(step);
    flex-shrink: 0;
    width: 1.6rem;
    height: 1.6rem;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    margin-top: 0.1rem;
}

/* ----------------------------------------------------------------
   Footer
   ---------------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 1.75rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.site-footer a {
    color: var(--text-muted);
}

.site-footer a:hover {
    color: var(--link);
}

/* ----------------------------------------------------------------
   HR divider
   ---------------------------------------------------------------- */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* ----------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    .docs-wrapper {
        flex-direction: column;
    }

    .docs-sidebar {
        position: relative;
        top: 0;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-y: visible;
        padding: 1rem 0;
    }

    .docs-main {
        max-width: 100%;
        padding: 1.5rem 1.25rem 3rem;
        /* ensure the main column itself never overflows the viewport */
        overflow-x: hidden;
    }

    .site-header nav a:not(.logo) {
        font-size: 0.8rem;
    }

    .site-header {
        gap: 1rem;
        padding: 0 1rem;
    }

    /* tighten code blocks on small screens */
    pre {
        font-size: 0.8rem;
        padding: 0.75rem 0.9rem;
    }

    /* quick-start card padding */
    .quick-start {
        padding: 1.25rem 1rem;
    }

    /* method blocks */
    .method {
        padding: 0.75rem 1rem;
    }
}