/* Typography Imports with Fallback Cascade */
@import url('https://fonts.googleapis.com/css2?family=Estedad:wght@100..900&family=Noto+Sans+Arabic:wght@100..900&family=Roboto+Slab:wght@100..900&display=swap');
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
  /* Light Theme (Warm White + Red) */
  --bg-main: #F8F6F1;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #FFFFFF;
  --bg-surface-muted: #F2EFE9;
  --text-primary: #171717;
  --text-secondary: #737373;
  --border-color: rgba(23, 23, 23, 0.08);
  --border-focus: rgba(198, 40, 40, 0.4);
  
  --accent-primary: #C62828;
  --accent-hover: #B71C1C;
  --accent-secondary: #E57373;
  --accent-glow: rgba(198, 40, 40, 0.15);

  /* Neumorphic Shadows for Light Theme */
  --neu-shadow-outer: 6px 6px 14px rgba(0, 0, 0, 0.06), -6px -6px 14px rgba(255, 255, 255, 0.9);
  --neu-shadow-inner: inset 3px 3px 6px rgba(0, 0, 0, 0.06), inset -3px -3px 6px rgba(255, 255, 255, 0.8);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.06);

  /* Typography Stacks */
  --font-persian: 'Estedad', 'Noto Sans Arabic', 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display-en: 'Roboto Slab', serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

[data-theme="dark"] {
  /* Dark Theme (Charcoal + Orange) */
  --bg-main: #101010;
  --bg-surface: #191919;
  --bg-surface-elevated: #222222;
  --bg-surface-muted: #242424;
  --text-primary: #F4F1EA;
  --text-secondary: #96928A;
  --border-color: rgba(244, 241, 234, 0.1);
  --border-focus: rgba(249, 115, 22, 0.5);

  --accent-primary: #F97316;
  --accent-hover: #EA580C;
  --accent-secondary: #FDBA74;
  --accent-glow: rgba(249, 115, 22, 0.2);

  /* Neumorphic Shadows for Dark Theme */
  --neu-shadow-outer: 6px 6px 16px rgba(0, 0, 0, 0.6), -6px -6px 16px rgba(255, 255, 255, 0.03);
  --neu-shadow-inner: inset 3px 3px 6px rgba(0, 0, 0, 0.6), inset -3px -3px 6px rgba(255, 255, 255, 0.02);
  --glass-bg: rgba(25, 25, 25, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-persian);
  line-height: 1.7;
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Liquid Glass Navbar Layer */
.glass-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

/* Base Container */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Fluid Motion Interactive Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-persian);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.1s cubic-bezier(0.3, 0, 0.8, 0.15), background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #FFFFFF;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-neu {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--neu-shadow-outer);
}

.btn-neu:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-neu:active {
  box-shadow: var(--neu-shadow-inner);
}

/* Fluid Neumorphic Theme Switcher */
.theme-switch-wrapper {
  display: inline-flex;
  align-items: center;
}

.theme-switch {
  position: relative;
  width: 64px;
  height: 32px;
  border-radius: 99em;
  background: var(--bg-surface-muted);
  box-shadow: var(--neu-shadow-inner);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  user-select: none;
}

.theme-switch-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch-thumb {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-surface);
  box-shadow: var(--neu-shadow-outer);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .theme-switch-thumb {
  transform: translateX(-32px);
  background: var(--accent-primary);
}

.theme-icon-svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.theme-icon-sun {
  color: #F59E0B;
}

.theme-icon-moon {
  color: var(--text-secondary);
}

/* Technical Article Card */
.article-card {
  background: var(--bg-surface);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--neu-shadow-outer);
  transition: transform 0.25s cubic-bezier(0.3, 0, 0.2, 1), border-color 0.25s ease;
  position: relative;
  overflow: hidden;
}

.article-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
}

.article-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.article-tag {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--accent-glow);
  color: var(--accent-primary);
  text-decoration: none;
}

.article-readtime {
  font-size: 12px;
  color: var(--text-secondary);
}

.article-title {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.5;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.article-title:hover {
  color: var(--accent-primary);
}

.article-summary {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.author-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.author-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-surface-muted);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--accent-primary);
}

.author-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

/* Isometric Action Button in Footer / Cards */
.card-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  transition: color 0.2s ease, transform 0.1s ease;
}

.card-action-btn:hover {
  color: var(--accent-primary);
}

.card-action-btn:active {
  transform: scale(0.92);
}

/* Form Elements & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  box-shadow: var(--neu-shadow-inner);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}