/*
 Theme Name:   NewsNation Child
 Template:     newsnation
 Description:  Guardian-style with full mobile fixes
*/

/* ---------- GLOBAL MANDATORY MOBILE FIX ---------- */
html {
    overflow-x: hidden !important;
    -webkit-text-size-adjust: 100%;
}
body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    position: relative;
}
img, iframe, video, embed, object, svg {
    max-width: 100% !important;
    height: auto !important;
}
.container,
.wp-block-group,
.wp-block-cover,
.site-header,
.site-footer,
.alignwide,
.alignfull,
.wp-block-image,
.wp-block-video,
.wp-block-table,
.widget,
.post-thumbnail,
article {
    max-width: 100vw !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}
/* Prevent any element from causing horizontal scrollbar */
* {
    max-width: 100vw;
}
/* Ensure all containers use full width on mobile without overflow */
.site-content,
.site-main,
.page-content,
.entry-content,
.wp-block-post-content,
.entry-content > * {
    max-width: 100% !important;
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
}
@media (max-width: 768px) {
    .site-content,
    .site-main,
    .entry-content {
        padding: 0 10px;
    }
    /* Fix hidden right edge on single posts */
    .single .entry-content,
    .single .site-main {
        overflow-x: visible;
    }
}
/* ---------- HEADER – show logo only, no title ---------- */
.site-branding .site-title {
    display: none !important; /* hide the text */
}
.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
}
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
}
.site-branding .custom-logo-link img {
    max-height: 45px;
    width: auto;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}
.search-toggle, #dark-mode-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    font-size: 1.3em;
    color: #333;
    line-height: 1;
}
/* Search form dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    right: 20px;
    background: #fff;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    padding: 20px;
    z-index: 999;
    border-radius: 4px;
    min-width: 280px;
}
.search-dropdown .search-form {
    display: flex;
}
.search-dropdown input[type="search"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

/* Mobile menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    flex-direction: column;
    gap: 5px;
}
.menu-toggle .bar {
    width: 25px;
    height: 3px;
    background: #333;
    display: block;
}
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
        margin-left: auto;
    }
    .main-navigation {
        display: none;
        width: 100%;
    }
    .main-navigation.toggled {
        display: block;
    }
}

/* ---------- DARK MODE TOGGLE STYLING (same as NewsNation) ---------- */
/* Override if parent has an existing dark mode toggle, we'll mimic its class */
#dark-mode-toggle {
    font-size: 1.4em;
    line-height: 1;
}

/* ---------- DARK MODE SCHEME ---------- */
body.dark-mode {
    background: #121212;
    color: #e0e0e0;
}
body.dark-mode .site-header {
    background: #1f1f1f;
    border-bottom-color: #333;
}
body.dark-mode .search-toggle,
body.dark-mode #dark-mode-toggle {
    color: #eee;
}
body.dark-mode .search-dropdown {
    background: #1f1f1f;
    color: #fff;
}
body.dark-mode .search-dropdown input[type="search"] {
    background: #333;
    border-color: #555;
    color: #fff;
}
body.dark-mode .news-card {
    background: #1e1e1e;
    border-color: #333;
}
body.dark-mode .section-title {
    border-bottom-color: #d32f2f;
}
body.dark-mode .newsnation-ticker-wrapper {
    background: #1a1a1a;
}

.newsnation-ticker-wrapper {
    display: flex !important;
    align-items: center;
    width: 100%;
    overflow: hidden;
    background: #000;
    color: #fff;
    font-size: 14px;
    padding: 0;
}
.newsnation-ticker-wrapper .ticker-container {
    display: flex;
    align-items: center;
    width: 100%;
}
.newsnation-ticker-wrapper .ticker-label {
    background: #d32f2f;
    padding: 8px 12px;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;          /* label stays fixed */
}
.newsnation-ticker-wrapper .ticker-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}
.newsnation-ticker-wrapper .ticker-content ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    animation: ticker-scroll 20s linear infinite;
    white-space: nowrap;
}
.newsnation-ticker-wrapper .ticker-content li {
    padding: 0 30px;
}
.newsnation-ticker-wrapper .ticker-content a {
    color: #fff;
    text-decoration: none;
}
@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ---------- HOMEPAGE SECTIONS ---------- */
.guardian-section {
    margin-top: 40px;
    padding: 0 15px;
}
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 3px solid #d32f2f;
    padding-bottom: 8px;
    margin-bottom: 20px;
}
.section-title .see-all {
    font-size: 0.7em;
    font-weight: 400;
    color: #d32f2f;
    text-decoration: none;
}
.news-card {
    background: #fff;
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 4px;
}

/* ---------- FOOTER ---------- */
.site-footer {
    background: #222;
    color: #ccc;
    padding: 40px 20px 20px;
    margin-top: 60px;
}
.site-footer .footer-widgets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto 30px;
}
.site-footer .widget-title {
    color: #fff;
}
.site-footer a {
    color: #bbb;
}
@media (max-width: 768px) {
    .site-footer .footer-widgets {
        grid-template-columns: 1fr;
    }
}