:root {
    --primary-color: #e67e22;
    /* Warmer orange for better contrast */
    --accent-color: #d35400;
    --bg-color: #121212;
    /* Deeper dark mode */
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --link-color: #ffab40;
    --spacing-unit: 1rem;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: var(--spacing-unit);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    font-size: 16px;
    /* Base size for mobile */
}

/* Typography needed for mobile readability */
h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    text-align: center;
    line-height: 1.2;
}

h2 {
    color: var(--link-color);
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    font-size: 1rem;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

/* Header & Navigation */
header {
    text-align: center;
    margin-bottom: 2rem;
    width: 100%;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--text-color);
    opacity: 0.7;
    font-size: 0.9rem;
    padding: 0.5rem;
}

/* Candle Animation Container - Responsive */
.candle-container {
    height: 120px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin: 1.5rem 0;
    position: relative;
}

/* The Candle Body */
.candle {
    width: 30px;
    height: 80px;
    background: linear-gradient(#e67e22, #d35400);
    border-radius: 3px;
    position: relative;
    box-shadow: inset 0 -10px 10px rgba(0, 0, 0, 0.3);
}

/* The Wick */
.wick {
    width: 3px;
    height: 12px;
    background: #5e4034;
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
}

/* The Flame */
.flame {
    width: 16px;
    height: 35px;
    background: linear-gradient(to bottom, #ffff00 0%, #ff6a00 100%);
    border-radius: 50% 50% 35% 35%;
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.6), 0 0 30px rgba(255, 165, 0, 0.4);
    animation: flicker 1s infinite alternate;
    transform-origin: bottom center;
}

@keyframes flicker {
    0% {
        transform: translateX(-50%) scale(1);
        opacity: 0.9;
    }

    20% {
        transform: translateX(-52%) scale(1.1) skewX(2deg);
        opacity: 1;
    }

    40% {
        transform: translateX(-48%) scale(0.95) skewX(-2deg);
        opacity: 0.8;
    }

    60% {
        transform: translateX(-51%) scale(1.05) skewX(1deg);
        opacity: 1;
    }

    80% {
        transform: translateX(-49%) scale(0.98) skewX(-1deg);
        opacity: 0.9;
    }

    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

/* Mobile-First Grid (1 column by default) */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
    max-width: 600px;
    /* Optimal reading width on mobile */
}

/* Card Styling for Touch Targets */
.card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    /* Ensure entire card is clickable/tappable */
    position: relative;
    border: 1px solid transparent;
}

.card:active {
    background-color: #252525;
    transform: scale(0.98);
}

.card h2 {
    margin-top: 0;
    font-size: 1.3rem;
    color: var(--link-color);
}

.card p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0;
    line-height: 1.5;
}

/* Article Content Styling */
article {
    max-width: 700px;
    width: 100%;
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

article h2 {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

article ul {
    padding-left: 1.5rem;
}

article li {
    margin-bottom: 0.5rem;
}

blockquote {
    border-left: 3px solid var(--primary-color);
    margin: 1.5rem 0;
    padding-left: 1rem;
    color: #ccc;
    font-style: italic;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 0 4px 4px 0;
}

footer {
    margin-top: 3rem;
    font-size: 0.85rem;
    opacity: 0.6;
    text-align: center;
    padding-bottom: 2rem;
    /* Extra padding for bottom-nav mobile browsers */
}

/* Desktop Enhancements (Tablet and up) */
@media (min-width: 768px) {
    body {
        padding: 40px;
        font-size: 18px;
    }

    h1 {
        font-size: 3rem;
    }

    .grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on tablet+ */
        max-width: 1000px;
    }

    .card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
        border-color: var(--primary-color);
    }
}