/* ==========================================================================
   GameHub Ghost Theme - Core & Base Stylesheet
   Designed for Ghost CMS 5.x+
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Variables & Theme Setup
   -------------------------------------------------------------------------- */
:root {
  --bg-primary: #090a10;
  --bg-secondary: #10121d;
  --bg-card: #161928;
  --bg-card-hover: #1d2135;
  --bg-glass: rgba(22, 25, 40, 0.75);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(229, 9, 20, 0.35);
  --border-hover: rgba(229, 9, 20, 0.55);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;

  /* Default Primary Theme: Gaming Crimson Red */
  --accent: #e50914;
  --accent-rgb: 229, 9, 20;
  --accent-secondary: #ff3b47;
  --accent-glow: rgba(229, 9, 20, 0.35);
  --accent-cyan: #00b4d8;
  --accent-cyan-rgb: 0, 180, 216;
  --accent-emerald: #10b981;
  --accent-gold: #ffb703;
  --accent-rose: #f43f5e;

  --font-sans: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 25px rgba(229, 9, 20, 0.3);
  --shadow-cyan-glow: 0 0 25px rgba(0, 180, 216, 0.25);

  --container-max: 1320px;
  --header-height: 72px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Color Theme Presets
   ========================================================================== */
html[data-color="red"], :root[data-color="red"] {
  --accent: #e50914;
  --accent-rgb: 229, 9, 20;
  --accent-secondary: #ff3b47;
  --accent-glow: rgba(229, 9, 20, 0.35);
  --border-glow: rgba(229, 9, 20, 0.35);
  --border-hover: rgba(229, 9, 20, 0.55);
  --shadow-glow: 0 0 25px rgba(229, 9, 20, 0.35);
}

html[data-color="purple"], :root[data-color="purple"] {
  --accent: #8b5cf6;
  --accent-rgb: 139, 92, 246;
  --accent-secondary: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.35);
  --border-glow: rgba(139, 92, 246, 0.35);
  --border-hover: rgba(139, 92, 246, 0.55);
  --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.35);
}

html[data-color="blue"], :root[data-color="blue"] {
  --accent: #00b4d8;
  --accent-rgb: 0, 180, 216;
  --accent-secondary: #38bdf8;
  --accent-glow: rgba(0, 180, 216, 0.35);
  --border-glow: rgba(0, 180, 216, 0.35);
  --border-hover: rgba(0, 180, 216, 0.55);
  --shadow-glow: 0 0 25px rgba(0, 180, 216, 0.35);
}

html[data-color="gold"], :root[data-color="gold"] {
  --accent: #f59e0b;
  --accent-rgb: 245, 158, 11;
  --accent-secondary: #fbbf24;
  --accent-glow: rgba(245, 158, 11, 0.35);
  --border-glow: rgba(245, 158, 11, 0.35);
  --border-hover: rgba(245, 158, 11, 0.55);
  --shadow-glow: 0 0 25px rgba(245, 158, 11, 0.35);
}

html[data-color="green"], :root[data-color="green"] {
  --accent: #10b981;
  --accent-rgb: 16, 185, 129;
  --accent-secondary: #34d399;
  --accent-glow: rgba(16, 185, 129, 0.35);
  --border-glow: rgba(16, 185, 129, 0.35);
  --border-hover: rgba(16, 185, 129, 0.55);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.35);
}

/* --------------------------------------------------------------------------
   2. Reset & Typography
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  direction: rtl;
  text-align: right;
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(var(--accent-rgb), 0.09) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(0, 180, 216, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.75;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

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

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #2a2e48;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* --------------------------------------------------------------------------
   3. Layout Utilities
   -------------------------------------------------------------------------- */
.gh-container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

.site-main {
  flex: 1 0 auto;
  padding: 30px 0 60px;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 1024px) {
  .main-grid {
    grid-template-columns: 8fr 4fr;
  }
}

/* Section Title Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.section-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: 0;
  width: 80px;
  height: 2px;
  background: linear-gradient(to left, var(--accent), var(--accent-cyan));
  border-radius: 2px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-title svg {
  width: 24px;
  height: 24px;
  fill: var(--accent-cyan);
}

.section-view-all {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.section-view-all:hover {
  color: var(--accent-cyan);
  transform: translateX(-4px);
}

/* --------------------------------------------------------------------------
   4. Reading Progress Bar (Attached to bottom of sticky header)
   -------------------------------------------------------------------------- */
.reading-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  pointer-events: none;
  z-index: 100;
}

#reading-progress {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: auto;
  height: 100%;
  background: linear-gradient(270deg, var(--accent), var(--accent-cyan));
  box-shadow: 0 0 8px var(--accent-glow, rgba(229, 9, 20, 0.4));
  z-index: 100;
  width: 0%;
  border-radius: 4px 0 0 4px;
  transition: width 0.08s ease-out;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   5. Ghost Koenig Card Content Styles
   -------------------------------------------------------------------------- */
.gh-content {
  font-size: 1.125rem;
  line-height: 2;
  color: #e2e8f0;
}

.gh-content p {
  margin-bottom: 1.75em;
}

.gh-content h1,
.gh-content h2,
.gh-content h3,
.gh-content h4,
.gh-content h5,
.gh-content h6 {
  color: #fff;
  font-weight: 800;
  line-height: 1.4;
  margin-top: 2.2em;
  margin-bottom: 0.8em;
  scroll-margin-top: 90px;
}

.gh-content h2 {
  font-size: 1.65rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.gh-content h3 {
  font-size: 1.35rem;
}

.gh-content a {
  color: var(--accent-cyan);
  border-bottom: 1px dashed rgba(0, 180, 216, 0.4);
}

.gh-content a:hover {
  border-bottom-style: solid;
  color: #fff;
}

.gh-content ul,
.gh-content ol {
  margin-bottom: 1.75em;
  padding-right: 1.75em;
}

.gh-content ul {
  list-style-type: disc;
}

.gh-content ol {
  list-style-type: decimal;
}

.gh-content li {
  margin-bottom: 0.6em;
}

.gh-content blockquote {
  margin: 2em 0;
  padding: 1.25em 1.75em;
  background: var(--bg-secondary);
  border-right: 4px solid var(--accent);
  border-radius: var(--radius-md);
  font-style: italic;
  color: var(--text-secondary);
}

.gh-content figure,
.gh-content .wp-block-image,
.gh-content .wp-caption,
figure.wp-caption,
.wp-caption {
  margin: 2.5em auto;
  max-width: 100% !important;
  width: auto;
  box-sizing: border-box;
}

.gh-content img,
.gh-content figure img,
.gh-content .wp-caption img,
figure.wp-caption img {
  max-width: 100% !important;
  height: auto !important;
  box-sizing: border-box;
}

.gh-content figcaption,
.gh-content .wp-caption-text,
.wp-caption .wp-caption-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  max-width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
}

.gh-content code {
  font-family: var(--font-mono);
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: #f43f5e;
}

.gh-content pre {
  direction: ltr;
  text-align: left;
  background: #0f111a;
  padding: 1.25em;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow-x: auto;
  margin: 2em 0;
}

.gh-content pre code {
  background: transparent;
  padding: 0;
  color: #e2e8f0;
}

/* Ghost Callout Card */
.kg-callout-card {
  display: flex;
  padding: 1.25em 1.5em;
  border-radius: var(--radius-md);
  margin: 2em 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  gap: 16px;
}

.kg-callout-emoji {
  font-size: 1.5rem;
  line-height: 1;
}

.kg-callout-text {
  flex: 1;
  font-size: 1rem;
  line-height: 1.7;
}

/* Ghost Bookmark Card */
.kg-bookmark-card {
  width: 100%;
  margin: 2.5em 0;
}

.kg-bookmark-container {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  overflow: hidden;
  transition: var(--transition);
}

.kg-bookmark-container:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kg-bookmark-content {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kg-bookmark-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 8px;
}

.kg-bookmark-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}

.kg-bookmark-metadata {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 12px;
}

.kg-bookmark-thumbnail {
  position: relative;
  min-width: 33%;
  max-height: 100%;
}

.kg-bookmark-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Ghost Gallery Card */
.kg-gallery-card {
  margin: 2.5em 0;
}

.kg-gallery-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kg-gallery-row {
  display: flex;
  gap: 12px;
}

.kg-gallery-image img {
  border-radius: var(--radius-md);
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Ghost Audio & Video Card */
.kg-audio-card, .kg-video-card {
  margin: 2em 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

/* Ghost Koenig Width Modifiers (Required by Ghost) */
.kg-width-wide {
  position: relative;
  width: 85vw;
  min-width: 100%;
  margin-left: calc(50% - 42.5vw);
  margin-right: calc(50% - 42.5vw);
  transform: translateX(calc(50vw - 50%));
}

.kg-width-full {
  position: relative;
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

