/* ============================================
   Moosavi Physics Academy — Biomaze-Inspired Styles
   ============================================ */

/* ---------- @font-face: Self-hosted fonts ---------- */

/* Material Symbols Outlined (local) */
@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("/static/fonts/materialsymbols.a73b2817ae3c.ttf") format('truetype');
}

/* IranSansX (licensed, user-provided TTF files) */
@font-face {
  font-family: 'IranSansX';
  font-style: normal;
  font-weight: 100;
  font-display: swap;
  src: url("/static/fonts/fonnts.com-IRANSansXThin.e6f2fcf87f22.ttf") format('truetype');
}
@font-face {
  font-family: 'IranSansX';
  font-style: normal;
  font-weight: 200;
  font-display: swap;
  src: url("/static/fonts/fonnts.com-IRANSansXUltraLight.be90ac0c756a.ttf") format('truetype');
}
@font-face {
  font-family: 'IranSansX';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("/static/fonts/fonnts.com-IRANSansXLight.123bd587a56f.ttf") format('truetype');
}
@font-face {
  font-family: 'IranSansX';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/fonnts.com-IRANSansXRegular.36ecc1c83b55.ttf") format('truetype');
}
@font-face {
  font-family: 'IranSansX';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/fonnts.com-IRANSansXMedium.30d96e26d791.ttf") format('truetype');
}
@font-face {
  font-family: 'IranSansX';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/fonnts.com-IRANSansXDemiBold.abfe5e908a67.ttf") format('truetype');
}
@font-face {
  font-family: 'IranSansX';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/fonnts.com-IRANSansXBold.be579363ac3f.ttf") format('truetype');
}
@font-face {
  font-family: 'IranSansX';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/fonts/fonnts.com-IRANSansXExtraBold.bd9be3d2d751.ttf") format('truetype');
}
@font-face {
  font-family: 'IranSansX';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("/static/fonts/fonnts.com-IRANSansXBlack.184607ec8f26.ttf") format('truetype');
}

/* Vazirmatn (self-hosted fallback; Regular file was corrupt, use Medium for 400) */
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/Vazirmatn-Medium.dd2193b32cbe.woff2") format('woff2');
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/Vazirmatn-Medium.dd2193b32cbe.woff2") format('woff2');
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/Vazirmatn-SemiBold.9260c1927872.woff2") format('woff2');
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/Vazirmatn-Bold.7958481fe611.woff2") format('woff2');
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/fonts/Vazirmatn-ExtraBold.a0f99309cd35.woff2") format('woff2');
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("/static/fonts/Vazirmatn-Black.6cfb460b4140.woff2") format('woff2');
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 { font-weight: 700; }

/* ---------- Skip Link ---------- */
.skip-link {
  position: fixed; top: -100%; right: 50%; transform: translateX(50%);
  z-index: 9999; padding: 10px 20px;
  background: rgba(var(--color-primary-50), 1); color: #fff;
  border-radius: 8px; font-weight: 500; font-size: 14px;
  transition: top 0.2s;
}
.skip-link:focus { top: 16px; }

/* ---------- Screen Reader Only ---------- */
.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;
}

/* ---------- Scroll Reveal ---------- */
.scroll-reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.scroll-reveal.revealed { opacity: 1; transform: translateY(0); }
.scroll-reveal-left { opacity: 0; transform: translateX(-30px); transition: opacity 0.6s ease, transform 0.6s ease; }
.scroll-reveal-left.revealed { opacity: 1; transform: translateX(0); }
.scroll-reveal-right { opacity: 0; transform: translateX(30px); transition: opacity 0.6s ease, transform 0.6s ease; }
.scroll-reveal-right.revealed { opacity: 1; transform: translateX(0); }
.scroll-reveal-scale { opacity: 0; transform: scale(0.95); transition: opacity 0.5s ease, transform 0.5s ease; }
.scroll-reveal-scale.revealed { opacity: 1; transform: scale(1); }

/* ---------- Toast ---------- */
#toast-container {
  /* top: calc(var(--navbar-height, 72px) + 12px) could be set per breakpoint;
     simplest robust fix: keep below the tallest sticky navbar (96px on xl) */
  position: fixed; top: 104px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 2rem); max-width: 400px;
}
@media (max-width: 1279px) {
  #toast-container { top: 84px; }
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 12px; font-size: 13px; font-weight: 500;
  direction: rtl; animation: toastIn 0.25s ease forwards;
  background: rgba(var(--color-neutral-0), 1);
  border: 1px solid rgba(var(--color-neutral-20), 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.toast-removing { animation: toastOut 0.25s ease forwards !important; }
.toast.success { border-color: rgba(var(--color-success-50), 0.3); }
.toast.error { border-color: rgba(var(--color-error-50), 0.3); }
.toast.warning { border-color: rgba(var(--color-warning-50), 0.3); }
.toast.info { border-color: rgba(var(--color-info-50), 0.3); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-8px) scale(0.96); } }

/* ---------- Form Validation ---------- */
.form-input-error { border-color: rgba(var(--color-error-50), 1) !important; }
.form-error-text { color: rgba(var(--color-error-50), 1); font-size: 12px; margin-top: 4px; }

/* ---------- Status Dots ---------- */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.active { background: rgba(var(--color-success-50), 1); }
.status-dot.inactive { background: rgba(var(--color-neutral-30), 1); }
.status-dot.pending { background: rgba(var(--color-warning-50), 1); }

/* ---------- Animations ---------- */
.slide-in-right { animation: slideInRight 0.3s ease; }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

.success-bounce { animation: successBounce 0.5s ease; }
@keyframes successBounce { 0% { transform: scale(0); } 50% { transform: scale(1.15); } 70% { transform: scale(0.9); } 100% { transform: scale(1); } }

.shake { animation: shake 0.5s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.cart-badge-pulse { animation: badgePulse 0.4s ease; }
@keyframes badgePulse { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* ---------- Material Symbols ---------- */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

/* ---------- RTL Helpers ---------- */
.rtl-flip { transform: scaleX(-1); }

/* ---------- Social Icon Hover ---------- */
.social-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  color: rgba(var(--color-neutral-60), 1);
  background: rgba(var(--color-neutral-10), 1);
}
.social-icon:hover { background: rgba(var(--color-primary-10), 1); color: rgba(var(--color-primary-50), 1); }

/* ---------- Navbar Smooth Shadow ---------- */
.nav-shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* ---------- Premium Hover Animations ---------- */
.hover-lift-sm {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-lift-sm:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.hover-glow-primary {
  transition: box-shadow 0.3s ease;
}
.hover-glow-primary:hover {
  box-shadow: 0 0 20px rgba(5, 90, 255, 0.15);
}

.hover-glow-gold {
  transition: box-shadow 0.3s ease;
}
.hover-glow-gold:hover {
  box-shadow: 0 0 20px rgba(255, 194, 36, 0.15);
}

.hover-scale {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-scale:hover {
  transform: scale(1.05);
}

.hover-scale-sm {
  transition: transform 0.2s ease;
}
.hover-scale-sm:hover {
  transform: scale(1.02);
}

.active-press {
  transition: transform 0.1s ease;
}
.active-press:active {
  transform: scale(0.97);
}

/* ---------- Smooth Card Interactions ---------- */
.card-interactive {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-interactive:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.card-interactive:active {
  transform: translateY(-1px) scale(0.99);
}

/* ---------- Icon Hover ---------- */
.icon-hover {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.icon-hover:hover {
  transform: scale(1.1);
}
.icon-hover:active {
  transform: scale(0.95);
}

/* ---------- Button Press ---------- */
.btn-press {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-press:active {
  transform: scale(0.96);
  box-shadow: none;
}

/* ---------- Premium Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(var(--color-neutral-30), 1);
  border-radius: 3px;
  transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover { background: rgba(var(--color-neutral-40), 1); }

/* ---------- Premium Selection ---------- */
::selection {
  background: rgba(var(--color-primary-50), 0.15);
  color: rgba(var(--color-neutral-90), 1);
}

/* ---------- Smooth Focus ---------- */
*:focus-visible {
  outline: 2px solid rgba(var(--color-primary-50), 0.4);
  outline-offset: 2px;
  border-radius: 4px;
  transition: outline-color 0.15s ease;
}

/* ---------- Gradient Text (kept for homepage) ---------- */
.gradient-text {
  background: linear-gradient(135deg, rgba(var(--color-primary-50), 1), rgba(var(--color-gold-50), 1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Print ---------- */
@media print { .skip-link, #back-to-top, .toast, [x-cloak] { display: none !important; } }

/* ---------- Swiper Pagination (biomaze-style) ---------- */
.swiper-pagination-bullet {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(var(--color-neutral-30), 1);
  opacity: 1;
  transition: all 0.2s;
}
.swiper-pagination-bullet-active {
  width: 24px; border-radius: 4px;
  background: rgba(var(--color-primary-50), 1);
}

/* ---------- Premium Card Interactions ---------- */
.card-premium:active {
  transform: translateY(-1px) scale(0.995);
}

/* ---------- Premium Button Ripple ---------- */
.btn-premium:active {
  transform: scale(0.97);
}

/* ---------- Ambient Glow ---------- */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.4;
}

/* ---------- Blog content (prose) ---------- */
.blog-content {
  font-size: 16px;
  line-height: 2.1;
  color: rgba(var(--color-neutral-90), 1);
}
.blog-content h2 {
  font-size: 20px;
  font-weight: 800;
  color: rgba(var(--color-dark-primary), 1);
  margin: 1.8em 0 0.7em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid rgba(var(--color-neutral-20), 1);
  scroll-margin-top: 90px;
}
.blog-content h3 {
  font-size: 17px;
  font-weight: 700;
  color: rgba(var(--color-dark-primary), 1);
  margin: 1.5em 0 0.6em;
  scroll-margin-top: 90px;
}
.blog-content p { margin: 0 0 1em; }
.blog-content ul, .blog-content ol { margin: 0 0 1em; padding-right: 1.4em; }
.blog-content ul { list-style: disc; }
.blog-content ol { list-style: decimal; }
.blog-content li { margin-bottom: 0.4em; }
.blog-content a { color: rgba(var(--color-primary-50), 1); text-decoration: underline; text-underline-offset: 3px; }
.blog-content a:hover { color: rgba(var(--color-primary-60), 1); }
.blog-content blockquote {
  border-right: 4px solid rgba(var(--color-primary-50), 0.5);
  background: rgba(var(--color-primary-10), 0.4);
  padding: 0.9em 1.2em;
  border-radius: 12px;
  margin: 1.2em 0;
  color: rgba(var(--color-neutral-70), 1);
}
.blog-content img { border-radius: 16px; max-width: 100%; height: auto; margin: 1.2em 0; }
.blog-content pre, .blog-content code {
  background: rgba(var(--color-neutral-10), 1);
  border-radius: 8px;
  font-size: 13px;
}
.blog-content code { padding: 0.15em 0.4em; }
.blog-content pre { padding: 1em; overflow-x: auto; }
.blog-content pre code { background: transparent; padding: 0; }
.blog-content table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 14px; }
.blog-content th, .blog-content td { border: 1px solid rgba(var(--color-neutral-20), 1); padding: 0.6em 0.9em; text-align: right; }
.blog-content th { background: rgba(var(--color-neutral-10), 1); font-weight: 700; }

/* ---------- Blog video player extras ---------- */
.blog-vq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(var(--color-neutral-20), 1);
  background: rgba(var(--color-neutral-0), 1);
  color: rgba(var(--color-neutral-70), 1);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.blog-vq-btn:hover { background: rgba(var(--color-neutral-10), 1); }
.blog-vq-btn.active {
  background: rgba(var(--color-primary-50), 1);
  border-color: rgba(var(--color-primary-50), 1);
  color: #fff;
}

/* Plyr theming to brand blue + RTL control row */
.blog-video-wrap .plyr { --plyr-color-main: rgba(var(--color-primary-50), 1); }
.blog-video-wrap .plyr__controls { direction: ltr; }
.blog-video-wrap .plyr__controls button { cursor: pointer; }

/* ============================================
   Blog Redesign (list + detail)
   ============================================ */

/* ---- Headline balance / better orphans ---- */
.text-balance { text-wrap: balance; }
.blog-content p { text-wrap: pretty; }

/* ---- Reading progress bar (article detail) ---- */
.blog-progress { transition: opacity 0.25s ease; }
.blog-progress.is-hidden { opacity: 0; }
#blogProgressBar { transition: width 80ms linear; }

/* ---- Sticky TOC + scrollspy active state ---- */
.blog-toc { scrollbar-width: thin; scrollbar-color: rgba(var(--color-neutral-30), 1) transparent; }
.blog-toc::-webkit-scrollbar { width: 4px; }
.blog-toc::-webkit-scrollbar-thumb { background: rgba(var(--color-neutral-30), 1); border-radius: 2px; }
.blog-toc a.is-active {
  color: rgba(var(--color-primary-50), 1);
  border-color: rgba(var(--color-primary-50), 1);
  font-weight: 700;
  background: rgba(var(--color-primary-10), 0.5);
  border-radius: 4px;
}

/* ---- Editorial card hover: number watermark / accent ---- */
.post-card-meta { transition: color 0.25s ease; }

/* ---- Pre-wrap links in content (table-safe) ---- */
.blog-content { overflow-wrap: break-word; }
.blog-content h2, .blog-content h3 { scroll-margin-top: 96px; }
.blog-content h2 { text-wrap: balance; }
.blog-content p { max-width: 70ch; }
.blog-content blockquote { text-wrap: pretty; }

/* ---- Share buttons ---- */
.blog-share-btn {
  position: relative;
  overflow: hidden;
}
.blog-share-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.blog-share-btn:hover::after { opacity: 1; }

/* ---- Copy-link toast feedback ---- */
.copy-link-toast {
  position: fixed;
  bottom: 24px;
  right: 50%;
  transform: translateX(50%) translateY(12px);
  background: rgba(var(--color-neutral-90), 0.95);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1000;
}
.copy-link-toast.is-visible { opacity: 1; transform: translateX(50%) translateY(0); }

/* ---- List hero ambient background ---- */
@media (prefers-reduced-motion: reduce) {
  #blogProgressBar { transition: none; }
  .blog-progress { animation-duration: 0.01ms !important; }
}

/* ---- Featured number markers ---- */
.post-index-badge {
  font-variant-numeric: tabular-nums;
}
