/* Make navbar full width and centered */
.uk-navbar-container .uk-navbar-right {
    width: 100%;
    justify-content: center;
}

/* Force two rows of 6 months */
.uk-navbar-nav {
    flex-wrap: wrap !important;
    justify-content: center;
    width: 100%;
    gap: 2px;
    list-style: none !important;
}
.uk-navbar-nav > li {
    list-style: none !important;
    flex: 0 0 calc(16.666% - 2px);
    max-width: calc(16.666% - 2px);
    text-align: center;
    box-sizing: border-box;
}
.uk-navbar-nav > li::before,
.uk-navbar-nav > li::after,
.uk-navbar-nav > li > a::before,
.uk-navbar-nav > li > a::after {
    display: none !important;
    content: none !important;
}
.uk-navbar-nav > li > a {
    min-height: auto;
    padding: 6px 0;
    justify-content: center;
    font-size: 0.9em;
    border: 1px solid rgba(166, 133, 99, 0.4);
    border-radius: 4px;
    margin: 1px 0;
    transition: background 0.2s, border-color 0.2s;
}
.uk-navbar-nav > li > a:hover {
    background: rgba(166, 133, 99, 0.2);
    border-color: #a68563;
}
.uk-navbar-nav > li.uk-active > a {
    background: rgba(166, 133, 99, 0.3);
    border-color: #a68563;
}


/* Hide the 'X is required' message in Smart Search results */
#search-results > p:has(.query-required) {
    display: none !important;
}
#search-results > p:has(> .query-required) {
    display: none !important;
}
.query-required {
    display: none !important;
}

/* Reduce vertical spacing in top section (Google Ad area) */
#tm-top, .tm-top {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}
.uk-section.uk-section-default {
    padding-top: 15px;
    padding-bottom: 15px;
}

/* === Mobile responsive (< 768px) === */
@media (max-width: 767px) {
    /* Month nav: 3 columns (4 rows of 3) instead of 6 (2 rows of 6) */
    .uk-navbar-nav > li {
        flex: 0 0 calc(33.333% - 2px);
        max-width: calc(33.333% - 2px);
    }
    .uk-navbar-nav > li > a {
        padding: 8px 0;
        font-size: 0.95em;
    }

    /* Calendar tooltip: position below the date (full width)
       since side positioning runs off screen */
    .evil-calendar td .day-tooltip,
    .evil-calendar td:nth-child(n+5) .day-tooltip {
        left: 50% !important;
        right: auto !important;
        top: calc(100% + 4px) !important;
        bottom: auto !important;
        transform: translateX(-50%) !important;
        max-width: 90vw;
        min-width: 200px;
    }

    /* Make article images smaller and non-floating on phones */
    .item-page img,
    .uk-article img {
        max-width: 100% !important;
        height: auto;
    }
    div[style*=float:right] {
        float: none !important;
        margin: 0 auto 15px !important;
        max-width: 280px !important;
        text-align: center;
    }

    /* Tighter calendar */
    .evil-calendar { max-width: 280px; }
    .evil-calendar td { padding: 2px 1px; }
    .evil-calendar td > a { width: 26px !important; height: 26px !important; line-height: 26px !important; font-size: 0.85em; }

    /* Smaller logo / title on mobile */
    h1[style*=xx-large] { font-size: 1.5em !important; }

    /* Reduce padding on mobile */
    .tm-main { padding: 10px !important; }
}

/* === Smaller phones (< 480px) === */
@media (max-width: 479px) {
    /* Month nav: 2 columns (6 rows of 2) */
    .uk-navbar-nav > li {
        flex: 0 0 calc(50% - 2px);
        max-width: calc(50% - 2px);
    }
}

/* === Touch device fixes === */
/* Disable hover tooltips on touch devices - they interfere with tapping */
@media (hover: none), (pointer: coarse) {
    .evil-calendar td .day-tooltip {
        display: none !important;
    }
    .evil-calendar td.tooltip-active .day-tooltip {
        display: none !important;
    }
}


/* Mobile: Move sidebar ABOVE article content */
@media (max-width: 959px) {
    #tm-main > .uk-container > .uk-grid {
        display: flex !important;
        flex-direction: column !important;
    }
    #tm-main > .uk-container > .uk-grid > #tm-sidebar {
        order: -1 !important;
        width: 100% !important;
    }
    #tm-main > .uk-container > .uk-grid > .uk-width-expand\@m {
        order: 1 !important;
        width: 100% !important;
    }
}

/* Mobile: hide sidebar Google ad to keep calendar prominent (top + bottom ads still show) */
@media (max-width: 767px) {
    #tm-sidebar #module-120 {
        display: none !important;
    }
}

/* Hide the redundant category title (h3) above article list */
#tm-main .uk-panel.uk-margin-medium-bottom > h3:only-child {
    display: none;
}
/* Fallback - hide any direct h3 child of uk-panel that contains only a month name */
.uk-panel > h3 {
    display: none;
}

/* === Mobile: tighter spacing === */
@media (max-width: 767px) {
    /* Smaller calendar */
    .evil-calendar { max-width: 240px; margin-bottom: 10px; }
    .evil-calendar-header { padding: 4px 0; margin-bottom: 4px; }
    .evil-calendar-header .month-title { font-size: 1em; }
    .evil-calendar th { padding: 3px 1px; font-size: 0.7em; }
    .evil-calendar td { padding: 1px; font-size: 0.85em; }
    .evil-calendar td.has-articles > a {
        width: 24px !important;
        height: 24px !important;
        line-height: 24px !important;
        font-size: 0.85em;
    }
    .evil-calendar-months { margin-top: 6px; padding-top: 6px; }
    .evil-calendar-months a { font-size: 0.7em; padding: 1px 4px; }

    /* Reduce section padding everywhere on mobile */
    .uk-section { padding-top: 8px !important; padding-bottom: 8px !important; }
    .tm-main { padding-top: 8px !important; padding-bottom: 8px !important; }
    #tm-top, .tm-top { padding: 4px 0 !important; }
    #tm-bottom, .tm-bottom { padding: 4px 0 !important; }

    /* Tighter container padding */
    .uk-container { padding-left: 10px !important; padding-right: 10px !important; }

    /* Article spacing */
    .uk-article { margin-top: 10px !important; }
    .uk-article-title { font-size: 1.2em !important; margin-top: 5px !important; }
    .uk-margin-medium { margin-bottom: 8px !important; }
    .uk-margin-medium-top { margin-top: 8px !important; }
    .uk-margin-medium-bottom { margin-bottom: 8px !important; }

    /* Sidebar tighter */
    #tm-sidebar { padding: 0 !important; margin: 0 !important; }
}

/* === Wikipedia source attribution blockquote === */
blockquote.wiki-source {
    margin: 20px 0;
    padding: 20px 25px;
    background: #faf8f5;
    border-left: 4px solid #a68563;
    border-radius: 0 4px 4px 0;
    color: #444;
    font-size: 0.96em;
}
blockquote.wiki-source p.wiki-source-header {
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8dec8;
    color: #a68563;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: normal;
}
blockquote.wiki-source p {
    margin-bottom: 1em;
}
blockquote.wiki-source p:last-of-type {
    margin-bottom: 0;
}
blockquote.wiki-source footer.wiki-source-attribution {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #e8dec8;
    font-size: 0.85em;
    color: #666;
    text-align: right;
}
blockquote.wiki-source footer.wiki-source-attribution a {
    color: #8b6f50;
}
blockquote.wiki-source img {
    border-color: #a68563 !important;
}

/* === Home page (Welcome to EvilBirthdays) === */
.eb-home {
    max-width: 900px;
    margin: 0 auto;
}
.eb-home h3 {
    color: #a68563;
    border-bottom: 2px solid #e8dec8;
    padding-bottom: 8px;
    margin-top: 35px;
    margin-bottom: 15px;
    font-size: 1.4em;
}
.eb-hero {
    background: #faf8f5;
    border-left: 4px solid #a68563;
    padding: 25px 30px;
    margin: 25px 0;
    border-radius: 0 4px 4px 0;
}
.eb-hero p {
    font-size: 1.05em;
    line-height: 1.65;
    margin-bottom: 12px;
}
.eb-hero p:last-child {
    margin-bottom: 0;
}
.eb-today-cta {
    background: #fff8eb;
    border: 1px solid #e8dec8;
    padding: 20px 25px;
    margin: 25px 0;
    border-radius: 4px;
    text-align: center;
}
.eb-today-cta h3 {
    border: none;
    margin-top: 0;
}
.eb-button {
    display: inline-block;
    background: #a68563;
    color: #fff !important;
    padding: 12px 28px;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none !important;
    font-size: 1.05em;
    transition: background 0.2s;
}
.eb-button:hover {
    background: #8b6f50;
}
.eb-month-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 15px 0;
}
.eb-month-grid a {
    display: block;
    text-align: center;
    padding: 14px 8px;
    background: #fff;
    border: 1px solid #e8dec8;
    border-radius: 4px;
    color: #5a4a37 !important;
    text-decoration: none !important;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
}
.eb-month-grid a:hover {
    background: #fff8eb;
    border-color: #a68563;
    color: #a68563 !important;
}
.eb-collections, .eb-book {
    background: #fafafa;
    padding: 18px 22px;
    margin: 20px 0;
    border-radius: 4px;
    border: 1px dashed #d4c4a8;
}
.eb-collections h3, .eb-book h3 {
    margin-top: 0;
}
.eb-footer-links {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e8dec8;
    font-size: 0.95em;
    color: #888;
}
.eb-footer-links a {
    color: #8b6f50;
}
@media (max-width: 600px) {
    .eb-month-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .eb-hero, .eb-today-cta {
        padding: 18px 20px;
    }
}

/* === Amazon Further Reading section === */
.eb-further-reading {
    margin: 25px 0 15px 0;
    padding: 14px 18px;
    background: #fff8eb;
    border-left: 3px solid #a68563;
    border-radius: 0 4px 4px 0;
}
.eb-further-reading p {
    margin: 0;
}
.eb-further-reading a {
    color: #8b6f50;
    font-weight: 600;
    text-decoration: none;
}
.eb-further-reading a:hover {
    color: #a68563;
    text-decoration: underline;
}
.eb-further-reading .eb-affiliate-disclosure {
    margin-top: 6px;
    color: #888;
}
.eb-further-reading .eb-affiliate-disclosure em {
    font-style: italic;
    font-size: 0.85em;
}

/* === Book card list (curated Amazon recommendations) === */
.eb-book-cards-header {
    margin: 0 0 8px 0 !important;
    color: #5a4a37;
}
.eb-book-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 8px 0 !important;
}
.eb-book-list li {
    margin: 0 0 6px 0 !important;
    padding: 0 !important;
    list-style: none !important;
}
.eb-book-list li::before { content: none !important; }
.eb-book-list a {
    display: block;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e8dec8;
    border-radius: 3px;
    text-decoration: none !important;
    color: #5a4a37 !important;
    transition: background 0.15s, border-color 0.15s;
}
.eb-book-list a:hover {
    background: #fffaf0;
    border-color: #a68563;
}
.eb-book-title {
    display: block;
    font-weight: 600;
    color: #5a4a37;
}
.eb-book-author {
    display: block;
    font-size: 0.88em;
    color: #888;
    font-style: italic;
    margin-top: 2px;
}

/* === Hide top-position search on desktop (toolbar handles it there) === */
@media (min-width: 960px) {
    .tm-top #module-124 {
        display: none !important;
    }
}

/* === Hide Random Evil Figure on touch devices to prevent accidental taps === */
@media (hover: none) {
    #module-123,
    .evil-random {
        display: none !important;
    }
}
