/*
Theme Name: TechFront360 Pro
Theme URI: https://techfront360.com
Author: TechFront360 Principal Engineering Team
Author URI: https://techfront360.com
Description: Enterprise-grade, TechCrunch-inspired Tech & AI News WordPress Theme engineered for techfront360.com. v5.0.0 fixes Hero Grid column overlap on desktop, fixes mobile viewport width overflow, adds WordPress Admin Bar sticky offset support, preserves all existing post permalinks, disables comments site-wide, and delivers 95+ Core Web Vitals on Desktop & Mobile.
Version: 5.0.0
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: techfront360
Tags: news, blog, technology, artificial-intelligence, two-columns, right-sidebar, custom-menu, featured-images, theme-options, accessibility-ready
*/

:root {
  --tf-emerald: #00a562;
  --tf-emerald-bright: #00d474;
  --tf-emerald-dark: #057a4a;
  --tf-emerald-tint: rgba(0, 165, 98, 0.1);
  --tf-obsidian: #0b0f17;
  --tf-surface-dark: #111827;
  --tf-bg: #f8fafc;
  --tf-card: #ffffff;
  --tf-card-alt: #f1f5f9;
  --tf-text: #0f172a;
  --tf-text-secondary: #334155;
  --tf-text-muted: #64748b;
  --tf-border: #e2e8f0;
  --tf-border-strong: #cbd5e1;
  --tf-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --tf-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.07);
  --tf-shadow-lg: 0 16px 36px -4px rgba(15, 23, 42, 0.14);
  --tf-radius-sm: 6px;
  --tf-radius: 12px;
  --tf-radius-lg: 16px;
  --tf-font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
  --tf-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

html[data-theme="dark"] {
  --tf-bg: #070a10;
  --tf-card: #111726;
  --tf-card-alt: #1a2234;
  --tf-text: #f8fafc;
  --tf-text-secondary: #cbd5e1;
  --tf-text-muted: #94a3b8;
  --tf-border: #1e293b;
  --tf-border-strong: #334155;
  --tf-emerald-tint: rgba(0, 212, 116, 0.14);
  --tf-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeSpeed;
  overflow-x: clip;
  max-width: 100%;
}

body {
  font-family: var(--tf-font-sans);
  background-color: var(--tf-bg);
  color: var(--tf-text);
  line-height: 1.65;
  overflow-x: clip;
  max-width: 100%;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Global Grid & Flex Child Overflow Prevention */
.tf-hero-grid > *,
.tf-main-layout > *,
.tf-river-card > *,
.tf-footer-grid > *,
.tf-form-grid > *,
.tf-photo-upload-grid > *,
.tf-photo-showcase-grid > * {
  min-width: 0;
  max-width: 100%;
}

.tf-skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--tf-emerald);
  color: #fff;
  padding: 0.6rem 1.2rem;
  font-weight: 800;
  border-radius: var(--tf-radius-sm);
  z-index: 100000;
  transition: top 0.15s ease;
}

.tf-skip-link:focus {
  top: 12px;
  color: #fff;
  outline: 3px solid var(--tf-emerald-bright);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--tf-emerald);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.tf-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* GPU-Composited Reading Progress Bar (Respects WP Admin Bar) */
.tf-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--tf-emerald) 0%, var(--tf-emerald-bright) 100%);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 1001;
  pointer-events: none;
  will-change: transform;
}

body.admin-bar .tf-progress-bar {
  top: 32px;
}

/* ==========================================================================
   TOP BREAKING NEWS TICKER BAR
   ========================================================================== */
.tf-topbar {
  background: #05080e;
  color: #cbd5e1;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 36px;
  display: flex;
  align-items: center;
  width: 100%;
}

.tf-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.tf-pulse-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  overflow: hidden;
}

.tf-pulse-badge {
  background: var(--tf-emerald);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.tf-pulse-dot {
  width: 6px;
  height: 6px;
  background: #ffffff;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.tf-pulse-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #cbd5e1;
}

.tf-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.tf-topbar-date {
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.75rem;
  white-space: nowrap;
}

.tf-theme-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 0.18rem 0.62rem;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.tf-theme-toggle:hover {
  border-color: var(--tf-emerald-bright);
  color: var(--tf-emerald-bright);
}

/* ==========================================================================
   STICKY EDITORIAL HEADER & PRIMARY NAVIGATION (WP ADMIN BAR SAFE)
   ========================================================================== */
.tf-header {
  background: var(--tf-obsidian);
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 999;
  border-bottom: 3px solid var(--tf-emerald);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
  width: 100%;
}

/* Offset sticky header when WordPress Admin Bar is visible */
body.admin-bar .tf-header {
  top: 32px;
}

.tf-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  gap: 0.85rem;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.tf-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  flex-shrink: 0;
}

.tf-brand-monogram {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--tf-emerald) 0%, var(--tf-emerald-bright) 100%);
  color: var(--tf-obsidian);
  font-weight: 900;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.04em;
  box-shadow: 0 0 16px rgba(0, 212, 116, 0.32);
  flex-shrink: 0;
}

.tf-brand-text {
  display: flex;
  flex-direction: column;
}

.tf-brand-title {
  font-size: 1.42rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1.05;
}

.tf-brand-title span {
  color: var(--tf-emerald-bright);
}

.tf-brand-tagline {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #94a3b8;
  margin-top: 2px;
}

/* Single-line scrollable nav on desktop so 7 long categories never wrap into 2 rows */
.tf-nav {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: center;
}

.tf-nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0.15rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}

.tf-nav-list::-webkit-scrollbar {
  display: none;
}

.tf-nav-list li {
  flex-shrink: 0;
}

.tf-nav-list li a {
  display: inline-block;
  padding: 0.42rem 0.62rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #e2e8f0;
  border-radius: var(--tf-radius-sm);
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tf-nav-list li a:hover,
.tf-nav-list li.current-menu-item a,
.tf-nav-list li.current-cat a {
  background: rgba(0, 212, 116, 0.14);
  color: var(--tf-emerald-bright);
}

/* Header Search & Live Dropdown */
.tf-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  flex-shrink: 0;
}

.tf-search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.tf-search-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-radius: 999px;
  padding: 0.44rem 2.2rem 0.44rem 0.9rem;
  font-size: 0.82rem;
  width: 190px;
  max-width: 100%;
  transition: width 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.tf-search-input::placeholder {
  color: #94a3b8;
}

.tf-search-input:focus {
  outline: none;
  width: 230px;
  background: rgba(15, 23, 42, 0.98);
  border-color: var(--tf-emerald-bright);
  box-shadow: 0 0 0 3px rgba(0, 212, 116, 0.2);
}

.tf-search-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--tf-emerald-bright);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.tf-mobile-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: var(--tf-radius-sm);
  padding: 0.42rem 0.72rem;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.tf-live-search-results {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 2.5rem);
  background: var(--tf-card);
  color: var(--tf-text);
  border-radius: var(--tf-radius);
  box-shadow: var(--tf-shadow-lg);
  border: 1px solid var(--tf-border);
  z-index: 1000;
  display: none;
  overflow: hidden;
}

.tf-live-search-results.active {
  display: block;
}

.tf-live-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.72rem 0.95rem;
  border-bottom: 1px solid var(--tf-border);
}

.tf-live-item:last-child {
  border-bottom: none;
}

.tf-live-item:hover {
  background: var(--tf-card-alt);
}

.tf-live-item img {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--tf-obsidian);
}

.tf-live-item-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--tf-text);
  line-height: 1.32;
}

.tf-live-item-cat {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--tf-emerald);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
}

/* ==========================================================================
   CATEGORY RIBBON PILLS (7 CORE TECH & AI CHANNELS)
   ========================================================================== */
.tf-cat-ribbon {
  background: var(--tf-card);
  border-bottom: 1px solid var(--tf-border);
  min-height: 48px;
  display: flex;
  align-items: center;
  width: 100%;
}

.tf-cat-ribbon-inner {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.45rem 1.25rem;
  width: 100%;
}

.tf-cat-ribbon-inner::-webkit-scrollbar {
  display: none;
}

.tf-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.82rem;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
  background: var(--tf-card-alt);
  color: var(--tf-text-secondary);
  white-space: nowrap;
  border: 1px solid transparent;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.tf-cat-pill:hover,
.tf-cat-pill.active {
  background: var(--tf-obsidian);
  color: var(--tf-emerald-bright);
  border-color: var(--tf-emerald);
}

/* ==========================================================================
   ZERO-CLS GOOGLE ADSENSE COMPLIANT CONTAINERS
   ========================================================================== */
.tf-ad-wrapper {
  margin: 1.75rem auto;
  padding: 0.85rem 1rem 1rem;
  background: var(--tf-card);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
  text-align: center;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  contain: layout paint;
  clear: both;
}

.tf-ad-label {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--tf-text-muted);
  margin-bottom: 0.55rem;
  text-align: center;
}

.tf-ad-slot {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tf-card-alt);
  border-radius: var(--tf-radius-sm);
  overflow: hidden;
}

.tf-ad-slot-inarticle,
.tf-ad-slot-sidebar {
  min-height: 280px;
}

.tf-ad-placeholder-note {
  font-size: 0.78rem;
  color: var(--tf-text-muted);
  padding: 1rem;
}

/* ==========================================================================
   TECHCRUNCH HERO FEATURE GRID (FIXED: ZERO OVERLAP & ZERO MOBILE OVERFLOW)
   ========================================================================== */
.tf-hero-section {
  padding: 1.65rem 0 1.25rem;
  width: 100%;
}

.tf-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  gap: 1.65rem;
  align-items: stretch;
  width: 100%;
}

/* Fixed: No aspect-ratio on flex/grid stretch container so height never inflates width! */
.tf-hero-lead {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 460px;
  border-radius: var(--tf-radius-lg);
  overflow: hidden;
  background: var(--tf-obsidian);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: var(--tf-shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tf-hero-lead-img {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: cover;
  opacity: 0.58;
  transition: transform 0.35s ease, opacity 0.25s ease;
}

.tf-hero-lead:hover .tf-hero-lead-img {
  transform: scale(1.025);
  opacity: 0.68;
}

.tf-hero-lead-overlay {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  background: linear-gradient(180deg, rgba(11, 15, 23, 0.02) 0%, rgba(11, 15, 23, 0.86) 48%, rgba(11, 15, 23, 0.98) 100%);
  padding: 2rem;
  color: #ffffff;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.tf-badge {
  display: inline-flex;
  align-items: center;
  background: var(--tf-emerald);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.26rem 0.68rem;
  border-radius: 5px;
  margin-bottom: 0.75rem;
  max-width: 100%;
}

.tf-badge:hover {
  background: var(--tf-emerald-bright);
  color: var(--tf-obsidian);
}

.tf-hero-lead-title {
  font-size: clamp(1.38rem, 2.2vw, 2.15rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
  color: #ffffff;
  overflow-wrap: break-word;
}

.tf-hero-lead-title a:hover {
  color: var(--tf-emerald-bright);
}

.tf-hero-lead-excerpt {
  color: #cbd5e1;
  font-size: 0.94rem;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tf-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.78rem;
  color: var(--tf-text-muted);
  font-weight: 600;
  flex-wrap: wrap;
}

.tf-hero-lead .tf-meta {
  color: #94a3b8;
}

.tf-meta-photo-count {
  color: var(--tf-emerald-bright);
  font-weight: 800;
}

.tf-hero-stack {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: var(--tf-card);
  border-radius: var(--tf-radius-lg);
  border: 1px solid var(--tf-border);
  padding: 1.35rem 1.45rem;
  box-shadow: var(--tf-shadow);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-wrap: break-word;
}

.tf-stack-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.8rem;
  margin-bottom: 0.85rem;
  border-bottom: 2px solid var(--tf-text);
}

.tf-stack-title {
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tf-text);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.tf-stack-title::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--tf-emerald);
  display: inline-block;
  border-radius: 2px;
  flex-shrink: 0;
}

.tf-stack-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.tf-stack-item {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--tf-border);
}

.tf-stack-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tf-stack-cat {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--tf-emerald);
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.18rem;
}

.tf-stack-item-title {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.34;
  color: var(--tf-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tf-stack-item-title a:hover {
  color: var(--tf-emerald);
}

.tf-stack-time {
  font-size: 0.72rem;
  color: var(--tf-text-muted);
  margin-top: 0.22rem;
  display: block;
}

/* ==========================================================================
   MAIN TWO-COLUMN LAYOUT (RIVER FEED + STICKY SIDEBAR)
   ========================================================================== */
.tf-main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 2.25rem;
  padding: 1.5rem 1.25rem 3.5rem;
  align-items: start;
  width: 100%;
}

.tf-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--tf-text);
  padding-bottom: 0.65rem;
  margin-bottom: 1.4rem;
}

.tf-section-heading h2,
.tf-section-heading h1 {
  font-size: 1.22rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--tf-text);
}

.tf-section-heading h2::before,
.tf-section-heading h1::before {
  content: "";
  width: 11px;
  height: 11px;
  background: var(--tf-emerald);
  display: inline-block;
  border-radius: 2px;
  flex-shrink: 0;
}

.tf-river-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

.tf-river-card {
  background: var(--tf-card);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 1.35rem;
  align-items: center;
  box-shadow: var(--tf-shadow-sm);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  content-visibility: auto;
  contain-intrinsic-size: 0 210px;
  width: 100%;
}

.tf-river-card:hover {
  transform: translateY(-2px);
  border-color: var(--tf-emerald);
  box-shadow: var(--tf-shadow);
}

.tf-river-thumb-wrap {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  height: 160px;
  background: var(--tf-obsidian);
  display: block;
}

.tf-river-thumb {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.tf-river-card:hover .tf-river-thumb {
  transform: scale(1.04);
}

.tf-photo-pill {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(11, 15, 23, 0.88);
  color: var(--tf-emerald-bright);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
}

.tf-river-cat {
  display: inline-block;
  font-size: 0.71rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tf-emerald);
  margin-bottom: 0.3rem;
}

.tf-river-title {
  font-size: 1.22rem;
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: -0.015em;
  margin-bottom: 0.5rem;
  color: var(--tf-text);
  overflow-wrap: break-word;
}

.tf-river-excerpt {
  font-size: 0.91rem;
  color: var(--tf-text-secondary);
  margin-bottom: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   SIDEBAR WIDGETS
   ========================================================================== */
.tf-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.65rem;
  position: sticky;
  top: 90px;
  width: 100%;
}

body.admin-bar .tf-sidebar {
  top: 122px;
}

.tf-widget {
  background: var(--tf-card);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
  padding: 1.35rem;
  box-shadow: var(--tf-shadow-sm);
  width: 100%;
}

.tf-widget-title {
  font-size: 0.88rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.65rem;
  margin-bottom: 0.95rem;
  border-bottom: 2px solid var(--tf-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--tf-text);
}

.tf-trending-list {
  list-style: none;
  counter-reset: trend-counter;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.tf-trending-item {
  counter-increment: trend-counter;
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--tf-border);
}

.tf-trending-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tf-trending-item::before {
  content: "0" counter(trend-counter);
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--tf-emerald);
  line-height: 1.1;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.tf-trending-link {
  font-size: 0.89rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--tf-text);
  overflow-wrap: break-word;
}

.tf-cat-dir-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.tf-cat-dir-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.52rem 0.75rem;
  border-radius: 8px;
  background: var(--tf-card-alt);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--tf-text);
  transition: all 0.15s ease;
}

.tf-cat-dir-list li a:hover {
  background: var(--tf-obsidian);
  color: var(--tf-emerald-bright);
}

.tf-cat-count {
  background: var(--tf-emerald-tint);
  color: var(--tf-emerald);
  padding: 0.08rem 0.48rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 800;
}

/* ==========================================================================
   SINGLE ARTICLE VIEW, AUTO TABLE OF CONTENTS & 2-3 PHOTO SHOWCASE
   ========================================================================== */
.tf-breadcrumbs {
  font-size: 0.78rem;
  color: var(--tf-text-muted);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-weight: 600;
}

.tf-breadcrumbs a {
  color: var(--tf-emerald);
}

.tf-single-article {
  background: var(--tf-card);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius-lg);
  padding: 2.25rem;
  box-shadow: var(--tf-shadow-sm);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
}

.tf-single-header {
  margin-bottom: 1.65rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--tf-border);
}

.tf-single-title {
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  font-weight: 900;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: var(--tf-text);
  margin: 0.55rem 0 0.95rem;
  overflow-wrap: break-word;
}

.tf-share-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--tf-border);
  flex-wrap: wrap;
}

.tf-share-btns {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tf-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.7rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--tf-card-alt);
  color: var(--tf-text-secondary);
  border: 1px solid var(--tf-border);
  cursor: pointer;
}

.tf-share-btn:hover {
  border-color: var(--tf-emerald);
  color: var(--tf-emerald);
}

.tf-tldr-box {
  background: var(--tf-emerald-tint);
  border-left: 4px solid var(--tf-emerald);
  border-radius: 0 10px 10px 0;
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.65rem;
}

.tf-tldr-title {
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tf-emerald);
  margin-bottom: 0.35rem;
}

.tf-toc-box {
  background: var(--tf-card-alt);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
}

.tf-toc-title {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tf-text);
  margin-bottom: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tf-toc-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.1rem;
  font-size: 0.86rem;
  font-weight: 700;
}

.tf-toc-list a {
  color: var(--tf-emerald);
}

.tf-toc-list a:hover {
  text-decoration: underline;
}

.tf-hero-figure {
  margin: 0 0 1.85rem;
  border-radius: var(--tf-radius);
  overflow: hidden;
  background: var(--tf-obsidian);
  border: 1px solid var(--tf-border);
  width: 100%;
}

.tf-hero-figure-media {
  width: 100%;
  max-height: 500px;
  overflow: hidden;
  background: var(--tf-obsidian);
}

.tf-hero-figure-media img {
  width: 100% !important;
  height: auto !important;
  max-height: 500px;
  object-fit: cover;
  cursor: zoom-in;
}

.tf-figcaption {
  padding: 0.62rem 1rem;
  font-size: 0.79rem;
  color: var(--tf-text-muted);
  background: var(--tf-card-alt);
  border-top: 1px solid var(--tf-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tf-entry-content {
  font-size: 1.075rem;
  line-height: 1.8;
  color: var(--tf-text-secondary);
  width: 100%;
  max-width: 100%;
  overflow-wrap: break-word;
}

.tf-entry-content p {
  margin-bottom: 1.35rem;
}

.tf-entry-content h2,
.tf-entry-content h3 {
  color: var(--tf-text);
  font-weight: 800;
  margin: 2rem 0 0.85rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  scroll-margin-top: 110px;
}

.tf-entry-content ul,
.tf-entry-content ol {
  margin: 0 0 1.35rem 1.5rem;
}

.tf-entry-content blockquote {
  border-left: 4px solid var(--tf-emerald);
  padding: 0.85rem 1.25rem;
  background: var(--tf-card-alt);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  margin: 1.5rem 0;
}

.tf-entry-content pre {
  background: #0b0f17;
  color: #e2e8f0;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--tf-font-mono);
  font-size: 0.88rem;
  margin: 1.5rem 0;
  max-width: 100%;
}

.tf-entry-content img,
.tf-entry-content figure,
.tf-entry-content iframe,
.tf-entry-content video,
.tf-entry-content table {
  max-width: 100% !important;
  height: auto !important;
}

.tf-inline-figure {
  margin: 2.25rem 0;
  border-radius: var(--tf-radius);
  overflow: hidden;
  border: 1px solid var(--tf-border);
  background: var(--tf-card-alt);
  box-shadow: var(--tf-shadow-sm);
  width: 100%;
}

.tf-inline-figure-media {
  width: 100%;
  max-height: 480px;
  overflow: hidden;
  background: var(--tf-obsidian);
}

.tf-inline-figure-media img {
  width: 100% !important;
  height: auto !important;
  max-height: 480px;
  object-fit: cover;
  cursor: zoom-in;
}

.tf-photo-showcase {
  margin: 2.25rem 0 1.5rem;
  padding: 1.35rem;
  background: var(--tf-card-alt);
  border-radius: var(--tf-radius);
  border: 1px solid var(--tf-border);
  width: 100%;
}

.tf-photo-showcase-title {
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tf-text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tf-photo-showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  width: 100%;
}

.tf-photo-card {
  background: var(--tf-card);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--tf-border);
  width: 100%;
}

.tf-photo-card-media {
  width: 100%;
  height: 170px;
  overflow: hidden;
  background: var(--tf-obsidian);
}

.tf-photo-card-media img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.22s ease;
}

.tf-photo-card-media img:hover {
  transform: scale(1.04);
}

.tf-photo-card-cap {
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  color: var(--tf-text-secondary);
  font-weight: 600;
}

.tf-author-box {
  margin-top: 2rem;
  padding: 1.25rem;
  border-radius: var(--tf-radius);
  background: var(--tf-card-alt);
  border: 1px solid var(--tf-border);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tf-author-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--tf-obsidian);
  color: var(--tf-emerald-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  flex-shrink: 0;
  border: 2px solid var(--tf-emerald);
}

.tf-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 16, 0.94);
  z-index: 100001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.tf-lightbox.open {
  display: flex;
}

.tf-lightbox img {
  max-width: 92vw;
  max-height: 86vh;
  width: auto !important;
  height: auto !important;
  border-radius: 10px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

.tf-lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  background: var(--tf-emerald);
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
}

/* ==========================================================================
   HIDDEN FRONTEND ADMIN & PUBLISHER STUDIO
   ========================================================================== */
.tf-studio-wrap {
  max-width: 1100px;
  margin: 2.5rem auto;
  padding: 0 1.25rem;
  width: 100%;
}

.tf-studio-card {
  background: var(--tf-card);
  border-radius: var(--tf-radius-lg);
  border: 2px solid var(--tf-obsidian);
  box-shadow: var(--tf-shadow-lg);
  overflow: hidden;
  width: 100%;
}

.tf-studio-topbar {
  background: var(--tf-obsidian);
  color: #ffffff;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--tf-emerald);
  flex-wrap: wrap;
  gap: 1rem;
}

.tf-studio-body {
  padding: 2rem;
}

.tf-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.tf-field {
  margin-bottom: 1.25rem;
}

.tf-field label {
  display: block;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--tf-text);
  margin-bottom: 0.42rem;
}

.tf-input,
.tf-select,
.tf-textarea {
  width: 100%;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--tf-border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.94rem;
  background: var(--tf-bg);
  color: var(--tf-text);
}

.tf-input:focus,
.tf-select:focus,
.tf-textarea:focus {
  outline: none;
  border-color: var(--tf-emerald);
  background: var(--tf-card);
  box-shadow: 0 0 0 3px rgba(0, 165, 98, 0.16);
}

.tf-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.65rem;
  background: var(--tf-card-alt);
  border: 1px solid var(--tf-border-strong);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.tf-tool-btn {
  background: var(--tf-card);
  border: 1px solid var(--tf-border);
  color: var(--tf-text);
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  cursor: pointer;
}

.tf-tool-btn:hover {
  border-color: var(--tf-emerald);
  color: var(--tf-emerald);
}

.tf-photo-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.tf-photo-slot {
  background: var(--tf-card-alt);
  border: 2px dashed var(--tf-border-strong);
  border-radius: 10px;
  padding: 1.1rem;
}

.tf-photo-slot-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--tf-emerald);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.tf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--tf-emerald);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 0.78rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.tf-btn:hover {
  background: var(--tf-emerald-dark);
  color: #ffffff;
}

.tf-btn-secondary {
  background: #1e293b;
  color: #ffffff;
}

.tf-alert-success {
  background: #dcfce7;
  border: 1px solid #16a34a;
  color: #14532d;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

/* ==========================================================================
   FOOTER & ZERO-CLS COOKIE CONSENT BANNER
   ========================================================================== */
.tf-footer {
  background: var(--tf-obsidian);
  color: #94a3b8;
  padding: 3.5rem 0 2.5rem;
  border-top: 4px solid var(--tf-emerald);
  margin-top: 3rem;
  content-visibility: auto;
  contain-intrinsic-size: 0 340px;
  width: 100%;
}

.tf-footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tf-footer-title {
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.tf-footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tf-footer-links a {
  color: #cbd5e1;
  font-size: 0.87rem;
}

.tf-footer-links a:hover {
  color: var(--tf-emerald-bright);
}

.tf-footer-bottom {
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.81rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.tf-cookie-bar {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 960px;
  margin: 0 auto;
  background: var(--tf-obsidian);
  color: #e2e8f0;
  border: 1px solid var(--tf-emerald);
  border-radius: var(--tf-radius);
  padding: 1rem 1.35rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  z-index: 9990;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  transform: translateZ(0);
}

.tf-cookie-bar.show {
  display: flex;
}

.tf-pagination {
  margin-top: 2rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tf-pagination .page-numbers {
  padding: 0.5rem 0.95rem;
  border-radius: 6px;
  background: var(--tf-card);
  border: 1px solid var(--tf-border);
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--tf-text);
}

.tf-pagination .page-numbers.current,
.tf-pagination .page-numbers:hover {
  background: var(--tf-emerald);
  color: #ffffff;
  border-color: var(--tf-emerald);
}

@media print {
  .tf-topbar, .tf-header, .tf-cat-ribbon, .tf-sidebar, .tf-ad-wrapper, .tf-share-bar, .tf-cookie-bar, .tf-footer {
    display: none !important;
  }
  .tf-main-layout {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (TABLET & MOBILE)
   ========================================================================== */
@media screen and (max-width: 782px) {
  body.admin-bar .tf-header {
    top: 46px;
  }
  body.admin-bar .tf-progress-bar {
    top: 46px;
  }
}

@media screen and (max-width: 600px) {
  body.admin-bar .tf-header {
    top: 0;
  }
  body.admin-bar .tf-progress-bar {
    top: 0;
  }
}

@media (max-width: 1024px) {
  .tf-hero-grid,
  .tf-main-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .tf-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .tf-container {
    padding: 0 1rem;
  }
  .tf-pulse-text {
    display: none;
  }
  .tf-mobile-toggle {
    display: inline-flex;
  }
  .tf-header-main {
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
    gap: 0.65rem;
  }
  .tf-nav {
    display: none;
    width: 100%;
    order: 4;
    padding: 0.5rem 0 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  .tf-nav.open {
    display: block;
  }
  .tf-nav-list {
    flex-direction: column;
    align-items: flex-start;
    overflow-x: visible;
  }
  .tf-nav-list li,
  .tf-nav-list li a {
    width: 100%;
  }
  .tf-header-actions {
    width: 100%;
    order: 3;
  }
  .tf-search-input,
  .tf-search-input:focus {
    width: 100%;
  }
  .tf-hero-section {
    padding: 1.15rem 0 1rem;
  }
  .tf-hero-lead {
    min-height: 360px;
  }
  .tf-hero-lead-overlay {
    padding: 1.35rem;
  }
  .tf-hero-lead-title {
    font-size: 1.32rem;
  }
  .tf-river-card {
    grid-template-columns: minmax(0, 1fr);
    padding: 1rem;
    gap: 1rem;
  }
  .tf-river-thumb-wrap {
    height: 195px;
  }
  .tf-form-grid,
  .tf-photo-upload-grid,
  .tf-footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .tf-single-article {
    padding: 1.25rem;
  }
  .tf-author-box {
    flex-direction: column;
    align-items: flex-start;
  }
  .tf-cookie-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}
