/*
Theme Name: OpenPress
Theme URI: https://www.openpress.tech
Author: Abeer Mahfuj
Author URI: https://www.openpress.tech
Description: OpenPress is a tech news, tutorials, and portfolio theme for a web/desktop/mobile development, digital marketing, SEO, and UI/UX services site that also offers free tools (CV Builder, File Converter, etc.). Design blends BBC's editorial typography, CNN's bento-grid density, and Fox News's bold hierarchy, with full dark/light "newsprint" theming built on Flowbite UI + Tailwind CSS. Static homepage version — header, breaking news bar, bento hero, top stories, opinion, video, and footer.
Version: 1.0.0
Requires at least: 6.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: openpress
*/

:root {
  /* Light Mode - Warm newsprint */
  --background: 40 30% 98%;
  --foreground: 0 0% 12%;
  --card: 0 0% 100%;
  --primary: 38 85% 40%;
  --primary-foreground: 0 0% 100%;
  --secondary: 40 20% 94%;
  --muted: 0 0% 90%;
  --muted-foreground: 0 0% 40%;
  --accent: 38 85% 40%;
  --accent-foreground: 0 0% 100%;
  --border: 0 0% 86%;
}
.dark {
  /* Dark Mode - Original Deep Canvas */
  --background: 0 0% 4%;
  --foreground: 60 30% 97%;
  --card: 0 0% 6%;
  --primary: 38 46% 67%;
  --primary-foreground: 0 0% 4%;
  --secondary: 0 0% 10%;
  --muted: 0 0% 12%;
  --muted-foreground: 60 5% 58%;
  --accent: 38 46% 67%;
  --accent-foreground: 0 0% 4%;
  --border: 0 0% 14%;
}
body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Inter', sans-serif;
}
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: hsl(var(--accent));
}
.live-dot {
  width: 6px; height: 6px;
  background: hsl(var(--accent));
  border-radius: 999px;
  display: inline-block;
}
.card-hover { transition: background-color 0.2s ease, border-color 0.2s ease; }
.card-hover:hover { background-color: hsl(var(--secondary)); border-color: hsl(var(--accent) / 0.35); }

/* Live stat card (FTSE 100 / London Stock Exchange) */
.stat-card-live { isolation: isolate; }
.stat-card-glow {
  position: absolute;
  top: -60%; right: -15%;
  width: 65%; height: 160%;
  background: radial-gradient(circle, hsl(var(--accent) / 0.16), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.stat-card-live > *:not(.stat-card-glow) { position: relative; z-index: 1; }
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: hsl(var(--accent));
  background: hsl(var(--accent) / 0.1);
  border: 1px solid hsl(var(--accent) / 0.3);
  border-radius: 999px;
  padding: 3px 8px 3px 6px;
  white-space: nowrap;
}
.live-dot.pulse { position: relative; }
.live-dot.pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  background: hsl(var(--accent) / 0.55);
  animation: openpress-pulse 1.8s ease-out infinite;
}
@keyframes openpress-pulse {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}
.stat-sparkline { width: 100%; }
.stat-sparkline-fill { fill: hsl(var(--accent) / 0.08); }
.stat-sparkline-line { stroke: hsl(var(--accent)); stroke-width: 1.75; vector-effect: non-scaling-stroke; }
.stat-sparkline-down .stat-sparkline-line { stroke: #ef4444; }
.stat-sparkline-down .stat-sparkline-fill { fill: rgba(239, 68, 68, 0.08); }
.stat-sparkline-flat .stat-sparkline-line { stroke: hsl(var(--muted-foreground)); }
.stat-sparkline-flat .stat-sparkline-fill { fill: hsl(var(--muted-foreground) / 0.08); }

@media (prefers-reduced-motion: reduce) {
  .live-dot.pulse::after { animation: none; }
}

/* Hero "Video-style card" — dimmed background video preview */
.hero-video-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.hero-video-bg video,
.hero-video-bg iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: auto;
  height: auto;
  min-width: 100%;
  min-height: 100%;
  transform: translate(-50%, -50%);
  border: 0;
}
/* YouTube/Vimeo draw their own title bar, share/CC icons, and end-screen
   suggestions flush against the top/bottom edges of the player frame —
   parameters alone can no longer fully suppress that chrome. Zooming the
   iframe in well past 100% and letting the card's overflow:hidden crop it
   pushes that chrome outside the visible card instead of leaving it
   floating on top of the preview. */
.hero-video-bg iframe {
  min-width: 145%;
  min-height: 145%;
  transform: translate(-50%, -50%) scale(1.35);
}
.hero-video-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  background-image: repeating-linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.4) 0,
    rgba(0, 0, 0, 0.4) 1px,
    transparent 1px,
    transparent 7px
  );
}

/* Breaking news ticker */
.ticker-viewport {
  mask-image: linear-gradient(to right, transparent 0, black 24px, black calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, black 24px, black calc(100% - 24px), transparent 100%);
}
.ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  width: max-content;
  animation: ticker-scroll 32s linear infinite;
}
.ticker-viewport:hover .ticker-track { animation-play-state: paused; }
.ticker-item { color: hsl(var(--foreground) / 0.9); text-decoration: none; }
a.ticker-item:hover { color: hsl(var(--accent)); text-decoration: underline; }
.ticker-sep { color: hsl(var(--accent)); margin: 0 1.5rem; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .ticker-track { animation: none; }
  .ticker-viewport { overflow-x: auto; }
}

/* Article body copy (single.php) — hand-styled since no Tailwind
   Typography plugin is loaded; keeps the same type system as the
   rest of the theme. */
.openpress-article {
  font-family: 'Inter', sans-serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: hsl(var(--foreground) / 0.92);
}
.openpress-article > * + * { margin-top: 1.4em; }
.openpress-article h2 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.25;
  margin-top: 2em;
  scroll-margin-top: 6rem;
}
.openpress-article h3 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.375rem;
  line-height: 1.3;
  margin-top: 1.75em;
  scroll-margin-top: 6rem;
}
.openpress-article h4 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.125rem;
  margin-top: 1.5em;
}

/* Auto table of contents (single.php) — built from the post's own
   H2/H3 headings via openpress_prepare_content_with_toc() in
   functions.php. Collapsible on all screen sizes; JS toggle lives in
   assets/js/toc.js. */
.openpress-toc {
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  background: hsl(var(--card));
  margin-bottom: 2rem;
}
.openpress-toc-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}
.openpress-toc-toggle .eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.openpress-toc-chevron {
  color: hsl(var(--muted-foreground));
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.openpress-toc-toggle[aria-expanded="false"] .openpress-toc-chevron {
  transform: rotate(-90deg);
}
.openpress-toc-list {
  list-style: none;
  margin: 0;
  padding: 0 1.25rem 1.25rem;
}
.openpress-toc-toggle[aria-expanded="false"] + .openpress-toc-list {
  display: none;
}
.openpress-toc-item {
  border-top: 1px solid hsl(var(--border));
}
.openpress-toc-item:first-child { border-top: none; }
.openpress-toc-item a {
  display: block;
  padding: 0.625rem 0;
  font-size: 0.9375rem;
  color: hsl(var(--foreground) / 0.85);
  text-decoration: none;
}
.openpress-toc-item a:hover { color: hsl(var(--accent)); }
.openpress-toc-item--sub a {
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}
.openpress-article a {
  color: hsl(var(--accent));
  text-decoration: underline;
  text-underline-offset: 2px;
}
.openpress-article a:hover { text-decoration: none; }
.openpress-article strong { font-weight: 700; color: hsl(var(--foreground)); }
.openpress-article blockquote {
  border-left: 3px solid hsl(var(--accent));
  padding-left: 1.25rem;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.375rem;
  line-height: 1.5;
  color: hsl(var(--foreground));
}
.openpress-article ul,
.openpress-article ol {
  padding-left: 1.5rem;
}
.openpress-article ul { list-style: disc; }
.openpress-article ol { list-style: decimal; }
.openpress-article li { margin-top: 0.5em; }
.openpress-article img {
  width: 100%;
  height: auto;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border));
}
.openpress-article figure { margin: 0; }
.openpress-article figcaption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.5rem;
}
.openpress-article code {
  font-family: 'JetBrains Mono', monospace;
  background: hsl(var(--secondary));
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.875em;
}
.openpress-article hr {
  border: none;
  border-top: 1px solid hsl(var(--border));
  margin: 2.5em 0;
}

/* Social share buttons (single.php) */
.openpress-share-btn {
  position: relative;
}
.openpress-share-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  line-height: 1;
  white-space: nowrap;
  padding: 0.35em 0.6em;
  border-radius: 0.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}
.openpress-share-tooltip.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.openpress-share-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: hsl(var(--foreground));
}
