/* ISK Website - Minimal Unix Aesthetic */

:root {
    /* Light mode (default) */
    --bg: #f5f5f5;
    --bg-alt: #e8e8e8;
    --text: #1a1a1a;
    --text-muted: #666;
    --link: #0066cc;
    --link-hover: #004499;
    --border: #ccc;
    --accent: #2d5016;
    --code-bg: #e0e0e0;
    --quote-bg: #eee;
    
    --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'Fira Code', 'SF Mono', 'Monaco', 'Consolas', 'Courier New', monospace;
    --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

[data-theme="dark"] {
    --bg: #0d0d0d;
    --bg-alt: #1a1a1a;
    --text: #e0e0e0;
    --text-muted: #888;
    --link: #6db3f2;
    --link-hover: #9dd1ff;
    --border: #333;
    --accent: #7cb342;
    --code-bg: #1e1e1e;
    --quote-bg: #151515;
}

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

/* Base */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
}

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

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
h3 { font-size: 1.1rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Header */
.header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-title a {
    color: var(--text);
}

.header-title a:hover {
    color: var(--accent);
    text-decoration: none;
}

/* Navigation */
.nav {
    margin-top: 0.75rem;
}

.nav a {
    margin-right: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.nav a.active {
    color: var(--accent);
    font-weight: 600;
}

/* Quote box */
.quote-box {
    background: var(--quote-bg);
    border-left: 3px solid var(--accent);
    padding: 1rem;
    margin-bottom: 2rem;
    font-style: italic;
}

.quote-text {
    margin-bottom: 0.5rem;
}

.quote-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: normal;
}

.quote-author::before {
    content: "— ";
}

/* ASCII art */
.ascii-art {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.15;
    letter-spacing: 0;
    color: var(--accent);
    white-space: pre;
    display: block;
    width: fit-content;
    margin: 0 auto 1rem auto;
    text-align: left;
}

/* Content sections */
.content {
    margin-bottom: 2rem;
}

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

label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--accent);
    border-color: var(--accent);
}

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

button, .btn {
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    cursor: pointer;
}

button:hover, .btn:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--bg-alt);
    color: var(--text);
    border: 1px solid var(--border);
}

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

li {
    margin-bottom: 0.25rem;
}

/* Code */
code {
    font-family: var(--font-mono);
    background: var(--code-bg);
    padding: 0.15rem 0.3rem;
    font-size: 0.9em;
}

pre {
    background: var(--code-bg);
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

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

/* Code blocks from format_content */
.code-block {
    position: relative;
    margin: 1rem 0;
}

.code-block pre {
    margin: 0;
    border-radius: 4px;
}

.code-lang {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--border);
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0 4px 0 4px;
}

/* Cards (for recs, guestbook, TIL) */
.card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    padding: 1rem;
    margin-bottom: 1rem;
}

.card-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* TIL specific */
.til-entry {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--border);
}

.til-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.til-category {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    margin-left: 0.3rem;
    border-radius: 3px;
}

/* Guestbook */
.guestbook-entry {
    margin-bottom: 1.5rem;
}

.guestbook-name {
    font-weight: 600;
    color: var(--accent);
}

.guestbook-message {
    margin: 0.5rem 0;
}

/* Recommendations */
.rec-type {
    display: inline-block;
    background: var(--code-bg);
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Links page */
.link-item {
    margin-bottom: 1rem;
}

.link-item a {
    font-weight: 600;
}

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

/* Theme toggle */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    padding: 0.4rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text);
}

.theme-toggle:hover {
    background: var(--border);
}

/* Man page styling */
.man-page {
    font-size: 0.9rem;
}

.man-section {
    margin-bottom: 1.5rem;
}

.man-section-title {
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.man-content {
    margin-left: 1rem;
}

/* Changelog */
.changelog-entry {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.changelog-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    min-width: 90px;
}

/* Footer */
.footer {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.sdf-badge {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
}

.sdf-badge img {
    display: inline-block;
    image-rendering: pixelated;
}

/* Text-based SDF badge fallback */
.sdf-keys {
    display: inline-flex;
    gap: 2px;
    margin: 0.5rem 0;
}

.sdf-key {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: linear-gradient(180deg, #e8e8e8 0%, #c0c0c0 100%);
    border: 1px solid #888;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: bold;
    line-height: 24px;
    text-align: center;
    color: #333;
    box-shadow: 0 2px 0 #666;
}

[data-theme="dark"] .sdf-key {
    background: linear-gradient(180deg, #444 0%, #333 100%);
    border-color: #555;
    color: #ddd;
    box-shadow: 0 2px 0 #222;
}

/* Admin styles */
.admin-nav {
    background: var(--bg-alt);
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.admin-nav a {
    margin-right: 1rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

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

.admin-table th {
    background: var(--bg-alt);
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
}

.admin-actions a, .admin-actions button {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

/* Messages */
.message {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid;
}

.message-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.message-error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

[data-theme="dark"] .message-success {
    background: #1e3a1e;
    color: #75d675;
}

[data-theme="dark"] .message-error {
    background: #3a1e1e;
    color: #d67575;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 1rem;
    }
    
    .nav a {
        display: inline-block;
        margin-bottom: 0.5rem;
    }
    
    .theme-toggle {
        position: static;
        display: block;
        margin-bottom: 1rem;
    }
}
