/**
 * Theme Name: ReadIt Stories
 * Theme URI: https://readit.stories/
 * Author: ReadIt Stories Team
 * Author URI: https://readit.stories/
 * Description: Premium audiobook and narrated stories streaming platform theme. A cinematic, dark-mode WordPress theme inspired by Spotify, Netflix, and Audible. Features a custom Audiobooks CPT, sticky audio player, AJAX search, SwiperJS sliders, GSAP animations, Schema.org markup, and full WordPress REST API support.
 * 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: readit-stories
 * Domain Path: /languages
 * Tags: dark-mode, entertainment, custom-menu, custom-logo, featured-images, full-width-template, threaded-comments, translation-ready, rtl-language-support, accessibility-ready
 */

/* ============================================================
   DESIGN TOKENS — ReadIt Stories Design System
   ============================================================ */

:root {
  /* === Core Brand Colors === */
  --rs-bg:           #0B0B0F;
  --rs-bg-secondary: #111118;
  --rs-card:         #16161D;
  --rs-card-hover:   #1E1E28;
  --rs-primary:      #FF4D4D;
  --rs-primary-dark: #E03030;
  --rs-primary-glow: rgba(255, 77, 77, 0.25);
  --rs-secondary:    #FF6A3D;
  --rs-gradient:     linear-gradient(135deg, #FF4D4D 0%, #FF6A3D 100%);
  --rs-gradient-subtle: linear-gradient(135deg, rgba(255,77,77,0.15) 0%, rgba(255,106,61,0.08) 100%);

  /* === Text Colors === */
  --rs-text:         #FFFFFF;
  --rs-text-muted:   #BDBDBD;
  --rs-text-faint:   #6B6B80;
  --rs-text-inverse: #0B0B0F;

  /* === Borders === */
  --rs-border:       rgba(255, 255, 255, 0.08);
  --rs-border-hover: rgba(255, 255, 255, 0.18);
  --rs-border-active:rgba(255, 77, 77, 0.5);

  /* === Glassmorphism === */
  --rs-glass-bg:     rgba(22, 22, 29, 0.80);
  --rs-glass-blur:   blur(24px);
  --rs-glass-border: rgba(255, 255, 255, 0.06);

  /* === Shadows === */
  --rs-shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
  --rs-shadow-md:    0 8px 32px rgba(0,0,0,0.5);
  --rs-shadow-lg:    0 24px 64px rgba(0,0,0,0.7);
  --rs-shadow-glow:  0 0 40px rgba(255,77,77,0.3);
  --rs-shadow-card:  0 4px 24px rgba(0,0,0,0.6);

  /* === Spacing Scale === */
  --rs-space-1:  4px;
  --rs-space-2:  8px;
  --rs-space-3:  12px;
  --rs-space-4:  16px;
  --rs-space-5:  20px;
  --rs-space-6:  24px;
  --rs-space-7:  32px;
  --rs-space-8:  40px;
  --rs-space-9:  48px;
  --rs-space-10: 64px;
  --rs-space-11: 80px;
  --rs-space-12: 96px;

  /* === Border Radius === */
  --rs-radius-sm:  8px;
  --rs-radius-md:  12px;
  --rs-radius-lg:  16px;
  --rs-radius-xl:  24px;
  --rs-radius-2xl: 32px;
  --rs-radius-full:9999px;

  /* === Typography === */
  --rs-font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --rs-font-display: 'Manrope', 'Inter', system-ui, sans-serif;
  --rs-font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Font Sizes */
  --rs-text-xs:   0.75rem;   /* 12px */
  --rs-text-sm:   0.875rem;  /* 14px */
  --rs-text-base: 1rem;      /* 16px */
  --rs-text-lg:   1.125rem;  /* 18px */
  --rs-text-xl:   1.25rem;   /* 20px */
  --rs-text-2xl:  1.5rem;    /* 24px */
  --rs-text-3xl:  1.875rem;  /* 30px */
  --rs-text-4xl:  2.25rem;   /* 36px */
  --rs-text-5xl:  3rem;      /* 48px */
  --rs-text-6xl:  3.75rem;   /* 60px */
  --rs-text-7xl:  4.5rem;    /* 72px */

  /* Font Weights */
  --rs-weight-normal:    400;
  --rs-weight-medium:    500;
  --rs-weight-semibold:  600;
  --rs-weight-bold:      700;
  --rs-weight-extrabold: 800;
  --rs-weight-black:     900;

  /* Line Heights */
  --rs-leading-tight:  1.2;
  --rs-leading-snug:   1.35;
  --rs-leading-normal: 1.5;
  --rs-leading-relaxed:1.7;

  /* === Transitions === */
  --rs-ease-fast:   all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --rs-ease-normal: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --rs-ease-slow:   all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --rs-ease-spring: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* === Z-Index Scale === */
  --rs-z-below:   -1;
  --rs-z-base:     0;
  --rs-z-raised:   10;
  --rs-z-dropdown: 100;
  --rs-z-sticky:   200;
  --rs-z-modal:    300;
  --rs-z-player:   400;
  --rs-z-toast:    500;

  /* === Layout === */
  --rs-nav-height:    72px;
  --rs-player-height: 80px;
  --rs-container:     1400px;
  --rs-container-sm:  960px;
}

/* ============================================================
   BASE RESET & GLOBAL STYLES
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--rs-font-body);
  font-size: var(--rs-text-base);
  font-weight: var(--rs-weight-normal);
  line-height: var(--rs-leading-normal);
  color: var(--rs-text);
  background-color: var(--rs-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  padding-bottom: 0;
}

body.rs-player-active {
  padding-bottom: var(--rs-player-height);
}

/* Screen Reader Text */
.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;
  width: 1px;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background-color: var(--rs-card);
  border-radius: var(--rs-radius-sm);
  box-shadow: var(--rs-shadow-md);
  clip: auto !important;
  clip-path: none;
  color: var(--rs-text);
  display: block;
  font-size: var(--rs-text-sm);
  font-weight: var(--rs-weight-bold);
  height: auto;
  left: 5px;
  line-height: normal;
  padding: 15px 23px 14px;
  text-decoration: none;
  top: 5px;
  width: auto;
  z-index: var(--rs-z-toast);
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: var(--rs-z-toast);
  padding: 12px 24px;
  background: var(--rs-primary);
  color: white;
  font-weight: var(--rs-weight-bold);
  text-decoration: none;
  border-radius: 0 0 var(--rs-radius-sm) 0;
  transition: var(--rs-ease-fast);
}

.skip-link:focus {
  top: 0;
}

/* Typography Base */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--rs-font-display);
  font-weight: var(--rs-weight-bold);
  line-height: var(--rs-leading-tight);
  color: var(--rs-text);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--rs-text-5xl); }
h2 { font-size: var(--rs-text-4xl); }
h3 { font-size: var(--rs-text-3xl); }
h4 { font-size: var(--rs-text-2xl); }
h5 { font-size: var(--rs-text-xl); }
h6 { font-size: var(--rs-text-lg); }

p {
  color: var(--rs-text-muted);
  line-height: var(--rs-leading-relaxed);
  margin-bottom: var(--rs-space-4);
}

p:last-child { margin-bottom: 0; }

a {
  color: var(--rs-primary);
  text-decoration: none;
  transition: var(--rs-ease-fast);
}

a:hover {
  color: var(--rs-secondary);
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
}

/* Focus Styles — Accessibility */
:focus-visible {
  outline: 2px solid var(--rs-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Selection */
::selection {
  background: var(--rs-primary-glow);
  color: var(--rs-text);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--rs-bg); }
::-webkit-scrollbar-thumb { background: var(--rs-border-hover); border-radius: var(--rs-radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--rs-text-faint); }

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */

.rs-container {
  width: 100%;
  max-width: var(--rs-container);
  margin: 0 auto;
  padding: 0 var(--rs-space-6);
}

.rs-container-sm {
  max-width: var(--rs-container-sm);
}

.rs-section {
  padding: var(--rs-space-11) 0;
}

.rs-section-sm {
  padding: var(--rs-space-9) 0;
}

.rs-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--rs-space-7);
  gap: var(--rs-space-4);
}

.rs-section-title {
  font-family: var(--rs-font-display);
  font-size: var(--rs-text-2xl);
  font-weight: var(--rs-weight-extrabold);
  color: var(--rs-text);
  letter-spacing: -0.03em;
  position: relative;
}

.rs-section-title::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  background: var(--rs-gradient);
  border-radius: var(--rs-radius-full);
}

.rs-view-all {
  display: flex;
  align-items: center;
  gap: var(--rs-space-2);
  font-size: var(--rs-text-sm);
  font-weight: var(--rs-weight-semibold);
  color: var(--rs-text-muted);
  text-decoration: none;
  padding: var(--rs-space-2) var(--rs-space-4);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-full);
  transition: var(--rs-ease-normal);
}

.rs-view-all:hover {
  color: var(--rs-text);
  border-color: var(--rs-border-hover);
  background: var(--rs-card);
}

.rs-view-all svg {
  width: 14px;
  height: 14px;
  transition: var(--rs-ease-fast);
}

.rs-view-all:hover svg {
  transform: translateX(3px);
}

/* Grid Layouts */
.rs-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--rs-space-6);
}

.rs-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--rs-space-6);
}

.rs-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--rs-space-6);
}

/* Divider */
.rs-divider {
  height: 1px;
  background: var(--rs-border);
  border: none;
  margin: var(--rs-space-8) 0;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
  :root {
    --rs-container: 100%;
  }

  h1 { font-size: var(--rs-text-4xl); }
  h2 { font-size: var(--rs-text-3xl); }

  .rs-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .rs-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --rs-nav-height: 64px;
    --rs-player-height: 72px;
  }

  h1 { font-size: var(--rs-text-3xl); }
  h2 { font-size: var(--rs-text-2xl); }

  .rs-section { padding: var(--rs-space-9) 0; }
  .rs-section-sm { padding: var(--rs-space-7) 0; }
  .rs-container { padding: 0 var(--rs-space-4); }

  .rs-grid-4 { grid-template-columns: repeat(2, 1fr); gap: var(--rs-space-4); }
  .rs-grid-3 { grid-template-columns: 1fr; }
  .rs-grid-2 { grid-template-columns: 1fr; }

  .rs-section-title { font-size: var(--rs-text-xl); }
  .rs-section-title::before { display: none; }
}

/* Small Mobile */
@media (max-width: 480px) {
  .rs-grid-4 { grid-template-columns: 1fr; }
}

/* ============================================================
   RTL SUPPORT
   ============================================================ */

[dir="rtl"] .rs-section-title::before {
  left: auto;
  right: -16px;
}

[dir="rtl"] .rs-view-all svg {
  transform: scaleX(-1);
}

[dir="rtl"] .rs-view-all:hover svg {
  transform: scaleX(-1) translateX(3px);
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.text-gradient {
  background: var(--rs-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.badge-premium {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--rs-gradient);
  border-radius: var(--rs-radius-full);
  font-size: var(--rs-text-xs);
  font-weight: var(--rs-weight-bold);
  color: white;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-trending {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(255, 77, 77, 0.15);
  border: 1px solid rgba(255, 77, 77, 0.3);
  border-radius: var(--rs-radius-full);
  font-size: var(--rs-text-xs);
  font-weight: var(--rs-weight-bold);
  color: var(--rs-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-new {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(0, 200, 130, 0.15);
  border: 1px solid rgba(0, 200, 130, 0.3);
  border-radius: var(--rs-radius-full);
  font-size: var(--rs-text-xs);
  font-weight: var(--rs-weight-bold);
  color: #00C882;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-editors {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(160, 100, 255, 0.15);
  border: 1px solid rgba(160, 100, 255, 0.3);
  border-radius: var(--rs-radius-full);
  font-size: var(--rs-text-xs);
  font-weight: var(--rs-weight-bold);
  color: #A064FF;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--rs-card) 25%,
    var(--rs-card-hover) 50%,
    var(--rs-card) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--rs-radius-sm);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
