:root {
  
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-alt: #fbfcfe;
  --border: rgba(23, 26, 36, 0.09);
  --border-strong: rgba(23, 26, 36, 0.16);
  --text: #181b26;
  --text-muted: #565d6e;
  --text-faint: #8f97a6;
  --accent: #3b5bfd;
  --accent-strong: #2c3fd6;
  --accent-2: #2c3fd6;
  --accent-tint: rgba(59, 91, 253, 0.08);
  --accent-tint-strong: rgba(59, 91, 253, 0.18);
  --accent-glow: rgba(59, 91, 253, 0.20);
  --accent-glow-strong: rgba(59, 91, 253, 0.35);
  --success: #3b5bfd;
  --success-shadow: rgba(59, 91, 253, 0.16);
  --success-shadow-faint: rgba(59, 91, 253, 0.06);
  --gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  --gradient-hero: linear-gradient(120deg, var(--accent-strong) 0%, var(--accent) 100%);

  --shadow-sm:
    0 1px 2px rgba(23, 26, 36, 0.05);
  --shadow-md:
    0 1px 2px rgba(23, 26, 36, 0.04),
    0 12px 28px rgba(23, 26, 36, 0.07);
  --shadow-lg:
    0 2px 4px rgba(23, 26, 36, 0.05),
    0 22px 44px rgba(23, 26, 36, 0.10);
  --shadow-cta:
    0 10px 24px rgba(59, 91, 253, 0.28);

  --header-height: 72px;
  --container-max: 1200px;
  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --font-sans: "Vazirmatn", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, "Courier New", monospace;

  --section-pad: clamp(64px, min(8vw, 10svh), 108px);
  --page-gutter: clamp(16px, 4vw, 36px);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-scroll: cubic-bezier(0.45, 0, 0.55, 1);
  --dur-fast: 0.16s;   
  --dur-base: 0.26s;   
  --dur-slow: 0.4s;    
  --dur-reveal: 0.6s;  
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

*:not(input):not(textarea):not([contenteditable="true"]) {
  user-select: none;
  -webkit-user-select: none;
}

html.font-loading body {
  opacity: 0;
  transition: none;
}

html.font-loaded body {
  opacity: 1;
  transition: opacity 0.3s var(--ease);
}

html {
  overflow-x: clip;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  direction: rtl;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("../assets/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("../assets/fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("../assets/fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

body {
  min-width: 0;
  overflow-x: clip;
  direction: rtl;
  unicode-bidi: plaintext;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
a {
  touch-action: manipulation;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.section-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: clamp(44px, 5vw, 60px);
}

.section-kicker {
  display: inline-flex;
  align-items: center;
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 500;
}

.section-eyebrow::after {
  content: "";
  width: 44px;
  height: 1px;
  background: var(--border-strong);
}

.section-title {
  position: relative;
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.section-title::before,
.section-title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.section-title.is-glitching::before {
  opacity: 0.55;
  color: rgba(244, 63, 94, 0.75);
  animation: title-glitch-red 0.16s steps(2, end) infinite;
}

.section-title.is-glitching::after {
  opacity: 0.55;
  color: rgba(34, 211, 238, 0.75);
  animation: title-glitch-cyan 0.16s steps(2, end) infinite;
}

@keyframes title-glitch-red {
  0%   { clip-path: inset(0 0 84% 0);  transform: translateX(-2px); }
  25%  { clip-path: inset(18% 0 58% 0); transform: translateX(-5px); }
  50%  { clip-path: inset(52% 0 24% 0); transform: translateX(-1px); }
  75%  { clip-path: inset(72% 0 4% 0);  transform: translateX(-4px); }
  100% { clip-path: inset(0 0 84% 0);  transform: translateX(-2px); }
}

@keyframes title-glitch-cyan {
  0%   { clip-path: inset(30% 0 52% 0); transform: translateX(2px); }
  25%  { clip-path: inset(64% 0 14% 0); transform: translateX(5px); }
  50%  { clip-path: inset(8% 0 76% 0);  transform: translateX(1px); }
  75%  { clip-path: inset(44% 0 36% 0); transform: translateX(4px); }
  100% { clip-path: inset(30% 0 52% 0); transform: translateX(2px); }
}

.projects-accent {
  color: var(--accent-strong);
}

.hero,
.about,
.contact {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-inner,
.about-inner,
.contact-inner {
  width: 100%;
  min-width: 0;
}

main,
section,
figure,
article,
header,
footer {
  min-width: 0;
}

.js-reveal .project-row,
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.42s var(--ease-out),
    transform 0.42s var(--ease-out);
}

.js-reveal .project-row.is-visible,
.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
}

.js-reveal .about-essay.is-visible .about-profile {
  animation: essay-editorial-in 0.7s var(--ease-out) 0.15s both;
}

@keyframes essay-editorial-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.desktop,
.about-craft-window,
.contact-terminal {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #161a24 0%, #0e1118 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    var(--shadow-lg);
}

.desktop-window-bar,
.about-craft-bar,
.contact-terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.desktop-window-title,
.about-craft-title,
.contact-terminal-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #9aa4b8;
}

.desktop-window-controls,
.about-craft-controls,
.contact-terminal-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.62rem;
  color: #8791a6;
}

.win-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.win-minimize::before {
  content: "";
  display: block;
  width: 8px;
  height: 1px;
  background: currentColor;
}

.win-maximize::before {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
}

.win-close {
  color: #f38ba8;
}

.win-close::before {
  content: "\2715";
}

.code-cursor {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: cursor-blink 1.1s steps(2, start) infinite;
}

@keyframes cursor-blink {
  50% { opacity: 0; }
}

@keyframes dot-pulse {
  0%,
  100% { box-shadow: 0 0 6px 1px var(--success-shadow); }
  50%   { box-shadow: 0 0 12px 2px var(--success-shadow-faint); }
}

.about-heading,
.contact-heading {
  margin-bottom: clamp(40px, 5vw, 64px);
}

.about-heading .section-title,
.contact-heading .section-title {
  font-size: clamp(1.95rem, 3.6vw, 2.7rem);
  text-wrap: balance; 
}

.about-accent,
.contact-accent {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.about-essay,
.contact-essay {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(230px, 0.85fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: start;
  margin-bottom: clamp(56px, 6vw, 80px);
}

.contact-essay-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.contact-essay-lead {
  color: var(--text);
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  font-weight: 500;
  line-height: 2.05;
}

.contact-mark {
  font-weight: 700;
  color: var(--accent-strong);
  background-image: linear-gradient(180deg, transparent 62%, var(--accent-tint-strong) 62%);
  padding: 0 3px;
  border-radius: 2px;
}

.contact-essay-body {
  margin-top: 18px;
  max-width: 52ch;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 2;
}

:where(button, a, input, textarea, select, summary, [tabindex]):focus:not(:focus-visible) {
  outline: none;
}

:where(button, a, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--surface),
              0 0 0 4px var(--focus-ring),
              0 0 16px var(--focus-ring-shadow);
}

.hero,
.navbar,
.about,
.contact {
  --accent: #3b5bfd;
  --accent-strong: #2c3fd6;
  --accent-2: #2c3fd6;
  --accent-tint: rgba(59, 91, 253, 0.08);
  --accent-tint-strong: rgba(59, 91, 253, 0.18);
  --accent-glow: rgba(59, 91, 253, 0.20);
  --accent-glow-strong: rgba(59, 91, 253, 0.35);
  --success: #3b5bfd;
  --success-shadow: rgba(59, 91, 253, 0.16);
  --success-shadow-faint: rgba(59, 91, 253, 0.06);
  --gradient: linear-gradient(135deg, #3b5bfd 0%, #2c3fd6 100%);
  --gradient-hero: linear-gradient(120deg, #2c3fd6 0%, #3b5bfd 100%);
  --shadow-cta: 0 10px 24px rgba(59, 91, 253, 0.28);
}

.hero .section-title.is-glitching::before,
.about .section-title.is-glitching::before,
.contact .section-title.is-glitching::before {
  color: rgba(59, 91, 253, 0.65);
}

.hero .section-title.is-glitching::after,
.about .section-title.is-glitching::after,
.contact .section-title.is-glitching::after {
  color: rgba(109, 139, 255, 0.65);
}

.projects .section-eyebrow,
.projects .projects-accent,
.projects .projects-empty-mark,
.projects .projects-empty-category {
  --accent: #3b5bfd;
  --accent-strong: #2c3fd6;
}

.contact .contact-cta:hover,
.contact .contact-cta:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 14px 30px rgba(59, 91, 253, 0.34);
}

.hero .hero-cta:hover,
.hero .hero-cta:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 16px 34px rgba(59, 91, 253, 0.36);
}

@media (max-width: 600px) {

  .section-heading {
    gap: 12px;
    margin-bottom: 32px;
  }

  .about-heading,
  .contact-heading {
    margin-bottom: 36px;
  }

  .about-heading .section-title,
  .contact-heading .section-title {
    font-size: clamp(1.55rem, 7vw, 2rem);
  }

  .about-essay,
  .contact-essay {
    gap: 28px;
    margin-bottom: 44px;
  }

}

/* Motion is intentionally always on: the site's animations and transitions keep
   running even when the device has animations turned off
   (prefers-reduced-motion), so the page never appears frozen. */

.js-scrollbar {
  scrollbar-width: none; 
}

.js-scrollbar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.js-scrollbar::-webkit-scrollbar-track,
.js-scrollbar::-webkit-scrollbar-thumb {
  background: transparent;
}

.scrollbar {
  position: fixed;
  top: 0;
  right: -3px;
  z-index: 1000;
  width: 18px;
  height: 100%;
  pointer-events: none;
}

.scrollbar-hit {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  cursor: default;
  touch-action: none;
}

.scrollbar-thumb {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -3px;
  width: 6px;
  border-radius: var(--radius-pill);
  --scrollbar-gradient: linear-gradient(135deg, #3b5bfd 0%, #2c3fd6 100%);
  background: var(--scrollbar-gradient);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), background 0.35s var(--ease);
  will-change: transform, background;
}

.scrollbar.is-visible .scrollbar-thumb {
  opacity: 0.45;
}

.scrollbar.is-active .scrollbar-thumb {
  opacity: 0.95;
}

.scrollbar.is-active .scrollbar-hit {
  cursor: grab;
}

.scrollbar.is-dragging .scrollbar-hit {
  cursor: grabbing;
}

@media (pointer: coarse) {
  .scrollbar {
    display: none;
  }
}

html.js-cursor,
html.js-cursor * {
  cursor: none !important;
}

.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background-color 0.2s var(--ease);
  will-change: transform;
}

.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9998;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background-color 0.2s var(--ease),
              border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  will-change: transform;
}

body.is-cursor-active .cursor-dot,
body.is-cursor-active .cursor-ring {
  opacity: 1;
}

body.is-cursor-hover .cursor-ring {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 2px 10px color-mix(in srgb, var(--accent) 12%, transparent);
}

@supports not (backdrop-filter: blur(1px)) {
  body.is-cursor-hover .cursor-ring {
    background: var(--accent-tint-strong);
    background-color: var(--accent-tint-strong);
  }
}

body.is-cursor-hover .cursor-dot {
  background: var(--accent-strong);
}
