/* ============================= LOCAL FONTS ============================= */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../font/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: 'Sora';
  src: url('../font/Sora.ttf') format('truetype');
  font-weight: 300 800;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../font/Inter.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../font/JetBrains-mono.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

/* ============================= TOKENS ============================= */
:root{
  --font-scale: 1.08;
  --font-size-base: calc(1rem * var(--font-scale));

  --bg:#06060a;
  --bg-soft:#0b0b12;
  --surface: rgba(18, 22, 36, 0.75);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.16);
  --text:#e8ecf1;
  --muted:#8892a0;
  --cyan:#4fd8e8;
  --blue:#1e40af;
  --dark-blue:#0f172a;
  --glow-color: rgba(79, 216, 232, 0.25);
  --accent-grad: linear-gradient(120deg, var(--cyan), var(--blue) 55%, var(--dark-blue));
  --shadow-soft: 0 20px 50px rgba(0,0,0,0.65);
  --radius: 18px;
  --ease: cubic-bezier(.22,1,.36,1);
  --font-display:'Sora', system-ui, sans-serif;
  --font-body:'Inter', system-ui, sans-serif;
  --font-mono:'JetBrains Mono', ui-monospace, monospace;
  --card-blur: blur(8px) saturate(130%);
  color-scheme: dark;
}

html[lang="fa"] {
  --font-body: 'Vazirmatn', 'Inter', system-ui, sans-serif;
  --font-display: 'Vazirmatn', 'Sora', system-ui, sans-serif;
}

html[data-theme="light"]{
  --bg:#eef1f6;
  --bg-soft:#e4e8f0;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.85);
  --border: rgba(20, 25, 40, 0.14);
  --text:#10131a;
  --muted:#5b6472;
  --cyan:#0891a6;
  --blue:#1d4ed8;
  --dark-blue:#1e3a8a;
  --glow-color: rgba(8, 145, 166, 0.15);
  --shadow-soft: 0 20px 40px rgba(20,25,45,0.12);
  --card-blur: blur(8px) saturate(130%);
  color-scheme: light;
}

html[data-theme="sunrise"]{
  --bg:#0f0d06;
  --bg-soft:#1a150a;
  --surface: rgba(32, 26, 12, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.14);
  --border: rgba(245, 158, 11, 0.22);
  --text:#fffbeb;
  --muted:#d97706;
  --cyan:#f59e0b;
  --blue:#b45309;
  --dark-blue:#78350f;
  --glow-color: rgba(245, 158, 11, 0.2);
  --shadow-soft: 0 20px 50px rgba(40,25,5,0.65);
  --card-blur: blur(8px) saturate(130%);
  color-scheme: dark;
}

*{margin:0;padding:0;box-sizing:border-box;}
html{
  font-size: var(--font-size-base);
  scroll-behavior:smooth; 
  overflow-x:hidden; 
  width:100%;
}
body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  overflow-x:hidden;
  width:100%;
  transition:background-color .2s var(--ease), color .2s var(--ease);
  -webkit-font-smoothing:antialiased;
}
::selection{background:var(--blue); color:#fff;}
a{color:inherit; text-decoration:none;}
button{font-family:inherit;}
::-webkit-scrollbar{width:8px;}
::-webkit-scrollbar-track{background:var(--bg);}
::-webkit-scrollbar-thumb{background:var(--border); border-radius:10px;}

.header-btn, .btn, .nav-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: inline-block;
  vertical-align: middle;
}

.section-eyebrow{
  font-family:var(--font-body);
  font-size:.82rem;
  font-weight:600;
  letter-spacing:.18em;
  text-transform:uppercase;
  color:var(--cyan);
  opacity:.9;
  display:flex;
  align-items:center;
  gap:.6em;
  margin-bottom:.5rem;
}
.section-eyebrow::before{
  content:"";
  width:22px; height:1px;
  background:var(--cyan);
  display:inline-block;
}
.section-title{
  font-family:var(--font-display);
  font-weight:700;
  font-size:clamp(1.85rem, 3.5vw, 2.85rem);
  letter-spacing:-0.01em;
}
.container{
  max-width:1240px;
  margin:0 auto;
  padding:0 clamp(16px, 4vw, 48px);
  width:100%;
}

.glass, .about-card, .stat-card, .project-card, .skills-group, .deck-card, .contact-card {
  position: relative;
  z-index: 2;
  background-color: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border-radius: var(--radius);
}

.hero{
  position:relative;
  height:100vh; width:100%;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
}
#bg-canvas{
  position:fixed; inset:0; width:100vw; height:100vh; z-index:1;
  opacity:.45; pointer-events:none;
  will-change: transform;
}
.hero-vignette{
  position:absolute; inset:0; z-index:2; pointer-events:none;
  background: radial-gradient(ellipse at center, transparent 30%, var(--bg) 92%);
}
.hero-inner{
  position:relative; z-index:3;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center;
  width:100%;
  padding: 0 16px;
}
.hero-tag{
  font-family:var(--font-body);
  font-size:.85rem;
  font-weight: 600;
  letter-spacing:.25em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:1.6rem;
  opacity:0;
  animation: fadeUp .9s var(--ease) .3s forwards;
}
.h1-wrap{
  display:flex;
  align-items:center;
  justify-content:center;
  width: 100%;
  overflow: visible;
}
h1.hero-name{
  font-family:var(--font-display);
  font-weight:800;
  font-size:clamp(2.2rem, 7.8vw, 6.4rem);
  line-height:1.1;
  letter-spacing:-0.01em;
  white-space:nowrap;
  color:var(--text);
  text-align:center;
  background:linear-gradient(180deg, #fff 0%, var(--text) 55%, var(--cyan) 130%);
  -webkit-background-clip:text;
  background-clip:text;
  -webkit-text-fill-color:transparent;
  filter: drop-shadow(0 0 18px var(--glow-color));
  position:relative;
}
html[data-theme="light"] h1.hero-name{
  background: linear-gradient(180deg, #10131a 0%, var(--cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(8, 145, 166, 0.2));
}
h1.hero-name .glyph{display:inline-block;}
h1.hero-name .glyph.space{width:.32em;}
.hero-subtitle{
  margin-top:1.6rem;
  font-family:var(--font-body);
  font-size:clamp(.95rem, 1.8vw, 1.2rem);
  font-weight: 500;
  letter-spacing:.06em;
  color:var(--cyan);
  min-height:1.6em;
}

.btn{
  font-family:var(--font-body);
  font-size:.9rem;
  letter-spacing:.03em;
  padding:12px 22px;
  border-radius:999px;
  border:1px solid var(--border);
  cursor:pointer;
  transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.btn-primary{
  background:var(--accent-grad);
  color:#06060a;
  border:none;
  font-weight:600;
}
.btn-primary:hover{transform:translateY(-2px);}
.btn-ghost{background:var(--surface); color:var(--text);}
.btn-ghost:hover{transform:translateY(-2px); border-color:var(--cyan);}

@keyframes fadeUp{from{opacity:0; transform:translateY(10px);} to{opacity:1; transform:translateY(0);}}

.section{padding: 48px 0; position:relative;}
.about-grid{
  display:grid;
  grid-template-columns: 1fr 1.25fr;
  gap:24px;
  align-items:stretch;
}
.about-card{
  padding: clamp(20px, 3vw, 32px);
  box-shadow:var(--shadow-soft);
  overflow: hidden;
}
.avatar-frame{
  width:100px; height:100px; border-radius:20px;
  background: var(--accent-grad);
  padding:2px;
  margin-bottom:1.2rem;
}
.avatar-frame .inner{
  width:100%; height:100%; border-radius:18px;
  background:var(--bg-soft);
  display:grid; place-items:center;
  font-family:var(--font-display); font-weight:800; font-size:1.75rem;
  color:var(--text);
  overflow: hidden;
}
.avatar-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
  display: block;
}
.about-card h3{font-family:var(--font-display); font-size:1.4rem; margin-bottom:.4rem;}
.about-card .role-line{font-family:var(--font-body); font-size:.85rem; font-weight: 500; color:var(--cyan); letter-spacing:.04em; margin-bottom:.8rem; opacity:.9;}
.about-card p{color:var(--muted); line-height:1.7; font-size:.98rem; margin-bottom:1.2rem;}
.about-badges{display:flex; flex-wrap:wrap; gap:8px;}
.about-badges span{font-family:var(--font-body); font-size:.76rem; font-weight: 500; padding:5px 12px; border-radius:999px; border:1px solid var(--border); color:var(--muted); background:var(--surface-strong);}

.stats-row{
  display:grid;
  grid-template-columns:repeat(2, 1fr);
  gap:14px;
}
.stat-card{
  position:relative;
  padding:18px 18px;
  display:flex; flex-direction:column; gap:10px;
  box-shadow:var(--shadow-soft);
  transition: transform .2s var(--ease), border-color .2s var(--ease);
  overflow: hidden;
}
.stat-card:hover { transform:translateY(-3px); border-color:var(--cyan); }
.stat-icon{
  width:32px; height:32px; border-radius:10px;
  display:grid; place-items:center;
  background:var(--surface-strong);
  border:1px solid var(--border);
  color:var(--cyan);
}
.stat-icon svg{width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:1.8;}
.stat .num{
  font-family:var(--font-display); font-weight:800;
  font-size:clamp(1.8rem, 3vw, 2.4rem);
  line-height:1;
  background:var(--accent-grad); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
  display:inline-block;
}
.stat .label{font-family:var(--font-body); font-size:.76rem; font-weight: 500; letter-spacing:.05em; text-transform:uppercase; color:var(--muted);}

.section-head{display:flex; align-items:flex-end; justify-content:space-between; margin-bottom:16px; flex-wrap:wrap; gap:12px;}

.projects-filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.project-filter-btn {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.project-filter-btn:hover {
  color: var(--text);
  border-color: var(--cyan);
}

.project-filter-btn.active {
  background: var(--surface);
  color: var(--cyan);
  border-color: var(--cyan);
}

.projects-controls,
.deck-controls {
  display:flex;
  gap:10px;
  direction: ltr !important;
}

.projects-btn,
.deck-btn {
  width:38px; height:38px;
  border-radius:50%;
  border:1px solid var(--border);
  background:var(--surface-strong);
  color:var(--text);
  font-size:1rem;
  cursor:pointer;
  display:grid; place-items:center;
  transition: border-color .2s, transform .2s, background-color .2s;
}
.projects-btn:hover,
.deck-btn:hover {
  border-color:var(--cyan);
  transform:scale(1.05);
}

.projects-carousel-wrapper{
  width:100%;
  overflow:hidden;
  position:relative;
  padding:6px 0;
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
  direction: ltr !important;
}
.projects-carousel-wrapper:active {
  cursor: grabbing;
}

.projects-track{
  display:flex;
  gap:16px;
  direction: ltr !important;
  will-change: transform;
}

.project-card{
  position:relative;
  flex: 0 0 clamp(270px, 26vw, 310px);
  min-width: 270px;
  padding:20px;
  cursor:pointer;
  box-shadow:var(--shadow-soft);
  display:flex; flex-direction:column;
  overflow: hidden;
}

.project-img-wrapper{
  width:100%; height:145px;
  border-radius:12px;
  overflow:hidden;
  margin-bottom:14px;
  position:relative;
  border:1px solid var(--border);
  background: var(--bg-soft);
  z-index: 1;
}
.project-img{
  width:100%; height:100%;
  object-fit:cover;
  display: block;
  position: relative;
  z-index: 2;
  transition: transform .25s var(--ease);
}
.project-card:hover .project-img{transform:scale(1.03);}
.project-tag{font-family:var(--font-body); font-size:.74rem; font-weight: 600; letter-spacing:.1em; text-transform:uppercase; color:var(--cyan); margin-bottom:6px; display:block;}
.project-card h4{font-family:var(--font-display); font-size:1.15rem; margin-bottom:6px;}
.project-card p{color:var(--muted); font-size:.9rem; line-height:1.55; margin-bottom:14px; flex-grow:1;}
.project-stack{display:flex; flex-wrap:wrap; gap:6px;}
.chip-mini{font-family:var(--font-body); font-size:.72rem; font-weight: 500; padding:3px 9px; border-radius:999px; border:1px solid var(--border); color:var(--muted);}

/* ============================= ACHIEVEMENTS (DECK) ============================= */
.deck-container{
  position:relative;
  width:100%;
  max-width:850px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  align-items:center;
  touch-action: pan-y;
}
.deck-wrapper{
  position:relative;
  width:100%;
  height:360px;
  display:flex;
  justify-content:center;
  align-items:center;
  user-select: none;
  touch-action: pan-y;
}
.deck-card{
  position:absolute;
  width:310px;
  height:350px;
  padding:18px;
  box-shadow:var(--shadow-soft);
  transition: transform .3s var(--ease), opacity .3s var(--ease), z-index .3s var(--ease);
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  border:1px solid var(--border);
  border-radius:var(--radius);
  overflow: hidden;
  will-change: transform, opacity;
  cursor: pointer;
  touch-action: pan-y;
}
.deck-img-wrapper{
  width:100%;
  height:150px;
  border-radius:10px;
  overflow:hidden;
  margin-bottom:10px;
  border:1px solid var(--border);
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.deck-img{
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  display: block;
  position: relative;
  z-index: 2;
}
.deck-card.pos-center{
  transform: translateX(0) scale(1);
  opacity:1;
  z-index:4;
  pointer-events: auto;
  border-color:var(--cyan);
}
.deck-card.pos-left{
  transform: translateX(-55%) scale(0.82);
  opacity:0.6;
  z-index:2;
  pointer-events: auto;
}
.deck-card.pos-right{
  transform: translateX(55%) scale(0.82);
  opacity:0.6;
  z-index:2;
  pointer-events: auto;
}
.deck-card.pos-hidden{
  transform: translateX(0) scale(0.6);
  opacity:0;
  z-index:0;
  pointer-events:none;
}
.deck-badge{
  font-family:var(--font-body);
  font-size:.74rem;
  font-weight: 600;
  letter-spacing:.12em;
  color:var(--cyan);
  text-transform:uppercase;
  margin-bottom:4px;
}
.deck-card h3{
  font-family:var(--font-display);
  font-size:1.1rem;
  margin-bottom:4px;
  line-height:1.3;
}
.deck-card p{
  color:var(--muted);
  font-size:.85rem;
  line-height:1.45;
  max-height: 80px;
  overflow-y: auto;
  padding-right: 4px;
}
.deck-card p::-webkit-scrollbar {
  width: 4px;
}
.deck-card p::-webkit-scrollbar-track {
  background: transparent;
}
.deck-card p::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.deck-footer{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-family:var(--font-body);
  font-size:.78rem;
  color:var(--muted);
  border-top:1px solid var(--border);
  padding-top:8px;
  margin-top:8px;
}
.deck-controls{
  margin-top:14px;
  z-index:10;
}

/* ============================= SKILLS SECTION ============================= */
.skills-carousel-wrapper{
  width:100%;
  position:relative;
  touch-action: pan-x pan-y !important;
}

.skills-sections-wrap{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:16px;
}
.skills-group{
  padding:18px;
  box-shadow:var(--shadow-soft);
  overflow: hidden;
}
.skill-group-title{
  font-family:var(--font-display);
  font-size:1.1rem;
  margin-bottom:12px;
  color:var(--text);
  display:flex;
  align-items:center;
  gap:8px;
  border-bottom:1px solid var(--border);
  padding-bottom:8px;
}
.skill-group-title::before{
  content:"";
  width:8px; height:8px;
  border-radius:2px;
  background:var(--cyan);
}
.skills-grid-bars{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.skill-bar-card{
  padding:0;
  background:transparent;
  border:none;
}
.skill-bar-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:4px;
  font-family:var(--font-body);
  font-size:.82rem;
}
.skill-bar-name{
  font-weight:500;
  color:var(--text);
}
.skill-bar-percent{
  color:var(--cyan);
  font-family: var(--font-mono);
}
.skill-progress-bg{
  width:100%;
  height:6px;
  background:var(--surface-strong);
  border-radius:999px;
  overflow:hidden;
  border:1px solid var(--border);
}
.skill-progress-fill{
  height:100%;
  border-radius:999px;
  background:var(--accent-grad);
  transition: width .6s var(--ease);
  will-change: width;
}

/* ============================= CONTACT & ANIMATION FIXES ============================= */
.contact-card{
  padding: 24px 24px;
  text-align:center;
  position:relative;
  overflow:hidden;
  box-shadow:var(--shadow-soft);
}
.contact-card h2{
  font-family:var(--font-display); 
  font-weight:700; 
  font-size:clamp(1.7rem,3.5vw,2.7rem); 
  margin-bottom:.6rem;
}
.contact-card p{
  color:var(--muted); 
  max-width:520px; 
  margin:0 auto 1.4rem;
  font-size:.95rem;
}

.contact-tabs-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 0;
  flex-wrap: wrap;
}

.contact-tab-content {
  max-height: 0;
  opacity: 0;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: max-height 0.35s var(--ease), opacity 0.3s var(--ease), padding 0.35s var(--ease);
  padding: 0;
}

.contact-tab-content.expanded {
  max-height: 380px;
  opacity: 1;
  padding: 24px 0 10px 0;
}

.contact-tab-btn {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.contact-tab-btn:hover {
  color: var(--text);
  border-color: var(--cyan);
}

.contact-tab-btn.active {
  background: var(--surface);
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 4px 12px var(--glow-color);
}

.contact-tab-pane {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  width: 100%;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  will-change: opacity, transform;
}

.contact-tab-pane.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transform: translateY(0);
}

.contact-form {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: flex;
  gap: 14px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.25s var(--ease);
}

.form-input:focus {
  border-color: var(--cyan);
  background: var(--surface);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.telegram-actions,
.github-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
}

.telegram-actions .btn,
.github-actions .btn {
  white-space: nowrap;
}

footer{padding:24px 0; text-align:center; font-family:var(--font-body); font-size:.78rem; color:var(--muted); letter-spacing:.05em;}

/* ============================= SECRET DOOR SECTION STYLES ============================= */
.secret-section {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 180px;
  z-index: 999;
  background: var(--surface) !important;
  border-top: 1px solid var(--border) !important;
  backdrop-filter: var(--card-blur) !important;
  -webkit-backdrop-filter: var(--card-blur) !important;
  box-shadow: none !important;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.1, 0.9, 0.2, 1), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  will-change: transform;
}

.secret-section.peek,
.secret-section.open {
  box-shadow: 0 -4px 12px var(--glow-color) !important;
  border-top-color: var(--cyan) !important;
}

.secret-section.peek {
  transform: translateY(calc(100% - 24px));
}

.secret-section.open {
  transform: translateY(0);
  pointer-events: auto;
}

.secret-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  text-align: center;
}

.secret-title {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.secret-score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.8rem;
  color: var(--cyan);
  line-height: 1;
  transition: text-shadow 0.3s var(--ease);
}

.secret-hint {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--cyan);
  margin-top: 4px;
  opacity: 0.9;
  line-height: 1.4;
}

.secret-section.open .secret-score {
  animation: themeGlowPulse 2s ease-in-out infinite;
}

@keyframes themeGlowPulse {
  0%, 100% { text-shadow: 0 0 8px var(--glow-color); }
  50% { text-shadow: 0 0 20px var(--glow-color), 0 0 35px var(--cyan); }
}

/* RTL OVERRIDES */
html[dir="rtl"] .section-eyebrow::before {
  margin-left: 0.6em;
  margin-right: 0;
}

html[dir="rtl"] .form-input {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .contact-card h2,
html[dir="rtl"] .contact-card p {
  text-align: center;
  direction: rtl;
}

html[dir="rtl"] .contact-tabs-row,
html[dir="rtl"] .projects-filter-row {
  direction: rtl;
}

.reveal{opacity:0; transform:translateY(16px); transition:opacity .35s var(--ease), transform .35s var(--ease); will-change: opacity, transform;}
.reveal.in{opacity:1; transform:translateY(0);}

/* ============================= MEDIA QUERIES & EXTREME MOBILE OPTIMIZATIONS ============================= */
@media (max-width: 1024px){
  .section{padding: 36px 0;}
  .project-card {
    flex: 0 0 290px;
    min-width: 270px;
  }
  .about-grid{
    grid-template-columns:1fr;
    gap: 20px;
  }
}

@media (max-width: 920px){
  .skills-carousel-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    touch-action: pan-x pan-y !important;
    overscroll-behavior-y: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
  }
  .skills-sections-wrap {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 16px;
    width: max-content;
  }
  .skills-group {
    flex: 0 0 min(290px, 80vw);
    scroll-snap-align: start;
  }
}

@media (max-width: 800px){
  .deck-card{
    width: 280px;
    height: 340px;
  }
  .deck-card.pos-left{ transform: translateX(-35%) scale(0.82); }
  .deck-card.pos-right{ transform: translateX(35%) scale(0.82); }
}

@media (max-width: 768px) {
  #bg-canvas {
    opacity: 0.12;
  }

  .glass, .about-card, .stat-card, .project-card, .skills-group, .deck-card, .contact-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  }

  h1.hero-name {
    filter: none !important;
  }
}

@media (max-width: 580px){
  .section{padding: 24px 0;}
  .form-row {
    flex-direction: column;
  }
  .contact-card {
    padding: 16px 12px;
  }
  
  .telegram-actions,
  .github-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .telegram-actions .btn,
  .github-actions .btn {
    width: 100%;
    text-align: center;
    padding: 10px 14px;
    font-size: 0.85rem;
    border-radius: 999px !important;
  }

  .contact-tabs-row {
    flex-direction: column;
    width: 100%;
    gap: 8px;
    margin-bottom: 0;
  }

  .contact-tab-btn {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.85rem;
    text-align: center;
    border-radius: 999px !important;
  }

  .project-card {
    flex: 0 0 clamp(240px, 80vw, 280px);
    min-width: 240px;
  }
  .stats-row{grid-template-columns:1fr 1fr; gap:10px;}
  .stat-card{padding:14px 12px;}
  .about-card{padding: 18px 14px;}
  h1.hero-name{font-size:clamp(1.8rem, 8vw, 3.2rem);}
  .deck-card.pos-left{
    transform: translateX(-18%) scale(0.75);
    opacity: 0.3;
  }
  .deck-card.pos-right{
    transform: translateX(18%) scale(0.75);
    opacity: 0.3;
  }
}

@media (prefers-reduced-motion: reduce){
  *{animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.15s !important;}
}