/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0a;
    --bg-surface: #111111;
    --bg-elevated: #181818;
    --bg-hover: #1e1e1e;
    --border: #222222;
    --border-hover: #333333;
    --text: #e8e8e8;
    --text-secondary: #999999;
    --text-muted: #666666;
    --accent: #dc2626;
    --accent-hover: #b91c1c;
    --accent-dim: rgba(220, 38, 38, 0.08);
    --green: #22c55e;
    --yellow: #eab308;
    --radius: 8px;
    --radius-lg: 12px;
    --max-width: 800px;
    --header-height: 64px;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    display: block;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.875em;
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

pre {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    overflow-x: auto;
    margin: 24px 0;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.7;
}

/* ===== LAYOUT ===== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.page-content {
    flex: 1;
    padding-top: calc(var(--header-height) + 40px);
    padding-bottom: 80px;
}

/* ===== HEADER / NAV ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.site-logo img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.site-logo:hover {
    color: var(--text);
}

.site-logo .logo-accent {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
}

.nav-links a {
    display: block;
    padding: 6px 14px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    transition: color 0.2s;
}

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

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

.nav-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    color: var(--text);
    cursor: pointer;
}

.nav-toggle svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* ===== HERO ===== */
.hero {
    padding: 64px 0 48px;
}

.hero-inner {
    display: flex;
    align-items: flex-start;
    gap: 32px;
}

.hero-avatar {
    flex-shrink: 0;
}

.hero-avatar img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.hero-content {
    flex: 1;
}

.hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 8px;
}

.hero .subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.65;
    max-width: 480px;
}

.hero-stats {
    display: flex;
    gap: 32px;
    margin-top: 24px;
}

.hero-stat .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.hero-stat .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== DIVIDER ===== */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 48px 0;
}

/* ===== SECTION ===== */
.section {
    margin-bottom: 48px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s;
}

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

/* ===== CARDS ===== */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-grid.two-col {
    grid-template-columns: 1fr 1fr;
}

.card {
    background: var(--bg-surface);
    padding: 20px 24px;
    transition: background 0.15s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    background: var(--bg-elevated);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.card-tag.difficulty-easy {
    background: rgba(34, 197, 94, 0.08);
    color: var(--green);
}

.card-tag.difficulty-medium {
    background: rgba(234, 179, 8, 0.08);
    color: var(--yellow);
}

.card-tag.difficulty-hard {
    background: rgba(220, 38, 38, 0.08);
    color: var(--accent);
}

.card-tag.difficulty-insane {
    background: rgba(168, 85, 247, 0.08);
    color: #a855f7;
}

.card-tag.locked {
    background: rgba(234, 179, 8, 0.08);
    color: var(--yellow);
}

.card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

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

/* ===== SIMPLE LIST ===== */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    color: var(--accent);
}

.list-item .arrow {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: transform 0.15s;
}

.list-item:hover .arrow {
    transform: translateX(3px);
    color: var(--accent);
}

/* ===== ARTICLE / WRITEUP PAGE ===== */
.article-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.article-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 12px;
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.article-body {
    max-width: 100%;
}

.article-body h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 40px 0 12px;
    letter-spacing: -0.01em;
}

.article-body h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 28px 0 8px;
}

.article-body p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    line-height: 1.75;
}

.article-body ul, .article-body ol {
    margin: 0 0 16px 24px;
    color: var(--text-secondary);
    line-height: 1.75;
}

.article-body li {
    margin-bottom: 4px;
}

.article-body img {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 24px 0;
}

.article-body blockquote {
    border-left: 2px solid var(--accent);
    padding: 8px 20px;
    margin: 24px 0;
    color: var(--text-secondary);
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.85rem;
}

.article-body th,
.article-body td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.article-body th {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.article-body td {
    color: var(--text-secondary);
}

.article-body thead {
    border-bottom: 2px solid var(--border);
}

.article-body tbody tr:hover {
    background: var(--bg-elevated);
}

.article-body .notice {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 3px solid var(--yellow);
    padding: 16px 20px;
    border-radius: var(--radius);
    margin: 24px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.article-body .notice strong {
    color: var(--yellow);
}

/* ===== PASSWORD PROTECTION ===== */
.protected-overlay {
    text-align: center;
    padding: 80px 24px;
}

.protected-overlay h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.protected-overlay p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.password-form {
    display: flex;
    gap: 8px;
    max-width: 320px;
    margin: 0 auto;
}

.password-form input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.password-form input:focus {
    border-color: var(--accent);
}

.password-form input::placeholder {
    color: var(--text-muted);
}

.password-error {
    color: var(--accent);
    font-size: 0.8rem;
    margin-top: 12px;
    display: none;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--border-hover);
    background: var(--bg-elevated);
    color: var(--text);
}

/* ===== CONTACT ===== */
.contact-info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color 0.15s;
}

.contact-item:hover {
    border-color: var(--border-hover);
}

.contact-item .icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-item .icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--accent);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.contact-item .details .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.contact-item .details .value {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== LISTING PAGE ===== */
.page-hero {
    padding: 40px 0 32px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.page-hero h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.page-hero p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 540px;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== FOOTER ===== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    margin-top: auto;
}

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

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

.footer-links {
    display: flex;
    gap: 20px;
    list-style: none;
}

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

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero-inner {
        flex-direction: column;
        gap: 20px;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero-stats {
        gap: 24px;
    }

    .card-grid.two-col {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 8px;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .footer-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.3rem;
    }

    .hero-stats {
        flex-wrap: wrap;
        gap: 16px;
    }

    .password-form {
        flex-direction: column;
    }
}
