/* ── Tabule Theme Documentation Site ────────────────────────────────────────
   Standalone static PHP site for docs.tabuletheme.com
   No WordPress, no framework. Pure CSS with CSS custom properties.
   ────────────────────────────────────────────────────────────────────────── */

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

:root {
    --accent:        #6f8e1d;
    --accent-dark:   #5a7518;
    --accent-light:  #f0f4e8;
    --sidebar-w:     272px;
    --sidebar-bg:    #1a1d23;
    --sidebar-text:  #c9cdd6;
    --sidebar-hover: #2a2e38;
    --sidebar-active-bg: rgba(111,142,29,0.18);
    --sidebar-active: #8ab224;
    --body-bg:       #ffffff;
    --content-bg:    #ffffff;
    --text:          #1a1d23;
    --text-muted:    #6b7280;
    --border:        #e5e7eb;
    --code-bg:       #f3f4f6;
    --code-border:   #e5e7eb;
    --topbar-h:      52px;
    --font:          'Libre Franklin', system-ui, sans-serif;
    --radius:        6px;
    --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--body-bg);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

img { max-width: 100%; height: auto; display: block; }

/* ── Layout shell ──────────────────────────────────────────────────────── */

.tbl-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
}

.tbl-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Sidebar header ────────────────────────────────────────────────────── */

.tbl-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.tbl-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: #fff;
    font-weight: 700;
    font-size: 0.9375rem;
    text-decoration: none;
}
.tbl-logo:hover { text-decoration: none; color: #fff; }

.tbl-version {
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(111,142,29,.3);
    color: var(--sidebar-active);
    padding: 2px 8px;
    border-radius: 99px;
    letter-spacing: 0.03em;
}

/* ── Sidebar nav ───────────────────────────────────────────────────────── */

.tbl-nav {
    padding: 0.75rem 0 2rem;
    flex: 1;
}

.tbl-nav-section { }

.tbl-nav-section-title {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #fff;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    text-align: left;
    margin-top: 0.5rem;
}
.tbl-nav-section-title:hover { color: #fff; }

.tbl-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.5;
}
.tbl-nav-section.is-open .tbl-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

.tbl-nav-items {
    list-style: none;
    display: none;
    padding-bottom: 0.25rem;
}
.tbl-nav-section.is-open .tbl-nav-items {
    display: block;
}

.tbl-nav-link {
    display: block;
    padding: 0.375rem 1.25rem 0.375rem 1.5rem;
    font-size: 0.875rem;
    color: var(--sidebar-text);
    border-left: 2px solid transparent;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}
.tbl-nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}
.tbl-nav-link.is-active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    border-left-color: var(--accent);
    font-weight: 600;
}

/* ── Mobile top bar ────────────────────────────────────────────────────── */

.tbl-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    background: var(--sidebar-bg);
    align-items: center;
    padding: 0 1rem;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.tbl-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #fff;
    padding: 6px;
    display: flex;
    align-items: center;
    border-radius: var(--radius);
}
.tbl-menu-btn:hover { background: rgba(255,255,255,.1); }

.tbl-topbar-logo {
    font-weight: 700;
    font-size: 0.9375rem;
    color: #fff;
    flex: 1;
    text-decoration: none;
}
.tbl-topbar-logo:hover { color: #fff; text-decoration: none; }

.tbl-topbar-link {
    font-size: 0.8125rem;
    color: var(--sidebar-text);
    white-space: nowrap;
    text-decoration: none;
}
.tbl-topbar-link:hover { color: #fff; text-decoration: none; }

/* Mobile sidebar overlay */
.tbl-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.25s;
}
.tbl-sidebar-overlay.is-visible {
    display: block;
    opacity: 1;
}

/* ── Content area ──────────────────────────────────────────────────────── */

.tbl-content {
    flex: 1;
    padding: 2.5rem 3rem;
    max-width: 860px;
    width: 100%;
}

/* ── Breadcrumb ────────────────────────────────────────────────────────── */

.tbl-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.tbl-breadcrumb a { color: var(--text-muted); }
.tbl-breadcrumb a:hover { color: var(--accent); text-decoration: none; }
.tbl-breadcrumb span[aria-current] { color: var(--text); }

/* ── Article typography ────────────────────────────────────────────────── */

.tbl-article h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.tbl-article h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 2.5rem 0 0.75rem;
}

.tbl-article h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    margin: 1.75rem 0 0.5rem;
}

.tbl-article p {
    margin-bottom: 1.125rem;
    font-size: 0.9375rem;
    color: #374151;
    line-height: 1.75;
}

.tbl-article ul, .tbl-article ol {
    margin: 0 0 1.125rem 1.5rem;
    font-size: 0.9375rem;
    color: #374151;
    line-height: 1.75;
}
.tbl-article li { margin-bottom: 0.375rem; }

.tbl-article strong { font-weight: 600; color: var(--text); }

.tbl-article a { color: var(--accent); }
.tbl-article a:hover { text-decoration: underline; }

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

/* Inline code */
.tbl-article code {
    font-family: 'Fira Mono', 'Courier New', monospace;
    font-size: 0.8375em;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    padding: 1px 5px;
    border-radius: 3px;
    color: #b91c1c;
}

/* Code blocks */
.tbl-article pre {
    background: #1e2130;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 0 0 1.5rem;
}
.tbl-article pre code {
    background: none;
    border: none;
    padding: 0;
    color: #e2e8f0;
    font-size: 0.875rem;
    line-height: 1.7;
}

/* Note / tip / warning boxes */
.tbl-note {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.6;
}
.tbl-note-icon { flex-shrink: 0; font-size: 1rem; margin-top: 1px; }
.tbl-note p { margin: 0; font-size: inherit; color: inherit; }
.tbl-note.tip    { background: var(--accent-light); border-left: 3px solid var(--accent); color: #374151; }
.tbl-note.warn   { background: #fffbeb; border-left: 3px solid #f59e0b; color: #374151; }
.tbl-note.info   { background: #eff6ff; border-left: 3px solid #3b82f6; color: #374151; }

/* Step list */
.tbl-steps {
    counter-reset: steps;
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}
.tbl-steps li {
    counter-increment: steps;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    color: #374151;
    line-height: 1.75;
}
.tbl-steps li::before {
    content: counter(steps);
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

/* ── Tables ────────────────────────────────────────────────────────────── */
.tbl-article table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin: 0 0 1.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tbl-article table thead tr {
    background: #f3f4f6;
    border-bottom: 2px solid var(--border);
}
.tbl-article table th {
    font-weight: 600;
    text-align: left;
    padding: 0.625rem 1rem;
    color: var(--text);
    white-space: nowrap;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.tbl-article table td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
    line-height: 1.5;
}
.tbl-article table tbody tr:last-child td { border-bottom: none; }
.tbl-article table tbody tr:nth-child(even) { background: #f9fafb; }
.tbl-article table td code {
    font-size: 0.82em;
    white-space: nowrap;
}

/* Screenshot / image wrapper */
.tbl-img-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}
.tbl-img-wrap img { width: 100%; }
.tbl-img-caption {
    background: #f9fafb;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ── Prev/Next pager ───────────────────────────────────────────────────── */

.tbl-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.tbl-pager-link {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tbl-pager-link:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(111,142,29,.1);
    text-decoration: none;
    color: var(--text);
}
.tbl-pager-next { text-align: right; }

.tbl-pager-dir {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}
.tbl-pager-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.tbl-footer {
    padding: 1.5rem 3rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
.tbl-footer a { color: var(--text-muted); }
.tbl-footer a:hover { color: var(--accent); text-decoration: none; }

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .tbl-sidebar {
        transform: translateX(-100%);
    }
    .tbl-sidebar.is-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,.3);
    }
    .tbl-main {
        margin-left: 0;
    }
    .tbl-topbar {
        display: flex;
    }
    .tbl-content {
        padding: 1.5rem 1.25rem;
    }
    .tbl-footer {
        padding: 1.25rem;
    }
    .tbl-pager {
        grid-template-columns: 1fr;
    }
    .tbl-pager-next { text-align: left; }
    .tbl-attr-table { display: block; overflow-x: auto; }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .tbl-content { padding: 2rem 2rem; }
}
