/*
Theme Name: Life 360 Tips
Theme URI: https://life360.tips
Author: Life 360 Tips
Description: Modern responsive theme for life360.tips — replaces pekopeko. Carries over OG tags, GTM/GA tracking, ad-spots markers (as comments), campaign_remove_nextpage, cookie writing logic.
Version: 1.0.3
Requires PHP: 7.4
License: GPL v2
Text Domain: life360
*/

/* ─── Brand colors ─────────────────────────────────────────────────────── */
:root {
    --brand:       #2db3c4;
    --brand-dark:  #2390a0;
    --brand-light: #e7f7fa;
    --text:        #1a1a1a;
    --text-muted:  #777;
    --bg:          #fafafa;
    --border:      #eaeaea;
}

/* ─── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }

/* ─── Layout ───────────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}
.site-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px 0;
}
@media (min-width: 992px) {
    .site-content {
        grid-template-columns: 1fr 320px;
    }
}

/* ─── Header ───────────────────────────────────────────────────────────── */
.site-header {
    background: #fff;
    border-bottom: 3px solid var(--brand);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Single-row layout: Logo | Nav | Search */
.site-header__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
}
.site-logo { flex-shrink: 0; }
.site-logo img { display: block; max-height: 40px; width: auto; }

/* Nav sits between logo and search, takes remaining space */
.main-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    flex: 1;
    overflow: hidden;
}
.main-nav__item {
    padding: 7px 12px;
    color: var(--text);
    font-weight: 500;
    font-size: 0.88rem;
    border-radius: 4px;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}
.main-nav__item:hover {
    color: var(--brand);
    background: var(--brand-light);
    text-decoration: none;
}

.site-search {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.site-search input {
    border: none; outline: none;
    padding: 7px 10px;
    font-size: 13px;
    background: transparent;
    width: 160px;
}
.site-search button {
    border: none;
    background: var(--brand);
    color: #fff;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
}
.site-search button:hover { background: var(--brand-dark); }

.menu-toggle {
    display: none;
    background: none; border: none;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 6px 8px;
    color: var(--brand);
    line-height: 1;
}

/* Mobile header */
@media (max-width: 768px) {
    /* Row wraps: line 1 = logo + burger, line 2 = nav + search */
    .site-header__row {
        flex-wrap: wrap;
        padding: 0;
        align-items: center;
    }

    .site-logo { padding: 10px 0; }

    /* Burger: visible, pushed to right of logo */
    .menu-toggle {
        display: flex;
        align-items: center;
        margin-left: auto;
        order: 1;
    }

    /* Nav: hidden by default, wraps to line 2 when open */
    .main-nav {
        display: none;
        flex-direction: column;
        flex: unset;
        order: 2;
        width: 100%;
        border-top: 1px solid var(--border);
        background: #fff;
        overflow: visible;
    }
    .main-nav.is-open { display: flex; }
    .main-nav__item {
        border-radius: 0;
        padding: 13px 16px;
        font-size: 1rem;
        border-bottom: 1px solid var(--border);
    }
    .main-nav__item:last-child { border-bottom: none; }

    /* Search: hidden by default, shows below nav when nav is open */
    .site-search {
        display: none;
        order: 3;
        width: calc(100% - 32px);
        margin: 12px 16px;
        flex-shrink: 0;
    }
    .main-nav.is-open ~ .site-search { display: flex; }
    .site-search input { width: 100%; flex: 1; }
}

/* ─── Home hero (slider + news list) ───────────────────────────────────── */
.home-hero {
    background: #f0f3f5;
    padding: 24px 0;
    margin-bottom: 32px;
}
.home-hero__grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}
@media (min-width: 768px) {
    .home-hero__grid { grid-template-columns: 1fr 1fr; }
}

/* Slider */
.home-slider {
    position: relative;
    aspect-ratio: 16/10;
    background: #ddd;
    border-radius: 8px;
    overflow: hidden;
}
.home-slider__slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}
.home-slider__slide.is-active {
    opacity: 1;
    pointer-events: auto;
}
.home-slider__slide::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 60%);
}
.home-slider__title {
    position: relative;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    padding: 24px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.home-slider__dots {
    position: absolute;
    bottom: 12px; left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}
.home-slider__dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s;
}
.home-slider__dot.is-active { background: var(--brand); }

/* News list (right side of hero) — matches slider height via grid stretch */
.home-news-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* stretch to full grid cell height (same as slider) */
    align-self: stretch;
}
.home-news-list__item {
    display: flex;
    flex: 1;                  /* items share height equally */
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s, box-shadow 0.15s;
    min-height: 0;            /* allow flex shrink */
}
.home-news-list__item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    text-decoration: none;
}
.home-news-list__pic {
    flex-shrink: 0;
    width: 110px;
    background-size: cover;
    background-position: center;
    background-color: #ddd;
}
.home-news-list__title {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.82rem;
    line-height: 1.35;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    align-self: center;
}

/* Home main column title */
.home-title {
    font-size: 1.5rem;
    font-weight: 700;
    border-left: 4px solid var(--brand);
    padding-left: 12px;
    margin: 0 0 24px;
}

/* ─── Sidebar widgets (popular posts + categories) ──────────────────────── */
.sidebar-title {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 16px;
    padding: 0 0 8px;
    border-bottom: 2px solid var(--brand);
}

.pop-post {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.pop-post__item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: var(--text);
}
.pop-post__item:last-child { border-bottom: none; }
.pop-post__item:hover { text-decoration: none; }
.pop-post__pic {
    width: 70px; height: 70px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-color: #ddd;
    border-radius: 4px;
}
.pop-post__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pop-post__title {
    font-size: 0.85rem;
    line-height: 1.3;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pop-post__cat {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--brand);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.categories {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.categories__list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.categories__item {
    padding: 6px 12px;
    background: #f0f3f5;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text);
    transition: background 0.15s, color 0.15s;
}
.categories__item:hover {
    background: var(--brand);
    color: #fff;
    text-decoration: none;
}

/* ─── Article preview (homepage / archive) ────────────────────────────── */
.posts-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr;
}
@media (min-width: 600px) { .posts-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .posts-grid { grid-template-columns: repeat(3, 1fr); } }

.article-preview {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.15s, box-shadow 0.15s;
}
.article-preview:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.article-preview__thumb {
    display: block;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #eee;
}
.article-preview__thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.article-preview:hover .article-preview__thumb img { transform: scale(1.05); }
.article-preview__body { padding: 16px; }
.article-preview__title {
    font-size: 1.1rem;
    line-height: 1.35;
    margin: 0 0 8px;
}
.article-preview__title a { color: #1a1a1a; }
.article-preview__meta { font-size: 0.8rem; color: #888; margin-bottom: 8px; }
.article-preview__excerpt { font-size: 0.9rem; color: #555; margin: 0; }

/* ─── Category / Archive — list format ────────────────────────────────── */
.archive-title {
    font-size: 1.2rem;
    font-weight: 700;
    border-left: 4px solid var(--brand);
    padding-left: 12px;
    margin: 0 0 20px;
    color: var(--text);
}

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.posts-list .article-preview {
    display: flex;
    flex-direction: row;
    border-radius: 8px;
    overflow: hidden;
}
.posts-list .article-preview__thumb {
    flex-shrink: 0;
    width: 200px;
    aspect-ratio: unset;
    min-height: 130px;
}
.posts-list .article-preview__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.posts-list .article-preview__body {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.posts-list .article-preview__title {
    font-size: 1rem;
    margin: 0 0 6px;
}
.posts-list .article-preview__excerpt {
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 600px) {
    .posts-list .article-preview { flex-direction: column; }
    .posts-list .article-preview__thumb { width: 100%; min-height: 180px; aspect-ratio: 16/9; }
}

/* ─── Single post ──────────────────────────────────────────────────────── */
.single-article {
    background: #fff;
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
@media (max-width: 600px) {
    .single-article { padding: 16px; border-radius: 0; }
}
.single-article__title {
    font-size: 2rem;
    line-height: 1.2;
    margin: 0 0 16px;
}
.single-article__meta { color: #888; font-size: 0.9rem; margin-bottom: 24px; }
.single-article__thumb { margin: 0 -32px 24px; }
.single-article__thumb img { width: 100%; }
.single-article__content {
    font-size: 1.05rem;
    line-height: 1.7;
}
.single-article__content p { margin: 0 0 1em; }
.single-article__content img { border-radius: 4px; margin: 16px 0; }
.single-article__content h2,
.single-article__content h3 {
    margin: 1.5em 0 0.5em;
    line-height: 1.3;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
/* Sticky sidebar on desktop (where the 2-column grid exists).
   align-self:start stops the grid item stretching full-height so sticky can move. */
@media (min-width: 992px) {
    .sidebar {
        position: sticky;
        top: 20px;
        align-self: start;
    }
}
.sidebar__widget {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.sidebar__widget h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    color: #1a1a1a;
    border-bottom: 2px solid var(--brand);
    padding-bottom: 8px;
}

/* ─── Footer (matching pekopeko style) ─────────────────────────────────── */
.site-footer {
    background: #1a1a1a;
    color: #bbb;
    padding: 48px 0 0;
    margin-top: 64px;
    font-size: 0.9rem;
    border-top: 4px solid var(--brand);
}

.site-footer__top {
    display: grid;
    gap: 32px;
    grid-template-columns: 1fr;
    padding-bottom: 32px;
}
@media (min-width: 600px)  { .site-footer__top { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px)  { .site-footer__top { grid-template-columns: 1.2fr 1fr 1fr 1.4fr; align-items: start; } }

.site-footer__col { min-width: 0; }

.site-footer__logo img { max-height: 60px; width: auto; margin-bottom: 16px; }

.site-footer__social {
    display: flex;
    gap: 8px;
}
.site-footer__social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #2a2a2a;
    color: #ccc !important;
    font-size: 14px;
    font-family: FontAwesome, sans-serif;
    transition: background 0.15s, color 0.15s;
}
.site-footer__social a:hover {
    background: var(--brand);
    color: #fff !important;
    text-decoration: none;
}

.site-footer__title {
    color: #fff;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2a2a2a;
    position: relative;
}
.site-footer__title::after {
    content: '';
    position: absolute;
    left: 0; bottom: -1px;
    width: 40px; height: 2px;
    background: var(--brand);
}

.site-footer__list {
    list-style: none;
    margin: 0; padding: 0;
}
.site-footer__list li { margin-bottom: 8px; }
.site-footer__list a {
    color: #bbb;
    font-size: 0.9rem;
    transition: color 0.15s;
}
.site-footer__list a:hover { color: var(--brand); text-decoration: none; }

.site-footer__list--2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.site-footer__pics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.site-footer__pic {
    position: relative;
    aspect-ratio: 1/1;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    overflow: hidden;
    display: block;
}
.site-footer__pic::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 60%);
    transition: background 0.2s;
}
.site-footer__pic:hover::before { background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(45,179,196,0.5)); }
.site-footer__pic-title {
    position: absolute;
    left: 8px; right: 8px; bottom: 8px;
    color: #fff;
    font-size: 11px;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.site-footer__bottom {
    border-top: 1px solid #2a2a2a;
    padding: 16px 0;
    text-align: center;
    font-size: 0.8rem;
    color: #888;
}

/* Back-to-top button */
.to-top {
    position: fixed;
    bottom: 24px; right: 24px;
    width: 44px; height: 44px;
    background: var(--brand);
    color: #fff !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 100;
    transition: background 0.15s, transform 0.15s;
    text-decoration: none !important;
}
.to-top:hover { background: var(--brand-dark); transform: translateY(-2px); }

/* ─── Ad-spot markers — Ad Inserter targets these by class name ───────── */
/* Slot classes: .content-top .sidebar-top .sidebar-bottom
   .under-content-top .under-content-bottom .in_article */
.content-top,
.sidebar-top,
.sidebar-bottom,
.under-content-top,
.under-content-bottom,
.in_article {
    margin: 24px 0;
    min-height: 1px;
}

/* ─── Pagination / Load more button ────────────────────────────────────── */
.alm-load-more-btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--brand);
    color: #fff !important;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s;
}
.alm-load-more-btn:hover { background: var(--brand-dark); text-decoration: none; }

/* ─── In-post page pagination (wp_link_pages) ───────────────────────────── */
.page-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 32px 0;
}
.page-pagination__label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #888;
    margin-right: 4px;
}
.page-pagination__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
/* Clickable page numbers (wrapped in <a>) */
.page-pagination a { text-decoration: none; }
.page-pagination a .page-pagination__num {
    background: #f0f3f5;
    color: var(--brand-dark);
    box-shadow: inset 0 0 0 1px #e1e7ea;
}
.page-pagination a:hover .page-pagination__num {
    background: var(--brand);
    color: #fff;
    box-shadow: inset 0 0 0 1px var(--brand);
}
/* Current page (plain span, not a link) */
.page-pagination > .page-pagination__num {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 6px rgba(45, 179, 196, 0.35);
}
