/* ==========================================================================
   Pouya Aghely — Personal Resume & Intelligent Systems Portfolio
   Original Handcrafted Stylesheet · Forest Emerald & Mint Aurora Theme
   ========================================================================== */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-deep: #05110c;
  --bg-forest: #081a13;
  --bg-card: rgba(12, 36, 26, 0.52);
  --bg-card-hover: rgba(18, 52, 38, 0.72);
  --bg-panel: rgba(7, 24, 18, 0.94);

  --border-subtle: rgba(94, 234, 212, 0.11);
  --border-accent: rgba(52, 211, 153, 0.36);

  --text-bright: #e8f6f0;
  --text-body: #9dbbad;
  --text-muted: #6c8f80;

  --mint: #5eead4;
  --emerald: #34d399;
  --mint-soft: rgba(52, 211, 153, 0.13);
  --mint-glow: rgba(94, 234, 212, 0.28);

  --font-en: 'Inter', 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-fa: 'Vazirmatn', Tahoma, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Fira Code', Consolas, monospace;

  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 12px 34px -12px rgba(1, 8, 5, 0.75);
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-deep);
  color: var(--text-body);
  font-size: 16px;
}

body {
  min-height: 100vh;
  background: radial-gradient(ellipse at 15% 10%, #0b241a 0%, var(--bg-deep) 65%);
  color: var(--text-body);
  font-family: var(--font-en);
  line-height: 1.72;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  selection-background-color: var(--emerald);
}

html[lang="fa"] body {
  font-family: var(--font-fa);
  line-height: 1.9;
}

::selection {
  background: rgba(52, 211, 153, 0.28);
  color: var(--text-bright);
}

/* Visible Keyboard Focus */
:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: fixed;
  top: -100px;
  inset-inline-start: 16px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--emerald);
  color: #031a11;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
}

/* ==========================================================================
   Aurora Ambient Blobs & Cursor Spotlight
   ========================================================================== */
.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.34;
  will-change: transform;
}

.blob-1 {
  width: 520px;
  height: 520px;
  top: -120px;
  left: -100px;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.38), rgba(6, 78, 59, 0.05) 70%);
  animation: auroraDrift1 32s ease-in-out infinite alternate;
}

.blob-2 {
  width: 580px;
  height: 580px;
  bottom: -180px;
  right: -120px;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.26), rgba(4, 47, 46, 0.04) 70%);
  animation: auroraDrift2 38s ease-in-out infinite alternate;
}

.blob-3 {
  width: 420px;
  height: 420px;
  top: 42%;
  left: 38%;
  background: radial-gradient(circle, rgba(74, 222, 128, 0.18), transparent 72%);
  animation: auroraDrift3 28s ease-in-out infinite alternate;
}

@keyframes auroraDrift1 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(110px, 85px, 0) scale(1.14); }
}

@keyframes auroraDrift2 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-120px, -90px, 0) scale(1.12); }
}

@keyframes auroraDrift3 {
  0% { transform: translate3d(-40px, -30px, 0) scale(0.95); }
  100% { transform: translate3d(70px, 60px, 0) scale(1.15); }
}

.cursor-spotlight {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    620px circle at var(--mouse-x, 50%) var(--mouse-y, 25%),
    rgba(94, 234, 212, 0.075),
    transparent 65%
  );
  transition: opacity 0.3s ease;
}

/* ==========================================================================
   Slow 2-Second Blur + Fade Entrance Animations
   ========================================================================== */
.reveal-hero {
  opacity: 0;
  filter: blur(7px);
  transform: translateY(14px);
  animation: slowReveal 2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.24s; }
.delay-3 { animation-delay: 0.42s; }
.delay-4 { animation-delay: 0.60s; }
.delay-5 { animation-delay: 0.78s; }
.delay-6 { animation-delay: 0.96s; }

@keyframes slowReveal {
  0% {
    opacity: 0;
    filter: blur(7px);
    transform: translateY(14px);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

.reveal-on-scroll {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(18px);
  transition:
    opacity 1.85s cubic-bezier(0.22, 1, 0.36, 1),
    filter 1.85s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

/* ==========================================================================
   Fixed Top Language Switcher (EN | فارسی)
   ========================================================================== */
.lang-switcher {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  background: rgba(7, 26, 19, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-accent);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  direction: ltr;
}

.lang-btn {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text-body);
  font-family: var(--font-fa);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.lang-btn:hover {
  color: var(--text-bright);
}

.lang-btn.active {
  background: rgba(52, 211, 153, 0.2);
  color: var(--mint);
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.35);
}

.lang-sep {
  color: rgba(157, 187, 173, 0.35);
  font-size: 0.78rem;
  user-select: none;
}

/* ==========================================================================
   Split Two-Column Layout (Brittany Chiang Inspired, Original Implementation)
   ========================================================================== */
.layout-shell {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
}

@media (min-width: 1024px) {
  .layout-shell {
    grid-template-columns: minmax(320px, 415px) minmax(0, 1fr);
    gap: 68px;
    padding: 0 48px;
  }
}

/* ==========================================================================
   Sidebar / Left Column
   ========================================================================== */
.sidebar {
  padding-top: 76px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}

@media (min-width: 1024px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    padding-top: 84px;
    padding-bottom: 118px; /* Space below for the cute walking sprout mascot */
  }
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 13px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(94, 234, 212, 0.25);
  color: var(--mint);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: pulseDot 2.4s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.65; }
}

.hero-name {
  font-size: clamp(2.25rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text-bright);
}

html[lang="fa"] .hero-name {
  letter-spacing: 0;
  line-height: 1.3;
}

.hero-name a {
  color: inherit;
  text-decoration: none;
  background: linear-gradient(125deg, #f0fdf4 20%, #6ee7b7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-role {
  margin-top: 12px;
  font-size: 1.08rem;
  font-weight: 600;
  color: #d1fae5;
  line-height: 1.5;
}

.hero-tagline {
  margin-top: 14px;
  max-width: 380px;
  font-size: 0.92rem;
  color: var(--text-body);
  line-height: 1.7;
}

/* Expanding Line Section Nav */
.section-nav {
  display: none;
  margin-top: 40px;
}

@media (min-width: 1024px) {
  .section-nav {
    display: block;
  }
}

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

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color 0.25s ease;
}

html[lang="fa"] .nav-link {
  font-size: 0.88rem;
  letter-spacing: 0;
}

.nav-indicator {
  display: inline-block;
  width: 30px;
  height: 1.5px;
  background-color: var(--text-muted);
  border-radius: 2px;
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.3s ease, box-shadow 0.3s ease;
}

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

.nav-link:hover .nav-indicator,
.nav-link.active .nav-indicator {
  width: 66px;
  background-color: var(--mint);
  box-shadow: 0 0 10px var(--mint-glow);
}

/* Social Links */
.social-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 18px;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--text-body);
  background: rgba(12, 38, 28, 0.55);
  border: 1px solid var(--border-subtle);
  transition: color 0.22s ease, transform 0.22s ease, border-color 0.22s ease, background-color 0.22s ease;
}

.social-links a svg {
  width: 20px;
  height: 20px;
}

.social-links a:hover {
  color: var(--mint);
  border-color: var(--border-accent);
  background: rgba(20, 62, 45, 0.75);
  transform: translateY(-3px);
}

/* ==========================================================================
   Main Scrollable Content Column
   ========================================================================== */
.content {
  padding-top: 24px;
  padding-bottom: 136px;
}

@media (min-width: 1024px) {
  .content {
    padding-top: 84px;
  }
}

.section {
  margin-bottom: 88px;
  scroll-margin-top: 72px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--text-bright);
}

.section-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  margin-inline-start: 12px;
  background: linear-gradient(90deg, rgba(94, 234, 212, 0.28), transparent);
}

html[dir="rtl"] .section-heading::after {
  background: linear-gradient(270deg, rgba(94, 234, 212, 0.28), transparent);
}

.section-num {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--mint);
}

/* About Section */
.about-prose {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 1rem;
  color: var(--text-body);
}

.about-prose strong {
  color: var(--text-bright);
  font-weight: 600;
}

.identity-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.identity-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(12, 40, 29, 0.65);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: #cde7dc;
}

.identity-chip .chip-label {
  color: var(--mint);
  font-weight: 600;
}

/* ==========================================================================
   Metrics Dashboard (2x2 Grid)
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-card {
  position: relative;
  padding: 22px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
  transition: transform 0.28s ease, border-color 0.28s ease, background-color 0.28s ease;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--mint), transparent);
  opacity: 0.7;
}

.metric-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

.metric-value {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--mint);
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--mint-soft);
  margin-bottom: 12px;
  direction: ltr;
}

html[lang="fa"] .metric-value.is-rtl-val {
  font-family: var(--font-fa);
  direction: rtl;
}

.metric-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.metric-desc {
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.65;
}

/* ==========================================================================
   Technical Stack & Skills
   ========================================================================== */
.skills-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.skill-group {
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.skill-group:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

.skill-group-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--mint);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.skill-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.skill-item {
  font-size: 0.92rem;
  color: var(--text-body);
  padding-inline-start: 16px;
  position: relative;
}

.skill-item::before {
  content: "▹";
  position: absolute;
  inset-inline-start: 0;
  color: var(--emerald);
}

.skill-item strong {
  color: var(--text-bright);
  font-weight: 600;
}

/* ==========================================================================
   Projects & Experience (Interactive Spotlight List)
   ========================================================================== */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 1024px) {
  .projects-list:hover .project-card {
    opacity: 0.58;
  }
  .projects-list:hover .project-card:hover {
    opacity: 1;
  }
}

.project-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition:
    opacity 0.28s ease,
    transform 0.28s ease,
    background-color 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

@media (min-width: 640px) {
  .project-card {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 18px;
  }
}

.project-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}

.project-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mint);
  padding-top: 3px;
  opacity: 0.85;
}

.project-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-bright);
  transition: color 0.22s ease;
}

.project-card:hover .project-title {
  color: var(--mint);
}

.project-subtitle {
  font-size: 0.86rem;
  font-weight: 600;
  color: #6ee7b7;
  margin-top: 3px;
  margin-bottom: 9px;
}

.project-desc {
  font-size: 0.92rem;
  color: var(--text-body);
  line-height: 1.7;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  list-style: none;
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint);
  direction: ltr;
}

/* ==========================================================================
   Education, Languages & Interests
   ========================================================================== */
.edu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .edu-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.edu-card {
  padding: 22px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.edu-card.full-span {
  grid-column: 1 / -1;
}

.edu-card-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mint);
  margin-bottom: 8px;
}

html[lang="fa"] .edu-card-label {
  letter-spacing: 0;
  font-size: 0.85rem;
}

.edu-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 6px;
}

.edu-card-sub {
  font-size: 0.9rem;
  color: var(--text-body);
}

.interest-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.interest-pill {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.11);
  border: 1px solid rgba(94, 234, 212, 0.22);
  color: #d1fae5;
  font-size: 0.83rem;
}

/* ==========================================================================
   Contact Section & Footer
   ========================================================================== */
.contact-lead {
  font-size: 0.98rem;
  color: var(--text-body);
  margin-bottom: 22px;
  max-width: 620px;
}

.contact-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .contact-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.22s ease, background-color 0.22s ease, transform 0.22s ease;
}

.contact-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.contact-card-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--mint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

html[lang="fa"] .contact-card-label {
  letter-spacing: 0;
  font-size: 0.82rem;
}

.contact-card-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-bright);
  direction: ltr;
  text-align: start;
  word-break: break-all;
}

.contact-actions {
  margin-top: 22px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--border-accent);
  background: rgba(52, 211, 153, 0.14);
  color: var(--mint);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.btn-primary:hover {
  background: rgba(52, 211, 153, 0.25);
  box-shadow: 0 0 22px rgba(52, 211, 153, 0.25);
  transform: translateY(-2px);
}

.btn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
}

.site-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.83rem;
  color: var(--text-muted);
  direction: ltr;
}

/* ==========================================================================
   Cute Walking Sprout Mascot (Bottom-Left)
   ========================================================================== */
.mascot-stage {
  position: fixed;
  left: 18px;
  bottom: 12px;
  width: 230px;
  height: 112px;
  z-index: 80;
  pointer-events: none;
  direction: ltr;
}

.mascot-walker {
  position: absolute;
  left: 0;
  bottom: 0;
  will-change: transform;
  pointer-events: auto;
}

.mascot-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  color: inherit;
  transition: transform 0.22s ease;
}

.mascot-btn:hover {
  transform: scale(1.06);
}

/* Speech Bubble above head */
.mascot-bubble {
  position: relative;
  margin-bottom: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(8, 30, 22, 0.95);
  border: 1px solid var(--border-accent);
  color: var(--mint);
  font-family: var(--font-fa);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  transition: background-color 0.22s ease, transform 0.22s ease;
}

html[lang="fa"] .mascot-bubble {
  direction: rtl;
}

.mascot-bubble::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: rgba(8, 30, 22, 0.95);
  border-right: 1px solid var(--border-accent);
  border-bottom: 1px solid var(--border-accent);
}

.mascot-svg {
  display: block;
  overflow: visible;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

/* Flip body horizontally when walking left without flipping speech bubble */
.mascot-flip-group {
  transform-origin: 55px 69px;
  transition: transform 0.28s ease;
}

.mascot-flip-group.facing-left {
  transform: scaleX(-1);
}

/* Walking animations */
.mascot-walker.is-walking .leg-left {
  transform-origin: 43px 97px;
  animation: stepLeft 0.46s ease-in-out infinite alternate;
}

.mascot-walker.is-walking .leg-right {
  transform-origin: 67px 97px;
  animation: stepRight 0.46s ease-in-out infinite alternate;
}

.mascot-walker.is-walking .mascot-torso {
  animation: torsoBob 0.46s ease-in-out infinite alternate;
}

.mascot-sprout-top {
  transform-origin: 55px 38px;
  animation: leafSway 2.8s ease-in-out infinite alternate;
}

.mascot-eyes {
  transform-origin: 55px 66px;
  animation: eyeBlink 4.6s infinite;
}

@keyframes stepLeft {
  0% { transform: translateY(0) rotate(-10deg); }
  100% { transform: translateY(-5px) rotate(12deg); }
}

@keyframes stepRight {
  0% { transform: translateY(-5px) rotate(-12deg); }
  100% { transform: translateY(0) rotate(10deg); }
}

@keyframes torsoBob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-2.6px); }
}

@keyframes leafSway {
  0% { transform: rotate(-4deg); }
  100% { transform: rotate(5deg); }
}

@keyframes eyeBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.08); }
}

/* ==========================================================================
   Chat Panel (Frosted Forest Glass)
   ========================================================================== */
.chat-panel {
  position: fixed;
  left: 18px;
  bottom: 122px;
  width: min(380px, calc(100vw - 36px));
  max-height: min(510px, calc(100vh - 150px));
  z-index: 95;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.72), 0 0 30px rgba(52, 211, 153, 0.12);
  overflow: hidden;
  animation: panelPop 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-panel[hidden] {
  display: none !important;
}

@keyframes panelPop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: rgba(14, 45, 33, 0.72);
  border-bottom: 1px solid var(--border-subtle);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.18);
  border: 1px solid var(--border-accent);
  font-size: 1.05rem;
}

.chat-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.3;
}

.chat-subtitle {
  font-size: 0.73rem;
  color: var(--mint);
  opacity: 0.9;
}

.chat-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-body);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.chat-close-btn:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.06);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 190px;
  max-height: 290px;
}

.chat-msg {
  max-width: 87%;
  padding: 10px 13px;
  border-radius: 13px;
  font-size: 0.86rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-msg.bot {
  align-self: flex-start;
  background: rgba(16, 52, 38, 0.78);
  border: 1px solid var(--border-subtle);
  color: var(--text-bright);
  border-end-start-radius: 4px;
}

.chat-msg.user {
  align-self: flex-end;
  background: rgba(52, 211, 153, 0.22);
  border: 1px solid rgba(94, 234, 212, 0.35);
  color: #ecfdf5;
  border-end-end-radius: 4px;
}

.chat-msg.error {
  align-self: flex-start;
  background: rgba(127, 29, 29, 0.45);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.chat-msg.typing {
  color: var(--mint);
  font-style: italic;
  opacity: 0.9;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 14px 10px;
}

.chat-suggestions[hidden] {
  display: none !important;
}

.suggestion-chip {
  background: rgba(52, 211, 153, 0.11);
  border: 1px solid rgba(94, 234, 212, 0.28);
  color: #d1fae5;
  font-family: inherit;
  font-size: 0.76rem;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  text-align: start;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.suggestion-chip:hover {
  background: rgba(52, 211, 153, 0.22);
  border-color: var(--mint);
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(5, 19, 14, 0.9);
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(12, 36, 26, 0.7);
  color: var(--text-bright);
  font-family: inherit;
  font-size: 0.85rem;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-input:focus {
  outline: none;
  border-color: var(--mint);
}

.chat-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-accent);
  background: rgba(52, 211, 153, 0.2);
  color: var(--mint);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.chat-send-btn:hover:not(:disabled) {
  background: rgba(52, 211, 153, 0.34);
  transform: scale(1.04);
}

.chat-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ==========================================================================
   Reduced Motion Accessibility
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal-hero,
  .reveal-on-scroll {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
}

@media (max-width: 640px) {
  .lang-switcher {
    top: 14px;
    right: 14px;
  }
  .sidebar {
    padding-top: 66px;
  }
  .mascot-stage {
    width: 175px;
    left: 10px;
    bottom: 8px;
  }
  .chat-panel {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 112px;
  }
}
