/* =================================================================
   AlgoStock Tutorial Website — Stylesheet
   Designed with rich glassmorphism, responsive grid, and RTL support.
   ================================================================= */

:root {
  --ink:       #06100e;
  --ink2:      #0d1f1b;
  --ink3:      #172e28;
  --seam:      #1f3d36;
  --seam2:     #2a5248;
  --mist:      #7aa89f;
  --fog:       #3d6159;
  --paper:     #eef5f3;
  --paper2:    #f7faf9;
  --teal:      #00d4aa;
  --teal-hi:   #00ffcc;
  --teal-lo:   rgba(0,212,170,0.10);
  --teal-glow: rgba(0,212,170,0.22);
  --gold:      #e8a030;
  --gold-lo:   rgba(232,160,48,0.10);
  --red-lo:    rgba(239,68,68,0.12);
  --red:       #ef4444;
  --r: 18px;
  --rs: 10px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--ink);
  color: var(--paper);
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23g)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: .5;
}

/* RTL Support */
[dir="rtl"] {
  font-family: 'Noto Naskh Arabic', 'Bricolage Grotesque', sans-serif;
}

/* Header / Navigation */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 48px;
  background: rgba(6, 16, 14, 0.85);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--seam);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Clash Display', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--paper);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo-gem {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--teal), #009e80);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  box-shadow: 0 0 20px var(--teal-glow);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--ink2);
  border: 1px solid var(--seam);
  border-radius: 999px;
  padding: 4px;
}

.lang-btn {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--fog);
  transition: all .2s;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: .05em;
}

.lang-btn.active {
  background: var(--teal);
  color: var(--ink);
  box-shadow: 0 2px 8px var(--teal-glow);
}

.back-btn {
  background: transparent;
  border: 1px solid var(--seam2);
  color: var(--mist);
  padding: 8px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all .25s;
}

.back-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-lo);
}

/* Tutorial Hero */
.tutorial-hero {
  padding: 140px 24px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(0, 212, 170, 0.12), transparent 70%);
}

.tutorial-hero h1 {
  font-family: 'Clash Display', sans-serif;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.tutorial-hero h1 em {
  font-style: normal;
  color: var(--teal);
}

.tutorial-hero p {
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  color: var(--mist);
  max-width: 700px;
  margin: 0 auto;
  font-weight: 300;
}

/* Tutorial Workspace */
.tutorial-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 100px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  align-items: start;
}

/* Sticky Sidebar Navigation */
.tutorial-sidebar {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--ink2);
  border: 1px solid var(--seam);
  border-radius: var(--r);
  padding: 20px;
}

.tutorial-sidebar::-webkit-scrollbar {
  width: 4px;
}
.tutorial-sidebar::-webkit-scrollbar-thumb {
  background: var(--seam2);
  border-radius: 999px;
}

.sidebar-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fog);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--seam);
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--mist);
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 8px;
  transition: all .2s;
  border: 1px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.02);
  color: var(--paper);
}

.sidebar-link.active {
  background: var(--teal-lo);
  color: var(--teal);
  border-color: rgba(0, 212, 170, 0.2);
  font-weight: 600;
}

.sidebar-link .step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  background: var(--ink3);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--seam);
  color: var(--fog);
}

.sidebar-link.active .step-num {
  background: var(--teal);
  color: var(--ink);
  border-color: var(--teal);
}

/* Steps Content */
.tutorial-content {
  display: flex;
  flex-direction: column;
  gap: 60px;
}

.tutorial-step {
  background: var(--ink2);
  border: 1px solid var(--seam);
  border-radius: var(--r);
  padding: 40px;
  scroll-margin-top: 100px;
  transition: border-color .3s;
}

.tutorial-step:hover {
  border-color: rgba(0, 212, 170, 0.2);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--seam);
  padding-bottom: 18px;
}

.step-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--teal-lo);
  color: var(--teal);
  border: 1px solid rgba(0, 212, 170, 0.3);
  padding: 6px 14px;
  border-radius: 999px;
}

.step-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--paper);
}

.step-body {
  font-size: 0.95rem;
  color: var(--mist);
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.step-body p strong {
  color: var(--paper);
}

.step-body h4 {
  font-family: 'Clash Display', sans-serif;
  font-size: 1.1rem;
  color: var(--teal);
  margin-top: 10px;
}

.step-body ul, .step-body ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-body li strong {
  color: var(--paper);
}

/* Screenshot Placeholder */
.screenshot-placeholder {
  position: relative;
  background: var(--ink3);
  border: 2px dashed var(--seam2);
  border-radius: 12px;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 380px;
  margin: 20px 0;
  cursor: pointer;
  transition: all 0.3s;
}

.screenshot-placeholder:hover {
  border-color: var(--teal);
  background: rgba(0, 212, 170, 0.02);
}

.placeholder-icon {
  font-size: 3rem;
  color: var(--fog);
  margin-bottom: 15px;
  transition: transform 0.3s;
}

.screenshot-placeholder:hover .placeholder-icon {
  transform: scale(1.1);
  color: var(--teal);
}

.placeholder-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--paper);
  margin-bottom: 6px;
}

.placeholder-desc {
  font-size: 0.82rem;
  color: var(--fog);
  max-width: 420px;
  line-height: 1.5;
}

.placeholder-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  background: var(--ink2);
  border: 1px solid var(--seam);
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--mist);
}

/* Callouts / Warnings */
.tip-box {
  background: var(--teal-lo);
  border-left: 4px solid var(--teal);
  border-radius: 4px 12px 12px 4px;
  padding: 18px 24px;
  font-size: 0.9rem;
  color: var(--paper);
}

.tip-box b {
  color: var(--teal-hi);
  display: block;
  margin-bottom: 4px;
}

.warning-box {
  background: rgba(232, 160, 48, 0.07);
  border-left: 4px solid var(--gold);
  border-radius: 4px 12px 12px 4px;
  padding: 18px 24px;
  font-size: 0.9rem;
  color: var(--paper);
}

.warning-box b {
  color: var(--gold);
  display: block;
  margin-bottom: 4px;
}

/* Back to Top Floating Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--ink);
  display: grid;
  place-items: center;
  text-decoration: none;
  font-weight: bold;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 100;
  transition: all 0.2s;
  opacity: 0;
  visibility: hidden;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-3px);
  background: var(--teal-hi);
  box-shadow: 0 6px 16px var(--teal-glow);
}

/* RTL Specific Overrides */
[dir="rtl"] header {
  padding: 14px 48px;
}

[dir="rtl"] .tip-box, [dir="rtl"] .warning-box {
  border-left: none;
  border-radius: 12px 4px 4px 12px;
}

[dir="rtl"] .tip-box {
  border-right: 4px solid var(--teal);
}

[dir="rtl"] .warning-box {
  border-right: 4px solid var(--gold);
}

[dir="rtl"] .placeholder-badge {
  right: auto;
  left: 15px;
}

[dir="rtl"] .back-to-top {
  right: auto;
  left: 30px;
}

/* Responsive Breakpoints */
@media(max-width: 992px) {
  .tutorial-container {
    grid-template-columns: 1fr;
  }
  
  .tutorial-sidebar {
    position: static;
    max-height: none;
  }
  
  header {
    padding: 14px 24px;
  }
}

@media(max-width: 576px) {
  .tutorial-step {
    padding: 24px;
  }
  
  .step-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
