/* Hindsight Website - Main Stylesheet */
/* Matches sphinx_rtd_theme color scheme */

/* ============================================================
   Reset & Base Styles
   ============================================================ */

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

html {
    font-size: 16px;
    line-height: 1.6;
}

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

/* ============================================================
   Typography
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    margin: 1.5rem 0 1rem 0;
    line-height: 1.3;
    font-weight: 600;
    color: #2c3e50;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; border-bottom: 2px solid #e1e4e5; padding-bottom: 0.3rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin: 1rem 0;
}

a {
    color: #2980B9;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #3091d1;
    text-decoration: underline;
}

code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    background-color: #f8f8f8;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    border: 1px solid #e1e4e5;
}

pre {
    background-color: #f8f8f8;
    border: 1px solid #e1e4e5;
    border-left: 4px solid #3776ab;
    padding: 1rem;
    overflow-x: auto;
    border-radius: 3px;
    margin: 1rem 0;
}

pre code {
    background: none;
    border: none;
    padding: 0;
}

/* Override pre styles when inside sourceCode div */
.sourceCode pre {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

/* ============================================================
   Layout
   ============================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.main-content {
    flex: 1;
    padding: 3rem 0;
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
    background-color: #2980B9;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.site-title a {
    color: white;
    text-decoration: none;
}

.site-title a:hover {
    color: #ecf0f1;
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap: 2rem;
}

.site-nav a {
    color: white;
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}

.site-nav a:hover {
    border-bottom-color: white;
    text-decoration: none;
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

.site-footer p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.site-footer a {
    color: #3498db;
}

.site-footer a:hover {
    color: #5dade2;
}

/* ============================================================
   Syntax Highlighting (Pygments-compatible)
   ============================================================ */

div.sourceCode {
    background-color: #f8f8f8;
    border-left: 4px solid #3776ab;
    padding: 1rem;
    overflow-x: auto;
    border-radius: 3px;
    margin: 1rem 0;
    color: #333;
}

.sourceCode code {
    color: #333;
    background: transparent;
}

.sourceCode .kw { color: #007020; font-weight: bold; } /* Keyword */
.sourceCode .dt { color: #902000; font-weight: bold; } /* DataType */
.sourceCode .dv { color: #40a070; } /* DecVal */
.sourceCode .bn { color: #40a070; } /* BaseN */
.sourceCode .fl { color: #40a070; } /* Float */
.sourceCode .ch { color: #4070a0; } /* Char */
.sourceCode .st { color: #4070a0; } /* String */
.sourceCode .co { color: #408090; font-style: italic; } /* Comment */
.sourceCode .ot { color: #007020; } /* Other */
.sourceCode .al { color: #ff0000; font-weight: bold; } /* Alert */
.sourceCode .fu { color: #06287e; } /* Function */
.sourceCode .er { color: #ff0000; font-weight: bold; } /* Error */
.sourceCode .wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
.sourceCode .cn { color: #880000; } /* Constant */
.sourceCode .sc { color: #4070a0; } /* SpecialChar */
.sourceCode .vs { color: #4070a0; } /* VerbatimString */
.sourceCode .ss { color: #bb6688; } /* SpecialString */
.sourceCode .im { color: #333; } /* Import */
.sourceCode .va { color: #19177c; } /* Variable */
.sourceCode .cf { color: #007020; font-weight: bold; } /* ControlFlow */
.sourceCode .op { color: #666666; } /* Operator */
.sourceCode .pp { color: #bc7a00; } /* Preprocessor */
.sourceCode .do { color: #ba2121; font-style: italic; } /* Documentation */
.sourceCode .an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
.sourceCode .cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */

/* Kill all line number artifacts */
.sourceCode a {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Remove borders from all spans in code blocks */
.sourceCode span,
.sourceCode pre span,
.sourceCode code span,
.sourceCode pre code span {
    border: none !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: none !important;
    padding-left: 0;
    margin-left: 0;
    box-shadow: none !important;
    outline: none !important;
}

/* Specifically target line wrapper spans */
code.sourceCode > span {
    border: none !important;
}

/* ============================================================
   Code Carousel
   ============================================================ */

.code-carousel {
    margin: 3rem 0;
    background: white;
    border: 1px solid #e1e4e5;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.carousel-tabs {
    display: flex;
    border-bottom: 2px solid #e1e4e5;
    background-color: #f9f9f9;
    border-radius: 6px 6px 0 0;
    overflow-x: auto;
}

.carousel-tab {
    flex: 1;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    color: #666;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: fit-content;
}

.carousel-tab:hover {
    background-color: #f0f0f0;
    color: #2980B9;
}

.carousel-tab.active {
    color: #2980B9;
    border-bottom-color: #2980B9;
    background-color: white;
}

.carousel-content {
    padding: 2rem;
}

.carousel-panel {
    display: none;
}

.carousel-panel.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.carousel-panel h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.25rem;
}

.carousel-panel p {
    margin-bottom: 1rem;
    color: #555;
}

.carousel-panel .sourceCode {
    margin-top: 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ============================================================
   Home Page Specific
   ============================================================ */

.cta-buttons {
    margin: 2rem 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.btn-primary {
    background-color: #2980B9;
    color: white;
}

.btn-primary:hover {
    background-color: #3091d1;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-secondary {
    background-color: white;
    color: #2980B9;
    border-color: #2980B9;
}

.btn-secondary:hover {
    background-color: #2980B9;
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* ============================================================
   Blog
   ============================================================ */

.blog-archive h1 {
    margin-bottom: 2rem;
}

.post-list {
    list-style: none;
}

.post-list li {
    margin-bottom: 2rem;
}

.post-preview h2 {
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
    border-bottom: none;
}

.post-preview time {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* ============================================================
   Blog Post
   ============================================================ */

.post-header {
    margin-bottom: 2rem;
}

.post-title {
    margin-bottom: 0.5rem;
}

.post-meta {
    color: #7f8c8d;
    font-size: 0.95rem;
}

.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

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

@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .site-nav {
        flex-direction: column;
        gap: 0.5rem;
    }

    .container {
        padding: 0 1rem;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }

    .cta-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .carousel-tab {
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
    }

    .carousel-content {
        padding: 1rem;
    }

    .carousel-panel .sourceCode {
        font-size: 0.8rem;
    }
}
