@charset "utf-8";

/**
 * Dark theme for Open Conjecture Formalizations
 * Matches SamuelSchlesinger.github.io main site
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
    --bg-color: #0f111e;
    --bg-secondary: #161a2c;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --heading-color: #ffffff;
    --link-color: #3c92ff;
    --link-hover: #0fccce;
    --link-active: #3c92ff;
    --border-color: #2a304a;
    --code-bg: #1a1f35;
    --code-border: #2a304a;
    --blockquote-bg: #181e33;
    --accent-color: #f7931a;
    --accent-secondary: #627eea;
    --accent-tertiary: #2775ca;
    --card-bg: rgba(26, 31, 53, 0.7);
    --card-border: rgba(42, 48, 74, 0.7);
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    --nav-bg: rgba(15, 17, 30, 0.8);
    --focus-ring: 0 0 0 3px rgba(247, 147, 26, 0.4);
    --hover-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    scroll-padding-top: 100px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    margin: 0;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

body.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Layout */
.page-wrapper {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

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

.content-wrapper {
    display: flex;
    flex: 1;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    line-height: 1.2;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: var(--heading-color);
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.03em;
    margin-top: 0;
}

h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; color: var(--text-muted); }

p {
    margin: 1.25rem 0;
    font-size: 1rem;
    line-height: 1.7;
}

strong, b { font-weight: 600; }

/* Links */
a, a:visited {
    color: var(--link-color);
    text-decoration: none;
    transition: var(--hover-transition);
    position: relative;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
}

a:hover {
    color: var(--link-hover);
    background-color: rgba(107, 162, 255, 0.1);
}

a:active {
    color: var(--link-active);
}

a:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Lists */
ul, ol {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

li { margin: 0.5rem 0; }

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.site-title a {
    color: var(--heading-color);
    text-decoration: none;
    padding: 0;
}

.site-title a:hover {
    background: none;
    color: var(--accent-color);
}

/* Top Navigation */
nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    gap: 0.25rem;
}

nav li { margin: 0; }

nav a {
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 6px;
}

nav a:hover {
    background-color: rgba(107, 162, 255, 0.15);
}

nav a.active {
    background-color: rgba(247, 147, 26, 0.15);
    color: var(--accent-color);
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    width: 30px;
    height: 30px;
    position: relative;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--heading-color);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s ease;
}

.mobile-menu-toggle span:nth-child(1) { top: 7px; }
.mobile-menu-toggle span:nth-child(2) { top: 14px; }
.mobile-menu-toggle span:nth-child(3) { top: 21px; }

.mobile-menu-toggle.active span:nth-child(1) {
    top: 14px;
    transform: translateX(-50%) rotate(45deg);
}
.mobile-menu-toggle.active span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle.active span:nth-child(3) {
    top: 14px;
    transform: translateX(-50%) rotate(-45deg);
}

/* Sidebar */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-right: 1rem;
    border-right: 1px solid var(--border-color);
}

.sidebar-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    margin: 0;
}

.sidebar a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-radius: 6px;
    transition: var(--hover-transition);
}

.sidebar a:hover {
    color: var(--heading-color);
    background-color: rgba(107, 162, 255, 0.1);
}

.sidebar a.active {
    color: var(--accent-color);
    background-color: rgba(247, 147, 26, 0.1);
    font-weight: 500;
}

.sidebar .sub-nav {
    padding-left: 1rem;
    margin-top: 0.25rem;
}

.sidebar .sub-nav a {
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
}

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;
    padding-bottom: 4rem;
}

.main-content > h1:first-child {
    background: linear-gradient(135deg, var(--heading-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

table th, table td {
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    text-align: left;
}

table th {
    background-color: var(--bg-secondary);
    font-weight: 600;
    color: var(--heading-color);
    position: sticky;
    top: 60px;
    z-index: 10;
}

table tr {
    background-color: transparent;
    transition: background-color 0.2s ease;
}

table tr:nth-child(even) {
    background-color: rgba(22, 26, 44, 0.3);
}

table tr:hover {
    background-color: rgba(107, 162, 255, 0.05);
}

/* Responsive table wrapper */
.table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.table-wrapper table {
    margin: 0;
}

.table-wrapper table th:first-child,
.table-wrapper table td:first-child {
    border-left: none;
}

.table-wrapper table th:last-child,
.table-wrapper table td:last-child {
    border-right: none;
}

.table-wrapper table tr:first-child th {
    border-top: none;
}

.table-wrapper table tr:last-child td {
    border-bottom: none;
}

/* Code */
code, pre {
    font-family: 'JetBrains Mono', 'Fira Code', 'Roboto Mono', Consolas, Monaco, monospace;
    border-radius: 3px;
    background-color: var(--code-bg);
    color: var(--text-color);
}

code {
    border: 1px solid var(--code-border);
    margin: 0 2px;
    padding: 2px 5px;
    font-size: 0.85em;
}

pre {
    border: 1px solid var(--code-border);
    line-height: 1.4;
    overflow: auto;
    padding: 1rem;
    margin: 1.5rem 0;
}

pre > code {
    border: 0;
    margin: 0;
    padding: 0;
    font-size: 0.85em;
    background-color: transparent;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid var(--accent-color);
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    background-color: var(--blockquote-bg);
    border-radius: 3px;
    margin: 1.5rem 0;
}

/* HR */
hr {
    height: 1px;
    border: 0;
    background-color: var(--border-color);
    margin: 2rem 0;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Back link styling */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.back-link:hover {
    color: var(--link-hover);
}

/* Footer */
footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 1rem;
}

.footer-links li { margin: 0; }

.footer-links a {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    color: var(--heading-color);
}

.footer-links a:hover {
    border-color: var(--accent-color);
    background: none;
    transform: translateY(-2px);
}

.footer-links a i {
    margin-right: 0.5rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Media Queries */
@media (max-width: 768px) {
    html { font-size: 14px; }

    .content-wrapper {
        flex-direction: column;
        padding: 1rem;
    }

    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .mobile-menu-toggle {
        display: block;
    }

    nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        background-color: var(--bg-color);
        z-index: 200;
        transition: left 0.3s ease;
        padding-top: 5rem;
    }

    nav.active {
        left: 0;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    nav a {
        font-size: 1.1rem;
        padding: 0.75rem 1.5rem;
        display: block;
        text-align: center;
    }

    .header-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

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

    table {
        font-size: 0.8rem;
    }

    table th, table td {
        padding: 0.5rem;
    }

    h1 { font-size: 2rem; }
}

@media (max-width: 480px) {
    .footer-links {
        flex-direction: column;
        width: 100%;
    }

    .footer-links a {
        width: 100%;
        justify-content: center;
    }
}
