@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&amp;display=swap');

:root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface-2: #242424;
    --text: #f5f5f5;
    --text-muted: #a0a0a0;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --border: #333;
    --nav-bg: rgba(15, 15, 15, 0.95);
}

.light {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --surface-2: #f1f3f5;
    --text: #1f2937;
    --text-muted: #6b7280;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --border: #e5e7eb;
    --nav-bg: rgba(248, 249, 250, 0.95);
}

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

body {
    font-family: 'Inter', system_ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    transition: background-color 0.3s ease, color 0.3s ease;
}

nav {
    background: transparent;
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

/* Pinned to the top-left corner; the tall widget bleeds down beside the
   centered intro so it doesn't consume vertical space of its own. */
.webring {
    position: absolute;
    top: 0.75rem;
    left: 1.25rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

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

.theme-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--surface-2);
    transform: scale(1.05);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.intro {
    max-width: 680px;
    margin: 2rem auto 3.5rem;
    padding: 0 1.5rem;
    text-align: center;
}

.intro h1 {
    font-size: 2.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.15;
}

.intro p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.contact {
    margin-top: 1.25rem;
}

.contact a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.section {
    max-width: 1100px;
    margin: 0 auto 4rem;
    padding: 0 1.5rem;
}

.section h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.character-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.char-row {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.35rem;
    transition: all 0.2s ease;
}

.char-row:hover {
    border-color: #555;
    background: var(--surface-2);
}

.light .char-row:hover {
    border-color: #ccc;
}

.char-image {
    width: 92px;
    height: 138px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.char-main {
    flex: 1;
    min-width: 0;
}

.char-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    line-height: 1.2;
}

.char-desc {
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.6;
    margin-bottom: 0.9rem;
}

.char-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Subtle download button (matches theme toggle style) */
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

button.download-btn {
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
}

.download-btn:hover {
    background: var(--surface-2);
    transform: scale(1.02);
}

.download-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.25;
    fill: none;
}

footer {
    max-width: 1100px;
    margin: 4rem auto 0;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

/* --- Card detail pages --- */
.card-page {
    max-width: 800px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
}

.card-header {
    display: flex;
    gap: 1.75rem;
    align-items: flex-start;
    margin-bottom: 2.5rem;
}

.card-header img {
    width: 200px;
    border-radius: 12px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.card-header h1 {
    font-size: 1.9rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.card-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.card-page .section {
    max-width: none;
    padding: 0;
    margin: 0 0 2.5rem;
}

.field-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
}

.field-text {
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.6;
    overflow-wrap: break-word;
}

.field-text p,
.field-text ul {
    margin: 0 0 0.9rem;
}

.field-text ul {
    padding-left: 1.4rem;
}

.field-text p:last-child,
.field-text ul:last-child {
    margin-bottom: 0;
}

.field-text h4 {
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 1.3rem 0 0.6rem;
}

.field-text h4:first-child {
    margin-top: 0;
}

.field-text hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.2rem 0;
}

.field-text code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.05em 0.35em;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .card-header .char-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .nav-inner {
        padding: 1rem;
    }

    .intro {
        margin: 2rem auto 2.5rem;
        padding: 0 1rem;
    }

    /* On small screens there is no room beside the title: back into the flow */
    .webring {
        position: static;
        display: flex;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .intro h1 {
        font-size: 1.75rem;
    }

    .section {
        padding: 0 1rem;
    }

    .char-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.25rem 1rem;
    }

    .char-image {
        width: 110px;
        height: 165px;
        margin-bottom: 0.75rem;
    }

    .char-main {
        text-align: center;
    }

    .char-actions {
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .char-image {
        width: 95px;
        height: 142px;
    }
}