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

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

/* Dark theme (default) */
:root,
[data-theme="dark"] {
    --bg-primary: #0a0f1a;
    --bg-surface: #111827;
    --bg-surface-hover: #1e293b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.12);
    --border: #1e3a5f;
    --border-subtle: rgba(59, 130, 246, 0.08);
    --success: #22c55e;
    --warning: #f59e0b;
    --finding-high: #ef4444;
    --nav-bg: rgba(17, 24, 45, 0.85);
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.08);
    --border: #e2e8f0;
    --border-subtle: rgba(37, 99, 235, 0.06);
    --success: #16a34a;
    --warning: #d97706;
    --finding-high: #dc2626;
    --nav-bg: rgba(241, 245, 249, 0.85);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

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

/* ==================== */
/* Top Navigation Bar   */
/* ==================== */
.navbar {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 1100px;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(59, 130, 246, 0.05);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.navbar-inner {
    padding: 0 2rem;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
}

.nav-logo {
    height: 40px;
    width: auto;
    border-radius: 8px;
}

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

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s ease;
    position: relative;
}

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

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-social {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-social a {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    transition: color 0.15s ease;
}

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

.nav-social svg {
    width: 22px;
    height: 22px;
}

/* Theme Toggle */
.theme-toggle {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

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

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: block;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.25rem;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* ==================== */
/* Hero / Header        */
/* ==================== */
.hero {
    padding: 8rem 2rem 3rem;
    text-align: center;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.hero-logo {
    width: 80px;
    height: auto;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.hero-name {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 0.25rem;
}

.hero-alias {
    color: var(--accent);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.hero-tagline {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 550px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* ==================== */
/* Sections             */
/* ==================== */
.section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

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

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==================== */
/* Results Table        */
/* ==================== */
.table-container {
    position: relative;
}

.table-wrapper {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.3s ease, max-height 0.4s ease;
    max-height: 280px;
}

.table-wrapper.expanded {
    max-height: 2000px;
    overflow-x: auto;
}

.table-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent, var(--bg-primary));
    pointer-events: none;
    transition: opacity 0.3s ease;
    border-radius: 0 0 12px 12px;
}

.table-container.expanded .table-fade {
    opacity: 0;
}

.table-expand {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.table-expand button {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.table-expand button:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

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

th {
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--bg-surface-hover);
}

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

td a:hover {
    text-decoration: underline;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--bg-surface-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.finding-high {
    color: var(--finding-high);
    font-weight: 600;
}

.finding-medium {
    color: var(--warning);
    font-weight: 600;
}

.finding-low {
    color: var(--text-secondary);
}

.earnings {
    color: var(--success);
    font-weight: 600;
}

.rank {
    color: var(--accent);
    font-weight: 500;
}

/* ==================== */
/* Write-ups Section    */
/* ==================== */
.writeups-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.writeup-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.writeup-card:hover {
    border-color: var(--accent);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    color: var(--text-primary);
}

.writeup-tag {
    display: inline-block;
    align-self: flex-start;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

[data-theme="light"] .writeup-tag {
    background: rgba(109, 40, 217, 0.08);
    color: #7c3aed;
    border-color: rgba(109, 40, 217, 0.15);
}

.writeup-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.writeup-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.writeup-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
}

.writeup-source {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
}

.section-more {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

.section-more a {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

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

/* ==================== */
/* About Section        */
/* ==================== */
.about-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    max-width: 700px;
}

.about-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.about-content p:last-child {
    margin-bottom: 0;
}

.about-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.about-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--accent-glow);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.about-link:hover {
    border-color: var(--accent);
    background: var(--bg-surface-hover);
}

.about-link svg {
    width: 16px;
    height: 16px;
}

/* ==================== */
/* Post Page            */
/* ==================== */
.post-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 7rem 2rem 3rem;
}

.post-back {
    display: inline-block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    transition: color 0.15s ease;
}

.post-back:hover {
    color: var(--accent);
}

.post-meta-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

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

.post-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.post-description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-subtle);
}

.post-content {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.8;
}

.post-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
}

.post-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
}

.post-content p {
    margin-bottom: 1.25rem;
}

.post-content code {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-size: 0.88em;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.post-content pre {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.post-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

.post-content ul, .post-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.post-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1.5rem 0;
}

/* ==================== */
/* Payout Carousel      */
/* ==================== */
.carousel-section {
    margin-bottom: 2rem;
}

.carousel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.carousel-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.carousel-nav {
    display: flex;
    gap: 0.5rem;
}

.carousel-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.carousel-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.carousel-btn svg {
    width: 18px;
    height: 18px;
}

.carousel-track {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0.25rem;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

.carousel-card {
    flex: 0 0 260px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.carousel-card:hover {
    border-color: var(--accent);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    color: var(--text-primary);
}

.carousel-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.carousel-card-name {
    font-size: 1rem;
    font-weight: 600;
}

.carousel-card-platform {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.15rem 0.5rem;
}

.carousel-card-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.carousel-card-earnings {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success);
}

.carousel-card-findings {
    display: flex;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.carousel-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
}

.carousel-card-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.carousel-card-rank {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
}

/* Write-ups Page */
.writeups-page {
    padding-top: 7rem;
}

/* ==================== */
/* Footer               */
/* ==================== */
.site-footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

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

/* ==================== */
/* Responsive           */
/* ==================== */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 80px;
        left: 0;
        right: 0;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-subtle);
        border-radius: 0 0 16px 16px;
        flex-direction: column;
        padding: 0.75rem 1.5rem;
        gap: 0;
    }

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

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border-subtle);
    }

    .nav-links a.active::after {
        display: none;
    }

    .nav-social {
        display: none;
    }

    .hero {
        padding: 6rem 1.25rem 2rem;
    }

    .hero-logo {
        width: 60px;
    }

    .hero-name {
        font-size: 2rem;
    }

    .hero-tagline {
        font-size: 0.95rem;
    }

    .section {
        padding: 2rem 1.25rem;
    }

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

    .writeups-grid {
        grid-template-columns: 1fr;
    }

    .carousel-card {
        flex: 0 0 220px;
    }

    th, td {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
    }

    .about-content {
        padding: 1.5rem;
    }
}

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