/* news_lonotv/assets/css/style.css */

/* Same accent top border lonotv/ uses on its nav, so this reads as
   the same product rather than a visually unrelated app. */
.navbar {
    border-top: 3px solid var(--accent-primary);
    padding-top: calc(1rem - 3px);
}

/* News-specific override: the shared token styles the active nav
   link the same near-black as hover, which doesn't read as "current
   page" against Home/category links — brand red makes it obvious. */
.nav-link.active {
    color: var(--accent-primary);
}

/* Wraps the category links app.js populates into .nav-links —
   "disappears" from layout so they sit in the same flex row as Home
   and LonoTV rather than as a nested block. */
.nav-categories {
    display: contents;
}

/* Category pill — used on the hero, every card, and the detail page.
   One fixed accent color for every category, matching the reference
   layout (it doesn't color-code categories either). */
.category-pill {
    display: inline-block;
    background: var(--accent-primary);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.7rem;
    border-radius: 4px;
    margin-bottom: 0.6rem;
}

/* Breaking news ticker */
.breaking-ticker[hidden] {
    display: none;
}

.breaking-ticker {
    background: var(--accent-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
}

.breaking-ticker-label {
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 1rem 0.5rem 5%;
}

.breaking-ticker-viewport {
    overflow: hidden;
    flex: 1;
    padding-right: 5%;
}

.breaking-ticker-track {
    display: flex;
    width: max-content;
    gap: 2.5rem;
    padding: 0.5rem 1.5rem;
    animation: breaking-ticker-scroll 30s linear infinite;
}

.breaking-ticker-track:hover {
    animation-play-state: paused;
}

.breaking-ticker-track a {
    text-decoration: none;
    color: inherit;
    font-size: 0.9rem;
    white-space: nowrap;
}

.breaking-ticker-track a:hover {
    text-decoration: underline;
}

.breaking-ticker-sep {
    margin-right: 2.5rem;
    opacity: 0.6;
}

@keyframes breaking-ticker-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    .breaking-ticker-track {
        animation: none;
    }
}

/* Search bar — its own full-width strip directly under the navbar. */
.search-bar-section {
    padding: 1.25rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.search-form {
    width: 100%;
}

.search-form input {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.9rem 1.25rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    width: 100%;
}

/* Featured hero — the lead story. A full-bleed picture with the
   title/excerpt overlaid on top (gradient scrim for legibility)
   rather than a side-by-side image+text layout. */
.featured-hero-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

.featured-hero {
    position: relative;
    height: 420px;
    margin-bottom: 2rem;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.hero-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-cover-placeholder {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.25) 55%, rgba(0, 0, 0, 0) 100%);
}

.hero-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2rem 2.25rem;
}

.hero-content h1 {
    font-size: 2.1rem;
    line-height: 1.15;
    margin-bottom: 0.6rem;
    color: #ffffff;
}

.hero-content h1 a {
    text-decoration: none;
    color: inherit;
}

.hero-content h1 a:hover {
    text-decoration: underline;
}

.hero-content p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    margin-bottom: 0.6rem;
    max-width: 640px;
}

.hero-meta {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
}

/* Latest News section */
.articles-section {
    padding: 1rem 5% 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.6rem;
}

.section-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.category-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.category-filter label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.category-filter select {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.9rem;
    color: var(--text-primary);
    font-family: inherit;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.article-card {
    display: block;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.article-card:hover {
    transform: translateY(-3px);
}

.card-cover {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
}

.card-cover-placeholder {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.article-card-body {
    padding: 1.25rem;
}

/* Clamped to a fixed number of lines rather than left free-height —
   keeps every card (and the skeleton placeholder it replaces) the same
   height regardless of title/excerpt length, so the grid doesn't
   reflow when real content swaps in or when paging between articles. */
.article-card h3 {
    font-size: 1.15rem;
    line-height: 1.3;
    margin-bottom: 0.4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.3em * 2);
}

.article-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.6 * 0.9rem * 2);
}

.article-card .article-meta,
.article-detail .article-meta {
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: flex;
    gap: 0.75rem;
}

.articles-pagination {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2.5rem;
}

.articles-pagination button {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
}

.articles-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Skeleton loader — shown while articles are fetched. Sized to match
   real cards/detail layout so nothing jumps once content arrives, with
   a brand-tinted shimmer sweep instead of a plain gray placeholder. */
.skeleton-block {
    background: linear-gradient(100deg, rgba(0, 0, 0, 0.04) 30%, var(--accent-glow) 50%, rgba(0, 0, 0, 0.04) 70%);
    background-size: 250% 100%;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
    border-radius: var(--border-radius-sm);
}

.skeleton-card .card-cover {
    background: linear-gradient(100deg, rgba(0, 0, 0, 0.04) 30%, var(--accent-glow) 50%, rgba(0, 0, 0, 0.04) 70%);
    background-size: 250% 100%;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
    border-radius: 0;
}

.skeleton-line {
    height: 0.85rem;
    margin-bottom: 0.6rem;
}

.skeleton-line.title {
    height: 1.1rem;
    width: 80%;
}

.skeleton-line.short {
    width: 45%;
    margin-bottom: 0;
}

.skeleton-cover-lg {
    height: 320px;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius-lg);
}

/* Staggered delay per card so the shimmer ripples across the grid
   instead of every placeholder pulsing in lockstep. */
.articles-grid .skeleton-card:nth-child(2) .skeleton-block,
.articles-grid .skeleton-card:nth-child(2) .card-cover { animation-delay: 0.12s; }
.articles-grid .skeleton-card:nth-child(3) .skeleton-block,
.articles-grid .skeleton-card:nth-child(3) .card-cover { animation-delay: 0.24s; }
.articles-grid .skeleton-card:nth-child(4) .skeleton-block,
.articles-grid .skeleton-card:nth-child(4) .card-cover { animation-delay: 0.36s; }
.articles-grid .skeleton-card:nth-child(5) .skeleton-block,
.articles-grid .skeleton-card:nth-child(5) .card-cover { animation-delay: 0.48s; }
.articles-grid .skeleton-card:nth-child(6) .skeleton-block,
.articles-grid .skeleton-card:nth-child(6) .card-cover { animation-delay: 0.6s; }

@keyframes skeleton-shimmer {
    0% { background-position: 200% 50%; }
    100% { background-position: -50% 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-block,
    .skeleton-card .card-cover {
        animation: none;
    }
}

/* Article detail */
.article-detail {
    padding: 3rem 5% 4rem;
    max-width: 760px;
    margin: 0 auto;
}

.article-detail h1 {
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
}

.article-detail .article-meta {
    margin-bottom: 1.5rem;
}

.article-detail-cover {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
}

/* article.body is HTML from the admin's rich-text editor (see
   Sanitizer::sanitizeRichText on the backend) rather than plain text, so
   this styles real block elements — pre-wrap stays as a fallback for
   articles saved before the editor existed, whose body is still a plain
   string with manual line breaks and no tags to lay it out. */
.article-detail .article-body {
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-wrap;
}

.article-detail .article-body p {
    margin-bottom: 1rem;
}

.article-detail .article-body h2,
.article-detail .article-body h3 {
    color: var(--text-primary);
    margin: 1.75rem 0 0.75rem;
}

.article-detail .article-body ul,
.article-detail .article-body ol {
    margin: 0 0 1rem 1.5rem;
}

.article-detail .article-body blockquote {
    border-left: 3px solid var(--accent-primary);
    padding-left: 1.25rem;
    margin: 0 0 1rem;
    font-style: italic;
}

.article-detail .article-body a {
    color: var(--accent-primary);
    text-decoration: underline;
}

.article-detail .article-body mark {
    background: #fff3a0;
    color: var(--text-primary);
}

.related-posts {
    padding: 1rem 5% 4rem;
    max-width: 900px;
    margin: 0 auto;
}

.related-posts h2 {
    font-size: 1.3rem;
    margin-bottom: 1.25rem;
}

/* Mobile nav — hamburger toggle + slide-in drawer for #nav-links.
   Same pattern lonotv/assets/css/style.css and lonotv/assets/js/app.js
   already use (wireMobileNav there, wireMobileNav in this app's own
   app.js) — kept local to this app rather than shared, since
   news_lonotv is the only app whose nav length is unbounded (category
   links come from the database, see .nav-categories in app.js). A
   horizontal-scroll strip was tried here first, but it hides links
   with no visual hint they're swipeable — a real drawer, where every
   link is visible at once, is the more usable fix. */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    /* Kept short on mobile so the hero doesn't push the article grid
       below the fold — it's a teaser, not the main event on a phone. */
    .featured-hero {
        height: 200px;
        margin-bottom: 1.25rem;
        border-radius: var(--border-radius-sm);
    }

    .hero-content {
        padding: 1rem 1.1rem;
    }

    .hero-content h1 {
        font-size: 1.15rem;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .hero-content p,
    .hero-meta {
        display: none;
    }

    .section-controls {
        width: 100%;
    }

    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .card-cover,
    .card-cover-placeholder {
        height: 100px;
    }

    .article-card-body {
        padding: 0.65rem;
    }

    .article-card h3 {
        font-size: 0.9rem;
        line-height: 1.25;
        margin-bottom: 0.25rem;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .article-card p {
        display: none;
    }

    .article-card .article-meta {
        font-size: 0.7rem;
        gap: 0.5rem;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 80px;
        right: 0;
        width: min(78%, 320px);
        height: calc(100vh - 80px);
        background: #ffffff;
        border-left: 1px solid var(--border-color);
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        padding: 1.5rem;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

    .nav-links.is-open {
        transform: translateX(0);
    }

    .nav-links .nav-link {
        padding: 0.75rem 0.25rem;
        border-bottom: 1px solid var(--border-color);
        font-size: 1.05rem;
    }
}
