/*
Theme Name: Asterisk High-Tech Magazine
Theme URI: https://asteriskclasses.com
Description: High-Tech Magazine Layout EdTech Theme for Asterisk Classes. Features dynamic CSS Grid & Flexbox content cards, wide-container single reading mode with fluid typography, KaTeX chemical/math formula formatting, and locked author metadata.
Author: Balvir Sir
Author URI: https://asteriskclasses.com
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: asterisk-child
*/

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@500;600;700;800&display=swap');

/* ==========================================================================
   1. DESIGN TOKENS & SYSTEM VARIABLES
   ========================================================================== */
:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Palette */
  --ast-bg: #0b0f19;
  --ast-bg-subtle: #111827;
  --ast-surface: #1e293b;
  --ast-surface-elevated: #243248;
  --ast-border: #334155;
  --ast-border-hover: #475569;

  --ast-text-title: #f8fafc;
  --ast-text-body: #cbd5e1;
  --ast-text-muted: #94a3b8;

  --ast-primary: #3b82f6;
  --ast-primary-glow: rgba(59, 130, 246, 0.25);
  --ast-secondary: #0ea5e9;
  --ast-accent-emerald: #10b981;
  --ast-accent-amber: #f59e0b;
  --ast-accent-rose: #ef4444;
  --ast-accent-purple: #a855f7;

  /* Reading Mode Variables */
  --read-bg: #ffffff;
  --read-surface: #ffffff;
  --read-text-title: #0f172a;
  --read-text-body: #334155;
  --read-text-muted: #64748b;
  --read-border: #e2e8f0;

  /* Typography Scale */
  --type-h1: clamp(2rem, 3.5vw + 1rem, 3.25rem);
  --type-h2: clamp(1.6rem, 2.5vw + 0.8rem, 2.25rem);
  --type-h3: clamp(1.3rem, 1.8vw + 0.6rem, 1.75rem);
  --type-body: clamp(1.05rem, 0.4vw + 0.95rem, 1.22rem);
  --type-lead: clamp(1.15rem, 0.5vw + 1rem, 1.35rem);

  /* Spacing & Layout */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 30px var(--ast-primary-glow);
}

/* ==========================================================================
   2. GLOBAL BASE & RESET
   ========================================================================== */
*, *::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(--font-sans);
  background-color: var(--ast-bg);
  color: var(--ast-text-body);
  line-height: 1.7;
  overflow-x: hidden;
}

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

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

/* ==========================================================================
   3. HIGH-TECH MAGAZINE MASTHEAD & HEADER
   ========================================================================== */
.mag-header {
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ast-border);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.mag-ticker {
  background: #080d1a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  height: 38px;
  position: relative;
  overflow: hidden;
}

.ticker-badge-wrapper {
  background: #080d1a;
  padding: 0 16px 0 24px;
  z-index: 10;
  display: flex;
  align-items: center;
  height: 100%;
  flex-shrink: 0;
  box-shadow: 14px 0 18px #080d1a;
}

.ticker-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.ticker-marquee-box {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.ticker-text {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: tickerSlide 28s linear infinite;
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 500;
}

.ticker-text:hover {
  animation-play-state: paused;
}

@keyframes tickerSlide {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

.mag-nav-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mag-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mag-logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ast-primary), var(--ast-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 0 15px var(--ast-primary-glow);
}

.mag-brand-title {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--ast-text-title);
}

.mag-brand-title span {
  color: var(--ast-primary);
}

.mag-nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.mag-nav-link {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ast-text-muted);
}

.mag-nav-link:hover, .mag-nav-link.active {
  color: var(--ast-text-title);
}

.btn-mag-cta {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-mag-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

/* ==========================================================================
   4. FRONT-PAGE: HIGH-TECH MAGAZINE GRID
   ========================================================================== */
.mag-main-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* Featured Hero Layout (CSS Grid) */
.mag-hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 28px;
  margin-bottom: 48px;
}

.mag-lead-article {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid var(--ast-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.mag-lead-article::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, var(--ast-primary-glow) 0%, transparent 70%);
  pointer-events: none;
}

.mag-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 16px;
  width: fit-content;
}

.mag-lead-title {
  font-size: var(--type-h1);
  font-weight: 900;
  line-height: 1.18;
  color: var(--ast-text-title);
  margin-bottom: 16px;
}

.mag-lead-excerpt {
  font-size: var(--type-lead);
  color: var(--ast-text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.mag-sidebar-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mag-side-card {
  background: var(--ast-surface);
  border: 1px solid var(--ast-border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.mag-side-card:hover {
  transform: translateY(-3px);
  border-color: var(--ast-primary);
  box-shadow: var(--shadow-glow);
}

/* Filter Bar Component */
.mag-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  padding: 18px 24px;
  background: var(--ast-bg-subtle);
  border: 1px solid var(--ast-border);
  border-radius: var(--radius-md);
}

.filter-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  background: transparent;
  color: var(--ast-text-muted);
  border: 1px solid var(--ast-border);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.filter-btn:hover, .filter-btn.active {
  background: var(--ast-primary);
  border-color: var(--ast-primary);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--ast-primary-glow);
}

.filter-search-box {
  display: flex;
  align-items: center;
  background: var(--ast-surface);
  border: 1px solid var(--ast-border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  min-width: 260px;
}

.filter-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.88rem;
  width: 100%;
  font-family: var(--font-sans);
}

/* Interactive Content Cards Grid (CSS Grid) */
.mag-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.content-card {
  background: var(--ast-surface);
  border: 1px solid var(--ast-border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.content-card:hover {
  transform: translateY(-4px);
  border-color: #60a5fa;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3), var(--shadow-glow);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.class-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.tag-class12 { background: rgba(59, 130, 246, 0.18); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.3); }
.tag-class10 { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.tag-neet    { background: rgba(245, 158, 11, 0.18); color: #fde68a; border: 1px solid rgba(245, 158, 11, 0.3); }
.tag-jkssb   { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.3); }

.subject-label {
  font-size: 0.8rem;
  color: var(--ast-text-muted);
  font-weight: 600;
}

.card-title {
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--ast-text-title);
  line-height: 1.35;
  margin-bottom: 10px;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--ast-text-muted);
  line-height: 1.55;
  margin-bottom: 20px;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  color: var(--ast-text-muted);
}

.card-read-link {
  color: #60a5fa;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card-read-link:hover {
  color: #ffffff;
  transform: translateX(3px);
}

/* ==========================================================================
   5. SINGLE POST: WIDE READING CONTAINER & FLUID TYPOGRAPHY
   ========================================================================== */
.single-post-wrapper {
  background-color: var(--read-bg);
  color: var(--read-text-body);
  min-height: 100vh;
  padding: 40px 0 80px;
}

/* Strict requirement: Minimum 32px padding on all screen sizes */
.reading-container {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 64px) 32px; /* Always >= 32px padding */
  box-sizing: border-box;
}

.article-header {
  margin-bottom: 36px;
  border-bottom: 1px solid var(--read-border);
  padding-bottom: 28px;
}

.article-category {
  display: inline-block;
  background: #eff6ff;
  color: #2563eb;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.article-title {
  font-size: var(--type-h1);
  font-weight: 900;
  color: var(--read-text-title);
  line-height: 1.22;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}

/* Verified Author Metadata Row: Locked to 'Balvir Sir' */
.article-meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.92rem;
  color: var(--read-text-muted);
}

.meta-author {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--read-text-title);
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
}

.verified-badge {
  color: #10b981;
  font-size: 0.9rem;
}

.article-meta-divider {
  color: #cbd5e1;
}

/* Fluid Typography in Prose Content */
.article-content {
  font-size: var(--type-body);
  line-height: 1.8;
  color: var(--read-text-body);
}

.article-content p {
  margin-bottom: 1.6em;
}

.article-content h2 {
  font-size: var(--type-h2);
  font-weight: 800;
  color: var(--read-text-title);
  line-height: 1.28;
  margin: 1.8em 0 0.8em;
  letter-spacing: -0.01em;
}

.article-content h3 {
  font-size: var(--type-h3);
  font-weight: 700;
  color: var(--read-text-title);
  line-height: 1.35;
  margin: 1.5em 0 0.6em;
}

.article-content ul, .article-content ol {
  margin: 0 0 1.6em 1.5em;
}

.article-content li {
  margin-bottom: 0.5em;
}

.article-content blockquote {
  border-left: 4px solid var(--ast-primary);
  background: #f8fafc;
  padding: 18px 24px;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  margin: 2em 0;
  color: #1e293b;
}

/* ==========================================================================
   6. MATH & CHEMICAL FORMULA SUBSCRIPT/SUPERSCRIPT ENGINE
   ========================================================================== */
sub, sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sup {
  top: -0.5em;
}

sub {
  bottom: -0.25em;
}

.chem-formula, .formula-badge {
  font-family: var(--font-mono);
  font-weight: 600;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  padding: 2px 7px;
  border-radius: 5px;
  display: inline-block;
  letter-spacing: 0.02em;
}

.equation-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  padding: 20px 24px;
  margin: 28px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  line-height: 1.7;
}

/* ==========================================================================
   7. AUTHOR PROFILE BOX (BALVIR SIR LOCKED)
   ========================================================================== */
.author-profile-card {
  background: #f8fafc;
  border: 1px solid var(--read-border);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-top: 48px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.author-profile-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #1e40af;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(30, 64, 175, 0.25);
}

.author-profile-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--read-text-title);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.author-profile-bio {
  font-size: 0.92rem;
  color: var(--read-text-muted);
  line-height: 1.55;
}

/* ==========================================================================
   8. RESPONSIVE BREAKPOINTS & ZERO LAYOUT SHIFT
   ========================================================================== */
@media (max-width: 992px) {
  .mag-hero-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mag-nav-links {
    display: none;
  }
  .mag-cards-grid {
    grid-template-columns: 1fr;
  }
  .reading-container {
    padding: 32px 32px; /* Guarantees minimum 32px padding on mobile */
  }
  .author-profile-card {
    flex-direction: column;
    text-align: center;
  }
}

/* ==========================================================================
   9. HIGH-CONTRAST GLOBAL FIXES FOR STUDY READER & TABS
   ========================================================================== */
.ast-ch-tab-btn {
  padding: 9px 18px !important;
  border-radius: 9px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #0f172a !important; /* Bold high-contrast text */
  font-weight: 700 !important;
  font-size: 13.5px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

[data-ast-theme="dark"] .ast-ch-tab-btn {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

.ast-ch-tab-btn:hover {
  border-color: var(--ast-primary) !important;
  color: var(--ast-primary) !important;
}

.ast-ch-tab-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35) !important;
}

/* Chapter Header Banner - High Contrast Fix */
.chapter-header {
  background: linear-gradient(135deg, #1e3a8a, #2563eb) !important;
  color: #ffffff !important;
  border-radius: 12px !important;
  padding: 22px 24px !important;
  margin-bottom: 20px !important;
  text-align: center !important;
  box-shadow: 0 4px 15px rgba(30, 58, 138, 0.2) !important;
}

.chapter-header h1,
.ast-article-body .chapter-header h1 {
  color: #ffffff !important;
  font-size: 22px !important;
  font-weight: 800 !important;
  margin: 6px 0 10px 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25) !important;
  padding-bottom: 8px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.chapter-header p,
.ast-article-body .chapter-header p {
  color: #f1f5f9 !important;
  font-size: 13.5px !important;
  line-height: 1.6 !important;
  margin: 4px 0 0 0 !important;
  opacity: 0.95 !important;
  font-weight: 500 !important;
}

.chapter-header p:first-child,
.ast-article-body .chapter-header p:first-child {
  font-size: 11.5px !important;
  color: #93c5fd !important;
  text-transform: uppercase !important;
  letter-spacing: 1.5px !important;
  font-weight: 700 !important;
}
