/* ============================================
   Koldy PHP Framework — Website Styles
   ============================================ */

/* --- Reset & Base --- */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1a1a2e;
    line-height: 1.65;
    background: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

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

a {
    color: #2d8a9c;
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: #1e6b7a;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    font-weight: 600;
}

code {
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", "Liberation Mono", monospace;
    font-size: 0.875em;
    background: #f0f4f8;
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
    border-radius: 0;
}

/* --- Container --- */

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Navigation --- */

.main-nav {
    background: #fff;
    border-bottom: 1px solid #e8ecf1;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #3EB1C8;
    font-weight: 700;
    font-size: 1.125rem;
    text-decoration: none;
}

.nav-logo:hover {
    color: #2d8a9c;
}

.nav-logo svg {
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: #555;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #3EB1C8;
    border-bottom-color: #3EB1C8;
}

/* Hamburger (CSS-only) */
.nav-toggle {
    display: none;
}

.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
}

.nav-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #1a1a2e;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

@media (max-width: 640px) {
    .nav-hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 1px solid #e8ecf1;
        flex-direction: column;
        padding: 1rem 1.5rem;
        gap: 0;
    }

    .nav-links a {
        padding: 0.75rem 0;
        border-bottom: 1px solid #f0f4f8;
    }

    .nav-links a:last-child {
        border-bottom: none;
    }

    .nav-toggle:checked ~ .nav-links {
        display: flex;
    }

    .nav-toggle:checked ~ .nav-hamburger span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle:checked ~ .nav-hamburger span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle:checked ~ .nav-hamburger span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}

/* --- Hero --- */

.hero {
    background: linear-gradient(135deg, #3EB1C8 0%, #2d8a9c 50%, #1e6b7a 100%);
    color: #fff;
    padding: 5rem 0 4rem;
    text-align: center;
}

.hero-logo {
    width: 180px;
    height: auto;
    margin: 0 auto 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
    max-width: 540px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.hero-install {
    margin-top: 0.5rem;
}

.hero-install code {
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    display: inline-block;
}

/* --- Buttons --- */

.btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    cursor: pointer;
    border: 2px solid transparent;
}

.btn-white {
    background: #fff;
    color: #2d8a9c;
}

.btn-white:hover {
    background: #f0f9fa;
    color: #1e6b7a;
}

.btn-outline {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}

.btn-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: #fff;
    color: #fff;
}

.btn-primary {
    background: #3EB1C8;
    color: #fff;
}

.btn-primary:hover {
    background: #2d8a9c;
    color: #fff;
}

.btn-secondary {
    background: transparent;
    color: #3EB1C8;
    border-color: #3EB1C8;
}

.btn-secondary:hover {
    background: #f0f9fa;
    color: #2d8a9c;
}

/* --- Features Section --- */

.features {
    padding: 5rem 0;
    background: #f7f9fb;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.feature-card {
    background: #fff;
    border-radius: 10px;
    padding: 2rem;
    border: 1px solid #e8ecf1;
    transition: box-shadow 0.2s;
}

.feature-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.feature-highlight {
    border-color: #3EB1C8;
    border-width: 2px;
    position: relative;
}

.feature-highlight::before {
    content: "Key differentiator";
    position: absolute;
    top: -0.75rem;
    left: 1.5rem;
    background: #3EB1C8;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.feature-icon {
    color: #3EB1C8;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: #555;
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

.feature-card p:last-child {
    margin-bottom: 0;
}

/* --- Included Section --- */

.included {
    padding: 5rem 0;
}

.included h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

.included-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.included-card {
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e8ecf1;
}

.included-card h4 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    color: #1a1a2e;
}

.included-card p {
    color: #555;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* --- Code Example Section --- */

.code-example {
    padding: 5rem 0;
    background: #f7f9fb;
}

.code-example h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

.code-columns {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    align-items: start;
}

.code-block {
    background: #1e293b;
    border-radius: 10px;
    overflow: hidden;
}

.code-header {
    background: #15202e;
    color: #94a3b8;
    padding: 0.75rem 1.25rem;
    font-size: 0.8rem;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
    border-bottom: 1px solid #2d3f54;
}

.code-block pre {
    padding: 1.25rem;
    overflow-x: auto;
    line-height: 1.7;
}

.code-block pre code {
    color: #e2e8f0;
    font-size: 0.825rem;
}

/* Syntax highlighting (CSS only) */
.code-block .kw { color: #c792ea; }
.code-block .cl { color: #82aaff; }
.code-block .fn { color: #82aaff; }
.code-block .st { color: #c3e88d; }
.code-block .vr { color: #f78c6c; }
.code-block .cm { color: #676e95; font-style: italic; }

.code-explanation {
    padding-top: 1rem;
}

.code-explanation h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.code-explanation ul {
    list-style: none;
    padding: 0;
}

.code-explanation li {
    padding: 0.4rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #555;
    font-size: 0.9375rem;
}

.code-explanation li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.85rem;
    width: 8px;
    height: 8px;
    background: #3EB1C8;
    border-radius: 50%;
}

.link-arrow {
    display: inline-block;
    margin-top: 1.5rem;
    font-weight: 600;
    color: #3EB1C8;
}

.link-arrow:hover {
    color: #1e6b7a;
}

.link-arrow::after {
    content: " \2192";
}

/* --- CTA Section --- */

.cta {
    padding: 5rem 0;
    text-align: center;
}

.cta h2 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.cta p {
    color: #555;
    font-size: 1.05rem;
    margin-bottom: 2rem;
}

.cta-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Footer --- */

.main-footer {
    background: #1a1a2e;
    color: #94a3b8;
    padding: 2.5rem 0;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #cbd5e1;
    font-weight: 600;
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: #94a3b8;
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: #e2e8f0;
}

.footer-install code {
    background: rgba(255,255,255,0.08);
    color: #94a3b8;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ============================================
   Documentation Pages
   ============================================ */

/* --- Docs Header --- */

.docs-header {
    background: linear-gradient(135deg, #3EB1C8 0%, #2d8a9c 100%);
    color: #fff;
    padding: 3rem 0;
}

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

.docs-header p {
    opacity: 0.9;
    font-size: 1.05rem;
}

/* --- Docs Listing --- */

.docs-listing {
    padding: 3rem 0 5rem;
}

.docs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.doc-card {
    display: block;
    background: #fff;
    border: 1px solid #e8ecf1;
    border-radius: 8px;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    position: relative;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.doc-card:hover {
    border-color: #3EB1C8;
    box-shadow: 0 2px 12px rgba(62,177,200,0.1);
    color: inherit;
}

.doc-card h3 {
    font-size: 1.05rem;
    color: #1a1a2e;
    margin-bottom: 0.35rem;
}

.doc-card p {
    color: #555;
    font-size: 0.875rem;
    line-height: 1.5;
}

.doc-card-arrow {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: #3EB1C8;
    font-size: 1.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.doc-card:hover .doc-card-arrow {
    opacity: 1;
}

/* --- Docs Layout (Sidebar + Content) --- */

.docs-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    max-width: 1120px;
    margin: 0 auto;
    min-height: calc(100vh - 180px);
}

.docs-sidebar {
    border-right: 1px solid #e8ecf1;
    padding: 2rem 1.5rem;
    position: sticky;
    top: 60px;
    height: fit-content;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

.docs-nav h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 1rem;
}

.docs-nav a {
    display: block;
    padding: 0.35rem 0.75rem;
    margin: 0 -0.75rem;
    font-size: 0.875rem;
    color: #555;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
}

.docs-nav a:hover {
    background: #f0f4f8;
    color: #1a1a2e;
}

.docs-nav a.active {
    background: #e8f6f8;
    color: #2d8a9c;
    font-weight: 600;
}

/* --- Markdown Content --- */

.docs-content {
    padding: 2rem 3rem 4rem;
    min-width: 0;
}

.markdown-body h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e8ecf1;
}

.markdown-body h2 {
    font-size: 1.4rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #f0f4f8;
}

.markdown-body h3 {
    font-size: 1.15rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.markdown-body h4 {
    font-size: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.markdown-body p {
    margin-bottom: 1rem;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.35rem;
}

.markdown-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    line-height: 1.65;
}

.markdown-body pre code {
    color: #e2e8f0;
    font-size: 0.825rem;
}

.markdown-body blockquote {
    border-left: 3px solid #3EB1C8;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: #f7f9fb;
    color: #555;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.markdown-body th {
    background: #f7f9fb;
    text-align: left;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e8ecf1;
    font-weight: 600;
}

.markdown-body td {
    padding: 0.6rem 0.75rem;
    border: 1px solid #e8ecf1;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid #e8ecf1;
    margin: 2.5rem 0;
}

/* ============================================
   Error Page
   ============================================ */

.error-page {
    padding: 6rem 0 5rem;
    text-align: center;
    min-height: calc(100vh - 240px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #f7f9fb;
}

.error-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 280px;
    color: #e8ecf1;
    opacity: 0.35;
    pointer-events: none;
    user-select: none;
}

.error-bg svg {
    width: 100%;
    height: 100%;
}

.error-inner {
    max-width: 600px;
    position: relative;
    z-index: 1;
}

.error-code {
    font-size: 10rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #3EB1C8 0%, #2d8a9c 60%, #1e6b7a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 8px rgba(62, 177, 200, 0.15));
}

.error-page h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #1a1a2e;
    letter-spacing: -0.01em;
}

.error-message {
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

.error-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Debug panel (collapsible) */

.error-debug {
    margin-top: 3rem;
    text-align: left;
    background: #1e293b;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.error-debug-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #15202e;
    color: #94a3b8;
    padding: 0.75rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
    border-bottom: 1px solid #2d3f54;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.15s;
}

.error-debug-header::-webkit-details-marker {
    display: none;
}

.error-debug-header:hover {
    background: #1a2a3d;
}

.error-debug-chevron {
    transition: transform 0.2s;
    flex-shrink: 0;
}

.error-debug[open] .error-debug-chevron {
    transform: rotate(180deg);
}

.error-debug-body {
    padding: 1.25rem;
}

.error-debug-section {
    margin-bottom: 1rem;
}

.error-debug-section:last-child {
    margin-bottom: 0;
}

.error-debug-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 0.35rem;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
}

.error-debug-value {
    color: #f8b4b4;
    font-size: 0.85rem;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
    word-break: break-word;
}

.error-debug pre {
    margin: 0;
    overflow-x: auto;
}

.error-debug pre code {
    color: #cbd5e1;
    font-size: 0.775rem;
    line-height: 1.7;
    background: none;
    padding: 0;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 900px) {
    .features-grid {
        grid-template-columns: 1fr;
    }

    .included-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .code-columns {
        grid-template-columns: 1fr;
    }

    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: static;
        border-right: none;
        border-bottom: 1px solid #e8ecf1;
        max-height: none;
        padding: 1.5rem;
    }

    .docs-nav a {
        display: inline-block;
        margin: 0.15rem 0.25rem;
        padding: 0.3rem 0.6rem;
    }

    .docs-content {
        padding: 2rem 1.5rem 4rem;
    }
}

@media (max-width: 640px) {
    .hero {
        padding: 3.5rem 0 3rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .features, .included, .code-example, .cta {
        padding: 3rem 0;
    }

    .error-page {
        padding: 4rem 0 3rem;
    }

    .error-code {
        font-size: 6rem;
    }

    .error-bg {
        width: 200px;
        height: 200px;
    }

    .included-grid {
        grid-template-columns: 1fr;
    }

    .docs-grid {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }
}
