/* ============================================
   52 Aces — Design System
   Dark mode with red accents
   ============================================ */

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

:root {
    --bg:          #09090b;
    --bg-elevated: #111113;
    --bg-card:     #16161a;
    --bg-subtle:   #1c1c21;
    --bg-hover:    #22222a;

    --text:        #ececef;
    --text-secondary: #a1a1aa;
    --text-muted:  #71717a;

    --accent:      #dc2626;
    --accent-light:#ef4444;
    --accent-dim:  rgba(220, 38, 38, 0.10);
    --accent-glow: rgba(220, 38, 38, 0.25);

    --border:      #27272a;
    --border-light:#3f3f46;

    --success:     #4ade80;
    --warning:     #fbbf24;
    --error:       #f87171;

    --radius:      12px;
    --radius-sm:   8px;
    --radius-lg:   20px;

    --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif:  'Instrument Serif', Georgia, 'Times New Roman', serif;
    --font-mono:   'IBM Plex Mono', 'SF Mono', 'Fira Code', monospace;

    --container:   1100px;
    --container-narrow: 720px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Noise texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

strong { font-weight: 600; color: var(--text); }

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

/* --- Typography --- */
h1, h2, h3, h4 { line-height: 1.2; font-weight: 600; }

.heading-serif {
    font-family: var(--font-serif);
    font-weight: 400;
    font-style: italic;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.label-mono {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 500;
}

/* --- Layout --- */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 2rem;
}

.container-narrow {
    max-width: var(--container-narrow);
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    padding: 5rem 0;
}

section + section {
    border-top: 1px solid var(--border);
}

/* --- Navigation --- */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    text-decoration: none;
}

.nav-brand {
    font-family: 'Bungee', cursive;
    font-size: 1rem;
    font-weight: 400;
    font-style: normal;
    letter-spacing: -0.01em;
}

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

.brand-52 {
    color: var(--accent);
}

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

.nav-link {
    font-size: 0.825rem;
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    text-decoration: none;
}

.nav-link:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--accent);
}

/* Mobile nav */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
}

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

/* --- Hero Section --- */
.hero {
    padding-top: 10rem;
    padding-bottom: 5rem;
    text-align: center;
    position: relative;
}

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

.hero h1 {
    font-size: clamp(2.5rem, 5.5vw, 4rem);
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.hero h1 .heading-serif {
    display: inline;
}

.hero-sub {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

.hero-ctas {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s;
    border: none;
    text-decoration: none;
    font-family: var(--font);
}

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

.btn-primary:hover {
    background: var(--accent-light);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

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

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
    color: var(--text);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--accent);
    padding: 0.75rem 0;
}

.btn-ghost:hover { color: var(--accent-light); }

.btn-ghost .arrow { transition: transform 0.2s; }
.btn-ghost:hover .arrow { transform: translateX(4px); }

/* --- Section Headers --- */
.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 3.5rem;
}

.section-header .label-mono {
    margin-bottom: 1rem;
    display: block;
}

.section-header h2 {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
}

/* --- Card Grid --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

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

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

a.card:hover {
    color: inherit;
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: var(--accent);
}

.card-icon svg { width: 20px; height: 20px; }

.card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.card-meta {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* --- Blog Post List --- */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.post-item {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: all 0.3s;
    text-decoration: none;
    color: inherit;
}

.post-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    color: inherit;
}

.post-item h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.post-item p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.post-item .post-meta {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* --- Article / Blog Post Content --- */
.article-header {
    padding-top: 8rem;
    padding-bottom: 3rem;
    text-align: center;
    position: relative;
}

.article-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    opacity: 0.2;
    pointer-events: none;
    z-index: -1;
}

.article-header .label-mono {
    margin-bottom: 1.5rem;
    display: block;
}

.article-header h1 {
    font-size: clamp(2rem, 4.5vw, 3rem);
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.article-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.article-content {
    padding: 3rem 0 5rem;
}

.article-content h2 {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.article-content h3 {
    font-size: 1.2rem;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.article-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
}

.article-content ul, .article-content ol {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
    line-height: 1.8;
    font-size: 1.05rem;
}

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

.article-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: var(--bg-card);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.8;
}

.article-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-content a:hover {
    color: var(--accent-light);
}

.article-content img {
    border-radius: var(--radius);
    margin: 2rem auto;
    border: 1px solid var(--border);
}

.article-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 3rem 0;
}

/* Article tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.article-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.3rem 0.75rem;
    border-radius: 100px;
    text-decoration: none;
    transition: all 0.2s;
}

.article-tag:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Article navigation */
.article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border);
}

.article-nav a {
    display: block;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.3s;
}

.article-nav a:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.article-nav .nav-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: block;
}

.article-nav .nav-title {
    font-size: 0.925rem;
    color: var(--text);
    font-weight: 500;
}

/* --- Books Page --- */
.book-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
    transition: all 0.3s;
    align-items: center;
}

.book-card:hover {
    border-color: var(--border-light);
}

.book-cover {
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.book-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.book-info p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.book-quote {
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.925rem;
}

/* --- Reading List --- */
.reading-section {
    margin-bottom: 3rem;
}

.reading-section h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.reading-section > p {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

.reading-list {
    list-style: none;
    padding: 0;
}

.reading-list li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.925rem;
}

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

.reading-list .book-title {
    color: var(--text);
    font-weight: 500;
}

.reading-list .book-author {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --- Download Section --- */
.download-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem;
    margin-top: 3rem;
    position: relative;
    overflow: hidden;
}

.download-section::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.download-section h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.download-section > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.download-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.download-item h4 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

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

.download-links a {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    padding: 0.4rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.2s;
    text-decoration: none;
}

.download-links a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem 0;
}

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

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

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

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

/* --- Featured Post Card --- */
.featured-card {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 3rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.featured-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.featured-card .label-mono {
    margin-bottom: 1rem;
    display: block;
}

.featured-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.featured-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.25rem;
}

/* --- About Section on Homepage --- */
.about-links {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.about-links li {
    margin-bottom: 0.5rem;
}

.about-links a {
    color: var(--accent);
    font-weight: 500;
}

/* --- Page Header (non-hero) --- */
.page-header {
    padding-top: 8rem;
    padding-bottom: 3rem;
    text-align: center;
    position: relative;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    opacity: 0.2;
    pointer-events: none;
    z-index: -1;
}

.page-header h1 {
    font-size: clamp(2rem, 4.5vw, 3rem);
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* --- Memory Mastery Landing Page --- */
.landing-section {
    padding: 3rem 0;
}

.landing-section h2 {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.landing-section p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
}

.landing-section ul {
    color: var(--text-secondary);
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
    line-height: 1.8;
}

.landing-section li {
    margin-bottom: 0.5rem;
}

.highlight-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin: 2rem 0;
}

.highlight-box h3 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.check-list {
    list-style: none;
    padding: 0;
}

.check-list li {
    padding: 0.6rem 0;
    padding-left: 1.75rem;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.6;
}

.check-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
}

.x-list {
    list-style: none;
    padding: 0;
}

.x-list li {
    padding: 0.6rem 0;
    padding-left: 1.75rem;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.6;
}

.x-list li::before {
    content: '✕';
    position: absolute;
    left: 0;
    color: var(--error);
    font-weight: 700;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.stagger > * {
    animation: fadeIn 0.5s ease both;
}
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }

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

    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
    }

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

    .nav-link {
        padding: 0.75rem 1rem;
    }

    .hero {
        padding-top: 7rem;
        padding-bottom: 3rem;
    }

    section { padding: 3rem 0; }

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

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

    .book-card {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .book-cover {
        max-width: 160px;
        margin: 0 auto;
    }

    .highlight-box[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        text-align: center;
    }

    .highlight-box[style*="grid-template-columns"] img {
        max-width: 120px;
        margin: 0 auto;
    }

    .article-nav {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.75rem; }
    .section-header h2 { font-size: 1.5rem; }
    .download-links { flex-direction: column; }
}
