:root {
    /* Color Palette - Classroom Theme */
    --bg-color: #1e3f20;        /* Chalkboard green */
    --card-bg: #fdfbf7;         /* Lined paper */
    --card-bg-hover: #fcf9f2;
    --primary-color: #fcd34d;   /* Yellow chalk */
    --text-color: #ffffff;      /* White chalk */
    --text-muted: #d1d5db;      /* Gray chalk */

    --accent-color: #fbbf24;    /* Yellow chalk darker */
    --accent-hover: #f59e0b;
    --accent-glow: rgba(252, 211, 77, 0.3);

    --border-color: #2d5a2f;    /* Board frame */
    --border-radius: 4px;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
    --shadow-glow: 0 0 15px var(--accent-glow);

    --card-text: #333333;       /* Black ink */
    --card-line: #94a3b8;       /* Blue line on paper */
    --card-red-line: #ef4444;   /* Red margin line */

    --font-heading: 'Patrick Hand', cursive, sans-serif;
    --font-body: 'Patrick Hand', cursive, sans-serif;

    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
body > header {
    background-color: #1a361c; /* solid wood/chalkboard top */
    border-bottom: 4px solid #8b5a2b; /* wooden frame border */
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transform: translateZ(0); /* Crucial: Creates stacking context to fix sticky z-index issues caused by animations */
}

.logo {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo img {
    height: 32px;
    width: auto;
}

main {
    flex-grow: 1;
    padding: 3rem 0;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--primary-color);
    letter-spacing: 1px;
}

p {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* Hero Section */
.hero {
    position: relative;
    padding: 6rem 1rem;
    text-align: center;
    background: transparent;
    border: 4px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    margin-bottom: 4rem;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 1.5rem;
    color: var(--text-color);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero p {
    font-size: clamp(1.3rem, 2vw, 1.5rem);
    color: #e2e8f0;
    max-width: 600px;
    margin: 0 auto;
}

/* Intro Section */
.intro-section {
    max-width: 800px;
    margin: 0 auto 4rem auto;
    text-align: center;
}

.intro-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #fca5a5; /* pink chalk */
}

.intro-content {
    font-size: 1.3rem;
    color: var(--text-color);
}

.intro-content p {
    margin-bottom: 1.5rem;
}

/* Search Bar */
.search-container {
    max-width: 600px;
    margin: 0 auto 3rem auto;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
}

#fallacy-search {
    width: 100%;
    padding: 1.2rem 1.2rem 1.2rem 3rem;
    border-radius: 30px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background-color: transparent;
    color: var(--text-color);
    font-size: 1.3rem;
    transition: all var(--transition-fast);
}

#fallacy-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(252, 211, 77, 0.2);
}

/* Fallacy Cards */
.fallacy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.fallacy-card {
    background-color: var(--card-bg);
    border-radius: 2px;
    padding: 2.5rem 1.5rem 1.5rem 2.5rem;
    text-decoration: none;
    color: var(--card-text);
    border: none;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.4);
    transition: all var(--transition-medium);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;

    /* Ruled paper background */
    background-image:
        linear-gradient(transparent 95%, var(--card-line) 5%),
        linear-gradient(90deg, transparent 2rem, var(--card-red-line) 2rem, var(--card-red-line) 2.1rem, transparent 2.1rem);
    background-size: 100% 1.5rem, 100% 100%;
    line-height: 1.5rem; /* Matches the line height */
}

/* Tape/Pin effect */
.fallacy-card::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 60px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    border-radius: 2px;
    z-index: 10;
}

.fallacy-card:nth-child(even) {
    transform: rotate(1deg);
}

.fallacy-card:nth-child(odd) {
    transform: rotate(-1deg);
}

.fallacy-card:hover {
    transform: translateY(-5px) scale(1.02) rotate(0deg);
    box-shadow: 5px 15px 25px rgba(0, 0, 0, 0.6);
}

.card-icon {
    font-size: 2.5rem;
    color: #1e3a8a; /* blue ink */
    margin-bottom: 1.5rem;
    margin-top: 1rem;
    z-index: 2;
}

.card-icon svg {
    width: 2.5rem;
    height: 2.5rem;
    fill: #1e3a8a;
}

.card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--card-text);
    margin-top: -0.2rem;
}

.card-content p {
    color: var(--card-text);
    font-size: 1.1rem;
    margin-bottom: 0;
    flex-grow: 1;
}

/* Fallacy Detail Page */
.fallacy-detail {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--card-bg); /* Lined paper look for whole detail */
    color: var(--card-text);
    padding: 3rem 4rem 3rem 5rem;
    border-radius: 4px;
    box-shadow: 2px 5px 15px rgba(0,0,0,0.5);
    position: relative;
    background-image:
        linear-gradient(transparent 95%, var(--card-line) 5%),
        linear-gradient(90deg, transparent 4rem, var(--card-red-line) 4rem, var(--card-red-line) 4.2rem, transparent 4.2rem);
    background-size: 100% 2rem, 100% 100%;
    line-height: 2rem;
}

/* Notebook holes */
.fallacy-detail::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 3rem;
    width: 1.5rem;
    height: 1.5rem;
    background-color: var(--bg-color); /* Shows chalkboard through */
    border-radius: 50%;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.5);
}

.fallacy-detail::after {
    content: '';
    position: absolute;
    left: 1rem;
    bottom: 3rem;
    width: 1.5rem;
    height: 1.5rem;
    background-color: var(--bg-color);
    border-radius: 50%;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.5);
}

.fallacy-header {
    text-align: center;
    padding-bottom: 3rem;
    border-bottom: 2px dashed var(--card-line);
    margin-bottom: 3rem;
}

.icon-circle {
    width: 80px;
    height: 80px;
    background-color: transparent;
    border: 3px dashed #1e3a8a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
}

.icon-circle i {
    font-size: 2.5rem;
    color: #1e3a8a;
}

.icon-circle svg {
    width: 2.5rem;
    height: 2.5rem;
    fill: #1e3a8a;
}

.fallacy-header h1 {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    margin-bottom: 0;
    color: var(--card-text);
}

.fallacy-content section {
    margin-bottom: 3rem;
}

.fallacy-content h2 {
    color: #b91c1c; /* red ink */
    font-size: 1.8rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: underline;
}

.fallacy-content p {
    font-size: 1.3rem;
    color: var(--card-text);
    line-height: 2rem; /* matches paper lines */
}

.example-box {
    background-color: rgba(0,0,0,0.05);
    border: 2px dashed #1e3a8a;
    padding: 2rem;
    border-radius: 8px;
    position: relative;
    transform: rotate(-1deg);
    margin-top: 1rem;
}

.example-box i {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 2rem;
    color: rgba(30, 58, 138, 0.2);
}

.example-box p {
    margin: 0;
    color: #1e3a8a;
    font-style: italic;
    font-size: 1.4rem;
    padding-left: 2rem;
}

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

.btn-primary {
    background-color: var(--primary-color);
    color: #1e3f20;
    font-weight: bold;
    border-radius: 8px;
    border: 2px solid #fbbf24;
    font-size: 1.2rem;
    box-shadow: 0 4px 6px rgba(252, 211, 77, 0.3);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(252, 211, 77, 0.4);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 1.1rem;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.navigation-links {
    margin-top: 4rem;
}

.navigation-links .btn {
    background-color: var(--primary-color);
    color: #1e3f20;
    border: none;
    font-weight: bold;
}

/* Footer */
footer {
    background-color: #1a361c; /* wooden tray at bottom of chalkboard */
    border-top: 8px solid #8b5a2b; /* chalk tray */
    padding: 2rem 0;
    text-align: center;
    margin-top: auto;
}

footer p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    margin: 0;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsiveness */
@media (max-width: 768px) {
    .fallacy-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 4rem 1rem;
    }

    .fallacy-detail {
        padding: 2rem 1.5rem 2rem 2.5rem;
    }
}
