/* Reset and base */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #ff6b35;
    --primary-dark: #e85a2c;
    --bg: #fffbf5;
    --card: #ffffff;
    --text: #2a2a2a;
    --text-muted: #6b6b6b;
    --border: #f0e8dd;
    --accent: #ffd166;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

/* Header */
header {
    background: white;
    border-bottom: 2px solid var(--border);
    padding: 18px 0;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo {
    font-size: 1.4em;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
}
.logo:hover { text-decoration: none; color: var(--primary); }

.nav-links {
    list-style: none;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

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

.nav-links a:hover {
    background: var(--border);
    color: var(--text);
    text-decoration: none;
}

.nav-links a.active {
    color: var(--primary);
    background: rgba(255, 107, 53, 0.1);
}

/* Main */
main { flex: 1; padding: 40px 0; }

h1 {
    font-size: 2.2em;
    margin-bottom: 0.4em;
    color: var(--text);
    font-weight: 800;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.5em;
    margin: 1.5em 0 0.7em;
    color: var(--text);
    font-weight: 700;
}

h3 { font-size: 1.15em; margin: 1em 0 0.5em; font-weight: 600; }

p, ul, ol { margin-bottom: 1em; }
ul, ol { padding-left: 22px; }
li { margin-bottom: 0.4em; }

.lead {
    font-size: 1.15em;
    color: var(--text-muted);
    margin-bottom: 2em;
}

/* Hero */
.hero {
    text-align: center;
    padding: 30px 0;
    margin-bottom: 30px;
}

.hero h1 { font-size: 2.5em; }
.hero .lead { max-width: 580px; margin: 0 auto; }

/* Filter / Tags */
.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 30px;
    padding: 16px 20px;
    background: white;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.filter-label {
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 8px;
}

.tag {
    display: inline-block;
    padding: 5px 12px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 0.9em;
    transition: all 0.15s;
}

.tag:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    text-decoration: none;
}

/* Joke cards */
.jokes h2 { margin-top: 0; margin-bottom: 20px; }

.joke {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 18px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.joke:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.joke-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    font-size: 0.88em;
}

.category {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255, 107, 53, 0.1);
    color: var(--primary-dark);
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.joke-meta .date {
    color: var(--text-muted);
}

.joke-text {
    font-size: 1.05em;
    line-height: 1.65;
    margin-bottom: 16px;
    color: var(--text);
}

.joke-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px dashed var(--border);
}

.btn-rate, .btn-share {
    padding: 6px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    color: var(--text-muted);
    transition: all 0.15s;
    font-family: inherit;
}

.btn-rate:hover, .btn-share:hover {
    background: var(--card);
    color: var(--text);
    border-color: var(--primary);
}

/* Category sections */
.category-section {
    margin: 40px 0;
    padding-top: 20px;
    scroll-margin-top: 80px;
}

.category-section h2 {
    margin-top: 0;
    font-size: 1.6em;
}

.category-desc {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Buttons */
.btn-primary {
    display: inline-block;
    padding: 12px 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.25);
}

.btn-large {
    padding: 16px 36px;
    font-size: 1.1em;
}

.load-more {
    text-align: center;
    margin: 30px 0;
}

/* Random page */
.random-page {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}

.joke-random {
    text-align: left;
    margin: 30px 0;
    min-height: 140px;
    padding: 30px;
}

.joke-random .joke-text {
    font-size: 1.15em;
    text-align: center;
}

.random-controls {
    margin: 30px 0;
}

.stats {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    margin-top: 40px;
    text-align: left;
}

.stats h3 { margin-top: 0; }
.stats ul { list-style: none; padding: 0; }
.stats li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}
.stats li:last-child { border-bottom: none; }

/* Article content (about page) */
.content { max-width: 700px; }
.content p { color: var(--text); }
.content ul li { margin-bottom: 0.6em; }

/* Footer */
footer {
    background: white;
    border-top: 2px solid var(--border);
    padding: 40px 0 20px;
    margin-top: 60px;
    color: var(--text-muted);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-content h3 {
    color: var(--text);
    margin-bottom: 10px;
}

.footer-content ul {
    list-style: none;
    padding: 0;
}

.footer-content li {
    margin-bottom: 6px;
}

.footer-content a {
    color: var(--text-muted);
}

.footer-content a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 600px) {
    .container { padding: 0 16px; }
    h1 { font-size: 1.8em; }
    .hero h1 { font-size: 2em; }
    .joke { padding: 20px; }
    nav { flex-direction: column; align-items: flex-start; }
    .nav-links { gap: 2px; }
    .nav-links a { padding: 6px 10px; font-size: 0.9em; }
}
