/*
Theme Name: America Facticity Stream
Theme URI: https://www.youtube.com/@AmericaFacticity
Author: America Facticity
Author URI: https://www.youtube.com/@AmericaFacticity
Description: A lightweight streaming-style news, video and podcast WordPress theme built for America Facticity. Features 16:9 media cards, hero carousel, ad-safe layout zones, accessible navigation and strong performance defaults.
Version: 3.0.0
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: america-facticity-stream
Tags: news, entertainment, video, podcast, dark, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

:root {
    --af-bg: #05080d;
    --af-bg-soft: #09101a;
    --af-panel: #0d1520;
    --af-panel-2: #111c2a;
    --af-line: rgba(255,255,255,.11);
    --af-text: #f5f7fa;
    --af-muted: #a9b2bf;
    --af-red: #ef252f;
    --af-red-dark: #bb111a;
    --af-white: #fff;
    --af-radius: 8px;
    --af-radius-lg: 14px;
    --af-shell: min(1540px, calc(100vw - 56px));
    --af-shadow: 0 18px 50px rgba(0,0,0,.35);
    --af-transition: 180ms ease;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: dark; }
body {
    margin: 0;
    background: radial-gradient(circle at 74% 0%, rgba(15,42,77,.22), transparent 33rem), var(--af-bg);
    color: var(--af-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
::selection { background: var(--af-red); color: #fff; }

.screen-reader-text {
    border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%); height: 1px;
    margin: -1px; overflow: hidden; padding: 0; position: absolute !important; width: 1px;
}
.screen-reader-text:focus, .skip-link:focus {
    clip: auto !important; clip-path: none; height: auto; width: auto; z-index: 100000;
    top: 8px; left: 8px; padding: 12px 16px; background: #fff; color: #111; border-radius: 4px;
}
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.af-shell { width: var(--af-shell); margin-inline: auto; }
.af-site-main { min-height: 65vh; }
.af-section { margin-block: 36px 46px; content-visibility: auto; contain-intrinsic-size: 1px 420px; }
.af-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.af-section-title { margin: 0; font-size: clamp(1.15rem, 1.7vw, 1.55rem); letter-spacing: -.025em; }
.af-section-title::after { content: ""; display: inline-block; width: 20px; height: 2px; margin-left: 11px; vertical-align: middle; background: var(--af-red); }
.af-view-all { color: var(--af-muted); font-weight: 650; font-size: .9rem; }
.af-view-all:hover { color: var(--af-white); }
.af-kicker { color: var(--af-red); font-weight: 800; text-transform: uppercase; font-size: .75rem; letter-spacing: .09em; }
.af-muted { color: var(--af-muted); }
.af-pill { display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--af-line); border-radius: 999px; padding: 6px 10px; font-size: .76rem; color: var(--af-muted); }

/* Header */
.af-header { position: sticky; top: 0; z-index: 1000; background: rgba(5,8,13,.92); border-bottom: 1px solid var(--af-line); backdrop-filter: blur(15px); }
.admin-bar .af-header { top: 32px; }
.af-header-inner { min-height: 72px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 32px; }
.af-brand { display: inline-flex; flex-direction: column; line-height: .86; font-weight: 900; letter-spacing: .015em; font-size: 1.38rem; white-space: nowrap; }
.af-brand-bottom { background: var(--af-red); margin-top: 5px; padding: 4px 7px 5px; font-size: .82rem; letter-spacing: .18em; }
.custom-logo { display: block; max-height: 48px; width: auto; }
.af-primary-nav { justify-self: center; }
.af-primary-nav ul { display: flex; align-items: center; gap: clamp(18px, 2.4vw, 38px); list-style: none; padding: 0; margin: 0; }
.af-primary-nav a { color: #e8ebef; font-weight: 650; font-size: .94rem; transition: color var(--af-transition); }
.af-primary-nav a:hover, .af-primary-nav .current-menu-item > a { color: var(--af-red); }
.af-header-actions { display: flex; align-items: center; gap: 12px; }
.af-icon-button { appearance: none; border: 0; background: transparent; display: inline-grid; place-items: center; width: 42px; height: 42px; cursor: pointer; border-radius: 50%; }
.af-icon-button:hover { background: rgba(255,255,255,.08); }
.af-youtube-button, .af-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 5px; padding: 10px 17px; background: var(--af-red); color: #fff; font-weight: 800; border: 0; cursor: pointer; transition: transform var(--af-transition), background var(--af-transition); }
.af-youtube-button:hover, .af-button:hover { background: #ff3440; transform: translateY(-1px); }
.af-button-secondary { background: rgba(255,255,255,.92); color: #111; }
.af-button-secondary:hover { background: #fff; }
.af-menu-toggle { display: none; }

/* Search overlay */
.af-search-overlay { position: fixed; inset: 0; z-index: 2000; display: none; background: rgba(2,4,8,.94); backdrop-filter: blur(18px); }
.af-search-overlay.is-open { display: grid; place-items: start center; padding-top: min(20vh, 180px); }
.af-search-panel { width: min(760px, calc(100vw - 32px)); }
.af-search-panel form { display: flex; gap: 10px; }
.af-search-panel input { width: 100%; background: #fff; color: #111; border: 0; border-radius: 6px; padding: 17px 18px; font-size: 1.1rem; }
.af-search-close { position: absolute; right: 22px; top: 22px; }

/* Hero */
.af-hero-wrap { width: min(1600px, calc(100vw - 36px)); margin: 0 auto; padding-top: 0; }
.af-hero { position: relative; min-height: clamp(390px, 39vw, 610px); overflow: hidden; border-radius: 0 0 var(--af-radius-lg) var(--af-radius-lg); background: #07101c; box-shadow: var(--af-shadow); }
.af-hero-track { position: relative; height: 100%; min-height: inherit; }
.af-hero-slide { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity 550ms ease; }
.af-hero-slide.is-active { opacity: 1; pointer-events: auto; z-index: 1; }
.af-hero-media, .af-hero-media img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; }
.af-hero-slide::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(3,7,12,.99) 0%, rgba(3,7,12,.86) 26%, rgba(3,7,12,.24) 57%, rgba(3,7,12,.03) 100%), linear-gradient(0deg, rgba(3,7,12,.52), transparent 45%); }
.af-hero-content { position: relative; z-index: 2; max-width: 560px; padding: clamp(54px, 7vw, 112px) clamp(32px, 6vw, 92px); }
.af-hero-title { margin: 14px 0 20px; font-size: clamp(2rem, 3.3vw, 3.7rem); line-height: 1.06; letter-spacing: -.045em; text-wrap: balance; }
.af-hero-meta { color: #c8d0da; display: flex; flex-wrap: wrap; gap: 9px 14px; margin-bottom: 24px; font-size: .9rem; }
.af-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.af-hero-nav { position: absolute; inset: 50% 18px auto; transform: translateY(-50%); z-index: 5; display: flex; justify-content: space-between; pointer-events: none; }
.af-hero-arrow { pointer-events: auto; width: 46px; height: 54px; border: 1px solid rgba(255,255,255,.14); background: rgba(0,0,0,.42); border-radius: 7px; display: grid; place-items: center; cursor: pointer; }
.af-hero-dots { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 12px; }
.af-hero-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.85); cursor: pointer; }
.af-hero-dot.is-active { background: var(--af-red); }

/* Horizontal media rails */
.af-rail-wrap { position: relative; }
.af-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(235px, 1fr); grid-template-rows: 1fr; gap: 14px; overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: inline mandatory; scrollbar-width: none; padding: 2px 1px 9px; }
.af-rail::-webkit-scrollbar { display: none; }
.af-rail > * { scroll-snap-align: start; min-width: 0; }
.af-rail-arrow { position: absolute; z-index: 4; right: -18px; top: 33%; width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(4,8,14,.86); display: grid; place-items: center; cursor: pointer; box-shadow: 0 9px 30px rgba(0,0,0,.45); }
.af-rail-arrow[data-direction="prev"] { left: -18px; right: auto; }

.af-media-card { min-width: 0; }
.af-card-thumb { display: block; position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--af-radius); background: var(--af-panel); border: 1px solid rgba(255,255,255,.08); }
.af-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 260ms ease, filter 260ms ease; }
.af-media-card:hover .af-card-thumb img { transform: scale(1.035); filter: brightness(1.05); }
.af-card-play { position: absolute; inset: auto auto 10px 10px; width: 36px; height: 36px; border-radius: 50%; background: rgba(239,37,47,.94); display: grid; place-items: center; opacity: 0; transform: translateY(5px); transition: var(--af-transition); }
.af-media-card:hover .af-card-play { opacity: 1; transform: none; }
.af-duration { position: absolute; right: 7px; bottom: 7px; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.84); color: #fff; font-size: .73rem; font-weight: 800; }
.af-card-title { margin: 9px 0 5px; font-size: .95rem; line-height: 1.35; font-weight: 720; letter-spacing: -.012em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.af-card-meta { color: var(--af-muted); font-size: .78rem; display: flex; gap: 7px; flex-wrap: wrap; }
.af-card-meta .views { color: var(--af-red); }

/* News cards */
.af-news-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 22px 16px; }
.af-news-card .af-card-title { font-size: 1rem; }
.af-news-card .af-card-summary { color: var(--af-muted); font-size: .85rem; margin: 7px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Podcast */
.af-podcast-card { display: grid; grid-template-columns: 92px 1fr; gap: 13px; align-items: center; min-width: 330px; background: linear-gradient(135deg, var(--af-panel-2), #090f18); border: 1px solid var(--af-line); border-radius: 11px; padding: 11px; }
.af-podcast-art { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #162131; }
.af-podcast-art img { width: 100%; height: 100%; object-fit: cover; }
.af-podcast-card .af-card-title { margin-top: 0; }
.af-podcast-button { color: var(--af-red); font-weight: 800; font-size: .8rem; }

/* Ads */
.af-ad-area { display: grid; place-items: center; width: 100%; overflow: hidden; margin: 26px auto; border-radius: 6px; }
.af-ad-area::before { content: "Advertisement"; display: block; color: #788391; text-transform: uppercase; letter-spacing: .12em; font-size: .62rem; margin-bottom: 5px; }
.af-ad-leaderboard { min-height: 112px; }
.af-ad-rectangle { min-height: 280px; }
.af-ad-inline { min-height: 290px; margin-block: 32px; }
.af-ad-area > div, .af-ad-area .widget { width: 100%; text-align: center; }

/* Newsletter */
.af-newsletter { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 30px; padding: clamp(28px,4vw,54px); border: 1px solid var(--af-line); border-radius: var(--af-radius-lg); background: linear-gradient(120deg, #111c2b, #090e16 67%); }
.af-newsletter h2 { margin: 0 0 8px; font-size: clamp(1.45rem,2.3vw,2.3rem); }
.af-newsletter p { margin: 0; color: var(--af-muted); }
.af-newsletter form { display: flex; gap: 9px; width: min(470px, 100%); }
.af-newsletter input[type="email"] { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 5px; border: 1px solid #364254; background: #fff; color: #111; }

/* Archive and page */
.af-page-header { padding-block: 56px 30px; border-bottom: 1px solid var(--af-line); }
.af-page-title { margin: 0; font-size: clamp(2rem,5vw,4.3rem); letter-spacing: -.05em; line-height: 1; }
.af-page-description { max-width: 780px; color: var(--af-muted); margin-top: 16px; }
.af-archive-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 28px 16px; margin-block: 34px 60px; }
.af-pagination { margin-block: 38px 60px; }
.af-pagination .nav-links { display: flex; gap: 7px; flex-wrap: wrap; }
.af-pagination .page-numbers { padding: 8px 12px; border: 1px solid var(--af-line); border-radius: 4px; }
.af-pagination .current { background: var(--af-red); border-color: var(--af-red); }

/* Single article */
.af-breadcrumbs { display: flex; gap: 8px; flex-wrap: wrap; color: var(--af-muted); font-size: .8rem; padding-top: 24px; }
.af-single-header { max-width: 1030px; margin: 0 auto; padding: 45px 0 28px; }
.af-single-title { margin: 10px 0 18px; font-size: clamp(2.25rem,5vw,5rem); line-height: 1.02; letter-spacing: -.052em; text-wrap: balance; }
.af-single-deck { max-width: 820px; color: #c7cfda; font-size: clamp(1.05rem,1.6vw,1.3rem); }
.af-byline { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--af-muted); font-size: .86rem; margin-top: 19px; }
.af-featured-image { margin: 0 auto 34px; width: min(1250px,100%); aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--af-panel); }
.af-featured-image img { width: 100%; height: 100%; object-fit: cover; }
.af-article-layout { display: grid; grid-template-columns: minmax(0,780px) 310px; justify-content: center; gap: 58px; align-items: start; }
.af-article-content { font-family: Georgia, "Times New Roman", serif; font-size: 1.12rem; line-height: 1.82; color: #e9edf2; }
.af-article-content > *:first-child { margin-top: 0; }
.af-article-content h2, .af-article-content h3, .af-article-content h4 { font-family: Inter, ui-sans-serif, system-ui, sans-serif; line-height: 1.2; letter-spacing: -.03em; margin-top: 2.2em; color: #fff; }
.af-article-content a { color: #ff6670; text-decoration: underline; text-underline-offset: 3px; }
.af-article-content blockquote { margin: 1.8em 0; padding: 5px 0 5px 24px; border-left: 4px solid var(--af-red); color: #fff; font-size: 1.2em; }
.af-article-content figure { margin-inline: 0; }
.af-sidebar { position: sticky; top: 100px; }
.af-sidebar-card { border: 1px solid var(--af-line); border-radius: 10px; padding: 18px; margin-bottom: 18px; background: var(--af-panel); }
.af-sidebar-card h3 { margin-top: 0; }
.af-share-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0; }
.af-share-row a, .af-copy-link { border: 1px solid var(--af-line); background: var(--af-panel); border-radius: 5px; padding: 8px 11px; font-size: .8rem; cursor: pointer; }

/* Video watch page */
.af-watch-shell { width: min(1280px, calc(100vw - 36px)); margin: 28px auto 0; }
.af-video-player { position: relative; aspect-ratio: 16/9; background: #000; overflow: hidden; border-radius: 10px; box-shadow: var(--af-shadow); }
.af-video-player img { width: 100%; height: 100%; object-fit: cover; }
.af-video-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.af-video-facade { width: 100%; height: 100%; border: 0; padding: 0; background: #000; cursor: pointer; position: relative; }
.af-video-facade::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.25), transparent); }
.af-big-play { position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--af-red); box-shadow: 0 15px 40px rgba(0,0,0,.55); }
.af-watch-info { max-width: 950px; padding: 24px 0; }
.af-watch-title { font-size: clamp(1.75rem,3vw,3rem); line-height: 1.12; margin: 0 0 12px; letter-spacing: -.035em; }

/* Podcast single */
.af-podcast-hero { display: grid; grid-template-columns: minmax(220px,360px) 1fr; gap: clamp(28px,5vw,70px); align-items: center; padding-block: 52px; }
.af-podcast-cover { aspect-ratio: 1; border-radius: 16px; overflow: hidden; box-shadow: var(--af-shadow); background: var(--af-panel); }
.af-podcast-cover img { width: 100%; height: 100%; object-fit: cover; }
.af-audio-player { width: 100%; margin-top: 24px; }
.af-podcast-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* Footer */
.af-footer { margin-top: 70px; border-top: 1px solid var(--af-line); background: #03060a; }
.af-footer-grid { padding-block: 48px 28px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 46px; }
.af-footer h3 { margin: 0 0 12px; font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; }
.af-footer p, .af-footer a { color: var(--af-muted); font-size: .88rem; }
.af-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.af-footer-bottom { border-top: 1px solid var(--af-line); padding-block: 18px; display: flex; justify-content: space-between; gap: 18px; color: #747e8c; font-size: .77rem; }

/* Forms and comments */
.af-form input, .af-form textarea, .comment-form input, .comment-form textarea { width: 100%; border: 1px solid #344052; background: #0d1520; color: #fff; border-radius: 5px; padding: 11px 12px; }
.comment-list { list-style: none; padding: 0; }
.comment-body { border-top: 1px solid var(--af-line); padding-block: 20px; }

/* Utility empty state */
.af-empty { border: 1px dashed #334052; border-radius: 10px; padding: 32px; color: var(--af-muted); text-align: center; }

@media (min-width: 1350px) {
    .af-rail { grid-auto-columns: calc((100% - 56px) / 5); }
}
@media (max-width: 1100px) {
    :root { --af-shell: min(100% - 34px, 1300px); }
    .af-primary-nav { display: none; position: fixed; inset: 72px 0 auto; padding: 22px; background: #05080d; border-bottom: 1px solid var(--af-line); }
    .af-primary-nav.is-open { display: block; }
    .af-primary-nav ul { align-items: stretch; flex-direction: column; gap: 0; }
    .af-primary-nav a { display: block; padding: 11px 0; }
    .af-menu-toggle { display: inline-grid; }
    .af-header-inner { grid-template-columns: 1fr auto; }
    .af-header-actions { grid-column: 2; grid-row: 1; }
    .af-news-grid, .af-archive-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .af-article-layout { grid-template-columns: minmax(0,760px); }
    .af-sidebar { position: static; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
}
@media (max-width: 780px) {
    .admin-bar .af-header { top: 46px; }
    :root { --af-shell: calc(100vw - 28px); }
    .af-header-inner { min-height: 64px; gap: 10px; }
    .af-brand { font-size: 1.05rem; }
    .af-brand-bottom { font-size: .64rem; }
    .af-youtube-button { display: none; }
    .af-primary-nav { top: 64px; }
    .af-hero-wrap { width: 100%; }
    .af-hero { border-radius: 0; min-height: 500px; }
    .af-hero-slide::before { background: linear-gradient(0deg, rgba(3,7,12,.99) 5%, rgba(3,7,12,.76) 56%, rgba(3,7,12,.08) 100%); }
    .af-hero-content { position: absolute; inset: auto 0 0; padding: 32px 22px 48px; max-width: none; }
    .af-hero-title { font-size: clamp(1.75rem,8vw,2.65rem); }
    .af-hero-nav { inset-inline: 8px; }
    .af-hero-arrow { width: 39px; height: 46px; }
    .af-section { margin-block: 27px 38px; }
    .af-rail { grid-auto-columns: 78%; gap: 12px; }
    .af-rail-arrow { display: none; }
    .af-news-grid, .af-archive-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px 12px; }
    .af-newsletter { grid-template-columns: 1fr; }
    .af-newsletter form { flex-direction: column; }
    .af-article-layout { display: block; }
    .af-single-header { padding-top: 32px; }
    .af-single-title { font-size: clamp(2rem,10vw,3.3rem); }
    .af-article-content { font-size: 1.05rem; }
    .af-sidebar { display: block; margin-top: 40px; }
    .af-podcast-hero { grid-template-columns: 1fr; }
    .af-podcast-cover { max-width: 320px; }
    .af-footer-grid { grid-template-columns: 1fr 1fr; }
    .af-footer-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
    .af-news-grid, .af-archive-grid { grid-template-columns: 1fr; }
    .af-rail { grid-auto-columns: 84%; }
    .af-podcast-card { min-width: 285px; grid-template-columns: 76px 1fr; }
    .af-footer-grid { grid-template-columns: 1fr; }
    .af-footer-grid > :first-child { grid-column: auto; }
    .af-footer-bottom { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
