/* Codex - Ancient Manuscript Aesthetic */

:root {
    --parchment: #f8f4e8;
    --ink: #1b1b1b;
    --burgundy: #7a2e2e;
    --gold: #bfa46f;
    --shadow: rgba(27, 27, 27, 0.15);
}

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

body {
    font-family: Georgia, 'Times New Roman', serif;
    background-color: var(--parchment);
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 1px,
            rgba(27, 27, 27, 0.02) 2px
        );
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem 1rem;
}

/* Parchment texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Folio card */
.folio {
    background: var(--parchment);
    border: 1px solid rgba(27, 27, 27, 0.2);
    border-radius: 2px;
    padding: 3rem 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px var(--shadow);
    position: relative;
}

.folio::before {
    content: '';
    position: absolute;
    top: 0;
    left: 2rem;
    right: 2rem;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--burgundy), transparent);
}

/* Illuminated drop cap */
.drop-cap::first-letter {
    font-size: 3.5rem;
    line-height: 1;
    float: left;
    margin: 0 0.15rem 0 0;
    color: var(--burgundy);
    font-weight: bold;
}

/* Typography */
h1, h2, h3 {
    color: var(--burgundy);
    font-weight: 600;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: 0.05em;
}

h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid var(--gold);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
}

h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

/* Links */
a {
    color: var(--burgundy);
    text-decoration: none;
    border-bottom: 1px dotted var(--burgundy);
}

a:hover {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--ink);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    padding: 0.75rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1rem;
    border: 1px solid rgba(27, 27, 27, 0.3);
    background: rgba(255, 255, 255, 0.5);
    color: var(--ink);
    border-radius: 2px;
}

input:focus,
textarea:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* Buttons */
button,
.button {
    padding: 0.75rem 1.5rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--parchment);
    background: var(--burgundy);
    border: 1px solid var(--ink);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

button:hover,
.button:hover {
    background: var(--gold);
    color: var(--ink);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--shadow);
}

button:active,
.button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button.secondary {
    background: var(--gold);
    color: var(--ink);
}

button.secondary:hover {
    background: var(--burgundy);
    color: var(--parchment);
}

/* Output section with monospace */
.output {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(27, 27, 27, 0.2);
    padding: 1.5rem;
    border-radius: 2px;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 600px;
    overflow-y: auto;
    background-image: repeating-linear-gradient(
        transparent,
        transparent 23px,
        rgba(27, 27, 27, 0.05) 24px
    );
    line-height: 24px;
}

/* Status badges */
.status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status.success {
    background: rgba(76, 175, 80, 0.2);
    color: #2e7d32;
    border: 1px solid #2e7d32;
}

.status.failure {
    background: rgba(244, 67, 54, 0.2);
    color: #c62828;
    border: 1px solid #c62828;
}

.status.running {
    background: rgba(191, 164, 111, 0.2);
    color: var(--burgundy);
    border: 1px solid var(--burgundy);
}

/* Marginal notes (errors) */
.marginal-note {
    border-left: 3px solid var(--burgundy);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    background: rgba(122, 46, 46, 0.05);
    font-style: italic;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--gold);
}

.tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: var(--ink);
    transition: all 0.2s;
}

.tab:hover {
    color: var(--burgundy);
}

.tab.active {
    border-bottom-color: var(--burgundy);
    color: var(--burgundy);
    font-weight: 600;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(27, 27, 27, 0.1);
}

th {
    font-weight: 600;
    color: var(--burgundy);
    border-bottom: 2px solid var(--gold);
}

tr:hover {
    background: rgba(191, 164, 111, 0.1);
}

/* Details/Summary (collapsible) */
details {
    margin: 1rem 0;
    border: 1px solid rgba(27, 27, 27, 0.2);
    padding: 1rem;
    border-radius: 2px;
}

summary {
    font-weight: 600;
    color: var(--burgundy);
    cursor: pointer;
    user-select: none;
}

summary:hover {
    color: var(--gold);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(27, 27, 27, 0.2);
    font-size: 0.875rem;
    color: rgba(27, 27, 27, 0.6);
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Loader */
.loader {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(27, 27, 27, 0.2);
    border-top-color: var(--burgundy);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .folio {
        padding: 2rem 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .drop-cap::first-letter {
        font-size: 2.5rem;
    }
    
    header nav {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* WCAG AA focus states */
*:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

button:focus,
.button:focus {
    outline-color: var(--parchment);
}

/* Print styles */
@media print {
    body {
        background: white;
        background-image: none;
    }
    
    body::before {
        display: none;
    }
    
    .folio {
        box-shadow: none;
        border: 1px solid black;
    }
    
    button, nav {
        display: none;
    }
}

