/**
 * CNL Archive - Stylesheet
 * Location: /Library/WebServer/Documents/Canemah/archive/assets/css/archive.css
 * 
 * Design: Clean, scholarly, readable
 * Typography: System fonts, optimized for technical documents
 */

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

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

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

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
    background: #fafafa;
}

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

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #1a1a1a;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; border-bottom: 1px solid #e0e0e0; padding-bottom: 0.3em; }
h3 { font-size: 1.1rem; }

p {
    margin: 0 0 1em 0;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

.site-header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 2rem;
}

.site-nav {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1a1a1a;
}

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

.nav-links a {
    color: #666;
    font-size: 0.9rem;
}

.nav-links a:hover {
    color: #1a1a1a;
}

main {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.site-footer {
    margin-top: 4rem;
    padding: 2rem;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    font-size: 0.85rem;
    color: #666;
}

.footer-links {
    margin-top: 0.5rem;
}

.footer-links a {
    color: #666;
}

/* ============================================================================
   Archive Browse Page
   ============================================================================ */

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

.archive-header h1 {
    margin-top: 0;
}

.archive-description {
    color: #666;
    font-size: 1rem;
}

.archive-filters {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.9rem;
    color: #666;
}

.filter-group select {
    padding: 0.4rem 0.8rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}

.document-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.document-entry {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1.25rem;
}

.document-entry header {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.document-id {
    font-family: "SF Mono", Monaco, "Courier New", monospace;
    color: #666;
    background: #f5f5f5;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.document-series {
    color: #888;
}

.document-entry h2 {
    font-size: 1.15rem;
    margin: 0 0 0.5rem 0;
    border: none;
    padding: 0;
}

.document-entry h2 a {
    color: #1a1a1a;
}

.document-authors {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.document-abstract {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.document-entry footer {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #888;
    align-items: center;
}

.pdf-link {
    background: #2563eb;
    color: #fff !important;
    padding: 0.25rem 0.6rem;
    border-radius: 3px;
    font-weight: 500;
}

.pdf-link:hover {
    background: #1d4ed8;
    text-decoration: none;
}

/* ============================================================================
   Document View Page
   ============================================================================ */

.document-view article {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 2rem;
}

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

.document-meta-top {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.version-warning {
    background: #fef3c7;
    color: #92400e;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

.document-view h1 {
    margin-top: 0;
    font-size: 1.5rem;
}

.document-view .document-authors {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.document-view .document-authors .author {
    display: block;
    margin-bottom: 0.25rem;
}

.document-view .document-authors .affiliation {
    color: #666;
    font-size: 0.9rem;
}

.document-dates {
    font-size: 0.85rem;
    color: #666;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.document-view section {
    margin-bottom: 2rem;
}

.document-abstract p {
    font-size: 1rem;
    line-height: 1.7;
}

.keyword-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.keyword-list li {
    background: #f3f4f6;
    padding: 0.3rem 0.7rem;
    border-radius: 3px;
    font-size: 0.85rem;
    color: #555;
}

.download-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.download-btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    font-weight: 500;
    text-decoration: none;
}

.download-btn.pdf {
    background: #dc2626;
    color: #fff;
}

.download-btn.pdf:hover {
    background: #b91c1c;
}

.download-btn.source {
    background: #f3f4f6;
    color: #333;
    border: 1px solid #d1d5db;
}

.download-btn.source:hover {
    background: #e5e7eb;
}

.file-info {
    font-weight: normal;
    font-size: 0.85rem;
    opacity: 0.9;
}

.ai-disclosure {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    padding: 1rem;
}

.ai-disclosure h2 {
    margin-top: 0;
    color: #166534;
    border: none;
}

.disclosure-entry {
    margin-bottom: 1rem;
}

.disclosure-entry:last-child {
    margin-bottom: 0;
}

.disclosure-entry p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.human-review {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
}

.version-history table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.version-history th,
.version-history td {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.version-history th {
    font-weight: 600;
    color: #666;
}

.version-history tr.current {
    background: #fef9c3;
}

.citation {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 1rem;
}

.citation h2 {
    margin-top: 0;
    border: none;
}

.citation-text {
    font-family: "SF Mono", Monaco, "Courier New", monospace;
    font-size: 0.85rem;
    background: #fff;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.copy-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.copy-btn:hover {
    background: #1d4ed8;
}

.permanent-url {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

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

.error-page {
    text-align: center;
    padding: 3rem 1rem;
}

.error-page h1 {
    color: #dc2626;
}

.error-page ul {
    text-align: left;
    display: inline-block;
}

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

@media (max-width: 640px) {
    .site-nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .archive-filters {
        flex-direction: column;
    }
    
    .document-dates {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .download-buttons {
        flex-direction: column;
    }
    
    .download-btn {
        text-align: center;
    }
}
/* ============================================================================
   View Tabs (ArXiv-style)
   ============================================================================ */

.view-tabs {
    display: flex;
    gap: 0;
    margin: 1.5rem 0;
    border-bottom: 2px solid #e5e7eb;
}

.view-tab {
    padding: 0.75rem 1.25rem;
    color: #666;
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
    background: #f9fafb;
    border-radius: 4px 4px 0 0;
}

.view-tab:hover {
    color: #1a1a1a;
    background: #f3f4f6;
    text-decoration: none;
}

.view-tab.active {
    color: #1a1a1a;
    background: #fff;
    border-color: #e5e7eb;
    border-bottom-color: #fff;
    font-weight: 500;
}

/* ============================================================================
   HTML Content View Button
   ============================================================================ */

.download-btn.html {
    background: #059669;
    color: #fff;
}

.download-btn.html:hover {
    background: #047857;
}

/* ============================================================================
   Rendered Markdown Content
   ============================================================================ */

.document-content {
    margin: 2rem 0;
}

.rendered-markdown {
    font-size: 1rem;
    line-height: 1.8;
    color: #1a1a1a;
}

.rendered-markdown h1 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e5e7eb;
}

.rendered-markdown h2 {
    font-size: 1.25rem;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

.rendered-markdown h3 {
    font-size: 1.1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

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

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

.rendered-markdown li {
    margin-bottom: 0.5rem;
}

.rendered-markdown blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-left: 4px solid #d1d5db;
    color: #4b5563;
}

.rendered-markdown code {
    font-family: "SF Mono", Monaco, "Courier New", monospace;
    font-size: 0.9em;
    background: #f3f4f6;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.rendered-markdown pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.rendered-markdown pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.rendered-markdown table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.rendered-markdown th,
.rendered-markdown td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    text-align: left;
}

.rendered-markdown th {
    background: #f9fafb;
    font-weight: 600;
}

.rendered-markdown img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
}

.rendered-markdown a {
    color: #2563eb;
}

.rendered-markdown a:hover {
    text-decoration: underline;
}

.rendered-markdown hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 2rem 0;
}

/* ============================================================================
   Responsive Adjustments for Tabs
   ============================================================================ */

@media (max-width: 640px) {
    .view-tabs {
        flex-wrap: wrap;
    }
    
    .view-tab {
        flex: 1 1 auto;
        text-align: center;
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
}