/*
Theme Name: TrendForge Daily
Theme URI: https://trendforgedaily.com/
Author: TrendForge Daily
Author URI: https://www.facebook.com/trendforgedaily/
Description: Cablgram-inspired visual photocard news theme built for TrendForge Daily. Includes zero-code Customizer controls for branding, light & dark mode colors, grid columns, card aspect ratios, motion effects, bilingual (Bangla & English) category feeds, direct Facebook post redirects, a branded preloader, and an editable bilingual Privacy Policy modal.
Version: 1.1.5
Requires at least: 6.0
Tested up to: 6.7
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: trendforgedaily
Tags: news, photography, grid-layout, custom-colors, custom-logo, custom-menu, dark-mode, featured-images, two-columns, three-columns, four-columns, translation-ready
*/

:root {
  --frame-bg: linear-gradient(145deg, #be123c 0%, #e11d48 52%, #dc2626 100%);
  --frame-solid: #e11d48;
  --accent: #e11d48;

  --sheet-bg: #ffffff;
  --sheet-subtle: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-light: #e2e8f0;

  --font-sans: "Inter", "Hind Siliguri", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-bn: "Hind Siliguri", "Noto Sans Bengali", sans-serif;
  --sheet-width: 940px;

  --grid-cols: 3;
  --card-radius: 14px;
  --card-ratio: auto;
  --card-fit: contain;
}

[data-theme="dark"] {
  --frame-bg: linear-gradient(145deg, #881337 0%, #be123c 55%, #991b1b 100%);
  --frame-solid: #be123c;
  --accent: #fb7185;

  --sheet-bg: #0f172a;
  --sheet-subtle: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-light: #1e293b;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--frame-bg);
  background-attachment: scroll;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.25s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.bn {
  font-family: var(--font-bn);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Fixed Side Editorial Silhouettes (Desktop Framing) */
.backdrop-art {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  display: none;
}

.backdrop-side {
  position: absolute;
  bottom: 0;
  width: 280px;
  height: 460px;
  opacity: 0.16;
  color: #000000;
}

.backdrop-side.left {
  left: 16px;
  animation: backdropFloat 9s ease-in-out infinite;
}

.backdrop-side.right {
  right: 16px;
  animation: backdropFloat 11s ease-in-out infinite reverse;
}

/* Sticky Frame Header */
.frame-header {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  overflow-x: clip;
  background: var(--frame-solid);
  transition: background 0.35s ease, box-shadow 0.25s ease;
}

.frame-header.scrolled {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.frame-header-inner {
  width: 100%;
  max-width: var(--sheet-width);
  margin: 0 auto;
  min-height: 60px;
  padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wordmark-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: #ffffff;
}

.wordmark-link img.custom-logo {
  max-height: 30px;
  max-width: min(155px, 44vw);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.wordmark-main {
  font-size: clamp(1.06rem, 4.4vw, 1.36rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wordmark-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  margin-left: 1px;
}

.wordmark-sub {
  flex-shrink: 0;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  white-space: nowrap;
  line-height: 1.25;
}

@media (max-width: 340px) {
  .wordmark-sub {
    display: none;
  }
}

.frame-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

/* Segmented Language Switcher (বাংলা | EN) */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.28);
  gap: 2px;
  flex-shrink: 0;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn.active {
  background: #ffffff;
  color: var(--frame-solid);
}

.frame-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.2);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.frame-pill-btn .theme-text {
  display: none;
}

.frame-pill-btn:hover {
  background: rgba(0, 0, 0, 0.34);
}

/* Elevated Rounded-Top Content Sheet */
.page-sheet {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: var(--sheet-width);
  margin: 4px auto 0;
  min-height: calc(100vh - 82px);
  background: var(--sheet-bg);
  border-radius: 28px 28px 0 0;
  padding: 18px 14px 32px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.14);
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 0.25s ease,
    color 0.25s ease;
}

body.is-ready .page-sheet {
  opacity: 1;
  transform: translateY(0);
}

/* Centered Sheet Navigation with Sliding Spring Active Dot */
.sheet-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 4px;
  padding: 4px 6px 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.sheet-nav::-webkit-scrollbar {
  display: none;
}

.sheet-nav-item {
  position: relative;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 8px 10px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-secondary);
  transition: color 0.18s ease, transform 0.15s ease;
}

.sheet-nav-item:hover,
.sheet-nav-item.active {
  color: var(--text-primary);
}

.sheet-nav-item:active {
  transform: scale(0.96);
}

.nav-active-dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, background-color 0.25s ease;
}

/* Photocard Visual Grid */
.visual-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: start;
  gap: 12px;
  margin: 4px 0 8px;
}

.visual-grid.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.visual-card {
  position: relative;
  display: block;
  aspect-ratio: var(--card-ratio, auto);
  border-radius: var(--card-radius);
  overflow: hidden;
  background: var(--sheet-subtle);
  border: 1px solid var(--border-light);
  isolation: isolate;
  opacity: 0;
  transform: translateY(28px) scale(0.95);
  transition:
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.52s ease;
  will-change: transform, opacity;
}

.visual-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.visual-card.is-visible:hover {
  transform: translateY(-5px) scale(1);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.24);
}

.visual-card.is-visible:active {
  transform: translateY(-1px) scale(0.985);
}

.visual-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.16) 50%,
    transparent 70%
  );
  transform: translateX(-120%);
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.visual-card:hover::after {
  transform: translateX(120%);
}

.visual-card-bg {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  object-fit: var(--card-fit, contain);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 0;
}

body.tf-ratio-fixed .visual-card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: var(--card-fit, contain);
}

.visual-card:hover .visual-card-bg {
  transform: scale(1.02);
}

.feed-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 36px 12px;
  margin: 0;
}

/* Load More & Facebook CTA */
.feed-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 30px 0 26px;
}

.pill-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--sheet-subtle);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 700;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, background-color 0.2s ease;
}

.pill-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.pill-cta:active {
  transform: scale(0.97);
}

.pill-cta.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

/* Minimal Centered Sheet Footer */
.sheet-footer {
  margin-top: auto;
  padding: 28px 16px 10px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
}

.footer-links-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 12px;
  font-weight: 600;
}

.footer-links-row a:hover,
.footer-link-btn:hover {
  color: var(--accent);
}

.footer-link-btn {
  border: none;
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
  font-weight: 600;
}

/* Privacy Policy Modal */
.tf-modal[hidden] {
  display: none;
}

.tf-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
}

.tf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px);
}

.tf-modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  overflow-y: auto;
  background: var(--sheet-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 22px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: sheetRise 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.tf-modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.tf-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--sheet-subtle);
  color: var(--text-primary);
  font-weight: 700;
  display: grid;
  place-items: center;
}

.tf-modal-body {
  padding-top: 14px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.tf-modal-body h3 {
  margin: 14px 0 4px;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.tf-modal-body p {
  margin: 0 0 10px;
}

.tf-modal-body a {
  color: var(--accent);
  font-weight: 600;
}

/* Responsive Breakpoints */
@media (min-width: 440px) {
  .frame-header-inner {
    min-height: 68px;
    padding: 11px 18px;
    gap: 12px;
  }
  .wordmark-link img.custom-logo {
    max-height: 36px;
    max-width: 200px;
  }
  .wordmark-main {
    font-size: 1.48rem;
  }
  .wordmark-sub {
    font-size: 0.64rem;
    padding: 2px 7px;
  }
  .frame-controls {
    gap: 8px;
  }
  .lang-btn {
    min-height: 30px;
    font-size: 0.74rem;
    padding: 4px 10px;
  }
  .frame-pill-btn {
    width: auto;
    height: auto;
    min-height: 34px;
    padding: 5px 12px;
    font-size: 0.74rem;
  }
  .frame-pill-btn .theme-text {
    display: inline;
  }
}

@media (min-width: 640px) {
  .frame-header-inner {
    min-height: 84px;
    padding: 14px 28px;
  }
  .wordmark-link img.custom-logo {
    max-height: 42px;
    max-width: 240px;
  }
  .wordmark-main {
    font-size: 1.72rem;
  }
  .wordmark-dot {
    width: 7px;
    height: 7px;
  }
  .wordmark-sub {
    font-size: 0.72rem;
    padding: 2px 8px;
    letter-spacing: 0.08em;
  }
  .page-sheet {
    border-radius: 32px 32px 0 0;
    margin-top: 6px;
    padding: 24px 28px 40px;
  }
  .sheet-nav {
    justify-content: center;
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 6px 14px;
    padding: 6px 8px 18px;
    margin-bottom: 22px;
  }
  .sheet-nav-item {
    padding: 8px 12px 12px;
    font-size: 0.94rem;
  }
  .visual-grid {
    grid-template-columns: repeat(var(--grid-cols, 3), 1fr);
    gap: 16px;
    margin: 6px 0 10px;
  }
  .sheet-footer {
    padding: 32px 20px 14px;
  }
}

@media (min-width: 1024px) {
  body {
    background-attachment: fixed;
  }
}

@media (min-width: 1200px) {
  .backdrop-art {
    display: block;
  }
}

@keyframes sheetRise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes backdropFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-14px);
  }
}

/* Reduced Motion & Optional Motion Off State */
body.tf-no-motion .page-sheet,
body.tf-no-motion .visual-card {
  opacity: 1;
  transform: none;
  transition: none !important;
}

body.tf-no-motion .backdrop-side.left,
body.tf-no-motion .backdrop-side.right {
  animation: none !important;
}

body.tf-no-motion .visual-card-bg,
body.tf-no-motion .visual-card::after,
body.tf-no-motion .nav-active-dot,
body.tf-no-motion .pill-cta {
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .page-sheet,
  .backdrop-side.left,
  .backdrop-side.right {
    animation: none !important;
  }
  .visual-card,
  .visual-card-bg,
  .visual-card::after,
  .nav-active-dot,
  .pill-cta {
    transition: none !important;
  }
  .visual-card,
  .page-sheet {
    opacity: 1;
    transform: none;
  }
  .tf-preloader {
    display: none !important;
  }
}

/* Branded Preloader */
.tf-preloader {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--frame-bg);
  display: grid;
  place-items: center;
  transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.38s ease, transform 0.38s ease;
}

.tf-preloader.is-done {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.02);
  pointer-events: none;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.preloader-wordmark {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #ffffff;
  display: inline-flex;
  align-items: baseline;
}

.preloader-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  margin-left: 2px;
  animation: dotBounce 0.9s ease-in-out infinite;
}

.preloader-bar {
  width: 120px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.preloader-bar-fill {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: 999px;
  background: #ffffff;
  animation: preloaderSlide 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes dotBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes preloaderSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(250%); }
}

.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 20px;
  z-index: 40;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: var(--frame-solid);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.9);
  transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.25s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top:hover {
  transform: translateY(-3px) scale(1.05);
}
